Repository navigation
GH-5107 MySQL queue sender moves the outbox row atomically for every durable send - #5113
Merged
Merged
Conversation
…durable send Durable sends without WasPersistedInOutbox now write the queue or scheduled row and delete the outbox row in one transaction; a duplicate send is a no-op ON DUPLICATE KEY UPDATE so the delete still commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCggXgxnG3EBXoR9rrq37U (cherry picked from commit d3f3778)
This was referenced Oct 23, 2026
This was referenced Oct 29, 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 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.
Follow-up to #5107 / #5109 for the MySQL queue sender. Independent of #5109; each database engine gets its own PR.
The gap
MySqlQueueSender.SendAsync(Envelope)only took the atomicMoveFromOutgoingTo*path whenEnvelope.WasPersistedInOutboxwas true. Envelopes stored by the EF Core / Marten outbox and envelopes resent by outbox recovery are not marked, so they were inserted into the queue on their own and the outbox row was deleted later, in a separate transaction byDurableSendingAgent. A node that dies between the two leaves the outbox row behind; outbox recovery resends it, and once the receiver's handled inbox row has expired (KeepAfterMessageHandling) the copy is handled a second time.Fix
A durable send that isn't marked
WasPersistedInOutboxnow goes throughMoveOrWriteToQueueAsync, which writes the queue (or scheduled) row and deletes the outbox row, if there is one, in one transaction. A client transaction; a duplicate is a no-opON DUPLICATE KEY UPDATE id = id, so the delete still commits. (Not changed here: the existing markedMoveFromOutgoing*path runs its insert and delete as two autocommitted statements, so it isn't atomic either.) Marked envelopes keep the existing path; non-durable endpoints are unchanged. TheDurableSendingAgentdelete that follows becomes a no-op.Tests
New
Transport/Bug_5107_outbox_row_survives_the_queue_insert.cs:Before the fix 3 of 4 failed ("outbox count should be 0 but was 1"); the no-outbox-row test was the control. After: 4/4. Locally on net9.0 the provider's
Transporttests pass (60/60), andwolverine.slnxbuilds clean with-f net9.0.Refs #5107
🤖 Generated with Claude Code
https://claude.ai/code/session_01DCggXgxnG3EBXoR9rrq37U