This is an automated email from the ASF dual-hosted git repository.

szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git


The following commit(s) were added to refs/heads/master by this push:
     new 4089b0e6e RATIS-1822. Disable first election on changeToFollower (#863)
4089b0e6e is described below

commit 4089b0e6e86ad600b81cc19378ee242e8db84ff0
Author: William Song <[email protected]>
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 9204faf68..4a65c3b80 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;
   }
@@ -1852,7 +1853,6 @@ class RaftServerImpl implements RaftServer.Division,
   }
 
   void onGroupLeaderElected() {
-    this.firstElectionSinceStartup.set(false);
     transferLeadership.complete(TransferLeadership.Result.SUCCESS);
   }
 }

Reply via email to