Commit Graph
1386 Commits
Author SHA1 Message Date
pingqiu d977a8b718 test(durable): verify seeded takeover and lost-response restore on mapped v3 2026-11-17 15:31:17 -08:00
pingqiu c7d0ff5494 feat(durable): restore mapped v3 provider from HEAD through verified seed 2026-11-17 15:30:05 -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
pingqiuandClaude Opus 5.5 66be344b54 feat(storage,recovery): v3 gated Sync and the receiver's install-log ack (row 10a)
DESIGN r17.4 section 7 (O1-a), dark:

- While installing, the v3 logical Sync returns exactly (0,
  ErrBaseInstalling): no batch, no new W; the gate is rechecked at the
  completion under the leader role.
- SyncInstallLog(installID) on the narrow InstallLogSyncer (not on
  LogicalStorage): under installMu shared it refuses outside an install
  (ErrNotInstalling) or for another ID (ErrInstallIDMismatch), freezes the
  cut H, fsyncs the WAL and publishes W = max(W, H) with BaseState still
  installing, always mode A. A v2 store's SyncInstallLog is its Sync.
- The receiver's sendAck uses it until the session's own BaseDone, then
  the ordinary Sync (the WAL lane can outlive BaseDone, r17.4).

Controls: the gate, the refusals, mode A on a lagged store with a crash,
the receiver's progress ack (tagged), and the receiver-only boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 13:00:03 -08:00
pingqiuandClaude Opus 5.5 09d1663f13 feat(storage): v3 SeedChunkFrontier through the one checkpoint publication (row 9c)
Plan row 9: SeedChunkFrontier uses the checkpoint's map/metadata barrier
and the sole descriptor publication. The mapped v3 checkpoint body is
extracted into publishCheckpointV3 (metadata and chunk barriers, owned-map
candidate outside every lock, the sole slot publisher under syncMu with the
recovery-lifetime check), which the flusher's checkpoint and the seed both
call. The v3 seed fsyncs the data, then raises W and CheckpointLSN to the
inherited frontier in that one publication, and moves the volatile
frontier only after it; a failure publishes nothing and a retry works. It
refuses local writes, an install, an attached chunk layer and a store
without an owned map, writing nothing.

The dark provider still refuses a HEAD restore onto a v3 store
(errV3RestoreNotYet in PrepareRestore, before any seed or claim) until the
v3 FreshFromHead restore on the owned map lands (codex03), so codex03's
TestDurableProviderV3_UnwiredHEADRestoreRefusesBeforeClaim stays as is.
WALStore.FormatV3 reports the dark format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 12:39:07 -08:00
pingqiuandClaude Opus 5.5 73e4c1c4c5 fix(storage,recovery): a BASE install handle lives until the next begin (row 9b P1)
codex01 row 9b review (f08ee20c): the real Sender sends BaseDone from its
base lane while its WAL lane is still sending, but a completed install
refused every later WAL entry of the same session (the handle admitted
only while installing). DESIGN r17.4 (Claude01 ruling A):

- every begin bumps an install epoch; a handle is admitted only while no
  later begin has run (checked under installMu shared);
- WriteBase stays installing-only under the handle's ID;
- ApplyInstallEntry is also admitted after the handle's own successful
  MarkBaseComplete, while installed under its ID or retired, under the
  8.1 order and gap rules;
- a later begin refuses the old handle with ErrInstallSuperseded, even
  after both installs completed and retired.

Controls: the real receiver in the Sender order (BASE, WAL, BaseDone,
WAL, barrier), also across a crash and reopen; the store-level lifetime
control. Mutants: installing-only admission, no epoch check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 12:26:10 -08:00
pingqiuandClaude Opus 5.5 f08ee20c0b feat(recovery,storage): BASE install seam with a handle; dual-lane receiver on it (row 9b)
DESIGN r17.3.1 section 8.7:

- BaseInstallPreparer.BeginBaseInstall(baseLSN, installID) returns an
  InstallHandle (WriteBase, ApplyInstallEntry, MarkBaseComplete). The v3
  WALStore runs the row 9a begin; a v2 WALStore and stores without the
  seam get the legacy handle, which keeps their exact pre-seam behaviour
  (WriteExtentDirect, ApplyEntry, AdvanceFrontier(baseLSN)) and stages a
  BaseStager store lazily before the first BASE block or completion.
  parallelwal's staging step is renamed BaseStager.BeginBaseStage; the
  legacy replica caller uses it unchanged (row 10 rewrites that caller).
