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/04/27 10:45:25 UTC

[GitHub] [incubator-ratis] lokeshj1703 commented on a change in pull request #65: RATIS-881. Fix Failed unit test because test before MiniRaftCluster ready

lokeshj1703 commented on a change in pull request #65:
URL: https://github.com/apache/incubator-ratis/pull/65#discussion_r415703916



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -460,6 +460,20 @@ public String toString() {
     return null;
   }
 
+  @VisibleForTesting
+  public boolean isLeaderReady() {
+    if (!isLeader()) {
+      return false;
+    }
+
+    final LeaderState leaderState = role.getLeaderState().orElse(null);
+    if (leaderState == null || !leaderState.isReady()) {
+      return false;
+    }
+
+    return true;

Review comment:
       We can simplify this as.
   `return leaderState != null && leaderState.isReady();`

##########
File path: ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -460,6 +460,20 @@ public String toString() {
     return null;
   }
 
+  @VisibleForTesting
+  public boolean isLeaderReady() {
+    if (!isLeader()) {

Review comment:
       We can remove this check as leaderState == null covers the case and use this function in checkLeaderState line 451 as well.




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