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/11/30 18:44:13 UTC

[GitHub] [ratis] szetszwo opened a new pull request, #794: RATIS-1744. NullPointerException causes RaftClient retry failure.

szetszwo opened a new pull request, #794:
URL: https://github.com/apache/ratis/pull/794

   See https://issues.apache.org/jira/browse/RATIS-1744


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


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

Posted by GitBox <gi...@apache.org>.
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


[GitHub] [ratis] codings-dan merged pull request #794: RATIS-1744. NullPointerException causes RaftClient retry failure.

Posted by GitBox <gi...@apache.org>.
codings-dan merged PR #794:
URL: https://github.com/apache/ratis/pull/794


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


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

Posted by GitBox <gi...@apache.org>.
szetszwo commented on PR #794:
URL: https://github.com/apache/ratis/pull/794#issuecomment-1336471275

   @codings-dan , thanks a lot for reviewing and merging this!


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


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

Posted by GitBox <gi...@apache.org>.
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