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 2ED156EC58; Mon, 21 Jun 2021 15:11:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2ED156EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1624277488; bh=HnBjtEnt6oOZii2dzw1FWhF3y4RvCbUKF4xyjCkoU5g=; 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=mQZ4GjOg0uJTvXqoXNnsqo1gjW/oeEhIcYlMQaccYHfvhZaSQ9jnj7aPFLy3vm6TT UPaRHQz/fMaZYJ/gKKn0TAEJQKmK7xuwiuROBheBgoxTFdaXAd37g62Oj6ngUT2+JT 4ade4FXB+p5v9yzS5iZvGNncF1mmi0ZDUoE+X9Vw= Received: from smtp59.i.mail.ru (smtp59.i.mail.ru [217.69.128.39]) (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 B04C56EC58 for ; Mon, 21 Jun 2021 15:11:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B04C56EC58 Received: by smtp59.i.mail.ru with esmtpa (envelope-from ) id 1lvIlx-00063b-PA; Mon, 21 Jun 2021 15:11:26 +0300 To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: Message-ID: <039adbec-220f-6606-0568-ba44f4a13e0d@tarantool.org> Date: Mon, 21 Jun 2021 15:11:25 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 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: 4F1203BC0FB41BD91C2C07775F13263A612E9F961DCF5576EBB1C736C2A4021700894C459B0CD1B9CD2B2028BE6BBC3FAC246D330176F8B376D6A66D10735992A39717FFD9CF39A8 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7798B95EC47D21699EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BC4B0F5721B555078638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8DAAC0D889D35C27350187E5DA823AE69117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC8883BAB8B32E402CA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520B1593CA6EC85F86D28451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE7532CA1512B8198132F3B5D5B27460C0D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3093C2F12201C912AC0837EA9F3D19764C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637427B078F297B269AEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C0D45A76B959E3B5D093B04F35C27F03D02CE136E60436E159C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF31C0090ACECF247D699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34060C3C6DE316ECE478EA9D955AC6A36745C43B2137FCFBD49E83FDC0CF1C2C097D99CA5778E48D301D7E09C32AA3244C3883ED5DC5C226FF2B565A78233E6C3AA90944CA99CF22E3FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXiUAvUxkZsQelxrSgE+wCku X-Mailru-Sender: 583F1D7ACE8F49BD9DF7A8DAE6E2B08A0E88E1ACCEABFAB774D359DFE28B4EB9D92993E909A1DF64424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 9/8] replication: send current Raft term in join response 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" Make Raft nodes send out their latest persisted term to joining replicas. Follow-up #6034 diff --git a/src/box/applier.cc b/src/box/applier.cc index 9d90a2384..2b3c653a5 100644 --- a/src/box/applier.cc +++ b/src/box/applier.cc @@ -463,6 +463,11 @@ applier_wait_snapshot(struct applier *applier)                         if (xrow_decode_synchro(&row, &req) != 0)                                 diag_raise();                         txn_limbo_process(&txn_limbo, &req); +               } else if (iproto_type_is_raft_request(row.type)) { +                       struct raft_request req; +                       if (xrow_decode_raft(&row, &req, NULL) != 0) +                               diag_raise(); +                       box_raft_recover(&req);                 } else if (iproto_type_is_error(row.type)) {                         xrow_decode_error_xc(&row);  /* rethrow error */                 } else { diff --git a/src/box/relay.cc b/src/box/relay.cc index e05b53d5d..510e5c420 100644 --- a/src/box/relay.cc +++ b/src/box/relay.cc @@ -400,7 +400,9 @@ relay_initial_join(int fd, uint64_t sync, struct vclock *vclock)                 diag_raise();         struct synchro_request req; +       struct raft_request raft_req;         txn_limbo_checkpoint(&txn_limbo, &req); +       box_raft_checkpoint_local(&raft_req);         /* Respond to the JOIN request with the current vclock. */         struct xrow_header row; @@ -419,6 +421,11 @@ relay_initial_join(int fd, uint64_t sync, struct vclock *vclock)                 row.sync = sync;                 coio_write_xrow(&relay->io, &row);         } +       if (raft_req.term > 1) { +               xrow_encode_raft(&row, &fiber()->gc, &raft_req); +               row.sync = sync; +               coio_write_xrow(&relay->io, &row); +       }         /* Send read view to the replica. */         engine_join_xc(&ctx, &relay->stream);