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 1A3E16EC5F; Tue, 20 Apr 2021 01:36:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1A3E16EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618871811; bh=JUiHgR1ZIa0G0cAAy2c9Bnq63udvdWkNyeEHtDhs/GU=; 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=rZaO4LZQbkvrKIC4bsIxvRZlH0yzqNBK1sfxLnf8GAmmuUctFzaVYDFDqQBwYAcTn adameAmxY7rMqcXbgdxir4BgzcAiiRk61IkW6aVINu8Eil02/jrkXQj7ZVALcMTswP xuJseT3TEbCkGUQzjnNFt4sRFkw0TCqrKNFN6qsM= 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 281CF6EC5F for ; Tue, 20 Apr 2021 01:36:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 281CF6EC5F Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1lYcVd-0000Jw-BK; Tue, 20 Apr 2021 01:36:49 +0300 To: Serge Petrenko , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: <5cbaefa9-078a-b00c-2aec-75cf01f732d4@tarantool.org> <83e7df81-078c-def7-1f73-8810676bf241@tarantool.org> <6e626b42-dddd-5ac0-3e0f-f2b92d3ac8fe@tarantool.org> Message-ID: <35351452-fbd8-926f-886b-8210ccb8f74e@tarantool.org> Date: Tue, 20 Apr 2021 00:36:48 +0200 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: <6e626b42-dddd-5ac0-3e0f-f2b92d3ac8fe@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E74800BD71C2E2CF43DDE8CBA234A641A13D4182A05F538085040D3E3C6D408F02A7F95D8A96EC4CB16FADDC30FF2B0067465D3E7FF725B692FC9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE705B093C0FC4B30B9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637889C00975665ABF68638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2FA4F4CE114AC220741ACD661BA47184ADF65068396D3048702ED4CEA229C1FA827C277FBC8AE2E8B2693A7E87501CB31A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE7850F8B975A76562C9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3A333A05395E4745B117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BB07C9E286C61B7F975ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C978319A5E66ACF10FF28938E9427ECC4B679E X-C1DE0DAB: 0D63561A33F958A5CC38A4E5C449D5EF3BA47618845AD6F9E434DD6C36ED07DED59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D344E332383F80D58BB67F9D170CFABE0B9AA723CF7BC0AB25CCC83114AE37883A7EA271D9A001A3A621D7E09C32AA3244C1A9B8D6D569AAA6EB899D6C3BFFCC3D555E75C8D0ED9F6EEFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojocJA+pXcDunotaC7lLRh5w== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822BBDF4378B4AF35C9403FA300270309BF3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 13/12] replication: send accumulated Raft messages after relay start 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the patch! See 2 comments below. > diff --git a/src/box/relay.cc b/src/box/relay.cc > index 7be33ee31..85f335cd7 100644 > --- a/src/box/relay.cc > +++ b/src/box/relay.cc > @@ -628,13 +659,38 @@ struct relay_is_raft_enabled_msg { >      bool is_finished; >  }; > > +static void > +relay_push_raft_msg(struct relay *relay, bool do_restart_recovery) 1. Why is the recovery restart flag is ignored if a message is already sent? This might lead to recovery restart loss if I am not mistaken. > +{ > +    if (!relay->tx.is_raft_enabled || relay->tx.is_raft_push_sent) > +        return; > +    struct relay_raft_msg *msg = > +        &relay->tx.raft_msgs[relay->tx.raft_ready_msg]; > +    msg->do_restart_recovery = do_restart_recovery; > +    cpipe_push(&relay->relay_pipe, &msg->base); > +    relay->tx.raft_ready_msg = (relay->tx.raft_ready_msg + 1) % 2; > +    relay->tx.is_raft_push_sent = true; > +    relay->tx.is_raft_push_pending = false; > +} > + >  /** TX thread part of the Raft flag setting, first hop. */ >  static void >  tx_set_is_raft_enabled(struct cmsg *base) >  { >      struct relay_is_raft_enabled_msg *msg = >          (struct relay_is_raft_enabled_msg *)base; > -    msg->relay->tx.is_raft_enabled = msg->value; > +    struct relay *relay  = msg->relay; > +    relay->tx.is_raft_enabled = msg->value; > +    /* > +     * Send saved raft message as soon as relay becomes operational. > +     * Do not restart recovery upon the message arrival. Recovery is > +     * positioned at replica_clock initially, i.e. already "restarted" and > +     * restarting it once again would position it at the oldest xlog > +     * possible, because relay reader hasn't received replica vclock yet. > +     */ > +    if (relay->tx.is_raft_push_pending) { > +        relay_push_raft_msg(msg->relay, false); 2. I don't understand. Why wasn't there such a problem before? Recovery must be restarted when the node becomes a leader. If you do not restart it, the data would be ignored by the replicas. How do you know it is positioned right now at replica_clock? You are in tx thread, you can't tell. What do I miss?