You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question: should checkpoints_pending survive a failed checkpoint write? #45
Question: a checkpoint write that returns a database error is logged, and then checkpoints_pending is set to 0, so nothing writes that progress again until the next ack. A restart after a transient error on the last checkpoint before a quiet period replays the events since; nothing is lost, because the next checkpoint is cumulative. Medium, and at-least-once allows the replay. Should the pending count survive the error?
Answered and fixed by #71: yes, checkpoints_pending now survives a failed checkpoint write. The next checkpoint writes that position, and a retry is scheduled after the checkpoint interval (or the retry interval when the subscription writes on every ack), so a quiet period after a transient error no longer causes a replay on restart.
Verified with test/subscriptions/subscription_fsm_test.exs ("writes a position whose earlier write failed on the next checkpoint", "retries a failed write once the checkpoint interval has passed", "retries a failed write after the retry interval when it writes on every ack"): they fail against the code before #71 (with only its new state field stubbed in) and pass on main.
Activity
yordis commentedon Oct 27, 2026
Answered and fixed by #71: yes,
checkpoints_pendingnow survives a failed checkpoint write. The next checkpoint writes that position, and a retry is scheduled after the checkpoint interval (or the retry interval when the subscription writes on every ack), so a quiet period after a transient error no longer causes a replay on restart.Verified with
test/subscriptions/subscription_fsm_test.exs("writes a position whose earlier write failed on the next checkpoint", "retries a failed write once the checkpoint interval has passed", "retries a failed write after the retry interval when it writes on every ack"): they fail against the code before #71 (with only its new state field stubbed in) and pass on main.