You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "ShadowySpirits (via GitHub)" <gi...@apache.org> on 2023/01/31 08:56:16 UTC

[GitHub] [rocketmq] ShadowySpirits commented on a diff in pull request #5956: [ISSUE #5844] Fix bug when examine pop consumer group info

ShadowySpirits commented on code in PR #5956:
URL: https://github.com/apache/rocketmq/pull/5956#discussion_r1091625028


##########
tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:
##########
@@ -418,35 +418,20 @@ public ConsumeStats examineConsumeStats(
     @Override
     public ConsumeStats examineConsumeStats(String consumerGroup,
         String topic) throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
-        TopicRouteData topicRouteData = null;
-        List<String> routeTopics = new ArrayList<>();
-        routeTopics.add(MixAll.getRetryTopic(consumerGroup));
-        if (topic != null) {
-            routeTopics.add(topic);
-            routeTopics.add(KeyBuilder.buildPopRetryTopic(topic, consumerGroup));
-        }
-        for (int i = 0; i < routeTopics.size(); i++) {
-            try {
-                topicRouteData = this.examineTopicRouteInfo(routeTopics.get(i));
-                if (topicRouteData != null) {
-                    break;
-                }
-            } catch (Throwable e) {
-                if (i == routeTopics.size() - 1) {
-                    throw e;
-                }
-            }
-        }
         ConsumeStats result = new ConsumeStats();
-
-        for (BrokerData bd : topicRouteData.getBrokerDatas()) {
-            String addr = bd.selectBrokerAddr();
-            if (addr != null) {
-                ConsumeStats consumeStats = this.mqClientInstance.getMQClientAPIImpl().getConsumeStats(addr, consumerGroup, topic, timeoutMillis * 3);
-                result.getOffsetTable().putAll(consumeStats.getOffsetTable());
-                double value = result.getConsumeTps() + consumeStats.getConsumeTps();
-                result.setConsumeTps(value);
+        for (BrokerData brokerData : this.examineBrokerClusterInfo().getBrokerAddrTable().values()) {

Review Comment:
   Scanning all clusters is not a good choice. This way is inefficient and easily leads to timeout, especially since the number of clusters is very large.



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org