From 71f5b6f4409dd18987fbfb1b47f86337133a67b0 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 4 Dec 2026 21:27:07 -0800 Subject: [PATCH] seaweed-block: invariants rows for the store record wait The wait-site row still gave the read a 10 s bound ending in exit 75 and a unit restart. It now waits while blockmaster gives no reply and ends on an answer or a signal. INV-WALSTORE-NO-EMPTY-STORE-001 names the new unit test. Co-Authored-By: Claude Opus 5.5 --- seaweed-block/docs/design/invariants.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index 6d616638b6..24b4a924d8 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -1083,7 +1083,7 @@ Notes: | `INV-WS-FORCED-CONFIRM-NO-BYPASS-001` | No force-move flag bypasses the confirmation, and `--dry-run` is never a confirmation: it sends only a preview, which needs the same confirmation. | M2 lease: Expired → Moved (forced) (the explicit-force guard) | `cmd/sw-block/workspace.go` `runWorkspaceForceMove`, `workspacePreview`; `core/rpc/wsclient/wsclient.go` `PreviewForcedMove` | `TestWorkspaceForceMove_Row2_DryRunPreview`, `TestWorkspaceHelpText` (`cmd/sw-block/workspace_test.go`) | — | ACTIVE | | `INV-ATTACH-ASSIGNMENT-BOUND-001` | Without a master wait, the assignment allowance is checked between attach attempts; it never cancels a granted attempt's manifest read. Per-fetch bounds, recovery progress and provider Close still apply. | M1 Recovering to Serving (wait scheduling only) | `DurableProvider.chunkAuthorityWait` | `TestDefaultAttachAt262144EntriesOutlivesAssignmentWait`, `TestDefaultGrantedAttachFailureEndsAtAssignmentAllowance` (`core/frontend/durable/default_attach_attempt_test.go`); `TestRestoreDeferredAssignmentWaitEndsOnDeadlineAndClose` (`core/frontend/durable/provider_assignment_test.go`) | none (scheduling; authority guards unchanged) | ACTIVE | | `INV-WS-STARTUP-RETRY-001` | A workspace primary exits 75 on assignment timeout or lease expiry after bounded cleanup. A master fact newer than nonzero observed-own, or an exact foreign HEAD at/above the assigned epoch, permits 78. Newer HEAD/store format: 78. ACK and signal keep normal exit; lease and claim gates never relax. | M2 restart | `cmd/blockvolume/process_exit.go` `superviseProcess`, `workspaceRetryOutcome`; `core/frontend/durable/provider_layout.go` `startLayoutRoot`; `core/frontend/durable/provider_startup.go` `ChunkStartupIdentityRefused`, `ChunkStartupNewerVersion`, `endChunkStartup`; `cmd/blockvolume/process_exit.go` `chooseChunkStartupExit`, `durableOpenFatalExit` | `TestANewerHeadVersionExits78NotRestartable`, `TestAStoreOfANewerFormatExits78` (`cmd/blockvolume/newer_version_exit_test.go`); `TestChunkStartupNewerVersionIsGenerationBound` (`core/frontend/durable/provider_startup_internal_test.go`); `TestChunkAssignmentTimeoutExposesCurrentRecoveryOutcome` (`core/frontend/durable/provider_startup_outcome_test.go`); `TestChunkStartupOutcomeRejectsOldGenerationAndCoalescesWake` (`core/frontend/durable/provider_startup_internal_test.go`); `TestWorkspaceDisplacedClaimUsesAssignedEpoch`, `TestWorkspaceRetryUsesNewestOwnAssignment`, `TestWorkspaceForeignHeadClaimChoosesNoRetry`, `TestWorkspaceOldLocalHolderForeignHeadChoosesNoRetry` (`cmd/blockvolume/process_exit_authority_test.go`); `TestWorkspaceExitFirstOutcomeIsLatched`, `TestWorkspaceExitDoesNotWaitForBlockedFrontendClose`, `TestWorkspacePlannedStopKeepsSuccess` (`cmd/blockvolume/process_exit_test.go`) | Existing WorkspaceRegrant restart transition; no new grant rule | ACTIVE | -| `INV-WALSTORE-NO-EMPTY-STORE-001` | A plain walstore holder (single replica, or a replicated volume's line primary) creates its store only on the master's creating answer. Once its store is recorded, or its volume predates attestation, a missing store exits 78 store_lost; an unreadable record exits 75. Neither writes anything. | Holder startup, before the durable open | `cmd/blockvolume/store_admission.go` `decideStoreAdmission`; `cmd/blockvolume/main.go` `runVolume` (before `InitReplicaFloor`); `core/host/master/store_attestation.go` `GetReplicaStore`, `ReplicaStoreState`; `core/frontend/durable/provider.go` `openOrCreate` (`ErrLostStore`) | `TestRF1HolderOnAWipedStateDirectoryRefusesStoreLost` (`cmd/blockvolume/rf1_store_lost_test.go`, process-level); `TestBlockvolumeAsksTheMasterBeforeCreatingItsStore` (`cmd/blockvolume/lost_store_exit_test.go`); `TestStoreAdmissionCreatesOnlyOnAnExplicitCreatingAnswer` (`cmd/blockvolume/store_admission_test.go`); `TestRF3WipedPrimaryRefusesAndASurvivorServesItsData` (`cmd/blockvolume/rf3_primary_store_lost_test.go`, process-level); `TestGetReplicaStoreAnswersFromTheMastersCreationFact` (`core/host/master/get_replica_store_test.go`); `TestGetReplicaStoreAnswersAReplicatedPrimaryFromItsOwnStore` (`core/host/master/primary_store_answer_test.go`); `TestAnEndedVolumeWithoutItsStoreRefusesAndCreatesNothing` (`core/frontend/durable/lost_store_test.go`) | MasterCreate NoEmptyHeadOverLineage projected onto the holder's local store (mutant RecreateWhenReady, here recreate_when_ended); CreateEvid2 creation fact; KnownZero (walstore has no HEAD to hydrate from). A replicated volume's non-primary replica keeps the peer rebuild: a fresh store has no durable LSN and is not the recorded store, so it never counts as a survivor or a promotion candidate | STUB | +| `INV-WALSTORE-NO-EMPTY-STORE-001` | A plain walstore holder (single replica, or a replicated volume's line primary) creates its store only on the master's creating answer. Once its store is recorded, or its volume predates attestation, a missing store exits 78 store_lost; an unreadable record exits 75. Neither writes anything. | Holder startup, before the durable open | `cmd/blockvolume/store_admission.go` `decideStoreAdmission`; `cmd/blockvolume/main.go` `runVolume` (before `InitReplicaFloor`); `core/host/master/store_attestation.go` `GetReplicaStore`, `ReplicaStoreState`; `core/frontend/durable/provider.go` `openOrCreate` (`ErrLostStore`) | `TestRF1HolderOnAWipedStateDirectoryRefusesStoreLost` (`cmd/blockvolume/rf1_store_lost_test.go`, process-level); `TestBlockvolumeAsksTheMasterBeforeCreatingItsStore` (`cmd/blockvolume/lost_store_exit_test.go`); `TestReadReplicaStoreWaitsOnlyWhileTheMasterGivesNoReply` (`cmd/blockvolume/store_record_wait_test.go`); `TestStoreAdmissionCreatesOnlyOnAnExplicitCreatingAnswer` (`cmd/blockvolume/store_admission_test.go`); `TestRF3WipedPrimaryRefusesAndASurvivorServesItsData` (`cmd/blockvolume/rf3_primary_store_lost_test.go`, process-level); `TestGetReplicaStoreAnswersFromTheMastersCreationFact` (`core/host/master/get_replica_store_test.go`); `TestGetReplicaStoreAnswersAReplicatedPrimaryFromItsOwnStore` (`core/host/master/primary_store_answer_test.go`); `TestAnEndedVolumeWithoutItsStoreRefusesAndCreatesNothing` (`core/frontend/durable/lost_store_test.go`) | MasterCreate NoEmptyHeadOverLineage projected onto the holder's local store (mutant RecreateWhenReady, here recreate_when_ended); CreateEvid2 creation fact; KnownZero (walstore has no HEAD to hydrate from). A replicated volume's non-primary replica keeps the peer rebuild: a fresh store has no durable LSN and is not the recorded store, so it never counts as a survivor or a promotion candidate | STUB | | `INV-WS-SERVE-AFTER-OWN-STORE-001` | A new volume's primary acknowledges no write until the master has recorded every initial replica's store, its own included (a single-replica volume waits for its own). So a replica's recorded store precedes every write it acknowledges. | Volume creation: stores awaited, then Serving | `core/host/master/store_attestation.go` `awaited`; `core/host/master/services.go` `assignmentFact`; `core/host/volume/workspace_startup.go` `ReplicaStoresAwaited`; `core/host/volume/projection_bridge.go` `replicaStoresAwaited` | `TestAnRF1PrimaryAwaitsItsOwnStoreBeforeServing` (`core/host/master/primary_store_answer_test.go`); `TestNewVolumeAssignmentWaitsForReplicaAttestations` (`core/host/master/store_record_wait_test.go`); `TestNewVolumePrimaryServesNothingBeforeReplicaAttestations` (`core/host/volume/replica_stores_wait_test.go`) | CreateEvid2: a recorded store may hold acknowledged data, which is what lets `INV-WALSTORE-NO-EMPTY-STORE-001` read a recorded store as creation ended | ACTIVE | | `INV-WS-MASTER-WAIT-001` | Startup waits without a bound while the master gives no reply or refuses credentials or identity; after contact it ends 30 s beyond the later of recovery's first reply or the master barrier. Typed MOVED or DELETED ends it with 78, including a confirmed moved source without an own assignment. | M2 Awaiting assignment → Process exited | `core/host/volume/master_wait.go` `masterWait` (contact from heartbeat, stream and renewal results; the refusal kind from the status detail only); `core/frontend/durable/provider_chunk.go` `chunkAuthorityWait` (`ChunkMasterWait`); `cmd/blockvolume/process_exit.go` `chooseChunkStartupExit`; `core/host/master/workspace_service.go` `leaseRefusal`, `renewalMoved`; `core/authority/workspace.go` `WorkspaceSourceMoved`; `core/host/master/services.go` `SubscribeAssignments`; `core/authority/workspace_lease_view.go` `LeaseBarrierError`; `core/host/volume/workspace_lease.go` `renewDelay` (sleeps until just past the barrier time, jittered, at most 2 min; then a 200 ms poll for 5 s); `core/rpc/link/link.go` `MasterReconnect` | `TestChunkAuthorityWaitStartsAtFirstContact`, `TestLeaseGuardSleepsUntilTheBarrier`, `TestStatusShowsTheMasterWait`, `TestCredentialsRefusedForAnHourWaitsAndLogs`, `TestHeartbeatLogsTheMasterWait`, `TestFlappingMasterNeverExpiresEarly` (`core/host/volume/master_wait_test.go`); `TestMasterLinkReconnectsWithinTwoSeconds` (`core/host/volume/master_reconnect_test.go`); `TestChunkAuthorityWaitFollowsTheMasterWait`, `TestChunkAuthorityWaitPassesItsOwnStart`, `TestChunkGrantedAttachThatKeepsFailingIsBounded`, `TestChunkAuthorityWaitAttachesAGrantOnTheBoundsTick` (`core/frontend/durable/provider_master_wait_test.go`); `TestIdentityRefusalWaitsVisibly`, `TestChunkAuthorityWaitAfterASlowOpenGetsItsFullLimit`, `TestIdentityRefusalEndsAndDecays` (`core/host/volume/master_wait_test.go`); `TestIdentityRefusalEndsOnADeliveredAssignment` (`cmd/blockvolume/process_exit_authority_test.go`); `TestIdentityRefusalIsTyped` (`core/host/master/workspace_lease_refusal_kind_test.go`); `TestLeaseRefusalKinds`, `TestRenewalReplicaMismatchAtOlderLineEpochIsOther` (`core/host/master/workspace_lease_refusal_kind_test.go`); `TestChunkStartupExitFinalGives78`, `TestRestartedMovedSourceExits78WithoutAnOwnLine` (`cmd/blockvolume/process_exit_authority_test.go`); `TestWorkspaceSourceMovedProof`, `TestMovedSourceProofCallers`, `TestMasterWaitFinalSites`, `TestMovedAssignmentStreamIsFinalWithoutAnyOwnAssignment`; also in `core/authority/workspace_source_moved_test.go`, `core/host/master/workspace_moved_source_guard_test.go` | Real systemd moved-source and prestarted-target controls remain qualification gates. | ACTIVE | @@ -1529,7 +1529,7 @@ One row per wait in the data and control paths. Guest-visible rows on one path m | Site | Waits for | Bound | Owner that ends it | On expiry | Lock held while waiting | Guest-visible | |---|---|---|---|---|---|---| -| `cmd/blockvolume/main.go` `runVolume`, `Host.ReplicaStoreRecord` (one call before the durable open of a plain walstore holder) | the master's `GetReplicaStore` answer | `replicaStoreQueryTimeout` (10 s) | the call's own context | exit 75 `store_record_unreadable`, nothing written; the supervisor restarts the unit | none | no (no frontend has started) | +| `cmd/blockvolume/store_admission.go` `readReplicaStore` (from `runVolume`, before the durable open of a plain walstore holder) | the master's `GetReplicaStore` answer | none while blockmaster gives no reply (`volume.MasterCallClass`); each read `replicaStoreQueryTimeout` (10 s), reads `replicaStoreRetryEvery` (2 s) apart | the master's answer, or a signal (`processExit.parent`) | none: an answer goes to `decideStoreAdmission` (an unreadable record exits 75 `store_record_unreadable`), nothing written while waiting | none | no (no frontend has started) | | `core/storage/chunk_publish_settled.go` `runPublishSettled` (from `unlockCap`, on the cut or detach caller's goroutine) | the `OnPublishSettled` hook to return | the hook's duration: the hook must return without blocking and without remote calls, enqueueing its work to its own worker | the hook implementer | none: a stalled hook stalls its caller, and later reports queue without a bound (a nil hook queues nothing) | none (`capMu` and `stMu` released) | yes on detach (the detach caller delivers before returning) | | `cmd/blockvolume/frontend_gate.go` `awaitFrontendStart` (from `runVolume`, before any frontend starts) | the backend's first admitted I/O (`StorageBackend.FirstServing`), or the process's stop waiter returning | none of its own: it ends on the stop waiter, which INV-WS-STARTUP-RETRY-001 bounds (a refused or timed-out claim latches exit 75/78) | `runVolume` (`INV-FE-PRIMARY-READY-OPERATIONAL-001`) | no frontend starts; shutdown as after the frontends | none | no (no target listens yet) | | `cmd/blockvolume/frontend_gate.go` `firstAdmitted` (one goroutine from `runVolume`, workspace chunk primaries only) | the backend's first admitted I/O (`FirstServing`), then `AdmitsIO` passing, re-checked every 50 ms (the backend has no projection-change signal) | until first served or the process outcome (`e.done`), whichever comes first | the process exit owner (`superviseProcess`) through `e.done` | none: it ends without starting the frontends | none | no (no target listens yet) |