抛出原论文:
Raft uses the voting process to prevent a candidate from winning an election unless its log contains all committed entries. A candidate must contact a majority of the cluster in order to be elected, which means that every committed entry must be present in at least one of those servers. If the candidate ’ s log is at least as up-to-date as any other log in that majority (where “ up-to-date ” is defined precisely below), then it will hold all the committed entries... 这是说,leader 必须包含所有已提交的日志,那么选择时候选节点必须是 up-to-date 的。
Raft determines which of two logs is more up-to-date by comparing the index and term of the last entries in the logs. If the logs have last entries with different terms, then the log with the later term is more up-to-date. If the logs end with the same term, then whichever log is longer is more up-to-date. 这是说,判断 up-to-date 的标准是,term 号越大越新; term 号一致则日志越长越新。
我想问下,满足这个 up-to-date 标准,为什么该候选节点就包含了所有的已提交日志了?