Raft Consensus Algorithm - matchIndex[]的作用是什么?

2021-10-28 17:55:06 +08:00
 JasonLaw

1616 次点击
所在节点    程序员
6 条回复
wqlin
2021-10-28 18:48:44 +08:00
leader 用于统计 commit index ,如果超哥半数的节点的 matchIndex 都 >= N ,那么就可以把 commit index 更新到 N 了
JasonLaw
2021-10-28 19:51:51 +08:00
@wqlin #1 我还是不太理解“for each server, index of highest log entry known to be replicated on server”。

对于下面的 Figure 7 来说,matchIndex[]会是什么?会是[9, 4, 10, 10, 5, 3]吗?

realrojeralone
2021-10-28 20:22:41 +08:00
@JasonLaw 我认为是的
JasonLaw
2021-10-28 20:36:57 +08:00
@realrojeralone #3 如果是这样的话,那么#1 所说的就是错误的了。在(c)中,S1 的 matchIndex[]会是[2, 2, 1, 1],但是 commitIndex 并不会是 2 。

edgar
2021-10-28 23:14:03 +08:00
@JasonLaw 可以看看图里 “Rules for Servers” 里 leader 部分的最后一句。
JasonLaw
2021-10-29 09:00:54 +08:00
@edgar #5 理解了,THX

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/811322

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX