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 3C1F96EC61; Wed, 21 Apr 2021 01:31:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3C1F96EC61 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618957875; bh=uBDauLq8VWchfvcDoB+456H4FuMHzytOt0ICVJJo5UA=; 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=t/i+CYvM/TypmLEQ8S0e8km+zXWPVz72tDrouA+/nQJbcliNZgo+GdSz7+pupgYDS 9ul/JvT0UDji/CKyxaHbuRcVXoGfx2GxSohSIZBOErabPOr1mkH9KjiCFSwjvrOQ/F 2h4FBiiD/vC1KeezowqTDkDPgEGmMOiQ6DCyXpbs= Received: from smtp38.i.mail.ru (smtp38.i.mail.ru [94.100.177.98]) (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 A0A036EC61 for ; Wed, 21 Apr 2021 01:30:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A0A036EC61 Received: by smtp38.i.mail.ru with esmtpa (envelope-from ) id 1lYytJ-00028h-Td; Wed, 21 Apr 2021 01:30:46 +0300 To: Serge Petrenko , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: <60125d86-5142-c616-bbed-d479f7454219@tarantool.org> <0545e52f-028c-882b-c3d1-2dcc45b9fc0c@tarantool.org> Message-ID: <67f4c428-2ac1-ba76-bc1e-b60aa7e7195b@tarantool.org> Date: Wed, 21 Apr 2021 00:30:44 +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: <0545e52f-028c-882b-c3d1-2dcc45b9fc0c@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480257C85EA0BB7A95D0F00AE41BB9A5343182A05F53808504014747ED4412CB10531DCC86DBA70790FCCFC47EE0DCC83A6BA00DD6A89ED76A7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79FF7180C05A1FF7CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E80306D42697F3998638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B22AC91727515BCD26637EACB94EB65D3B79373A8315E4CF65D2E47CDBA5A96583C09775C1D3CA48CF17B107DEF921CE79117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE7C029D2AEF1418D74D32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C08D6C7A5C1D38D1AECD04E86FAF290E2DA2C5D8508FA2CF601DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B67393CE827C55B5F775ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4AD4A55790139E197E61CA345C91A9ADAA8 X-C1DE0DAB: 0D63561A33F958A5DCEDC71E3030E0F19B5EBF2FADD2E48BD5BFBA3218C5E15FD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3480665FBD8F49180C34EB928E7EF5BC0EF11B55B9FCD21329B416E2AC7E5A1C4EAD512BBDD2B78F971D7E09C32AA3244C845BAF0C507CC910638390C5E0AE4E79D9ADFF0C0BDB8D1FFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojlPRl29Bx4WG3jWCqBCCJ+g== X-Mailru-Sender: 504CC1E875BF3E7D9BC0E5172ADA311094DE23CA03102C4282C94F190819760EDC3D13817423D1F407784C02288277CA03E0582D3806FB6A5317862B1921BA260ED6CFD6382C13A6112434F685709FCF0DA7A0AF5A3A8387 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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): ==================== [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();