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 CB159469719 for ; Wed, 23 Sep 2020 23:31:09 +0300 (MSK) References: <3c916b9b7e70c4fbfa2b95c4aeb4146e83c82c58.1599693319.git.v.shpilevoy@tarantool.org> <7a9e07de-5f24-ed4b-3749-74a4dbedabb3@tarantool.org> From: Vladislav Shpilevoy Message-ID: Date: Wed, 23 Sep 2020 22:31:07 +0200 MIME-Version: 1.0 In-Reply-To: <7a9e07de-5f24-ed4b-3749-74a4dbedabb3@tarantool.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Tarantool-patches] [PATCH v2 09/11] raft: introduce state machine List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Serge Petrenko , tarantool-patches@dev.tarantool.org, gorcunov@gmail.com >> diff --git a/src/box/raft.c b/src/box/raft.c >> index f712887a1..ce90ed533 100644 >> --- a/src/box/raft.c >> +++ b/src/box/raft.c >> @@ -177,16 +178,9 @@ raft_election_quorum(void) >> -            /* Can't vote when vclock is unknown. */ >> -            if (req->vclock == NULL) { >> -                say_info("RAFT: vote request is skipped - " >> -                     "missing candidate vclock."); >> -                break; >> -            } >> -            /* Can't vote for too old or incomparable nodes. */ >> -            if (!raft_can_vote_for(req->vclock)) { >> +            if (req->state != RAFT_STATE_CANDIDATE) { >>                   say_info("RAFT: vote request is skipped - " >> -                     "the vclock is not acceptable = %s", >> -                     vclock_to_string(req->vclock)); >> +                     "this is a notification about a vote " >> +                     "for a third node, not a request"); >>                   break; >>               } >> -            /* >> -             * Check if somebody is asking to vote for a third >> -             * node - nope. Make votes only when asked directly by >> -             * the new candidate. However that restriction may be >> -             * relaxed in future, if can be proven to be safe. >> -             */ >> -            if (req->vote != source) { >> +            if (raft.volatile_vote != 0) { >>                   say_info("RAFT: vote request is skipped - " >> -                     "indirect votes are not allowed"); >> +                     "already voted in this term"); >>                   break; >>               } >> -            if (raft.leader != 0) { >> +            /* Vclock is not NULL, validated above. */ >> +            if (!raft_can_vote_for(req->vclock)) { >>                   say_info("RAFT: vote request is skipped - the " >> -                     "leader is already known - %u", >> -                     raft.leader); >> +                     "vclock is not acceptable"); >>                   break; > > > Are you sure we want these messages on `info` level? Info is the default log level and > > RAFT spams the log with quite a lot of messages. Maybe `verbose` level would be better? Raft messages are supposed to be sent super rare. Only at an instance start, and when the leader fails. They are sent often only in the tests, because we tweak Raft config values a lot and start/kill instances. So I would keep these logs. They could help to recover what happened in a live cluster if something goes wrong with Raft. I propose to lower them to verbose or even remove in case someone will complain.