mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
dd370a53673a56e1500b82563ed7dc03a754cb03
Architect §6.8 #6 BASE ∥ WAL WALL-CLOCK OVERLAP: extent/base bulk SHOULD overlap WAL drain where product permits (reduces wall-clock pin exposure). Pre-C3 Sender.Run ran streamBase fully before sink.DrainBacklog — strictly serial. Sender.Run now spawns two goroutines: Base goroutine: streamBase → frameBaseDone → coord.MarkBaseDone WAL goroutine: sink.StartSession → sink.DrainBacklog Both share writeMu via C1 (sink's WriteMu() duck-typing). Frame integrity preserved by mutex-bounded interleaving on the wire — two writers never interleave bytes within a single frame. Wall- clock benefit comes from CPU/IO overlap (substrate scans, encoding, small base-block writes). Coordination: - groupCtx with cancel; first failing goroutine cancels to unblock the other (in particular DrainBacklog observes ctx). - Both error channels collected; first non-nil error returned. - Barrier writes after both goroutines complete (errgroup-Wait pattern via two channels). Note on physical reality: shared writeMu means base waits on slow WAL writes (and vice versa). This is correct serialization. Hard SLO on base under bursty WAL would need a separate credit channel (out of scope §6.8 #6 strict reading; see consensus §6.8 note). Test: + TestC3_BaseWalParallel_FramesInterleave — receiver-side capture parses sender's wire stream into a frame sequence; asserts at least one frameWALEntry appears BEFORE the last frameBaseBlock in that sequence (interleaved progress, not strictly base- then-WAL). Verified: firstWAL index << lastBase index. go test ./core/recovery/ ./core/transport/ ./core/replication/{,component} — all PASS. C1+C2+C3 close §6.8 nine MUSTs: ✓ #1 SINGLE-SERIALIZER (C1: shared writeMu) ✓ #2 ONE TAPE (single shipMu + cursor; substrate is canonical) ✓ #3 PRIORITY (C2: drain in cursor order during Backlog) ✓ #4 TIMER (C2: self-driving Backlog drain) ✓ #5 FRAMING ≠ SECOND TAPE (P2d: profile selects encoder, not tape) ✓ #6 BASE ∥ WAL (C3: errgroup goroutines) ✓ #7 R1 (existing: assertCaughtUpAndEnableTailShipLocked) ✓ #8 R2 (existing: OnSaturation single-shot per session) ✓ #9 send(·,·) consistency (C2: NotifyAppend + drain dispatch)
Languages
Go
84.7%
Rust
7.7%
Shell
2.7%
templ
1.5%
Java
1%
Other
2.1%