Replies: 2 comments 5 replies
-
Blocking read and write on client side can ensure the order. But I'm still wondering what kind of read/write concurrency we can do. Also, blocking read and write doesn't seems need "ReadIndex" at all. |
Beta Was this translation helpful? Give feedback.
-
raft-rs only guarantees ReadIndex can read the latest data that it has told client successfully processed. In theory, no system can guarantee the order without extra synchronization. For example, the previous create request can be delay by network, and client has no idea when the request reaches the server and it's totally OK that the create is out of order with the following read index request. On the other hand, using committed index is good for latency. In most cases, when the read index is returned, the index is probably already applied. |
Beta Was this translation helpful? Give feedback.
-
Ref - https://github.com/tisonkun/mephisto
I'm trying to understand this crate by creating a simple DataTree storage system (as linked above).
By implementing the basic PUT/GET (Create/GetData) methods, I'm expecting the following requests get linearizable results:
The raftstore example exactly performs these actions.
I implement it with
MsgPropose
for every "Create" request, and issue aMsgReadIndex
for every "GetData" request. But it seems that the read index returns the index just when it's issued instead of after the former proposal committed.Now, since the "Create" requests go with Raft append entries, it returns properly. But "GetData" can return previous data:
I don't know how we can implement read-after-write without inserting "GetData" request with
MsgPropose
.I read this post but am still unclear what to do.
cc @BusyJay
Beta Was this translation helpful? Give feedback.
All reactions