Files
seaweedfs/seaweed-block/docs/design
5577472124 seaweed-block: guard format finalize with serving-holder reports (#13448)
* test(block): expose serving-report and finalize grant races

* fix(block): guard format finalize with serving-holder reports

* test: pin finalize intent crash and refusal behavior

* fix: retain current process report checks across finalize

* fix: distinguish format placements from serving grants

* fix: preserve durability exit contract and strengthen finalize controls

* Normalize finalize manual ending after master merge

* fix(block): preserve capable refresh and report waits during finalize

* seaweed-block: pass the published line to the refresh owner check

The same-owner refresh check passed VolumeAuthorityLine's AuthorityBasis to
workspaceLineOwner, which takes a PublishedLine, so core/host/master did not
build. Resolve the owner through workspaceSourceHost, which reads the
published line for the same replica and epoch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: wait on a published line's owner, not every placed slot

A move does not rewrite the placement, so once a volume moved, its former
host's slot stayed in the grant waits. When that host's report for the volume
expired, the slot became a wait the new holder's reports never cleared, and
the status stayed degraded. The new holder, absent from the placement, got no
wait at all. A volume with a published line now waits on the line's owner
only; placed slots wait until a line exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: judge a heal or failover on the volume's own report

Only a same-owner endpoint refresh judged the volume's own process. A heal of
the current holder after a failed fence round, or a failover to a replica's
committed holder, places no new work on that server either, but it still read
the server's lowest level, so one old sibling process refused the recovery of
a capable holder. A reassign to the replica's committed holder now judges the
volume's own report like the refresh; a new placement keeps the server-wide
gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: red: a holder renews its lease before its first heartbeat is answered

Identity check (1) of the format finalize bound: until the master answers
a holder process's first heartbeat (which names its incarnation), it holds
only the predecessor's report for the volume, so a renewal in that window
is judged on the predecessor's proof. The lease runtime starts as soon as
the assignment epoch is known, independent of the heartbeat loop: with
the first heartbeat held open the holder renews anyway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: a holder's first lease renewal waits for its first answered heartbeat

The heartbeat loop closes a signal when the master first answers this
process's heartbeat; the workspace lease runtime starts its guard (and so
its first renewal) only after it, so every renewal is judged on this
process's own report. A host whose heartbeat loop never started has
nothing to wait for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: a v1.0-shaped heartbeat supersedes the cached report, so its renewals are refused

Identity check (2) of the format finalize bound: a heartbeat with no
incarnation and no reads level, from a new process on the holder's
server, replaces the capable predecessor's report for the volume (as
level 0), so that process's renewals are refused at level 1 and during
the finalize intent; the capable process renews again after reporting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: the wait for the first answered heartbeat is bounded; past it the holder fences

Ruling: the first renewal waits for the first answered heartbeat at most
one lease validity (the longest validity a reply may carry); past that the
lease runtime installs its guard fenced, so a holder whose heartbeat is
never answered neither renews nor serves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: the v1.0-heartbeat check's intent case runs a real finalize

The intent case set only the master's finalizing flag; the renewal check
reads the publisher's own flag, which BeginFormatFinalize sets, so at
level 0 that case never reached the check. It now holds a real finalize
at its durable barrier, as the serving tests do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the operator procedure before the format finalize

The finalize section of the operations manual and the v1.1.2 notes state
the operator bound for the window before a new process's first answered
heartbeat: no v1.0.x volume process running or able to start until the
finalize completes, and a wait of at least 30 seconds after the last
volume process start. v1.1.3 carries the process identity on every
renewal and removes the procedure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: the first-heartbeat tests witness the window, test the bound and join the runtime

Review: the held-heartbeat test now waits until the first heartbeat is
inside the master's handler before checking that no renewal arrives, so
the window is witnessed open; the fence test checks that the lease
runtime waits its configured bound, no less, and names it in the fence
cause; both tests join the lease runtime within a bound at cleanup,
before the host and the server close.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the finalize operator text becomes a hard rule checked on each host

Ruling: a delayed heartbeat report can stand in for a newer process, so
the 30 s wait alone does not close the window. The manual and the v1.1.2
notes now state a hard rule, no v1.0.x volume process runs or starts from
the end of the upgrade until the finalize completes, checked on each host
from the running processes and the units rather than through blockmaster;
the wait stays as a backstop, and the remaining case is stated, not
claimed closed. v1.1.3 removes the rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the host check matches what --version prints; the guarantees name the latest report

Review: blockvolume --version prints 'revision=<commit> 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 <noreply@anthropic.com>

* seaweed-block: the fence test checks the bound from both sides; a failed join stops before teardown

Review: the never-answered test now measures from the lease runtime's own
wait start (a test hook) to its return and requires the bound, no less
and at most 500 ms more, so a runtime fencing at ten times the bound
fails it. The rig's cleanup join is fail-stop: a lease runtime that does
not return within 10 s stops the test binary before the host, the server
and the shared settings are torn down; a negative test covers the join.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the unit check covers every blockvolume unit; the notes drop the unconditional renewal claim

Review: the restart-binary check enumerates every blockvolume unit file
and template instance (sw-blockvolume*, loaded or not), since a
systemctl glob skips an enabled but stopped unit; and the v1.1.2 notes
now require the latest received report, say a v1.1.2 process renews
only after its own first answered heartbeat, and state the
delayed-report residual instead of claiming an old replacement can never
extend a lease.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: the rig's failed join exits without unwinding, proven in a child

Review: a panic in a cleanup still runs the later cleanups, so teardown
happened under a live worker. A failed join now ends the test binary
with os.Exit(3); a child test binary proves it: with a worker that never
returns it exits 3 and a later teardown cleanup never runs (its marker
is absent), with a returned worker it passes and the marker is present.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the unit check includes unloaded instances overridden by their own drop-ins

Review: list-unit-files finds unit files and templates, and list-units
finds instances in memory, so an unloaded instance whose ExecStart is
set only by its own drop-in directory was missed. The inventory now also
takes the enabled instance links and the instance drop-in directories;
systemctl cat on an instance shows the template with its drop-ins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: the fail-stop witness's child is bounded and joined

Review: the child test binary ran with no deadline, so a join that hangs
would hang the witness. It now runs under a 30 s context (killed and
reaped at the deadline, with -test.timeout=20s of its own), and a
timeout fails as a timeout, never as the expected exit 3. A join that
hangs instead of exiting fails the witness in about 23 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the ledger names the new regression tests; the manual's renewal guarantee names the latest report

Review: INV-FMT-FINALIZE-001 and INV-FMT-ELIGIBLE-001 name the sibling
refresh/reassign, placed and moved-owner wait, queued-finalize,
v1.0-heartbeat and first-heartbeat tests with their files; the FormatGate
r12 citation is marked as checked outside the repository; and the
manual's finalize section requires the latest received level-1 report,
says an old replacement is refused once its own report is received and
that the first-heartbeat wait does not identify the caller, and points
at the operator rule for a delayed report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: name the renewal validity cap the first-heartbeat wait is bound to

firstHeartbeatWait is documented as one lease validity, the longest a
renewal reply may carry, but repeated Refresh's 30 s literal. Both now use
maxRenewalValidity, so a change to the cap moves the bound with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the unit check searches every unit path for instance overrides

The instance search read only /etc/systemd/system and /run/systemd/system,
and only .wants links. A drop-in in another unit path (/usr/local/lib or
/usr/lib/systemd/system) applies to the instance the same way, and an
instance linked through .requires is enabled too, so an old ExecStart set
there passed the check. The search now walks systemd-analyze unit-paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the finalize ledger row names the files of its older finalize tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: operator wording for the finalize release note, unit check and refusal hint

Review (wording only): the release note's Format finalize paragraphs are
rewritten for operators (what refuses, what to do, exit 74 and
format-level after a restart, the last-received report); the manual's
version lines must end with the reference line after the pid or path;
the unit check strips systemd's ExecStart= prefixes (-, @, +, !, :) so
an ignore-failure override is checked rather than refused; the finalize
bullet keeps only what an operator acts on; and the refusal hint says to
upgrade the named process and let it report, not to make it report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the release note's exit 74 covers only an uncertain replacement

Review: a write, sync, close or rename failure of the new file is an
ordinary error before the replacement (the level stays 0, no exit); only
a failure after the rename, when the new level may not be durable, exits
74.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the M4 lease guard shows the first-heartbeat gate; the unit check tolerates blanks around ExecStart=

Review: the M4 diagram and table now show that a renewal from NoLease
waits for this process's first answered heartbeat, and that NoLease
fences when none is answered within firstHeartbeatWait (one lease
validity), naming runWorkspaceLease and INV-FMT-FINALIZE-001. The
manual's unit check accepts blanks around '=' as systemd does, skips
only the empty reset, and prints a line that stops the check when a
value yields no binary; the version call no longer reads the loop's
input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the unit check covers copied volume units; listed names an idle old process

Review: the host check found units by the shipped name only, but the
shipped unit says to copy it for more volumes, so a stopped copy was
missed. The inventory now takes every unit, loaded or not and under any
name, whose file, drop-in or enabled link mentions blockvolume; only
ExecStart values that name blockvolume are checked, and one that runs it
through another program prints a stop line. The listed bullet now
includes a fresh level-0 report from a process that holds no volume.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the unit check runs every ExecStart value of every selected unit

Review: a unit with the current blockvolume base, an empty ExecStart=
reset and a renamed old binary in a drop-in printed only the base's good
line, because the check kept only values naming blockvolume. Every
non-empty ExecStart value of every selected unit, overridden or not, now
runs with --version and its line names the unit; a renamed binary, a
wrapper or a missing binary prints a non-reference line and stops the
check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the unit check never runs a program that is not blockvolume

Review: a wrapper, /bin/sh -c or a site script ignores --version and runs
as written. Only a binary named exactly blockvolume is now run; any
other ExecStart value prints 'NOT a blockvolume binary: confirm by hand'
without being executed, which is not the reference line, so the check
still stops on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-block: docs: the unit check reads every start directive; the operator confirms the rest

Review: ExecStartPre, ExecStartPost and ExecReload values are now checked
with the same rule as ExecStart. Units are found by the text blockvolume,
so a unit or script that starts a renamed binary without naming it
cannot be found by text search; step 2 now says the checks are helpers
and adds the rule line: confirm no other unit or script on the host
starts a v1.0.x volume binary. The listed bullet names a stale report at
any level, not only a capable one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: pingqiu <pingqiu@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-06 00:03:05 -08:00
..