From 2734785ebec9a39ad58156390029e07e33012078 Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov@tarantool.org> Date: Tue, 28 Dec 2021 13:58:18 +0300 Subject: [PATCH] box: make cfg value comparison more thorough Use table.equals for comparing table-valued configuration parameters instead of ipairs. Needed to trigger reconfiguraiton if the new URI differs from the old one only by parameters, e.g.: box.cfg{listen = {uri = 3301, params = {transport = 'plain'}}} box.cfg{listen = {uri = 3301, params = {transport = 'ssl'}}} No test is added, because currently there's no URI parameters handled by box. The next commit adds the 'transport' parameter and a test that wouldn't pass without this commit. --- src/box/lua/load_cfg.lua | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua index 87cf9dbe70..196b8fa389 100644 --- a/src/box/lua/load_cfg.lua +++ b/src/box/lua/load_cfg.lua @@ -602,15 +602,7 @@ local function compare_cfg(cfg1, cfg2) if type(cfg1) ~= 'table' then return cfg1 == cfg2 end - if #cfg1 ~= #cfg2 then - return false - end - for k, v in ipairs(cfg1) do - if v ~= cfg2[k] then - return false - end - end - return true + return table.equals(cfg1, cfg2) end local function reload_cfg(oldcfg, cfg) -- GitLab