V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
JasonLaw
V2EX  ›  程序员

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

  •  
  •   JasonLaw · 2021-10-28 17:55:06 +08:00 · 1549 次点击
    这是一个创建于 903 天前的主题,其中的信息可能已经有所发展或是发生改变。

    6 条回复    2021-10-29 09:00:54 +08:00
    wqlin
        1
    wqlin  
       2021-10-28 18:48:44 +08:00
    leader 用于统计 commit index ,如果超哥半数的节点的 matchIndex 都 >= N ,那么就可以把 commit index 更新到 N 了
    JasonLaw
        2
    JasonLaw  
    OP
       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
        3
    realrojeralone  
       2021-10-28 20:22:41 +08:00
    @JasonLaw 我认为是的
    JasonLaw
        4
    JasonLaw  
    OP
       2021-10-28 20:36:57 +08:00
    @realrojeralone #3 如果是这样的话,那么#1 所说的就是错误的了。在(c)中,S1 的 matchIndex[]会是[2, 2, 1, 1],但是 commitIndex 并不会是 2 。

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

    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5290 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 01:26 · PVG 09:26 · LAX 18:26 · JFK 21:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.