Commit Graph
327 Commits
Author SHA1 Message Date
Ping Qiu 367617c14b Merge pull request #222 from seaweedfs/fix/v3-local-pressure-sync
fix: reclaim native WAL under pressure without guest Flush
2026-11-18 22:15:34 -08:00
pingqiuandClaude Opus 5.5 bc5e3e6446 storage: P2 review fold: Lock-request handshake, bounded test helper, design wording
- 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>
2026-11-18 20:22:30 -08:00
pingqiu 41b6783a95 docs: integrate local reclaim liveness model and mutant configs 2026-11-18 19:40:20 -08:00
pingqiu bb17d7a835 docs: bind pressure progress to durability and lifetime invariants 2026-11-18 19:24:08 -08:00
Ping Qiu b6ca5237fd Merge pull request #216 from seaweedfs/feat/cut-cow-native
storage: move native chunk cut copying outside the write barrier
2026-11-18 19:16:05 -08:00
pingqiu 77b96d025d test: synchronize existing admission waiters and mark partial v3 replacement coverage 2026-11-18 17:35:32 -08:00
pingqiu 761882ba82 Merge native WAL admission fixes into COW cut branch 2026-11-18 17:13:37 -08:00
pingqiu b88c64cd15 docs: identify the burst caller and pattern controls separately 2026-11-18 16:25:55 -08:00
pingqiu dffda03239 fix: preserve terminal faults in WAL pressure waits and bind burst bytes to full LBA 2026-11-18 16:23:35 -08:00
pingqiu 0ff432fbe9 docs: pin native tail reuse controls in the liveness audit 2026-11-18 16:02:47 -08:00
pingqiu cd5d7db0ed docs: audit v3 admission and reclaim liveness replacements 2026-11-18 15:54:34 -08:00
pingqiu 8529530c4b fix: preserve binding refusals before capacity waits 2026-11-18 15:15:15 -08:00
pingqiu 44eea4ee49 fix: use native v3 WAL pressure for write admission 2026-11-18 14:54:00 -08:00
pingqiu ed23f149e2 test: make COW corruption and batch oracles precise 2026-11-18 12:31:01 -08:00
pingqiu cd6dff4f67 storage: copy native chunk cut images outside the write barrier
Fix H and candidates under the short barrier; save pending chunks before mutation.
Drain owners and waiters before cleanup, recovery, reset and close. Preserve
intent/CAS and local durability contracts. Include native caller controls,
existing model correspondence and a real-mount rehearsal note.
2026-11-18 12:05:39 -08:00
pingqiuandClaude Opus 5.5 83eb3d3d93 storage: end-to-end v3 test of the wrap/forged-replay scenario; spec open items 1-2 resolved in v3
TestWALStoreV3StaleLapBytesAtTheWrapAreNotReplayed replays the forged
replay reproduction (docs/spec/README.md, open item 2) end to end on a
mapped v3 WALStore: a guest batch in lap 1 carries a well-formed record
bound to the volume's own nonce at its lap-1 cursor (LSN 999, LBA 7); the
WAL wraps so one newer record overwrites only the batch's start and the
lap-2 scan resumes exactly at the embedded record. The cursor binding
stops the scan there; after a crash and reopen the frontier is the newest
real LSN and LBA 7 is never the forged data. With the lap dropped from the
cursor check the scan admits the record and the test fails.

