You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2022/12/01 13:27:28 UTC

[GitHub] [ratis] szetszwo commented on a diff in pull request #794: RATIS-1744. NullPointerException causes RaftClient retry failure.

szetszwo commented on code in PR #794:
URL: https://github.com/apache/ratis/pull/794#discussion_r1037106723


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java:
##########
@@ -921,11 +921,11 @@ ReadRequests getReadRequests() {
   }
 
   private CompletableFuture<ReadIndexReplyProto> sendReadIndexAsync() {
-    if (getInfo().getLeaderId() == null) {
-      JavaUtils.completeExceptionally(generateNotLeaderException());
+    final RaftPeerId leaderId = getInfo().getLeaderId();
+    if (leaderId == null) {
+      return JavaUtils.completeExceptionally(generateNotLeaderException());

Review Comment:
   You are right that NotLeaderException is incorrect -- this server could be a follower and don't know who is the leader.  It should not return NotLeaderException in such case.



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

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

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