diff --git a/pkg/topology/common.go b/pkg/topology/common.go index 5cd5109..cd70f13 100644 --- a/pkg/topology/common.go +++ b/pkg/topology/common.go @@ -102,13 +102,28 @@ func (r *CommonCartridgeTopology) SetWeight(ctx context.Context, leader *v1.Pod, local uuid, weight = ... local replicaset = cartridge.admin_get_replicasets(uuid)[1] - local actualWight = 0 - if replicaset ~= nil and replicaset.weight ~= nil and actualWight ~= box.NULL then - actualWight = replicaset.weight + --setting weights only for vhsard storages + local isVshardStorage = false + + for _, role in ipairs(replicaset.roles) do + if role == "vshard-storage" then + isVshardStorage = true + break + end + end + + if not isVshardStorage then + return { res=true, err=nil } + end + + local actualWeight = 0 + + if replicaset ~= nil and replicaset.weight ~= nil and actualWeight ~= box.NULL then + actualWeight = replicaset.weight end - if replicaset == nil or actualWight ~= weight then + if replicaset == nil or actualWeight ~= weight then local topology, err = cartridge.admin_edit_topology({ replicasets = { { uuid = uuid , weight = weight} @@ -223,11 +238,11 @@ func (r *CommonCartridgeTopology) GetRolesHierarchy(ctx context.Context, leader lua := ` local roles = require('cartridge.roles') local hierarchy = {} - + for _, roleName in pairs(roles.get_all_roles()) do hierarchy[roleName] = roles.get_role_dependencies(roleName) end - + return hierarchy ` @@ -324,7 +339,7 @@ func (r *CommonCartridgeTopology) GetCartridgeConfig(ctx context.Context, leader ['vshard_groups.yml'] = true, ['schema.yml'] = true, } - + local ret = {} for section, data in pairs(cfg) do if not blacklist[section] then