A candidate prepared successfully and then refused because its proof
went stale during the prepare's I/O was left in flight until reopen;
both preparation paths now release it before returning
ErrMapCoverageStale.
A publication whose slot write and fsync succeeded but which a fault
latched meanwhile refuses at its success boundary may still be named by
the slot on disk. It is now recorded as uncertain, so its candidate
stays pinned until reopen instead of being released for reuse.
The map's file-size counter now follows every write and truncation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New map pages and roots go into 4 KiB extents that no live root
references, lowest first, instead of always being appended. Live roots
are the roots named by the two descriptor slots and every prepared
candidate not yet published or superseded. After each publication the
publisher reports both slots; an extent is released only once neither
slot's root references it. New pages and the root are fsynced before a
publication names them. The free tail is truncated when the file
exceeds 4x the live bytes. The on-disk format is unchanged.
WALStore.ChunkMapStatsV3 reports the file bytes, live bytes and
truncations.
Fixes#236.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- master slow store: each held Put takes a generation; a renewal is credited
with the generation it read before its call, so a reply computed before
the hold never releases it. slow.release() runs as the first cleanup, so a
held Put cannot block the publisher/extender joins after a failure.
- authority WritersExtendersClose: only grants of calls that started after
the extension write was held count (flag set before the hold blocks).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- core/host/master TestWorkspaceLeaseGuardSurvivesSlowAuthorityStore: each
lease write is held until a renewal succeeded during the hold (slowness by
progress), three held writes must complete, a sampler records any fence;
replaces the 2.5 s sleeps and the 10 s watch. A renewal that waited for the
store would let the guard lapse and fail the test at once.
- TestWorkspaceHeldRenewalBoundary, TestWorkspaceMoveRestoresLazilyAndFencesOldHost:
the test context has no wall-clock bound (3 s / 10 s); each step completes
or the go test timeout reports the hang. The guard's own RPC timeout stays.
- core/authority TestWorkspaceLeaseConcurrentRenewalsWritersExtendersClose:
wait for the held extension write and for renewals under it by progress
(were 5 s / 2 s bounds); joins after release unchanged.
- waitExtenders joins the finite extenders without a 10 s bound.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The no-host-validity refusal in RenewWorkspaceLease formatted its error
from lv.d.horizon after releasing leaseMu, while the extender
(refreshLeaseViewLocked) rewrites the view under leaseMu: a data race.
The horizon is now read before the unlock.
Test: TestWorkspaceLeaseRefusalReadsTheViewUnderTheLock drives the
refusal while the view is republished concurrently; under -race it fails
on main (workspace_lease_view.go:174) and passes here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Test-only hooks: DetachVolume's StopIO can be replaced (the repeat and
retry tests now force and observe the failed-drain branch instead of
racing a cancelled context against a finished drain); the detach's cut
and settlement deadlines are traced (the budget test checks 3/4 of the
freeze, then the bound); the backend signals an I/O passing its
readiness check right before the I/O lock (the drain test's arrival
handshake replaces a 100 ms non-completion window, with bounded
receives).
- The delayed detach CAS worker is joined, bounded, also on failure.
- chunkErrorCode: the detach sentinels decide before a catalog-error
cause; the table rows now discriminate that order (no storage CAS
sentinel behind them).
- Invariants: INV-WS-DETACH-ABORT-001 and INV-WS-DETACH-FREEZE-001, and
the M4 transition Holder (detaching) -> Holder.
- Mutants (declared, 10/10): plus a catalog cause deciding before the
sentinels; the whole-budget cut is now caught by the deadline check too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- P1: every failed detach is settled before anything resumes, a failed
drain included. A repeated detach after a successful one (or with a
cancelled context) returns the first result and stays stopped, and a
retry over an unresolved detach CAS stays stopped while the outcome is
unknown. The StopIO failure path used to resume unconditionally.
- P1: one freeze budget covers the drain, the final cut and the
settlement (the cut gets three quarters, the settlement the rest); the
settlement no longer adds 10 s of its own. The bound is cooperative
(contexts), as documented.
- P2: the resume does not restart the periodic cuts after a concurrent
Close (or a replaced layer); ErrDetachOutcomeUnknown maps to
outcome_unknown explicitly, before its cause.
- Tests: the two P1 cases and the budget case (red on 26426dd5: resumed a
detached volume, resumed over an unknown CAS, 10.4 s for a 400 ms bound);
a detach CAS genuinely delayed until after the cancel then fails its
precondition; the drain test now checks that the resumed write queues
behind the admitted one and that recovery succeeds.
- Mutants (declared, 9/9): plus a failed StopIO resuming without the
settle, the settlement with time of its own, the cut taking the whole
budget.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>