Skip to content

Commit fe5956e

Browse files
Add cartridge.get_opts (#2253)
1 parent 1c54e09 commit fe5956e

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ Changed
1818

1919
- Update ``membership`` dependency to `2.4.5 <https://github.com/tarantool/membership/releases/tag/2.4.5>`_.
2020

21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22+
Added
23+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24+
25+
- ``cartirdge.get_opts()`` function to get current Cartridge options.
26+
27+
- More logging cartridge options on start.
2128

2229
-------------------------------------------------------------------------------
2330
[2.12.1] - 2024-06-06

cartridge.lua

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ if not ok then
6464
VERSION = 'unknown'
6565
end
6666

67+
local cartridge_opts
68+
6769
--- Vshard storage group configuration.
6870
--
6971
-- Every vshard storage must be assigned to a group.
@@ -276,7 +278,6 @@ end
276278
-- env `TARANTOOL_UPLOAD_PREFIX`,
277279
-- args `--upload-prefix`)
278280
--
279-
280281
-- @tparam ?boolean opts.enable_failover_suppressing
281282
-- Enable failover suppressing. It forces eventual failover
282283
-- to stop in case of constant switching.
@@ -304,9 +305,14 @@ end
304305
-- env `TARANTOOL_SET_COOKIE_HASH_MEMBERSHIP`,
305306
-- args `--set-cookie-hash-membership`)
306307
--
308+
-- @tparam ?boolean opts.rebalancer_mode
309+
-- Rebalancer mode for vshard cluster. See vshard doc for more details.
310+
-- env `TARANTOOL_REBALANCER_MODE`,
311+
-- args `--rebalancer-mode`)
312+
--
307313
-- @tparam ?table box_opts
308-
-- tarantool extra box.cfg options (e.g. memtx_memory),
309-
-- that may require additional tuning
314+
-- tarantool extra box.cfg options (e.g. force_recovery),
315+
-- that may require additional tuning on startup.
310316
--
311317
-- @return[1] true
312318
-- @treturn[2] nil
@@ -984,6 +990,7 @@ local function cfg(opts, box_opts)
984990
confapplier.log_bootinfo()
985991
end
986992

993+
--[[global]] cartridge_opts = opts
987994
if rawget(_G, '__TEST') ~= true then
988995
local crg_opts_to_logs = table.deepcopy(opts)
989996

@@ -1023,6 +1030,16 @@ return {
10231030
-- @function is_healthy
10241031
is_healthy = topology.cluster_is_healthy,
10251032

1033+
--- Get cartridge opts.
1034+
-- It's like calling **box.cfg** without arguments, but returns cartridge opts.
1035+
--
1036+
-- @function get_opts
1037+
-- @treturn[1] table Catridge opts
1038+
-- @treturn[2] nil If cartridge opts are not set
1039+
get_opts = function()
1040+
return table.deepcopy(cartridge_opts)
1041+
end,
1042+
10261043
--- Global functions.
10271044
-- @section globals
10281045

cartridge/logging_whitelist.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ local cartridge_opts = {
44
'auth_backend_name',
55
'auth_enabled',
66
'bucket_count',
7-
'rebalancer_mode',
87
'console_sock',
8+
'disable_raft_on_small_clusters',
9+
'enable_failover_suppressing',
10+
'enable_synchro_mode',
911
'http_enabled',
1012
'http_host',
1113
'http_port',
14+
'rebalancer_mode',
1215
'roles',
1316
'roles_reload_allowed',
17+
'set_cookie_hash_membership',
1418
'swim_broadcast',
1519
'upgrade_schema',
1620
'upload_prefix',
@@ -20,6 +24,7 @@ local cartridge_opts = {
2024
'webui_enforce_root_redirect',
2125
'webui_prefix',
2226
'workdir',
27+
2328
}
2429

2530
local box_opts = {

0 commit comments

Comments
 (0)