diff --git a/README.md b/README.md index d567ea0..08112db 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This repo is a list of distributed consensus protocol's bugs, flaws, deceptive t - [Paxos: (Optimize): Asymmetric Acceptors](src/list/asymmetric-paxos/asymmetric-paxos.md) | 🌎 [中文版](src/list/asymmetric-paxos/asymmetric-paxos.cn.md) - [Paxos/Raft: (Generalize): Round Number Reversion](src/list/paxos-revert-rnd/paxos-revert-rnd.md) | 🌎 [中文版](src/list/paxos-revert-rnd/paxos-revert-rnd.cn.md) - [Paxos: (Generalize): Partial Order Round Number = Paxos + 2PC](src/list/paxos-partial-order-rnd/paxos-partial-order-rnd.md) | 🌎 [中文版](src/list/paxos-partial-order-rnd/paxos-partial-order-rnd.cn.md) -- [Raft: (Suboptimal): Leader Step Down](src/list/raft-leader-step-down/raft-leader-step-down.md) +- [Raft: (Suboptimal): Leader Step Down](src/list/raft-leader-step-down/raft-leader-step-down.md) | 🌎 [中文版](src/list/raft-leader-step-down/raft-leader-step-down.cn.md) - [Raft: (Optimize): ReadIndex: Less Wait](src/list/raft-read-index/raft-read-index.md) | 🌎 [中文版](src/list/raft-read-index/raft-read-index.cn.md) diff --git a/src/list/raft-leader-step-down/raft-leader-step-down.cn.md b/src/list/raft-leader-step-down/raft-leader-step-down.cn.md new file mode 100644 index 0000000..9cf41cf --- /dev/null +++ b/src/list/raft-leader-step-down/raft-leader-step-down.cn.md @@ -0,0 +1,33 @@ +## Raft: (Suboptimal): Leader Step Down + +> 在raft论文中: +> 6. Cluster membership changes +> +> 第二个问题是集群 Leader 可能不在新配置中。 +> 在这种情况下,一旦 Leader 提交了 $C_{new}$ 日志条目,它就会退位(返回到追随者状态)。 +> +> ![](raft-leader-step-down-std.jpeg) + +但是 Leader **不必** 立刻放弃领导权: + +尽管它 **不应该**为其他 Candidate 投票,一个 Learner (也称为 Non-voter,从集群配置中移除的节点)仍然可以保持 Leader 地位(或成为 Candidate ),只要它愿意。这种不投票的 Leader : + +- 与正常 Leader 一样处理写操作,除了本地日志存储不计入 quorum。 +- 与正常 Leader 一样处理读操作。 + +**注意**: Learner (Non-voter)也不必拒绝来自其他节点的投票请求。 +因为raft确保使用倒数第二个已提交配置的 Candidate 永远不会成为 Leader 。Thanks to [Gao Xinge](https://www.zhihu.com/people/gao-xinge). + +![](raft-leader-step-down-optimize.jpeg) + +### 改进 + +当 Leader 提交 $C_{new}$ 时,它 **不会** 放弃 leadership,但会继续作为 Leader 服务。 + +通过这种方式,membership config 日志不需要被实现特别处理。只有在需要时才会移除(non-voting) Leader : +通过关闭非投票 Leader 或通知其将领导权转移给另一个节点。 + + +**参考文献**: + +- [Raft consensus algorithm](https://raft.github.io/) diff --git a/src/list/raft-leader-step-down/raft-leader-step-down.md b/src/list/raft-leader-step-down/raft-leader-step-down.md index 8a66646..29e1f53 100644 --- a/src/list/raft-leader-step-down/raft-leader-step-down.md +++ b/src/list/raft-leader-step-down/raft-leader-step-down.md @@ -23,7 +23,7 @@ would never become the leader. Thanks to [Gao Xinge](https://www.zhihu.com/peopl ![](raft-leader-step-down-optimize.jpeg) -#### Improvement +### Improvement When a leader commits $C_{new}$, it does **NOT** give up leadership, but just keep serving as leader.