You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/07/14 06:20:57 UTC

[GitHub] [incubator-ratis] GlenGeng commented on a change in pull request #150: RATIS-981: Step-down stale leader in case of split-brain

GlenGeng commented on a change in pull request #150:
URL: https://github.com/apache/incubator-ratis/pull/150#discussion_r454128140



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/impl/PeerConfiguration.java
##########
@@ -90,11 +90,8 @@ boolean hasMajority(Collection<RaftPeerId> others, RaftPeerId selfId) {
       if (contains(other)) {
         num++;
       }
-      if (num > size() / 2) {
-        return true;
-      }
     }
-    return false;
+    return num > size() / 2;

Review comment:
       After this change, it can handle single-server cluster.
   Previous one can not handle such case, since its `others` is empty.




----------------------------------------------------------------
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.

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