mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
7ed813a3b75f0e2fe9ac3ce4d33524cdc72ed505
## The bug `doRebuild` returned `AchievedLSN = targetLSN` immediately after writing `MsgRebuildDone`, then closed the connection. The replica's handler runs on a separate goroutine and might not have processed the rebuild blocks yet when `OnSessionClose` fires — tests that read replica state after close saw unapplied blocks. `TestTransport_Rebuild_DoesNotCorruptLBA0` flaked at ~40% locally. ## The fix Structural, not a sleep. The replica's `MsgRebuildDone` handler now replies with `MsgBarrierResp` carrying the actual synced frontier, sent **after** `Sync()` returns. The primary's `doRebuild` reads that ack before returning, mirroring the existing `doCatchUp` barrier contract. The `time.Sleep(50ms)` previously needed in `TestTransport_Rebuild_StreamsAndAdvancesFrontier` is no longer required and has been removed — the structural ack guarantees durability when `closeCh` fires. `AchievedLSN` reported to `OnSessionClose` is now the replica's real frontier rather than the primary's intent — a more truthful durability boundary. ## Verification - `TestTransport_Rebuild_DoesNotCorruptLBA0` 5/5 runs pass (was ~3/5 before) - Full transport suite green under `-count=5` - Full repo suite green
Languages
Go
84.6%
Rust
7.8%
Shell
2.7%
templ
1.6%
Java
1%
Other
2%