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/22 01:14:54 UTC

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

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