[PATCH v2 0/5] box: introduce multikey indexes in memtx

Kirill Shcherbatov kshcherbatov at tarantool.org
Tue Mar 19 15:32:05 MSK 2019


Multikey indexes allows you to automatically index set of documents
by JSON paths having array index placeholder "[*]". Multikey index
cannot be primary as it cannot be unique(by definition).
Multikey index parts must be compatible: only one "[*]" placeholder
is allowed in same position(for all JSON paths in index parts).

Changes in version 2:
    - introduced field_map_builder class to perform field_map
      preparation
    - reworked code: new helpers json_path_is_multikey and
      new flag json_path_cmp(is_weak_cmp = true)
    - rebased to actual tuple hints head
    - new tests

http://github.com/tarantool/tarantool/tree/kshch/gh-1257-multikey-indexes
https://github.com/tarantool/tarantool/issues/1257

Kirill Shcherbatov (5):
  lib: introduce json_path_is_multikey helper
  lib: introduce is_weak_cmp flag for json_path_cmp
  box: move offset_slot init to tuple_format_add_field
  box: introduce field_map_builder for field_map init
  box: introduce multikey indexes in memtx

 src/box/CMakeLists.txt            |   1 +
 src/box/errcode.h                 |   1 +
 src/box/index_def.c               |  27 ++-
 src/box/key_def.c                 |  14 +-
 src/box/key_def.h                 |  18 ++
 src/box/memtx_engine.c            |  10 +-
 src/box/memtx_space.c             |  18 ++
 src/box/memtx_tree.c              | 183 ++++++++++++++---
 src/box/tuple.c                   |  40 +++-
 src/box/tuple.h                   | 111 +++++++++--
 src/box/tuple_compare.cc          |  87 +++++++--
 src/box/tuple_extract_key.cc      |   2 +-
 src/box/tuple_field_map.c         |  80 ++++++++
 src/box/tuple_field_map.h         | 163 ++++++++++++++++
 src/box/tuple_format.c            | 315 ++++++++++++++++++------------
 src/box/tuple_format.h            |   7 +-
 src/box/vinyl.c                   |   8 +-
 src/box/vy_stmt.c                 |   9 +-
 src/lib/json/json.c               |  25 ++-
 src/lib/json/json.h               |  14 +-
 test/box/misc.result              |   1 +
 test/engine/json.result           |  13 --
 test/engine/json.test.lua         |   7 -
 test/engine/multikey_idx.result   | 228 +++++++++++++++++++++
 test/engine/multikey_idx.test.lua |  67 +++++++
 test/unit/json.c                  |  20 +-
 test/unit/json.result             |   7 +-
 27 files changed, 1242 insertions(+), 234 deletions(-)
 create mode 100644 src/box/tuple_field_map.c
 create mode 100644 src/box/tuple_field_map.h
 create mode 100644 test/engine/multikey_idx.result
 create mode 100644 test/engine/multikey_idx.test.lua

-- 
2.21.0




More information about the Tarantool-patches mailing list