Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@dev.tarantool.org, sergepetrenko@tarantool.org
Subject: [Tarantool-patches] [PATCH 1/3] [tosquash] raft: vote without a new term when possible
Date: Fri, 25 Sep 2020 23:29:11 +0200	[thread overview]
Message-ID: <7e536c4e14975533480fdb67aa5531d2eab2cff6.1601069274.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1601069274.git.v.shpilevoy@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)

  reply	other threads:[~2020-09-25 21:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 21:29 [Tarantool-patches] [PATCH 0/3] Raft follow-ups Vladislav Shpilevoy
2020-09-25 21:29 ` Vladislav Shpilevoy [this message]
2020-09-25 21:29 ` [Tarantool-patches] [PATCH 2/3] [tosquash] raft: fix 99% CPU issue in raft io worker Vladislav Shpilevoy
2020-09-25 21:29 ` [Tarantool-patches] [PATCH 3/3] [tosquash] raft: don't start new election immediately after restart Vladislav Shpilevoy
2020-09-28  7:09 ` [Tarantool-patches] [PATCH 0/3] Raft follow-ups Serge Petrenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e536c4e14975533480fdb67aa5531d2eab2cff6.1601069274.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/3] [tosquash] raft: vote without a new term when possible' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox