ivandika3 commented on code in PR #1444:
URL: https://github.com/apache/ratis/pull/1444#discussion_r3238969148


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java:
##########
@@ -1146,7 +1145,8 @@ private CompletableFuture<RaftClientReply> 
readAsync(RaftClientRequest request)
       }
 
       return replyFuture
-          .thenCompose(readIndex -> getReadRequests().waitToAdvance(readIndex))
+          .thenCompose(readIndex -> 
getState().getReadRequests().waitToAdvance(readIndex,
+              
snapshotInstallationHandler::getInProgressInstallSnapshotReadException))

Review Comment:
   Thanks for the review. Updated, but there might be a small chance of 
interleaving here since the snapshot checking is not protected by ReadRequests 
object lock.
   
   1. waitReadIndex() checks snapshot state and sees no snapshot.
   1. Snapshot notification sets inProgressInstallSnapshotIndex.
   1. Snapshot notification calls ReadRequests.fail() and clears the current 
queue.
   1. Read then enqueues itself in ReadRequests.waitToAdvance() after the 
failure sweep.
   
   We can probably synchronized on RaftServerImpl lock, but I'm afraid this 
might increase follower read contention.



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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to