From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Georgy Kirichenko <georgy@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] [PATCH 1/2] Update lua space cache just after creation
Date: Thu, 30 Aug 2018 15:06:57 +0300 [thread overview]
Message-ID: <20180830120657.fhlkoqvowzckashl@esperanza> (raw)
In-Reply-To: <52f6dd8a94f65030216f78796b8ed3d7f91f5eb2.1535472838.git.georgy@tarantool.org>
On Tue, Aug 28, 2018 at 07:19:12PM +0300, Georgy Kirichenko wrote:
> The lua space cache (box.space.*) should be valid just after space is
> created because space is ready to accept new records or does not exists
> before wal would be written. So invoke a space create/drop trigger after
> a space is changed and recall it in a case of rollback.
>
> Relates: 3159
Nit: should be
Needed for #3159
> diff --git a/src/box/alter.cc b/src/box/alter.cc
> index a6299a12e..b2758a4d9 100644
> --- a/src/box/alter.cc
> +++ b/src/box/alter.cc
> @@ -1626,12 +1616,10 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event)
> * so it's safe to simply drop the space on
> * rollback.
> */
> - struct trigger *on_commit =
> - txn_alter_trigger_new(on_create_space_commit, space);
> - txn_on_commit(txn, on_commit);
> struct trigger *on_rollback =
> txn_alter_trigger_new(on_create_space_rollback, space);
> txn_on_rollback(txn, on_rollback);
> + trigger_run_xc(&on_alter_space, space);
> } else if (new_tuple == NULL) { /* DELETE */
> access_check_ddl(old_space->def->name, old_space->def->id,
> old_space->def->uid, SC_SPACE, PRIV_D, true);
> @@ -1674,6 +1662,7 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event)
> struct trigger *on_rollback =
> txn_alter_trigger_new(on_drop_space_rollback, space);
> txn_on_rollback(txn, on_rollback);
> + trigger_run_xc(&on_alter_space, old_space);
> } else { /* UPDATE, REPLACE */
> assert(old_space != NULL && new_tuple != NULL);
> struct space_def *def =
> @@ -1730,6 +1719,7 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event)
> (void) new UpdateSchemaVersion(alter);
> alter_space_do(txn, alter);
> alter_guard.is_active = false;
> + trigger_run_xc(&on_alter_space, alter->new_space);
> }
> }
>
> @@ -1931,6 +1921,7 @@ on_replace_dd_index(struct trigger * /* trigger */, void *event)
> (void) new UpdateSchemaVersion(alter);
> alter_space_do(txn, alter);
> scoped_guard.is_active = false;
> + trigger_run_xc(&on_alter_space, alter->new_space);
> }
Why not call this trigger from alter_space_do?
> diff --git a/test/box/errinj.test.lua b/test/box/errinj.test.lua
> index a3ea659aa..32569f605 100644
> --- a/test/box/errinj.test.lua
> +++ b/test/box/errinj.test.lua
> @@ -557,3 +557,30 @@ fio = require('fio')
> #fio.glob(fio.pathjoin(box.cfg.vinyl_dir, box.space.test.id, 0, '*.index.inprogress')) == 0
>
> box.space.test:drop()
> +
> +
> +-- allocate a space id to prevent max space id update
Why?
> +trig = box.schema.space.create('trig')
> +trig_id = trig.id
> +trig:drop()
> +trig = nil
> +fiber = require('fiber')
> +ch = fiber.channel(1)
> +errinj = box.error.injection
> +test_run:cmd("setopt delimiter ';'")
> +-- check space exists just after creation
> +errinj.set("ERRINJ_WAL_WRITE", true);
> +_ = fiber.create(function ()
> + fiber.create(function ()
> + pcall(box.schema.space.create, 'trig', {id = trig_id})
> + ch:put(true)
> + end)
> + trig = box.space.trig
> + end);
> +trig ~= nil;
> +ch:get();
> +--and not exists after rollback
> +box.space.trig;
> +test_run:cmd("setopt delimiter ''");
> +
> +errinj.set("ERRINJ_WAL_WRITE", false)
next prev parent reply other threads:[~2018-08-30 12:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-28 16:19 [tarantool-patches] [PATCH 0/2] Box control event trigger Georgy Kirichenko
2018-08-28 16:19 ` [tarantool-patches] [PATCH 1/2] Update lua space cache just after creation Georgy Kirichenko
2018-08-30 12:06 ` Vladimir Davydov [this message]
2018-08-31 4:57 ` [tarantool-patches] " Georgy Kirichenko
2018-08-30 12:31 ` Konstantin Osipov
2018-08-31 4:53 ` Georgy Kirichenko
2018-08-28 16:19 ` [tarantool-patches] [PATCH 2/2] On ctl event trigger Georgy Kirichenko
2018-08-30 12:07 ` Vladimir Davydov
2018-08-30 12:10 ` Vladimir Davydov
2018-08-30 12:38 ` Vladimir Davydov
2018-08-30 13:04 ` Georgy Kirichenko
2018-08-30 13:21 ` Vladimir Davydov
2018-08-30 14:45 ` [tarantool-patches] " Konstantin Osipov
2018-08-30 14:40 ` Konstantin Osipov
2018-08-30 12:50 ` Konstantin Osipov
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=20180830120657.fhlkoqvowzckashl@esperanza \
--to=vdavydov.dev@gmail.com \
--cc=georgy@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH 1/2] Update lua space cache just after creation' \
/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