diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index 44d23bc377..7a749418b1 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -125,6 +125,24 @@ flowchart LR | Bound | Deleting | a deletion reservation; the id is never created again | `core/host/master/services.go` `MarkVolumeDeleting` | `INV-VOL-ID-NO-REUSE-001` | | any authority line | DeleteReserved (permanent) | the existing lifecycle reservation is committed durably; then `mu -> leaseMu` publishes the exclusion. Publication, move issue, first grant, expired re-grant, renewal and background horizon extension check it under their writer lock. Restart reloads every committed exclusion before serving. Deleting HEAD requires the persisted lease horizon and restart deadline plus skew to have ended, including unclaimed grants; the check returns a refusal rather than waiting | `core/authority/workspace_delete_reservation.go` `ReserveWorkspaceDeletion`, `NoLiveWorkspaceLease`; `core/host/master/volume_delete_authority.go`; `host.go` `New` | `INV-SNAPK-DELETE-GATE-001` | +**Volume creation phase, in blockmaster's store record** (`core/host/master/store_attestation.go`, decided by `inCreationPhase` in `core/host/master/product_loop.go`). Every replacement entry (both promotion gates, the operator's failover and planned move, the rebalance) acts only on Established. + +```mermaid +stateDiagram-v2 + [*] --> AwaitingStores: first bind of a new volume (record opened with its initial replicas) + AwaitingStores --> AwaitingStores: the write that ends the wait fails (still held, reported as one store awaited) + AwaitingStores --> AwaitingEnd: every current replica's store attested (written durably) + AwaitingEnd --> Established: first of the primary's ready answer, or a survivor's DurableLSN > 0 at the line (written durably) + Established --> Established: later answers reopen nothing +``` + +| From | To | Event and guard | Enforced in | Protects | +|---|---|---|---|---| +| (none) | AwaitingStores | the master binds a volume for the first time; the record lists its initial replicas | `core/host/master/store_attestation.go` `openStoreRecord`, `open` | `INV-PROMOTE-CREATION-WAIT-001` | +| AwaitingStores | AwaitingEnd | every current replica has an attested store; Initial is cleared and `awaiting_first_ready` set in one durable write; a failed write leaves the record as it was and the volume held | `core/host/master/store_attestation.go` `awaited` | `INV-PROMOTE-CREATION-WAIT-001` | +| AwaitingEnd | Established | the line's primary answers ready, or a survivor answers DurableLSN > 0 with its epoch-table row at the current epoch (or none), in any probe; recorded durably and for good | `core/host/master/product_loop.go` `inCreationPhase`, `firstReadyNow`, `survivorHoldingAWrite`; `core/host/master/store_attestation.go` `noteFirstReady` | `INV-PROMOTE-CREATION-WAIT-001` | +| AwaitingStores, AwaitingEnd | (no change) | no replacement decision: no reassign, fencing round, heal, operator move or rebalance; also while the primary's own answer says its assignment at the line's epoch awaits the stores | `core/host/master/product_loop.go` `holdCreating`, `noteCreating`; `core/host/master/planned_move.go` `plannedMoveEvidenceAt`, `fencedMoveEvidence` | `INV-PROMOTE-CREATION-WAIT-001` | + **Workspace lease and move, in blockmaster.** TERM-HOLDER-001 uses one owner decision, `PublishedLine.Owner` (core/authority),