From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id A54966EC5F; Mon, 19 Apr 2021 15:52:42 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A54966EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618836762; bh=kDhGh0/xdkwMbLxFzniYgzxfMxPN474oxHI59kNHbaU=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=hHfHAIQEwv4tI+HAEBlLEGht8Q1EDPNTtIjnaaxCA/f5VArrmPBiDFCNEEMsh6fZ+ r3bYIqNSeJn39kApzJfxh9LHqoSfK9JECLDvnqMEgsnCMIRqFHUpqV4bJ98srXuYPs WsirCDmqxTOoTlTDZ5MC+ybJnOuOUsZxoL/kno3U= Received: from smtp52.i.mail.ru (smtp52.i.mail.ru [94.100.177.112]) (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 3DB3B6EC5F for ; Mon, 19 Apr 2021 15:52:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3DB3B6EC5F Received: by smtp52.i.mail.ru with esmtpa (envelope-from ) id 1lYTOK-0004SE-KD; Mon, 19 Apr 2021 15:52:40 +0300 To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: Message-ID: <24975ba3-90b6-c5e3-327d-9e68afe47a8b@tarantool.org> Date: Mon, 19 Apr 2021 15:52:40 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480257C85EA0BB7A95D5E28B957962BB550182A05F5380850405C3B1EE8ED2F966D4D2DBEA521309E4B803AF62565A2F23EA8D0BE65B10BB0C0 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77EB2E345998A721DEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373880C950E4B364568638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B29AB3E135224E96D3561ED0FCB474FA9607164437C8F97EC6D2E47CDBA5A96583C09775C1D3CA48CF27ED053E960B195E117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE759A2DA0C93DFCD719FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE77375C166457008BBD32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C046DA754BBE08B471CD04E86FAF290E2D7E9C4E3C761E06A71DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3BE90F13D913F449135872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24209795067102C07E8F7B195E1C97831964D49B25CA0DD0AA2A6A4873189992C X-C1DE0DAB: 0D63561A33F958A5D362D546F808F02AF7D2C35212F6AA0246878DD544DB2486D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34B9F55CA4D2956E307A2A984517A314358447400D646F53482BD3CE236E00789F252B501E908C197D1D7E09C32AA3244CF1F62B8A82693F9580A0A33F25F260B5725D5B54B2FE4575FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojocJA+pXcDulvbNtpajVnLg== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F8E827E2D7B33C7431C889C375F493C842065D0E68F1A78D77424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 09/12] raft: introduce raft_start/stop_candidate X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 16.04.2021 19:25, Serge Petrenko пишет: > Extract raft_start_candidate and raft_stop_candidate functions from > raft_cfg_is_candidate. > > These functions will be used in manual elections. > > Prerequisite #3055 > Follow-up fixes: ============================= diff --git a/src/lib/raft/raft.c b/src/lib/raft/raft.c index 3f900db9a..46a30149f 100644 --- a/src/lib/raft/raft.c +++ b/src/lib/raft/raft.c @@ -886,7 +886,11 @@ raft_start_candidate(struct raft *raft)  void  raft_stop_candidate(struct raft *raft, bool do_demote)  { -       if (!raft->is_candidate) +       /* +        * May still be the leader after raft_stop_candidate +        * with do_demote = false. +        */ +       if (!raft->is_candidate && raft->state != RAFT_STATE_LEADER)                 return;         raft->is_candidate = false;         if (raft->state != RAFT_STATE_LEADER) { -- Serge Petrenko