From 19195503eb5d4b77cc9217bc8a90a11a024d16df Mon Sep 17 00:00:00 2001 From: pingqiu Date: Wed, 18 Nov 2026 22:57:17 -0800 Subject: [PATCH] chore: keep public PR changes to implementation and tests --- seaweed-block/docs/design/agent-workspace-design.md | 1 - seaweed-block/docs/design/invariants.md | 10 +--------- seaweed-block/docs/spec/CutPipeline.tla | 5 ----- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/seaweed-block/docs/design/agent-workspace-design.md b/seaweed-block/docs/design/agent-workspace-design.md index bef22a0ab8..48b9ca7a58 100644 --- a/seaweed-block/docs/design/agent-workspace-design.md +++ b/seaweed-block/docs/design/agent-workspace-design.md @@ -126,7 +126,6 @@ Per volume, under the chunk base directory in the filer (`core/frontend/chunksto 5. **LSN guard:** if H is below HEAD's `RemoteLSN`, refuse (`lsn_behind`). 6. **Diff:** upload only chunks whose SHA-256 differs from HEAD; drop all-zero chunks from the map. 7. **Intent first:** write an intent naming every key, then upload in parallel (`UploadConcurrency`, `--chunk-upload-concurrency`, default 8, 1 to 64). - Failed chunk uploads retry the same immutable key and captured bytes with 100 ms exponential backoff capped at 2 s. Resolve a possibly committed binding by exact-byte read-back before replay; a mismatch refuses the cut. All retries share a five-minute cut execution budget, shortened by the caller deadline. Queued lock wait and a remote ignoring cancellation are not forcibly terminated: workers remain joined before buffers/intents settle. Failure preserves dirt. HEAD CAS is never blindly replayed by this upload retry. 8. **Manifest:** build segments; new segments are also covered by an intent before upload (`PrepareManifest`). 9. **Re-admit** right before the CAS; fence if a superseding holder owns HEAD (`supersededBy`). 10. **CAS** HEAD on `{gen, epoch}` with `RemoteLSN = H`. On success, drop the intents and settle unchanged owned-map versions, keeping post-cut dirt. diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index e9dcfa760e..b032a37af0 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -194,8 +194,6 @@ stateDiagram-v2 Aborted --> Refused: drain owners, cleanup, merge candidates Copy --> Refused: H below HEAD RemoteLSN Closed --> Upload: drain and cleanup; intent durable first - Upload --> Upload: retry one immutable key after backoff - Upload --> Refused: shared deadline/cancel or mismatching binding Upload --> Manifest Manifest --> Readmit Readmit --> Fenced: superseding HEAD @@ -215,7 +213,7 @@ stateDiagram-v2 | Quiesce | the capture barrier (`captureMu`) is held exclusively, then `Sync` fixes H; `Recover` and writes hold the barrier shared | `core/storage/chunk_layer.go` `captureLocked`; `core/storage/walstore.go` `WALStore.Recover`, `WALStore.Write` | `INV-CUT-QUIESCED-001`, `INV-CUT-RECOVER-BARRIER-001` | | Copy | every candidate chunk (native owned LSN map relative to HEAD plus retained WAL/in-memory dirt; legacy bitmap/hash mode) is read into buffers; a staged copy is reused only if unchanged since staging; native copy occurs after barrier release with pre-publication COW ownership | `core/storage/chunk_layer.go` `captureLocked` | `INV-CUT-QUIESCED-001`, `INV-CUT-STAGED-REUSE-001`, `INV-CUT-BITMAP-001` | | LSN guard | refuse when H is below HEAD's `RemoteLSN` (`lsn_behind`) | `core/storage/chunk_layer.go` `captureLocked` | `INV-WS-HEAD-MONOTONE-001` | -| Upload | upload changed chunks after a durable intent names their write-once keys; retry one key under the shared five-minute cut execution deadline (or shorter caller deadline); resolve ambiguous bindings by exact-byte read-back before replay | `core/storage/chunk_layer.go` `captureLocked`; `core/frontend/chunkstore/chunk_remote.go` `putObject` | `INV-CUT-INTENT-FIRST-001`, `INV-CHUNK-WRITE-ONCE-001` | +| Upload | upload only chunks whose SHA-256 differs from HEAD, under fresh write-once keys, after a durable intent names them | `core/storage/chunk_layer.go` `captureLocked`; `core/frontend/chunkstore/chunk_remote.go` `putObject` | `INV-CUT-INTENT-FIRST-001`, `INV-CHUNK-WRITE-ONCE-001` | | Manifest | rewrite only segments whose references changed; new segments are covered by an intent | `core/frontend/chunkstore/manifest.go` `PrepareManifest` | `INV-CUT-SEGMENT-REUSE-001`, `INV-CUT-INTENT-FIRST-001` | | No-op cut | when nothing changed since HEAD, no CAS is sent, but HEAD is re-read; a HEAD that moved fences the holder | `core/storage/chunk_layer.go` `captureLocked` | `INV-WS-HEAD-CAS-001` | | Readmit | admission is checked again right before the CAS; a superseding HEAD fences | `core/storage/chunk_layer.go` `admit`, `supersededBy` | `INV-WS-HEAD-CAS-001` | @@ -471,12 +469,6 @@ Notes: |---|---|---|---|---|---|---| | `INV-NVME-H2C-RANGE-001` | An H2CData range exceeding the expected transfer size is refused before slicing, including a uint32 offset-plus-length overflow; an exact-bound payload is preserved. | Frontend H2C receive validation; no storage state transition | `core/frontend/nvme/session.go` `recvH2CData` | `TestRecvH2CDataRangeBounds` (`core/frontend/nvme/h2c_bounds_test.go`) | — | ACTIVE | -### Cut upload retry - -| ID | Status | Invariant | Enforced in | Tests | Model | -|---|---|---|---|---|---| -| INV-CUT-UPLOAD-RETRY-001 | ACTIVE | A failed chunk upload retries the same key and captured bytes, keeps its intent, and cannot advance HEAD before completion; cancellation preserves dirt. | `chunk_upload.go` `putCaptured`; `chunk_layer.go` `captureLocked` | `TestChunkCutRetriesOnlyTheFailedUpload`, `TestChunkCutUploadCollisionNeverPublishes`, `TestChunkCutUploadRetryHonorsDeadlineAndRetainsDirt` | M5; retry stutters in abstract `CutPipeline`; timing and ambiguity are qualified by native tests. | - ## Part C. Change rules How a fix or a feature is calibrated against this model: diff --git a/seaweed-block/docs/spec/CutPipeline.tla b/seaweed-block/docs/spec/CutPipeline.tla index 166f466a8f..40367a642d 100644 --- a/seaweed-block/docs/spec/CutPipeline.tla +++ b/seaweed-block/docs/spec/CutPipeline.tla @@ -13,11 +13,6 @@ (* chunk is compared against HEAD; cuts are refused ("reconciling") *) (* until the compare finishes (chunk_layer.go:95); *) (* - a crash before the root CAS leaves only orphan uploads. *) -(* Per-object upload retries retain the same key/bytes and intent. Failed *) -(* attempts make no abstract state change (Spec permits stuttering); the *) -(* atomic Cut below still requires all objects before HEAD publication. *) -(* Backoff/deadline timing and ambiguous-reply byte checks are qualified *) -(* by native TestChunkCut*Upload* controls, not by this abstraction. *) (* Chunk content = the LSN of the write it holds. *) (***************************************************************************) EXTENDS Integers, FiniteSets, Sequences, TLC