baidu / braft

An industrial-grade C++ implementation of RAFT consensus algorithm based on brpc, widely used inside Baidu to build highly-available distributed systems.
Apache License 2.0
3.86k stars 865 forks source link

BallotBox中的commit机制在成员变更期间疑似有bug #410

Closed cangfengzhs closed 1 year ago

cangfengzhs commented 1 year ago

假设我从Joint阶段推进到Stable阶段 old_conf{A, B, C} new_conf{D, E, F}

stable conf log 的Index=7

此时ABC三个node的lastIndex=5,并且leader获知了这一信息,BallotBox分别进行了commitAt(firstIndex, 5, A | B | C) 但是DEF三个node的lastIndex=10, 并且leader同样进行了commitAt(firstIndex, 10, D | E | F)

根据BallotBox中commit_at的逻辑,lastCommitIndex会被推进到10,因为Index=10的这个ballot中只有{D, E, F},但是Index=7这个stable conf log并没有被commit。old_conf并没有完成成员变更