From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (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 3E1F8469719 for ; Tue, 22 Sep 2020 11:49:35 +0300 (MSK) References: <3c916b9b7e70c4fbfa2b95c4aeb4146e83c82c58.1599693319.git.v.shpilevoy@tarantool.org> From: Serge Petrenko Message-ID: Date: Tue, 22 Sep 2020 11:49:34 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: ru 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 22.09.2020 01:47, Vladislav Shpilevoy пишет: > My new changes for this commit, on top of the branch: > > ==================== > [tosquash] raft: don't broadcast shit from WAL writer; add a log; > > raft_write_request() should not broadcast anything. > > 1. It is a WAL write function, has nothing to do with talking to > other nodes. > > 2. Its caller, raft_worker_handle_io(), already does the > broadcast. > > 3. Broadcast was done wrong - it didn't send vclock when vote > was == instance_id. Led to warnings about missing vclock. > > Also a new log was added for the skipped RAFT messages. Not to > loose anything. Anyway the messages are rare. 99% of the RAFT > interaction will be via empty heartbeats. So it makes sense to > log everything happening in the rest of the time. > > diff --git a/src/box/raft.c b/src/box/raft.c > index 237d71a2d..f712887a1 100644 > --- a/src/box/raft.c > +++ b/src/box/raft.c > @@ -332,8 +332,11 @@ raft_process_msg(const struct raft_request *req, uint32_t source) > assert(source > 0); > assert(source != instance_id); > /* Outdated request. */ > - if (req->term < raft.volatile_term) > + if (req->term < raft.volatile_term) { > + say_info("RAFT: the message is ignored due to outdated term - " > + "current term is %u", raft.volatile_term); > return; > + } > > enum raft_state old_state = raft.state; > > @@ -545,8 +548,6 @@ raft_write_request(const struct raft_request *req) > goto fail; > } > > - raft_broadcast(req); > - > region_truncate(region, svp); > return; > fail: Looking good -- Serge Petrenko