• 请不要在回答技术问题时复制粘贴 AI 生成的内容
JasonLaw
V2EX  ›  程序员

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

  •  
  •   JasonLaw · Oct 28, 2021 · 2658 views
    This topic created in 1662 days ago, the information mentioned may be changed or developed.

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

    edgar
        5
    edgar  
       Oct 28, 2021
    @JasonLaw 可以看看图里 “Rules for Servers” 里 leader 部分的最后一句。
    JasonLaw
        6
    JasonLaw  
    OP
       Oct 29, 2021
    @edgar #5 理解了,THX

    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3030 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 12:02 · PVG 20:02 · LAX 05:02 · JFK 08:02
    ♥ Do have faith in what you're doing.