From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 26 Jul 2019 12:49:58 +0300 From: Vladimir Davydov Subject: Re: [PATCH v5 3/3] box: introduce func_index Message-ID: <20190726094958.GA4080@esperanza> References: <25789ea46e8fcec527bd7864209bb6ea2113dca5.1564079799.git.kshcherbatov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25789ea46e8fcec527bd7864209bb6ea2113dca5.1564079799.git.kshcherbatov@tarantool.org> To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org, kostja@tarantool.org, v.shpilevoy@tarantool.org List-ID: 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).