fix: correct bookmark queue pagination after deletions#7719
Open
cristiandolf wants to merge 1 commit into
Open
fix: correct bookmark queue pagination after deletions#7719cristiandolf wants to merge 1 commit into
cristiandolf wants to merge 1 commit into
Conversation
Advance the page offset by the number of non-deleted items per batch instead of always incrementing by batch size. Deleting processed items while paginating with a fixed offset caused remaining queue entries to be skipped within the same processing run. Failed items are skipped for the remainder of the run and retried on the next worker cycle.
Contributor
|
PR author is not in the allowed authors list. |
Contributor
Author
|
Hi @sfmskywalker , I noticed that v3.6.3 and v3.7.1 were recently released. Just wanted to check if there's anything else needed from my end on this PR, or if we can plan to target it for the next patch release? Thanks! |
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.
Summary
Fixes incorrect offset advancement in
BookmarkQueueProcessor.ProcessAsyncwhen queue items are deleted during pagination.The processor paginates with an increasing
offsetbut removes successfully processed items from the store. Incrementing the offset by the full batch size (offset += batchSize) causes remaining items to be skipped within the same processing run.This bug is present across released 3.x versions that use the current pagination loop (including 3.6.x and 3.7.x). I verified it is still present on 3.8.x as well.
Fix
Advance the offset by the number of non-deleted items in each page:
offset += page.Items.Count - deletedCountBehavior:
Version notes for maintainers
3.6.x / 3.7.x
This PR's approach applies directly.
deletedCountshould count items removed via successful resume (DeleteAsyncafterresponses.Count > 0).3.8.x
The same pagination bug exists, but
ProcessItemAsynchas additional paths:SaveAsync) — not a deletionDeleteAsyncFor 3.8.x,
deletedCountmust include deletions from both successful resume and dead-letter, while retryable failures and "no matching bookmark" items should advance the offset (remain in queue).I can provide a follow-up commit/PR targeting
release/3.8.0/mainwith the dead-letter-aware variant if preferred.Tests
Added unit tests in
BookmarkQueueProcessorTests:ProcessAsyncinvocationTests fail against the previous
offset += batchSizeimplementation.Related
Offset pagination + in-loop deletion anti-pattern.
DefaultBookmarkQueuePurgeron newer branches already usesFromPage(0, ...);BookmarkQueueProcessorwas not updated similarly.