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 660096E201; Fri, 18 Jun 2021 00:09:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 660096E201 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1623964186; bh=5g5sh2rqXaoCFvFlQaZoEgDoHGsX1lHqbJpFLXRTYSw=; 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=fVBeCJU4xu0xR8UzoVeq17lyJaWzEqrciL6rY2+bQXh4rE9XKjjbrf0GTBf8xkO6I Z9zwI3T+0AP/izkM2ip4B7xnT/1if8SglCe9aSBk93cGOiHb8yCp4FXd4M5NRXbSwJ RphXn3/JuycrXbAYzDRpQsNl8sA52jVFiDK7y4ok= Received: from smtp46.i.mail.ru (smtp46.i.mail.ru [94.100.177.106]) (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 8696E6E204 for ; Fri, 18 Jun 2021 00:08:42 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8696E6E204 Received: by smtp46.i.mail.ru with esmtpa (envelope-from ) id 1ltzFh-00046o-Om; Fri, 18 Jun 2021 00:08:42 +0300 To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Date: Fri, 18 Jun 2021 00:07:36 +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: 4F1203BC0FB41BD91C2C07775F13263AD4A2A3BFBC817E640615893838B9A94F00894C459B0CD1B98244B84720BFC437B6F1B538520FB0477FF79ED123BE076C37692451E7D5BD79 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70F8483684B69468CB287FD4696A6DC2FA8DF7F3B2552694A4E2F5AFA99E116B42401471946AA11AF1661749BA6B977356CEA61CADDE926D952120BFB3F63BC185F65E78799B30205C33C3ADAEA971F8E611E41BBFE2FEB2B1E11FAF78CF6E2FBA90AD62224F8B220EB97DFAD89F18A1B389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0B27420F9988F54058941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6F532FBFD8162E58CCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C224985CDA5091932EF7376E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8B1DE3259247C233783AA81AA40904B5D9DBF02ECDB25306B2201CA6A4E26CD07C3BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E7358CCB3ED2A1DE2304C4224003CC83647689D4C264860C145E X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4AD7067FEF890167A547D0C7A6D636B7081 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C2C9C2AE8C25C43DD7D7261B5FEB10891A06AE4F2F355ACBC9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFD99FB7B2A39B4961699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34128DEC38EFF4BE5AFBD70DB49972B3EC0BE135EE7956D293DA70ACF8BB0894791EE11252F0DA00661D7E09C32AA3244C8116DE44C695F965EE78CC2DB4BE2F1F3E8609A02908F271927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXjymZAW17GbhEbkpXNH/a9w X-Mailru-Sender: 583F1D7ACE8F49BD9DF7A8DAE6E2B08A18ACA3F9016771411266D9C58BC58D2A536B73BBDC67F8F1424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 2/8] 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 | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c index 51dc2a186..a5d1df00c 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -665,17 +665,21 @@ txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req) { uint64_t term = req->term; uint32_t origin = req->origin_id; - if (txn_limbo_replica_term(limbo, origin) < term) { + if (txn_limbo_replica_term(limbo, origin) < term) vclock_follow(&limbo->promote_term_map, origin, term); - if (term > limbo->promote_greatest_term) { - limbo->promote_greatest_term = term; - } else if (req->type == IPROTO_PROMOTE) { - /* - * PROMOTE for outdated term. Ignore. - */ - return; - } + + if (term > limbo->promote_greatest_term) { + limbo->promote_greatest_term = term; + } 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 %"PRIu32" for term %"PRIu64". Greatest term seen " + "before (%"PRIu64") is bigger.", origin, term, + limbo->promote_greatest_term); + return; } + int64_t lsn = req->lsn; if (req->replica_id == REPLICA_ID_NIL) { /* -- 2.30.1 (Apple Git-130)