mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
055fd468a07b5cd26941c68013acd585802afb08
Implements consensus §6.10 (INV-RECV-BITMAP-CORE / INV-RECV-WAL-NAIVE):
BASE lane writes go directly to extent, bypassing the LSN-tracked WAL
apply path entirely. The receiver's per-session bitmap is the sole
arbiter of BASE-vs-WAL conflict at this LBA; substrate stale-skip is
irrelevant for BASE because BASE never enters the WAL.
Substrate contract delta (LogicalStorage):
+ WriteExtentDirect(lba uint32, data []byte) error
Writes one block's bytes to the substrate's extent. No LSN. No
frontier (R/S/H) advancement. Substrate stale-skip / WAL apply
machinery NOT invoked. Receiver pairs with AdvanceFrontier in
MarkBaseComplete to keep post-rebuild frontier reporting honest.
Implementations:
- BlockStore — write to in-memory blocks map; nextLSN/walHead
untouched.
- memorywal — append a record with LSN=0 sentinel; no
retention/nextLSN advance. Receiver bitmap
discipline keeps semantics correct (BASE only
reaches substrate when WAL hasn't touched LBA).
- WALStore — wraps existing private writeExtent; pwrites to
extent file, no WAL append, no dirty-map entry.
- smartwal.Store — pwrites directly to extent at lba's offset; ring
NOT touched, no LSN/frontier advance.
RebuildSession changes:
- ApplyBaseBlock now calls store.WriteExtentDirect(lba, data) instead
of store.ApplyEntry(lba, data, targetLSN). The targetLSN-as-base-LSN
POC compromise (which silently rode substrate stale-skip) is gone.
- MarkBaseComplete now calls store.AdvanceFrontier(targetLSN) — the
explicit frontier-advance that ApplyEntry's side effect previously
provided implicitly. Pre-§6.10, BASE applies bumped walHead per
LBA; now we make the bump explicit at base-done.
Contract test (TestContract_WriteExtentDirect): pins
- WriteExtentDirect succeeds and Read returns the bytes
- Frontier (H) and nextLSN MUST NOT advance (BASE has no LSN)
- Subsequent ApplyEntry at LSN > 0 shadows the BASE bytes
runs against BlockStore-mem / WALStore / MemoryWAL.
Refs: v3-recovery-algorithm-consensus.md §6.10 (INV-RECV-BITMAP-CORE,
INV-RECV-WAL-NAIVE); §6.3 cursor-monotonic sender invariant; mini-plan
§12 design-candidate doc-track.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Languages
Go
84.5%
Rust
7.9%
Shell
2.7%
templ
1.6%
Java
1%
Other
2%