Skip to content

Question: should checkpoints_pending survive a failed checkpoint write? #45

Closed

Description

@vheathen

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?

Part of the review of main at 1f9d1f8: #27 (comment)

Activity

  1. yordis commented on Oct 27, 2026

    @yordis
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions