The read operation in the kvstore (i.e. kvstore-get command) can be processed in Followers without quorum round trips, which violates linearizability (e.g. reading stale values).
I further discovered that the develop branch has implemented the readindex protocol to guarantee linearizability for reads. But there is no explanation of the consistency levels in the doc, so few users can find the develop branch and users might assume the kvstore satisfy linearizability because it is based on Raft.
A possible fix
For a reference, Consul has three read modes: default (Leader processes reads without quorums), consistent (like the develop branch of Xraft-kvstore), stale (like the main branch).
In the Xraft's documentation/README, it would be better to explicitly clarify the consistency modes. Specifically, provide an explanation that the kvstore-get operation may read stale values, directing users seeking consistent reads to the develop branch. Additionally, considering the feasibility, Xraft can offer the default level, akin to Consul, for users seeking a balanced compromise between availability and consistency.
Thanks. You are right. The default mode for kvstore is to read without quorum guarantee. The develop branch implements the readindex so consistent read is offered. I'll update the README.
The read operation in the kvstore (i.e.
kvstore-get
command) can be processed in Followers without quorum round trips, which violates linearizability (e.g. reading stale values).https://github.com/xnnyygn/xraft/blob/dea670012bf470071a519c2e8ecc7a14642042f5/xraft-kvstore/src/main/java/in/xnnyygn/xraft/kvstore/server/Service.java#L95-L101
I further discovered that the
develop
branch has implemented the readindex protocol to guarantee linearizability for reads. But there is no explanation of the consistency levels in the doc, so few users can find thedevelop
branch and users might assume the kvstore satisfy linearizability because it is based on Raft.A possible fix
For a reference, Consul has three read modes:
default
(Leader processes reads without quorums),consistent
(like the develop branch of Xraft-kvstore),stale
(like the main branch).In the Xraft's documentation/README, it would be better to explicitly clarify the consistency modes. Specifically, provide an explanation that the
kvstore-get
operation may readstale
values, directing users seekingconsistent
reads to the develop branch. Additionally, considering the feasibility, Xraft can offer thedefault
level, akin to Consul, for users seeking a balanced compromise between availability and consistency.