From 9c342579359c3b48eb836324250afad99c30235e Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja@tarantool.org> Date: Fri, 13 Feb 2015 22:54:19 +0300 Subject: [PATCH] startup: A quick fix for broken double initialization of listen port. --- src/box/lua/load_cfg.lua | 9 ++++++++- test/box/cfg.result | 18 +++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua index 60badb0213..85d5fcb1f6 100644 --- a/src/box/lua/load_cfg.lua +++ b/src/box/lua/load_cfg.lua @@ -131,6 +131,13 @@ local dynamic_cfg = { snapshot_count = box.internal.snapshot_daemon.set_snapshot_count, } +local dynamic_cfg_skip_at_load = { + wal_mode = true, + listen = true, + replication_source = true, +} + + local function prepare_cfg(cfg, default_cfg, template_cfg, modify_cfg, prefix) if cfg == nil then return {} @@ -255,7 +262,7 @@ local function load_cfg(cfg) ffi.C.load_cfg() for key, fun in pairs(dynamic_cfg) do local val = cfg[key] - if val ~= nil then + if val ~= nil and not dynamic_cfg_skip_at_load[key] then fun(cfg[key]) if val ~= default_cfg[key] then log.info("set '%s' configuration option to '%s'", key, val) diff --git a/test/box/cfg.result b/test/box/cfg.result index 16afded4a8..26e161104d 100644 --- a/test/box/cfg.result +++ b/test/box/cfg.result @@ -2,7 +2,7 @@ --# push filter 'admin: .*' to 'admin: <uri>' box.cfg.nosuchoption = 1 --- -- error: '[string "-- load_cfg.lua - internal file..."]:251: Attempt to modify a read-only +- error: '[string "-- load_cfg.lua - internal file..."]:258: Attempt to modify a read-only table' ... t = {} for k,v in pairs(box.cfg) do if type(v) ~= 'table' and type(v) ~= 'function' then table.insert(t, k..': '..tostring(v)) end end @@ -36,7 +36,7 @@ t -- must be read-only box.cfg() --- -- error: '[string "-- load_cfg.lua - internal file..."]:197: bad argument #1 to ''pairs'' +- error: '[string "-- load_cfg.lua - internal file..."]:204: bad argument #1 to ''pairs'' (table expected, got nil)' ... t = {} for k,v in pairs(box.cfg) do if type(v) ~= 'table' and type(v) ~= 'function' then table.insert(t, k..': '..tostring(v)) end end @@ -70,23 +70,23 @@ t -- check that cfg with unexpected parameter fails. box.cfg{sherlock = 'holmes'} --- -- error: '[string "-- load_cfg.lua - internal file..."]:153: Error: cfg parameter +- error: '[string "-- load_cfg.lua - internal file..."]:160: Error: cfg parameter ''sherlock'' is unexpected' ... -- check that cfg with unexpected type of parameter failes box.cfg{listen = {}} --- -- error: '[string "-- load_cfg.lua - internal file..."]:173: Error: cfg parameter +- error: '[string "-- load_cfg.lua - internal file..."]:180: Error: cfg parameter ''listen'' should be one of types: string, number' ... box.cfg{wal_dir = 0} --- -- error: '[string "-- load_cfg.lua - internal file..."]:167: Error: cfg parameter +- error: '[string "-- load_cfg.lua - internal file..."]:174: Error: cfg parameter ''wal_dir'' should be of type string' ... box.cfg{coredump = 'true'} --- -- error: '[string "-- load_cfg.lua - internal file..."]:167: Error: cfg parameter +- error: '[string "-- load_cfg.lua - internal file..."]:174: Error: cfg parameter ''coredump'' should be of type boolean' ... -------------------------------------------------------------------------------- @@ -94,17 +94,17 @@ box.cfg{coredump = 'true'} -------------------------------------------------------------------------------- box.cfg{slab_alloc_arena = "100500"} --- -- error: '[string "-- load_cfg.lua - internal file..."]:167: Error: cfg parameter +- error: '[string "-- load_cfg.lua - internal file..."]:174: Error: cfg parameter ''slab_alloc_arena'' should be of type number' ... box.cfg{sophia = "sophia"} --- -- error: '[string "-- load_cfg.lua - internal file..."]:161: Error: cfg parameter +- error: '[string "-- load_cfg.lua - internal file..."]:168: Error: cfg parameter ''sophia'' should be a table' ... box.cfg{sophia = {threads = "threads"}} --- -- error: '[string "-- load_cfg.lua - internal file..."]:167: Error: cfg parameter +- error: '[string "-- load_cfg.lua - internal file..."]:174: Error: cfg parameter ''sophia.threads'' should be of type number' ... -------------------------------------------------------------------------------- -- GitLab