You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/01/05 12:35:16 UTC

[GitHub] [rocketmq] weibubli opened a new pull request #3710: [ISSUE #3709] Update ExportMetadataCommand.java

weibubli opened a new pull request #3710:
URL: https://github.com/apache/rocketmq/pull/3710


   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   XXXXX
   
   ## Brief changelog
   
   XX
   
   ## Verifying this change
   
   XXXX
   
   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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq] weibubli closed pull request #3710: [ISSUE #3709] Fixes the problem that the result of requesting information from multiple addresses does not overlap when exporting Metadate.

Posted by GitBox <gi...@apache.org>.
weibubli closed pull request #3710:
URL: https://github.com/apache/rocketmq/pull/3710


   


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

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



[GitHub] [rocketmq] weibubli closed pull request #3710: [ISSUE #3709] Fixes the problem that the result of requesting information from multiple addresses does not overlap when exporting Metadate.

Posted by GitBox <gi...@apache.org>.
weibubli closed pull request #3710:
URL: https://github.com/apache/rocketmq/pull/3710


   


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

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



[GitHub] [rocketmq] coveralls commented on pull request #3710: [ISSUE #3709] Fixes the problem that the result of requesting information from multiple addresses does not overlap when exporting Metadate.

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #3710:
URL: https://github.com/apache/rocketmq/pull/3710#issuecomment-1005695743


   
   [![Coverage Status](https://coveralls.io/builds/45391754/badge)](https://coveralls.io/builds/45391754)
   
   Coverage increased (+0.05%) to 54.513% when pulling **c8d644559634feb869e3fdf5c0bdda9eece8b5d9 on weibubli:master** into **e24794da71beef185221220ba817e9b4aafbf8f2 on apache:master**.
   


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

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



[GitHub] [rocketmq] yuz10 commented on a change in pull request #3710: [ISSUE #3709] Fixes the problem that the result of requesting information from multiple addresses does not overlap when exporting Metadate.

Posted by GitBox <gi...@apache.org>.
yuz10 commented on a change in pull request #3710:
URL: https://github.com/apache/rocketmq/pull/3710#discussion_r780067737



##########
File path: tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java
##########
@@ -119,6 +119,8 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook)
 
                 Map<String, TopicConfig> topicConfigMap = new HashMap<>();
                 Map<String, SubscriptionGroupConfig> subGroupConfigMap = new HashMap<>();
+                Map<String, Object> result = new HashMap<>();
+                result.put("rocketmqVersion", MQVersion.getVersionDesc(MQVersion.CURRENT_VERSION));

Review comment:
       The version is client side version, not broker side?

##########
File path: tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java
##########
@@ -127,49 +129,51 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook)
                     SubscriptionGroupWrapper subscriptionGroupWrapper = defaultMQAdminExt.getUserSubscriptionGroup(
                         addr, 10000);
 
