From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Kirill Shcherbatov Subject: [PATCH v4 0/4] box: functional indexes Date: Wed, 24 Jul 2019 10:36:06 +0300 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: tarantool-patches@freelists.org, kostja@tarantool.org Cc: vdavydov.dev@gmail.com, Kirill Shcherbatov List-ID: This patchset introduces functional indexes in memtx. Functional index is an index that use user-defined function to extract a key by tuple. In current implementation only persistent deterministic sandboxed Lua function previously created with box.schema.func.create may be used in functional index. This provides a potential ability to support new languages to transparently extend supported extractors in future (e.g. SQL extractor, C extractor). Because an _index space is loaded before _func space, functional index initially created in "disabled state". Then, on loading from a new space _func_index, it completely rebuilds. Comment: - I'll send a follow-up patch to specify function by name a bit later. Changes in version 4: - functional indexes are implemented with memtx_tree vtab like version 1 did - index object doesn't use hash at all http://github.com/tarantool/tarantool/tree/kshch/gh-1260-functional-index-new https://github.com/tarantool/tarantool/issues/1260 Kirill Shcherbatov (4): box: introduce tuple_chunk infrastructure box: generalize memtx_multikey_tree methods box: refactor memtx_tree_delete_identical box: introduce functional indexes src/box/alter.h | 1 + src/box/errcode.h | 1 + src/box/func_key.h | 117 +++++ src/box/index.h | 9 + src/box/index_def.h | 16 + src/box/key_def.h | 22 +- src/box/schema_def.h | 9 + src/box/tuple.h | 28 ++ src/box/tuple_format.h | 9 + src/lib/salad/bps_tree.h | 9 +- src/box/func_key.c | 135 ++++++ src/box/index_def.c | 21 +- src/box/key_def.c | 32 +- src/box/lua/key_def.c | 2 +- src/box/memtx_engine.c | 29 ++ src/box/memtx_space.c | 18 + src/box/memtx_tree.c | 334 +++++++++++++- 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.c | 8 + src/box/vinyl.c | 9 +- src/box/vy_stmt.c | 2 + test/unit/luaT_tuple_new.c | 2 +- test/unit/merger.test.c | 4 +- src/box/CMakeLists.txt | 1 + src/box/alter.cc | 107 ++++- src/box/bootstrap.snap | Bin 5863 -> 5914 bytes src/box/index.cc | 28 ++ src/box/lua/schema.lua | 20 + src/box/lua/space.cc | 7 + src/box/lua/upgrade.lua | 18 + src/box/schema.cc | 12 +- src/box/tuple_compare.cc | 104 ++++- src/box/tuple_extract_key.cc | 29 +- src/box/tuple_hash.cc | 1 + test/app-tap/tarantoolctl.test.lua | 4 +- test/box-py/bootstrap.result | 5 + test/box/access.result | 3 + test/box/access.test.lua | 1 + test/box/access_misc.result | 132 +++--- test/box/access_sysview.result | 6 +- test/box/alter.result | 7 +- 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 | 1 + test/box/rtree_misc.result | 24 + test/box/rtree_misc.test.lua | 9 + test/engine/engine.cfg | 5 +- test/engine/functional.result | 690 +++++++++++++++++++++++++++++ test/engine/functional.test.lua | 233 ++++++++++ test/unit/bps_tree.cc | 8 +- test/unit/bps_tree.result | 4 +- test/vinyl/misc.result | 23 + test/vinyl/misc.test.lua | 9 + test/wal_off/alter.result | 2 +- 59 files changed, 2251 insertions(+), 133 deletions(-) create mode 100644 src/box/func_key.h create mode 100644 src/box/func_key.c create mode 100644 test/engine/functional.result create mode 100644 test/engine/functional.test.lua -- 2.22.0