TheR1sing3un commented on code in PR #6100:
URL: https://github.com/apache/rocketmq/pull/6100#discussion_r1127721267
##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -148,8 +178,24 @@ private boolean startBasicService() {
}
if (this.state == State.FIRST_TIME_SYNC_CONTROLLER_METADATA_DONE) {
- if (registerBrokerToController()) {
- LOGGER.info("First time register broker success");
+ for (int retryTimes = 0; retryTimes < 5; retryTimes++) {
+ if (register()) {
+ LOGGER.info("First time register broker success");
+ this.state = State.REGISTER_TO_CONTROLLER_DONE;
+ break;
+ }
+ }
+ // register 5 times but still unsuccessful
+ if (this.state != State.REGISTER_TO_CONTROLLER_DONE) {
+ return false;
+ }
+ }
+
+ if (this.state == State.REGISTER_TO_CONTROLLER_DONE) {
+ // The scheduled task for heartbeat sending is not starting now,
so we should manually send heartbeat request
+ this.sendHeartbeatToController();
+ if (this.masterBrokerId != null || brokerElect()) {
+ LOGGER.info("Master in this broker set is elected");
Review Comment:
>
done~
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]