Skip to content

Keep catching up when the checkpoint timer fires - #327

Open
pirvudoru wants to merge 1 commit into
commanded:masterfrom
pirvudoru:fix-checkpoint-during-catch-up
Open

Keep catching up when the checkpoint timer fires#327
pirvudoru wants to merge 1 commit into
commanded:masterfrom
pirvudoru:fix-checkpoint-during-catch-up

Conversation

@pirvudoru

Copy link
Copy Markdown

When checkpoint_after is set and the timer fires while a subscription is catching up, the FSM moves to subscribed and stops reading. Notifications received during catch-up are tracked in last_received, so the next live event matches last_received + 1, gets sent and acknowledged, and the checkpoint jumps past every event between last_sent and the head. We hit this in production twice on a replay from origin: the subscription skipped ~40M events in one step.

The fix persists the checkpoint but keeps the current state in request_catch_up, catching_up and max_capacity. The added test fails on master (receives event 32 instead of 11) and passes with the change.

@pirvudoru
pirvudoru force-pushed the fix-checkpoint-during-catch-up branch from 41f46c2 to e0cbe9a Compare September 8, 2026 06:47
A subscription that was catching up moved to the subscribed state when
its checkpoint_after timer fired. With the queue drained it stopped
reading, and the next live event matched last_received + 1 because
notifications received during catch-up are tracked. That event was
sent and acknowledged, so the checkpoint jumped past every unread event
between last_sent and the head.

Persist the checkpoint but stay in the current state for
request_catch_up, catching_up and max_capacity.
@pirvudoru
pirvudoru force-pushed the fix-checkpoint-during-catch-up branch from e0cbe9a to cb21b09 Compare September 8, 2026 07:31
@yordis

yordis commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

duplicate of #325 althou this one has unit tests 😄

@pirvudoru

Copy link
Copy Markdown
Author

@yordis do you think this is a fix worth merging and releasing ?

So far so good. will wait until the handler will finish consuming the events
image

@yordis

yordis commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

I'll leave that to @drteeth. I am merely an outsider

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants