[tarantool-patches] [PATCH] lua: fix for option changed by tarantoolctl

Konstantin Belyavskiy k.belyavskiy at tarantool.org
Fri Jul 20 19:53:59 MSK 2018


During startup tarantoolctl ignores 'pid_file' option and
set it to default value.
This cause a fault if user tries to execute config with option set.

Closes #3214
---
ticket: https://github.com/tarantool/tarantool/issues/3214
branch: https://github.com/tarantool/tarantool/tree/kbelyavs/gh-3214-tarantoolctl-pidfile-fix
 extra/dist/tarantoolctl.in | 5 ++++-
 src/box/lua/load_cfg.lua   | 8 +++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
index 507ebe8bf..0c806d086 100755
--- a/extra/dist/tarantoolctl.in
+++ b/extra/dist/tarantoolctl.in
@@ -443,7 +443,10 @@ local function wrapper_cfg(cfg)
         end
     end
     -- force these startup options
-    cfg.pid_file = default_cfg.pid_file
+    if cfg.pid_file ~= default_cfg.pid_file then
+        log.warn("then using with tarantoolctl option 'pid_file' is ignored")
+        cfg.pid_file = default_cfg.pid_file
+    end
     if os.getenv('USER') ~= default_cfg.username then
         cfg.username = default_cfg.username
     else
diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
index 4910ec4b6..89ebbd368 100644
--- a/src/box/lua/load_cfg.lua
+++ b/src/box/lua/load_cfg.lua
@@ -328,7 +328,13 @@ local function reload_cfg(oldcfg, cfg)
     -- iterate over original table because prepare_cfg() may store NILs
     for key, val in pairs(cfg) do
         if dynamic_cfg[key] == nil and oldcfg[key] ~= val then
-            box.error(box.error.RELOAD_CFG, key);
+            -- then started with tarantoolctl this option is set to
+            -- default value, see #3214.
+            if key == "pid_file" then
+                log.info("Can't set option '%s' dynamically", key)
+            else
+                box.error(box.error.RELOAD_CFG, key);
+            end
         end
     end
     for key in pairs(cfg) do
-- 
2.14.3 (Apple Git-98)





More information about the Tarantool-patches mailing list