You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by ji...@apache.org on 2022/08/30 00:43:13 UTC
[rocketmq] branch develop updated: [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader (#4918)
This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 6a8b1aa96 [ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader (#4918)
6a8b1aa96 is described below
commit 6a8b1aa96b8997a185616c0cbe05e1663bc5fd88
Author: TheR1sing3un <87...@users.noreply.github.com>
AuthorDate: Tue Aug 30 08:43:03 2022 +0800
[ISSUE#4917] Optimize the retry logic in appending a no-op request when controller change to leader (#4918)
---
.../apache/rocketmq/controller/impl/DLedgerController.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java b/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java
index 1e34aad97..3a00dec73 100644
--- a/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java
+++ b/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java
@@ -440,10 +440,16 @@ public class DLedgerController implements Controller {
}
} catch (final Throwable e) {
log.error("Error happen when controller leader append initial request to dledger", e);
- tryTimes++;
- if (tryTimes % 3 == 0) {
- log.warn("Controller leader append initial log failed too many times, please wait a while");
- }
+ }
+ if (!DLedgerController.this.getMemberState().isLeader()) {
+ // now is not a leader
+ log.error("Append a initial log failed because current state is not leader");
+ break;
+ }
+ tryTimes++;
+ log.error(String.format("Controller leader append initial log failed, try %d times", tryTimes));
+ if (tryTimes % 3 == 0) {
+ log.warn("Controller leader append initial log failed too many times, please wait a while");
}
}
break;