[tarantool-patches] [PATCH v1 3/8] schema: rework _func system space format

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu May 30 16:10:15 MSK 2019



On 30/05/2019 13:45, Kirill Shcherbatov wrote:
> This patch updates a _func system space to prepare it for
> working with persistent functions. The format of the _func
> system space is
> [<id> UINT, <owner> UINT, <name> STR, <setuid> UINT,
>  <language> STR, <body> STR, <returns> STR,
>  <is_deterministic> BOOL]

As I understand, a user always should set a function
return type. Even for Lua functions (the only supported
language now, but SQL is coming).

In case of a functional index it should be exactly the same
type as of the index key. For example, if a functional index
has an alone unsigned key part, the function should return
exactly unsigned.

But what about alter? What if I had unsigned function and
key part, but decided to make it 'number' or 'scalar'? I can
do that with normal indexes and space formats, even without
index rebuild or check, for free. In two steps.

Or what if I had 'number', but decided to change it to 'scalar'?
Again, I can do that with index parts and space format, despite
non-transactional DDL, in two steps. Of course, all the tuples
are checked to conform the new stricter format, but it works, and
it is muuuch cheeper than recreate an index.

In your case alter is not possible at all. A user need to drop
the functional index, change type in space format, and create
the index again. Even if type change was 'unsigned' -> 'number'.
It does not match our 'Tarantool is schema less' feature.

Does not look ok, IMO. You could reuse the 'compatible types'
mechanism we use for gradual alter of index parts and space
format.



More information about the Tarantool-patches mailing list