raft-rs中确认leader收到follower回复的代码段

tikv原理解读文章中提到过

对于 propose 过程而言,当 Leader 收到了足够的确认这一 Raft Log 的回复,便能够认为这一 Raft Log 已经被确认了,这一逻辑体现在 Raft::handle_append_response 之后的 Raft::maybe_commit 方法中。

“Leader 收到了足够的确认这一 Raft Log 的回复”意思就是收到majority的回复吗?在handle_append_response和maybe_commit里都没找到这部分代码段…

如果从其他渠道获得了答案,也可以更新在这里方便后面的人查阅。同时自己整理叙述一遍也是加深自己理解的好方法。

在slack上讨论过了。

progress_set.rs中有一个函数maximal_committed_index。maybe_commit 会call maximal_committed_index,用来确定当前log index是否已经replicated到大多数节点了。
maximal_committed_index是根据leader上保存的各节点progress来判断的。

另外leader更新progress的步骤可以参考这里:

学习学习