RongtongJin commented on code in PR #4918:
URL: https://github.com/apache/rocketmq/pull/4918#discussion_r957291783


##########
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:
   > Yep~ Maybe we can check the state once the appending is 
failed(appendToDLedfer return false or appendToDLedger AndWait throws an 
exception)
   
   How about creating a function to deal with 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to