raft: do not rely on just ev_is_active for timers
When timer has 0 timeout and 0 repeat, during timers preparation libev makes them inactive right away but puts into the array of pending events. Therefore to check if a timer is really active (will be executed in the future) need to look both at ev_is_active() and ev_is_pending(). It could happen only during split-vote, because all the other places use election_timeout + random shift, while split vote uses just random shift - it can be 0. The patch makes raft do that for all timer checks. Also to make the testing reliable and not depend on random the shift factor now is configurable. For the test it is set to 0. Closes #6847 NO_DOC=Bugfix NO_CHANGELOG=Bug was not released
Showing
- src/lib/fakesys/fakeev.c 13 additions, 2 deletionssrc/lib/fakesys/fakeev.c
- src/lib/raft/raft.c 16 additions, 17 deletionssrc/lib/raft/raft.c
- src/lib/raft/raft.h 9 additions, 0 deletionssrc/lib/raft/raft.h
- src/lib/raft/raft_ev.h 5 additions, 0 deletionssrc/lib/raft/raft_ev.h
- test/unit/raft.c 32 additions, 1 deletiontest/unit/raft.c
- test/unit/raft.result 7 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 4 additions, 0 deletionstest/unit/raft_test_utils.h
Loading
Please register or sign in to comment