[DB-1912] Persistent subscriptions: Fix wrong checkpoint when using pinned strategy#5497
Open
[DB-1912] Persistent subscriptions: Fix wrong checkpoint when using pinned strategy#5497
Conversation
3ffd0b0 to
e2ee35c
Compare
Co-Authored-By: Timothy Coleman <timothy.coleman@gmail.com>
d336daa to
84ef7ea
Compare
… the consumer strategy skips events * When a consumer strategy skips an event, don't keep it in the buffer but add it to the retry list instead. The checkpointing mechanism considers the lowest message in `_retry` - not the lowest message in `_buffer`. Thus leaving it in the buffer may result in a wrong checkpoint being produced. * Always update the last known event when a new sequence number has been assigned A new sequence number being assigned means that we are seeing an event that was not processed before. In other words, it's the last event we've read from the source stream, so we update the last known sequence number / last known event position accordingly
84ef7ea to
a0ce7ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Persistent subscription consumer strategies that can skip events can produce wrong checkpoints when events are skipped. The pinned consumer strategy is currently the only strategy that can skip events.
This PR fixes the following issues:
OutstandingMessagedid not take skipped events into consideration - this could result into wrongly assigned sequence numbers / previous event positions and subsequently to wrong checkpoints too.