From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Georgy Kirichenko <georgy@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] [PATCH v3 2/5] Synchronize lua schema update with space cache
Date: Wed, 27 Mar 2019 13:03:51 +0300 [thread overview]
Message-ID: <20190327100351.gpo2befo6mulqw2k@esperanza> (raw)
In-Reply-To: <2c27dc3efab7420737653d3362570136d885dbb4.1553255718.git.georgy@tarantool.org>
On Fri, Mar 22, 2019 at 03:06:07PM +0300, Georgy Kirichenko wrote:
> Update lua schema as soon as space cache replace was done instead of
> doing this while on_commit trigger executes. In opposite then case
> schema changes would not be visible until commit was finished.
>
> Needed for: #2798
> ---
> src/box/alter.cc | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/src/box/alter.cc b/src/box/alter.cc
> index daaa9cd57..275e39dd5 100644
> --- a/src/box/alter.cc
> +++ b/src/box/alter.cc
> @@ -750,8 +750,6 @@ alter_space_commit(struct trigger *trigger, void *event)
> op->commit(alter, txn->signature);
> }
>
> - trigger_run_xc(&on_alter_space, alter->new_space);
> -
> alter->new_space = NULL; /* for alter_space_delete(). */
> /*
> * Delete the old version of the space, we are not
> @@ -787,6 +785,8 @@ alter_space_rollback(struct trigger *trigger, void * /* event */)
> space_swap_triggers(alter->new_space, alter->old_space);
> space_swap_fk_constraints(alter->new_space, alter->old_space);
> space_cache_replace(alter->new_space, alter->old_space);
> + trigger_run(&on_alter_space, alter->old_space);
> +
> alter_space_delete(alter);
> }
>
> @@ -888,6 +888,7 @@ alter_space_do(struct txn *txn, struct alter_space *alter)
> * cache with it.
> */
> space_cache_replace(alter->old_space, alter->new_space);
> + trigger_run_xc(&on_alter_space, alter->new_space);
The comment right above says that this function must not throw an
exception here so I guess we should use _xc free variant. Not that it
really matters, as on_alter_space trigger can only fail on OOM, which
is hardly ever possible.
>
> /*
> * Install transaction commit/rollback triggers to either
> @@ -1388,7 +1389,6 @@ on_drop_space_commit(struct trigger *trigger, void *event)
> {
> (void) event;
> struct space *space = (struct space *)trigger->data;
> - trigger_run_xc(&on_alter_space, space);
> space_delete(space);
> }
>
> @@ -1403,6 +1403,7 @@ on_drop_space_rollback(struct trigger *trigger, void *event)
> (void) event;
> struct space *space = (struct space *)trigger->data;
> space_cache_replace(NULL, space);
> + trigger_run(&on_alter_space, space);
> }
>
> /**
> @@ -1412,8 +1413,7 @@ static void
> on_create_space_commit(struct trigger *trigger, void *event)
> {
> (void) event;
> - struct space *space = (struct space *)trigger->data;
> - trigger_run_xc(&on_alter_space, space);
> + (void) trigger;
> }
The function is not used now. I guess it's okay to leave it, just in
case we want to extend it in the future.
>
> /**
> @@ -1429,6 +1429,7 @@ on_create_space_rollback(struct trigger *trigger, void *event)
> (void) event;
> struct space *space = (struct space *)trigger->data;
> space_cache_replace(space, NULL);
> + trigger_run(&on_alter_space, space);
> space_delete(space);
> }
>
> @@ -1672,6 +1673,7 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event)
> * execution on a replica.
> */
> space_cache_replace(NULL, space);
> + trigger_run_xc(&on_alter_space, space);
Agagin, we must no throw exceptions here.
> /*
> * Do not forget to update schema_version right after
> * inserting the space to the space_cache, since no
> @@ -1764,6 +1766,7 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event)
> * execution on a replica.
> */
> space_cache_replace(old_space, NULL);
> + trigger_run_xc(&on_alter_space, old_space);
> /*
> * Do not forget to update schema_version right after
> * deleting the space from the space_cache, since no
I think we should've fixed on_alter_sequence trigger in the scope of
this issue, too.
The patch has been pushed to master, 2.1, and 1.10 by Kostja.
I guess we can address the minor hitches I pointed out above in
a separate 'review-fix' patch.
next prev parent reply other threads:[~2019-03-27 10:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-22 12:06 [tarantool-patches] [PATCH v3 0/5] Transaction in replication protocol Georgy Kirichenko
2019-03-22 12:06 ` [tarantool-patches] [PATCH v3 1/5] Abort vinyl index creation in case of truncation rollback Georgy Kirichenko
2019-03-27 9:59 ` Vladimir Davydov
2019-03-22 12:06 ` [tarantool-patches] [PATCH v3 2/5] Synchronize lua schema update with space cache Georgy Kirichenko
2019-03-27 10:03 ` Vladimir Davydov [this message]
2019-03-27 10:32 ` Vladimir Davydov
2019-03-27 11:45 ` [tarantool-patches] " Konstantin Osipov
2019-03-22 12:06 ` [tarantool-patches] [PATCH v3 3/5] Require for single statement not autocommit in case of ddl Georgy Kirichenko
2019-03-27 10:49 ` Vladimir Davydov
2019-03-22 12:06 ` [tarantool-patches] [PATCH v3 4/5] Transaction support for applier Georgy Kirichenko
2019-03-27 11:41 ` Vladimir Davydov
2019-03-27 11:48 ` Vladimir Davydov
2019-03-22 12:06 ` [tarantool-patches] [PATCH v3 5/5] Raise an error if remote transaction produces non-local changes Georgy Kirichenko
2019-03-27 12:06 ` Vladimir Davydov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190327100351.gpo2befo6mulqw2k@esperanza \
--to=vdavydov.dev@gmail.com \
--cc=georgy@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH v3 2/5] Synchronize lua schema update with space cache' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox