From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 13 Jun 2019 17:27:35 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] [PATCH v3 10/14] core: latch_unlock_external routine Message-ID: <20190613142735.f4aoatxq7kxnlwps@esperanza> References: <98f0889a17245be64f1753012419e92c7ceef4e7.1560112747.git.georgy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <98f0889a17245be64f1753012419e92c7ceef4e7.1560112747.git.georgy@tarantool.org> To: Georgy Kirichenko Cc: tarantool-patches@freelists.org List-ID: On Sun, Jun 09, 2019 at 11:44:39PM +0300, Georgy Kirichenko wrote: > Allow unlock a latch from a fiber which isn't owner of the latch. This > is required to process transaction triggers asynchronously. > > Prerequisites: #1254 > --- > src/box/alter.cc | 2 +- > src/lib/core/latch.h | 13 +++++++++++-- > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/src/box/alter.cc b/src/box/alter.cc > index 671209b51..adf30c9b6 100644 > --- a/src/box/alter.cc > +++ b/src/box/alter.cc > @@ -3446,7 +3446,7 @@ unlock_after_dd(struct trigger *trigger, void *event) > { > (void) trigger; > (void) event; > - latch_unlock(&schema_lock); > + latch_unlock_external(&schema_lock); > } > > static void > diff --git a/src/lib/core/latch.h b/src/lib/core/latch.h > index 49c59cf63..b27d6dd08 100644 > --- a/src/lib/core/latch.h > +++ b/src/lib/core/latch.h > @@ -159,9 +159,8 @@ latch_trylock(struct latch *l) > * \copydoc box_latch_unlock > */ > static inline void > -latch_unlock(struct latch *l) > +latch_unlock_external(struct latch *l) > { > - assert(l->owner == fiber()); > l->owner = NULL; > if (!rlist_empty(&l->queue)) { > struct fiber *f = rlist_first_entry(&l->queue, > @@ -176,6 +175,16 @@ latch_unlock(struct latch *l) > } > } > > +/** > + * \copydoc box_latch_unlock > + */ > +static inline void > +latch_unlock(struct latch *l) > +{ > + assert(l->owner == fiber()); > + latch_unlock_external(l); > +} Again, looks like a temporary hack to me. I would rather not commit it. The right way would be getting rid of the schema_lock. I know that you have tried, but failed because of vylog. I'll look what we can do about it.