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.99k
stars
886
forks
source link
_leader_lease should also be considered when handling vote #463
Currently only _follower_lease is considered, and leader will never update _follower_lease, so _follower_lease will always expire on leader side. If a follower starts election in an idle group, leader will vote for follower even the leader lease is still valid. Leader will call step_down to invalidate _leader_lease before vote, so there seems to be no correctness problem. But if a follower is isolated for a while and then return, it's likely to cause leadership change and lead to latency jitter on the client side.
Currently only
_follower_lease
is considered, and leader will never update_follower_lease
, so_follower_lease
will always expire on leader side. If a follower starts election in an idle group, leader will vote for follower even the leader lease is still valid. Leader will callstep_down
to invalidate_leader_lease
before vote, so there seems to be no correctness problem. But if a follower is isolated for a while and then return, it's likely to cause leadership change and lead to latency jitter on the client side.