commit 7616db5201b7743a78277529bf20933a73f50098 from: Mergen Imeev via: Sergey Bronnikov date: Tue Jul 11 07:09:27 2023 UTC config: introduce remaining vinyl options This patch introduces all remaining vinyl options that have not been introduced before. Part of #8861 NO_DOC=Was already described before. commit - 75d9340595502d644a20d35df86d4a012dbd5d8b commit + 7616db5201b7743a78277529bf20933a73f50098 blob - /dev/null blob + b326568bf1ec355535f3b7c3052c86fe631223b8 (mode 644) --- /dev/null +++ changelogs/unreleased/gh-8861-vinyl-options.md @@ -0,0 +1,3 @@ +## feature/config + +* All vinyl options are now supported (gh-8861). blob - 6b411e3873dbc2b12ed8a29d1745fba4ab271de0 blob + 96c8bd953aa7bf6c2ac3ec7177459db52fcc3ec7 --- src/box/lua/config/instance_config.lua +++ src/box/lua/config/instance_config.lua @@ -717,7 +717,22 @@ return schema.new('instance_config', schema.record({ }), }), vinyl = schema.record({ - -- TODO: vinyl options. + bloom_fpr = schema.scalar({ + type = 'number', + box_cfg = 'vinyl_bloom_fpr', + box_cfg_nondynamic = true, + default = 0.05, + }), + cache = schema.scalar({ + type = 'integer', + box_cfg = 'vinyl_cache', + default = 128 * 1024 * 1024, + }), + defer_deletes = schema.scalar({ + type = 'boolean', + box_cfg = 'vinyl_defer_deletes', + default = false, + }), dir = schema.scalar({ type = 'string', box_cfg = 'vinyl_dir', @@ -730,6 +745,52 @@ return schema.new('instance_config', schema.record({ box_cfg = 'vinyl_max_tuple_size', default = 1024 * 1024, }), + memory = schema.scalar({ + type = 'integer', + box_cfg = 'vinyl_memory', + default = 128 * 1024 * 1024, + }), + page_size = schema.scalar({ + type = 'integer', + box_cfg = 'vinyl_page_size', + box_cfg_nondynamic = true, + default = 8 * 1024, + }), + range_size = schema.scalar({ + type = 'integer', + box_cfg = 'vinyl_range_size', + box_cfg_nondynamic = true, + default = box.NULL, + }), + read_threads = schema.scalar({ + type = 'integer', + box_cfg = 'vinyl_read_threads', + box_cfg_nondynamic = true, + default = 1, + }), + run_count_per_level = schema.scalar({ + type = 'integer', + box_cfg = 'vinyl_run_count_per_level', + box_cfg_nondynamic = true, + default = 2, + }), + run_size_ratio = schema.scalar({ + type = 'number', + box_cfg = 'vinyl_run_size_ratio', + box_cfg_nondynamic = true, + default = 3.5, + }), + timeout = schema.scalar({ + type = 'number', + box_cfg = 'vinyl_timeout', + default = 60, + }), + write_threads = schema.scalar({ + type = 'integer', + box_cfg = 'vinyl_write_threads', + box_cfg_nondynamic = true, + default = 2, + }), }), wal = schema.record({ dir = schema.scalar({ blob - d9b8560220e007d7a69d26b1324a04e12bd12728 blob + f9f7d194fc07f906998db08a1d8fff96fbb82f48 --- test/config-luatest/cluster_config_schema_test.lua +++ test/config-luatest/cluster_config_schema_test.lua @@ -162,6 +162,17 @@ g.test_defaults = function() vinyl = { dir = '{{ instance_name }}', max_tuple_size = 1048576, + bloom_fpr = 0.05, + page_size = 8192, + range_size = box.NULL, + run_count_per_level = 2, + run_size_ratio = 3.5, + read_threads = 1, + write_threads = 2, + cache = 134217728, + defer_deletes = false, + memory = 134217728, + timeout = 60, }, database = { instance_uuid = box.NULL, blob - 500b40f1ba6a1c0b9e6c980018a05c42a07422c3 blob + 0c6e18770e3367882bbdf79ea92d268ee8a9297b --- test/config-luatest/config_test.lua +++ test/config-luatest/config_test.lua @@ -1,4 +1,5 @@ local t = require('luatest') +local server = require('test.luatest_helpers.server') local cluster_config = require('internal.config.cluster_config') local configdata = require('internal.config.configdata') local treegen = require('test.treegen') @@ -15,6 +16,12 @@ g.after_all(function() treegen.clean(g) end) +g.after_each(function() + if g.server ~= nil then + g.server:stop() + end +end) + g.test_configdata = function() local cconfig = { credentials = { @@ -280,4 +287,59 @@ g.test_config_option = function() local res = justrun.tarantool(dir, env, args, opts) t.assert_equals(res.exit_code, 0) t.assert_equals(res.stdout, table.concat({16, 100000000, 0}, "\n")) +end + +g.test_remaining_vinyl_options = function() + local dir = treegen.prepare_directory(g, {}, {}) + local config = [[ + credentials: + users: + guest: + roles: + - super + + iproto: + listen: unix/:./{{ instance_name }}.iproto + + vinyl: + bloom_fpr: 0.37 + page_size: 777 + range_size: 5555 + run_count_per_level: 3 + run_size_ratio: 1.63 + read_threads: 11 + write_threads: 22 + cache: 111111111 + defer_deletes: true + memory: 222222222 + timeout: 7.5 + + groups: + group-001: + replicasets: + replicaset-001: + instances: + instance-001: {} + ]] + local config_file = treegen.write_script(dir, 'config.yaml', config) + local opts = { + config_file = config_file, + alias = 'instance-001', + chdir = dir, + } + g.server = server:new(opts) + g.server:start() + g.server:exec(function() + t.assert_equals(box.cfg.vinyl_bloom_fpr, 0.37) + t.assert_equals(box.cfg.vinyl_page_size, 777) + t.assert_equals(box.cfg.vinyl_range_size, 5555) + t.assert_equals(box.cfg.vinyl_run_count_per_level, 3) + t.assert_equals(box.cfg.vinyl_run_size_ratio, 1.63) + t.assert_equals(box.cfg.vinyl_read_threads, 11) + t.assert_equals(box.cfg.vinyl_write_threads, 22) + t.assert_equals(box.cfg.vinyl_cache, 111111111) + t.assert_equals(box.cfg.vinyl_defer_deletes, true) + t.assert_equals(box.cfg.vinyl_memory, 222222222) + t.assert_equals(box.cfg.vinyl_timeout, 7.5) + end) end blob - e262a1b0626d376139ff657f432ca49571f1b2c7 blob + e1186cafa1b1e8bf2d5d736d661d415752de2120 --- test/config-luatest/instance_config_schema_test.lua +++ test/config-luatest/instance_config_schema_test.lua @@ -730,6 +730,17 @@ g.test_vinyl = function() vinyl = { dir = 'one', max_tuple_size = 1, + bloom_fpr = 0.1, + page_size = 123, + range_size = 321, + run_count_per_level = 11, + run_size_ratio = 1.15, + read_threads = 7, + write_threads = 9, + cache = 10, + defer_deletes = true, + memory = 11, + timeout = 5.5, }, } instance_config:validate(iconfig) @@ -738,6 +749,17 @@ g.test_vinyl = function() local exp = { dir = '{{ instance_name }}', max_tuple_size = 1048576, + bloom_fpr = 0.05, + page_size = 8192, + range_size = box.NULL, + run_count_per_level = 2, + run_size_ratio = 3.5, + read_threads = 1, + write_threads = 2, + cache = 134217728, + defer_deletes = false, + memory = 134217728, + timeout = 60, } local res = instance_config:apply_default({}).vinyl t.assert_equals(res, exp)