hashicorp/raft

linearizable read

Closed this issue · 4 comments

Does the library provide any linearizable read strategy?

Technically it does. Consul (which uses Raft) allows a "consistency mode" which makes use of linearized reads. Here's
how Consul does it
The request has to go through the leader, and the leader will do a read from in memory. Then it has to contact a quorum and ensure that it's still the leader. That guarantees the read isn't stale.

You can do this by having the leader call (raft *Raft) VerifyLeader().

Hope that helps! Please let me know if you have any more questions!

Another subtly: the leader has to get passed its write barrier: it has to have finished applying committed logs to it's FSM before it can proceed.