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 9E5126FC8F; Fri, 16 Apr 2021 10:17:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9E5126FC8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618557454; bh=DgZmHg8WZi3LAH8jPijJt3xrh8LgjJNhBJY1oiPoots=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=jTG1iCqZNWU/ERha4+NVo1CHyv2osK8UoQQl3ChkZpySfgn2rUFNoU0iO2pEnk4aj WnfqKOvzdZfhqMCtGps02quSeYgl3nRHP39wvXt/WV1UkI6gc92DCXM1rXvOEbGIPy 0C+4wTo4vKP4ZmKWOWkFdIUX5x/Hesn1lMeCvMQk= Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (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 E59996FC8F for ; Fri, 16 Apr 2021 10:17:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E59996FC8F Received: by mail-lf1-f51.google.com with SMTP id x19so12819058lfa.2 for ; Fri, 16 Apr 2021 00:17:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UJZ0HxUUWxRnY8UxYckJGF2yjokBckWsRQQjgTickas=; b=b5uCHsKhCzeDCC2B2sasB1uPW8x6LCAOAZ2sMzMpe59aY8qbPolMUWMRd/iYI6TRUa 7D8u6A9eufcOjCBvA0y1Ur3xmmP6VPl817ul7yj1ppkr6OmneRfCHMqm4EHjEzt0wtT6 50x2SUsks8pN9FE8pxN/eAz6+wmQA7Of3VLxiY3BYkLgaVh9CAH32ODj0Ahd97uPeEe9 Tjbnr7Q76kjqxNzbv0hKzCryELkBfv7a+pwjNSgh8E1Lw4AR8wBJAmSvBlwJEwsRpxqK rtj/oMzIhtM4rZqdBxlR176feYkjrK28UYEy7al7VNEzzqnc1rrOkj9yQ+9TbNxsKKIB NWqg== X-Gm-Message-State: AOAM532E0VP8SKWafA169RVjJSwbS32qC2N46dJsKdRANQBvhz7ia3fm 0IIv/1n3mifnBExL/clHAgHN4pgN4n7ooA== X-Google-Smtp-Source: ABdhPJzCVFomYopUIKfJpmB2Kovx0J83tW7ebd64sd+5X7aok75ofuWe+WNcLxHgt8M/6VQUVosr3w== X-Received: by 2002:a05:6512:20d9:: with SMTP id u25mr1935035lfr.452.1618557452844; Fri, 16 Apr 2021 00:17:32 -0700 (PDT) Received: from grain.localdomain ([5.18.199.94]) by smtp.gmail.com with ESMTPSA id c23sm922851lfc.300.2021.04.16.00.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 00:17:31 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 235DD5601F3; Fri, 16 Apr 2021 10:17:31 +0300 (MSK) Date: Fri, 16 Apr 2021 10:17:31 +0300 To: Vladislav Shpilevoy Message-ID: References: <20210415220619.27208-1-gorcunov@gmail.com> <8f84416e-440e-8f31-e673-f182fd402c18@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8f84416e-440e-8f31-e673-f182fd402c18@tarantool.org> User-Agent: Mutt/2.0.5 (2021-01-21) Subject: [Tarantool-patches] [PATCH v2] 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: tml 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. Signed-off-by: Cyrill Gorcunov --- src/box/txn_limbo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Index: tarantool.git/src/box/txn_limbo.c =================================================================== --- tarantool.git.orig/src/box/txn_limbo.c +++ tarantool.git/src/box/txn_limbo.c @@ -94,8 +94,7 @@ txn_limbo_append(struct txn_limbo *limbo 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)