A grant whose attach failed and whose authority was then lost returned to
the wait without a new pause, so the master's resumed wait could read as a
stall. The pause now starts whenever authority is missing and ends at each
grant, before the local attach.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review fixes. The provider ends the stall window's pause when authority is
granted, before the local attach, so a stuck attach is a stall again; the
first authority wait latches silence that already filled the window, so the
pause cannot hide it and its end cannot erase it. The held-sync and
held-attach tests release their holds before Close on every exit, and the
real prezero gets a sync seam with an order and a failed-sync control.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The startup inactivity window renewed only on replay, scan, map and attach
work. A new store's prezero and the WAL fence wrote and synced whole
regions with no report, so on a slow disk the window could end inside one
silent step; and the chunk layer's wait for master authority, a wait the
master bounds, ran out the same window.
- storage: phases RecoveryCreate and RecoveryFence; syncedSlices runs a
sized step 4 MiB at a time and reports a slice only after its sync;
prezeroNewStore uses it, and recovery reports the fence's synced bytes.
- durable: create passes RecoveryProgress; AuthorityWait tells the host
when the authority wait starts and ends; Chunk.AuthorityGap names the
projection fields that withhold authority.
- host: recovery_timeout becomes recovery_stalled; waits are counted, the
window pauses while any runs and restarts when the last ends, a stall
latched before stays latched; /status RecoveryWait=awaiting_authority.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The status schema's generated block takes its descriptions from the
fields' comments: the checkpoint step fields now carry them, and the
block is regenerated (STATUS_SCHEMA_UPDATE=1) instead of hand-edited.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fence stays a zero fill (a punched WAL would make the next lap's
appends allocating writes, each fsync committing metadata); the hole
punch is removed. The fill now runs in 4 MiB slices, each written,
fsynced, and only then counted (FenceZeroed) and reported to
fenceSliceHook, the per-slice recovery-progress hook: a recovery over a
slow disk shows progress every slice and the journal never takes the
whole WAL as one burst. The repeat skip stays: a new volume's second
recovery does not fill again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runTransition now runs the format level guard first (it refuses only a
raise of HEAD from version 0 to 1 below level 1; stamping never changes
the version, so a refused write is never stamped), then the write-time
snapshot stamp, then the write check. The stamp tests run a v1.1
holder's cut at level 1; the v1.0 landing control pins v1.0 whatever the
package mode. Both invariant rows are kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every recovery zeroed the whole WAL range with pwrites and fsynced it:
the WAL's size in writes on every open, twice on a new volume. On Linux,
with the default sparse allocation, the fence now deallocates the range
(a hole punch, which reads zeros) and then fsyncs; where the filesystem
cannot punch, or off Linux, or on a prezeroed store, it writes zeros as
before. A recovery skips the fence when the same range was fenced and
fsynced in this open by the same writer with no WAL write since (a new
volume's second recovery). The fence's bytes count only after its fsync:
status reports FencePunched, FenceZeroed and FenceSkips.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflict in docs/design/invariants.md: main added INV-FE-NVME-CANCEL-001
where this branch adds INV-NVME-RETRY-DELAY-001 and
INV-NVME-HOST-BEHAVIOR-001; all three rows kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The prefix cut, the checkpoint at the highest present LSN with whole-record
reclaim, the one checkpoint-and-retire step, and the flusher pass are
separate ledger rows, each one property.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setting the store's checkpoint and retiring every dirty entry at or below
it are one function on every path (the owned map's publication and
rollover, the map candidate's, the flusher cycle's own retirement): a
checkpoint that jumps past entries a pass wrote while it was held leaves
none of them dirty, pointing at WAL records the released tail lets the
writer reuse.
The checkpoint's steps are timed where they happen: the hooks, the owned
map's page writes and fsyncs, the waits for the leader role and the store
lock, the descriptor slot writes and fsyncs (the store file), and the
retirement. Status reports the step in progress with its start, and per
step the time, count and bytes written.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SetHeadFormat reports whether the remote took the format; the provider's
wrapper answers false over a remote without it, so a v1.1 attach refuses
before anything local is written instead of upgrading behind a v1.0
writer. A provider test over the real layout store proves the assigned
level decides the stored HEAD bytes across a restart.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflict in core/frontend/nvme/session.go: main added the rate-limited
write-failure log before the completion status; this branch computes the
status through the session (negotiated retry delay). Both kept: the log,
then s.completionStatus(res).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The host keeps the format level of every assignment no older than the
newest, the frontend projection carries it, and the provider attaches the
chunk layer at it (absent = 0). At level 0 the attach reads HEAD first: a
version-1 HEAD runs v1.1 (reported behind), a v1.1 store under a
version-0 HEAD is refused, anything else stays v1.0. A v1.1 attach over a
remote without the HEAD format is refused. The layout's one HEAD write
path refuses a write that raises HEAD from version 0 to version 1 below
format level 1, whichever writer tries; writers supply their level in
their context. The running format is in the chunk stats.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A flusher cycle drained the whole dirty map before one fsync and one
checkpoint, so on a slow disk no WAL byte was freed until the cycle ended
and a write waiting for space timed out while reclaim was running. A
cycle now takes the LSN prefix of the synced entries that fits in a
sixteenth of the WAL, cut at a record boundary (a native batch's blocks
stay together), and checkpoints at its last LSN; the run loop starts the
next cycle at once while entries remain. A pass position moves each
cycle past the previous batch, so a checkpoint held below a batch does
not repeat it, and it is trusted only within one recovery lifetime. A
full drain runs cycles until its first frontier is drained.
The durable status's checkpoint persistence gains the reclaim counters
(ReclaimedBytes, BoundedCycles, FlusherPhase, CycleStarted,
CycleExtentBytes, LastExtentWrite), and WALStore.ReclaimProgress reads
them without a store lock for a write's hold path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A chunk layer decides its format once at attach from its config's
FormatLevel and the store's marker: level 1 upgrades a v1.0 store; level
0 keeps it on v1.0; a store already on v1.1 at level 0 is served over a
version-1 HEAD (reported as format_level_behind_volume) and refused over
a version-0 HEAD (format_level_behind_store). The layout remote's HEAD
format follows its layer (SetHeadFormatV11) and reports the version it
read (HeadV11). Every production attach is level 0 until the assignment
carries the master's level, so a release build keeps writing v1.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a v1.0 shadow a cut can capture a written absent chunk while its
absence stands (no Hash), and the flusher can then complete the chunk's
local bits (P to U, no version change) before the publish. The publish's
Commit met U and the kernel refused it. Commit is now sent only when the
record holds the chunk's hash (HU or HP); the chunk stays a candidate.
Fixes#922.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runTransition stamps each snapshot without a publishing generation with
the write's generation whenever the result is a version-1 HEAD, and a
write check refuses a version-1 HEAD with an unstamped snapshot. Reads
stay tolerant. A v1.1 commit's new snapshot and an upgraded volume's
legacy snapshots can now be deleted by their captured target.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In the pause, a cut now syncs (H), takes the touched set and the dirty set
by pointer swaps, and opens the copy window over what they name (a
superset of the candidates, a lookup per chunk). Everything per candidate
runs after the pause, under the window: the judgement (WAL entries up to
H), the known-equal filter, each candidate's version, staged reuse, the
record shadow check, the base refs, the copy-order hint and the
HEAD-behind refusal. The window then narrows to the candidates.
- A candidate's version at the barrier is read atomically with the write
path: the version a guest write's save recorded with its bytes, else the
live one under the window lock. The window closes on a chunk only after
its version is read and it is uploaded.
- A refusal before the judgement returns the taken sets (touched again,
the dirty set rejoins l.dirty). After it, the existing requeue does.
- A pre-copy attempt keeps its drained frontend drained through the
judgement and decides its freeze on the judged tail, as before: its guest
pause runs to that release.
- The record shadow check exempts chunks written since the barrier (the
live touched set): the record already counts those writes.
- PauseCandidateOps counts per-candidate operations while the guest is
paused; it is 0 for an ordinary cut. The cut body and the status schema
carry it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A fill's install (absent to present) touches its chunk: a fetch that
outlived a same-open recovery installs HEAD's bytes with no clean mark,
and the full scan made that chunk a candidate; now the touched set does
too (TestAFillThatOutlivesARecoveryMakesItsChunkACandidate, which fails
without the touch).
- Under this package's tests every barrier runs the full scan as an oracle
(candidateOracle, nil in production) against the barrier's candidates
with l.dirty and allDirty; a chunk it finds that the set missed is a
finding. The whole package runs with 0 oracle findings.
- chunk_layer.go carries the table of each predicate input that moves and
what touches the chunk, including the clears that need none.
- The cut body (/chunk/cut) and the status schema carry CandidateVisits and
PreSyncNs.
- The unknown-outcome guard compares the remote's full images (any store
format) and asserts the injected cut's outcome is unknown.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A page rebuilt at open leaves its chunks unknown again behind the pass's
cursor (completed or partial): the attach now rewinds the cursor, durably
and before the layer admits any request, to the first unknown chunk. A
chunk written between the pass's read and its hash is superseded by the
write: not hashed, not counted as compared, reported (Superseded); it is
dirty and the next cut takes it, also after a restart. A failed attach
joins the record writer it started. The pass tests hold the pass at a
barrier inside a compare instead of racing a timed walk.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
INV-WAL-V3-CAPTURE-CANDIDATES-TOUCHED-001 states the touched set and the
pre-barrier sync; the v1.1 notes carry them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The status schema's generated block comes from the code: the hand-written
rows are replaced by the generated ones, with the field comments on
UpgradePassStatus.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>