szetszwo commented on PR #1362:
URL: https://github.com/apache/ratis/pull/1362#issuecomment-3981401024

   Regarding to [this 
problem](https://github.com/apache/ratis/pull/1362#discussion_r2870030074), one 
way to fix the bug is to hold also the read replies -- when a server's (leader 
or follower) appliedIndex > leader's repliedIndex, hold the read replies until 
leader's repliedIndex >= the local appliedIndex.  The previous example becomes:
   
   1. Leader: repliedIndex = 10 < appliedIndex = 20
   2. F1: repliedIndex = 10, appliedIndex = 18
   3. F2: repliedIndex = 10, appliedIndex = 14
   4. Client first reads from F1 but F1 holds the reply.
   5. The same client reads from F2 but F2 holds the reply.
   6. Leader, F1 and F2 update their repliedIndex to 20
   7. Client receive a reply from F1 (appliedIndex = 18)
   8. Client receive a reply from F2 (appliedIndex = 14)
   
   Note that Step 8 is not a stale read since the two reads can be considered 
as being sent in parallel and the read from F2 is faster than the read from F1.
   
   @ivandika3 , what do you think?


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