From ad420846861a117b2b7e82b434acd1372c6abe08 Mon Sep 17 00:00:00 2001 From: Nikolay Shirokovskiy <nshirokovskiy@tarantool.org> Date: Tue, 27 Sep 2022 13:15:22 +0300 Subject: [PATCH] box: expose box.info() before box.cfg() So one can easily check current box status. NO_DOC=minor change Closes #7255 --- changelogs/unreleased/gh-7255-box-info-before-cfg.md | 3 +++ src/box/box.cc | 2 +- src/box/lua/load_cfg.lua | 1 + test/box-luatest/gh_7255_box_info_before_cfg_test.lua | 8 ++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/gh-7255-box-info-before-cfg.md create mode 100644 test/box-luatest/gh_7255_box_info_before_cfg_test.lua diff --git a/changelogs/unreleased/gh-7255-box-info-before-cfg.md b/changelogs/unreleased/gh-7255-box-info-before-cfg.md new file mode 100644 index 0000000000..3076a1c87c --- /dev/null +++ b/changelogs/unreleased/gh-7255-box-info-before-cfg.md @@ -0,0 +1,3 @@ +## feature/core + +* box.info() can be called before box.cfg() (gh-7255). diff --git a/src/box/box.cc b/src/box/box.cc index 5997988115..a722c8ed7f 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -91,7 +91,7 @@ #include "wal_ext.h" #include "mp_util.h" -static char status[64] = "unknown"; +static char status[64] = "unconfigured"; /** box.stat rmean */ struct rmean *rmean_box; diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua index ad5e4908b8..6956cdce3e 100644 --- a/src/box/lua/load_cfg.lua +++ b/src/box/lua/load_cfg.lua @@ -842,6 +842,7 @@ local box_cfg_guard_whitelist = { broadcast = true; txn_isolation_level = true; NULL = true; + info = true; }; -- List of box members that requires full box loading. diff --git a/test/box-luatest/gh_7255_box_info_before_cfg_test.lua b/test/box-luatest/gh_7255_box_info_before_cfg_test.lua new file mode 100644 index 0000000000..2096ec35cb --- /dev/null +++ b/test/box-luatest/gh_7255_box_info_before_cfg_test.lua @@ -0,0 +1,8 @@ +local t = require('luatest') + +local g = t.group() + +g.test_box_info_before_box_cfg = function() + local info = box.info() + t.assert_equals(info.status, "unconfigured") +end -- GitLab