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

   ## What changes were proposed in this pull request?
   
   When `raft.server.read.option` uses `REPLIED_INDEX`, `ReplyFlusher` holds 
write reply callbacks and advances the leader replied index in batches. The old 
flow invoked reply callbacks while computing the max flushed log index, so a 
client could receive a successful write reply before `repliedIndex` covered 
that write.
   
   This PR stores the log index separately from the reply callback, advances 
`repliedIndex` first, and only then completes the held write replies. It also 
makes `LeaderTracer.removePendingRequest` tolerate a null pending request for 
cached-reply paths.
   
   ## Why are the changes needed?
   
   A read-after-write workload can issue a linearizable read immediately after 
receiving a successful write reply. With `REPLIED_INDEX`, that read depends on 
the leader replied index. Completing the write reply before advancing 
`repliedIndex` creates a race where the read can wait unnecessarily or time out 
even though the write reply was already released.
   
   ## How was this patch tested?
   
   `mvn -pl ratis-server,ratis-test -am 
-Dtest=TestReplyFlusher,TestLinearizableReadRepliedIndexWithGrpc test`


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