[tarantool-patches] [PATCH v3 10/14] core: latch_unlock_external routine
Vladimir Davydov
vdavydov.dev at gmail.com
Thu Jun 13 17:27:35 MSK 2019
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.
More information about the Tarantool-patches
mailing list