Raft 一些要点 #142
AlexStocks
started this conversation in
General
Raft 一些要点
#142
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment








Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Raft 一些要点:
ReadIndex
这个步骤,是为了确保 raft leader election 成功后,第一个 op 是个 write 操作,从而确保它的 log 复制到大多数 replica 上。write 操作确保 leader 的 log 被大多数 replica 复制到,然后各个 replica 自己 replay,从而确保 读数据的一致性。
服务端如何做幂等处理
如上,在 ApplyToStateMachine 的时候,判断这个 ID 是否被执行过:可以在 client 与 server 约定一个递增的可确保唯一的请求 ID,step3 一旦 server 检测到 ID 比当前最后成功执行的 ID 小,就直接返回成功;step2 server 端会给 client 返回“当前最后成功执行的 ID”,用于 client 端做幂等处理。
Beta Was this translation helpful? Give feedback.
All reactions