Skip to content

Commit

Permalink
config: fix hanging alert about missing name
Browse files Browse the repository at this point in the history
At the last itaration of review it was decided to throw an alerts,
when no UUID was passed to config and name is not set in _cluster.

This leads to alerts, thrown during replicaset bootstrap. However,
_cluster:on_replace trigger wasn't updated for that change, it
asssumed that when insert of a new replica is done, no alerts was
thrown.

Let's fix the behavior of on_replace trigger so that it deletes
alerts as soon as replica joined with name.

Follow-up #8978

NO_DOC=bugfix
NO_TEST=<already tested>
NO_CHANGELOG=bugfix
  • Loading branch information
Serpentian authored and Totktonada committed Oct 27, 2023
1 parent f399cc7 commit c2c8286
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions src/box/lua/config/applier/box_cfg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ local function names_alert_missing(config, missing_names)
end

local unknown_msg = 'box_cfg.apply: instance %s is unknown. Possibly ' ..
'instance_name is not set and UUID is not specified'
'instance_name is not set in database and UUID is ' ..
'not specified. Or instance have not joined yet.'
for name, uuid in pairs(missing_names._peers) do
local warning
if uuid == 'unknown' then
Expand Down Expand Up @@ -213,22 +214,11 @@ local function names_schema_upgrade_on_replace(old, new)
end

local function names_cluster_on_replace(old, new)
-- Ignore insert of a new replica. Every new replica will have
-- name set, as it may join to a replicaset only by bootstrap, which
-- means that config will pass instance_name to box.cfg. If user joins
-- replica without config module, we consider he understands, what he's
-- doing and don't automatically set instance_name.
if old == nil then
return
end

-- Name may be nil, if e.g. UUID have not been passed to config.
-- In such case alert was not done, it's safe to ignore such case.
local instance_name = nil
if new == nil then
instance_name = names_state.config._configdata:peer_name_by_uuid(old[2])
elseif old[3] == nil then
if new ~= nil then
instance_name = new[3]
elseif old ~= nil then
instance_name = names_state.config._configdata:peer_name_by_uuid(old[2])
end

if instance_name ~= nil then
Expand Down

0 comments on commit c2c8286

Please sign in to comment.