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.92k stars 876 forks source link

election timeout should be randomized again if campaign fails #464

Closed BusyJay closed 1 month ago

BusyJay commented 1 month ago

I can see the timeout is randomized at the beginning. It's possible two nodes have the same election timeout after being randomized and lead to split vote. If election timeout remains the same, there is no way to get out of the situation.

BusyJay commented 1 month ago

Turns out it's adjusted in timer.