From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [94.100.177.92]) (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 93C31469719 for ; Thu, 24 Sep 2020 12:34:35 +0300 (MSK) References: <3c916b9b7e70c4fbfa2b95c4aeb4146e83c82c58.1599693319.git.v.shpilevoy@tarantool.org> <7a9e07de-5f24-ed4b-3749-74a4dbedabb3@tarantool.org> From: Serge Petrenko Message-ID: <30d774c7-3e83-d1c9-8807-8a09a4fc2132@tarantool.org> Date: Thu, 24 Sep 2020 12:34:34 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: en-GB 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: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, gorcunov@gmail.com 23.09.2020 23:31, Vladislav Shpilevoy пишет: >>> 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. Ok, I agree -- Serge Petrenko