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 EF7556EC56; Wed, 14 Jul 2021 21:26:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EF7556EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626287210; bh=4ZnqYflo1N9ge8+BF5lwBqplnUZmDcNDacpD+4e8HAI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=HrYB7Arl2SC16NYEJCK9vNlWsqqkAry0ZN73TaZVRjkFBYbiNcKsGsuB/mQ98Xhd3 rt2FmE5jt4OMy75gnoQ/LqM/u7caGvlE00iYgX33mznEFMFZnPSbOmRB9VWJ0NEyxO mtN95piMzwtOEByQbbImmOEY4dz6GxDUQ2e0j5Oo= Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [217.69.128.38]) (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 7081A6EC56 for ; Wed, 14 Jul 2021 21:25:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7081A6EC56 Received: by smtp58.i.mail.ru with esmtpa (envelope-from ) id 1m3ja2-0007Q7-LN; Wed, 14 Jul 2021 21:25:59 +0300 To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Date: Wed, 14 Jul 2021 21:25:30 +0300 Message-Id: <1b79376936d1b731927e5d774d255d8c51bffcb8.1626287002.git.sergepetrenko@tarantool.org> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD97BB0EF39AD2B33D5F2EB549EE938DAF5BD6C597CA890F198182A05F538085040F9DE5B53B9F06CC51DF0AEAB0F5D851295D82B061BBE3561D852E5EED5BEFEA1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7780BADBB53F1FA59C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE73230F712CF4B3924EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BBCA57AF85F7723F2907CC1E2098DF357D4E02EE2EE85DA17CC7F00164DA146DAFE8445B8C89999728AA50765F7900637CAEE156C82D3D7D9389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC878444BBB7636F62AF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BB662CFBDBA8F60F475ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CE68746B1F2AB10C646929C2FC49E209F907585F5CA62F65A9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF309DFB797F6729CB699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34987A0E8D235BB5344A67F25A4B6878F0130742EF11B32AA59584E951FA9118D0A83EA81D9CF8FA861D7E09C32AA3244C1637ED6BA50DA7D175D7B24240DFEC6869B6CAE0477E908D927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojDdSFIg49M1RCOdk6LP6lAA== X-Mailru-Sender: 3B9A0136629DC9125D61937A2360A446DCF67A6ACA5D040D8C3E9DCD95E1F68DCBE8C9F27F311A76424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v4 02/16] txn_limbo: fix promote term filtering 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 Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" txn_limbo_process() used to filter out promote requests whose term was equal to the greatest term seen. This wasn't correct for PROMOTE entries with term 1. Such entries appear after box.ctl.promote() is issued on an instance with disabled elections. Every PROMOTE entry from such an instance has term 1, but should still be applied. Fix this in the patch. Also, when an outdated PROMOTE entry with term smaller than already applied from some replica arrived, it wasn't filtered at all. Such a situation shouldn't be possible, but fix it as well. Part-of #6034 --- src/box/txn_limbo.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c index fdea287c7..6e5d6d04e 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -707,15 +707,18 @@ txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req) uint32_t origin = req->origin_id; if (txn_limbo_replica_term(limbo, origin) < term) { vclock_follow(&limbo->promote_term_map, origin, term); - if (term > limbo->promote_greatest_term) { + if (term > limbo->promote_greatest_term) limbo->promote_greatest_term = term; - } else if (req->type == IPROTO_PROMOTE) { - /* - * PROMOTE for outdated term. Ignore. - */ - return; - } + } else if (req->type == IPROTO_PROMOTE && + limbo->promote_greatest_term > 1) { + /* PROMOTE for outdated term. Ignore. */ + say_info("RAFT: ignoring PROMOTE request from instance " + "id %u for term %llu. Greatest term seen " + "before (%llu) is bigger.", origin, (long long)term, + (long long)limbo->promote_greatest_term); + return; } + int64_t lsn = req->lsn; if (req->replica_id == REPLICA_ID_NIL) { /* -- 2.30.1 (Apple Git-130)