raft: fix 'manual' nodes bumping the term excessively
A node configured in 'manual' mode and promoted by `box.ctl.promote()` stays in is_candidate state for the whole term, even though it is not is_cfg_candidate. If such a node is the first one to notice leader death or to hit the election timeout, it bumps the term excessively, then immediately becomes a mere follower, because its is_candidate is reset with is_cfg_candidate. This extra term bump (one term after the node was actually promoted) is unnecessary and might lead to strange errors: tarantool> box.ctl.promote() --- - error: 'The term is outdated: old - 3, new - 4' ... Fix this by checking if a node is configured as a candidate before trying to start new elections. Closes #8168 NO_DOC=bugfix (cherry picked from commit 5765fdc4)
Showing
- changelogs/unreleased/gh-8168-double-term-bump-on-promote.md 4 additions, 0 deletionschangelogs/unreleased/gh-8168-double-term-bump-on-promote.md
- src/lib/raft/raft.c 10 additions, 3 deletionssrc/lib/raft/raft.c
- test/replication-luatest/gh_8168_extra_term_bump_test.lua 46 additions, 0 deletionstest/replication-luatest/gh_8168_extra_term_bump_test.lua
- test/unit/raft.c 36 additions, 1 deletiontest/unit/raft.c
- test/unit/raft.result 10 additions, 1 deletiontest/unit/raft.result
Loading
Please register or sign in to comment