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 670426EC5F; Wed, 21 Apr 2021 08:58:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 670426EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618984739; bh=rDl/iT0FXyFhz1Mqd9yfK3jNONVS9nciKOeTdWyTu7A=; 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=Kf05YgCyz+bbVYAB2ra8xPhcBUmZevVtGpSpXNOdEylNkSNPW8VZ/AQWeTfT4ZgN+ zZJ+sLBfjnW5Tcfz4PBezliogA8tTJOoelzIfT9RPjv64/9Vz1+ST+GgN2wsU1YmhY bFEaKVgmExaKz58cLk6EkTenQZEENivmTHcmG0N4= Received: from smtp43.i.mail.ru (smtp43.i.mail.ru [94.100.177.103]) (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 A01C16EC5F for ; Wed, 21 Apr 2021 08:58:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A01C16EC5F Received: by smtp43.i.mail.ru with esmtpa (envelope-from ) id 1lZ5t4-0008AB-3Q; Wed, 21 Apr 2021 08:58:58 +0300 To: Vladislav Shpilevoy , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: <60125d86-5142-c616-bbed-d479f7454219@tarantool.org> <0545e52f-028c-882b-c3d1-2dcc45b9fc0c@tarantool.org> <67f4c428-2ac1-ba76-bc1e-b60aa7e7195b@tarantool.org> Message-ID: <174d74bb-a5d6-a4c7-5786-9dc3abae2568@tarantool.org> Date: Wed, 21 Apr 2021 08:58:57 +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: <67f4c428-2ac1-ba76-bc1e-b60aa7e7195b@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E74806859AC5FE18436AE548FEBC73F726D7B182A05F538085040184CF0C9C8CD6DE8780F271174100C67F9ED6CB9FFDD5675B13BEB2C0EDE4E3F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70B8ADF238913687CB287FD4696A6DC2FA8DF7F3B2552694A4E2F5AFA99E116B42401471946AA11AF7680F9384605B90327865B382FF314938F08D7030A58E5ADC58D69EE07B14084F39EFFDF887939037866D6147AF826D8B5A6CECA3A2C74951191F89B27C25193117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC2EE5AD8F952D28FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18C26CFBAC0749D213D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE7532CA1512B8198103CEA74F0D118906D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3F8BD4E506CFA3D886E0066C2D8992A16C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637427B078F297B269AEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A5F3B598363205F33B34FA735DFD249A5C7F520EE9705A565FD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3438212F20E1E78D8E91ADC10D094F91036EBFDB1FCB541CA34F3F58C2736EC6C7E9243F223E4288991D7E09C32AA3244C6652BF9386955BE84EF15FA56BD0C0773FD9C8CA1B0515E0FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojlPRl29Bx4WGzzsn/hEZdCg== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F8F7DA7E4D73C7A60E8616098535D35B9BB7E4CF57933E0CAB424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 07/12] raft: filter rows based on known peer terms 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" 21.04.2021 01:30, Vladislav Shpilevoy пишет: > Thanks for the patch! > >>> A couple of fixes on top: >>> Only apply  PROMOTE when it's for a greater term than already received. >>> If promote tries to confirm entries for instance id other than limbo->owner_id >>> rollback everything that's unconfirmed. >> Sorry, discard this. election_qsync_stress hangs again with this change. >> >> I haven't pushed it yet anyway. > As we noticed in a private discussion, it hung on top of this commit, but > does not hang on top of the branch. Because the last commit contains a > fix for the test. So the initial change was good. I returned it in this > commit (pushed on my branch sp/gh-5445-election-fixes-review): Yes, indeed. Thanks for noticing! Squashed your commit. > > ==================== > [tosquash] Foreign promote should rollback local limbo > > See the comments why. > > diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c > index 31f4c1b1e..c22bd6665 100644 > --- a/src/box/txn_limbo.c > +++ b/src/box/txn_limbo.c > @@ -658,12 +658,13 @@ txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req) > return; > } > } > + int64_t lsn = req->lsn; > if (req->replica_id == REPLICA_ID_NIL) { > /* > * The limbo was empty on the instance issuing the request. > * This means this instance must empty its limbo as well. > */ > - assert(req->lsn == 0 && req->type == IPROTO_PROMOTE); > + assert(lsn == 0 && req->type == IPROTO_PROMOTE); > } else if (req->replica_id != limbo->owner_id) { > /* > * Ignore CONFIRM/ROLLBACK messages for a foreign master. > @@ -671,17 +672,25 @@ txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req) > * data from an old leader, who has just started and written > * confirm right on synchronous transaction recovery. > */ > - return; > + if (req->type != IPROTO_PROMOTE) > + return; > + /* > + * Promote has a bigger term, and tries to steal the limbo. It > + * means it probably was elected with a quorum, and it makes no > + * sense to wait here for confirmations. The other nodes already > + * elected a new leader. Rollback all the local txns. > + */ > + lsn = 0; > } > switch (req->type) { > case IPROTO_CONFIRM: > - txn_limbo_read_confirm(limbo, req->lsn); > + txn_limbo_read_confirm(limbo, lsn); > break; > case IPROTO_ROLLBACK: > - txn_limbo_read_rollback(limbo, req->lsn); > + txn_limbo_read_rollback(limbo, lsn); > break; > case IPROTO_PROMOTE: > - txn_limbo_read_promote(limbo, req->origin_id, req->lsn); > + txn_limbo_read_promote(limbo, req->origin_id, lsn); > break; > default: > unreachable(); > -- Serge Petrenko