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 9B2406E454; Mon, 28 Feb 2022 11:24:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9B2406E454 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1646036675; bh=xs8K+oKBX62AkyGICAPzM6eJtB1R2MDONb4uPYc/p7c=; 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=mONcn4eVafXx79TczSDImY0Ti11K8Hhv4C1Y+vtjt/4WPEdquK57xzhFoDWH3dOds /O7/LbzrGV5aL/oDmhq3cJ0u9iihPAjHxhMVrNSDHHqYDSRYUZJjNfjAW7fnD1B6O4 wZsBWsK9/D1tFnH2AHBvQ9oc0Pe/uuOQgdTxKlYw= Received: from smtp59.i.mail.ru (smtp59.i.mail.ru [217.69.128.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id D3B5F6E454 for ; Mon, 28 Feb 2022 11:24:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D3B5F6E454 Received: by smtp59.i.mail.ru with esmtpa (envelope-from ) id 1nObKa-0006u4-VT; Mon, 28 Feb 2022 11:24:33 +0300 Message-ID: Date: Mon, 28 Feb 2022 11:24:32 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-GB To: Cyrill Gorcunov , tml References: <20220224201841.412565-1-gorcunov@gmail.com> <20220224201841.412565-3-gorcunov@gmail.com> In-Reply-To: <20220224201841.412565-3-gorcunov@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD95E12778296193B1F46C6EE00CDC9538AEBC73806DEDBFD7600894C459B0CD1B9EF9D873AD479F726040CC706CD0CCBADC299CA69C3846B7258021F299768AAFE X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7586684DD3F99AA20EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637663000D94094A5D68638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8F8F4800EDB706C823B94FE5A2DB4EC1E117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC8C7ADC89C2F0B2A5A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18BDFBBEFFF4125B51D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EEC24E1E72F37C03A068E75A379BAF682BD8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3A816C540FC8EEC309735652A29929C6CC4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637870CFFD37CCFDD3AEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: 0D63561A33F958A512CE433B78631E3282F261EABDCB119925F45B5FCE03AA22D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75F78D6440C3F49C15410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34B9F55CA4D2956E303050C1F0349D1DCBC881ED9A1B4BC47D4C6CAE33E085AE30E2E5D406E815A44F1D7E09C32AA3244C7BDD51701DD8E4B348FCBCFD8E0835E1F165894D92D62706927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojNOYcSwubUYJUIc+cIvu9nw== X-Mailru-Sender: 11C2EC085EDE56FA38FD4C59F7EFE407A6CB12BA7DFEE506AD1788388ABC7A36EAA56BCEEA552A946BB2E709EA627F343C7DDD459B58856F0E45BC603594F5A135B915D4279FF0574198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v30 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: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Cc: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 24.02.2022 23:18, Cyrill Gorcunov пишет: > --- Thanks for the fixes! Only two minor comments left. Please find them below. Also, please, consider this diff fixing code style: ============================== diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c index 7607e084b..8634b63b4 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -726,8 +726,7 @@ txn_limbo_wait_empty(struct txn_limbo *limbo, double timeout)  }  void -txn_limbo_apply(struct txn_limbo *limbo, -               const struct synchro_request *req) +txn_limbo_apply(struct txn_limbo *limbo, const struct synchro_request *req)  {         assert(latch_is_locked(&limbo->promote_latch)); @@ -792,8 +791,7 @@ txn_limbo_apply(struct txn_limbo *limbo,  }  void -txn_limbo_process(struct txn_limbo *limbo, -                 const struct synchro_request *req) +txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req)  {         txn_limbo_begin(limbo);         txn_limbo_apply(limbo, req); diff --git a/src/box/txn_limbo.h b/src/box/txn_limbo.h index 1f5da7abb..8c9671ca5 100644 --- a/src/box/txn_limbo.h +++ b/src/box/txn_limbo.h @@ -235,8 +235,7 @@ txn_limbo_replica_term(const struct txn_limbo *limbo, uint32_t replica_id)   * data from it. The check is only valid when elections are enabled.   */  static inline bool -txn_limbo_is_replica_outdated(struct txn_limbo *limbo, -                             uint32_t replica_id) +txn_limbo_is_replica_outdated(struct txn_limbo *limbo, uint32_t replica_id)  {         latch_lock(&limbo->promote_latch);         uint64_t v = vclock_get(&limbo->promote_term_map, replica_id); ============================== ... > diff --git a/src/box/txn_limbo.h b/src/box/txn_limbo.h > index 53e52f676..1f5da7abb 100644 > --- a/src/box/txn_limbo.h > +++ b/src/box/txn_limbo.h > @@ -31,6 +31,7 @@ > */ > #include "small/rlist.h" > #include "vclock/vclock.h" > +#include "latch.h" > > #include > > @@ -147,6 +148,14 @@ struct txn_limbo { > * limbo and raft are in sync and the terms are the same. > */ > uint64_t promote_greatest_term; > + /** > + * To order access to the promote data. > + */ > + struct latch promote_latch; > + /** > + * A flag to inform if limbo is locked (for tests mostly). > + */ > + bool promote_is_latched; 1. As I can see, you only use `promote_is_latched` to     push box.info.synchro.queue.latched.    I suggest you simply use latch_is_locked instead. 2. Also, let's rename `box.info.synchro.queue.latched`    to something like `box.info.synchro.queue.busy`.    Feel free to suggest other variants.    "Latched" just sounds too technical IMO. > /** > * Maximal LSN gathered quorum and either already confirmed in WAL, or > * whose confirmation is in progress right now. Any attempt to confirm > @@ -226,11 +235,14 @@ txn_limbo_replica_term(const struct txn_limbo *limbo, uint32_t replica_id) > * data from it. The check is only valid when elections are enabled. > */ > static inline bool > -txn_limbo_is_replica_outdated(const struct txn_limbo *limbo, > +txn_limbo_is_replica_outdated(struct txn_limbo *limbo, > uint32_t replica_id) > { > - return txn_limbo_replica_term(limbo, replica_id) < > - limbo->promote_greatest_term; > + latch_lock(&limbo->promote_latch); > + uint64_t v = vclock_get(&limbo->promote_term_map, replica_id); > + bool res = v < limbo->promote_greatest_term; > + latch_unlock(&limbo->promote_latch); > + return res; > } > > ... -- Serge Petrenko