- prepareTouched, before the barrier and outside the pause, runs the
once-per-layer seed, a pending recovery's clean-fill touches, and makes
the cleared spare set; takeTouched at the barrier is a pointer swap.
- A recovery that lands between prepareTouched and the barrier is taken
at the barrier as a flag (O(1)): the window covers every chunk until it
narrows, and the clean fills are judged after the pause, with the
touched set's members. A refusal before the judgement keeps the request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The touched set's allocation and the recovery's clean-fill enumeration
now count themselves in PauseCandidateOps when the guest is paused.
- TestAColdFirstCutAllocatesNoSetInThePause: a layer's first cut at the
1 TiB shape (fails: 4,097, the spare set allocated at the take).
- TestARecoveryJustBeforeTheBarrierIsJudgedAfterThePause: a recovery
between the pre-barrier work and the barrier (fails: 9, the clean fills
enumerated at the take); the cut must still judge every clean fill.
- TestTheFirstCutAfterWritesDoesNoPerCandidateWorkInThePause now fails
too (the spare allocation).
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>
TestTheFirstCutAfterWritesDoesNoPerCandidateWorkInThePause: the first cut
after writes to many chunks must do no per-candidate operation between the
barrier's lock and its release, at 32 blocks and at the 1 TiB shape with
256 changed chunks (fails: 73 and 1,600 operations; the candidate step,
the known-equal filter, versions, the base refs and the copy-order hint
all run in the pause).
Seam: chunkCutStats.PauseCandidateOps, counted while a pause flag is up.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The window no longer sorts the candidates and makes one entry (with its
channel) per candidate inside the guest pause. It keeps the candidate set
and the staged marks (immutable once installed) and makes a chunk's entry
on its first touch: a guest write's save or the copier. Side-file slots
are handed out in touch order. After the pause, the copier lists the
covered chunks that a pre-copy does not hold and no touch has finished.
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>
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 barrier's candidate step no longer walks the chunk map, nor the
absent and clean-fill maps. It judges the members of a touched set, a
chunk bitmap with a per-word summary (1 bit a chunk), with the same
predicate the map scan used: (UNKNOWN and not known equal to HEAD) or
above remoteLSN, minus absent chunks with no local write. The barrier
takes the set by a pointer swap; readers (status, precopy, the record
shadow) list a copy.
- The set is a superset of the chunks whose answer may have changed: every
map entry change (OnMapEntryChange: a write's LSN, UNKNOWN by a direct or
BASE mutation or a reused LSN), every version move, a HEAD install's
changed refs (a whole install: the clean fills whose ref changed; a
commit: its changed chunks), a recovery (every clean fill), and a
once-per-layer seed on first use, outside the pause: every entry UNKNOWN
or above remoteLSN, minus absent chunks with no local write.
- The cut syncs the store once right before its barrier, outside the
pause (PreSyncNs, apart from BarrierPauseNs), so the pause's own sync has
only what came after it.
- A test fixture that forgets clean-fill marks as a restart now touches
those chunks, as a restarted layer's seed does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- An idle cut's candidate step must visit at most the summary words plus a
constant (counted, not timed) at 4,096 and 262,144 chunks (the 1 TiB SPACE
shape); a one-chunk cut likewise (fails: the step visits every map entry,
4,097 and 262,144).
- The cut must sync the store before its barrier, outside the pause, and
report that time apart (fails: no sync before the barrier). A control
checks the counter sees the pause's own sync.
- Guards, passing today and kept: an unknown commit outcome that did not
land loses no chunk (its chunks and a later write are published by the
next cut, nothing else changes); the candidate set's OR-back keeps the
summary and each lists exactly the set bits.
- Seams: chunkCutStats.CandidateVisits, counting the candidate step's
current visits, and PreSyncNs.
The candidate set type (a chunk bitmap with a per-word summary: set O(1),
walk O(C + S/4096), OR, clear) and the record runtime's take/return of it
come from an earlier parked branch, rebased onto the one-byte record codes.
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>
With neither --memory-limit-mib nor GOMEMLIMIT, a cgroup v2 limit that
cannot be derived (a membership outside the cgroup2 mount of the holder's
mount namespace, an unreadable or malformed memory.max) is the no-limit
case: the holder keeps the 256 MiB default and starts, instead of exiting
2. applyMemoryLimit, run once logging is configured, logs one level=WARN
line naming the derivation's error and the two ways to choose a limit, and
status reports the reason in Memory.SoftLimitFallback (empty otherwise).
Only an explicit but invalid limit still refuses.
Docs: the flag's help, the operator guide's memory section, the status
schema and the v1.1 notes.
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>
- A holder whose cgroup v2 limit cannot be derived (its membership is
outside the cgroup2 mount of its mount namespace, or memory.max is
unreadable), with neither --memory-limit-mib nor GOMEMLIMIT, must start
on the 256 MiB default and record why (fails: exit 2 on the derivation
error). An explicit but invalid flag still refuses.
- Applying that limit must log exactly one WARN naming the reason and the
two ways to choose a limit, and status must report the reason; a derived
limit logs nothing (fails: no WARN, status empty).
- Seams: flags.memoryLimitFallback, applyMemoryLimit (now called after
logging is configured), ProcessMemoryStatus.SoftLimitFallback,
volume.SetSoftLimitFallback / SoftLimitFallback.
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>
The controller never bound a once-reported static volume on Linux, so the
test now creates and places a volume through the lifecycle, ingests its
holder's heartbeat, settles the observation host (started == done, no
buffered wake, no timer due), runs the product tick (the master runs none
by itself), which binds the volume, and requires a build after that point:
only the line-change hook can take 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>