 pingqiuandClaude Opus 4.6
|
d2d57851b0
|
feat: rebuild MVP — dual-lane session with bitmap protection
Rebuild session protocol implementation for v2-rebuild-mvp-session-protocol.md.
New files:
- rebuild_bitmap.go: RebuildBitmap — session-scoped dense bitset for
WAL-applied LBA tracking. MarkApplied on local WAL write (not receive).
ShouldApplyBase returns false for WAL-covered LBAs (WAL always wins).
- rebuild_session.go: RebuildSession — replica-side two-line rebuild.
WAL lane (ApplyWALEntry) + base lane (ApplyBaseBlock) with bitmap
conflict resolution. TryComplete requires BOTH base_complete AND
wal_applied_lsn >= target_lsn. Volume-level control surface:
StartRebuildSession, ApplyRebuildSessionWALEntry/BaseBlock,
MarkRebuildSessionBaseComplete, TryCompleteRebuildSession,
CancelRebuildSession, ActiveRebuildSession.
- rebuild_mvp_test.go: 4 correctness tests — base+WAL converge,
WAL-applied never overwritten by base, bitmap set on applied not
received, control surface start/supersede/complete.
- rebuild_transport_test.go: 2 transport-level tests — two-line with
real WAL shipping, live writes during base copy with bitmap conflict.
Design docs:
- v2-rebuild-mvp-session-protocol.md: MVP spec with message set, apply
rules, completion/failure/crash rules, test matrix
- v2-sync-recovery-protocol.md: full protocol context (keepup/catchup/
rebuild unified design, primary decision logic, two-line model)
- v2-session-protocol-shape.md: protocol shape overview
Protocol engine (reference, not production):
- sw-block/protocol/: 7-event engine with ~300 lines, 13 tests
6 rebuild tests pass, all existing component tests pass.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
2026-04-07 14:30:34 -07:00 |
|