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 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-15 10:48:00 -08:00
1 parent e5beed4af9
commit c67eec48a1
1 file changed
+17
+17
View File
@@ -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) {