Skip to content

Commit

Permalink
Fix inconsistency for below var names (#76)
Browse files Browse the repository at this point in the history
1. prevLogIndex

  2. prevLogTerm
  • Loading branch information
ityuhui committed Feb 7, 2021
1 parent 476d559 commit 738f50b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions raft-zh_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ Raft 通过选举一个高贵的领导人,然后给予他全部的管理复制
| 返回值 | 解释 |
| --- | --- |
| term | 当前任期,对于领导者而言 它会更新自己的任期 |
| success | 结果为真 如果跟随者所含有的条目和preLogIndex以及preLogTerm匹配上了 |
| success | 结果为真 如果跟随者所含有的条目和prevLogIndex以及prevLogTerm匹配上了 |

接收者的实现:

1. 返回假 如果领导者的任期 小于 接收者的当前任期(译者注:这里的接收者是指跟随者或者候选者)(5.1 节)
2. 返回假 如果接收者日志中没有包含这样一个条目 即该条目的任期在preLogIndex上能和prevLogTerm匹配上
(译者注:在接收者日志中 如果能找到一个和preLogIndex以及prevLogTerm一样的索引和任期的日志条目 则返回真 否则返回假)(5.3 节)
2. 返回假 如果接收者日志中没有包含这样一个条目 即该条目的任期在prevLogIndex上能和prevLogTerm匹配上
(译者注:在接收者日志中 如果能找到一个和prevLogIndex以及prevLogTerm一样的索引和任期的日志条目 则返回真 否则返回假)(5.3 节)
3. 如果一个已经存在的条目和新条目(译者注:即刚刚接收到的日志条目)发生了冲突(因为索引相同,任期不同),那么就删除这个已经存在的条目以及它之后的所有条目 (5.3 节)
4. 追加日志中尚未存在的任何新条目
5. 如果领导者的已知已经提交的最高的日志条目的索引 大于 接收者的已知已经提交的最高的日志条目的索引
Expand Down

0 comments on commit 738f50b

Please sign in to comment.