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 876A26EC40; Tue, 29 Jun 2021 01:14:13 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 876A26EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1624918453; bh=IEUmgHf1xSjTY7Sk1uhz8VxKJ+2GdJ7Gidj4wIo6fRk=; 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=ktcPgHJ8lODypBPvMROn7vDiqlOs1MmewHQRB4ZrdT4xWyD22lU/9sQaYGjEo62k6 M6fnK3/V7g47oom8b9yLUHhCaCEFDszkzBrgVQ5Cr8eBueeVCKz0kWf//ZY2kukO7S QYS5jBUOZ7eUgKrZvfYtrPt4yqjxSiAQdwzcLJC8= Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [217.69.128.41]) (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 F38AB6EC43 for ; Tue, 29 Jun 2021 01:13:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F38AB6EC43 Received: by smtp61.i.mail.ru with esmtpa (envelope-from ) id 1lxzV6-0007oC-R2; Tue, 29 Jun 2021 01:13:09 +0300 To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Date: Tue, 29 Jun 2021 01:12:48 +0300 Message-Id: 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: 4F1203BC0FB41BD954DFF1DC42D673FB96E19CC2B9345E2B1F8975EC27617E56182A05F538085040509B584DBBE5E6A28C548A69DDB6D4D15B0DF02CF4594F194045E08A43DF8CE7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE746A11221A744BA93EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006370F98874192B1BA168638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8F5BDFC9BC80491938165036D2C804958117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC974A882099E279BDA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD186FD1C55BDD38FC3FD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B67393CE827C55B5F775ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CD87436A60A035F40194D9912A0869D8B8BEBB0961F73E5859C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF92B0BE0DA6BB795D699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3498910055B812BD9C69CCAF711DE753D5BD68D72B969E9A195B32B28F81D6AB95911BB952595954E51D7E09C32AA3244C072AA36F7482BBC877186750B692948497FE24653F78E668927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXjjQb0ILB/OAtAF8q2MujhV X-Mailru-Sender: 3B9A0136629DC9125D61937A2360A446C3FEE19542AA4C0E4B64C97DD3498DB51CD88C60EC26CF6F424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v3 02/12] 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 51dc2a186..16181b8a0 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -667,15 +667,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)