README: open items 1 (corrupted synced records) and 2 (forged replay) move
to "resolved in v3 (code)", citing the v3 tests. Still open: the mode C
newest-batch residual (silent truncation until an idle refresh or
SetWMode(A)) and the TLA model, which has no nonce/cursor/lap binding
(S3v1_root_lww_I1 and S3f_* rerun on cc5cf09a with TLC 2.19: unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 11:18:58 -08:00
pingqiu 3987ae0e52 test(storage): retain C11 fixture evidence outside production graph 2026-11-18 08:14:54 -08:00
pingqiu b0ff0c21a6 refactor(storage): remove production C11 file bitmap store 2026-11-18 08:14:18 -08:00
Ping Qiu 56af794492 Merge pull request #197 from seaweedfs/feat/walstore-format-v3
storage: walstore format bump v3 (#51, #189)
2026-11-18 08:07:17 -08:00
Ping Qiu 4644a3400c Merge pull request #209 from seaweedfs/fix/workspace-lease-horizon
workspace: answer lease renewals from memory under a durable horizon (#205)
2026-11-18 07:46:41 -08:00
pingqiuandClaude Opus 5.5 6f5710a11b spec(workspace): record the WorkspaceTakeover rerun for the durable horizon (#205)
All 27 W4_*/RED_* configurations re-run against the model at 7dd83eb6
(TLC 2.19, BFS): existing passes still pass, the new horizon
configurations pass with failing extension writes and a restart,
RED_hz_noclamp violates HostWithinHorizon as expected, the existing REDs
and witnesses keep their verdicts, the two large and the two "both"
configurations reached their time limits with no violation, and the two
open findings (W4_drift, W4_forced_exact) are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 07:12:54 -08:00
pingqiuandClaude Opus 5.5 7dd83eb6c0 spec(workspace): model the durable lease horizon in WorkspaceTakeover (#205)
lease.exp is now the published horizon, dhz the horizon on disk and
deadline the latest grant. A renewal of a live lease writes nothing:
grant = min(now + TTL, horizon), refused while uncertain or without
validity, and it may trigger an extension. The extension (MasterExtend)
is an ordinary serialized writer that raises the horizon to
trigger + TTL + HSlack; with ExtFail its write may fail without landing or
after landing, and either way latches uncertain. Revocation, ACK and move
writes are refused while uncertain; a restart reloads the disk horizon and
clears uncertainty. The revoking drain reply is clamped to
min(horizon, deadline). Nondecreasing time is stated as a model assumption.

New invariants HostWithinHorizon and DiskCoversMemory; witnesses
W_NoExtension, W_NoExtLanded, W_NoUncertain. New cfgs W4_hz_* (failing
extensions, clean/forced/both, one restart) and RED_hz_noclamp (no clamp:
EXPECTED to violate HostWithinHorizon) with the control
RED_hz_noclamp_safety (no clamp, split-brain invariants: expected to pass,
the restart rule covers grants). Existing cfgs gain Clamp = TRUE and
ExtFail = FALSE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 05:28:45 -08:00
pingqiuandClaude Opus 5.5 42e828a14c test(workspace): strengthen the concurrency control, bound held-write cleanup (#205)
Review folds, tests and docs only:
- The combined concurrency control now requires its schedule: a bounded
  handshake holds the first horizon-extension write inside the store
  while renewals keep succeeding and the writers and Close are in flight
  behind it, then releases it. It counts successful grants per eligible
  volume and extension writes classified by content (a raised horizon at
  the same epoch, not an ordinary writer's record) and requires both.
- It adds the forced-move arm next to the clean move: the forced volume
  is granted at an earlier injected time, so its horizon + skew barrier
  has passed when the writers run; the clock only moves forward.
- Held-write controls install their release cleanup before the hold is
  triggered, bound every admission and completion wait, and on any
  failure release, settle workers with bounded joins and only then close
  fixtures.
- Docs: an uncertain volume refuses renewals that would issue a new or
  extended grant; a Revoking lease still gets its bounded drain reply,
  min(horizon, deadline), never extended, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 05:22:00 -08:00
pingqiuandClaude Opus 5.5 521e1e8cb2 docs(workspace): invariants and lease docs for the durable horizon (#205)
- invariants.md: M2 lease rows (first grant writes the horizon, renewal
  from memory under a clamp, revoking reply carries the grant, expiry
  and forced barrier on the persisted horizon); new rows
  INV-LEASE-VIEW-001, INV-WS-LEASE-HORIZON-001,
  INV-WS-RENEW-NONBLOCKING-001 and INV-LIFECYCLE-SNAPSHOT-001;
  INV-WS-FORCED-MOVE-001 now names the horizon and the reply clamp.
- INV-AUTH-UNCERTAIN-001 moves from STUB to ACTIVE: its renewal reader is
  documented, and the ambiguous-extension control now also asserts that
  a revocation and an endpoint change of the uncertain volume are
  refused.
- Proof-text folds: the forced-barrier argument assumes nondecreasing
  master time, an assumption of the current WorkspaceTakeover model,
  not a consequence of time.Now's monotonic reading; the horizon
  invariant treats an ambiguously persisted issued successor (lease
  cleared) as the ordered clean-handoff or forced-barrier case.
- agent-workspace-design.md section 7 and workspace-lease.md: the
  master side of a renewal, the extension, the capacity bound, the logs.

The WorkspaceTakeover specification is not changed here; its update and
recorded configuration results are a later acceptance step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 05:00:43 -08:00
pingqiu fbd33f9712 test: restore native typed cut controls and close activation isolation coverage 2026-11-18 04:16:20 -08:00
pingqiu a81bca4926 feat(storage): activate mapped v3 through the production storage callers 2026-11-18 03:49:47 -08:00
pingqiu 8bdaf88f66 fix(storage): serialize WAL reuse with dirty retirement and revalidate catch-up reclamation 2026-11-18 03:38:12 -08:00
pingqiu 169923df83 fix(storage): reclaim covered v3 WAL prefixes through both slots 2026-11-18 01:40:01 -08:00
pingqiu 0fe8b00efc fix(storage): exclude offline migration from v3 open owners 2026-11-18 01:00:15 -08:00
pingqiu 5d3a11f910 fix(storage): close v3 catch-up BASE source lifetime gaps 2026-11-18 00:43:07 -08:00
pingqiuandClaude Opus 5.5 883b455134 docs: COW design, review fold 2: owner references through all I/O
Step 6 counted only saved-chunk readers. A saving writer and a copier
reading the live chunk also do I/O outside the per-chunk mutex, so an abort
or Close could see zero references and delete the side store while they
were still in I/O. Now every saving or copying owner holds a window
reference from its state claim until its I/O ends, readers hold one too,
abort does not wait for its caller's own reference (a self-aborting owner
releases first), Recover/reset/Close join every owner and reader before
their destructive transition, and the side store is deleted exactly once
at a terminal state with no reference outstanding. The test list names the
held saving owner and held live-copy owner cases. Text only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 22:18:56 -08:00
pingqiuandClaude Opus 5.5 451fa936a7 docs: COW design, review fold: pre-publication save, owners, abort protocol
Design review of the copy-before-write proposal, folded in one revision:
- the COW step runs before publication and outside store.mu (right after
  captureMu shared, before lifecycleMu/mu, the WAL append and the dirty-map
  insert), because the save uses the ordinary read path; a post-publication
  hook cannot do this; lock order stated;
- one owner per chunk (copier: pending -> copying -> done; writer:
  pending -> saving -> saved), a per-chunk mutex never held across I/O,
  waiters on a per-chunk condition;
- batches visit chunks in ascending index and finish each before the next,
  so they cannot deadlock with each other or the copier;
- terminal states closed or aborted; abort on save error, cancel, fence,
  and before Recover/reset/Close in the same open, taken before the
  mutation proceeds; waiters woken; the cut fails retryable and keeps its
  dirty set; a guest write is never refused for a cut problem;
- the side store is deleted only after close/abort with its refcount at
  zero; upload, manifest and CAS work from the buffers, so an unknown CAS
  keeps today's semantics;
- BASE: capMu stays held for the whole cut and already excludes
  Begin/EndBaseInstall (the earlier open point is removed);
- reads bind to the format-v3 read path, no flusher hook;
- the Model paragraph states what the model does not cover (owner races,
  batch order, abort), and the test list grows to match.

Text only; the TLA+ model is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 22:13:36 -08:00
pingqiuandClaude Opus 5.5 4408dd8ee1 docs: propose copy-before-write for the cut window, with its TLA+ model
The cut copies every candidate chunk under the capture barrier, so writes
stall for the whole copy (1.50 s at 3 GiB dirty in a lab measurement).
agent-workspace-design.md section 5 now has a proposed (not implemented)
copy-before-write design: the barrier only fixes H and the candidate set;
the first write to an uncopied candidate saves its at-H content to a local
side store; a write to a chunk being copied waits; the copier reads the side
store or the live chunk; the side store is dropped at the CAS and on crash,
and recovery never reads it. Alternatives, the open BASE-install point, and
the tests to write with the code are listed. Section 14's cut-cost gap
points at it.

docs/spec/CutCOW.tla (S4c) models today's barrier cut and the design, with a
two-step chunk copy and one crash. Both pass exhaustively at MaxLSN 6 with 2
cuts (COW 34,342,214 states, barrier 5,070,320). Each of the six design rules
is necessary: dropping any one violates BufFrozen. 11 configs, run.sh and
the spec README updated; all 13 specs pass SANY with tla2tools 1.7.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 22:02:53 -08:00
pingqiu 238aa54b02 fix(durable): withhold chunk publication until owner attachment commits 2026-11-17 21:06:20 -08:00
pingqiu 16c913e32b fix(durable): retain BASE until provider attachment is durably committed 2026-11-17 20:53:02 -08:00
pingqiuandClaude Opus 5.5 e69c54de17 feat(storage): the provider's durable chunk-attach commit lifts the BASE deferral (row 12a)
codex03's row 12a retirement-timing seam, store half: a completed BASE
must not retire while the provider's fresh-from-HEAD marker could still
make a reopen seed from HEAD over the completed local bytes.

- CommitChunkAttachV3(commit) runs the provider's commit (the marker
  removal and directory fsync; no store re-entry) under installMu
  exclusive, and only when it succeeds records this open's durable
  attach and lifts the retirement deferral of an installed volume. A
  failed commit changes nothing.
- OwnerChunkAttachDurableV3 reports that flag (atomic); Defer resets it at
  every managed open; a begin re-arms the gate but keeps the flag.

New edge: the provider's attachMu -> installMu; the store takes no
provider lock. Not a v3 store: commit only.

Control: the commit runs under installMu exclusive; a failed commit sets
no flag and the volume stays installed; a successful one retires it on
the next publication; Defer resets the flag. Mutants: lifting on a
failed commit, not recording the flag, committing outside installMu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:46:27 -08:00
pingqiu fd2ea05307 fix(durable): defer BASE retirement until local presence is durable 2026-11-17 20:35:12 -08:00
pingqiuandClaude Opus 5.5 7b47dd72ff feat(storage): an opt-in gate that defers BASE retirement (row 12a retired-BASE)
Descriptor-owner ruling on codex03's row 12a retired-BASE RED (6f545aad):
once a completed BASE retires to none, nothing durable tells the provider
that the local image is complete rather than a lazy seed. Retirement may
now be deferred, opt-in per store, so the installed descriptor stays that
evidence until the chunk layer has durably recorded local presence:

- DeferBaseRetirementV3 (the provider, at open, before Recover and any
  publication) and AllowBaseRetirementV3 (the chunk layer, after durable
  local presence) set an atomic gate on the publisher;
- retireBaseV3 is skipped while the gate is deferred; once allowed,
  retirement happens on the next ordinary publication;
- every successful begin re-arms a lifted deferral, so a later install in
  the same open needs its own durable presence before it may retire.

The publisher only reads the atomic under descMu: no new lock edge, no
format or durable field. Stores that never set the gate retire as
before, so a volume without a chunk layer cannot be stuck installed.

Control: a deferred store stays installed through publications whose
8.4 conditions hold, retires on the first one after Allow, and a second
install in the same open is deferred again. Mutants: a publisher that
ignores the gate; a begin that does not re-arm it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:26:34 -08:00
pingqiuandClaude Opus 5.5 173df33abd docs(design): how versions share chunks and how an old snapshot's data is freed
agent-workspace-design.md:
- section 3: a HEAD, a snapshot and a fork root are each a complete map
  (no backing chain, no per-layer bitmap); a cut uploads only changed
  chunks and rewrites only their segments; the dirty bitmap is local
  holder state, not part of a snapshot; a worked example (100 chunks,
  init, 20 rewritten, snap1: 120 objects, deleting init frees 20).
- section 6: the GC roots line now says what the code does: a deleted
  snapshot's attempt stays a root for one grace period after its delete
  time (Collector.snapshotAttemptHeads), then stops counting.
- section 6: freeing an old snapshot's data in three steps (delete the
  name, GC --apply with two marks a grace apart, SeaweedFS volume vacuum)
  with the timing at the default grace, and why GC uses a reachability
  mark rather than reference counts.

No invariant row changes (INV-GC-REACHABLE-001 already covers attempts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:04:50 -08:00
pingqiu 4a9d33f6f1 docs(storage): record dark chunk BASE transition guards and lock graph 2026-11-17 18:02:51 -08:00
pingqiuandClaude Opus 5.5 7c6a29d809 feat(sw-block): sw-block migrate-v3, the offline v2 -> v3 descriptor rewrite (row 13b)
DESIGN r17.4 section 10.1. The tool (cmd/sw-block/migrate.go) runs the
steps, each durable before the next: the read-only exhaustive scan and
the geometry check (a refusal changes no byte), the atomic operator
backup of the v2 superblock, the initial map sidecar (generation 1, every
chunk UNKNOWN, covered = the v2 checkpoint), the prepared slot B at 4096,
slot A at phase 0 (the commit point), slot B at phase 0, then the v2
chunk bitmap retirement, and prints the new descriptor hash. A rerun
decides from the slot bytes alone (the 10.1 table): a v2 A restarts with
a full rescan; a committed A finishes the rollover and the retirement; a
committed B only the retirement; a prepared B with an invalid A refuses
with ErrMigrationIncomplete; neither valid refuses. It never reads or
restores the backup.

core/storage/migrate_v3.go is the tool-only export: it reuses the row-1
slot codec and the row-6 map codec (no second encoder), keeps the extent
base (new WALSize = old - 4096), and opens or serves nothing.

Controls through the actual CLI entry and, tagged, the actual v3 open:
a clean migration (extent unchanged, backup, retirement, the old binary
refuses, an idempotent rerun, v3 serves the v2 blocks with an all-UNKNOWN
map), refusals changing nothing, a crash after each step, the old binary
after preparation, a partly and wholly overwritten prepared B, and the
backup never restored. Mutants: no clean scan, commit before prepare,
retire before the commit, no rollover on rerun, an unrefused incomplete
state, a clean initial map. Not yet: the shared advisory lock (12b) and
committed raw v2 fixtures (13c).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 17:48:10 -08:00
pingqiuandClaude Opus 5.5 54191e188d feat(storage): v3 WriteBatch as one multi-block record, with replay and reads
The activation limiter codex01 named: v3 WriteBatch (the real 8 KiB
multi-block write) and its replay/read path returned errV3NotYet. Dark:

- WriteBatch on a v3 store appends one multi-block record (type 0x04)
  with LSNs first..first+n-1 and one CRC32C, so a crash keeps all of it
  or none; the writer consumes the whole range (DESIGN 6.7, r16), the
  map coverage follows every block's LSN, and each block's dirty entry
  names its data offset inside the record. A single block is a write.
- One whole-record reader (readWholeRecordV3, blockOfRecordV3) serves the
  store read, the flusher and codex03's dark offline reader: it sizes the
  record from its type and Length, validates the whole record and the
  block's LBA, LSN and offset in it. The read retry also compares the
  data offset.
- Recovery's replay and the install-path replays (the reopen cut and the
  same-open continuation) republish every block of a batch.

Controls: round trip across a crash in both modes, a torn batch (dropped
whole when unacknowledged, fail-closed when acknowledged), a crash
mid-batch (latched, never acknowledged, none served), the ack boundary,
the flusher, the offline reader and the map coverage. Mutants: block 0
reads, first-block replay, a split batch, a flusher at offset 0, an
offline reader indexing only block 0, no map coverage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 16:42:13 -08:00
pingqiu ae23ba8a05 feat(storage): validate dark v3 readonly images and provider status 2026-11-17 15:44:54 -08:00
pingqiu d977a8b718 test(durable): verify seeded takeover and lost-response restore on mapped v3 2026-11-17 15:31:17 -08:00
pingqiuandClaude Opus 5.5 ec316e1043 fix(storage): a same-open installing Recover keeps the live install served (row 11b)
codex01 review of aa477c09 (pre-existing live-continuation P1): a
same-open installing Recover cleared the dirty map without replaying it.
With BASE LBA 1 = B0 and then install-lane LSN 11 at LBA 1 acknowledged,
the original handle could continue (r17.4), apply and acknowledge LSN 12
and complete, and a same-open read of LBA 1 then fell back to B0.

When the installing ID was begun in this open, the Recover now either
republishes the live install's trusted records (<= R) in the dirty map,
keeping the volatile map coverage (the BASE writes' UNKNOWN) as it is,
or, when the recovered cut is short of the live writer (damage under a
live install), latches the store so the handle cannot append behind the
gap; a physical reopen then decides intact or damaged. No DESIGN text
change.

Controls: codex01's exact schedule completed and read through the
original handle in the same open; a same-open Recover over a damaged
record fails closed. Mutants: no replay (serves B0), no latch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 14:47:03 -08:00
pingqiuandClaude Opus 5.5 aa477c09eb fix(storage): only a physical reopen records a resumable install cut (row 11b P1)
codex01 row 11b review (3c67ee56): a same-open Recover while this open's
install was live cached E and R but left the install's handle valid
(r17.4: until the next begin). That handle could apply and acknowledge
LSN 12 past the cut; a resume then fenced from the cached E and
fsync-erased the acknowledged record before the forward-only writer
refused to move back.

An installing Recover now records its recovered bounds only when the
installing ID was not begun in this open (a physical reopen). After a
same-open Recover the live install simply continues; a resume or a
fenced supersession refuses before any I/O. No DESIGN text change:
section 8.3's resume is the reopen case, and r17.3.1 already says a
same-open continuation keeps the live writer position.

Control: the held schedule (same-open Recover, the old handle applies
and acknowledges LSN 12, then a resume): the resume refuses, LSN 12's
bytes are unchanged, and a physical reopen still resumes and serves it.
Mutant: recording the cut on a same-open Recover erases LSN 12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 14:33:35 -08:00
pingqiuandClaude Opus 5.5 3c67ee5681 feat(storage): same-ID BASE resume after an installing reopen (row 11b)
DESIGN r17.4 section 8.3, "Resume (same ID)", store level and dark (no
current caller resumes: both receivers begin fresh install IDs). Under
installMu exclusive the resume appends nothing until all three hold:

1. trusted-through-W: the recovered suffix is intact (R >= W*) and E is
   at or past the persisted retainedHead;
2. the 6.6 fence of [E, floor + WALSize) with fsync;
3. a publication of retainedHead = E (G3).

Otherwise it refuses with ErrInstallSuffixDamaged, writing nothing, and
the volume stays installing. The writer continues at E (forward only)
and the reopen's trusted install-lane records are replayed so the
completed image serves them. The installing Recover now keeps those
records with its recovered bounds.

Controls: an intact resume that serves the recovered LSN 11 and fences
the dropped LSN 13; a damaged suffix refused; E below the persisted head
refused, while a covering supersession anchors at P = that head and stays
resumable across a crash. Mutants: no fence, ignoring the damage, no
E >= head check, anchoring the supersession at P = E.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 14:20:31 -08:00
pingqiuandClaude Opus 5.5 be0c988b80 feat(storage): covering supersession after an installing reopen (row 11a)
DESIGN r17.4 sections 6.6 (G3) and 8.3, dark:

- An installing Recover keeps its recovered bounds (E, R, intact or
  damaged) and moves the allocator state above every trusted record, but
  fences, publishes and admits nothing; the outcome stays the typed
  ErrBaseIncomplete.
- A superseding begin after that reopen checks the coverage rule, then
  fences [E, floor + WALSize) and fsyncs before its two-slot installing
  publication, so no record of the old install beyond E re-chains;
  it anchors at P = max(E, the persisted retainedHead), never lowers
  retainedHead, and restarts the writer at P (advanceHeadV3, forward
  only, no LSN change). Reads and the flusher see a recovery boundary.
- A damaged suffix refuses nothing here: the supersession does not need
  trusted-through-W, because the new BASE covers every record <= W.

Controls: the G3 revival schedule (A's LSN 13 beyond the gap would chain
on after B's 12 at the same position) and a covering supersession over a
damaged, acknowledged suffix (below W refused, at W installs and serves).
Mutants: no fence; trusted-through-W applied to the supersession.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 13:52:51 -08:00
pingqiuandClaude Opus 5.5 cfc6ddec23 feat(transport): the legacy single-lane rebuild on the BASE install handle (row 10b)
DESIGN r17.4 section 8.7, caller 2 (core/transport/replica.go, the
production default --recovery-mode=legacy):

- the first admitted MsgRebuildBlock of a connection, or an empty
  rebuild's MsgRebuildDone, begins one install at the lineage's frontier
  hint under a fresh random ID; a different hint on the connection is
  refused; a reconnect is a new connection and so a superseding install
  under the coverage rule;
- each block is written through the handle's WriteBase, never the
  store-level WriteExtentDirect;
- MsgRebuildDone completes through the handle, then calls Sync, which is
  ordinary once installed, and stops discarding the Sync error: a failed
  completion or Sync closes the connection with no MsgBarrierResp.

Stores without the seam keep their pre-seam behaviour behind the legacy
handle (lazy BaseStager staging, WriteExtentDirect, AdvanceFrontier at
completion). The one behaviour change on them is the DESIGN 8.7 rule: a
Sync error on the done path no longer replies AchievedLSN 0 but closes
the connection. The live MsgBarrierReq handler keeps replying the gated
Sync's 0 while installing (section 7).

Tagged controls on a dark v3 replica: the positive and empty rebuilds,
the real BlockExecutor.StartRebuild -> doRebuild path, injected
MarkBaseComplete and Sync failures, and reconnect supersession.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 13:22:45 -08:00
pingqiuandClaude Opus 5.5 43159460ff fix(storage): SyncInstallLog rechecks the sticky fault at its ack boundary (row 10a P1)
codex01 row 10a review (66be344b): after the publisher's final check, a
queued append of the same install could fail and latch the store while
holding WALStore.mu; SyncInstallLog then returned H anyway. It now
rechecks stickyIOFault under WALStore.mu immediately before it moves the
acknowledged frontier and returns H (the #172 ack-boundary rule section 7
imports), and returns the fault instead.

Control: a held same-ID append whose pwrite fails between the
publication and the ack; the ack is refused and the acknowledged frontier
does not move. Mutant: no final locked check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 13:10:17 -08:00