From c67eec48a13f294df6e2390d2ef9d3cf9cfb64d5 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 15 Nov 2026 10:48:00 -0800 Subject: [PATCH] transport: legacy catch-up and rebuild send the post-close durable ack Since the engine holds PublishHealthy until a durable ack observed after the recovery window closes, only the dual-lane rebuild close sent that ack. The legacy path (finishSession: every StartCatchUp, and StartRebuild without dual-lane; cmd/blockvolume defaults to --recovery-mode=legacy) sent only the session close, so a recovered replica stayed recovering. finishSession now sends, after a successful close, the same DurableAckResult the dual-lane close sends: DurableLSN is the replica's barrier-acknowledged achieved LSN, with the primary's tail and head. The ack follows the close callback, and both run without e.mu held. A failed close sends no ack. Fixes core/calibration C2/C3/C4/AllScenarios and cmd/sparrow AllThreePaths/Repeatable. Refs #94 Co-Authored-By: Claude Opus 5.5 --- seaweed-block/core/transport/executor.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/seaweed-block/core/transport/executor.go b/seaweed-block/core/transport/executor.go index 8b53cfe91d..67b72277ed 100644 --- a/seaweed-block/core/transport/executor.go +++ b/seaweed-block/core/transport/executor.go @@ -1218,6 +1218,7 @@ func (e *BlockExecutor) finishSession(replicaID string, session *activeSession, } delete(e.sessions, session.lineage.SessionID) cb := e.onSessionClose + ackCb := e.onDurableAck e.mu.Unlock() var result adapter.SessionCloseResult @@ -1265,6 +1266,22 @@ func (e *BlockExecutor) finishSession(replicaID string, session *activeSession, } e.recordSessionTerminal(result) cb(result) + if ackCb != nil { + // As the dual-lane close does: the close proves the recovery + // window closed, and the engine publishes healthy only after + // a durable progress fact observed after it. achieved is the + // replica's barrier-acknowledged durable LSN. The ack follows + // the close, so the engine sees the window closed first. Both + // callbacks run without e.mu held. + _, primaryS, primaryH := e.primaryStore.Boundaries() + ackCb(adapter.DurableAckResult{ + ReplicaID: replicaID, + SessionID: session.lineage.SessionID, + DurableLSN: achieved, + PrimaryTailLSN: primaryS, + PrimaryHeadLSN: primaryH, + }) + } } func (e *BlockExecutor) recordSessionTerminal(result adapter.SessionCloseResult) {