Open dragonylffly opened 3 years ago
@PFZheng
这个机制看着和 witness 是一回事情,实现得有一些问题:
MongoDB 实现的不是标准 Raft,有一些设计不能原样照搬
The current implementation seems to be the simplest way with minimum modification to braft to support two data copies, and it covers most situations. The only situation is when leader down, and the length of candidate's log is shorter than that of arbiter. In this case, the cluster will not have a leader elected. However, such situation (leader down and candidate lost data simultaneously) should rarely happen. In this case, the cluster manager needs to choose between consistency and availability. If consistency is preferred, the cluster needs to wait for original leader to restart. If availability, the manager could enable candidate elected by removing arbiter from the cluster, which can be automatically done by a script. If arbiter is allowed to be elected as leader (temporarily), careful and tricky modification to braft are needed, which will be error prone. In addtion, since arbiter does not have snapshot (otherwise against two data copies premise). The situation it can improve is only limited to that the data lost by candidate is covered in the arbiter log
@PFZheng
@PFZheng witness特性有合入计划吗
这个有进展么
This commit implements raft arbiter. An arbiter does not have a copy of data and only participates in elections. The concept is similar to MongoDB arbiter (https://docs.mongodb.com/manual/core/replica-set-arbiter). The motivation behind is for some cost-sensitive circumstances, three copies are not affordable, but an odd number of votes are needed to break a tie