What if readIndex is not checked with appliedIndex in read only requests.

66 views
Skip to first unread message

Unmesh Joshi

unread,
Dec 18, 2022, 1:40:48 AM12/18/22
to raft...@googlegroups.com
Assuming we have leader who is guaranteed to be the leader when serving read only requests (guaranteed with leader leader lease or just assume it's not going to be disconnected from other nodes)
What if, while handling the read only request, we directly read from the state machine without checking if lastapplied is at least same as commitIndex?    In a simple implementation, if commitIndex update and state machine apply is done atomically (naive implementation), then we are fine.
But what will be the case if a read only requests directly read from state machine, without doing this check?

Unmesh Joshi

unread,
Dec 19, 2022, 11:50:31 AM12/19/22
to raft...@googlegroups.com
To clarify, I am assuming a synchronous update to the state machine along with the commitIndex. The readIndex description in the raft thesis is generic and needed when state machine updates are asynchronous to commitIndex updates.  With asynchronous state machine updates, there is a window of uncertainty, where a later read request might see an older value if it is served by a newly elected leader, whose state machine has not yet applied the entry at the commitIndex.
Reply all
Reply to author
Forward
0 new messages