RongtongJin commented on code in PR #4918:
URL: https://github.com/apache/rocketmq/pull/4918#discussion_r957275150
##########
controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:
##########
@@ -432,6 +432,16 @@ public void handle(long term, MemberState.Role role) {
DLedgerController.this.startScheduling();
break;
}
+ if
(!DLedgerController.this.getMemberState().isLeader()) {
+ // now is not a leader
+ log.error("Append a initial log failed
because current state is not leader");
+ break;
+ }
+ log.error("Controller leader append initial
log failed, try again");
+ tryTimes++;
+ if (tryTimes % 3 == 0) {
+ log.warn("Controller leader append initial
log failed too many times, please wait a while");
+ }
} catch (final Throwable e) {
log.error("Error happen when controller leader
append initial request to dledger", e);
tryTimes++;
Review Comment:
If an exception is thrown, do we need to determine whether it is a leader?
--
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]