This is an automated email from the ASF dual-hosted git repository.

jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 1117ab8f97 [ISSUE #9780] Skip unnecessary RPC when topic has no 
message queues (#9781)
1117ab8f97 is described below

commit 1117ab8f97a891371514134aab5ab387a18d3a83
Author: yx9o <[email protected]>
AuthorDate: Tue Dec 30 11:49:11 2025 +0800

    [ISSUE #9780] Skip unnecessary RPC when topic has no message queues (#9781)
---
 .../rocketmq/client/impl/consumer/RebalanceImpl.java       | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git 
a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java
 
b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java
index b6f1d99b1c..193f150350 100644
--- 
a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java
+++ 
b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java
@@ -286,21 +286,19 @@ public abstract class RebalanceImpl {
             }
             case CLUSTERING: {
                 Set<MessageQueue> mqSet = 
this.topicSubscribeInfoTable.get(topic);
-                List<String> cidAll = 
this.mQClientFactory.findConsumerIdList(topic, consumerGroup);
-                if (null == mqSet) {
+                if (null == mqSet || mqSet.isEmpty()) {
                     if (!topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX)) {
                         this.messageQueueChanged(topic, 
Collections.<MessageQueue>emptySet(), Collections.<MessageQueue>emptySet());
                         log.warn("doRebalance, {}, but the topic[{}] not 
exist.", consumerGroup, topic);
                     }
+                    break;
                 }
 
-                if (null == cidAll) {
+                List<String> cidAll = 
this.mQClientFactory.findConsumerIdList(topic, consumerGroup);
+                if (null == cidAll || cidAll.isEmpty()) {
                     log.warn("doRebalance, {} {}, get consumer id list 
failed", consumerGroup, topic);
-                }
-
-                if (mqSet != null && cidAll != null) {
-                    List<MessageQueue> mqAll = new ArrayList<>();
-                    mqAll.addAll(mqSet);
+                } else {
+                    List<MessageQueue> mqAll = new ArrayList<>(mqSet);
 
                     Collections.sort(mqAll);
                     Collections.sort(cidAll);

Reply via email to