[Tarantool-patches] [PATCH 1/3] [tosquash] raft: vote without a new term when possible

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat Sep 26 00:29:11 MSK 2020


When instance wrote something to WAL and saw that there is no a
leader, and no vote, it started new term + wrote a vote for self.
Really the new term wasn't necessary. Since the node didn't vote
in the current term yet, it can vote right away.

It is not about saving term numbers. More about making the logs
more understandable. Otherwise it looks strange, that in some
terms a node didn't participate at all and just skipped them even
though it started tehm.
---
 src/box/raft.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/box/raft.c b/src/box/raft.c
index ce90ed533..9ef03d8c4 100644
--- a/src/box/raft.c
+++ b/src/box/raft.c
@@ -584,7 +584,7 @@ end_dump:
 			raft_sm_wait_election_end();
 		} else {
 			/* No leaders, no votes. */
-			raft_sm_schedule_new_election();
+			raft_sm_schedule_new_vote(instance_id);
 		}
 	} else {
 		memset(&req, 0, sizeof(req));
-- 
2.21.1 (Apple Git-122.3)



More information about the Tarantool-patches mailing list