Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org, vdavydov.dev@gmail.com
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [PATCH v1 0/8] box: functional indexes
Date: Thu, 30 May 2019 13:45:27 +0300	[thread overview]
Message-ID: <cover.1559212747.git.kshcherbatov@tarantool.org> (raw)

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

             reply	other threads:[~2019-05-30 10:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 10:45 Kirill Shcherbatov [this message]
2019-05-30 10:45 ` [PATCH v1 1/8] box: refactor box_lua_find helper Kirill Shcherbatov
2019-05-30 10:45 ` [PATCH v1 2/8] box: rework func cache update machinery Kirill Shcherbatov
2019-05-30 10:45 ` [PATCH v1 3/8] schema: rework _func system space format Kirill Shcherbatov
2019-05-30 12:06   ` [tarantool-patches] " Konstantin Osipov
2019-06-03 16:14     ` Vladimir Davydov
2019-05-30 13:10   ` Vladislav Shpilevoy
2019-05-30 10:45 ` [PATCH v1 4/8] box: load persistent Lua functions on creation Kirill Shcherbatov
2019-05-31  8:16   ` [tarantool-patches] " Konstantin Osipov
2019-06-03  8:26     ` [tarantool-patches] " Kirill Shcherbatov
2019-05-30 10:45 ` [PATCH v1 5/8] netbox: call persistent functions in netbox Kirill Shcherbatov
2019-05-30 10:45 ` [PATCH v1 6/8] box: export _func functions with box.func folder Kirill Shcherbatov
2019-06-03 16:22   ` Vladimir Davydov
2019-06-03 16:24   ` Vladimir Davydov
2019-05-30 10:45 ` [PATCH v1 7/8] box: introduce memtx_slab_alloc helper Kirill Shcherbatov
2019-05-30 10:45 ` [PATCH v1 8/8] box: introduce functional indexes in memtx Kirill Shcherbatov
2019-05-30 11:18 ` [tarantool-patches] [PATCH v1 0/8] box: functional indexes Vladislav Shpilevoy
2019-05-30 11:43   ` [tarantool-patches] " Kirill Shcherbatov
2019-05-30 11:47 ` [tarantool-patches] " Konstantin Osipov
2019-06-03 15:55 ` Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1559212747.git.kshcherbatov@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH v1 0/8] box: functional indexes' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox