From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 4E5C32A246 for ; Wed, 20 Mar 2019 16:31:48 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eRyLz9-vh5fm for ; Wed, 20 Mar 2019 16:31:48 -0400 (EDT) Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [94.100.177.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 057522A582 for ; Wed, 20 Mar 2019 16:31:48 -0400 (EDT) From: Georgy Kirichenko Subject: [tarantool-patches] [PATCH 2/3] Synchronize lua schema update with space cache Date: Wed, 20 Mar 2019 23:31:34 +0300 Message-Id: <95afa83e8d6118d2a0e4a570791bab6c10f20836.1553112720.git.georgy@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: Georgy Kirichenko 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 84e74ee89..d4cc5c0cc 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); /* * Install transaction commit/rollback triggers to either @@ -1387,7 +1388,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); } @@ -1402,6 +1402,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); } /** @@ -1411,8 +1412,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; } /** @@ -1428,6 +1428,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); } @@ -1677,6 +1678,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); /* * Do not forget to update schema_version right after * inserting the space to the space_cache, since no @@ -1769,6 +1771,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 -- 2.21.0