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 6CB7A6EC55; Thu, 10 Jun 2021 16:34:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6CB7A6EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1623332073; bh=Q40fiaORs6g497SLXuc0XJbSPaJtXz1EVnp8qE97FXY=; 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=U4fFWsc+DlzuS0ixLM1Wp2xlRg3qNSdU4887fgH92QbDTFPWJ03PByh27c/SuQ0eK +CnrlQNUWCWecDLibEIamJx4r4wkKZqZxrHMfKdu5w146Iewy/2oXY+RdW92wR0KI9 kXlLAEsGtACXPi0zXybdpGHwUeuhA8iWLg0ppEd4= Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (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 0AD566EC6E for ; Thu, 10 Jun 2021 16:33:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0AD566EC6E Received: by smtp63.i.mail.ru with esmtpa (envelope-from ) id 1lrKnw-0007EB-1w; Thu, 10 Jun 2021 16:33:04 +0300 To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Date: Thu, 10 Jun 2021 16:32:53 +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-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C540E30C2BDD69416C6E46C178CD572CB10182A05F538085040498A914A35DD48529C7643BD0C07794A1869A77EECC9811E02928BDCEEDF5110 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A41A3668A00E2636EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378D70459430292EC88638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D851C8ADEEEC1FBDA167A9B605B85F0B70117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC292D688DDAD4E7BC389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC87BD21ED50D08CA4DF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C6030639D0DAF385D6136E347CC761E074AD6D5ED66289B52698AB9A7B718F8C46E0066C2D8992A16725E5C173C3A84C37195ABA52E0305EBBA3038C0950A5D36B5C8C57E37DE458B0BC6067A898B09E46D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE732FCE54C4D9A645443847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C8874A2D3FA5089FEED74272756E9F239F5BB03572B04EE489C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFD99FB7B2A39B4961699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3435BBF0AC4E3A921CF6B2A6CB0BE93FAD485D9535BDFE0CD197AC6001E8BF55D245969D1DC241BE531D7E09C32AA3244C4E3868D234222FB68DFE9CD613085E3FE8FBBEFAE1C4874C927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXiiA81jxGMgNh4jqAp7WcHM X-Mailru-Sender: 583F1D7ACE8F49BD9DF7A8DAE6E2B08A7C268FF7D9159348871D8195F75444ED3B91CD86D79B28BC424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH 3/7] 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 53233add3..33a6e5548 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -645,17 +645,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)