-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cb_func is not triggered when cluster leader disappears #268
Comments
@faithware Line 995 in 789cc75
But that does not mean the event is fired as soon as the old leader goes down, since it will take some time to elect new leader according to the election timer. |
Thanks !@greensky00
The thing is the cluster I made is a two element cluster, when it is 3 element, this does not happen and one of the remaining two elements becomes a leader. |
If there are 2 members in a cluster, the other member can't be a leader as you observed, because it cannot reach the consensus (quorum size is 2 for a 2-member cluster). If you want to force the member become a leader, you can adjust the quorum size manually: There is also an option to adjust the quorum size automatically for a 2-member cluster. You can set this option to NuRaft/include/libnuraft/raft_params.hxx Lines 497 to 502 in 789cc75
|
Tested with quick_start.cxx example.
When a cluster leader is elected, the event nuraft::cb_func::Type::BecomeLeader is triggered on the leader and the event nuraft::cb_func::Type::BecomeFollower is triggered on the followers.
When the leader goes down, the new leader doesn't trigger BecomeLeader event.
Is this normal?
Cheers
The text was updated successfully, but these errors were encountered: