You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sh...@apache.org on 2020/06/22 04:07:17 UTC

[incubator-ratis] branch master updated: RATIS-983. Check follower state before ask for votes (#135)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4443f6d  RATIS-983. Check follower state before ask for votes (#135)
4443f6d is described below

commit 4443f6dec20da8e45da8e8223ad1bb2452b541ff
Author: runzhiwang <51...@users.noreply.github.com>
AuthorDate: Mon Jun 22 12:07:07 2020 +0800

    RATIS-983. Check follower state before ask for votes (#135)
---
 .../src/main/java/org/apache/ratis/server/impl/LeaderElection.java     | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderElection.java b/ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderElection.java
index cab775d..e0ab955 100644
--- a/ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderElection.java
+++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderElection.java
@@ -199,6 +199,9 @@ class LeaderElection implements Runnable {
       final long electionTerm;
       final RaftConfiguration conf;
       synchronized (server) {
+        if (!shouldRun()) {
+          break;
+        }
         electionTerm = state.initElection();
         conf = state.getRaftConf();
         state.persistMetadata();