From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Kirill Shcherbatov Subject: [PATCH v3 0/4] box: functional indexes Date: Wed, 17 Jul 2019 04:20:41 +0300 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: tarantool-patches@freelists.org, vdavydov.dev@gmail.com Cc: kostja@tarantool.org, Kirill Shcherbatov List-ID: This patchset introduces functional indexes in memtx. Functional index is an index that use user-defined function to extract key by processed 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. Changes in version 2: - new space _func_index - new, new enhanced object model for functional indexes infrastructure Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-1260-functional-index-new Issue: https://github.com/tarantool/tarantool/issues/1260 Kirill Shcherbatov (4): box: introduce key_def->is_multikey flag box: refactor key_validate_parts to return key_end box: introduce tuple_extra infrastructure box: introduce functional indexes in memtx src/box/CMakeLists.txt | 4 +- src/box/alter.cc | 134 +++++- src/box/alter.h | 1 + src/box/bootstrap.snap | Bin 5863 -> 5914 bytes src/box/box.cc | 4 +- src/box/call.c | 8 +- src/box/errcode.h | 1 + src/box/functional_extractor.c | 118 +++++ src/box/functional_extractor.h | 101 ++++ src/box/functional_key.c | 228 ++++++++++ src/box/functional_key.h | 94 ++++ src/box/index.cc | 34 +- src/box/index.h | 38 +- src/box/index_def.c | 11 +- src/box/index_def.h | 9 +- src/box/key_def.c | 39 +- src/box/key_def.h | 42 +- src/box/lua/key_def.c | 7 +- src/box/lua/misc.cc | 2 +- src/box/lua/schema.lua | 20 + src/box/lua/space.cc | 15 + src/box/lua/upgrade.lua | 18 + src/box/memtx_bitset.c | 2 +- src/box/memtx_engine.c | 36 +- src/box/memtx_rtree.c | 2 +- src/box/memtx_space.c | 24 +- src/box/memtx_tree.c | 43 +- src/box/port.h | 4 +- src/box/schema.cc | 13 +- src/box/schema_def.h | 9 + src/box/sql.c | 3 +- src/box/sql/build.c | 2 +- src/box/sql/select.c | 3 +- src/box/sql/where.c | 2 +- src/box/tuple.c | 35 +- src/box/tuple.h | 103 ++++- src/box/tuple_bloom.c | 4 +- src/box/tuple_compare.cc | 228 +++++++--- src/box/tuple_extract_key.cc | 21 +- src/box/tuple_format.c | 58 ++- src/box/tuple_format.h | 32 ++ src/box/tuple_hash.cc | 7 +- src/box/vinyl.c | 20 +- src/box/vy_stmt.c | 2 + src/box/vy_stmt.h | 6 +- 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 | 708 +++++++++++++++++++++++++++++ test/engine/functional.test.lua | 240 ++++++++++ test/unit/luaT_tuple_new.c | 2 +- test/unit/merger.test.c | 8 +- test/unit/tuple_bigref.c | 2 +- test/unit/vy_iterators_helper.c | 2 +- test/vinyl/misc.result | 23 + test/vinyl/misc.test.lua | 9 + test/wal_off/alter.result | 2 +- 69 files changed, 2619 insertions(+), 227 deletions(-) create mode 100644 src/box/functional_extractor.c create mode 100644 src/box/functional_extractor.h create mode 100644 src/box/functional_key.c create mode 100644 src/box/functional_key.h create mode 100644 test/engine/functional.result create mode 100644 test/engine/functional.test.lua -- 2.22.0