Skip to content

Commit

Permalink
feat: support replication_anon
Browse files Browse the repository at this point in the history
  • Loading branch information
ochaton committed Aug 20, 2024
1 parent cd0bf83 commit 6c1674f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ master_selection_policies = {
cfg.box.read_only = true
end

log.info("Using policy etcd.instance.read_only, read_only=%s",cfg.box.read_only)
log.info("Using policy etcd.instance.read_only (deperecated), read_only=%s",cfg.box.read_only)
return cfg
end;
['etcd.cluster.master'] = function(M, instance_name, common_cfg, instance_cfg, cluster_cfg, local_cfg)
Expand Down Expand Up @@ -416,6 +416,17 @@ master_selection_policies = {
end

deep_merge(cfg, local_cfg)
if cfg.box.replication_anon then
if cluster_cfg.master == instance_name then
log.error("Instance %s is declared as cluster master, and can't be replication_anon", instance_name)
cfg.box.replication_anon = nil
else
log.info("Instance is configured as anon replica, drop cluster_uuid, instance_uuid and enforce read_only=true")
cfg.box.instance_uuid = nil
cfg.box.replicaset_uuid = nil
cfg.box.read_only = true
end
end

return cfg
end;
Expand Down Expand Up @@ -455,6 +466,10 @@ master_selection_policies = {
end

deep_merge(cfg, local_cfg)
if cfg.box.replication_anon then
log.error("etcd.cluster.raft does not support replication_anon=true (option was dropped)")
cfg.box.replication_anon = nil
end

return cfg
end;
Expand Down

0 comments on commit 6c1674f

Please sign in to comment.