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

[GitHub] [rocketmq] HScarb opened a new pull request, #5956: [ISSUE #5844] Fix bug when examine pop consumer group info

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

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   Fix #5844 
   
   ## Brief changelog
   
   Use `examineBrokerClusterInfo` instead of examine retry topic route info when examing broker addrs in `examingConsumeStats` and `examingConsumerConnectionInfo` methods.
   
   ## Verifying this change
   
   ![image](https://user-images.githubusercontent.com/10664298/215471733-a144dd1b-b1c9-4b46-96a1-a20b445c204e.png)
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
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


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

Posted by "ShadowySpirits (via GitHub)" <gi...@apache.org>.
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


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

Posted by "HScarb (via GitHub)" <gi...@apache.org>.
HScarb commented on code in PR #5956:
URL: https://github.com/apache/rocketmq/pull/5956#discussion_r1092666812


##########
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:
   IMO, old code also scan all clusters, because consumers send heartbeat and create retry topics on all brokers.
   Do you have any suggestions for improvement here?



-- 
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


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

Posted by "ShadowySpirits (via GitHub)" <gi...@apache.org>.
ShadowySpirits commented on code in PR #5956:
URL: https://github.com/apache/rocketmq/pull/5956#discussion_r1092804436


##########
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:
   > IMO, old code also scan all clusters, because consumers send heartbeat and create retry topics on all brokers. Do you have any suggestions for improvement here?
   
   That's not exactly. If we only have one cluster, these two ways do not have differences. But in production practice, there are many broker clusters registered to the same nameserver cluster. So that your modification will access unnecessary clusters.



-- 
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


[GitHub] [rocketmq] codecov-commenter commented on pull request #5956: [ISSUE #5844] Fix bug when examine pop consumer group info

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #5956:
URL: https://github.com/apache/rocketmq/pull/5956#issuecomment-1558977225

   ## [Codecov](https://app.codecov.io/gh/apache/rocketmq/pull/5956?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#5956](https://app.codecov.io/gh/apache/rocketmq/pull/5956?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (53a08bb) into [develop](https://app.codecov.io/gh/apache/rocketmq/commit/eef581b464d0144a3ec400a20087196f7eefd764?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (eef581b) will **decrease** coverage by `0.01%`.
   > The diff coverage is `68.42%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #5956      +/-   ##
   =============================================
   - Coverage      42.93%   42.93%   -0.01%     
   + Complexity      8995     8992       -3     
   =============================================
     Files           1104     1104              
     Lines          78380    78373       -7     
     Branches       10207    10206       -1     
   =============================================
   - Hits           33654    33647       -7     
   + Misses         40512    40503       -9     
   - Partials        4214     4223       +9     
   ```
   
   
   | [Impacted Files](https://app.codecov.io/gh/apache/rocketmq/pull/5956?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...he/rocketmq/tools/admin/DefaultMQAdminExtImpl.java](https://app.codecov.io/gh/apache/rocketmq/pull/5956?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-dG9vbHMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3Rvb2xzL2FkbWluL0RlZmF1bHRNUUFkbWluRXh0SW1wbC5qYXZh) | `25.42% <68.42%> (+0.31%)` | :arrow_up: |
   
   ... and [27 files with indirect coverage changes](https://app.codecov.io/gh/apache/rocketmq/pull/5956/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
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