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 ED3666F3F2; Fri, 10 Sep 2021 18:30:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org ED3666F3F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1631287816; bh=IY8QJHRV94u91nKNTtqE1IJRwahontIRPTqYEUqPeG0=; 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=rnRYW/V7Cx0KK4nILfSHcFHrZKraEIn70OxCXgUbVaI7Fkc7f60bjZL7qgE2RUZry 0YdQRdu39nhy82vVHC8PvJXRbls+qsG3e7jFoIOu28BF3P7+T1npodtb2SsMTR8rz8 Y1z1F5CSEHcuAVmJ5u2/ZJbwcb9Lm3olXQbDAAuw= Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 43BD36F3F2 for ; Fri, 10 Sep 2021 18:29:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 43BD36F3F2 Received: by mail-lj1-f172.google.com with SMTP id f2so3822362ljn.1 for ; Fri, 10 Sep 2021 08:29:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=//QilHG6aZ8u9F/4fzjmTJyyTsdWN8tBF+L0mwF/YPE=; b=gWaVhNniAWwSh65BdsEbOb8q4vHe6CmhWt84Wt29x1cLzE5ngVFhs33foSSfQoeEpw AHLi590HVh/mc1E9pIjbggNI3c8MKcIK8UXNYToI0dNX2EbVfalM6KhfmfHrA8joClAA 0QmGvXIe5p3vOe/E8VPs40ou2/+edgOditSuDK6UC1untXLZkqOqh0EN6C087iOfKzm+ lqNeWMp5HsHj0fTO41w9QI39yEuiYlWUVmH3pFPYIFEmw9Tuy7l0wiR7PBNgdcRonQgN vUZNqvubd7Ui8IDUDpN/TDfoehRBSF70q5gBImO17JIlArViJ/B2kNilA7ruMpuU/bTO MLoA== X-Gm-Message-State: AOAM531MY4tAdjeRiI7l+OHZMtcPrjoBA1rMGIMPbOqGiAoSP0TJAsOF BBZiJ0bXXt8E1/NCWRYE1rThTX9GKxvWTw== X-Google-Smtp-Source: ABdhPJyAjFoTA7gVINEPrsa9XvaPlYJ95FJcjFBReRkjozqwij0/IwMEr7yN6p6BWGx9EDFN9LG8mA== X-Received: by 2002:a05:651c:617:: with SMTP id k23mr4817852lje.260.1631287779304; Fri, 10 Sep 2021 08:29:39 -0700 (PDT) Received: from grain.localdomain ([5.18.253.97]) by smtp.gmail.com with ESMTPSA id j1sm627991lja.108.2021.09.10.08.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 08:29:38 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id BDE055A0020; Fri, 10 Sep 2021 18:29:11 +0300 (MSK) To: tml Date: Fri, 10 Sep 2021 18:29:06 +0300 Message-Id: <20210910152910.607398-3-gorcunov@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210910152910.607398-1-gorcunov@gmail.com> References: <20210910152910.607398-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v14 2/6] qsync: update confirmed lsn on initial promote request 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: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" When promote request is handled we drop last confirmed lsn to zero because its value make sense for sync queue owner only. Still the case where we become queue owner for the first time is special - we need to fetch the obtained lsn from the request and remember it so we will be able to filter any next malformed requests with wrong lsn numbers (see queue filtering procedure in next patch). Part-of #6036 Signed-off-by: Cyrill Gorcunov --- src/box/txn_limbo.c | 8 +++++++- src/box/txn_limbo.h | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c index cca2ce493..08463219d 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -50,6 +50,7 @@ txn_limbo_create(struct txn_limbo *limbo) limbo->confirmed_lsn = 0; limbo->rollback_count = 0; limbo->is_in_rollback = false; + limbo->has_initial_promote = false; } bool @@ -521,8 +522,13 @@ txn_limbo_read_promote(struct txn_limbo *limbo, uint32_t replica_id, txn_limbo_read_rollback(limbo, lsn + 1); assert(txn_limbo_is_empty(&txn_limbo)); limbo->owner_id = replica_id; + if (likely(limbo->has_initial_promote)) { + limbo->confirmed_lsn = 0; + } else { + limbo->confirmed_lsn = lsn; + limbo->has_initial_promote = true; + } box_update_ro_summary(); - limbo->confirmed_lsn = 0; } void diff --git a/src/box/txn_limbo.h b/src/box/txn_limbo.h index 53e52f676..e0d17de4b 100644 --- a/src/box/txn_limbo.h +++ b/src/box/txn_limbo.h @@ -179,6 +179,12 @@ struct txn_limbo { * by the 'reversed rollback order' rule - contradiction. */ bool is_in_rollback; + /** + * Whether the limbo received initial PROMOTE request. It is needed to + * update confirmed_lsn appropriately and pass packet validation/filtering + * procedure. + */ + bool has_initial_promote; }; /** -- 2.31.1