From: Vladimir Davydov <vdavydov.dev@gmail.com> To: Kirill Shcherbatov <kshcherbatov@tarantool.org> Cc: tarantool-patches@freelists.org, kostja@tarantool.org Subject: Re: [PATCH v5 3/3] box: introduce func_index Date: Fri, 26 Jul 2019 15:15:36 +0300 [thread overview] Message-ID: <20190726121536.GA4659@esperanza> (raw) In-Reply-To: <38c49e4a186f40139488ad743fb0c37e458d5a65.1564134114.git.kshcherbatov@tarantool.org> On Fri, Jul 26, 2019 at 12:43:39PM +0300, Kirill Shcherbatov wrote: > diff --git a/src/box/index_def.h b/src/box/index_def.h > index 6dac28377..1d60c982b 100644 > --- a/src/box/index_def.h > +++ b/src/box/index_def.h > @@ -298,6 +302,25 @@ index_def_update_optionality(struct index_def *def, uint32_t min_field_count) > key_def_update_optionality(def->cmp_def, min_field_count); > } > > +/** > + * Update func pointer for a functional index key definition. > + * @param def Index def, containing key definitions to update. > + * @param func The func_index function pointer. > + */ > +static inline void > +index_def_set_func(struct index_def *def, struct func *func) > +{ > + assert(def->opts.func_id > 0 && > + def->key_def->for_func_index && def->key_def->for_func_index); for_func_index && for_func_index > + /* > + * Set func_index_func for functional index key > + * definition. It is used in key_list module to extract > + * a key for given tuple. > + */ > + def->key_def->func_index_func = func; > + def->cmp_def->func_index_func = NULL; Hmm, why is cmp_def->func_index_func set to NULL? > diff --git a/src/box/lua/upgrade.lua b/src/box/lua/upgrade.lua > index 02c1cb0ff..f570a1c08 100644 > --- a/src/box/lua/upgrade.lua > +++ b/src/box/lua/upgrade.lua > @@ -885,11 +885,29 @@ local function upgrade_func_to_2_2_1() > collation = 'unicode_ci'}}}) > end > > +local function create_func_index() > + log.info("Create _func_index space") > + local _func_index = box.space[box.schema.FUNC_INDEX_ID] > + local _space = box.space._space > + local _index = box.space._index > + local format = {{name='space_id', type='unsigned'}, > + {name='index_id', type='unsigned'}, > + {name='func_id', type='unsigned'}} > + _space:insert{_func_index.id, ADMIN, '_func_index', 'memtx', 0, > + setmap({}), format} > + _index:insert{_func_index.id, 0, 'primary', 'tree', {unique = true}, > + {{0, 'unsigned'}, {1, 'unsigned'}, {2, 'unsigned'}}} Why do we need to make all the three fields parts of the primary index? Shouldn't space and index id be enough? Other than that, the patch is fine by me.
next prev parent reply other threads:[~2019-07-26 12:15 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-07-26 9:43 [PATCH v5 0/3] box: functional indexes Kirill Shcherbatov 2019-07-26 9:43 ` [PATCH v5 1/3] box: introduce opts.is_multikey function option Kirill Shcherbatov 2019-07-26 9:43 ` [PATCH v5 2/3] box: introduce tuple_chunk infrastructure Kirill Shcherbatov 2019-07-26 9:43 ` [PATCH v5 3/3] box: introduce func_index Kirill Shcherbatov 2019-07-26 12:15 ` Vladimir Davydov [this message] 2019-07-26 13:58 ` [tarantool-patches] " Kirill Shcherbatov 2019-07-26 17:42 ` [tarantool-patches] [PATCH v5 0/3] box: functional indexes Kirill Yukhin 2019-07-26 19:00 ` [tarantool-patches] " Vladislav Shpilevoy -- strict thread matches above, loose matches on Subject: below -- 2019-07-25 18:39 Kirill Shcherbatov 2019-07-25 18:39 ` [PATCH v5 3/3] box: introduce func_index Kirill Shcherbatov 2019-07-26 9:49 ` Vladimir Davydov 2019-07-26 9:57 ` Konstantin Osipov 2019-07-26 10:10 ` 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=20190726121536.GA4659@esperanza \ --to=vdavydov.dev@gmail.com \ --cc=kostja@tarantool.org \ --cc=kshcherbatov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [PATCH v5 3/3] box: introduce func_index' \ /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