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/08/21 13:57:32 UTC

[GitHub] [rocketmq] mxsm opened a new pull request, #4862: [ISSUE #4857] Fix broker can't auto register to controller again

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

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   Fix #4857 
   
   ## Brief changelog
   
   - Fix broker can't auto register to controller again
   
   ## 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] RongtongJin commented on a diff in pull request #4862: [ISSUE #4857] Fix broker can't auto register to controller again

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on code in PR #4862:
URL: https://github.com/apache/rocketmq/pull/4862#discussion_r950935237


##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -347,6 +351,12 @@ private void schedulingSyncBrokerMetadata() {
                 }
             } catch (final Exception e) {
                 LOGGER.warn("Error happen when get broker {}'s metadata", this.brokerConfig.getBrokerName(), e);
+                if (e instanceof MQBrokerException) {
+                    int code = ((MQBrokerException) e).getResponseCode();
+                    if (code == CONTROLLER_INVALID_REQUEST || code == CONTROLLER_NOT_LEADER) {

Review Comment:
    Too many places use CONTROLLER_ INVALID_ REQUEST. How about adding a new response code to indicate this situation?



##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -347,6 +351,12 @@ private void schedulingSyncBrokerMetadata() {
                 }
             } catch (final Exception e) {
                 LOGGER.warn("Error happen when get broker {}'s metadata", this.brokerConfig.getBrokerName(), e);
+                if (e instanceof MQBrokerException) {
+                    int code = ((MQBrokerException) e).getResponseCode();
+                    if (code == CONTROLLER_INVALID_REQUEST || code == CONTROLLER_NOT_LEADER) {

Review Comment:
   if code == CONTROLLER_NOT_LEADER, we don't need to do anything.



-- 
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 #4862: [ISSUE #4857] Fix broker can't auto register to controller again

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

   
   [![Coverage Status](https://coveralls.io/builds/51819472/badge)](https://coveralls.io/builds/51819472)
   
   Coverage decreased (-0.1%) to 48.938% when pulling **cb56316e1a8ce6608cbccba9fa832074e750cea8 on mxsm:rocketmq-4857** into **96fd4f52e09536e2e8487c701cc7846b0529b04e on apache:develop**.
   


-- 
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] mxsm commented on a diff in pull request #4862: [ISSUE #4857] Fix broker can't auto register to controller again

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #4862:
URL: https://github.com/apache/rocketmq/pull/4862#discussion_r952380422


##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -347,6 +351,12 @@ private void schedulingSyncBrokerMetadata() {
                 }
             } catch (final Exception e) {
                 LOGGER.warn("Error happen when get broker {}'s metadata", this.brokerConfig.getBrokerName(), e);
+                if (e instanceof MQBrokerException) {
+                    int code = ((MQBrokerException) e).getResponseCode();
+                    if (code == CONTROLLER_INVALID_GETREPLICAINFO) {
+                        registerBrokerToController();

Review Comment:
   > how about try to register again after a while?
   
   That's good idea



-- 
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] RongtongJin merged pull request #4862: [ISSUE #4857] Fix broker can't auto register to controller again

Posted by GitBox <gi...@apache.org>.
RongtongJin merged PR #4862:
URL: https://github.com/apache/rocketmq/pull/4862


-- 
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 #4862: [ISSUE #4857] Fix broker can't auto register to controller again

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

   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/4862?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 [#4862](https://codecov.io/gh/apache/rocketmq/pull/4862?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (cb56316) into [develop](https://codecov.io/gh/apache/rocketmq/commit/96fd4f52e09536e2e8487c701cc7846b0529b04e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (96fd4f5) will **decrease** coverage by `0.14%`.
   > The diff coverage is `25.00%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #4862      +/-   ##
   =============================================
   - Coverage      44.80%   44.65%   -0.15%     
   + Complexity      7637     7623      -14     
   =============================================
     Files            982      982              
     Lines          68253    68258       +5     
     Branches        9023     9025       +2     
   =============================================
   - Hits           30580    30482      -98     
   - Misses         33884    33988     +104     
   + Partials        3789     3788       -1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/4862?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...org/apache/rocketmq/broker/out/BrokerOuterAPI.java](https://codecov.io/gh/apache/rocketmq/pull/4862/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvb3V0L0Jyb2tlck91dGVyQVBJLmphdmE=) | `18.56% <0.00%> (-0.04%)` | :arrow_down: |
   | [...he/rocketmq/broker/controller/ReplicasManager.java](https://codecov.io/gh/apache/rocketmq/pull/4862/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvY29udHJvbGxlci9SZXBsaWNhc01hbmFnZXIuamF2YQ==) | `44.20% <28.57%> (-0.78%)` | :arrow_down: |
   | [.../broker/subscription/SubscriptionGroupManager.java](https://codecov.io/gh/apache/rocketmq/pull/4862/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvc3Vic2NyaXB0aW9uL1N1YnNjcmlwdGlvbkdyb3VwTWFuYWdlci5qYXZh) | `68.79% <0.00%> (-14.19%)` | :arrow_down: |
   | [...n/java/org/apache/rocketmq/test/util/StatUtil.java](https://codecov.io/gh/apache/rocketmq/pull/4862/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-dGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvdGVzdC91dGlsL1N0YXRVdGlsLmphdmE=) | `16.19% <0.00%> (-14.09%)` | :arrow_down: |
   | [...org/apache/rocketmq/common/stats/StatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/4862/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%> (-8.96%)` | :arrow_down: |
   | [...va/org/apache/rocketmq/logging/inner/Appender.java](https://codecov.io/gh/apache/rocketmq/pull/4862/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-bG9nZ2luZy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvbG9nZ2luZy9pbm5lci9BcHBlbmRlci5qYXZh) | `29.21% <0.00%> (-7.87%)` | :arrow_down: |
   | [...ache/rocketmq/broker/topic/TopicConfigManager.java](https://codecov.io/gh/apache/rocketmq/pull/4862/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvdG9waWMvVG9waWNDb25maWdNYW5hZ2VyLmphdmE=) | `59.03% <0.00%> (-3.06%)` | :arrow_down: |
   | [...ent/impl/consumer/DefaultLitePullConsumerImpl.java](https://codecov.io/gh/apache/rocketmq/pull/4862/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-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9EZWZhdWx0TGl0ZVB1bGxDb25zdW1lckltcGwuamF2YQ==) | `67.66% <0.00%> (-2.82%)` | :arrow_down: |
   | [.../org/apache/rocketmq/store/ha/DefaultHAClient.java](https://codecov.io/gh/apache/rocketmq/pull/4862/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-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL0RlZmF1bHRIQUNsaWVudC5qYXZh) | `58.46% <0.00%> (-2.57%)` | :arrow_down: |
   | [...rocketmq/client/impl/factory/MQClientInstance.java](https://codecov.io/gh/apache/rocketmq/pull/4862/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==) | `45.64% <0.00%> (-1.39%)` | :arrow_down: |
   | ... and [20 more](https://codecov.io/gh/apache/rocketmq/pull/4862/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) | |
   
   :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: dev-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] mxsm commented on a diff in pull request #4862: [ISSUE #4857] Fix broker can't auto register to controller again

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #4862:
URL: https://github.com/apache/rocketmq/pull/4862#discussion_r950964112


##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -347,6 +351,12 @@ private void schedulingSyncBrokerMetadata() {
                 }
             } catch (final Exception e) {
                 LOGGER.warn("Error happen when get broker {}'s metadata", this.brokerConfig.getBrokerName(), e);
+                if (e instanceof MQBrokerException) {
+                    int code = ((MQBrokerException) e).getResponseCode();
+                    if (code == CONTROLLER_INVALID_REQUEST || code == CONTROLLER_NOT_LEADER) {

Review Comment:
   I will adding a new response code to indicate this situation.  and ReplicasInfoManager method to process different request code, if nothing to do will return ResponseCode.CONTROLLER_INVALID_REQUEST code. I think different handle should return coding related to processing. I will submit a PR to deal with in the future.



-- 
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] ShannonDing commented on a diff in pull request #4862: [ISSUE #4857] Fix broker can't auto register to controller again

Posted by GitBox <gi...@apache.org>.
ShannonDing commented on code in PR #4862:
URL: https://github.com/apache/rocketmq/pull/4862#discussion_r952117213


##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -347,6 +351,12 @@ private void schedulingSyncBrokerMetadata() {
                 }
             } catch (final Exception e) {
                 LOGGER.warn("Error happen when get broker {}'s metadata", this.brokerConfig.getBrokerName(), e);
+                if (e instanceof MQBrokerException) {
+                    int code = ((MQBrokerException) e).getResponseCode();
+                    if (code == CONTROLLER_INVALID_GETREPLICAINFO) {
+                        registerBrokerToController();

Review Comment:
   how about try to register again after a while?



-- 
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] mxsm commented on a diff in pull request #4862: [ISSUE #4857] Fix broker can't auto register to controller again

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #4862:
URL: https://github.com/apache/rocketmq/pull/4862#discussion_r952050042


##########
controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:
##########
@@ -288,7 +288,7 @@ public ControllerResult<GetReplicaInfoResponseHeader> getReplicaInfo(final GetRe
             result.setBody(new SyncStateSet(syncStateInfo.getSyncStateSet(), syncStateInfo.getSyncStateSetEpoch()).encode());
             return result;
         }
-        result.setCodeAndRemark(ResponseCode.CONTROLLER_INVALID_REQUEST, "Broker metadata is not existed");
+        result.setCodeAndRemark(ResponseCode.CONTROLLER_INVALID_GETREPLICAINFO, "Broker metadata is not existed");

Review Comment:
   Good idea



-- 
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 #4862: [ISSUE #4857] Fix broker can't auto register to controller again

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

   
   [![Coverage Status](https://coveralls.io/builds/51819472/badge)](https://coveralls.io/builds/51819472)
   
   Coverage decreased (-0.1%) to 48.938% when pulling **cb56316e1a8ce6608cbccba9fa832074e750cea8 on mxsm:rocketmq-4857** into **96fd4f52e09536e2e8487c701cc7846b0529b04e on apache:develop**.
   


-- 
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] mxsm commented on a diff in pull request #4862: [ISSUE #4857] Fix broker can't auto register to controller again

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #4862:
URL: https://github.com/apache/rocketmq/pull/4862#discussion_r953451881


##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -347,6 +351,17 @@ private void schedulingSyncBrokerMetadata() {
                 }
             } catch (final Exception e) {
                 LOGGER.warn("Error happen when get broker {}'s metadata", this.brokerConfig.getBrokerName(), e);
+                if (e instanceof MQBrokerException) {
+                    int code = ((MQBrokerException) e).getResponseCode();
+                    if (code == CONTROLLER_BROKER_METADATA_NOT_EXIST) {
+                        try {
+                            registerBrokerToController();
+                            TimeUnit.SECONDS.sleep(2);
+                        } catch (InterruptedException ignore) {
+
+                        }
+                    }
+                }

Review Comment:
   yes I will do this



-- 
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] hzh0425 commented on a diff in pull request #4862: [ISSUE #4857] Fix broker can't auto register to controller again

Posted by GitBox <gi...@apache.org>.
hzh0425 commented on code in PR #4862:
URL: https://github.com/apache/rocketmq/pull/4862#discussion_r950946164


##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -347,6 +351,12 @@ private void schedulingSyncBrokerMetadata() {
                 }
             } catch (final Exception e) {
                 LOGGER.warn("Error happen when get broker {}'s metadata", this.brokerConfig.getBrokerName(), e);
+                if (e instanceof MQBrokerException) {
+                    int code = ((MQBrokerException) e).getResponseCode();
+                    if (code == CONTROLLER_INVALID_REQUEST || code == CONTROLLER_NOT_LEADER) {

Review Comment:
   I think you are right



-- 
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] RongtongJin commented on a diff in pull request #4862: [ISSUE #4857] Fix broker can't auto register to controller again

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on code in PR #4862:
URL: https://github.com/apache/rocketmq/pull/4862#discussion_r953391626


##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -347,6 +351,17 @@ private void schedulingSyncBrokerMetadata() {
                 }
             } catch (final Exception e) {
                 LOGGER.warn("Error happen when get broker {}'s metadata", this.brokerConfig.getBrokerName(), e);
+                if (e instanceof MQBrokerException) {
+                    int code = ((MQBrokerException) e).getResponseCode();
+                    if (code == CONTROLLER_BROKER_METADATA_NOT_EXIST) {
+                        try {
+                            registerBrokerToController();
+                            TimeUnit.SECONDS.sleep(2);
+                        } catch (InterruptedException ignore) {
+
+                        }
+                    }
+                }

Review Comment:
   How about catching  MQBrokerException before Exception? In addition, could you rebase or merge the latest develop branch to this pull request? We add new rules for merging



-- 
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] mxsm commented on a diff in pull request #4862: [ISSUE #4857] Fix broker can't auto register to controller again

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #4862:
URL: https://github.com/apache/rocketmq/pull/4862#discussion_r950964437


##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -347,6 +351,12 @@ private void schedulingSyncBrokerMetadata() {
                 }
             } catch (final Exception e) {
                 LOGGER.warn("Error happen when get broker {}'s metadata", this.brokerConfig.getBrokerName(), e);
+                if (e instanceof MQBrokerException) {
+                    int code = ((MQBrokerException) e).getResponseCode();
+                    if (code == CONTROLLER_INVALID_REQUEST || code == CONTROLLER_NOT_LEADER) {

Review Comment:
   > if code == CONTROLLER_NOT_LEADER, we don't need to do anything.
   
   OK, I got 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: dev-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] RongtongJin commented on a diff in pull request #4862: [ISSUE #4857] Fix broker can't auto register to controller again

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on code in PR #4862:
URL: https://github.com/apache/rocketmq/pull/4862#discussion_r952044269


##########
controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:
##########
@@ -288,7 +288,7 @@ public ControllerResult<GetReplicaInfoResponseHeader> getReplicaInfo(final GetRe
             result.setBody(new SyncStateSet(syncStateInfo.getSyncStateSet(), syncStateInfo.getSyncStateSetEpoch()).encode());
             return result;
         }
-        result.setCodeAndRemark(ResponseCode.CONTROLLER_INVALID_REQUEST, "Broker metadata is not existed");
+        result.setCodeAndRemark(ResponseCode.CONTROLLER_INVALID_GETREPLICAINFO, "Broker metadata is not existed");

Review Comment:
   How about CONTROLLER_BROKER_MEATA_NOT_EXIST?



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