raft: make promote bump term and vote at once
box.ctl.promote() was implemented as follows: an instance bumps the term and marks itself a candidate, but doesn't vote for self immediately. Instead it relies on the machinery which makes a candidate vote for self as soon as it persists a new term. This differs from a normal election start due to leader timeout: there term and vote are bumped at once. Besides, this increases probability of box.ctl.promote() resulting in other node getting elected: if a node first broadcasts a term without a vote, it is not considered a candidate, so other candidates might start elections and vote for themselves. Let's bring promote into line with automatic elections. Closes #8497 NO_DOC=bugfix (cherry picked from commit 17371215)
Showing
- changelogs/unreleased/gh-8497-promote-atomic.md 4 additions, 0 deletionschangelogs/unreleased/gh-8497-promote-atomic.md
- src/lib/raft/raft.c 1 addition, 0 deletionssrc/lib/raft/raft.c
- test/replication-luatest/gh_6036_qsync_order_test.lua 1 addition, 1 deletiontest/replication-luatest/gh_6036_qsync_order_test.lua
- test/replication-luatest/gh_8497_atomic_promote_test.lua 56 additions, 0 deletionstest/replication-luatest/gh_8497_atomic_promote_test.lua
- test/replication/election_basic.result 3 additions, 12 deletionstest/replication/election_basic.result
- test/replication/election_basic.test.lua 3 additions, 6 deletionstest/replication/election_basic.test.lua
- test/unit/raft.c 2 additions, 2 deletionstest/unit/raft.c
Loading
Please register or sign in to comment