From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 22385469719 for ; Sat, 26 Sep 2020 00:29:17 +0300 (MSK) From: Vladislav Shpilevoy Date: Fri, 25 Sep 2020 23:29:11 +0200 Message-Id: <7e536c4e14975533480fdb67aa5531d2eab2cff6.1601069274.git.v.shpilevoy@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 1/3] [tosquash] raft: vote without a new term when possible List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, sergepetrenko@tarantool.org 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)