raft: introduce split vote detection
Split vote is a situation when during election nobody can win and will not win in this term for sure. Not a single node could get enough votes. For example, with 4 nodes one could get 2 votes and other also 2 votes. Nobody will get quorum 3 in this term. The patch makes raft able to notice that situation and speed up the term bump. It is not bumped immediately though, because nodes might do that simultaneously and will get the split vote again after voting for self. There is a random delay. But it is just max 10% of election timeout, so it should speed up split vote resolution on 90% at least. Part of #5285
Showing
- src/lib/raft/raft.c 122 additions, 4 deletionssrc/lib/raft/raft.c
- src/lib/raft/raft.h 10 additions, 0 deletionssrc/lib/raft/raft.h
- test/unit/raft.c 300 additions, 1 deletiontest/unit/raft.c
- test/unit/raft.result 63 additions, 1 deletiontest/unit/raft.result
- test/unit/raft_test_utils.c 12 additions, 0 deletionstest/unit/raft_test_utils.c
- test/unit/raft_test_utils.h 5 additions, 0 deletionstest/unit/raft_test_utils.h
Loading
Please register or sign in to comment