fix(streaming): preserve ADO.NET dequeue order - #10536
Merged
ReubenBond merged 2 commits intoAug 12, 2026
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes ADO.NET streaming dequeue ordering by ensuring GetStreamMessagesAsync returns results ordered by MessageId, addressing a MySQL-specific flake where unordered joined rows could cause the cache cursor to advance incorrectly and skip earlier items.
Changes:
- Normalize all ADO.NET dequeue results by sorting
GetStreamMessagesAsyncresults byMessageId. - Add/extend MySQL-focused regression coverage to validate ordering and increase batch coverage with concurrent enqueues.
- Ensure the MySQL streaming dequeue procedure returns its batch in
MessageIdorder.
Show a summary per file
| File | Description |
|---|---|
| test/Extensions/Orleans.AdoNet.Tests/Streaming/RelationalOrleansQueriesTests.cs | Adds a MySQL regression test for provider-result ordering and strengthens dequeue-batch coverage using concurrent enqueues. |
| src/AdoNet/Shared/Storage/RelationalOrleansQueries.cs | Sorts dequeued stream messages by MessageId to make result ordering deterministic across providers. |
| src/AdoNet/Orleans.Streaming.AdoNet/MySQL-Streaming.sql | Adds ORDER BY M.MessageId to the MySQL dequeue procedure’s returned result set to preserve dequeue order. |
Review details
Tip
Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Suppressed comments (1)
test/Extensions/Orleans.AdoNet.Tests/Streaming/RelationalOrleansQueriesTests.cs:422
- This test now queues 100 messages concurrently without any throttling. For MySQL specifically, this test class is configured with a lower
concurrencyvalue, and other tests in this file explicitly gate parallel DB calls to avoid connection pool timeouts. Throttle these enqueues toconcurrencyto reduce flakiness.
var acks = await Task.WhenAll(Enumerable
.Range(0, total)
.Select(i => _queries.QueueStreamMessageAsync(serviceId, providerId, queueId, payload, expiryTimeout))
.ToList());
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Aug 12, 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.
Fixes #10522.
Fixes #10458.
The ADO.NET stream pulling agent uses the first message returned for each stream as the cache cursor. MySQL selects dequeue batches in
MessageIdorder but returns the joined rows without an ordering guarantee. PostgreSQL has the same issue becauseUPDATE ... RETURNINGdoes not preserve the CTE's selection order. In preserved CI failures, affected streams produced all ten items but consumption began atsequential#2, skipping the older first row which had been returned later in the result set.This change orders the MySQL procedure result and normalizes all ADO.NET dequeue results by
MessageId, protecting existing database schemas and every provider whose result ordering is not guaranteed. It also adds a deterministic regression which supplies reverse-ordered provider results and strengthens batch coverage with concurrent enqueues.Microsoft Reviewers: Open in CodeFlow