runzhiwang commented on a change in pull request #241:
URL: https://github.com/apache/incubator-ratis/pull/241#discussion_r517024988



##########
File path: 
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftConfiguration.java
##########
@@ -206,6 +206,12 @@ boolean hasMajority(Collection<RaftPeerId> others, 
RaftPeerId selfId) {
         (oldConf == null || oldConf.hasMajority(others, selfId));
   }
 
+  /** @return true if the rejects are in the half(impossible for others in 
majority). */
+  boolean majorityImpossibleWithout(Collection<RaftPeerId> rejects) {
+    return conf.majorityImpossibleWithout(rejects) &&
+            (oldConf == null || oldConf.majorityImpossibleWithout(rejects));
+  }

Review comment:
       I think this check it not totally reverse  of hasMajority.  The reverse 
of hasMajority is `!conf.hasMajority(others, selfId) || !(oldConf == null || 
oldConf.hasMajority(others, selfId))` i.e.` !conf.hasMajority(others, selfId) 
|| (oldConf != null && !oldConf.hasMajority(others, selfId))``. i.e. ` 
conf.majorityImpossibleWithout(rejects) || (oldConf != null && 
!oldConf.majorityImpossibleWithout(rejects))``




----------------------------------------------------------------
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:
[email protected]


Reply via email to