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 243FA7414C; Tue, 5 Oct 2021 00:53:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 243FA7414C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1633384433; bh=yjGWuwt3FGY284+2qMKcv+cJR44Xmm8z7uq0GWsetu8=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=nUVN2KW5T7OU6qONcMOTU2STM+UfiNSO9EEOqa1b4T3YGV4pv+8p83uJKq04gC6+/ 3XpQKwfjJD9ODbHUF6CZmHqtbWXWJRQ0PgW0S0xsGpcTHbdG4YQ7XxHd/RcIbMkid+ T12qHG16Qi0jlBdJqv4SiE7bYmBLwInen0Sukbgs= Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 3728474147 for ; Tue, 5 Oct 2021 00:53:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3728474147 Received: by mail-lf1-f41.google.com with SMTP id y15so11939714lfk.7 for ; Mon, 04 Oct 2021 14:53: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:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2XMh9MldDdc66/pZr6yoIbuwSldnV9chexmLUo3UDBs=; b=Dir2EWopn8UMCaI6iVNL9BCPVumOYEXstbDM3SJbjjBuWogtI+HSozI2ubQFz6LX0I u9FLdDmSUrQMRvxattLifFIXatM0oLStSQ1aAg205fMLt7xu1V0AueWF8AWRYL7LYLO/ HPuIcy1S179PvwlkPC/BF47gYqThtRI9y8y262lrAV3GjtM1M8bmbHJn1bMH5cTpQRwP OIx8OoySyQwjl/CilHcNYLRgAKSFUceCnAgH0cN8TFTTHzvF6ejBvBUYhmx+5izwHKXn pXgtllyLqYE2VaEQEeSCy2wlJLgwh0hsyMFliS1w3+lc7Qf5rgtMCaUlZVToFG+wqxO4 hkeQ== X-Gm-Message-State: AOAM531jE8rL+W+cLFUvetR832WL8KAqehujELdgaQ0kz5HzFstHhOGU ZZgmtFseOvh9SzubMvAYCTbQC/bZlrc= X-Google-Smtp-Source: ABdhPJyhr5t6mXKkIY5AE56YRh1BM+bb8avw1F63OrEOW9rUEqSpbjm8hB4rWgWtVhFGTiMYkkabug== X-Received: by 2002:a05:6512:13a5:: with SMTP id p37mr16762485lfa.403.1633384419155; Mon, 04 Oct 2021 14:53:39 -0700 (PDT) Received: from grain.localdomain ([5.18.253.97]) by smtp.gmail.com with ESMTPSA id f10sm1749544ljp.55.2021.10.04.14.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 14:53:37 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 9D1F05A001E; Tue, 5 Oct 2021 00:53:36 +0300 (MSK) Date: Tue, 5 Oct 2021 00:53:36 +0300 To: Serge Petrenko Cc: tml , Vladislav Shpilevoy Message-ID: References: <20210930094445.316694-1-gorcunov@gmail.com> <20210930094445.316694-3-gorcunov@gmail.com> <0c64d172-4fa8-29ec-7845-ff772738c09a@tarantool.org> <590f764f-57f1-eeaf-925c-263c29121fd5@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <590f764f-57f1-eeaf-925c-263c29121fd5@tarantool.org> User-Agent: Mutt/2.0.7 (2021-05-04) Subject: Re: [Tarantool-patches] [PATCH v19 2/3] qsync: order access to the limbo terms 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Fri, Oct 01, 2021 at 03:37:18PM +0300, Serge Petrenko wrote: > Shouldn't we guard limbo->owner as well? > Otherwise you may start writing confirm for an old leader once promote for a > new one is already in progress. > > I don't remember us discussing this before, so, maybe I'm just confused. Seems I still don't follow. Look, currently limbo::owner_id is assigned from the one place: txn_limbo_process_core txn_limbo_process_begin(limbo) txn_limbo_read_demote | txn_limbo_read_promote ... limbo->owner_id = replica_id; The txn_limbo_process_core is called from console (via box.ctl.promote|demote commands) or via applier. When it comes from console then we still take the lock before write into the journal static void box_issue_promote(uint32_t prev_leader_id, int64_t promote_lsn) { struct raft *raft = box_raft(); assert(raft->volatile_term == raft->term); assert(promote_lsn >= 0); struct synchro_request req = { .type = IPROTO_RAFT_PROMOTE, .replica_id = prev_leader_id, .origin_id = instance_id, .lsn = promote_lsn, .term = raft->term, }; --> txn_limbo_process_begin(&txn_limbo); --> txn_limbo_write_promote(&txn_limbo, req.lsn, req.term); txn_limbo_process_core(&txn_limbo, &req); assert(txn_limbo_is_empty(&txn_limbo)); txn_limbo_process_commit(&txn_limbo); } thus console commands and applier are serialized. Or I miss something obvious?