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

config: snapshot section for instance config

This section describes the instance snapshot configuration.

Part of #8778

NO_DOC=will be added later
NO_CHANGELOG=will be added later
parent c6e9b673
No related branches found
No related tags found
No related merge requests found
......@@ -453,6 +453,37 @@ return schema.new('instance_config', schema.record({
default = 4 * 3600,
}),
}),
snapshot = schema.record({
dir = schema.scalar({
type = 'string',
box_cfg = 'memtx_dir',
box_cfg_nondynamic = true,
mkdir = true,
default = '{{ instance_name }}',
}),
by = schema.record({
interval = schema.scalar({
type = 'number',
box_cfg = 'checkpoint_interval',
default = 3600,
}),
wal_size = schema.scalar({
type = 'integer',
box_cfg = 'checkpoint_wal_threshold',
default = 1e18,
}),
}),
count = schema.scalar({
type = 'integer',
box_cfg = 'checkpoint_count',
default = 2,
}),
snap_io_rate_limit = schema.scalar({
type = 'number',
box_cfg = 'snap_io_rate_limit',
default = box.NULL,
}),
}),
}, {
-- Any configuration data should contain a version of the
-- config schema for which it is written.
......
......@@ -352,3 +352,31 @@ g.test_wal = function()
local res = instance_config:apply_default({}).wal
t.assert_equals(res, exp)
end
g.test_snapshot = function()
local iconfig = {
snapshot = {
dir = 'one',
by = {
interval = 1,
wal_size = 1,
},
count = 1,
snap_io_rate_limit = 1,
},
}
instance_config:validate(iconfig)
validate_fields(iconfig.snapshot, instance_config.schema.fields.snapshot)
local exp = {
dir = '{{ instance_name }}',
by = {
interval = 3600,
wal_size = 1000000000000000000,
},
count = 2,
snap_io_rate_limit = box.NULL,
}
local res = instance_config:apply_default({}).snapshot
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