[PATCH v5 3/3] box: introduce func_index
Vladimir Davydov
vdavydov.dev at gmail.com
Fri Jul 26 12:49:58 MSK 2019
On Thu, Jul 25, 2019 at 09:39:45PM +0300, Kirill Shcherbatov wrote:
> diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
> index 334f49d51..61790c1c3 100644
> --- a/src/box/lua/schema.lua
> +++ b/src/box/lua/schema.lua
> @@ -1081,11 +1096,18 @@ box.schema.index.create = function(space_id, name, options)
> if parts_can_be_simplified then
> parts = simplify_index_parts(parts)
> end
> + if index_opts.func ~= nil and type(index_opts.func) == 'string' then
> + index_opts.func = func_id_by_name(index_opts.func)
> + end
> local sequence_proxy = space_sequence_alter_prepare(format, parts, options,
> space_id, iid,
> space.name, name)
> _index:insert{space_id, iid, name, options.type, index_opts, parts}
> space_sequence_alter_commit(sequence_proxy)
> + if index_opts.func ~= nil then
> + local _func_index = box.space[box.schema.FUNC_INDEX_ID]
> + _func_index:insert{space_id, iid, index_opts.func}
> + end
> return space.index[name]
> end
There's one thing about _func_index space that keeps bothering me: since
insertion of a tuple into this space is a yielding operation and this
operation is executed after insertion of a tuple into _index, we won't
be able to wrap space.create_index() into box.begin/commit, because only
the first DDL statement in a transaction is allowed to be yielding.
I assume that it's not important, because the corresponding ticket
(#4348) is scheduled for 2.3 so we will probably figure something out
until then (may be, implement support of yielding statements in DDL).
More information about the Tarantool-patches
mailing list