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

[GitHub] [rocketmq] mahaitao617 opened a new pull request, #5958: [ISSUE #5936] feat:add display replica status

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

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

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


[GitHub] [rocketmq] mahaitao617 commented on pull request #5958: [ISSUE #5936] feat:add display replica status

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

   #5936 


-- 
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] caigy commented on a diff in pull request #5958: [ISSUE #5936] feat:add display replica status

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


##########
tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:
##########
@@ -123,13 +123,23 @@ private void printData(String controllerAddress, List<String> brokerNames,
                     next.getKey(), next.getValue().getMasterAddress(), next.getValue().getMasterEpoch(), next.getValue().getSyncStateSetEpoch(),
                     inSyncReplicas.size());
                 for (BrokerReplicasInfo.ReplicaIdentity member : inSyncReplicas) {
-                    System.out.printf("\n InSyncReplica:\t%s\n", member.toString());
+                    System.out.printf("\n InSyncReplica:\t%s\n", member.toString() + acquireBrokerStatus(defaultMQAdminExt, member.getAddress()));
                 }
 
                 for (BrokerReplicasInfo.ReplicaIdentity member : notInSyncReplicas) {
-                    System.out.printf("\n NotInSyncReplica:\t%s\n", member.toString());
+                    System.out.printf("\n NotInSyncReplica:\t%s\n", member.toString() + acquireBrokerStatus(defaultMQAdminExt, member.getAddress()));

Review Comment:
   Format the message in `printf` formatter instead of concatenating strings directly.



##########
tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:
##########
@@ -123,13 +123,23 @@ private void printData(String controllerAddress, List<String> brokerNames,
                     next.getKey(), next.getValue().getMasterAddress(), next.getValue().getMasterEpoch(), next.getValue().getSyncStateSetEpoch(),
                     inSyncReplicas.size());
                 for (BrokerReplicasInfo.ReplicaIdentity member : inSyncReplicas) {
-                    System.out.printf("\n InSyncReplica:\t%s\n", member.toString());
+                    System.out.printf("\n InSyncReplica:\t%s\n", member.toString() + acquireBrokerStatus(defaultMQAdminExt, member.getAddress()));
                 }
 
                 for (BrokerReplicasInfo.ReplicaIdentity member : notInSyncReplicas) {
-                    System.out.printf("\n NotInSyncReplica:\t%s\n", member.toString());
+                    System.out.printf("\n NotInSyncReplica:\t%s\n", member.toString() + acquireBrokerStatus(defaultMQAdminExt, member.getAddress()));
                 }
             }
         }
     }
+
+    private String acquireBrokerStatus(DefaultMQAdminExt defaultMQAdminExt,String brokerAddr) {
+        String status = " online";

Review Comment:
   `status` should not contain format characters (like white spaces), do formatting work where it is necessary.



-- 
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] mxsm commented on pull request #5958: [ISSUE #5936] feat:add display replica status

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

   Hi @mahaitao617  you can see this [document ](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)how to link issue.


-- 
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] mahaitao617 commented on pull request #5958: [ISSUE #5936] feat:add display replica status

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

   > Hi @mahaitao617 , We can really check whether the broker is alive or not by visiting the broker, but I think there is a better way.
   > 
   > 1. An exception in accessing the broker does not necessarily mean that the broker is not online
   > 2. Accessing each broker is time-consuming
   > 
   > In fact, since every broker sends heartbeats to the controller, we can get whether the broker is online in a PRC interaction from the controller.
   
   I have fix it,pls help me review again,thanks


-- 
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] mahaitao617 closed pull request #5958: [ISSUE #5936] feat:add display replica status

Posted by "mahaitao617 (via GitHub)" <gi...@apache.org>.
mahaitao617 closed pull request #5958: [ISSUE #5936] feat:add display replica  status
URL: https://github.com/apache/rocketmq/pull/5958


-- 
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] mahaitao617 commented on pull request #5958: [ISSUE #5936] feat:add display replica status

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

   @RongtongJin  please help me review code at your convenience,thanks


-- 
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] mahaitao617 commented on a diff in pull request #5958: [ISSUE #5936] feat:add display replica status

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


