forked from tarantool/tarantool
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
box: introduce memtx_sort_threads config parameter
Closes tarantool#3389 Closes tarantool#7689 Closes tarantool#4646 @TarantoolBot document Title: new box.cfg parameter memtx_sort_threads The parameter sets the number of threads used to sort keys of secondary indexes on loading memtx database. The parameter cannot be changed dynamically (as it does not make sense). Maximum value is 256, minimum is 1. Default is to use all available cores. Usage example: ``` box.cfg{memtx_sort_threads=4} ```
- Loading branch information
Showing
17 changed files
with
144 additions
and
360 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
changelogs/unreleased/gh-3389-cfg-option-memtx-sort-threads.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## feature/box | ||
|
||
* Added the `box.cfg.memtx_sort_threads` parameter that specifies the number of | ||
threads used to sort indexes keys on loading a memtx database. OpenMP is | ||
not used to sort keys anymore (gh-3389). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
test/box-luatest/gh_3389_cfg_option_memtx_sort_threads_test.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
local server = require('luatest.server') | ||
local t = require('luatest') | ||
|
||
local g = t.group() | ||
|
||
g.before_all(function(cg) | ||
-- test setting memtx_sort_threads to non default value | ||
cg.server = server:new{} | ||
cg.server:start() | ||
cg.server:exec(function() | ||
-- this will trigger calling tt_sort on box.cfg{} | ||
local s = box.schema.space.create('test') | ||
s:create_index('pri') | ||
s:replace{2} | ||
s:replace{1} | ||
box.snapshot() | ||
end) | ||
end) | ||
|
||
g.after_all(function(cg) | ||
if cg.server ~= nil then | ||
cg.server:drop() | ||
end | ||
end) | ||
|
||
g.after_each(function(cg) | ||
if cg.server ~= nil then | ||
cg.server:stop() | ||
end | ||
end) | ||
|
||
g.test_setting_cfg_option = function(cg) | ||
cg.server = server:new{box_cfg = {memtx_sort_threads = 3}} | ||
cg.server:start() | ||
cg.server:exec(function() | ||
t.assert_error_msg_equals( | ||
"Can't set option 'memtx_sort_threads' dynamically", | ||
box.cfg, {memtx_sort_threads = 5}) | ||
end) | ||
end | ||
|
||
g.test_setting_openmp_env_var = function(cg) | ||
cg.server = server:new{box_cfg = {log_level = 'warn'}, | ||
env = {OMP_NUM_THREADS = ' 3'}} | ||
cg.server:start() | ||
t.helpers.retrying({}, function() | ||
local p = "OMP_NUM_THREADS is used to set number" .. | ||
" of sorting threads. Use cfg option" .. | ||
"'memtx_sort_threads' instead." | ||
t.assert_not_equals(cg.server:grep_log(p), nil) | ||
end) | ||
cg.server:stop() | ||
end | ||
|
||
g.test_setting_openmp_env_var_bad = function(cg) | ||
cg.server = server:new{env= {OMP_NUM_THREADS = '300'}} | ||
cg.server:start() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.