- Retain deletes the exact attempt it planned: the attempt's entry is
marked deleting conditionally and the name record is removed only
while it names that attempt; a replacement is reported as replaced.
- Fork records a hold (forkholds/<name>/<attempt>/<target>) before it
reads the parent. Retain marks first, then reads the holds: a live
hold reverts the mark (fork_held); a fork holding after that read
finds the attempt deleting and refuses before installing anything.
A hold counts while its target has no HEAD and its VOLUME records the
fork, or while it is younger than the operation deadline.
- A pass stopped after a mark finishes (or reverts) it on the next run.
- Log-spaced keeps use rolling windows anchored at now.
- Exclusive bytes resolve "@owner/key" refs and count every volume's
HEAD and live snapshots as holders; documented as eligible for GC
subject to its grace period and intents.
- Retain reports confirmed deletions, the failing snapshot (uncertain
or not) and what it never reached; the CLI prints them with the
error and exits nonzero.
- chunkControl.Snapshot validates the class before any cut;
invalid_class and invalid_policy map to 400.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Controls for the six review findings on retention, failing against
stubs that restore each old behaviour:
- a same-name pinned replacement made after planning is deleted
(retain deletes by name);
- a fork that starts after the scan loses its parent; a stale hold;
a fork after the hold check;
- log-spaced keeps use calendar periods (10:20 and 09:50 both kept
at 10:30 with keep-hourly 1);
- exclusive bytes ignore a fork's "@owner/key" holders;
- a failing pass discards its partial result (catalog and CLI);
- an invalid class cuts before it is refused, and maps to 409.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude05's rulings (2026-11-15 22:53Z).
Retention, policy on the VOLUME entry: keep the newest KeepNewest
unpinned snapshots, every pinned snapshot not yet past its ExpiresAtNs,
every snapshot younger than KeepYounger (a future creation time from
clock skew counts as young), the newest snapshot of each of the last
KeepHourly / KeepDaily / KeepWeekly periods, and every snapshot a fork
still needs (named by a fork whose HEAD is absent or aborted). Everything
else is deleted through DeleteSnapshot (attempt-scoped tombstones; HEAD
untouched; names freed); GC reclaims the chunks. Equal creation times
rank by name. Semantic and labeled snapshots are not exempt; a pinned
snapshot past its expiry is unpinned. Defaults: 10 newest, 1h. A dry run
plans and writes nothing. The policy is stored as extended attributes on
the VOLUME entry, conditional on a revision.
Accounting, from manifests and filer listings (no data reads; a chunk is
ChunkBlocks x BlockSize, the last clipped): live bytes from HEAD;
per-snapshot exclusive bytes (referenced by no other holder); stored
bytes from the volume's chunk-key bindings, exact for referenced keys
and a full chunk (an upper bound, flagged) for the rest. The
unreferenced-not-yet-collected bytes come from GC's preview once #140
merges; bytes uploaded since creation need a counter (follow-up).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude05's rulings (2026-11-15 22:53Z): the surfaces and the controls,
with the behavior stubbed (the planner keeps everything, the policy is
not stored, usage reports nothing, no fork needs a parent, the class is
neither validated nor stored).
- chunkstore: snapshot class (semantic / pinned) on the snapshot;
RetentionPolicy stored on the VOLUME entry (extended attributes, CAS on
a revision); planRetention / Retain [dry run]; Usage (live, per-snapshot
exclusive, stored bytes).
- volume: GET /status/chunk?volume= (usage and policy); the snapshot
route carries "class".
- sw-block: ops chunk usage, ops chunk retain [--dry-run | --set-policy
--keep-*], snapshot --class / --pin / --expires.
- controls: policy edges (newest N with name tie-break; pinned never
expired by count or age but unpinned past its expiry; semantic and
labeled snapshots not exempt; younger than T and clock skew; hourly
buckets; fork parent), an agent checkpointing every step stays bounded,
dry run writes nothing, retain keeps N + pinned and frees names, the
policy CAS, class validation, an incomplete fork's parent kept, usage
from manifests; CLI usage/retain; and a real-service test against
SeaweedFS (chunkstore_integration, CHUNKSTORE_WEED): N+5 snapshots plus
pinned ones -> retain leaves N + pinned, accounting follows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #134 r2 (one P2): duplicate volume/replica keys in one report
were accepted. The health transition compared against the first prior
match while every entry was stored, so repeating [healthy, unhealthy]
for one key invented a replica_unhealthy event that did not describe
the stored slot.
The observation store now refuses an observation with a repeated slot
key (ErrInvalidObservation) before any mutation, so no transition and
no store change result; validateHeartbeat refuses it at the RPC with
the offending indices. Distinct slots are unchanged.
TestStatusFrontendsForAssignedVolume_DedupesRepeatedFacts ingested its
fact through a heartbeat that repeated the slot; what it pins is the
status dedupe over repeated replica IDs, so it now ingests the fact
once. No production heartbeat repeats a slot (one slot per blockvolume
process).
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #134 r2: store controls (conflicting and identical duplicate
volume/replica keys refused with no transition and no mutation; distinct
slots still yield one transition each) and an RPC control (a duplicate-slot
heartbeat is refused; status and timeline unchanged).
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
codex01's AMEND on #134 (three P2s; the disarm policy is unchanged):
1. Only a ready fact for the watched primary epoch clears or disarms
the watchdog. The full promotion fact is passed and its epoch is
compared with the watched epoch under the watchdog lock, so an
engine still ready at an older epoch (its new assignment refused at
admission) cannot disarm the new assignment, and an assignment that
advances while the fact is read is not cleared by it.
2. The G1 role-admission latch of a primary-assigned replica is checked
before readiness: it reports role_admission_failed for as long as it
holds, whatever an older engine-ready fact says.
3. Health events come from the accepted store mutation itself:
ObservationStore.IngestWithHealthTransitions returns, under the
store lock, each slot whose unhealthy reason the accepted report
changed against the same server's previously stored fact. A refused
report yields none and expiry never fabricates a clear. The master
ingests and records those events under healthMu, so events follow
accepted order across concurrent heartbeats.
Lock order: healthMu -> store.mu (released inside ingest) -> event
ring; nothing else takes healthMu, and neither the store nor the ring
calls back into the host. The watchdog keeps its own mutex and calls
nothing while holding it.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Controls for codex01's AMEND on #134 (three P2s), with the API shape
only (the watchdog takes the promotion fact's epoch; the store can
return accepted health transitions; the master Host has healthMu), the
behavior still as in 845bdc0:
- real host: ready at epoch 2, the epoch-3 primary assignment refused
at admission (peer-set install fails): the engine still ready at
epoch 2 must not disarm epoch 3, which times out; a genuine epoch-3
ready fact clears it;
- real host: a ready primary whose epoch-3 role call fails (G1 latch)
must report role_admission_failed despite its old ready fact; a
successful redelivery clears it;
- master: a second heartbeat landing between the first one's ingest and
its event bookkeeping must leave both events, in accepted order;
- master: expiry during an ingest that reports unhealthy again must not
fabricate a clear;
- control: a refused older heartbeat records nothing.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude05 accepted the disarm rule (21:24Z): after a fresh ready fact
clears it, the watchdog stays disarmed until the next primary epoch or a
new process incarnation. Tests:
- ready, then not ready an hour later on the same incarnation (and the
same assignment replayed): no recovery_timeout;
- a restarted process (new incarnation, same primary epoch) is re-armed
and reports recovery_timeout past the timeout, while the old process
stays disarmed;
- master: a running primary that degrades on the same incarnation (no
unhealthy reason) follows the normal failover rules to the qualified
peer, and nothing is listed as unhealthy.
Doc only otherwise: the watchdog comment names the incarnation re-arm.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Volume: a replica holding the PRIMARY assignment that has not produced
the engine's promotion-ready fact within --recover-timeout (default 30s,
from the primary assignment in this incarnation) reports
Eligible=false with unhealthy_reason=recovery_timeout instead of staying
silently not-ready. The G1 role-admission latch of a primary-assigned
replica reports role_admission_failed. A fresh ready fact clears it
(Eligible=true, reason empty) and disarms the watchdog until the next
primary epoch. Supporting replicas are never flagged; /status shows
their catch-up state (elapsed, lag).
Master: an explicit unhealthy slot is ineligible, so it gets no boot
grace and fails over at once to a peer that passes the promotion
evidence gate; with no qualified peer nobody is promoted. The reason is
listed in QueryVolumeStatus (unhealthy_replicas) and recorded as
replica_unhealthy / replica_unhealthy_cleared events when a slot's
stored reason changes.
wal_corrupt and io_error need typed failures from the durable recovery
path: tracked as a follow-up issue.
Lock order: the watchdog has its own mutex and calls nothing while
holding it; the master's transition check reads the observation store
before and after ingest and appends to the event ring, holding neither.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#128 rule 6 (claude05's rulings 21:07Z): declarations with the decision
stubbed, plus the controls.
- proto: HeartbeatSlot.unhealthy_reason (13); StatusResponse
.unhealthy_replicas (9) with ReplicaUnhealthy (regenerated with the
checked-in generator versions; the gRPC file is unchanged).
- authority: SlotFact/HeartbeatSlot.UnhealthyReason (raw fact).
- volume: the recovery watchdog type and Host wiring (primary
assignment, supporting admission, heartbeat Eligible/UnhealthyReason,
/status UnhealthyReason and CatchUp), --recover-timeout on blockvolume
(default 30s, logged at start); its decision is stubbed here.
- controls: a primary-assigned not-ready replica past the timeout
reports Eligible=false + recovery_timeout; ready clears it and
disarms the watchdog, a new primary epoch re-arms it; the G1 latch
reports role_admission_failed; /status shows the reason and a
supporting replica's catch-up state; the master promotes nobody
without a qualified peer and shows the reason in volume status and as
replica_unhealthy / replica_unhealthy_cleared events. Controls that
pass on both sides: a supporting replica is never flagged; an
unhealthy primary fails over at once to a qualified peer.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every /chunk error is a typed JSON body (B9 codes plus the 2026-11-15
transport errors), except an unknown path, which fell through to
net/http's plain-text "404 page not found". A catch-all /chunk/ route
now answers 404 {"code":"not_found","retryable":false}. The known routes
are unchanged; with the endpoint disabled, /chunk is still not mounted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #130 r5 (one P2): the recovery re-probe triggered on the
newer heartbeat's ReadyForPrimary bit alone. A newer engine-ready but
ineligible, withdrawn or unreachable heartbeat, with the frontend now
ready, led to a re-probe that returned the current primary ready, so
the gate skipped its placeability check and preserved an excluded
primary.
The trigger is now the whole fresh verdict: the newer fact must be
ready and placeable (reachable, eligible, not withdrawn). An excluded
newer fact causes no re-probe, so the first verdict and the gate's
fresh placeability/grace check decide, and the failover stands.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Counter-controls for the review of #130 r5 (tests only, on 6989dfd),
through the real workload-plan provider with the peer query held: the
frontend finishes recovery but the newer heartbeat, though engine-ready,
excludes the current primary (ineligible, withdrawn, unreachable). The
failover must stand; frontend readiness must not preserve an excluded
primary. The recovered-placeable positives and the engine-ready /
frontend-unready counter-control are unchanged.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every reconciliation start and every BeginBaseInstall bumps a generation.
A worker selects slices, records compare results and certifies the dirty
set only while its own generation is current, so:
- a worker running when a BASE install begins can no longer finish over
it and clear the install guard (Base=Installing), in memory or on disk;
finishReconcile also refuses while the guard is set (two independent
guards);
- a worker that saw its set empty, or compared a chunk, before a BASE
install restarted reconciliation can neither certify the replacement
run nor delete from its set.
A replaced run closes its channel, and waitReconciled re-checks against
the current run.
Deterministic schedules (test hook at slice, compare and certify):
- held worker -> BeginBaseInstall -> worker resumes: cuts stay refused
as base_installing, the persisted header keeps Installing, a restart
still refuses;
- old worker paused at certify -> Begin/EndBaseInstall -> old resumes:
the replacement stays reconciling and untouched, cuts refused;
- old worker paused after a compare -> Begin/End -> old resumes: the
replacement set is untouched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recover republishes the dirty map but did not take captureMu, so it could
run inside a quiesced cut: after the cut's Sync fixed H and before its
copy, a same-open Recover could publish a newer complete record (H+1) and
the cut would copy those bytes into a HEAD labelled H. Recover now holds
captureMu shared (order captureMu -> lifecycleMu -> mu), as Write,
WriteBatch, ApplyEntry and WriteExtentDirect do; nothing calls Recover
under captureMu.
Control: a real partial batch pwrite leaves a complete record at H+1; the
cut parks right after its barrier Sync fixed H and starts a same-open
Recover, which waits for the barrier; HEAD at H holds no post-H bytes and
the next cut publishes the recovered bytes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The typed control codes map every unlisted cause to 500 internal, so a cut
refused while the layer reconciles its dirty set (and a detach whose
deadline ended during reconciliation) reported internal. They now answer
409 with code reconciling, retryable, as ruled for the reconciler.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a layer's dirty set is unknown, its first cut used to hash-compare
every chunk under the capture barrier, which paused writes for a
whole-volume copy. The unknown case is a lost or mismatched bitmap, or
a BASE install that just finished.
Now the layer reconciles in the background, outside the barrier:
- The reconcile set is every chunk with a local copy (an absent chunk
never written locally is HEAD's content).
- A layer-owned reconciler, joined on Close, takes bounded slices. Per
chunk it reads through the normal read path, hashes, and compares
with HEAD; a mismatch sets the chunk's dirty bit. A write racing the
comparison marks its chunk dirty anyway.
- When the set is empty, the dirty set is saved first, then a header
naming HEAD. A crash between the two leaves a mismatching header, so
the next attach reconciles again rather than trusting an incomplete
bitmap. Then cuts resume, uploading only dirty chunks.
While reconciling, no HEAD moves:
- Cut, Capture and MakeRemoteDurable return ErrChunkReconciling
(retryable).
- Detach waits for reconciliation within its deadline, then makes its
normal cut; otherwise ErrChunkReconciling.
- The automatic cut scheduler skips the tick (not a failure, no
backoff).
A fresh host (FreshFromHead) starts with an empty dirty set instead of
an unknown one. Its local volume is new and accepts no write before
attach, so a new volume never reconciles.
Stats gains Reconciling and ReconcileDone/ReconcileTotal. DirtyChunks
(the scheduler's threshold) does not count chunks awaiting
reconciliation.
Test changes:
- The storage fixture waits for reconciliation after attach.
- The BASE tests wait after EndBaseInstall.
- The chunkstore source-host fixtures (including the catalog fork test)
attach as fresh hosts, which is what a new empty volume is.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #130 r4 (one P2): the production provider probes the current
primary first, then the peers. If the current primary's frontend
finished recovery and a newer ready heartbeat arrived during the peer
queries, both gates ended its grace but still direct-reassigned from the
probe's outdated Current.Ready=false.
Both gates now go through probePromotionCandidatesCurrent: when the
current primary's own fresh heartbeat advanced to ready (a newer fact or
a new incarnation) while the probe ran and the probe said it was not
ready, the probe is run once more and that fresh result decides. A
heartbeat is never taken as frontend readiness: if the fresh probe still
finds the frontend unready, the failover stands; a heartbeat already
ready before the probe causes no re-probe.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Controls for the review of #130 r4 (tests only, on bb37750), using the
real workload-plan promotion provider over fake /status servers. The
provider probes the current primary first, then the peers; the peer
query is held while the current primary's frontend finishes recovery
and a newer ready heartbeat arrives. The gate must not direct-reassign
from the probe's outdated current verdict (unsupported and supported
paths). Counter-control: a newer engine-ready heartbeat while the
frontend is still unready still fails over.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recover republishes the dirty map outside the write path: a partial batch
append can leave a complete newer record that same-open Recover publishes.
It only invalidated the WAL-sync coverage generation, so a chunk staged
before it could be reused over the recovered bytes. Recover now tells an
attached chunk layer, which counts a mutation of every chunk (O(chunks),
recovery only), also on a failed or partial scan, before s.mu is released
so no read sees recovered bytes first.
Control: stage chunk 0, then a real partial batch pwrite and same-open
Recover before the barrier: HEAD at the recovered H has the recovered
bytes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #130 r3 (three P2s; the same class as r1/r2, so fixed
structurally rather than per branch):
- Controller: a supported snapshot that carries any superseded slot
fact (older than the newest recorded for that replica, or equal-time
with another incarnation) is a stale snapshot. It records nothing and
no decision branch runs on it (readiness, endpoint refresh, rebalance,
failover, fallback); any existing desired is kept, as for a stale
authority basis. Fresh facts, including fresh unhealthy and expiry
decisions, are unchanged.
- Unsupported-volume gate: the current primary's own fresh slot fact is
recorded for every unsupported volume, before the promotion-reason
allow-list and concrete-placement filters, so ready reports and starts
under any reason are counted. The promotion rules are unchanged.
- Both gates decide after the blocking probe from the current primary's
fresh slot read at that point (primaryBootGraceHoldsNow), so a newer
unhealthy report or a heartbeat that expired during the probe is seen;
the unsupported gate also skips if the authority line moved during the
probe.
Lock order unchanged: state under TopologyController.mu; the gates read
the publisher line and the store snapshot (their own locks, released)
before calling the controller; no new locks.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Controls for the review of #130 r3 (tests only, on 4c84545):
- controller: a delayed READY fact of the previous incarnation with an
obsolete endpoint must not drive an endpoint refresh; after newest B
reported ready, a delayed UNREADY A must not fail over (a fresh
unready B still does);
- unsupported for a reason outside the promotion allow-list
(UnknownReplicaClaim): a ready report and a restart seen then must
still be recorded, so after the reason clears the same incarnation
going unready, or a third start, gets no grace;
- held promotion probe: a newer unhealthy report, or heartbeat expiry
while the grace still runs, during the probe must lead to failover;
an unchanged fresh primary across the held probe keeps its grace.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chunk's highest write LSN is not a change detector: a replica apply
may land a block at an LSN below another block of the same chunk, so the
maximum does not move and a stale stage could be reused. Each chunk now
has a mutation count, raised after every dirty-map insert (a write, a
batch write, a replica apply at any LSN) and every BASE block; flushing
moves bytes without changing them and never counts. It is an atomic
per-chunk counter on the write path (O(1), lock-free), sampled before the
staging read and compared at the barrier.
A barrier Sync failure after staging is a clean abort: the cut's staging
intents are deleted (a failed delete is kept and retried by the next cut).
Real-caller controls:
- chunk 0 holds a@10 and b@5; after the staging read, ApplyEntry(b, 6)
through the production apply path, in the WAL and flushed: HEAD at H
has b@6;
- staged uploads, then the local fsync fails at the barrier: no intent
is left; with the intent delete failing too, the intent is kept and the
next cut settles it and publishes the exact image.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #130 r2 (three P2s):
- The unsupported-volume gate records the current primary's own fresh
slot fact on every pass (RecordPrimaryBootFact), not only when a
promotion is considered, so a ready report ends the grace and ready
restarts count toward flap history.
- The grace decision is ordered like the history: a superseded fact
(older than the newest recorded one, or equal-time with another
incarnation) is not a decision input. The decision follows the newest
recorded fact (its incarnation, placeability and grace clock), and a
superseded fact's endpoint is never used for a refresh. A fresh fact
still needs to be placeable and not ready.
- The cap uses the observation store's effective freshness window
(FreshnessConfig.EffectiveFreshnessWindow), so an omitted window caps
at its 10s default; an unset or nonpositive grace takes the window.
Lock order unchanged: state under TopologyController.mu; the gate reads
the store snapshot (its own lock, released) before calling the
controller; no new locks.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Controls for the review of #130 r2 (tests only, on b5a23c2):
- unsupported path, full product tick: a READY tick (probe says the
current primary is ready) must still record the fact, so unready again
in the same incarnation fails over; and ready restarts count toward
flap history, so a third start gets no grace;
- controller: a delayed UNREADY fact of the previous incarnation, and an
equal-time fact with a changed incarnation, must not defeat the
restarted primary's grace;
- cap: an omitted freshness window is the effective 10s default and caps
an explicit 5m grace; a nonpositive grace takes the window.
The unsupported tests now use a switchable promotion probe.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #130:
- P1: the unsupported-volume promotion gate reassigned directly even
when only a different slot was stale. It now judges the current
primary from its own fresh heartbeat slot in the observation store
(FreshSlotCandidate, server reachability/eligibility folded in) and
skips the direct reassign while that slot is placeable and inside its
boot grace. Placement-synthesized facts are never used for it.
- P2: boot history is ordered by observation time. A fact changes the
incarnation, start count, or ready latch only if its ObservedAt is
strictly newer than the last recorded one for that replica, so a
delayed or superseded snapshot (or an equal-timestamp replay) never
counts a start nor resets or ends a grace. Both gates go through
PrimaryBootGraceHolds, which records the fact under the same rule and
evaluates it.
- P2: a configured PrimaryBootGrace above the freshness window is
capped at it (logged), never widened.
Lock order: boot-grace state stays under TopologyController.mu and the
new code adds no call out of it (existing paths call the authority
reader under c.mu, unchanged). The gates call PrimaryBootGraceHolds and
read the observation store's snapshot (its own lock, released before
the controller call) while holding no host lock. No new locks.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Controls for the review of #130, on 6c00734 with declarations only
(ReplicaCandidate.ObservedAt copied by the snapshot builder; a
PrimaryBootGrace() accessor):
- full product tick on the unsupported-volume path: the third server's
facts age out (StaleObservation) while the current primary reports a
fresh, placeable, restarted, not-ready slot. Today the gate reassigns
directly inside the grace;
- an ineligible restarted primary still fails over at once (control);
- a configured grace above the freshness window is capped, and an
unready primary fails over at the capped limit;
- an out-of-order snapshot carrying the previous incarnation's older
fact, and an equal-timestamp fact, must not change boot history.
The controller rig now advances its clock after the steady fact, so
every later fact is strictly newer.
Refs #128
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ruling (B9 W3 bound): the dirty threshold, now the layer's BarrierBound,
bounds how many chunks a cut copies under its barrier; it never triggers
a cut.
- While more candidates than the bound would be copied, the cut stages up
to the bound per round outside the barrier: current bytes, compared to
HEAD, uploaded under fresh content keys named by an intent written
before the round's first upload.
- Each staged chunk records its version: the chunk's highest write LSN,
flushed or still in the WAL, taken before the read. Flushing never
changes it; any later write raises it, so a stale stage is never used.
- At the barrier a staged chunk stands for the copy only while its
version and HEAD are unchanged; the rest is copied, so the image at H
is exact.
- At most three staging rounds; then the barrier copies the rest
(correctness over pause), counts BarrierOverBound and reports the
barrier copy size (BarrierCopyChunks).
- Every intent of the cut (staging rounds and the barrier) is settled
with it: deleted after the confirmed CAS or a clean abort, kept with an
unresolved proposal. Superseded staged keys stay under their intent
until then.
- Snapshot, explicit Cut and Detach's final cut share the path.
The barrier copy and staging share one readChunk helper. The provider
passes ChunkDirtyThreshold (default 512) as the bound.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>