##########
tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:
##########
@@ -123,13 +123,23 @@ private void printData(String controllerAddress, List<String> brokerNames,
                     next.getKey(), next.getValue().getMasterAddress(), next.getValue().getMasterEpoch(), next.getValue().getSyncStateSetEpoch(),
                     inSyncReplicas.size());
                 for (BrokerReplicasInfo.ReplicaIdentity member : inSyncReplicas) {
-                    System.out.printf("\n InSyncReplica:\t%s\n", member.toString());
+                    System.out.printf("\n InSyncReplica:\t%s\n", member.toString() + acquireBrokerStatus(defaultMQAdminExt, member.getAddress()));
                 }
 
                 for (BrokerReplicasInfo.ReplicaIdentity member : notInSyncReplicas) {
-                    System.out.printf("\n NotInSyncReplica:\t%s\n", member.toString());
+                    System.out.printf("\n NotInSyncReplica:\t%s\n", member.toString() + acquireBrokerStatus(defaultMQAdminExt, member.getAddress()));

Review Comment:
   i have fixed it



##########
tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:
##########
@@ -123,13 +123,23 @@ private void printData(String controllerAddress, List<String> brokerNames,
                     next.getKey(), next.getValue().getMasterAddress(), next.getValue().getMasterEpoch(), next.getValue().getSyncStateSetEpoch(),
                     inSyncReplicas.size());
                 for (BrokerReplicasInfo.ReplicaIdentity member : inSyncReplicas) {
-                    System.out.printf("\n InSyncReplica:\t%s\n", member.toString());
+                    System.out.printf("\n InSyncReplica:\t%s\n", member.toString() + acquireBrokerStatus(defaultMQAdminExt, member.getAddress()));
                 }
 
                 for (BrokerReplicasInfo.ReplicaIdentity member : notInSyncReplicas) {
-                    System.out.printf("\n NotInSyncReplica:\t%s\n", member.toString());
+                    System.out.printf("\n NotInSyncReplica:\t%s\n", member.toString() + acquireBrokerStatus(defaultMQAdminExt, member.getAddress()));
                 }
             }
         }
     }
+
+    private String acquireBrokerStatus(DefaultMQAdminExt defaultMQAdminExt,String brokerAddr) {
+        String status = " online";

Review Comment:
   i have fixed it



-- 
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 #5958: [ISSUE #5936] feat:add display replica status

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

   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/5958?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 [#5958](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9f16982) into [develop](https://codecov.io/gh/apache/rocketmq/commit/e2a341e7f50d606230105e7e1f5b8e734a984802?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e2a341e) will **increase** coverage by `0.03%`.
   > The diff coverage is `0.00%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #5958      +/-   ##
   =============================================
   + Coverage      43.30%   43.34%   +0.03%     
   - Complexity      8798     8811      +13     
   =============================================
     Files           1090     1090              
     Lines          76467    76473       +6     
     Branches        9992     9992              
   =============================================
   + Hits           33116    33146      +30     
   + Misses         39203    39191      -12     
   + Partials        4148     4136      -12     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...mq/tools/command/ha/GetSyncStateSetSubCommand.java](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-dG9vbHMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3Rvb2xzL2NvbW1hbmQvaGEvR2V0U3luY1N0YXRlU2V0U3ViQ29tbWFuZC5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...a/org/apache/rocketmq/filter/util/BloomFilter.java](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmlsdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9maWx0ZXIvdXRpbC9CbG9vbUZpbHRlci5qYXZh) | `60.43% <0.00%> (-2.20%)` | :arrow_down: |
   | [...ent/impl/consumer/DefaultLitePullConsumerImpl.java](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9EZWZhdWx0TGl0ZVB1bGxDb25zdW1lckltcGwuamF2YQ==) | `67.65% <0.00%> (-0.63%)` | :arrow_down: |
   | [...c/main/java/org/apache/rocketmq/common/MixAll.java](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vTWl4QWxsLmphdmE=) | `41.44% <0.00%> (ø)` | |
   | [...ava/org/apache/rocketmq/filter/util/BitsArray.java](https://codecov.io/gh/apache/rocketmq/pull/5958?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%> (ø)` | |
   | [...cketmq/broker/processor/PopBufferMergeService.java](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1BvcEJ1ZmZlck1lcmdlU2VydmljZS5qYXZh) | `33.41% <0.00%> (ø)` | |
   | [...main/java/org/apache/rocketmq/store/CommitLog.java](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL0NvbW1pdExvZy5qYXZh) | `65.23% <0.00%> (+0.20%)` | :arrow_up: |
   | [...e/rocketmq/namesrv/routeinfo/RouteInfoManager.java](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bmFtZXNydi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvbmFtZXNydi9yb3V0ZWluZm8vUm91dGVJbmZvTWFuYWdlci5qYXZh) | `63.75% <0.00%> (+0.32%)` | :arrow_up: |
   | [...cketmq/store/ha/autoswitch/AutoSwitchHAClient.java](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL2F1dG9zd2l0Y2gvQXV0b1N3aXRjaEhBQ2xpZW50LmphdmE=) | `76.53% <0.00%> (+0.36%)` | :arrow_up: |
   | [...cketmq/broker/schedule/ScheduleMessageService.java](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvc2NoZWR1bGUvU2NoZWR1bGVNZXNzYWdlU2VydmljZS5qYXZh) | `58.04% <0.00%> (+1.13%)` | :arrow_up: |
   | ... and [8 more](https://codecov.io/gh/apache/rocketmq/pull/5958?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :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=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: commits-unsubscribe@rocketmq.apache.org

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