[PATCH v1 0/8] box: functional indexes
Kirill Shcherbatov
kshcherbatov at tarantool.org
Thu May 30 13:45:27 MSK 2019
The patch set introduces persistent Lua functions and functional
indexes.
Lua functions managed by Tarantool are called 'persistent'.
They are stored in snapshoot and are available after server
restart.
Persistent Lua functions are exported in box.schema.func.persistent
folder. They may be called via .call exported object method or
via netbox:call.
Some restrictions must be accounted writing such routines:
1. only limited set of Lua functions and modules are available:
-assert -error -pairs -ipairs -next -pcall -xpcall -type
-print -select -string -tonumber -tostring -unpack -math -utf8;
2. global variables are forbidden.
Moreover all functions and their metadata are now exported in
box.func table (not only persistent). Persistent Lua functions
have box.func.FUNCNAME.call() method to execute it in interactive
console.
Persistent Lua functions are also available with net.box call.
A functional index use some registered persistent function as
key extractor.
You are not allowed to change functional index extractor function
while there are some functional indexes depends of it.
Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-1260-functional-index-new
Issue: https://github.com/tarantool/tarantool/issues/1260
Kirill Shcherbatov (8):
box: refactor box_lua_find helper
box: rework func cache update machinery
schema: rework _func system space format
box: load persistent Lua functions on creation
netbox: call persistent functions in netbox
box: export _func functions with box.func folder
box: introduce memtx_slab_alloc helper
box: introduce functional indexes in memtx
src/box/CMakeLists.txt | 1 +
src/box/alter.cc | 175 +++++++--
src/box/bootstrap.snap | Bin 4393 -> 4447 bytes
src/box/call.c | 2 +-
src/box/errcode.h | 1 +
src/box/func.c | 203 +++++++++-
src/box/func.h | 38 +-
src/box/func_def.h | 28 +-
src/box/index_def.c | 22 +-
src/box/index_def.h | 16 +
src/box/key_def.c | 13 +-
src/box/key_def.h | 31 +-
src/box/lua/call.c | 121 +++---
src/box/lua/call.h | 3 +-
src/box/lua/init.c | 2 +
src/box/lua/key_def.c | 2 +-
src/box/lua/schema.lua | 13 +-
src/box/lua/space.cc | 5 +
src/box/lua/tuple_fextract_key.c | 233 +++++++++++
src/box/lua/tuple_fextract_key.h | 100 +++++
src/box/lua/upgrade.lua | 22 +-
src/box/memtx_engine.c | 44 ++-
src/box/memtx_engine.h | 19 +
src/box/memtx_space.c | 18 +
src/box/memtx_tree.c | 355 ++++++++++++++++-
src/box/schema.cc | 49 ++-
src/box/schema.h | 31 +-
src/box/schema_def.h | 3 +
src/box/sql.c | 2 +-
src/box/sql/build.c | 2 +-
src/box/sql/select.c | 2 +-
src/box/sql/where.c | 2 +-
src/box/tuple_compare.cc | 112 +++++-
src/box/tuple_extract_key.cc | 33 +-
src/box/vinyl.c | 9 +-
src/lua/utils.c | 126 ++++++
src/lua/utils.h | 19 +
test/box-py/bootstrap.result | 6 +-
test/box/access_misc.result | 6 +-
test/box/bitset.result | 24 ++
test/box/bitset.test.lua | 9 +
test/box/hash.result | 24 ++
test/box/hash.test.lua | 9 +
test/box/misc.result | 2 +
test/box/persistent_func.result | 201 ++++++++++
test/box/persistent_func.test.lua | 88 +++++
test/box/rtree_misc.result | 24 ++
test/box/rtree_misc.test.lua | 9 +
test/engine/engine.cfg | 5 +-
test/engine/functional.result | 620 ++++++++++++++++++++++++++++++
test/engine/functional.test.lua | 214 +++++++++++
test/unit/luaT_tuple_new.c | 2 +-
test/unit/merger.test.c | 4 +-
53 files changed, 2898 insertions(+), 206 deletions(-)
create mode 100644 src/box/lua/tuple_fextract_key.c
create mode 100644 src/box/lua/tuple_fextract_key.h
create mode 100644 test/box/persistent_func.result
create mode 100644 test/box/persistent_func.test.lua
create mode 100644 test/engine/functional.result
create mode 100644 test/engine/functional.test.lua
--
2.21.0
More information about the Tarantool-patches
mailing list