DetachVolume stopped guest I/O, then ran the whole final cut; on any
error I/O stayed stopped for the process, even when nothing was
published, and the only bound was the caller's context (up to 5 min).
Now:
- The freeze (drain + final cut) is bounded by DetachFreezeTimeout
(default 20 s, below the host's 30 s I/O timeout); a freeze past the
5 s target is logged as an ALARM.
- A detach that provably did not publish (the drain or the cut failed
before its CAS, the CAS was refused, or an unresolved detach CAS was
cancelled) resumes serving: periodic cuts restart, the stop is lifted,
and ErrDetachAborted (HTTP detach_aborted, 409, retryable) is returned.
The dirty set stays dirty, so the next cut publishes it.
- The new ChunkLayer.SettleDetach decides an unresolved detach CAS: if
HEAD is still that CAS's base, a CAS at the same base to the
non-detached base image (this holder, this epoch) cancels it, so the
detach can never land afterwards; HEAD carrying the detach means it
applied (the detached result is returned, I/O stays stopped); a newer
holder means fenced (stays stopped); HEAD unreadable leaves it
undecided: ErrDetachOutcomeUnknown, I/O stays stopped. Never resume on
top of a possibly detached HEAD.
Tests: failed upload, refused CAS, lost unapplied CAS (cancelled, HEAD one
generation on, not detached) resume and the next cut publishes the dirty
blocks; an applied CAS whose reply was lost (found by the cut's re-read or
only by the settle) stays detached; undecidable and fenced stay stopped; a
hung CAS ends at the freeze bound, is settled and resumes; the old
drain-timeout test flips (it asserted I/O stays stopped). Six declared
mutants each turn exactly their declared tests red.
Known limit: after an abort whose drain is still pending (an admitted I/O
stuck), new I/O queues behind that admitted I/O (the drain holds a pending
ioMu.Lock); serving resumes once it completes, not instantly.
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>
Past the 64 MiB in-memory budget a copy window spills saved chunks to a
sparse side file next to the volume, with no byte limit: under a long copy
and steady writes it could fill the filesystem under the WAL/extent.
New chunkLayerConfig.COWSpillLimit (bytes; 0 defaults to 1 GiB, negative
refused at attach). A save that would take the side file past it aborts the
window (errCutCOWAborted, the caller retries the cut) instead of writing;
the guest write still completes.
Tests: a save past the cap aborts the cut, the write completes and no side
file is written; a spill within the cap is accounted (one chunk) and the cut
completes; the default applies and a negative cap is refused. Four declared
mutants (no cap, no accounting, no default, negative accepted) each turn
exactly their declared tests red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A test-only hook right before the capture barrier's Lock request; the
pause tests hold the barrier shared for 300 ms after that handshake (not
after admission plus a sleep), so the cut provably waited at its Lock and
pre-barrier time is excluded.
- The helper releases the shared hold on every path (also on a failed
assertion) and joins the cut within a bound.
- Design docs: barrierPauseNs runs from the Lock request and includes
lockWaitNs.
Mutants (declared, 4/4): pause timed after the Lock, lock wait unset, body
drops the field, the hook fired after the Lock (no handshake).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Tests: the copier's HEAD fill (after it released the entry) is
cancelled by an aborted cut and the window drains; a held fill is
bounded by ReadMissTimeout and aborts the cut; a lazily-absent saved
chunk that spills keeps its missing list and the image is exact.
- C3 waits for an actual writer-entry handshake (the writer parked on the
copy entry) instead of a 200 ms non-completion window.
- Comments: the happens-before of e.missing (published by finish), and
the lazy-HEAD saver test describes the local-only save.
Mutants (declared): fill ignores the window's end, fill without
ReadMissTimeout, missing list kept only for in-memory saves; the earlier
five now also turn the new fill/spill tests red where they should.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BarrierPauseNs started after captureMu.Lock returned, so the wait for
writers already holding the capture barrier shared (e.g. parked in WAL
admission) was not counted, although a pending Lock already blocks new
writers: the reported guest pause understated it.
The pause is now timed from the Lock request, and LockWaitNs reports the
wait for the shared holders on its own (also in the /chunk/cut body).
Tests: a cut whose barrier is held shared for 300 ms reports a pause that
includes the wait (red on main: about 24 ms) and a LockWaitNs of about the
hold, inside the pause before the sync. Three declared mutants (pause timed
after the Lock, lock wait unset, body drops the field) each turn exactly
their declared tests red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cut candidate chunk that is lazily absent but has local writes stays a
candidate. Its first writer inside the copy window saved the chunk
synchronously through Read, so every non-local block became a remote fetch
bounded only by ReadMissTimeout (30 s), and every writer queued behind that
chunk waited on it; an abort did not cancel the fetch. The in-window copier
had the same shape: writers to a chunk it was copying waited on its fetch.
The COW save and the in-window copy now read LOCAL blocks only (dirty
map/WAL, the extent of present or locally written blocks, zeros for a chunk
HEAD stores as ZERO) and never call the miss hook. A lazily-absent block's
image at H is HEAD's by definition: it is listed as missing, and the copier
fills it from the cut's base HEAD after it has released the entry, off the
write path (bounded by ReadMissTimeout and the window's end).
Tests: the lazy-HEAD saver test now holds every remote fetch once the window
is open and requires the saving write to finish without one (it asserted the
blocking fetch before); C3 holds the in-window local copy instead of a fetch
and requires the write to complete with the remote held, the copier's HEAD
fetch coming afterwards. Five declared mutants (blocking read, absent block
read as local, no fill, saver drops the missing list, fill under the entry)
each turn exactly their declared tests red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>