box: check whether box is loaded in box.execute()
box.execute() initializes box if it is not initialized. For this sake,
box.execute() is another function (so called <box_load_and_execute>)
when box is not loaded: it loads box and calls 'real' box.execute().
However it is not enough: <box_load_and_execute> may be saved by a user
before box initialization and called after box loading or during box
loading from a separate fiber.
Note: calling <box_load_and_execute> during box loading is safe now, but
calling of box.execute() is not: the 'real' box.execute() does not
verify whether box is configured. It will be fixed in a further commit.
This commit changes <box_load_and_execute> to verify whether box is
initialized and to load box only when it is not loaded. Also it adds
appropriate locking around load_cfg() invocation from
<box_load_and_execute>.
While we're here, clarified contracts of functions that set box
configuration options.
Closes #4231
Co-developed-by:
Alexander Turenko <alexander.turenko@tarantool.org>
Showing
- src/box/lua/load_cfg.lua 65 additions, 4 deletionssrc/box/lua/load_cfg.lua
- test/box-tap/gh-4231-box-execute-idempotence.test.lua 37 additions, 0 deletionstest/box-tap/gh-4231-box-execute-idempotence.test.lua
- test/box-tap/gh-4231-box-execute-locking.test.lua 46 additions, 0 deletionstest/box-tap/gh-4231-box-execute-locking.test.lua
Please register or sign in to comment