After a v1.0 store's upgrade with no clean-stop seed every whole local
chunk is unknown. The v1.1 attach now runs the compare pass (resuming at a
persisted cursor, or starting when the record holds an unknown chunk); it
compares each unknown chunk with HEAD by the cut's own transitions. A stop
never waits for it: the pages and cursor of the work done are persisted
and the next attach resumes. Until it ends, a cut, snapshot, backup or
sealing detach is refused typed (ErrUpgradePassInProgress, HTTP code
in_progress) and the pass runs at full rate. Holder status reports
Stats.UpgradePass {State, Compared, Total, Outcome}.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TestV11UncleanUpgradeLeavesNoUnknownAfterThePass: a v1.0.x store attached on
the v1.1 format with no clean-stop proof (an unclean stop) opens with every
whole local chunk unknown; the attach must then run the compare pass, which
leaves none unknown: chunks equal to HEAD end published with HEAD's hash, a
chunk that differs never with HEAD's hash. Fails on main: after 20 s all 16
chunks are still unknown, because the pass has no production caller.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main's HEAD-generation source guard allows a generation comparison only in
conditional updates and noteSettled's deduplication. The two report paths
added here compared generations before calling noteSettled; they now call
it and let it drop a report of an unchanged generation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflict: core/frontend/durable/provider_chunk.go imports only (main
dropped math/rand/v2; this branch's EachSegment fallback uses math).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HEAD's version followed the manifest size: a v1.1 commit by change over a
HEAD without a recorded size (an upgraded volume's first cut) left it at
version 0, a HEAD a v1.0 binary would read. A v1.1 commit now writes
version 1 whatever it knows of the size (CommitRequest.V11, set by the
layout remote on the v1.1 format), and a version-0 HEAD carrying a v1.1
manifest size is refused like one carrying ext.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under the shipped unit's restart policy, a holder that meets a local store
or a HEAD written by a newer format exits 78 with its reason and is not
started again; the store's bytes and HEAD stay as they were; the control,
a process of the same policy exiting 1, is restarted. Prebuilt binaries
of the same tree can stand in for the build on a host without Go.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests that pinned the removed horizon (barrier at the persisted
issue+1.5*TTL, extension writes and their status counters) now use this
process's deadline (or restart floor) plus skew. The golden wm lost range
is the same file: the master restarts half a lease after the issue, so
both versions' barriers are the same instant.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The newer-HEAD-version exit (78 head_newer_version) is chosen before the
master's final reasons, so a startup that also met a final refusal keeps
its exit: moved and deleted stay 78 with their reason, revoked stays 79.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A startup that ends on a HEAD written by a newer version exits 78
head_newer_version instead of the restartable 75 (a restart reads the same
HEAD again), and a fatal open of a store written by a newer format exits 78
store_format_newer instead of 1. The provider latches the newer-version
refusal per recovery, beside the identity refusal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
INV-STORE-FORMAT-NEWER-001: an intact descriptor of a newer store format
is refused typed, and an open refused at slot selection removes no file.
The discard's comment names what it covers: a refusal after the select
(a corrupt map) may still follow it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Regenerated with STATUS_SCHEMA_UPDATE=1: Chunk.Stats.CutsYielded and
Chunk.CutSchedule.CutYields.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- hostlimit: Config.YieldAfter (S, default 5 min). ShouldYield answers yes
only for a Normal hold at least S old while another cut on the host holds
a live ticket this process has not judged stalled (dead tickets are
reaped on the way); the probe runs only once the hold is old enough and
takes no limiter lock.
- storage: a cut attempt asks at each staging batch boundary and ends with
ErrCutYielded, keeping what it staged; CutsYielded counts it, never as a
failed cut.
- durable: a yielded attempt is retried at the next poll with no backoff,
on a ticket at the back (it was admitted), counted in status (CutYields)
and not logged as a failure.
- blockvolume: --host-limit-yield-after. Invariants: INV-HOST-CUT-YIELD-001;
M7 states the rule. v1.1 notes carry it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seams: Config.YieldAfter (S, default 5 min), Limiter.ShouldYield (never,
for now), storage.ErrCutYielded, storage.BudgetYield, ChunkLayerStats.
CutsYielded and CutScheduleStatus.CutYields.
- TestShouldYieldOnlyAfterSWithALiveWaiter: a Normal hold yields only once
it is S old and another process holds a live ticket; never a lone hold,
never before S, never an urgent hold, not for a ticket judged stalled.
Fails here: no hold ever yields.
- TestCutYieldsAtABatchBoundaryAndKeepsItsStaging: a cut whose budget asks
it to yield ends at the next staging batch boundary with ErrCutYielded,
counted as a yield, not a failure, publishes nothing, and its staged
chunks are kept for the next attempt. Fails here: the cut never yields.
- TestChunkLoop_AYieldIsRetriedAtOnceAndCountedApart: a yielded attempt is
retried at the next poll, never backed off as a failure, and status counts
it apart. Fails here: the retry came 1.1 s later.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the v1.1 format a detach settlement whose detach did not land cancels
it with a commit by change carrying no change at the detach's base: HEAD
keeps the base's chunks and returns to this holder's active identity, and
no whole base image is built from the ref table. A cancel that lands is
installed in place; one whose reply is lost after it applied is read back
and adopted, as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The envelope's volumes are checked on the decoded map (a later key of
another case can null it after a key probe), and a v1.0.x file that is
null is read as no attestations, as v1.0.x read it, so its envelope says {}
and the next start reads it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A store whose descriptor slots are intact but name a chunk-state format
newer than this binary reads is refused with ErrStoreFormatNewer, told
apart before the slot's byte checks, instead of "neither descriptor slot
is valid"; a half-fence still opens on the known slot. Cut COW side files
are discarded only after a slot is selected, so a refused open leaves the
directory as it was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An envelope already on disk is fsynced (file and directory) at every start
before the master serves: an earlier start may have renamed it in and
failed its directory fsync. master.New releases the store lock when the
envelope cannot be made durable or the attestations cannot be read. A
format-2 file without an explicit volumes object (missing, null, wrong
type) is refused rather than read as no attestations; v1.0.x files with
volumes named format or volumes are still read as bare maps.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Before it serves, under the authority store's lock, the master writes
store-attestations.json as {"format":2,"volumes":{...}}. A v1.0.x master
decodes that file as a bare map of volume records and returns the error
from New before it listens or publishes. This master reads the envelope
and v1.0.x's bare map (rewritten as the envelope at start) and refuses a
later format. The authority record's version 2 alone does not stop a
v1.0.x master (its loader skips such a record); the test is renamed to say
it fails the v1.0.x decoder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Commit by change made a v1.1 no-op cut compare only its captured chunks,
so a HEAD read whole that had moved, at this holder's identity, to another
chunk root was installed instead of fenced. A whole read's chunk root must
again be the one the layer holds (the ref table), as the full comparison
required; a HEAD moved with the same root still completes the no-op.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A renewal's grant stays a time.Time (now+TTL with its monotonic reading)
for the deadline admission compares; only the reply carries wall
nanoseconds. The revoke ACK checks validity against that deadline the same
way. A missing deadline reports expiry 0 (no host validity), and comments
tell the deadline (restart + TTL) from the barrier (deadline + skew).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A renewal grants now+TTL from memory and writes nothing: the persisted
horizon, its clamp, its background extension and its counters are gone.
A forced move, an expired re-grant and a delete's no-live-lease proof wait
for this process's deadline plus skew (its latest grant, or after a
restart the restart floor it already set at load); no lease value an
earlier process wrote is read. An authority record's envelope is now
version 2, which a v1.0.x master refuses (it would trust the record's
stale lease expiry); this master reads versions 1 and 2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the v1.1 format the layer's HEAD keeps no chunk map, so a settlement
that installs a HEAD read whole (a lost reply read back, a re-proposal read
back, a detach settled) now reports the previous image built from the ref
table, and every cut, settlement and detach outcome reports and keeps
HEAD's identity only (a no-op cut and a settled detach returned and kept
whole maps).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the v1.1 format the layer keeps HEAD's identity and its chunks in the
ref table only: the attach reads HEAD one segment at a time from a
segment reader (ChunkSegmentReader; the layout remote is one), every
install fills the table from a HEAD read whole, and the paths that need
the whole image (adoption, owning, the detach cancel, the publication
report) build it from the table. A cut's result reports HEAD's identity
only; no production code reads its chunks (a scan test guards it), and
tests read the remote's installed HEAD. The held heap at 1 TiB's chunk
count is 174 B/chunk (442 before) and is asserted at most 200.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every per-volume read in the package's tests now checks the whole index
against the whole state: every state key indexed, every indexed key in the
state, no empty volume set, and the read equal to the scan. Negative
controls: a stale extra entry, a missing entry, an empty set.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The window's timer starts inside Admit; a first admission publishes and
syncs the host configuration, which a loaded runner can stretch to
hundreds of milliseconds. The upper bound is now measured from Admit's
return; the lower bound still from before it. The failure message prints
the admission's duration.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the v1.1 format a cut's base is HEAD's identity and its candidates'
references (cutBaseLocked), the commit sends identity plus the change set,
and a landed commit is applied to HEAD in place (applyCommitLocked): O(C)
where the base, the proposal and the install each copied every chunk. A
no-op cut compares its captured chunks with the by-change rule less the
generation. The cut's result still reports the whole installed HEAD (one
copy after the settlement, until the flat map goes).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The fetch child keeps its release (and so the slot's file) reachable
while it lives, with forced collections before it reports HELD.
- The ended-waits test registers every release at once, and its second
half frees the other slot only once each fetch is already waiting, so
the waiting path's success is what is checked.
- The competing fetches derive from a cancellable context, and cleanup
joins them within a bound.
- Comments: one fetch polls per limiter (blockvolume makes one per
process); a configuration check in progress can add its bounded guard
wait after the context ends.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The publisher indexes its lines by volume, kept by the one writer of its
state, so every per-volume read (the workspace line, the authority line,
the bound replica, the published epoch, the promotion basis) costs the
volume's replicas, not every line. A register, ACK or move reconciles the
bindings of its own volume and of any volume whose reconcile failed before;
the start still reconciles every volume.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A limiter's first fetch checks the host configuration under
configuration.lock, publishing it when absent (configGuard, now shared
with cut admission): a fetch-only process with other flags gets ErrConfig.
- No blocking lock: with every slot held, one fetch per process polls
every slot each 20 ms (the others wait for its turn, within their
context). An ended wait leaves no lock request, descriptor or goroutine;
lockBlocking is removed.
- The waiting is unordered and bounded by the caller's context alone; the
docs say so instead of promising a kernel queue.
- A slot taken when the context has already ended is given back, with the
context's error.
- INV-HOST-FETCH-CAP-001, M7 and the v1.1 note state the contract.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A fetch-only start must publish and check the host configuration: a
child process with FetchSlots 2 fetches first, and a FetchSlots 1 fetch
must answer ErrConfig (fails: no configuration is published).
- Waits that end at their deadline, or by taking another slot, must leave
no goroutine or descriptor behind while their slot stays held (fails: 40
blocked lock waits remain).
- A context that ends as a slot is taken must get its error, slot given
back (fails: the slot is handed over). Seam: testFetchLocked.
- Controls: a killed child's slot is freed; a waiter passed by others ends
by its deadline (the waiting is unordered, bounded by the context).
- The same-process cap test is renamed AcrossLimiters; holdAsync joins and
releases its wait in cleanup.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the v1.1 format an unresolved commit is found landed by
sameProposalByChange over its change set and the captured chunks it left
as they were (commitMarks), kept beside the pending change set; the v1.0
format and the no-op cut keep the full comparison. A landed commit whose
reply was lost settles although an index it neither changed nor captured
differs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- hostlimit: Config.FetchSlots (default 64, files fetch-0..N-1 in the pool).
HoldFetch takes a free slot without waiting, from the key's hash slot;
with every slot held it blocks on its hash slot (the kernel queues the
waiters) and tries the other slots every 20 ms, using whichever lock comes
first and releasing the other; its context bounds the wait, and a lock got
after that is released at once. lockBlocking on Unix and Windows.
- storage: BudgetFetch; fillOnce holds one slot across its remote read only
(a read miss and a hydrate-all fill alike); a context error on the wait is
the hydration path's pending, as before.
- blockvolume: --host-limit-fetch-slots. Invariants: INV-HOST-FETCH-CAP-001;
M7 states it. v1.1 notes carry it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seams: Config.FetchSlots (default 64), fetchSlot (a key's hash slot),
Limiter.HoldFetch (no cap yet) and storage.BudgetFetch.
- TestHoldFetchCapHoldsAcrossProcesses: with every slot held by other
processes, a fetch waits until one is released, then takes it. Fails here.
- TestHoldFetchAWaiterThatGivesUpLeavesNoSlotHeld: a waiter past its context
returns the context's error, and a slot it gets after is released at once.
Fails here.
- TestHoldFetchTakesAnotherSlotThatFreesFirst: a waiter behind a slow holder
of its own hash slot takes another slot within one retry interval of its
release. Fails here.
- TestHoldFetchTakesAFreeSlotAtOnce: a fetch with a free slot does not wait
(holds here, must keep holding).
- TestChunkFetchHoldsAHostSlotAroundItsRemoteRead: a chunk fetch holds one
slot exactly across its remote read. Fails here: none is held.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cut marks a zero chunk equal to an absent base; marked now takes the
shape of changes (nil: cur must name nothing there), so a landed proposal
with such a mark is judged landed and one where cur names a reference is not.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>