[tarantool-patches] Re: [PATCH v1 1/1] box: support reload whole module

  • From: Vladimir Davydov <vdavydov.dev@xxxxxxxxx>
  • To: Kirill Shcherbatov <kshcherbatov@xxxxxxxxxxxxx>
  • Date: Thu, 12 Jul 2018 12:31:21 +0300

On Thu, Jul 12, 2018 at 11:27:13AM +0300, Kirill Shcherbatov wrote:

During our verbal discussion with Kirill, he noticed that the fact that
box.schema.func.reload() reloads the whole module when it is passed a
function name is rather confusing: the user may not know that and call
box.schema.func.reload() once per each used function, in which case he
will effectively reload the whole module that contains those functions
multiple times, which is pointless. Turns out Kirill isn't the only one
who finds such an API weird, see

  https://github.com/tarantool/tarantool/issues/910#issuecomment-331435227

I talked to Kostja and he doesn't mind banning this API, i.e. making
box.schema.func.reload() interpret its argument only as a module name.

So let's rework this patch so that box_func_reload() directly calls
module_reload(), and remove func_reload() altogether. As for the access
checks, box_func_reload() should work only if the caller has the global
execute privilege.

Closes #2946.

@TarantoolBot document
Title: fixed module reload
There was a bug in tarantool documentation:
https://tarantool.io/en/doc/1.7/book/box/
box_schema/#lua-function.box.schema.func.reload
Now it is allowed to reload all functions in loadable
module via one method. Legacy method including finction
name is forbidden.
box.schema.func.reload("utils")       -- ok since now
box.schema.func.reload("utils.func1") -- forbidden since now

Global reload is still unsupported because it seems
to be useless.
box.schema.func.reload()              -- invalid!
---
https://github.com/tarantool/tarantool/compare/kshch/gh-2946-module-reload
https://github.com/tarantool/tarantool/issues/2946

 src/box/call.c                | 23 +++++++++++++----------
 src/box/call.h                |  9 ++++++++-
 src/box/errcode.h             |  1 +
 src/box/func.c                | 16 ----------------
 src/box/func.h                | 11 ++++++++++-
 src/box/lua/call.c            |  6 +++---
 src/box/lua/schema.lua        |  2 +-
 test/box/func_reload.result   | 23 ++++++++---------------
 test/box/func_reload.test.lua | 14 ++++++--------
 test/box/misc.result          |  1 +
 10 files changed, 51 insertions(+), 55 deletions(-)

Looks good to me.

Other related posts: