[ISSUE #10405] Fix orderly consumer retry message routed to wrong broker via TBW102 fallback#10408
Open
qianye1001 wants to merge 2 commits into
Open
[ISSUE #10405] Fix orderly consumer retry message routed to wrong broker via TBW102 fallback#10408qianye1001 wants to merge 2 commits into
qianye1001 wants to merge 2 commits into
Conversation
…ng broker via TBW102 fallback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #10408 +/- ##
=============================================
- Coverage 47.99% 47.92% -0.07%
+ Complexity 13271 13251 -20
=============================================
Files 1376 1376
Lines 100536 100582 +46
Branches 12983 12995 +12
=============================================
- Hits 48249 48201 -48
- Misses 46355 46439 +84
- Partials 5932 5942 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
ConsumeMessageOrderlyService.sendMessageBack()andConsumeMessagePopOrderlyService.sendMessageBack()to route retry messages to brokers that actually host the original topic, instead of falling back to TBW102 which routes to all brokers in the cluster.Root Cause
When an orderly consumer's reconsume times reach
maxReconsumeTimes,sendMessageBack()sends the retry message viagetDefaultMQProducer().send(newMsg)— a normal producer send. Since the%RETRY%topic doesn't exist yet, the producer falls back to TBW102 (a system topic present on ALL brokers) for broker selection. This causes the%RETRY%topic to be auto-created on brokers that don't host the original topic.Contrast with concurrent consumers:
ConsumeMessageConcurrentlyServiceusesconsumerSendMsgBackwhich targetsmsg.getBrokerName()directly — no TBW102 fallback.Fix
Added
trySendToTopicBroker()to both orderly service classes. It uses the consumer's existingtopicSubscribeInfoTable(route info for the original topic) to select candidate brokers:Impact
No behavioral change for brokers that DO host the original topic. Backward compatible.
Test plan
trySendToTopicBrokerprefers the original broker when available%RETRY%should only appear on brokers hosting the original topicCloses #10405
🤖 Generated with Claude Code