Skip to content

Commit

Permalink
Add new vshard configuration options
Browse files Browse the repository at this point in the history
  • Loading branch information
yngvar-antonsson committed Feb 2, 2024
1 parent 7ebaa1a commit 2ef7f9d
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 31 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/compatibility-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ jobs:
downgrade: [null]
include:
- tarantool: '1.10'
cartridge: '2.7.9'
downgrade: true
- tarantool: '1.10'
cartridge: '2.8.4'
downgrade: true
- tarantool: '2.10'
cartridge: '2.7.9'
cartridge: '2.8.6'
downgrade: true
- tarantool: '2.10'
cartridge: '2.8.4'
cartridge: '2.8.6'
downgrade: true
runs-on: ubuntu-20.04
env:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ and this project adheres to
Unreleased
-------------------------------------------------------------------------------

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Added
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- New VShard configuration options: ``rebalancer`` and
``rebalancer_mode``.

-------------------------------------------------------------------------------
[2.8.6] - 2024-02-01
-------------------------------------------------------------------------------
Expand Down
37 changes: 37 additions & 0 deletions cartridge/vshard-utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ vars:new('known_groups', nil
-- rebalancer_disbalance_threshold = number,
-- sched_ref_quota = number,
-- sched_move_quota = number,
-- rebalancer = boolean,
-- rebalancer_mode = string,
-- }
--}
)
Expand Down Expand Up @@ -228,6 +230,26 @@ local function validate_vshard_group(field, vsgroup_new, vsgroup_old)
'%s.rebalancer_disbalance_threshold must be non-negative', field
)
end

if vsgroup_new.rebalancer ~= nil then
ValidateConfigError:assert(
type(vsgroup_new.rebalancer) == 'boolean',
'%s.rebalancer must be a boolean', field
)
end

if vsgroup_new.rebalancer_mode ~= nil then
ValidateConfigError:assert(
type(vsgroup_new.rebalancer_mode) == 'string'
and (
vsgroup_new.rebalancer_mode == 'auto'
or vsgroup_new.rebalancer_mode == 'manual'
or vsgroup_new.rebalancer_mode == 'off'
),
'%s.rebalancer must be one of: "auto", "manual", "off"', field
)
end

if vsgroup_new.sched_ref_quota ~= nil then
ValidateConfigError:assert(
type(vsgroup_new.sched_ref_quota) == 'number',
Expand Down Expand Up @@ -267,6 +289,8 @@ local function validate_vshard_group(field, vsgroup_new, vsgroup_old)
['sync_timeout'] = true,
['collect_bucket_garbage_interval'] = true,
['rebalancer_disbalance_threshold'] = true,
['rebalancer'] = true,
['rebalancer_mode'] = true,
['sched_ref_quota'] = true,
['sched_move_quota'] = true,
}
Expand Down Expand Up @@ -438,6 +462,15 @@ local function get_known_groups()
g.rebalancer_disbalance_threshold = vshard_consts.DEFAULT_REBALANCER_DISBALANCE_THRESHOLD
end

-- just for the code consistancy
if g.rebalancer == nil then
g.rebalancer = nil
end

if g.rebalancer_mode == nil then
g.rebalancer_mode = 'auto'
end

if g.sched_ref_quota == nil then
g.sched_ref_quota = vshard_consts.DEFAULT_SCHED_REF_QUOTA
end
Expand Down Expand Up @@ -555,6 +588,8 @@ local function get_vshard_config(group_name, conf)
sync_timeout = vshard_groups[group_name].sync_timeout,
collect_bucket_garbage_interval = vshard_groups[group_name].collect_bucket_garbage_interval,
rebalancer_disbalance_threshold = vshard_groups[group_name].rebalancer_disbalance_threshold,
rebalancer = vshard_groups[group_name].rebalancer,
rebalancer_mode = vshard_groups[group_name].rebalancer_mode,
sharding = sharding,
read_only = not failover.is_rw(),
weights = zone_distances,
Expand Down Expand Up @@ -614,6 +649,8 @@ local function edit_vshard_options(group_name, vshard_options)
sync_timeout = '?number',
collect_bucket_garbage_interval = '?number',
rebalancer_disbalance_threshold = '?number',
rebalancer = '?boolean',
rebalancer_mode = '?string',
sched_ref_quota = '?number',
sched_move_quota = '?number',
}
Expand Down
10 changes: 10 additions & 0 deletions cartridge/webui/api-vshard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ local gql_type_vsgroup = gql_types.object({
kind = gql_types.float.nonNull,
description = 'A maximum bucket disbalance threshold, in percent'
},
rebalancer = {
kind = gql_types.boolean,
description = 'Run rebalancer on a specific replicaset'
},
rebalancer_mode = {
kind = gql_types.string.nonNull,
description = 'Rebalancer mode'
},
sched_ref_quota = {
kind = gql_types.long.nonNull,
description = 'Scheduler storage ref quota'
Expand Down Expand Up @@ -171,6 +179,8 @@ local function init(graphql)
sync_timeout = gql_types.float,
collect_bucket_garbage_interval = gql_types.float,
rebalancer_disbalance_threshold = gql_types.float,
rebalancer = gql_types.boolean,
rebalancer_mode = gql_types.string,
sched_ref_quota = gql_types.long,
sched_move_quota = gql_types.long,
},
Expand Down
36 changes: 26 additions & 10 deletions doc/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# source: http://127.0.0.1:8081/admin/api
# timestamp: Fri Nov 03 2023 16:54:14 GMT+0300 (Moscow Standard Time)
# timestamp: Fri Feb 02 2024 17:36:46 GMT+0300 (Moscow Standard Time)

"""Custom scalar specification."""
directive @specifiedBy(
Expand Down Expand Up @@ -457,16 +457,26 @@ type MutationApicluster {
sched_ref_quota: Long

"""
The `Int` scalar type represents non-fractional signed whole numeric values.
Int can represent values from -(2^31) to 2^31 - 1, inclusive.
The `String` scalar type represents textual data, represented as UTF-8
character sequences. The String type is most often used by GraphQL to
represent free-form human-readable text.
"""
rebalancer_max_sending: Int
rebalancer_mode: String

"""The `Boolean` scalar type represents `true` or `false`."""
rebalancer: Boolean

"""
The `Float` scalar type represents signed double-precision fractional values as specified by IEEE 754.
"""
sync_timeout: Float

"""
The `Int` scalar type represents non-fractional signed whole numeric values.
Int can represent values from -(2^31) to 2^31 - 1, inclusive.
"""
rebalancer_max_sending: Int

"""
The `Float` scalar type represents signed double-precision fractional values as specified by IEEE 754.
"""
Expand Down Expand Up @@ -1110,22 +1120,28 @@ type VshardGroup {
"""
collect_lua_garbage: Boolean @deprecated(reason: "Has no effect anymore")

"""Scheduler storage ref quota"""
sched_ref_quota: Long!

"""Rebalancer mode"""
rebalancer_mode: String!

"""Run rebalancer on a specific replicaset"""
rebalancer: Boolean

"""
Timeout to wait for synchronization of the old master with replicas before demotion
"""
sync_timeout: Float!

"""Whether the group is ready to operate"""
bootstrapped: Boolean!

"""Scheduler storage ref quota"""
sched_ref_quota: Long!

"""
The maximum number of buckets that can be sent in parallel by a single replica set in the storage group
"""
rebalancer_max_sending: Int!

"""Whether the group is ready to operate"""
bootstrapped: Boolean!

"""A maximum bucket disbalance threshold, in percent"""
rebalancer_disbalance_threshold: Float!

Expand Down
51 changes: 38 additions & 13 deletions rst/cartridge_admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Cartridge is compatible with Tarantool 1.10 and Tarantool 2.x.
Cartridge doesn't support Tarantool 3.0 and higher.

.. list-table:: Compatibility and known issues
:widths: 50 50 50 50 50
:widths: 50 50 50 50 50 50
:header-rows: 1
:stub-columns: 1

Expand All @@ -37,91 +37,116 @@ Cartridge doesn't support Tarantool 3.0 and higher.
- Tarantool 2.8
- Tarantool 2.10
- Tarantool 2.11
- Additional notes
* - Cartridge scm-1
- \+
- \+
- \+
- \+
- Can't be downgraded to Cartridge 2.7.9 and lower
* - Cartridge 2.8.6
- \+
- \+
- \+
- \+
-
* - Cartridge 2.8.5
- \+
- \+
- \+
- \+
-
* - Cartridge 2.8.4
- \+
- \+
- \+
- \+
-
* - Cartridge 2.8.3
- \+
- \+
- \+
- \+
-
* - Cartridge 2.8.2
- \+
- \+
- \+
- \+
-
* - Cartridge 2.8.1
- \+
- \+
- \+
- \+
-
* - Cartridge 2.8.0
- \+
- \+
- \+
- \+
-
* - Cartridge 2.7.9
- \+
- \+
- \+
- \+
-
* - Cartridge 2.7.8
- Update is broken
- Update is broken
- Update is broken
- Update is broken
- \+
- \+
- \+
- \-
- Update to this release is broken
* - Cartridge 2.7.7
- Update is broken
- Update is broken
- Update is broken
- Update is broken
- \+
- \+
- \+
- \-
- Update to this release is broken
* - Cartridge 2.7.6
- Update is broken
- Update is broken
- Update is broken
- Update is broken
- \+
- \+
- \+
- \-
- Update to this release is broken
* - Cartridge 2.7.5
- \+
- \+
- \+
- \-
-
* - Cartridge 2.7.4
- \+
- \+
- \+
- \-
-
* - Cartridge 2.7.3
- \+
- \+
- \-
- \-
-
* - Cartridge 2.7.2
- \+
- \+
- \-
- \-
-
* - Cartridge 2.7.1
- \+
- \+
- \-
- \-
-
* - Cartridge 2.7.0
- \+
- \+
- \-
- \-
- Can't be downgraded to Cartridge 2.6.0 and lower


.. _cartridge-deployment:

Expand Down
3 changes: 3 additions & 0 deletions test/integration/vshard_api_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function g.test_get_cfg()
collect_lua_garbage = false,
read_only = false,
rebalancer_disbalance_threshold = 1,
rebalancer_mode = 'auto',
rebalancer_max_receiving = 100,
rebalancer_max_sending = 1,
sched_move_quota = 1,
Expand Down Expand Up @@ -122,6 +123,7 @@ function g.test_get_cfg_multisharding()
collect_lua_garbage = false,
read_only = false,
rebalancer_disbalance_threshold = 1,
rebalancer_mode = 'auto',
rebalancer_max_receiving = 100,
rebalancer_max_sending = 1,
sched_move_quota = 1,
Expand All @@ -146,6 +148,7 @@ function g.test_get_cfg_multisharding()
read_only = false,
rebalancer_disbalance_threshold = 1,
rebalancer_max_receiving = 100,
rebalancer_mode = 'auto',
rebalancer_max_sending = 1,
sched_move_quota = 1,
sched_ref_quota = 300,
Expand Down

0 comments on commit 2ef7f9d

Please sign in to comment.