A detach whose final cut provably did not publish resumes serving, but
the stop-pending mark set at the start of the detach stayed latched on
the host and on its lease guard, so a host that kept serving renewed
about four times a second for good instead of once per renewal delay.
The detach hook now returns an attempt token, and the provider calls a
second hook with that token only after it resumed serving on a proven
abort. The host clears stop-pending, on itself and on its guard, only
for the latest attempt, so an older attempt's resume cannot clear a
newer pending detach; an applied, fenced or unknown outcome keeps it.
Tests: the guard's sleep is now observable through a scheduling seam,
so the cadence test asserts the delay chosen after each renewal and the
kick path separately, with no wall-clock window; the detach hook is
witnessed before the drain starts; test workers are joined, bounded and
failing on timeout, before their providers are closed. The invariants
document gains the StopPending mode of the lease guard (scheduling
only, no admission or ACK change) and INV-WS-STOP-PENDING-001. Comments
now say that 250 ms bounds the sleep after a completed renewal, not the
time from a revocation to its ACK.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a graceful stop the chunk layer is detached first and the master marks
the lease revoking right after, but the host's lease guard only learned of
the revocation on its next renewal, up to 10 s later (3-6 s measured), and
the guest's writes were refused all that time.
A detach now calls an optional provider hook, OnChunkDetach, which the
blockvolume host connects to its lease guard: the guard renews at once and
then every 250 ms until it fences. The pending mark is never cleared; a
detached host does not serve again under the same guard. The hook fires
only on the detach path, not on the lease-fence StopIO.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pass now needs a master listing exactly the configured filer (same
gRPC port, same or co-resolving host). Every master is asked: any
master listing another filer or several refuses at once, whichever
answers first. Each master call is bounded within the remaining time,
so a stalled master no longer consumes the whole bound. Startup census
only; invariant INV-WS-SINGLE-FILER-001 and its M6 row record it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Block metadata needs exactly one filer behind --chunk-filer. At startup
the chunk wiring asks that filer for its masters and filer group
(filer_pb.SeaweedFiler/GetFilerConfiguration), then the masters for the
filers of that group (master_pb.Seaweed/ListClusterNodes). It refuses
unless a master lists exactly one, and when it cannot get that answer
within 15 s. The filer subset gains GetFilerConfiguration and a master
subset carries ListClusterNodes, generated with the committed plugin
versions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On platforms without SIGUSR1 a set --cpu-profile-dir is refused in flag
parsing; the default (off) stays common to all platforms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
parseFlags refuses an unusable --cpu-profile-dir (and a platform without
SIGUSR1) before run() activates anything; the handler is installed at
the top of run(). stop removes the handler, stops and joins the signal
worker, then writes out a running profile, so a buffered SIGUSR1 cannot
start a profile after it. Tests decompress the whole profile and check
that no profile runs after stop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--cpu-profile-dir (default $SWBLOCK_CPU_PROFILE_DIR) names an existing
directory; SIGUSR1 then starts a CPU profile written there as
blockvolume-<pid>-<n>.pprof and the next SIGUSR1 stops it. Shutdown
writes out a running profile. Unset (the default), nothing is installed
and blockvolume is unchanged. No port is opened, so a harness can
profile any running volume with kill -USR1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the conflict in the ProviderConfig comments: keep main's new DetachFreezeTimeout field and the corrected ChunkDirtyThreshold comment.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Fold of the #255 r2 review:
- the lost-range methods are part of AuthorityStore instead of an
optional capability, so no store (and no wrapper embedding one) can
issue a forced move without recording its range;
- a pending forced reservation resumes only with the exact range recorded
before it; a missing one is refused, never recomputed (a new request
records a fresh range);
- fault hooks inside the file store cover a failure before the rename and
one at the directory sync.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fold of the #258 review:
- the probe opens the volume once, locks that descriptor first, then
identifies the same open file as v3: a path replaced between two opens
can no longer yield a false unheld, and a locked file is held whatever
it is;
- locking before reading also fixes Windows, where an owner's byte lock
refused the probe's earlier read (it reported unknown, not held);
- the test reaps its holder process on every path; the CLI test closes
its store unconditionally;
- the usage text adds that the probe is momentary and reserves nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ProbeVolumeUnheld takes and releases the exclusive, nonblocking advisory
lock that every v3 owner holds while its store is open; the kernel drops
it when the owner process exits. nil means no process on this host holds
the volume; ErrVolumeHeld means one does; anything else is unknown (a
non-v3 file is refused: its owner would not take the lock).
`sw-block ops volume-unheld --path P` exits 0 only when unheld (1 held,
2 unknown). The proof is per host and for local filesystems only; host
cleanup must also check that the owner process is gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The flag help and the ChunkDirtyThreshold comment still described the
cut as it was before copy-before-write: "bound on one cut's barrier
copy" and "0 = unbounded".
Since the chunk copy moved out of the barrier, the value is the number
of candidate chunks above which a cut pre-copies (stages) chunks before
its barrier, in rounds of that size, and 0 disables pre-copy
(chunk_layer.go, stage: a bound <= 0 returns without staging).
Text only. No behaviour change.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Review fold (P1): the refusal had no epoch, so RF1@2 -> RF2@3 refused ->
a stale RF1@2 replay cleared it and reopened the old healthy view. The
host now records the highest refused epoch; an RF1 fact below it is stale
(not adopted, refusal kept), and the refusal is cleared only after the
role fence of a current-or-newer RF1 fact succeeds, never by a failed
attempt. Test with a real backend write schedule; ingress rows for legacy
and dual-lane, and no listener after the RF1 primary role.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review fold (P2): SetReplicationVolume replays a retained RF2 fact before
SetSelfFence installs the ingress gate; with no self fence the host could
install the peer set, adopt and emit readiness. The rule now lives in the
host config (RF1Only, from hostConfig at construction): every fact with
replica slots, primary with peers or supporting replica, is refused before
UpdateReplicaSet, adoption or the ready marker, and latched as a role
admission failure; an RF1 fact clears it. The ingress gate stays as the
second layer. Tests: the start schedule (blocked readiness, stored RF2 fact,
replay with no self fence), supporting refusal, RF1 recovery, unset control;
ingress refusal with dual-lane on both ports, classified by
ingressPortReleased; hostConfig wiring.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A chunk cut takes its LSN from the local WAL head, which no replica is
guaranteed to hold, so a published HEAD could be ahead of every replica.
The master's workspace RPCs enforce RF1; a direct start did not.
- start: --durable-impl=walstore-chunk with --replication-ack sync-quorum or
sync-all is refused at flag parse.
- assignment: the replication factor arrives with the assignment, so the
ingress role gate of a walstore-chunk volume refuses every role with replica
slots (replica, primary with peers) without opening a socket; the host's
existing role-admission latch keeps the role unadopted and not Healthy. A
primary without peers (RF1) is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guard fenced silently: when renewals kept failing until the lease
expired, it drained the volume through blockvolume's lease-stop path, which
logged nothing, and returned the raw RPC error (issue #205).
- Every fence records its first cause: lease expired without a successful
renewal, expired after a failed renewal (with the renewal's latency and
error), an invalid reply, a reply that arrived after the deadline,
revocation by the master, or shutdown. The guard logs it once as
"workspace lease: fenced ...", FenceCause() returns it, and the non-ACK
drain error carries it.
- Every failed renewal is logged with its latency and the lease deadline,
also when the lease is still valid: a run of them is the warning before
an expiry fence.
- An expiry after a failed renewal returns "workspace lease expired:
renewal failed after <d>: <err>", wrapping the RPC error.
- blockvolume logs when it stops because the guard requested the drain.
The fence behaviour itself is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>