- The dual-lane Receiver begins the install at SessionStart, inside the
  counted section, at FromLSN under a fresh random ID; RebuildSession
  writes, applies and completes only through the handle, and
  MarkBaseComplete's error now fails the session with no ack.
- Tagged (swblock_format_v3_test) controls through the real receiver on
  a dark v3 store: the positive rebuild, the held-write drain, the parked
  frame for both lanes, and a superseded BaseDone failing without an ack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 12:09:37 -08:00
pingqiuandClaude Opus 5.5 5d5dedcfb6 fix(storage): v3 BASE begin covers appended LSNs; complete settles the map (row 9a P1s)
codex01 row 9a review (60803a87), two P1s:

1. With W 1 and unacknowledged LSNs 2 and 3 appended, a begin at
   BaseLSN 1 left 2 and 3 behind BaseCursor while the allocator went on
   at 4; after complete an acknowledged write 4 met a hole at reopen
   (strict R 1 < W 4; lagged could drop it). The begin now also needs
   BaseLSN >= the highest appended LSN and is refused otherwise, writing
   nothing; nothing is rewound or dropped.
2. A BASE write's UNKNOWN coverage was only in memory, and complete
   published installed with the old clean map root. Complete now settles
   step 2 like a checkpoint: one fsync, the metadata and chunk barriers,
   a fresh owned-map candidate, and one installed publication carrying
   it, under the leader role and the recovery-lifetime check. A guest
   write that makes the candidate stale fails the completion.

