Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ Changed

- Update ``vshard`` dependency to `0.1.34 <https://github.com/tarantool/vshard/releases/tag/0. 1.34>`_.

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

- New vshard option ``connection_fetch_schema``.

-------------------------------------------------------------------------------
[2.15.4] - 2025-06-11
-------------------------------------------------------------------------------
Expand Down
15 changes: 15 additions & 0 deletions cartridge/vshard-utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local ValidateConfigError = errors.new_class('ValidateConfigError')

vars:new('default_bucket_count', 30000)
vars:new('default_rebalancer_mode', 'auto')
vars:new('default_connection_fetch_schema', true)
vars:new('known_groups', nil
--{
-- [group_name] = {
Expand All @@ -34,6 +35,7 @@ vars:new('known_groups', nil
-- sched_ref_quota = number,
-- sched_move_quota = number,
-- rebalancer_mode = string,
-- connection_fetch_schema = boolean,
-- }
--}
)
Expand Down Expand Up @@ -277,6 +279,12 @@ local function validate_vshard_group(field, vsgroup_new, vsgroup_old)
'%s.sched_move_quota must be non-negative', field
)
end
if vsgroup_new.connection_fetch_schema ~= nil then
ValidateConfigError:assert(
type(vsgroup_new.connection_fetch_schema) == 'boolean',
'%s.connection_fetch_schema must be a boolean', field
)
end
if vsgroup_old ~= nil then
ValidateConfigError:assert(
vsgroup_new.bucket_count == vsgroup_old.bucket_count,
Expand All @@ -299,6 +307,7 @@ local function validate_vshard_group(field, vsgroup_new, vsgroup_old)
['rebalancer_mode'] = true,
['sched_ref_quota'] = true,
['sched_move_quota'] = true,
['connection_fetch_schema'] = true,
}
for k, _ in pairs(vsgroup_new) do
if known_keys[k] == nil then
Expand Down Expand Up @@ -482,6 +491,10 @@ local function get_known_groups()
if g.sched_move_quota == nil then
g.sched_move_quota = vshard_consts.DEFAULT_SCHED_MOVE_QUOTA
end

if g.connection_fetch_schema == nil then
g.connection_fetch_schema = vars.default_connection_fetch_schema
end
end

return vshard_groups
Expand Down Expand Up @@ -595,6 +608,7 @@ local function get_vshard_config(group_name, conf)
collect_bucket_garbage_interval = vshard_groups[group_name].collect_bucket_garbage_interval,
rebalancer_disbalance_threshold = vshard_groups[group_name].rebalancer_disbalance_threshold,
rebalancer_mode = vshard_groups[group_name].rebalancer_mode,
connection_fetch_schema = vshard_groups[group_name].connection_fetch_schema,
sharding = sharding,
read_only = not failover.is_rw(),
weights = zone_distances,
Expand Down Expand Up @@ -701,6 +715,7 @@ local function edit_vshard_options(group_name, vshard_options)
rebalancer_mode = '?string',
sched_ref_quota = '?number',
sched_move_quota = '?number',
connection_fetch_schema = '?boolean',
}
)
vshard_options.collect_lua_garbage = nil
Expand Down
5 changes: 5 additions & 0 deletions cartridge/webui/api-vshard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ local gql_type_vsgroup = gql_types.object({
kind = gql_types.long.nonNull,
description = 'Scheduler bucket move quota'
},
connection_fetch_schema = {
kind = gql_types.boolean.nonNull,
description = 'Connection "fetch_schema" option'
},
}
})

Expand Down Expand Up @@ -178,6 +182,7 @@ local function init(graphql)
rebalancer_mode = gql_types.string,
sched_ref_quota = gql_types.long,
sched_move_quota = gql_types.long,
connection_fetch_schema = gql_types.boolean,
},
kind = gql_type_vsgroup.nonNull,
callback = module_name .. '.edit_vshard_options',
Expand Down
34 changes: 20 additions & 14 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: Thu Aug 22 2024 19:23:56 GMT+0300 (Moscow Standard Time)
# timestamp: Thu Jun 19 2025 13:00:02 GMT+0300 (Moscow Standard Time)

"""Custom scalar specification."""
directive @specifiedBy(
Expand Down Expand Up @@ -550,21 +550,24 @@ type MutationApicluster {
"""
rebalancer_mode: String

"""
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.
"""
sync_timeout: Float

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

"""The `Boolean` scalar type represents `true` or `false`."""
connection_fetch_schema: Boolean
name: String!

"""
Expand Down Expand Up @@ -1153,28 +1156,31 @@ 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!

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

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

"""
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!
"""Scheduler storage ref quota"""
sched_ref_quota: Long!

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

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

"""Connection "fetch_schema" option"""
connection_fetch_schema: Boolean!

"""Group name"""
name: String!

Expand Down
11 changes: 11 additions & 0 deletions test/integration/multisharding_one_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ local function get_vshard_groups(cluster)
rebalancer_max_receiving
rebalancer_max_sending
collect_lua_garbage
connection_fetch_schema
sync_timeout
collect_bucket_garbage_interval
rebalancer_disbalance_threshold
Expand All @@ -76,6 +77,7 @@ local function edit_vshard_group(cluster, kv_args)
$rebalancer_max_sending: Int
$group: String!
$collect_lua_garbage: Boolean
$connection_fetch_schema: Boolean
$sync_timeout: Float
$collect_bucket_garbage_interval: Float,
$rebalancer_disbalance_threshold: Float
Expand All @@ -86,6 +88,7 @@ local function edit_vshard_group(cluster, kv_args)
rebalancer_max_receiving: $rebalancer_max_receiving
rebalancer_max_sending: $rebalancer_max_sending
collect_lua_garbage: $collect_lua_garbage
connection_fetch_schema: $connection_fetch_schema
sync_timeout: $sync_timeout
collect_bucket_garbage_interval: $collect_bucket_garbage_interval
rebalancer_disbalance_threshold: $rebalancer_disbalance_threshold
Expand All @@ -96,6 +99,7 @@ local function edit_vshard_group(cluster, kv_args)
rebalancer_max_receiving
rebalancer_max_sending
collect_lua_garbage
connection_fetch_schema
sync_timeout
collect_bucket_garbage_interval
rebalancer_disbalance_threshold
Expand All @@ -122,6 +126,7 @@ function g.test_api()
rebalancer_max_receiving
rebalancer_max_sending
collect_lua_garbage
connection_fetch_schema
sync_timeout
collect_bucket_garbage_interval
rebalancer_disbalance_threshold
Expand All @@ -143,6 +148,7 @@ function g.test_api()
t.assert_equals(data['vshard_groups'][1]['bootstrapped'], true)
t.assert_equals(data['vshard_groups'][1]['sched_ref_quota'], 300)
t.assert_equals(data['vshard_groups'][1]['sched_move_quota'], 1)
t.assert_equals(data['vshard_groups'][1]['connection_fetch_schema'], true)


local res = g.server:graphql(request)
Expand All @@ -154,6 +160,7 @@ function g.test_api()
{
['collect_bucket_garbage_interval'] = box.NULL,
['collect_lua_garbage'] = false,
['connection_fetch_schema'] = true,
['rebalancer_disbalance_threshold'] = 1,
['rebalancer_max_receiving'] = 100,
['rebalancer_max_sending'] = 1,
Expand Down Expand Up @@ -208,13 +215,15 @@ function g.test_set_vshard_options_positive()
['name'] = 'default',
['bucket_count'] = 3000,
['bootstrapped'] = true,
['connection_fetch_schema'] = true,
})

local res = edit_vshard_group(g.cluster, {
group = "default",
rebalancer_max_receiving = nil,
rebalancer_max_sending = nil,
sync_timeout = 25,
connection_fetch_schema = false,
})
t.assert_equals(res['data']['cluster']['edit_vshard_options'], {
['collect_bucket_garbage_interval'] = box.NULL,
Expand All @@ -226,6 +235,7 @@ function g.test_set_vshard_options_positive()
['name'] = 'default',
['bucket_count'] = 3000,
['bootstrapped'] = true,
['connection_fetch_schema'] = false,
})

local res = get_vshard_groups(g.cluster)
Expand All @@ -240,6 +250,7 @@ function g.test_set_vshard_options_positive()
['name'] = 'default',
['bucket_count'] = 3000,
['bootstrapped'] = true,
['connection_fetch_schema'] = false,
}
})
end
Expand Down
11 changes: 11 additions & 0 deletions test/integration/multisharding_two_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ local function get_vshard_groups(cluster)
rebalancer_max_receiving
rebalancer_max_sending
collect_lua_garbage
connection_fetch_schema
sync_timeout
collect_bucket_garbage_interval
rebalancer_disbalance_threshold
Expand All @@ -105,6 +106,7 @@ local function edit_vshard_group(cluster, kv_args)
$rebalancer_max_sending: Int
$group: String!
$collect_lua_garbage: Boolean
$connection_fetch_schema: Boolean
$sync_timeout: Float
$collect_bucket_garbage_interval: Float,
$rebalancer_disbalance_threshold: Float
Expand All @@ -115,6 +117,7 @@ local function edit_vshard_group(cluster, kv_args)
rebalancer_max_receiving: $rebalancer_max_receiving
rebalancer_max_sending: $rebalancer_max_sending
collect_lua_garbage: $collect_lua_garbage
connection_fetch_schema: $connection_fetch_schema
sync_timeout: $sync_timeout
collect_bucket_garbage_interval: $collect_bucket_garbage_interval
rebalancer_disbalance_threshold: $rebalancer_disbalance_threshold
Expand All @@ -125,6 +128,7 @@ local function edit_vshard_group(cluster, kv_args)
rebalancer_max_receiving
rebalancer_max_sending
collect_lua_garbage
connection_fetch_schema
sync_timeout
collect_bucket_garbage_interval
rebalancer_disbalance_threshold
Expand All @@ -150,6 +154,7 @@ function g.test_api()
rebalancer_max_receiving
rebalancer_max_sending
collect_lua_garbage
connection_fetch_schema
sync_timeout
collect_bucket_garbage_interval
rebalancer_disbalance_threshold
Expand Down Expand Up @@ -225,6 +230,7 @@ function g.test_api()
{
['collect_bucket_garbage_interval'] = box.NULL,
['collect_lua_garbage'] = false,
['connection_fetch_schema'] = true,
['rebalancer_disbalance_threshold'] = 1,
['rebalancer_max_receiving'] = 100,
['rebalancer_max_sending'] = 1,
Expand All @@ -235,6 +241,7 @@ function g.test_api()
}, {
['collect_bucket_garbage_interval'] = box.NULL,
['collect_lua_garbage'] = false,
['connection_fetch_schema'] = true,
['rebalancer_disbalance_threshold'] = 1,
['rebalancer_max_receiving'] = 100,
['rebalancer_max_sending'] = 1,
Expand Down Expand Up @@ -331,6 +338,7 @@ function g.test_set_vshard_options_positive()
t.assert_equals(res['data']['cluster']['edit_vshard_options'], {
['collect_bucket_garbage_interval'] = box.NULL,
['collect_lua_garbage'] = false,
['connection_fetch_schema'] = true,
['rebalancer_disbalance_threshold'] = 1,
['rebalancer_max_receiving'] = 42,
['rebalancer_max_sending'] = 1,
Expand All @@ -348,6 +356,7 @@ function g.test_set_vshard_options_positive()
t.assert_equals(res['data']['cluster']['edit_vshard_options'], {
['collect_bucket_garbage_interval'] = box.NULL,
['collect_lua_garbage'] = false,
['connection_fetch_schema'] = true,
['rebalancer_disbalance_threshold'] = 1,
['rebalancer_max_receiving'] = 44,
['rebalancer_max_sending'] = 2,
Expand All @@ -362,6 +371,7 @@ function g.test_set_vshard_options_positive()
{
['collect_bucket_garbage_interval'] = box.NULL,
['collect_lua_garbage'] = false,
['connection_fetch_schema'] = true,
['rebalancer_disbalance_threshold'] = 1,
['rebalancer_max_receiving'] = 42,
['rebalancer_max_sending'] = 1,
Expand All @@ -373,6 +383,7 @@ function g.test_set_vshard_options_positive()
{
['collect_bucket_garbage_interval'] = box.NULL,
['collect_lua_garbage'] = false,
['connection_fetch_schema'] = true,
['rebalancer_disbalance_threshold'] = 1,
['rebalancer_max_receiving'] = 44,
['rebalancer_max_sending'] = 2,
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 @@ -41,6 +41,7 @@ function g.test_get_cfg()
default = {
bucket_count = 3000,
collect_lua_garbage = false,
connection_fetch_schema = true,
read_only = false,
rebalancer_disbalance_threshold = 1,
rebalancer_mode = 'auto',
Expand Down Expand Up @@ -121,6 +122,7 @@ function g.test_get_cfg_multisharding()
hot = {
bucket_count = 30000,
collect_lua_garbage = false,
connection_fetch_schema = true,
read_only = false,
rebalancer_disbalance_threshold = 1,
rebalancer_mode = 'auto',
Expand All @@ -145,6 +147,7 @@ function g.test_get_cfg_multisharding()
cold = {
bucket_count = 2000,
collect_lua_garbage = false,
connection_fetch_schema = true,
read_only = false,
rebalancer_disbalance_threshold = 1,
rebalancer_max_receiving = 100,
Expand Down
9 changes: 9 additions & 0 deletions test/unit/vshard_config_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ vshard_groups:
rebalancer_max_sending: 0
...]])

check_config('vshard_groups["global"].connection_fetch_schema must be a boolean',
[[---
vshard_groups:
global:
bucket_count: 200
bootstrapped: false
connection_fetch_schema: "no"
...]])

check_config('vshard_groups["global"].collect_lua_garbage must be a boolean',
[[---
vshard_groups:
Expand Down
Loading