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
Languages
Go 84.7%
Rust 7.7%
Shell 2.7%
templ 1.5%
Java 1%
Other 2.1%