Each has an actual-store control and a mutant. The held-test hooks now
always release in cleanup (P2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:33:34 -08:00
pingqiuandClaude Opus 5.5 60803a8704 feat(storage): v3 BASE install begin, handle and complete (dark, row 9a)
DESIGN r17.3.1 sections 8.1, 8.2, 8.4, 8.5 and 8.7 on the v3 store,
reachable only from tests:

- beginBaseInstallV3 takes installMu exclusive (draining the old ID's
  admitted mutations), refuses BaseLSN below the acknowledged W
  (published or not yet, mode C) or the checkpoint with the begin- or
  supersede-specific error before any write, freezes P at the writer
  head and publishes installing into both slots.
- installHandleV3.WriteBase and ApplyInstallEntry admit under installMu
  shared and recheck the state and ID under it (ErrInstallSuperseded);
  the install lane applies the order and gap rules and maps a full ring
  to ErrBaseInstallNoSpace.
- markBaseCompleteV3 validates the ID under installMu exclusive, fsyncs
  the BASE bytes and the install-lane suffix, publishes installed with
  retainedTail >= BaseCursor, drops the superseded pre-BASE dirty
  entries and moves the frontier to BaseLSN.
- installing -> none is refused (no abort, r17); installed -> none
  retires only once the checkpoint covers BaseLSN and both slots carry
  a tail at or past BaseCursor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:08:53 -08:00
pingqiu 75bf6559bf test(storage): reopen acknowledged replacement without graceful flush 2026-11-17 08:37:16 -08:00
pingqiu c4da7df516 docs(storage): bind checkpoint materialization to recovery lifetime 2026-11-17 08:36:08 -08:00
pingqiu 8af7760fbd fix(storage): bind flush checkpoint and retirement to original recovery lifetime 2026-11-17 08:34:59 -08:00
pingqiu 99deddb4d6 fix(storage): refuse unwired v3 seed before legacy locking and serialization 2026-11-17 08:28:01 -08:00
pingqiu d9a3442693 test(durable): keep mapped failures closed and default provider legacy 2026-11-17 08:24:59 -08:00
pingqiu 71e70dabaf test(durable): exercise mapped v3 stores through actual provider 2026-11-17 08:23:39 -08:00
pingqiu 52f8b7417f test(storage): control map-only attachment status and BASE refusal 2026-11-17 08:16:22 -08:00
pingqiu f3e4c22ddb feat(storage): use owned maps instead of C11 bitmap in impl3 capture 2026-11-17 08:12:13 -08:00
pingqiu e6c45d5906 docs(storage): bind owned-map eviction to capture coverage 2026-11-17 08:05:51 -08:00
pingqiu 037db1e6cd fix(storage): gate eviction on owned-map capture dirt 2026-11-17 08:04:41 -08:00
pingqiu 673fdf3015 docs(storage): record dark capture map token coverage 2026-11-17 08:02:06 -08:00
pingqiu f7953bd792 fix(storage): retain covered map knowledge across captured reopen 2026-11-17 08:00:33 -08:00
pingqiu 3c6e025da8 feat(storage): select and settle captured chunks through owned maps 2026-11-17 07:57:01 -08:00
pingqiu f4ed786d84 test(storage): refuse queued Sync after map persistence fault 2026-11-17 07:43:40 -08:00
pingqiu d9b5034a07 test(storage): cover checkpoint barriers and recovery map cache 2026-11-17 07:42:07 -08:00
pingqiu c2f8a5aee1 test(storage): exercise held and uncertain real map checkpoints 2026-11-17 07:40:16 -08:00
pingqiu 623ffedb69 feat(storage): publish owned map proofs through real checkpoints 2026-11-17 07:38:41 -08:00
pingqiuandClaude Opus 5.5 0193516bc0 storage: bump the v3 recovery generation at the end of a recovery too (codex01 P2)
Recover bumped recoverGen before dm.clear only. A read already admitted
could capture the new generation with the old dirty entry in that
interval, see the fenced bytes, then find the same LBA/position/LSN
rewritten after the recovery: tuple and generation matched, a false WAL
integrity failure. Recover and reset now also bump it at their end (on
every path), the start+end pattern of the map proof epoch, so any overlap
changes the generation a reader compares before and after its attempt.
The outer Sync completion's equality check is unchanged in meaning.

Control (held, actual Read/Recover/Write): a read admitted before its
generation capture, released after the start bump and before the clear,
resolves the old entry, sees the fenced bytes after the recovery and the
same-tuple rewrite, and returns the new write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 07:03:39 -08:00
pingqiuandClaude Opus 5.5 54de8ab8ac storage: v3 read damage verdict bound to one recovery lifetime; read I/O is substrate I/O (codex01 P2s)
(1) A same-open Recover can fence a dropped record and re-allocate its
LSN to the same LBA at the same position: a read parked across it saw the
fenced bytes and, finding the entry unchanged, reported false WAL damage.
The unchanged-entry verdict now also requires the same recovery
generation (a reset bumps it too) across the attempt; otherwise the read
retries and returns the new write.

(2) A failed or short pread (including io.EOF: the WAL region lies inside
the file) is a substrate I/O failure, never WAL integrity. Only a record
that was read and fails validation within one stable lifetime is damage.

The comment no longer implies a nonce check: LSN allocation runs on across
a reset, and LBA+LSN+CRC identify the resolved write.

Controls: a parked read across a reusing same-open recovery returns the
new write; a truncated file and a failing fd give substrate I/O.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 06:19:50 -08:00
pingqiuandClaude Opus 5.5 63d1f4a4ae storage: v3 reads validate the whole record they read (codex01 row 8 P1)
A Read that resolved an LBA's WAL position held no lock across its pread.
Parked there, the real flusher could checkpoint and release the entry, a
reset restart the cursor at 0 and Write(2, B) reuse the position; the
resumed read checked only the header type/length and returned B for LBA 1.
The same held after OnReadMiss.

readDirtyV3 now validates the whole record after the payload read (CRC,
footer, write type, LBA and LSN against the resolving dirty entry) and
re-resolves on a mismatch: the entry gone means the extent holds the
block; the entry unchanged means WAL damage (a WAL integrity failure).
No lock is added; the lock graph is unchanged.

Controls: the parked direct Read and the parked post-OnReadMiss recheck
across flush, reset and overwrite return LBA 1's own block; a damaged live
record is a WAL integrity failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 06:08:43 -08:00
pingqiuandClaude Opus 5.5 57e8c9e580 storage: a v3 Close never writes the legacy superblock (codex01 P1)
WALStore.Close serialized the legacy superblock and pwrote it at offset
0, which on a v3 file is descriptor slot A: strict create A1, Recover B2,
Write+Sync A3/W1, Close destroyed A, reopen selected B2/W0. A v3 Close now
writes nothing (acknowledged state is already in the slots and the WAL).
Both legacy offset-0 writers (writeSuperblockMetadata and
syncDirectFrontierMetadata, behind the checkpoint, v2 recovery,
SeedChunkFrontier and the direct-frontier Sync) refuse on a v3 store with
errV3LegacySuperblockWrite.

Controls: Close -> reopen in strict and lagged mode with the newest
publication in slot A; the two legacy writers refuse and leave slot A
untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 06:04:14 -08:00
pingqiuandClaude Opus 5.5 9ba7f7f54b storage: v3 nonce/position reset, dark (format v3 plan row 8)
Publisher: the reset publication mode of the single publisher (a new
nonzero nonce, an empty cursor space, ordinary rules otherwise), ported
onto the row 7 publication core; step 2 into one slot, step 3 into the
other, a step-3 failure latches.

Store: WALStore.resetIncarnationV3 quiesces (captureMu exclusive ->
lifecycleMu -> syncMu -> s.mu), refuses with ErrResetNotPreserved and no
write unless the dirty map is empty and CheckpointLSN >= appended ==
acknowledged W, publishes both slots under a fresh random nonce at cursor
0, recreates the WAL writer, bumps the recovery generation and
invalidates the map proof epoch. An open across a half-published reset
binds no writer; Recover's head publication completes the other slot and
creates it.

Not TLC-cleared: nothing in production calls it until the reset model
(r4.5) passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 05:45:31 -08:00
pingqiu dcc214e2d8 feat(storage): own maps before opening dark v3 stores 2026-11-17 05:40:18 -08:00
pingqiu 978b6f8e48 fix(storage): validate both map generations before binding 2026-11-17 04:05:10 -08:00
pingqiu c4be91b7e8 test: keep extent materialization visible with retained retry entries 2026-11-17 03:55:26 -08:00
pingqiu b2097f5b8b storage: retain flushed v3 entries until checkpoint coverage can advance 2026-11-17 03:54:17 -08:00
pingqiu 48ca086de9 Merge remote-tracking branch 'origin/feat/walstore-format-v3' into work/format-v3-map-row7-integration 2026-11-17 03:46:34 -08:00
pingqiuandClaude Opus 5.5 9473fc5f3a storage: clamp the v3 flusher checkpoint to the acknowledged W (row 5f)
A v3 checkpoint never exceeds W (DESIGN 2.2 item 5, 9.1 predicate 2:
CheckpointLSN <= mapCoveredCheckpoint <= W). The flusher may flush dirty
entries no Sync has acknowledged, so persistCheckpointV3 now clamps its
candidate to the acknowledged W; the unsynced records stay retained in the
WAL until a Sync covers them. (Raised by claude05's CkptUnsynced model
note; Claude01 ruled the v3 rule is CheckpointLSN <= W.)

The map candidate is prepared first, outside every lock, for the clamped
checkpoint. The publication is a W publisher, so it runs under the v3
leader role (syncMu -> s.mu -> descMu), like Sync, refreshW and SetWMode,
and cannot straddle a recovery; if a recovery lowered the acknowledged W
below the prepared candidate meanwhile, the cycle publishes nothing.

Control: an acknowledged LSN 1 and an unsynced dirty LSN 2 through a
flusher cycle (stub map candidate) give checkpoint = covered = 1, the tail
unchanged, and both LBAs readable after a crash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:42:42 -08:00
pingqiuandClaude Opus 5.5 e632d0e83e storage: serialize v3 Recover against every W publisher (row 5d amend)
codex01 row 5d review (3e76473c, AMEND): the start-only recovery epoch
did not cover a capture during recovery (schedule A), a batch recovered
between its publication and its ACK (schedule B), or the outer Sync()
completion. Structural seam per Claude01, replacing the epoch checks.

Lock graph: captureMu -> lifecycleMu -> syncMu (v3 leader) -> s.mu ->
descMu -> fileSyncMu. Checked first: no Recover caller holds s.mu or
descMu (durable.Recover, sparrow persist and tests call it from outside),
and no publisher takes syncMu while holding s.mu (committer goroutine,
flusher after dropping its read lock, SetWMode after Sync).

- Recover (v3) holds syncMu for its whole run, after lifecycleMu and
  before s.mu, and bumps recoverGen under syncMu and s.mu.
- The Sync batch (capture -> publish -> final ACK), refreshW and SetWMode
  hold syncMu throughout, so no publication or ACK straddles a recovery;
  the per-publication epoch checks are removed.
- The outer Sync() completion, which cannot hold syncMu across its
  committer wait, captures recoverGen with targetHead under s.mu.RLock
  and rechecks it under syncMu -> s.mu at completion; a moved generation
  refuses the ack (errV3RecoveredMeanwhile).
- Held controls: refresh during a held Recover (A); Recover during a batch
  held before its ACK (B); the outer completion across a recovery, with a
  fresh-lifetime positive. heldV3 releases the hold and joins every worker
  with a bound in cleanup, before the store crash cleanup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:31:38 -08:00
pingqiu f3a2b35c94 storage: invalidate bound map proofs at actual Recover start and end 2026-11-17 03:17:19 -08:00
pingqiuandClaude Opus 5.5 3e76473c07 storage: drop v3 W publications that a recovery has superseded (row 5c amend)
codex01 row 5c review (87a922fa, AMEND). Lock graph first, unchanged:
syncMu (v3 leader) -> s.mu -> descMu -> fileSyncMu; Recover holds
s.mu -> descMu -> fileSyncMu and never takes syncMu. No edge is added.

- P1: a flusher refresh could read Wack 2 and pause while a same-open
  Recover dropped record 2 and reset Wack to 1; the resumed refresh then
  published W 2 and the next Recover reported a false wal_corrupt. Every
  recovery now bumps a recovery epoch first thing (under s.mu, before it
  reads the descriptor). Every publication of a W derived from cached
  wack/appended values (Sync batch, refreshW, SetWMode) captures the epoch
  with them and rechecks it inside its publication mutate, under descMu: a
  superseded publication is dropped (errV3RecoveredMeanwhile; the refresh
  treats it as nothing to do). A publication that wins the race completes
  before the recovery reads the descriptor, so its W is genuine.
  Held real-flusher control: the refresh caches W 2 and parks, the same
  instance recovers to R 1, the refresh resumes and publishes nothing, and
  the next Recover succeeds.
- P2: held tests register the store crash with t.Cleanup before the
  release cleanup, so a failure releases the hold before shutdown.
- P2: the empty-dirty-set refresh branch has its own control.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:09:02 -08:00
pingqiu 3cf779490e test: cover real-store WAL dispatch after a held read miss 2026-11-17 03:06:47 -08:00
pingqiu 90bd02b37d Merge remote-tracking branch 'origin/feat/walstore-format-v3' into work/format-v3-map-row7-integration 2026-11-17 03:04:56 -08:00
pingqiu b77b5acaff fix: bound map allocation before root I/O and pin digest controls 2026-11-17 02:59:30 -08:00
pingqiu dc6e94e4cd docs: bound dark map publication claims before real lifecycle wiring 2026-11-17 02:58:28 -08:00
pingqiuandClaude Opus 5.5 87a922fa18 storage: reset the v3 acknowledged frontier on recovery; wire the idle refresh (row 5b amend)
codex01 row 5b review (b8950a26, AMEND):
- P1: recoverV3 sets the volatile acknowledged W to the recovered prefix
  R instead of keeping an older in-memory maximum. A same-open recovery
  that drops mode C's newest batch could otherwise let refreshW publish a
  W the WAL no longer holds, and the next Recover report a false
  wal_corrupt. Control: same-instance Recover -> refresh -> Recover with
  the exact kept and fenced bytes.
- P2: a scan error under an installing descriptor keeps the typed
  ErrBaseIncomplete outcome (cause preserved, not labelled damaged).
- P2: the real flusher cycle runs the mode-C idle refresh, also when no
  dirty entries remain. Control drives flushOnceInternal (no timing oracle).
- P2: the held controls use bounded handshakes and register their release
  as test cleanup before the held goroutine starts.
- Row 7 handoff: Read's post-OnReadMiss dirty-map recheck dispatches to
  the v3 WAL reader.
The LSN-order dependency is closed by codex03's writer enforcement
(2f201a5a..f0fd2916) and DESIGN r16.1.

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