Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cartridge.get_opts #2253

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ Changed

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Added
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- ``cartirdge.get_opts()`` function to get current Cartridge options.

- More logging cartridge options on start.

-------------------------------------------------------------------------------
[2.12.1] - 2024-06-06
Expand Down
23 changes: 20 additions & 3 deletions cartridge.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ if not ok then
VERSION = 'unknown'
end

local cartridge_opts

--- Vshard storage group configuration.
--
-- Every vshard storage must be assigned to a group.
Expand Down Expand Up @@ -276,7 +278,6 @@ end
-- env `TARANTOOL_UPLOAD_PREFIX`,
-- args `--upload-prefix`)
--

-- @tparam ?boolean opts.enable_failover_suppressing
-- Enable failover suppressing. It forces eventual failover
-- to stop in case of constant switching.
Expand Down Expand Up @@ -304,9 +305,14 @@ end
-- env `TARANTOOL_SET_COOKIE_HASH_MEMBERSHIP`,
-- args `--set-cookie-hash-membership`)
--
-- @tparam ?boolean opts.rebalancer_mode
-- Rebalancer mode for vshard cluster. See vshard doc for more details.
-- env `TARANTOOL_REBALANCER_MODE`,
-- args `--rebalancer-mode`)
--
-- @tparam ?table box_opts
-- tarantool extra box.cfg options (e.g. memtx_memory),
-- that may require additional tuning
-- tarantool extra box.cfg options (e.g. force_recovery),
-- that may require additional tuning on startup.
--
-- @return[1] true
-- @treturn[2] nil
Expand Down Expand Up @@ -984,6 +990,7 @@ local function cfg(opts, box_opts)
confapplier.log_bootinfo()
end

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

Expand Down Expand Up @@ -1023,6 +1030,16 @@ return {
-- @function is_healthy
is_healthy = topology.cluster_is_healthy,

--- Get cartridge opts.
-- It's like calling **box.cfg** without arguments, but returns cartridge opts.
--
-- @function get_opts
-- @treturn[1] table Catridge opts
-- @treturn[2] nil If cartridge opts are not set
get_opts = function()
return table.deepcopy(cartridge_opts)
end,

--- Global functions.
-- @section globals

Expand Down
7 changes: 6 additions & 1 deletion cartridge/logging_whitelist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ local cartridge_opts = {
'auth_backend_name',
'auth_enabled',
'bucket_count',
'rebalancer_mode',
'console_sock',
'disable_raft_on_small_clusters',
'enable_failover_suppressing',
'enable_synchro_mode',
'http_enabled',
'http_host',
'http_port',
'rebalancer_mode',
'roles',
'roles_reload_allowed',
'set_cookie_hash_membership',
'swim_broadcast',
'upgrade_schema',
'upload_prefix',
Expand All @@ -20,6 +24,7 @@ local cartridge_opts = {
'webui_enforce_root_redirect',
'webui_prefix',
'workdir',

}

local box_opts = {
Expand Down
Loading