-                    if (commandLine.hasOption('t')) {
-                        filePath = filePath + "/topic.json";
-                        MixAll.string2FileNotSafe(JSON.toJSONString(topicConfigSerializeWrapper, true), filePath);
-                        System.out.printf("export %s success", filePath);
-                        return;
-                    } else if (commandLine.hasOption('g')) {
-                        filePath = filePath + "/subscriptionGroup.json";
-                        MixAll.string2FileNotSafe(JSON.toJSONString(subscriptionGroupWrapper, true), filePath);
-                        System.out.printf("export %s success", filePath);
-                        return;
-                    } else {
-                        for (Map.Entry<String, TopicConfig> entry : topicConfigSerializeWrapper.getTopicConfigTable().entrySet()) {
-                            TopicConfig topicConfig = topicConfigMap.get(entry.getKey());
-                            if (null != topicConfig) {
-                                entry.getValue().setWriteQueueNums(
-                                    topicConfig.getWriteQueueNums() + entry.getValue().getWriteQueueNums());
-                                entry.getValue().setReadQueueNums(
-                                    topicConfig.getReadQueueNums() + entry.getValue().getReadQueueNums());
-                            }
-                            topicConfigMap.put(entry.getKey(), entry.getValue());
+                    for (Map.Entry<String, TopicConfig> entry : topicConfigSerializeWrapper.getTopicConfigTable()
+                        .entrySet()) {
+                        TopicConfig topicConfig = topicConfigMap.get(entry.getKey());
+                        if (null != topicConfig) {
+                            entry.getValue().setWriteQueueNums(
+                                topicConfig.getWriteQueueNums() + entry.getValue().getWriteQueueNums());
+                            entry.getValue().setReadQueueNums(
+                                topicConfig.getReadQueueNums() + entry.getValue().getReadQueueNums());
                         }
+                        topicConfigMap.put(entry.getKey(), entry.getValue());
+                    }
 
-                        for (Map.Entry<String, SubscriptionGroupConfig> entry : subscriptionGroupWrapper.getSubscriptionGroupTable().entrySet()) {
+                    for (Map.Entry<String, SubscriptionGroupConfig> entry : subscriptionGroupWrapper.getSubscriptionGroupTable()
+                        .entrySet()) {
 
-                            SubscriptionGroupConfig subscriptionGroupConfig = subGroupConfigMap.get(entry.getKey());
-                            if (null != subscriptionGroupConfig) {
-                                entry.getValue().setRetryQueueNums(
-                                    subscriptionGroupConfig.getRetryQueueNums() + entry.getValue().getRetryQueueNums());
-                            }
-                            subGroupConfigMap.put(entry.getKey(), entry.getValue());
+                        SubscriptionGroupConfig subscriptionGroupConfig = subGroupConfigMap.get(entry.getKey());
+                        if (null != subscriptionGroupConfig) {
+                            entry.getValue().setRetryQueueNums(
+                                subscriptionGroupConfig.getRetryQueueNums() + entry.getValue().getRetryQueueNums());
                         }
+                        subGroupConfigMap.put(entry.getKey(), entry.getValue());
+                    }
 
-                        Map<String, Object> result = new HashMap<>();
-                        result.put("topicConfigTable", topicConfigMap);
-                        result.put("subscriptionGroupTable", subGroupConfigMap);
-                        result.put("rocketmqVersion", MQVersion.getVersionDesc(MQVersion.CURRENT_VERSION));
-                        result.put("exportTime", System.currentTimeMillis());
+                }
 
-                        filePath = filePath + "/metadata.json";
-                        MixAll.string2FileNotSafe(JSON.toJSONString(result, true), filePath);
-                        System.out.printf("export %s success", filePath);
-                    }
+                if (commandLine.hasOption('t')) {

Review comment:
       could extract duplication like:
   ```java
                   String exportPath;
                   if (commandLine.hasOption('t')) {
                       result.put("topicConfigTable", topicConfigMap);
                       exportPath = filePath + "/topic.json";
                   } else if (commandLine.hasOption('g')) {
                       result.put("subscriptionGroupTable", subGroupConfigMap);
                       exportPath = filePath + "/topic.json";
                   } else {
                       result.put("topicConfigTable", topicConfigMap);
                       result.put("subscriptionGroupTable", subGroupConfigMap);
                       exportPath = filePath + "/metadata.json";
                   }
                   result.put("exportTime", System.currentTimeMillis());
                   MixAll.string2FileNotSafe(JSON.toJSONString(result, true), exportPath);
                   System.out.printf("export %s success%n", exportPath);
   ```




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

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



[GitHub] [rocketmq] yuz10 commented on a change in pull request #3710: [ISSUE #3709] Fixes the problem that the result of requesting information from multiple addresses does not overlap when exporting Metadate.

Posted by GitBox <gi...@apache.org>.
yuz10 commented on a change in pull request #3710:
URL: https://github.com/apache/rocketmq/pull/3710#discussion_r780067737



##########
File path: tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java
##########
@@ -119,6 +119,8 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook)
 
                 Map<String, TopicConfig> topicConfigMap = new HashMap<>();
                 Map<String, SubscriptionGroupConfig> subGroupConfigMap = new HashMap<>();
+                Map<String, Object> result = new HashMap<>();
+                result.put("rocketmqVersion", MQVersion.getVersionDesc(MQVersion.CURRENT_VERSION));

Review comment:
       The version is client side version, not broker side?




-- 
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: dev-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 #3710: [ISSUE #3709] Fixes the problem that the result of requesting information from multiple addresses does not overlap when exporting Metadate.

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #3710:
URL: https://github.com/apache/rocketmq/pull/3710#issuecomment-1005695863


   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/3710?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3710](https://codecov.io/gh/apache/rocketmq/pull/3710?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c8d6445) into [master](https://codecov.io/gh/apache/rocketmq/commit/e24794da71beef185221220ba817e9b4aafbf8f2?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e24794d) will **decrease** coverage by `0.07%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/rocketmq/pull/3710/graphs/tree.svg?width=650&height=150&src=pr&token=4w0sxP1wZv&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/rocketmq/pull/3710?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3710      +/-   ##
   ============================================
   - Coverage     48.25%   48.18%   -0.08%     
   + Complexity     4605     4595      -10     
   ============================================
     Files           555      555              
     Lines         36755    36755              
     Branches       4841     4841              
   ============================================
   - Hits          17735    17709      -26     
   - Misses        16792    16817      +25     
   - Partials       2228     2229       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/3710?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ketmq/client/impl/consumer/PullMessageService.java](https://codecov.io/gh/apache/rocketmq/pull/3710/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9QdWxsTWVzc2FnZVNlcnZpY2UuamF2YQ==) | `75.55% <0.00%> (-4.45%)` | :arrow_down: |
   | [...ava/org/apache/rocketmq/filter/util/BitsArray.java](https://codecov.io/gh/apache/rocketmq/pull/3710/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9maWx0ZXIvdXRpbC9CaXRzQXJyYXkuamF2YQ==) | `59.82% <0.00%> (-2.57%)` | :arrow_down: |
   | [...org/apache/rocketmq/common/stats/StatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/3710/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNJdGVtU2V0LmphdmE=) | `41.79% <0.00%> (-1.50%)` | :arrow_down: |
   | [...rocketmq/client/impl/factory/MQClientInstance.java](https://codecov.io/gh/apache/rocketmq/pull/3710/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9mYWN0b3J5L01RQ2xpZW50SW5zdGFuY2UuamF2YQ==) | `49.62% <0.00%> (-1.49%)` | :arrow_down: |
   | [...mq/client/impl/consumer/RebalanceLitePullImpl.java](https://codecov.io/gh/apache/rocketmq/pull/3710/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9SZWJhbGFuY2VMaXRlUHVsbEltcGwuamF2YQ==) | `48.52% <0.00%> (-1.48%)` | :arrow_down: |
   | [...a/org/apache/rocketmq/store/StoreStatsService.java](https://codecov.io/gh/apache/rocketmq/pull/3710/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL1N0b3JlU3RhdHNTZXJ2aWNlLmphdmE=) | `29.50% <0.00%> (-1.32%)` | :arrow_down: |
   | [...etmq/client/latency/LatencyFaultToleranceImpl.java](https://codecov.io/gh/apache/rocketmq/pull/3710/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvbGF0ZW5jeS9MYXRlbmN5RmF1bHRUb2xlcmFuY2VJbXBsLmphdmE=) | `50.00% <0.00%> (-1.29%)` | :arrow_down: |
   | [...e/rocketmq/client/impl/consumer/RebalanceImpl.java](https://codecov.io/gh/apache/rocketmq/pull/3710/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9SZWJhbGFuY2VJbXBsLmphdmE=) | `39.45% <0.00%> (-1.18%)` | :arrow_down: |
   | [...n/java/org/apache/rocketmq/store/ha/HAService.java](https://codecov.io/gh/apache/rocketmq/pull/3710/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL0hBU2VydmljZS5qYXZh) | `70.95% <0.00%> (-0.34%)` | :arrow_down: |
   | [.../apache/rocketmq/logging/inner/LoggingBuilder.java](https://codecov.io/gh/apache/rocketmq/pull/3710/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bG9nZ2luZy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvbG9nZ2luZy9pbm5lci9Mb2dnaW5nQnVpbGRlci5qYXZh) | `63.60% <0.00%> (-0.32%)` | :arrow_down: |
   | ... and [2 more](https://codecov.io/gh/apache/rocketmq/pull/3710/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/rocketmq/pull/3710?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/rocketmq/pull/3710?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e24794d...c8d6445](https://codecov.io/gh/apache/rocketmq/pull/3710?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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

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



[GitHub] [rocketmq] yuz10 commented on a change in pull request #3710: [ISSUE #3709] Fixes the problem that the result of requesting information from multiple addresses does not overlap when exporting Metadate.

Posted by GitBox <gi...@apache.org>.
yuz10 commented on a change in pull request #3710:
URL: https://github.com/apache/rocketmq/pull/3710#discussion_r780072521



##########
File path: tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java
##########
@@ -127,49 +129,51 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook)
                     SubscriptionGroupWrapper subscriptionGroupWrapper = defaultMQAdminExt.getUserSubscriptionGroup(
                         addr, 10000);
 
-                    if (commandLine.hasOption('t')) {
-                        filePath = filePath + "/topic.json";
-                        MixAll.string2FileNotSafe(JSON.toJSONString(topicConfigSerializeWrapper, true), filePath);
-                        System.out.printf("export %s success", filePath);
-                        return;
-                    } else if (commandLine.hasOption('g')) {
-                        filePath = filePath + "/subscriptionGroup.json";
-                        MixAll.string2FileNotSafe(JSON.toJSONString(subscriptionGroupWrapper, true), filePath);
-                        System.out.printf("export %s success", filePath);
-                        return;
-                    } else {
-                        for (Map.Entry<String, TopicConfig> entry : topicConfigSerializeWrapper.getTopicConfigTable().entrySet()) {
-                            TopicConfig topicConfig = topicConfigMap.get(entry.getKey());
-                            if (null != topicConfig) {
-                                entry.getValue().setWriteQueueNums(
-                                    topicConfig.getWriteQueueNums() + entry.getValue().getWriteQueueNums());
-                                entry.getValue().setReadQueueNums(
-                                    topicConfig.getReadQueueNums() + entry.getValue().getReadQueueNums());
-                            }
-                            topicConfigMap.put(entry.getKey(), entry.getValue());
+                    for (Map.Entry<String, TopicConfig> entry : topicConfigSerializeWrapper.getTopicConfigTable()
+                        .entrySet()) {
+                        TopicConfig topicConfig = topicConfigMap.get(entry.getKey());
+                        if (null != topicConfig) {
+                            entry.getValue().setWriteQueueNums(
+                                topicConfig.getWriteQueueNums() + entry.getValue().getWriteQueueNums());
+                            entry.getValue().setReadQueueNums(
+                                topicConfig.getReadQueueNums() + entry.getValue().getReadQueueNums());
                         }
+                        topicConfigMap.put(entry.getKey(), entry.getValue());
+                    }
 
-                        for (Map.Entry<String, SubscriptionGroupConfig> entry : subscriptionGroupWrapper.getSubscriptionGroupTable().entrySet()) {
+                    for (Map.Entry<String, SubscriptionGroupConfig> entry : subscriptionGroupWrapper.getSubscriptionGroupTable()
+                        .entrySet()) {
 
-                            SubscriptionGroupConfig subscriptionGroupConfig = subGroupConfigMap.get(entry.getKey());
-                            if (null != subscriptionGroupConfig) {
-                                entry.getValue().setRetryQueueNums(
-                                    subscriptionGroupConfig.getRetryQueueNums() + entry.getValue().getRetryQueueNums());
-                            }
-                            subGroupConfigMap.put(entry.getKey(), entry.getValue());
+                        SubscriptionGroupConfig subscriptionGroupConfig = subGroupConfigMap.get(entry.getKey());
+                        if (null != subscriptionGroupConfig) {
+                            entry.getValue().setRetryQueueNums(
+                                subscriptionGroupConfig.getRetryQueueNums() + entry.getValue().getRetryQueueNums());
                         }
+                        subGroupConfigMap.put(entry.getKey(), entry.getValue());
+                    }
 
-                        Map<String, Object> result = new HashMap<>();
-                        result.put("topicConfigTable", topicConfigMap);
-                        result.put("subscriptionGroupTable", subGroupConfigMap);
-                        result.put("rocketmqVersion", MQVersion.getVersionDesc(MQVersion.CURRENT_VERSION));
-                        result.put("exportTime", System.currentTimeMillis());
+                }
 
-                        filePath = filePath + "/metadata.json";
-                        MixAll.string2FileNotSafe(JSON.toJSONString(result, true), filePath);
-                        System.out.printf("export %s success", filePath);
-                    }
+                if (commandLine.hasOption('t')) {

Review comment:
       could extract duplication like:
   ```java
                   String exportPath;
                   if (commandLine.hasOption('t')) {
                       result.put("topicConfigTable", topicConfigMap);
                       exportPath = filePath + "/topic.json";
                   } else if (commandLine.hasOption('g')) {
                       result.put("subscriptionGroupTable", subGroupConfigMap);
                       exportPath = filePath + "/topic.json";
                   } else {
                       result.put("topicConfigTable", topicConfigMap);
                       result.put("subscriptionGroupTable", subGroupConfigMap);
                       exportPath = filePath + "/metadata.json";
                   }
                   result.put("exportTime", System.currentTimeMillis());
                   MixAll.string2FileNotSafe(JSON.toJSONString(result, true), exportPath);
                   System.out.printf("export %s success%n", exportPath);
   ```




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

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