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 E57566FC8F; Sun, 12 Sep 2021 18:45:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E57566FC8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1631461525; bh=PCzWNxLv+Zj9Y0MALpFzYlcufcElk7RW5Zbhhkh10m4=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=lTcZjBdQTi5IyN+/gLOwmHdFOoLABLHyXpAAWFLH/f2S/JevUZJPMp4qZPxcuasum Ow8ub/KLr9GGbZhxGwAj+cPe3W3BRQRoe6my3xdarZSAtBRVWoP9ALrzU/HLi6Dag4 yqvMEIfbHkCrVfGhM8ev/kwa7shuCMm1/CUHh0x8= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (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 4038E718A1 for ; Sun, 12 Sep 2021 18:44:13 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4038E718A1 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1mPReO-0006qD-Cb; Sun, 12 Sep 2021 18:44:12 +0300 To: Cyrill Gorcunov , tml References: <20210910152910.607398-1-gorcunov@gmail.com> <20210910152910.607398-5-gorcunov@gmail.com> Message-ID: <0adb2db1-4dd0-1975-83e4-dd525f59f264@tarantool.org> Date: Sun, 12 Sep 2021 17:44:11 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210910152910.607398-5-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD91AE02D33A9C88A2FECE56E2A292C9F7D3C69CC5C84EEB3A800894C459B0CD1B9E07D6BBAAC6BB287F3281030872C569506C63B2D39B5180C93525CDB3F0CE26E X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A40BC8721E3D31BBEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373CF509324F67ED188638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8F99F3A90ABECE48729279F3BF17BEFA0117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC566404C906FA8ADEA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520B28585415E75ADA96FD1C55BDD38FC3FD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6A1DCCEB63E2F10FB089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A54CB3F4CBC77BE6D2729FD7B2BF8E01963AD65418D7647769D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA756665624D6DDF07B5410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34D71B56C992F8AF19288EDF59A60029DAA870220A1518E69D397AEC580FBC053CF741F1825C9C39481D7E09C32AA3244C76CBD792AD4AF032FC11FE1CC38C310E5A1673A01BA68E40FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojuaewUBhMl4xaQCttIwKIRw== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D0CE98B49360A12627D2D1A26B04214D73841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v14 4/6] 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the patch! See 3 comments below. > diff --git a/src/box/applier.cc b/src/box/applier.cc > index b981bd436..845a7d015 100644 > --- a/src/box/applier.cc > +++ b/src/box/applier.cc > @@ -915,8 +916,10 @@ apply_synchro_row(uint32_t replica_id, struct xrow_header *row) > diag_set_journal_res(entry.base.res); > goto err; > } > + txn_limbo_term_unlock(&txn_limbo); > return 0; > err: > + txn_limbo_term_unlock(&txn_limbo); > diag_log(); 1. This function can go to 'err' before the lock is taken. 2. As for your complaint about the begin/commit/rollback API being not working because you can't unlock from a non-owner fiber - well, it works in your patch somehow, doesn't it? Why do you in your patch unlock here, but in the newly proposed API you only tried to unlock in the trigger? You could call commit/rollback from this function, like you do with unlock now. > return -1; > } > diff --git a/src/box/txn_limbo.h b/src/box/txn_limbo.h > index e0d17de4b..1ee815d1c 100644 > --- a/src/box/txn_limbo.h > +++ b/src/box/txn_limbo.h > @@ -217,14 +222,39 @@ txn_limbo_last_entry(struct txn_limbo *limbo) > in_queue); > } > > +/** Lock promote data. */ > +static inline void > +txn_limbo_term_lock(struct txn_limbo *limbo) > +{ > + latch_lock(&limbo->promote_latch); > +} > + > +/** Unlock promote data. */ > +static inline void > +txn_limbo_term_unlock(struct txn_limbo *limbo) > +{ > + latch_unlock(&limbo->promote_latch); > +} > + > +/** Fetch replica's term with lock taken. */ > +static inline uint64_t > +txn_limbo_replica_term_locked(struct txn_limbo *limbo, uint32_t replica_id) 3. Limbo can be made const here. > +{ > + assert(latch_is_locked(&limbo->promote_latch)); > + return vclock_get(&limbo->promote_term_map, replica_id); > +}