-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support asynchronous bootstrap for crud storages. The main motivation is compatibility with Tarantool 3 instances, which start in read-only mode. We do not support async bootstrap for crud routers since they do not change `box`, thus may start on read-only instances without any issues. Part of #412 Part of #415
- Loading branch information
1 parent
482ea31
commit fd2f14b
Showing
7 changed files
with
148 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
local t = require('luatest') | ||
|
||
local helpers = require('test.helper') | ||
local vtest = require('test.vshard_helpers.vtest') | ||
|
||
local g = t.group('async_bootstrap') | ||
|
||
local function prepare_clean_cluster(cg) | ||
local cfg = { | ||
sharding = { | ||
['s-1'] = { | ||
replicas = { | ||
['s1-master'] = { | ||
instance_uuid = helpers.uuid('b', 1), | ||
master = true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
bucket_count = 3000, | ||
storage_entrypoint = nil, | ||
router_entrypoint = nil, | ||
all_entrypoint = nil, | ||
crud_init = false, | ||
} | ||
|
||
cg.cfg = vtest.config_new(cfg) | ||
vtest.cluster_new(cg, cg.cfg) | ||
end | ||
|
||
|
||
g.test_async_storage_bootstrap = function(cg) | ||
helpers.skip_if_box_watch_unsupported() | ||
|
||
-- Prepare a clean vshard cluster with 1 router and 1 storage. | ||
prepare_clean_cluster(cg) | ||
|
||
-- Sync bootstrap router. | ||
cg.cluster:server('router'):exec(function() | ||
require('crud').init_router() | ||
end) | ||
|
||
-- Async bootstrap storage. | ||
cg.cluster:server('s1-master'):exec(function() | ||
require('crud').init_storage{async = true} | ||
end) | ||
|
||
-- Assert storage is ready after some time. | ||
cg.router = cg.cluster:server('router') | ||
helpers.wait_crud_is_ready_on_cluster(cg, {backend = helpers.backend.VSHARD}) | ||
end | ||
|
||
g.after_test('test_async_storage_bootstrap', function(cg) | ||
if cg.cluster ~= nil then | ||
cg.cluster:drop() | ||
end | ||
end) | ||
|
||
|
||
g.test_async_storage_bootstrap_unsupported = function(cg) | ||
helpers.skip_if_box_watch_supported() | ||
|
||
-- Prepare a clean vshard cluster with 1 router and 1 storage. | ||
prepare_clean_cluster(cg) | ||
|
||
-- Async bootstrap storage (fails). | ||
cg.cluster:server('s1-master'):exec(function() | ||
t.assert_error_msg_contains( | ||
'async start is supported only for Tarantool versions with box.watch support', | ||
function() | ||
require('crud').init_storage{async = true} | ||
end | ||
) | ||
end) | ||
end | ||
|
||
g.after_test('test_async_storage_bootstrap_unsupported', function(cg) | ||
if cg.cluster ~= nil then | ||
cg.cluster:drop() | ||
end | ||
end) |