From: "n.pettik" <korablev@tarantool.org> To: tarantool-patches@freelists.org Cc: Imeev Mergen <imeevma@tarantool.org> Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: make assertion to check only ephemeral spaces Date: Sat, 25 May 2019 16:48:36 +0300 [thread overview] Message-ID: <91C455A6-F115-4C63-B28C-C484A38BE5F8@tarantool.org> (raw) In-Reply-To: <20190521150622.GA15451@tarantool.org> > > From 16309a0e955f32a866585eb71e429080f716d7bf Mon Sep 17 00:00:00 2001 > From: Mergen Imeev <imeevma@gmail.com> > Date: Fri, 17 May 2019 17:56:56 +0300 > Subject: [PATCH] sql: do not set is_temporary for ephemeral spaces > > Up to this point, the is_temporary flag has been set in all > ephemeral spaces. > > At some point, it became possible to use spaces created in Lua in > SQL statements. Since it is allowed to create temporary spaces in > Lua, not all temporary spaces in SQL are ephemeral. To separate > the temporary and ephemeral spaces, is_ephemeral flag is now set > in the ephemeral spaces and is_temporary flag is not set. > > Close #4139 You slightly misunderstood my initial intention. There are two kinds of what we call ephemeral spaces: first ones are real ephemeral spaces which are created during VDBE runtime to hold materialised intermediate results of query execution. They are destroyed when query is finished. Second type consists of surrogate defs allocated using region and they are used to keep meta-information during compilation of DML queries. They are not real space object and I have no idea why we call them ‘ephemeral’, I guess it is a big mess. A while ago, we had to use some marked for such surrogate spaces to process special clean-up operations. And it was decided that we would use ‘is_temporary’ flag. I’ve force pushed my updates (commit message + code fixes). Message: sql: replace is_temprorary with is_ephemeral for surrogate defs Up to this point, the is_temporary flag has been set for surrogate space definitions used to transfer meta-information during compilation stage of DML queries (CREATE TABLE/INDEX etc). At some point, it became possible to use spaces created in Lua in SQL statements. Since it is allowed to create temporary spaces in Lua, not all temporary spaces in SQL are surrogate wrappers. To separate real temporary spaces (i.e. which came from space cache) from surrogate ones, is_ephemeral flag is now set in such spaces instead of is_temporary. Note that there can't be mess between these flags since ephemeral spaces can exist only during execution of VDBE bytecode. Also note that flag is required only for debugging facilities. Close #4139 Diff: diff --git a/src/box/space.c b/src/box/space.c index 6380a0af3..243e7da2f 100644 --- a/src/box/space.c +++ b/src/box/space.c @@ -194,6 +194,7 @@ space_new(struct space_def *def, struct rlist *key_list) struct space * space_new_ephemeral(struct space_def *def, struct rlist *key_list) { + assert(def->opts.is_temporary); assert(def->opts.is_ephemeral); struct space *space = space_new(def, key_list); if (space == NULL) diff --git a/src/box/space_def.c b/src/box/space_def.c index 0b9cc015c..d825def75 100644 --- a/src/box/space_def.c +++ b/src/box/space_def.c @@ -263,6 +263,7 @@ struct space_def* space_def_new_ephemeral(uint32_t field_count) { struct space_opts opts = space_opts_default; + opts.is_temporary = true; opts.is_ephemeral = true; struct space_def *space_def = space_def_new(0, 0, field_count, "ephemeral", diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c index b5d55b2e4..9cdeb051b 100644 --- a/src/box/tuple_format.c +++ b/src/box/tuple_format.c @@ -711,6 +711,7 @@ tuple_format_reuse(struct tuple_format **p_format) * Make sure they're unset. */ assert(format->dict->name_count == 0); + assert(format->is_temporary); mh_int_t key = mh_tuple_format_find(tuple_formats_hash, format, NULL); if (key != mh_end(tuple_formats_hash)) { @@ -736,6 +737,7 @@ tuple_format_add_to_hash(struct tuple_format *format) if(!format->is_ephemeral) return 0; assert(format->dict->name_count == 0); + assert(format->is_temporary); mh_int_t key = mh_tuple_format_put(tuple_formats_hash, (const struct tuple_format **)&format, NULL, NULL);
next prev parent reply other threads:[~2019-05-25 13:48 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-17 15:51 [tarantool-patches] " imeevma 2019-05-19 12:13 ` [tarantool-patches] " n.pettik 2019-05-21 15:06 ` Mergen Imeev 2019-05-25 13:48 ` n.pettik [this message] 2019-06-06 14:13 ` Kirill Yukhin
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=91C455A6-F115-4C63-B28C-C484A38BE5F8@tarantool.org \ --to=korablev@tarantool.org \ --cc=imeevma@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: make assertion to check only ephemeral spaces' \ /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