Skip to content

Commit 715b9a5

Browse files
georgiy-belyaninTotktonada
authored andcommitted
config: forbid instance scope bootstrap_strategy
This patch forbids configurations that have the option `replication.bootstrap_strategy` in the instance scope. Similarly to `replication.failover` this option only makes sense in the replicaset scope and on the upper levels. Otherwise the configuration might be broken. NO_DOC=bugfix, no new behavior
1 parent 46cc98b commit 715b9a5

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## bugfix/config
2+
3+
* Now, `replication.bootstrap_strategy` can't be specified in the instance scope
4+
since it only makes sense to specify the option for at least for the whole
5+
replicaset.

src/box/lua/config/instance_config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,7 @@ return schema.new('instance_config', schema.record({
13361336
}, {
13371337
box_cfg = 'bootstrap_strategy',
13381338
default = 'auto',
1339+
validate = validators['replication.bootstrap_strategy'],
13391340
}),
13401341
autoexpel = schema.record({
13411342
enabled = schema.scalar({

src/box/lua/config/validators.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ M['replication.autoexpel'] = function(data, w)
314314
end
315315
end
316316

317+
M['replication.bootstrap_strategy'] = function(_data, w)
318+
-- Forbid in the instance scope, because it has no
319+
-- sense to set the option for a part of a
320+
-- replicaset.
321+
validate_scope(w, {'global', 'group', 'replicaset'})
322+
end
323+
317324
M['replication.failover'] = function(_data, w)
318325
-- Forbid in the instance scope, because it has no
319326
-- sense to set the option for a part of a

test/config-luatest/cluster_config_schema_test.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,18 @@ g.test_scope = function()
798798
replicaset = false,
799799
instance = false,
800800
},
801+
{
802+
name = 'replication.bootstrap_strategy',
803+
data = {
804+
replication = {
805+
bootstrap_strategy = 'auto',
806+
},
807+
},
808+
global = true,
809+
group = true,
810+
replicaset = true,
811+
instance = false,
812+
},
801813
{
802814
name = 'replication.failover',
803815
data = {

0 commit comments

Comments
 (0)