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 12:20:50 UTC

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

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


##########
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:
   Recently I discovered the `NotLeaderException` will be handled by `RaftClient` automatically and count one retry attempt. Shall we change the exception here to `ReadIndexException("not leader")` ?



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