You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by wi...@apache.org on 2023/03/31 01:26:49 UTC
[ratis] 01/02: RATIS-1822. Disable first election on changeToFollower (#863)
This is an automated email from the ASF dual-hosted git repository.
williamsong pushed a commit to branch branch-2_readIndex
in repository https://gitbox.apache.org/repos/asf/ratis.git
commit 2b373f6bc3c278da2994967250e985d83617009a
Author: William Song <48...@users.noreply.github.com>
AuthorDate: Tue Mar 28 21:21:29 2023 +0800
RATIS-1822. Disable first election on changeToFollower (#863)
---
.../src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
index 5ecbc36d4..128900fb5 100644
--- a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
+++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
@@ -545,6 +545,7 @@ class RaftServerImpl implements RaftServer.Division,
role.shutdownFollowerState();
}
role.startFollowerState(this, reason);
+ firstElectionSinceStartup.set(false);
}
return metadataUpdated;
}
@@ -1851,7 +1852,6 @@ class RaftServerImpl implements RaftServer.Division,
}
void onGroupLeaderElected() {
- this.firstElectionSinceStartup.set(false);
transferLeadership.complete(TransferLeadership.Result.SUCCESS);
}
}