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/29 12:41:58 UTC

[GitHub] [rocketmq] RongtongJin commented on a diff in pull request #4918: [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader

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: dev-unsubscribe@rocketmq.apache.org

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