pingqiu dd370a5367 C3: BASE ∥ WAL parallel in Sender.Run (§6.8 #6 / P6 / G3)
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)
2026-04-30 03:11:54 -07:00
Languages
Go 84.7%
Rust 7.7%
Shell 2.7%
templ 1.5%
Java 1%
Other 2.1%