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 02B096EC5F; Mon, 19 Apr 2021 11:38:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 02B096EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618821510; bh=wWidIBKLc4j8oeyNhextngIhyR1Zz0cEjiPgtic9OE8=; 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=Fo/SA8wMjJbbAfTnSIcMNtJtWqqKx71e1sQ3NsXy35B8VvDC+MrRXClpkwXvJzitr EqcL8AK7+gxBzbEiMJAFFjmgYCZjMG79sn/ztEmvDqp/Aqijy9nDncfjriApA2QmfT CgpsWIY59Z1DxBG3Dupf7eojfzAiBd7a+o83btWo= 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 22FAC6F872 for ; Mon, 19 Apr 2021 11:37:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 22FAC6F872 Received: by mail-lj1-f172.google.com with SMTP id o5so5315613ljc.1 for ; Mon, 19 Apr 2021 01:37:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fwkjg8bMSshvhySV/qTJk5Bq/GjcExus/Zk0LFzkkAc=; b=ajSbj+Z9RII2r/KEu9tkEPGr536nv8/ZmD94m0dCbr6Xx+xzWVd7S+OwMQ4ksHLZP/ Uaj7l6VnN/Ne5sElgSEWloVMX/wM+wZncHQRDMpPnVQM8+k51iaUDvgWMiWTJ6JNct59 DrL6I5ydG04RQQp/nWOLiheZPcFJIb8qJzoa8Q1+e8PUa6/ha+iV7hZl6e3/3EoADKO/ X4tO6pg3yW1dkXDk6YUAAoGqIO+U6TCNCjYHF6/g/u2QRJ2fNtLuPGJVo4TRBUGh/CJA ZW4j8xY/xeJKYljcKhuMb812kZ7WPK2LxEKCEmAdJ5qsHd/HMCnygfkuf/YRD7WFyrcF Ce9Q== X-Gm-Message-State: AOAM5302hBq7iy29uhGQ5wKc/tVqdOnAxVVqW3SBZOs0FEEH2ZTOdjom OGBi3HSxy3H81ei12jv1N+VyWkSIUxz62w== X-Google-Smtp-Source: ABdhPJyOZDuPYqep7rMcszKHqUa5HVSmoqmHlo5SKov6HzgA6WHBr/cyOu+L7gwetyg6Boyz36znFQ== X-Received: by 2002:a2e:5855:: with SMTP id x21mr10424046ljd.203.1618821468151; Mon, 19 Apr 2021 01:37:48 -0700 (PDT) Received: from grain.localdomain ([5.18.199.94]) by smtp.gmail.com with ESMTPSA id m11sm839454ljp.36.2021.04.19.01.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 01:37:47 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 487305601FE; Mon, 19 Apr 2021 11:37:22 +0300 (MSK) To: tml Date: Mon, 19 Apr 2021 11:37:18 +0300 Message-Id: <20210419083719.29689-3-gorcunov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419083719.29689-1-gorcunov@gmail.com> References: <20210419083719.29689-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 2/3] txn_limbo: simplify owner migration condition 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 limbo owner is about to change the state we should check if there are some pending transactions which are not yet processed, iow if queue is empty. No need to test if current limbo owner is zero. The owner is set to zero once -- when limbo is created during initialization. After all I think even if owner would ever zero and we're about to change it the queue simply must be empty, that is the only safe state. Acked-by: Vladislav Shpilevoy Signed-off-by: Cyrill Gorcunov --- src/box/txn_limbo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c index addcb0f97..2a10bd0ae 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -94,8 +94,7 @@ txn_limbo_append(struct txn_limbo *limbo, uint32_t id, struct txn *txn) id = instance_id; bool make_ro = false; if (limbo->owner_id != id) { - if (limbo->owner_id == REPLICA_ID_NIL || - rlist_empty(&limbo->queue)) { + if (rlist_empty(&limbo->queue)) { limbo->owner_id = id; limbo->confirmed_lsn = 0; if (id != instance_id) -- 2.30.2