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 520A66FC8F; Fri, 16 Apr 2021 01:06:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 520A66FC8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618524389; bh=ebvSCTcVMCIN4aDUqwaoRWkiyUl3naDjOvyrQVQbK4c=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=HYOayRjKV8rIOxV5dsV12j8VtUk5pXTvYlEJ011qXyav/MYl60qB0RuAtX4xHe/4j oWk1z9KJ2tQfuPrAWeEFqYKRrMdVXb4fJ9i+6gKgddY9DJI9SVwo+Du3zvji1ok2XH 0TB8qyyJAffNzpbLoGXH5hQUyzEkKP4PxR4uiDH0= Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 25F296FC8F for ; Fri, 16 Apr 2021 01:06:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 25F296FC8F Received: by mail-lj1-f174.google.com with SMTP id r20so28845678ljk.4 for ; Thu, 15 Apr 2021 15:06:25 -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:mime-version :content-transfer-encoding; bh=layA8gnnAsdPAqpPnk/nXA1rT+u62lh1FMNl/CRRv/o=; b=W6DrJTx+d2AGxJs6Fs+DU/kbDGNMRnEiGn1BMyv6gLmgXbS9JfIlP4p+Q6q4pIolaq kCz4IScH3Hcyz2zdSxcWxtkhmyksE9fikmhVlXMJEB+k8fnpjsJyQVdM4nSKNrMzgAx6 vw7H16WerpG7NZfbDnEB5TdVP1WJAf6tx0uEeVcz9CM3/MVwhhdMJRYjgKYri5hC2D8M sI1c/EzhAjuXeA9DWNO+ZHWIn7WDLiGLIX1GBrVqPwUmS7+8HkXaZyw4uDSVBgkItcaG ejz8DP+fRrNlpo1gYh58XhSYImpDJUuRfdr/dDw/5Nl8wwPhAUrq4LKgF/owbPmUXCh9 DFfQ== X-Gm-Message-State: AOAM530gWYsDqWlKGGOr24ny+9gSdYZXOYwLP6Iy3pN/AUP233Vt4Wif GUHa7gDUuDbC1TjQFO9WzSfqyILJjNJJxQ== X-Google-Smtp-Source: ABdhPJxm0AbgnbslZWokEvRZkZQ6dgrLiJnkNyVpx1vQ/ly5gC4NtwBwyzLswUACVzNldvqt1Q3uYA== X-Received: by 2002:a2e:878c:: with SMTP id n12mr747824lji.492.1618524384028; Thu, 15 Apr 2021 15:06:24 -0700 (PDT) Received: from grain.localdomain ([5.18.199.94]) by smtp.gmail.com with ESMTPSA id l10sm751872ljc.119.2021.04.15.15.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 15:06:22 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 382BC5601F3; Fri, 16 Apr 2021 01:06:21 +0300 (MSK) To: tml Date: Fri, 16 Apr 2021 01:06:19 +0300 Message-Id: <20210415220619.27208-1-gorcunov@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH] 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 is if there are some pending transactions 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. Signed-off-by: Cyrill Gorcunov --- Guys, I don't want to create a separate branch for this small patch neither I consider it anyhow significant. More likely it is a cleanup dropping redundant code. Discovered while trying to figure out details of qsync. 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