-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rebalancer: introduce rebalancer_mode
Closes #432 @TarantoolBot document Title: vshard: rebalancer flag and mode So far it was impossible to specify which instance should run the rebalancer. It was always automatically assigned using some internal rules based on UUIDs. Now the users can choose: - Which specific instance should run the rebalancer. Can be a replica or a master - won't matter. - In which replicaset the instance to run the rebalancer should be selected automatically. - Which instances and whole replicasets should not run the rebalancer even when it is selected automatically. For that there are 2 new options: `rebalancer = <bool>` and `rebalancer_mode = <name>`. The `rebalancer` flag can be either omitted, or set to true, or false. It can be set for replicasets and for specific instances. There can be only one `rebalancer = true` in the whole config. But can be many `rebalancer = false`. * `rebalancer = true` assigned to an instance means that this instance is guaranteed to run the rebalancer service on it. The instance role doesn't matter - it can be a replica or a master. Will run the rebalancer anyway. * `rebalancer = true` assigned to a replicaset means that the service will run only on the master of this replicaset. Can be combined with `master = 'auto'` on the given replicaset. * `rebalancer = false` assigned to an instance means that it will not run the rebalancer. * `rebalancer = false` assigned to a replicaset means that all the instances of this replicaset will not run the rebalancer. * `rebalancer = nil` (same as omitted, default) means that the instance/replicaset will be eligible to run the rebalancer only if `rebalancer_mode = 'auto'` is set and there are no `rebalancer = true` anywhere. The option `rebalancer_mode` should be specified in the root of the config. It can have one of those values: * `'auto'` - default. Means that the rebalancer service location is chosen automatically among all master instances in the cluster. Excluding those which have `rebalancer = false` on them or on their replicaset. If there are any `rebalancer = true`, then this mode works the same as `'manual'`. * `'manual'`. The rebalancer will run only if there is at least one `rebalancer = true` in the config. And only on the given instance / replicaset (depending on at which level the flag was specified - for a specific instance or for a whole replicaset). * `'off'`. The rebalancer will not run anywhere, regardless of all the `rebalancer = true/false` specified in the config.
- Loading branch information
Showing
4 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,3 +211,42 @@ g.test_rebalancer_flag = function() | |
replicaset_1.rebalancer = nil | ||
storage_1_a.rebalancer = nil | ||
end | ||
|
||
g.test_rebalancer_mode = function() | ||
local storage_1_a = { | ||
uri = 'storage:[email protected]:3301', | ||
name = 'storage_1_a', | ||
} | ||
local replicaset_1 = { | ||
replicas = { | ||
storage_1_a_uuid = storage_1_a, | ||
}, | ||
} | ||
local config = { | ||
sharding = { | ||
storage_1_uuid = replicaset_1, | ||
}, | ||
} | ||
t.assert(vcfg.check(config)) | ||
|
||
local function check_all_flag_combinations() | ||
t.assert(vcfg.check(config)) | ||
storage_1_a.rebalancer = true | ||
t.assert(vcfg.check(config)) | ||
storage_1_a.rebalancer = nil | ||
replicaset_1.rebalancer = true | ||
t.assert(vcfg.check(config)) | ||
replicaset_1.rebalancer = false | ||
t.assert(vcfg.check(config)) | ||
replicaset_1.rebalancer = nil | ||
storage_1_a.rebalancer = false | ||
t.assert(vcfg.check(config)) | ||
storage_1_a.rebalancer = nil | ||
end | ||
config.rebalancer_mode = 'auto' | ||
check_all_flag_combinations() | ||
config.rebalancer_mode = 'manual' | ||
check_all_flag_combinations() | ||
config.rebalancer_mode = 'off' | ||
check_all_flag_combinations() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters