fix(cosmos): continue reminder queries after empty pages - #10276
Merged
ReubenBond merged 3 commits intoAug 10, 2026
Merged
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
Author
|
@dotnet-policy-service agree company="Microsoft" |
vladrai
force-pushed
the
fix/issue-10273-cosmos-pagination
branch
from
July 16, 2026 22:50
b1e2f15 to
9dacfd9
Compare
ReubenBond
force-pushed
the
fix/issue-10273-cosmos-pagination
branch
from
August 10, 2026 20:33
9dacfd9 to
016b57e
Compare
For cross-partition Cosmos queries, empty pages are valid while HasMoreResults is true. Drain FeedIterator until HasMoreResults is false in CosmosReminderTable ReadRows methods. Fixes dotnet#10273
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2a7080e2-0260-404d-82db-13416b40a339
ReubenBond
force-pushed
the
fix/issue-10273-cosmos-pagination
branch
from
August 10, 2026 21:28
016b57e to
99eab9c
Compare
ReubenBond
approved these changes
Aug 10, 2026
This was referenced Aug 28, 2026
Merged
This was referenced Aug 31, 2026
This was referenced Sep 7, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This pull request improves the reliability and maintainability of Cosmos DB reminder table operations by introducing a robust helper for draining paginated query results and refactoring the codebase to use it. The most important changes are summarized below:
Core reliability fix:
DrainAsyncextension method inFeedIteratorExtensions.csthat fully drains aFeedIterator<T>, ensuring all items are collected across all pages, even if empty pages appear before the end. This addresses a subtle bug where iteration could previously terminate early if an empty page was encountered while more results remained.Refactoring to use the new helper:
CosmosReminderTable.csmethods (ReadRows(GrainId),ReadRows(uint, uint), andTestOnlyClearTable) to use the newDrainAsynchelper instead of duplicating page-draining logic. This reduces code duplication and ensures robust iteration in all cases. [1] [2] [3] [4]Testing and validation:
FeedIteratorExtensionsTests.csto verify thatDrainAsynccorrectly handles various pagination scenarios, including empty pages in the middle, at the start, or at the end of the sequence. These tests use a custom in-memoryFeedIteratorto simulate edge cases that can occur in production.Fixes #10273
Microsoft Reviewers: Open in CodeFlow