qianye1001 opened a new pull request, #10406:
URL: https://github.com/apache/rocketmq/pull/10406

   ## Summary
   
   Fix for [#10405](https://github.com/apache/rocketmq/issues/10405): When 
orderly consumer consume message fails and reaches `maxReconsumeTimes`, the 
`%RETRY%` topic is unconditionally created on all brokers, including those that 
don't host the original topic.
   
   ## Root Cause
   
   Two code paths create `%RETRY%` topic without checking if the broker 
actually hosts any of the consumer's subscribed topics:
   
   1. **`ClientManageProcessor.java`** (heartbeat path) — `registerConsumer()` 
unconditionally creates `%RETRY%<group>` for every consumer heartbeat
   2. **`AbstractSendMessageProcessor.java`** (msgCheck fallback) — Creates 
retry topic without broker-topic validation
   
   ## Fix
   
   Added guard conditions in both paths:
   
   1. **ClientManageProcessor** — Before creating `%RETRY%` topic, iterate 
through the consumer's subscription set and verify at least one subscribed 
topic (excluding `%RETRY%`/`%DLQ%` system topics) exists on this broker via 
`containsTopic()`. Only create `%RETRY%` if the check passes.
   
   2. **AbstractSendMessageProcessor** — In the `msgCheck` fallback path, 
extract the consumer group from the retry topic name and perform the same 
validation before creating the topic.
   
   ## Impact
   
   - Reduces unnecessary topic metadata bloat across brokers
   - Prevents confusing `%RETRY%` routes on brokers that have no relevant data
   - No behavioral change for brokers that DO host subscribed topics
   - Backward compatible — existing retry flow continues to work normally
   
   Closes #10405


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to