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/3] box: persistent Lua functions Date: Tue, 14 May 2019 16:29:19 +0300 [thread overview] Message-ID: <cover.1557839195.git.kshcherbatov@tarantool.org> (raw) Lua functions managed by Tarantool are called 'persistent'. They are stored in snapshoot and are available after server restart. No regular Lua functions, nor C functions can't be 'persistent' because they depend on non-only snapshot environment (libc, global variables etc.). 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. Persistent Lua functions are exported in box.schema.func.persistent folder. They may be called via .call in exported object or via netbox:call. In scope of this patch, refactored func module API: in case of persistent Lua function update may be insecure operation, so we need a machinery to transactionally update the object. http://github.com/tarantool/tarantool/tree/kshch/gh-4182-persistent-lua-functions https://github.com/tarantool/tarantool/issues/4182 Kirill Shcherbatov (3): box: refactor box_lua_find helper schema: extend _func space to persist lua functions box: extend box.schema.func with persistent folder src/box/CMakeLists.txt | 1 + src/box/alter.cc | 87 ++++++++---- src/box/bootstrap.snap | Bin 4374 -> 4393 bytes src/box/call.c | 2 +- src/box/func.c | 225 +++++++++++++++++++++++++++++- src/box/func.h | 21 ++- src/box/func_def.h | 10 +- src/box/lua/call.c | 122 +++++++--------- src/box/lua/call.h | 4 +- src/box/lua/init.c | 2 + src/box/lua/schema.lua | 8 +- src/box/lua/upgrade.lua | 15 ++ src/box/lua/util.c | 102 ++++++++++++++ src/box/lua/util.h | 59 ++++++++ src/box/schema.cc | 47 +++---- src/box/schema.h | 31 ++-- src/box/schema_def.h | 1 + test/box-py/bootstrap.result | 6 +- test/box/access_misc.result | 4 +- test/box/persistent_func.result | 185 ++++++++++++++++++++++++ test/box/persistent_func.test.lua | 83 +++++++++++ 21 files changed, 858 insertions(+), 157 deletions(-) create mode 100644 src/box/lua/util.c create mode 100644 src/box/lua/util.h create mode 100644 test/box/persistent_func.result create mode 100644 test/box/persistent_func.test.lua -- 2.21.0
next reply other threads:[~2019-05-14 13:29 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-14 13:29 Kirill Shcherbatov [this message] 2019-05-14 13:29 ` [PATCH v1 1/3] box: refactor box_lua_find helper Kirill Shcherbatov 2019-05-17 12:33 ` [tarantool-patches] " Kirill Shcherbatov 2019-05-14 13:29 ` [PATCH v1 2/3] schema: extend _func space to persist lua functions Kirill Shcherbatov 2019-05-14 18:21 ` [tarantool-patches] " Konstantin Osipov 2019-05-17 12:33 ` [tarantool-patches] " Kirill Shcherbatov 2019-05-17 15:29 ` Konstantin Osipov 2019-05-14 13:29 ` [PATCH v1 3/3] box: extend box.schema.func with persistent folder Kirill Shcherbatov 2019-05-14 18:24 ` [tarantool-patches] " Konstantin Osipov
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.1557839195.git.kshcherbatov@tarantool.org \ --to=kshcherbatov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=vdavydov.dev@gmail.com \ --subject='Re: [PATCH v1 0/3] box: persistent Lua functions' \ /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