Skip to content
Snippets Groups Projects
Commit be98e1ae authored by Mergen Imeev's avatar Mergen Imeev Committed by Alexander Turenko
Browse files

config: memtx section for instance config

This section describes the instance memtx engine configuration.

Part of #8778

NO_DOC=will be added later
NO_CHANGELOG=will be added later
parent e1de4164
No related branches found
No related tags found
No related merge requests found
......@@ -361,6 +361,44 @@ return schema.new('instance_config', schema.record({
default = 5 * 1024 * 1024,
}),
}),
memtx = schema.record({
memory = schema.scalar({
type = 'integer',
box_cfg = 'memtx_memory',
default = 256 * 1024 * 1024,
}),
allocator = schema.enum({
'small',
'system',
}, {
box_cfg = 'memtx_allocator',
box_cfg_nondynamic = true,
default = 'small',
}),
slab_alloc_granularity = schema.scalar({
type = 'integer',
box_cfg = 'slab_alloc_granularity',
box_cfg_nondynamic = true,
default = 8,
}),
slab_alloc_factor = schema.scalar({
type = 'number',
box_cfg = 'slab_alloc_factor',
box_cfg_nondynamic = true,
default = 1.05,
}),
min_tuple_size = schema.scalar({
type = 'integer',
box_cfg = 'memtx_min_tuple_size',
box_cfg_nondynamic = true,
default = 16,
}),
max_tuple_size = schema.scalar({
type = 'integer',
box_cfg = 'memtx_max_tuple_size',
default = 1024 * 1024,
}),
}),
}, {
-- Any configuration data should contain a version of the
-- config schema for which it is written.
......
......@@ -282,3 +282,29 @@ g.test_sql = function()
local res = instance_config:apply_default({}).sql
t.assert_equals(res, exp)
end
g.test_memtx = function()
local iconfig = {
memtx = {
memory = 1,
allocator = 'small',
slab_alloc_granularity = 1,
slab_alloc_factor = 1,
min_tuple_size = 1,
max_tuple_size = 1,
},
}
instance_config:validate(iconfig)
validate_fields(iconfig.memtx, instance_config.schema.fields.memtx)
local exp = {
memory = 268435456,
allocator = 'small',
slab_alloc_granularity = 8,
slab_alloc_factor = 1.05,
min_tuple_size = 16,
max_tuple_size = 1048576,
}
local res = instance_config:apply_default({}).memtx
t.assert_equals(res, exp)
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment