Problem
SessionPrune keeps several pieces of per-session checkpoint bookkeeping: crossed, maxCrossed, and writerFailures.
resetThresholds(sessionID) currently clears crossed and maxCrossed, but it leaves writerFailures untouched. Since writerFailures is keyed by the same sessionID, the same session can enter a fresh checkpoint threshold cycle while still carrying the previous consecutive writer failure count.
If the previous count is already close to max_writer_failures, a later checkpoint writer failure in that same session can reach the retry cap earlier than expected. It also leaves a small stale in-memory entry until a successful writer clears it or the process restarts.
Expected behavior
When resetThresholds(sessionID) starts a fresh checkpoint threshold cycle for a session, all related per-session checkpoint threshold state should be reset together.
Suggested fix
Clear the writer failure counter together with the other reset state:
writerFailures.delete(sessionID)
Suggested test coverage
Add a targeted SessionPrune.fireCheckpoints test that:
- records two checkpoint writer failures for a session,
- calls
resetThresholds(sessionID),
- verifies the next checkpoint threshold cycle starts with a fresh failure count instead of inheriting the previous value.
This keeps the fix scoped to the same session and avoids changing retry behavior across different sessions.
Problem
SessionPrunekeeps several pieces of per-session checkpoint bookkeeping:crossed,maxCrossed, andwriterFailures.resetThresholds(sessionID)currently clearscrossedandmaxCrossed, but it leaveswriterFailuresuntouched. SincewriterFailuresis keyed by the samesessionID, the same session can enter a fresh checkpoint threshold cycle while still carrying the previous consecutive writer failure count.If the previous count is already close to
max_writer_failures, a later checkpoint writer failure in that same session can reach the retry cap earlier than expected. It also leaves a small stale in-memory entry until a successful writer clears it or the process restarts.Expected behavior
When
resetThresholds(sessionID)starts a fresh checkpoint threshold cycle for a session, all related per-session checkpoint threshold state should be reset together.Suggested fix
Clear the writer failure counter together with the other reset state:
Suggested test coverage
Add a targeted
SessionPrune.fireCheckpointstest that:resetThresholds(sessionID),This keeps the fix scoped to the same session and avoids changing retry behavior across different sessions.