From 91abc295c232e5241bff99c1ee879abdefb8b62e Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sat, 5 Dec 2026 17:02:17 -0800 Subject: [PATCH] seaweed-block: docs: the host check matches what --version prints; the guarantees name the latest report Review: blockvolume --version prints 'revision= modified=<...>', not a release number. The hard-rule check now compares every running process's and every unit binary's line with the installed v1.1.x binary's, and stops on another revision, modified=true or unknown, an error or no output. The 30 s wait is described as usually catching a missed process, not guaranteed to; the residual says a delayed report can come from a stopped old process and grounds safety in which process can still serve. The finalize ledger rows require the latest received report. Co-Authored-By: Claude Opus 5.5 --- seaweed-block/docs/design/invariants.md | 6 ++--- seaweed-block/docs/operations-manual.md | 33 ++++++++++++++++--------- seaweed-block/docs/releases/v1.1.2.md | 3 ++- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index 1befdf7ea4..627c5c91a1 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -785,8 +785,8 @@ stateDiagram-v2 | From | To | Guard / action | Enforced in | Invariant | |---|---|---|---|---| -| Level 0 | Finalizing | Preserve the existing known-old work check. Under Publisher mu then leaseMu, exclude unserved lines, clean ACKed releases and proven-ended leases; require each remaining current process's own level-1 report and set the admission intent. Report changes invalidate captured proofs. | `core/authority/format_finalize.go` `BeginFormatFinalize`; `core/host/master/format_gate.go` `FinalizeFormat` | `INV-FMT-FINALIZE-001` | -| Finalizing | Finalizing | Move and publication are placement: refuse only known-old targets. First serving deadlines, live renewals and regrants require the current process's level-1 report during intent and at level 1. A stored move lease alone permits no serving. Capable renewals stay memory-only; no grant lock spans the durable write. | `core/host/master/workspace_binding.go` `admitWorkspacePublication`; `core/authority/workspace_lease_view.go` `firstWorkspaceGrant`, `regrantWorkspaceLease` | `INV-FMT-FINALIZE-001`, `INV-WS-RENEW-NONBLOCKING-001` | +| Level 0 | Finalizing | Preserve the existing known-old work check. Under Publisher mu then leaseMu, exclude unserved lines, clean ACKed releases and proven-ended leases; require the latest level-1 report received for each remaining volume (a delayed report can stand in for a newer process; the operations manual's finalize rule covers that) and set the admission intent. Report changes invalidate captured proofs. | `core/authority/format_finalize.go` `BeginFormatFinalize`; `core/host/master/format_gate.go` `FinalizeFormat` | `INV-FMT-FINALIZE-001` | +| Finalizing | Finalizing | Move and publication are placement: refuse only known-old targets. First serving deadlines, live renewals and regrants require the latest level-1 report received for the volume during intent and at level 1 (a delayed report is covered by the operations manual's finalize rule). A stored move lease alone permits no serving. Capable renewals stay memory-only; no grant lock spans the durable write. | `core/host/master/workspace_binding.go` `admitWorkspacePublication`; `core/authority/workspace_lease_view.go` `firstWorkspaceGrant`, `regrantWorkspaceLease` | `INV-FMT-FINALIZE-001`, `INV-WS-RENEW-NONBLOCKING-001` | | Finalizing | Level 1 / Level 0 | On durable success publish level 1 under the grant locks; on a proven pre-rename failure clear the intent; an uncertain post-rename persistence failure retains the intent and fail-stops for recovery. The in-memory intent is not a persisted format or a new authority fact. | `core/authority/workspace_lease_v100.go` `FinalizeFormatLevel`; `core/authority/format_finalize.go` `CancelFormatFinalize` | `INV-FMT-LEVEL-001`, `INV-FMT-FINALIZE-001` | FormatGate r12 models this interval as Begin, durable raise and Abort, refining r11's atomic `Finalize`. @@ -1038,7 +1038,7 @@ Notes: | `INV-WS-RESTART-GRACE-001` | At format level 1, a renewal writes nothing durable. A forced move, an expired re-grant and a no-live-lease proof wait for this process's deadline plus skew: its latest grant, or after a restart the restart floor (restart + TTL); no lease value an earlier process wrote is read. | M2 Granted → Granted; Expired → Moved (forced); Expired → Granted; any → DeleteReserved | `core/authority/workspace_lease_view.go` `RenewWorkspaceLease`, `regrantWorkspaceLease`, `newWorkspaceLease`; `core/authority/workspace.go` `forcedMoveBarrierLocked`, `AckWorkspaceRevocation`; `core/authority/authority.go` `reloadFromStore` (the restart floor) | `TestRenewalWritesNothingDurable`, `TestForcedAdmissionIgnoresAPersistedHorizon` (`core/authority/workspace_restart_grace_test.go`); `TestWorkspaceLeaseGuardServesThroughAStalledStore` (`core/host/master/workspace_lease_horizon_test.go`); `TestAfterARestartADifferentHolderIsRefusedUntilTheRestartFloor`, `TestAfterARestartTheSameLiveHolderRenewsAtOnce` (`core/authority/workspace_restart_barrier_test.go`) | `LeaseRestart` `OneServer` (grace design) | ACTIVE | | `INV-WS-AUTH-RECORD-V2-001` | The format finalize writes the store's attestation file as format 2 (`INV-FMT-LEVEL-001`), on which a v1.0.x master refuses its whole start; from then on its authority records are envelope version 2 (a v1.0.x master would skip them); before it, both are v1.0's. It reads both forms of each. | M2 every workspace write; master start | `core/host/master/store_attestation.go` `ensureEnvelope`, `decodeStoreAttestations`; `core/host/master/host.go` `New`; `core/authority/authority_store.go` `storeEnvelopeVersion`, `encodeEnvelope`, `decodeEnvelope` | `TestAV100MasterRefusesTheAttestationEnvelope`, `TestAttestationsWriteTheV100FileUntilTheFinalize`, `TestAttestationsReadTheV100File` (`core/host/master/golden_v100_test.go`); `TestARecordWrittenNowFailsTheV100Decoder` (`core/authority/workspace_restart_grace_test.go`); `TestAuthorityStoreWritesTheV100Files`, `TestAuthorityStoreReadsTheV100Files` (`core/authority/golden_v100_test.go`) | — | ACTIVE | | `INV-FMT-LEVEL-001` | The cluster's format level is the attestation file's form: v1.0.x's bare map is level 0, the envelope (format 2, format_level 1) level 1. It only rises: the finalize is its only writer, and an envelope below level 1 is refused at start. | FormatGate Finalize (level 0 → 1) | `core/host/master/store_attestation.go` `decodeStoreAttestations`, `finalize`, `persist`, `level`; `core/host/master/host.go` `New` | `TestFinalizeFormatBlocksOnAnOldHolderAndIsDurable`, `TestAnAttestationEnvelopeBelowLevel1IsRefused` (`core/host/master/format_gate_test.go`); `TestAttestationsWriteTheV100FileUntilTheFinalize`, `TestAV100MasterRefusesTheAttestationEnvelope` (`core/host/master/golden_v100_test.go`) | `FormatGate` `OneWay` (mutation `level_lowered`) | ACTIVE | -| `INV-FMT-FINALIZE-001` | Finalize checks possibly-live leases and sets a memory intent under grant locks. First grants, renewals and regrants require current reports during intent and at level 1. Move/publication is Place. I/O holds no grant lock; pre-rename failure clears intent; uncertain persistence fail-stops. | FormatGate Finalize | `core/host/master/format_gate.go` `FinalizeFormat`, `finalizeCheck`; `core/authority/workspace_lease_v100.go` `FinalizeFormatLevel`; `core/authority/format_finalize.go` `BeginFormatFinalize`, `CancelFormatFinalize` | `TestFinalizeFormatBlocksOnAnOldHolderAndIsDurable`, `TestFinalizeFormatListsTheHostsItCannotConfirm`, `TestAFailedFinalizeWriteLeavesLevel0`, `TestAHolderRestartedOnAnOldBinaryIsNotReissuedItsLine` (`core/host/master/format_gate_test.go`); `TestHost_ApplyFact_LineIssuedForAnotherProcessIsNotAdopted` (`core/host/volume/line_incarnation_test.go`); `TestClusterFinalizeFormat` (`cmd/sw-block/cluster_format_test.go`); `TestClusterFinalizeFormatTypedAnswer` (`cmd/sw-block/cluster_format_json_test.go`); `TestFinalizeRequiresTheGrantedHoldersReadReport`, `TestFinalizeSerializesTheLevelZeroPublicationBoundary`, `TestFormatFinalizeIntentRequiresRegrantReport`, `TestFormatFinalizeCountsOnlyPossiblyLiveCurrentLeases`, `TestFormatFinalizeIntentDoesNotSurviveProcessExit`, `TestFormatFinalizeFailedCheckLeavesLevelZeroGrantsOpen`, `TestFormatFinalizeLiveRenewalChecksCurrentProcess`, `TestFormatFinalizeDeadlineProofSurvivesIntentCompletion`, `TestFormatMoveRecordCannotServeBeforeReportedRenewal`, `TestFormatFinalizeUncertainWriteFailStops` | FormatGate r12 FinalizeBegin, FinalizeCommit, FinalizeAbort, Grant, Renew / ServersReported, GrantReport, NoStrand; serve_across_restart and grant_unchecked_in_intent are refused; move/publication is Place, and only a checked renewal reply grants serving | ACTIVE | +| `INV-FMT-FINALIZE-001` | Finalize checks possibly-live leases and sets a memory intent under grant locks. First grants, renewals and regrants require the latest level-1 report during intent and at level 1. Move/publication is Place. I/O holds no grant lock; pre-rename failure clears intent; uncertain persistence fail-stops. | FormatGate Finalize | `core/host/master/format_gate.go` `FinalizeFormat`, `finalizeCheck`; `core/authority/workspace_lease_v100.go` `FinalizeFormatLevel`; `core/authority/format_finalize.go` `BeginFormatFinalize`, `CancelFormatFinalize` | `TestFinalizeFormatBlocksOnAnOldHolderAndIsDurable`, `TestFinalizeFormatListsTheHostsItCannotConfirm`, `TestAFailedFinalizeWriteLeavesLevel0`, `TestAHolderRestartedOnAnOldBinaryIsNotReissuedItsLine` (`core/host/master/format_gate_test.go`); `TestHost_ApplyFact_LineIssuedForAnotherProcessIsNotAdopted` (`core/host/volume/line_incarnation_test.go`); `TestClusterFinalizeFormat` (`cmd/sw-block/cluster_format_test.go`); `TestClusterFinalizeFormatTypedAnswer` (`cmd/sw-block/cluster_format_json_test.go`); `TestFinalizeRequiresTheGrantedHoldersReadReport`, `TestFinalizeSerializesTheLevelZeroPublicationBoundary`, `TestFormatFinalizeIntentRequiresRegrantReport`, `TestFormatFinalizeCountsOnlyPossiblyLiveCurrentLeases`, `TestFormatFinalizeIntentDoesNotSurviveProcessExit`, `TestFormatFinalizeFailedCheckLeavesLevelZeroGrantsOpen`, `TestFormatFinalizeLiveRenewalChecksCurrentProcess`, `TestFormatFinalizeDeadlineProofSurvivesIntentCompletion`, `TestFormatMoveRecordCannotServeBeforeReportedRenewal`, `TestFormatFinalizeUncertainWriteFailStops` | FormatGate r12 FinalizeBegin, FinalizeCommit, FinalizeAbort, Grant, Renew / ServersReported, GrantReport, NoStrand; serve_across_restart and grant_unchecked_in_intent are refused; move/publication is Place, and only a checked renewal reply grants serving | ACTIVE | | `INV-FMT-ELIGIBLE-001` | At level L no new work goes to a server known to read below L: no placement or move target (binary_too_old). An unreported target may be placed or moved; its serving deadline requires its own report. Heartbeats are recorded, never refused. Placed work stays. Every assignment carries L. | FormatGate Assign (placement, move, failover) | `core/host/master/format_gate.go` `formatEligible`, `formatTooOld`, `placementTooOld`; `core/host/master/journal_isolation.go` `newWorkRefused`, `reconcilePlacements`; `core/host/master/workspace_binding.go` `PlaceWorkspace`; `core/host/master/workspace_service.go` `workspaceMoveCheckLocked`; `core/host/master/services.go` `ReportHeartbeat`, `assignmentFact` | `TestFormatGateRecordsAnOldBinarysHeartbeatAtLevel1`, `TestFormatGateRefusesPlacementAndMoveOntoAnOldHost`, `TestFormatGateProductLoopPlacesOnlyOnHostsThatReadTheLevel`, `TestAssignmentFactCarriesTheFormatLevel` (`core/host/master/format_gate_test.go`) | `FormatGate` `NoStrand` (mutation `place_ignores_reads_level`) | ACTIVE | | `INV-FMT-LEVEL0-V100-001` | At format level 0 the master writes as v1.0: grants clamp to the persisted horizon, an extender keeps it current, forced moves and re-grants wait for the later of horizon and deadline plus skew, records are version 1. Every grant raises the deadline at both levels. | M2 Granted → Granted; Expired → Moved (forced); Expired → Granted (level 0) | `core/authority/workspace_lease_v100.go` `renewV100Locked`, `extendWorkspaceLease`, `forcedMoveBarrierV100Locked`, `ackValidityLocked`, `envelopeVersionLocked`; `core/authority/workspace_lease_view.go` `RenewWorkspaceLease` | `TestALevel0RenewalKeepsTheHorizonCurrent`, `TestALevel0GrantIsClampedToTheHorizon`, `TestTheForcedBarrierFollowsTheFormatLevel`, `TestRecordEnvelopeVersionFollowsTheFormatLevel` (`core/authority/workspace_format_level_test.go`) | `FormatGateMaster` `OneServer`, `GraceOnlyFinal` (mutations `level0_no_horizon`, `old_starts_after_finalize`) | ACTIVE | | `INV-FMT-RETIRE-001` | A host retire, the node registry's only writer after start, is refused, naming the volumes, while the host holds a placement or a live line, and unless confirm repeats the id. A retired id is unregistered; if the host returns it registers again at its reported level. | FormatGate Retire | `core/host/master/format_gate.go` `RetireHost`; `core/host/master/journal_isolation.go` `volumesServedBy` | `TestRetireHostRefusesAHostThatHoldsWork` (`core/host/master/format_gate_test.go`); `TestACleanMoveReleasesTheTopologyHome`, `TestTheTopologyHomeHoldsTheVolumeBeforeAMove`, `TestTheTopologyHomeAloneHoldsTheVolumeBeforeAMove` (`core/host/master/served_topology_move_test.go`); `TestClusterRetireHost` (`cmd/sw-block/cluster_format_test.go`); `TestNodeRegistryIsWrittenOnlyAtStartup` (`cmd/blockmaster/node_registry_guard_test.go`) | `FormatGate` r2 `OneServer` (mutation `retire_holding_host`) | ACTIVE | diff --git a/seaweed-block/docs/operations-manual.md b/seaweed-block/docs/operations-manual.md index 2adfed6673..6778dd6a8e 100644 --- a/seaweed-block/docs/operations-manual.md +++ b/seaweed-block/docs/operations-manual.md @@ -620,27 +620,38 @@ writing the v1.0 format until you finalize. Until then you can go back. Check it on **every host itself**. blockmaster's view cannot show it, so do not rely on it. + `blockvolume --version` prints the build's revision, not a release number: + `blockvolume revision= modified=`. Compare every line with the line the v1.1.x binary + you installed on that host prints. + ```sh + # 0. The reference line: the v1.1.x blockvolume binary you installed on this host. + /usr/local/bin/blockvolume --version # 1. Every RUNNING volume process: /proc//exe runs the image that process is running, - # even if an upgrade has since replaced the file on disk. Every line must show v1.1.x. + # even if an upgrade has since replaced the file on disk. for pid in $(pgrep -x blockvolume); do printf '%s ' "$pid"; sudo /proc/"$pid"/exe --version; done - # 2. The binary a restart would start: every unit's ExecStart must point at a v1.1.x blockvolume. - systemctl cat 'sw-blockvolume@*' | grep ExecStart + # 2. The binary each unit would start on a restart. + for b in $(systemctl cat 'sw-blockvolume@*' | sed -n 's/^ExecStart=\([^ ]*\).*/\1/p' | sort -u); do printf '%s ' "$b"; "$b" --version; done ``` - If any line shows v1.0.x, stop that volume and upgrade it before the finalize. Do not roll any host back while the - finalize runs. + Every line of steps 1 and 2 must print exactly the reference line, with `modified=false`. A line with another + revision, `modified=true` or `modified=unknown`, an error, or no output means that the process or unit cannot be + shown to run v1.1.x: stop that volume (or fix that unit) and upgrade it before the finalize. Do not roll any host + back while the finalize runs. **Also:** wait at least 30 seconds after the last start or restart of any volume process before running the - finalize. In that time, each running process reports its read level, and the finalize refuses while one reports an - older level. This wait catches a process that was missed. It does not replace the hard rule (see "What remains"). + finalize. In that time a running process normally reports its read level, and the finalize refuses while the latest + report for a volume shows an older level, so the wait usually catches a process that was missed. A report can be + delayed without bound (see "What remains"), so the wait does not replace the hard rule. **What remains (stated, not closed in v1.1.2):** - - The finalize judges each serving volume process by the last heartbeat report blockmaster received for that volume. + - The finalize judges each serving volume by the last heartbeat report blockmaster received for that volume. - A report delayed in the network or inside blockmaster can arrive after a newer process's report and stand in for - it. No wait bounds that delay. - - The hard rule is what keeps the finalize safe in that case. With no v1.0.x process running, every report, delayed - or not, comes from a process that reads the v1.1 format. + it. No wait bounds that delay. The delayed report can come from a process that has since stopped, including an + old one. + - What keeps the finalize safe in that case is which process can still serve: with no v1.0.x process running or + able to start, every process that can serve a volume reads the v1.1 format, whatever report blockmaster received + last. - v1.1.3 carries the process identity on every lease renewal and at the finalize, which removes this rule. Then: diff --git a/seaweed-block/docs/releases/v1.1.2.md b/seaweed-block/docs/releases/v1.1.2.md index 55530d785c..4c62b81121 100644 --- a/seaweed-block/docs/releases/v1.1.2.md +++ b/seaweed-block/docs/releases/v1.1.2.md @@ -29,7 +29,8 @@ level 0 and may be retried. - **Format finalize: operator rule.** From the end of the upgrade until `sw-block cluster finalize-format` completes: - no v1.0.x volume process may run or start on any host. Check it on each host from the running processes - (`/proc//exe --version`), not from blockmaster; + (`/proc//exe --version`) and the units' binaries, each printing exactly the revision of the v1.1.x binary + you installed with `modified=false`, not from blockmaster; - wait 30 seconds after the last volume process start before finalizing. The finalize now refuses while a serving volume process reports an older read level. A delayed heartbeat report