From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 1610729CFA for ; Mon, 1 Apr 2019 10:13:52 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bptm1jvH_isN for ; Mon, 1 Apr 2019 10:13:51 -0400 (EDT) Received: from smtp59.i.mail.ru (smtp59.i.mail.ru [217.69.128.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 97D5329BED for ; Mon, 1 Apr 2019 10:13:50 -0400 (EDT) From: avtikhon Subject: [tarantool-patches] [PATCH v1 3/6] Rename replicas to the each test specified name Date: Mon, 1 Apr 2019 17:13:32 +0300 Message-Id: <33fd4391bbebf99c39921e1927f79d798b2f4b19.1554127720.git.avtikhon@gmail.com> In-Reply-To: References: In-Reply-To: References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Alexander Turenko Cc: avtikhon , tarantool-patches@freelists.org From: avtikhon --- test/replication/before_replace.lua | 37 +++++ test/replication/before_replace.result | 44 +++--- test/replication/before_replace.test.lua | 44 +++--- test/replication/before_replace1.lua | 1 + test/replication/before_replace2.lua | 1 + test/replication/before_replace3.lua | 1 + test/replication/catch.result | 22 +-- test/replication/catch.test.lua | 22 +-- test/replication/ddl.lua | 4 +- test/replication/errinj.result | 70 +++++----- test/replication/errinj.test.lua | 70 +++++----- test/replication/force_recovery.result | 16 +-- test/replication/force_recovery.test.lua | 16 +-- test/replication/gc.result | 49 +++---- test/replication/gc.test.lua | 38 +++-- test/replication/gc_no_space.result | 22 +-- test/replication/gc_no_space.test.lua | 22 +-- test/replication/hot_standby.result | 22 +-- test/replication/hot_standby.test.lua | 22 +-- test/replication/join_vclock.result | 9 +- test/replication/join_vclock.test.lua | 8 +- test/replication/local_spaces.result | 18 +-- test/replication/local_spaces.test.lua | 18 +-- test/replication/lua/fast_replica.lua | 125 +++++++++++++---- test/replication/misc.lua | 37 +++++ test/replication/misc.result | 132 +++++++++--------- test/replication/misc.test.lua | 132 +++++++++--------- test/replication/misc1.lua | 1 + test/replication/misc2.lua | 1 + test/replication/misc3.lua | 1 + test/replication/on_replace.result | 14 +- test/replication/on_replace.test.lua | 14 +- test/replication/prune.result | 38 ++--- test/replication/prune.test.lua | 35 ++--- test/replication/quorum.result | 32 ++--- test/replication/quorum.test.lua | 32 ++--- test/replication/recover_missing_xlog.lua | 37 +++++ test/replication/recover_missing_xlog.result | 18 ++- .../replication/recover_missing_xlog.test.lua | 18 ++- test/replication/recover_missing_xlog1.lua | 1 + test/replication/recover_missing_xlog2.lua | 1 + test/replication/recover_missing_xlog3.lua | 1 + test/replication/replica_rejoin.result | 52 +++---- test/replication/replica_rejoin.test.lua | 52 +++---- test/replication/replica_uuid_ro1.lua | 1 - test/replication/replica_uuid_ro2.lua | 1 - test/replication/replica_uuid_ro3.lua | 1 - ...a_uuid_ro.lua => replicaset_ro_mostly.lua} | 6 +- test/replication/replicaset_ro_mostly.result | 6 +- .../replication/replicaset_ro_mostly.test.lua | 6 +- test/replication/replicaset_ro_mostly1.lua | 1 + test/replication/replicaset_ro_mostly2.lua | 1 + test/replication/replicaset_ro_mostly3.lua | 1 + test/replication/show_error_on_disconnect.lua | 38 +++++ .../show_error_on_disconnect.result | 12 +- .../show_error_on_disconnect.test.lua | 12 +- .../replication/show_error_on_disconnect1.lua | 1 + .../replication/show_error_on_disconnect2.lua | 1 + .../replication/show_error_on_disconnect3.lua | 1 + test/replication/skip_conflict_row.result | 36 ++--- test/replication/skip_conflict_row.test.lua | 36 ++--- test/replication/status.result | 24 ++-- test/replication/status.test.lua | 24 ++-- test/replication/sync.result | 28 ++-- test/replication/sync.test.lua | 28 ++-- test/replication/wal_rw_stress.result | 22 +-- test/replication/wal_rw_stress.test.lua | 22 +-- 67 files changed, 938 insertions(+), 721 deletions(-) create mode 100644 test/replication/before_replace.lua create mode 120000 test/replication/before_replace1.lua create mode 120000 test/replication/before_replace2.lua create mode 120000 test/replication/before_replace3.lua create mode 100644 test/replication/misc.lua create mode 120000 test/replication/misc1.lua create mode 120000 test/replication/misc2.lua create mode 120000 test/replication/misc3.lua create mode 100644 test/replication/recover_missing_xlog.lua create mode 120000 test/replication/recover_missing_xlog1.lua create mode 120000 test/replication/recover_missing_xlog2.lua create mode 120000 test/replication/recover_missing_xlog3.lua delete mode 120000 test/replication/replica_uuid_ro1.lua delete mode 120000 test/replication/replica_uuid_ro2.lua delete mode 120000 test/replication/replica_uuid_ro3.lua rename test/replication/{replica_uuid_ro.lua => replicaset_ro_mostly.lua} (83%) create mode 120000 test/replication/replicaset_ro_mostly1.lua create mode 120000 test/replication/replicaset_ro_mostly2.lua create mode 120000 test/replication/replicaset_ro_mostly3.lua create mode 100644 test/replication/show_error_on_disconnect.lua create mode 120000 test/replication/show_error_on_disconnect1.lua create mode 120000 test/replication/show_error_on_disconnect2.lua create mode 120000 test/replication/show_error_on_disconnect3.lua diff --git a/test/replication/before_replace.lua b/test/replication/before_replace.lua new file mode 100644 index 000000000..093676548 --- /dev/null +++ b/test/replication/before_replace.lua @@ -0,0 +1,37 @@ +#!/usr/bin/env tarantool + +-- get instance name from filename (before_replace1.lua => before_replace1) +local INSTANCE_ID = string.match(arg[0], "%d") +local USER = 'cluster' +local PASSWORD = 'somepassword' +local SOCKET_DIR = require('fio').cwd() +local TIMEOUT = tonumber(arg[1]) +local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 60.0 + +local function instance_uri(instance_id) + --return 'localhost:'..(3310 + instance_id) + return SOCKET_DIR..'/before_replace'..instance_id..'.sock'; +end + +-- start console first +require('console').listen(os.getenv('ADMIN')) + +box.cfg({ + listen = instance_uri(INSTANCE_ID); +-- log_level = 7; + replication = { + USER..':'..PASSWORD..'@'..instance_uri(1); + USER..':'..PASSWORD..'@'..instance_uri(2); + USER..':'..PASSWORD..'@'..instance_uri(3); + }; + replication_timeout = TIMEOUT; + replication_connect_timeout = CON_TIMEOUT; +}) + +box.once("bootstrap", function() + local test_run = require('test_run').new() + box.schema.user.create(USER, { password = PASSWORD }) + box.schema.user.grant(USER, 'replication') + box.schema.space.create('test', {engine = test_run:get_cfg('engine')}) + box.space.test:create_index('primary') +end) diff --git a/test/replication/before_replace.result b/test/replication/before_replace.result index ced40547e..714825232 100644 --- a/test/replication/before_replace.result +++ b/test/replication/before_replace.result @@ -10,7 +10,7 @@ test_run = env.new() engine = test_run:get_cfg('engine') --- ... -SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } +SERVERS = { 'before_replace1', 'before_replace2', 'before_replace3' } --- ... -- Deploy a cluster. @@ -26,7 +26,7 @@ test_run:cmd("setopt delimiter ';'") --- - true ... -test_run:cmd("switch autobootstrap1"); +test_run:cmd("switch before_replace1"); --- - true ... @@ -37,7 +37,7 @@ _ = box.space.test:before_replace(function(old, new) end); --- ... -test_run:cmd("switch autobootstrap2"); +test_run:cmd("switch before_replace2"); --- - true ... @@ -48,7 +48,7 @@ _ = box.space.test:before_replace(function(old, new) end); --- ... -test_run:cmd("switch autobootstrap3"); +test_run:cmd("switch before_replace3"); --- - true ... @@ -75,7 +75,7 @@ test_run:cmd("setopt delimiter ''"); ... -- Stall replication and generate incompatible data -- on the replicas. -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch before_replace1") --- - true ... @@ -86,7 +86,7 @@ box.error.injection.set('ERRINJ_RELAY_TIMEOUT', 0.01) for i = 1, 10 do box.space.test:replace{i, i % 3 == 1 and i * 10 or i} end --- ... -test_run:cmd("switch autobootstrap2") +test_run:cmd("switch before_replace2") --- - true ... @@ -97,7 +97,7 @@ box.error.injection.set('ERRINJ_RELAY_TIMEOUT', 0.01) for i = 1, 10 do box.space.test:replace{i, i % 3 == 2 and i * 10 or i} end --- ... -test_run:cmd("switch autobootstrap3") +test_run:cmd("switch before_replace3") --- - true ... @@ -121,7 +121,7 @@ vclock2 = test_run:wait_cluster_vclock(SERVERS, vclock) ... -- Check that all replicas converged to the same data -- and the state persists after restart. -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch before_replace1") --- - true ... @@ -138,7 +138,7 @@ box.space.test:select() - [9, 90] - [10, 100] ... -test_run:cmd('restart server autobootstrap1 with args="0.1 0.5"') +test_run:cmd('restart server before_replace1 with args="0.1 0.5"') box.space.test:select() --- - - [1, 10] @@ -152,7 +152,7 @@ box.space.test:select() - [9, 90] - [10, 100] ... -test_run:cmd("switch autobootstrap2") +test_run:cmd("switch before_replace2") --- - true ... @@ -169,7 +169,7 @@ box.space.test:select() - [9, 90] - [10, 100] ... -test_run:cmd('restart server autobootstrap2 with args="0.1 0.5"') +test_run:cmd('restart server before_replace2 with args="0.1 0.5"') box.space.test:select() --- - - [1, 10] @@ -183,7 +183,7 @@ box.space.test:select() - [9, 90] - [10, 100] ... -test_run:cmd("switch autobootstrap3") +test_run:cmd("switch before_replace3") --- - true ... @@ -204,7 +204,7 @@ push_err --- - Session 'applier' does not support push() ... -test_run:cmd('restart server autobootstrap3 with args="0.1 0.5"') +test_run:cmd('restart server before_replace3 with args="0.1 0.5"') box.space.test:select() --- - - [1, 10] @@ -243,15 +243,15 @@ _ = box.space.test:create_index('primary') box.schema.user.grant('guest', 'replication') --- ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server before_replace_gh3722 with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server before_replace_gh3722") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch before_replace_gh3722") --- - true ... @@ -266,12 +266,12 @@ box.space.test:replace{1, 1} --- - [1, 1] ... -_ = test_run:wait_vclock('replica', test_run:get_vclock('default')) +_ = test_run:wait_vclock('before_replace_gh3722', test_run:get_vclock('default')) --- ... -- Check that replace{1, 2} coming from the master was suppressed -- by the before_replace trigger on the replica. -test_run:cmd("switch replica") +test_run:cmd("switch before_replace_gh3722") --- - true ... @@ -282,7 +282,7 @@ box.space.test:select() -- [1, 2] -- Check that master's component of replica's vclock was bumped -- so that the replica doesn't apply replace{1, 2} after restart -- while syncing with the master. -test_run:cmd("restart server replica") +test_run:cmd("restart server before_replace_gh3722") box.space.test:select() -- [1, 2] --- - - [1, 2] @@ -291,15 +291,15 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server before_replace_gh3722") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server before_replace_gh3722") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server before_replace_gh3722") --- - true ... diff --git a/test/replication/before_replace.test.lua b/test/replication/before_replace.test.lua index bcc6dc00d..406fd63e7 100644 --- a/test/replication/before_replace.test.lua +++ b/test/replication/before_replace.test.lua @@ -5,7 +5,7 @@ env = require('test_run') test_run = env.new() engine = test_run:get_cfg('engine') -SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } +SERVERS = { 'before_replace1', 'before_replace2', 'before_replace3' } -- Deploy a cluster. test_run:create_cluster(SERVERS, "replication", {args="0.1"}) @@ -14,19 +14,19 @@ test_run:wait_fullmesh(SERVERS) -- Setup space:before_replace trigger on all replicas. -- The trigger favors tuples with a greater value. test_run:cmd("setopt delimiter ';'") -test_run:cmd("switch autobootstrap1"); +test_run:cmd("switch before_replace1"); _ = box.space.test:before_replace(function(old, new) if old ~= nil and new ~= nil then return new[2] > old[2] and new or old end end); -test_run:cmd("switch autobootstrap2"); +test_run:cmd("switch before_replace2"); _ = box.space.test:before_replace(function(old, new) if old ~= nil and new ~= nil then return new[2] > old[2] and new or old end end); -test_run:cmd("switch autobootstrap3"); +test_run:cmd("switch before_replace3"); -- -- gh-2677 - test that an applier can not push() messages. Applier -- session is available in Lua, so the test is here instead of @@ -46,13 +46,13 @@ test_run:cmd("setopt delimiter ''"); -- Stall replication and generate incompatible data -- on the replicas. -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch before_replace1") box.error.injection.set('ERRINJ_RELAY_TIMEOUT', 0.01) for i = 1, 10 do box.space.test:replace{i, i % 3 == 1 and i * 10 or i} end -test_run:cmd("switch autobootstrap2") +test_run:cmd("switch before_replace2") box.error.injection.set('ERRINJ_RELAY_TIMEOUT', 0.01) for i = 1, 10 do box.space.test:replace{i, i % 3 == 2 and i * 10 or i} end -test_run:cmd("switch autobootstrap3") +test_run:cmd("switch before_replace3") box.error.injection.set('ERRINJ_RELAY_TIMEOUT', 0.01) for i = 1, 10 do box.space.test:replace{i, i % 3 == 0 and i * 10 or i} end @@ -63,18 +63,18 @@ vclock2 = test_run:wait_cluster_vclock(SERVERS, vclock) -- Check that all replicas converged to the same data -- and the state persists after restart. -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch before_replace1") box.space.test:select() -test_run:cmd('restart server autobootstrap1 with args="0.1 0.5"') +test_run:cmd('restart server before_replace1 with args="0.1 0.5"') box.space.test:select() -test_run:cmd("switch autobootstrap2") +test_run:cmd("switch before_replace2") box.space.test:select() -test_run:cmd('restart server autobootstrap2 with args="0.1 0.5"') +test_run:cmd('restart server before_replace2 with args="0.1 0.5"') box.space.test:select() -test_run:cmd("switch autobootstrap3") +test_run:cmd("switch before_replace3") box.space.test:select() push_err -test_run:cmd('restart server autobootstrap3 with args="0.1 0.5"') +test_run:cmd('restart server before_replace3 with args="0.1 0.5"') box.space.test:select() -- Cleanup. @@ -92,32 +92,32 @@ _ = box.space.test:create_index('primary') box.schema.user.grant('guest', 'replication') -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") +test_run:cmd("create server before_replace_gh3722 with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server before_replace_gh3722") -test_run:cmd("switch replica") +test_run:cmd("switch before_replace_gh3722") _ = box.space.test:before_replace(function(old, new) return new:update{{'+', 2, 1}} end) test_run:cmd("switch default") box.space.test:replace{1, 1} -_ = test_run:wait_vclock('replica', test_run:get_vclock('default')) +_ = test_run:wait_vclock('before_replace_gh3722', test_run:get_vclock('default')) -- Check that replace{1, 2} coming from the master was suppressed -- by the before_replace trigger on the replica. -test_run:cmd("switch replica") +test_run:cmd("switch before_replace_gh3722") box.space.test:select() -- [1, 2] -- Check that master's component of replica's vclock was bumped -- so that the replica doesn't apply replace{1, 2} after restart -- while syncing with the master. -test_run:cmd("restart server replica") +test_run:cmd("restart server before_replace_gh3722") box.space.test:select() -- [1, 2] test_run:cmd("switch default") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server before_replace_gh3722") +test_run:cmd("cleanup server before_replace_gh3722") +test_run:cmd("delete server before_replace_gh3722") test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/before_replace1.lua b/test/replication/before_replace1.lua new file mode 120000 index 000000000..bef35a453 --- /dev/null +++ b/test/replication/before_replace1.lua @@ -0,0 +1 @@ +before_replace.lua \ No newline at end of file diff --git a/test/replication/before_replace2.lua b/test/replication/before_replace2.lua new file mode 120000 index 000000000..bef35a453 --- /dev/null +++ b/test/replication/before_replace2.lua @@ -0,0 +1 @@ +before_replace.lua \ No newline at end of file diff --git a/test/replication/before_replace3.lua b/test/replication/before_replace3.lua new file mode 120000 index 000000000..bef35a453 --- /dev/null +++ b/test/replication/before_replace3.lua @@ -0,0 +1 @@ +before_replace.lua \ No newline at end of file diff --git a/test/replication/catch.result b/test/replication/catch.result index e1b2995ec..3a88f5976 100644 --- a/test/replication/catch.result +++ b/test/replication/catch.result @@ -16,15 +16,15 @@ errinj = box.error.injection box.schema.user.grant('guest', 'replication') --- ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica_timeout.lua'") +test_run:cmd("create server catch with rpl_master=default, script='replication/replica_timeout.lua'") --- - true ... -test_run:cmd("start server replica with args='0.1'") +test_run:cmd("start server catch with args='0.1'") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch catch") --- - true ... @@ -39,7 +39,7 @@ s = box.schema.space.create('test', {engine = engine}); index = s:create_index('primary', {type = (engine == 'vinyl' and 'tree' or 'hash') }) --- ... -test_run:cmd("switch replica") +test_run:cmd("switch catch") --- - true ... @@ -53,7 +53,7 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server catch") --- - true ... @@ -66,11 +66,11 @@ errinj.set('ERRINJ_RELAY_SEND_DELAY', true) for i = 1, 100 do s:insert{i, 'this is test message12345'} end --- ... -test_run:cmd("start server replica with args='0.01'") +test_run:cmd("start server catch with args='0.01'") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch catch") --- - true ... @@ -99,7 +99,7 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("set variable r_uri to 'replica.listen'") +test_run:cmd("set variable r_uri to 'catch.listen'") --- - true ... @@ -116,15 +116,15 @@ errinj.set('ERRINJ_RELAY_SEND_DELAY', false) - ok ... -- Cleanup. -test_run:cmd("stop server replica") +test_run:cmd("stop server catch") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server catch") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server catch") --- - true ... diff --git a/test/replication/catch.test.lua b/test/replication/catch.test.lua index 7a531df39..b40be5ce4 100644 --- a/test/replication/catch.test.lua +++ b/test/replication/catch.test.lua @@ -6,28 +6,28 @@ net_box = require('net.box') errinj = box.error.injection box.schema.user.grant('guest', 'replication') -test_run:cmd("create server replica with rpl_master=default, script='replication/replica_timeout.lua'") -test_run:cmd("start server replica with args='0.1'") -test_run:cmd("switch replica") +test_run:cmd("create server catch with rpl_master=default, script='replication/replica_timeout.lua'") +test_run:cmd("start server catch with args='0.1'") +test_run:cmd("switch catch") test_run:cmd("switch default") s = box.schema.space.create('test', {engine = engine}); -- Vinyl does not support hash index. index = s:create_index('primary', {type = (engine == 'vinyl' and 'tree' or 'hash') }) -test_run:cmd("switch replica") +test_run:cmd("switch catch") fiber = require('fiber') while box.space.test == nil do fiber.sleep(0.01) end test_run:cmd("switch default") -test_run:cmd("stop server replica") +test_run:cmd("stop server catch") -- Insert values on the master while replica is stopped and can't -- fetch them. errinj.set('ERRINJ_RELAY_SEND_DELAY', true) for i = 1, 100 do s:insert{i, 'this is test message12345'} end -test_run:cmd("start server replica with args='0.01'") -test_run:cmd("switch replica") +test_run:cmd("start server catch with args='0.01'") +test_run:cmd("switch catch") -- Check that replica doesn't enter read-write mode before -- catching up with the master: to check that we stop sending @@ -47,7 +47,7 @@ box.space.test:replace{1} -- Case #2: replace tuple on replica by net.box. test_run:cmd("switch default") -test_run:cmd("set variable r_uri to 'replica.listen'") +test_run:cmd("set variable r_uri to 'catch.listen'") c = net_box.connect(r_uri) d = c.space.test:replace{1} @@ -55,9 +55,9 @@ d = c.space.test:replace{1} errinj.set('ERRINJ_RELAY_SEND_DELAY', false) -- Cleanup. -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server catch") +test_run:cmd("cleanup server catch") +test_run:cmd("delete server catch") test_run:cleanup_cluster() box.space.test:drop() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/ddl.lua b/test/replication/ddl.lua index ac889c929..ebaee2217 100644 --- a/test/replication/ddl.lua +++ b/test/replication/ddl.lua @@ -1,6 +1,6 @@ #!/usr/bin/env tarantool --- get instance name from filename (autobootstrap1.lua => autobootstrap1) +-- get instance name from filename (ddl1.lua => ddl1) local INSTANCE_ID = string.match(arg[0], "%d") local USER = 'cluster' local PASSWORD = 'somepassword' @@ -11,7 +11,7 @@ local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 60.0 local function instance_uri(instance_id) --return 'localhost:'..(3310 + instance_id) - return SOCKET_DIR..'/autobootstrap'..instance_id..'.sock'; + return SOCKET_DIR..'/ddl'..instance_id..'.sock'; end -- start console first diff --git a/test/replication/errinj.result b/test/replication/errinj.result index d4ac85ae8..05f11cff1 100644 --- a/test/replication/errinj.result +++ b/test/replication/errinj.result @@ -19,15 +19,15 @@ s = box.schema.space.create('test', {engine = engine}); index = s:create_index('primary') --- ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server errinj with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server errinj") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch errinj") --- - true ... @@ -106,7 +106,7 @@ test_f(11, true) test_f(21, true) --- ... -test_run:cmd("switch replica") +test_run:cmd("switch errinj") --- - true ... @@ -140,7 +140,7 @@ test_f(31, true) test_f(41, true) --- ... -test_run:cmd("switch replica") +test_run:cmd("switch errinj") --- - true ... @@ -168,7 +168,7 @@ box.snapshot() test_f(51, true) --- ... -test_run:cmd("switch replica") +test_run:cmd("switch errinj") --- - true ... @@ -195,7 +195,7 @@ box.snapshot() -- 3. Restore replication. -- 4. Generate some records on the master. -- 5. Make sure they'll make it to the slave. -test_run:cmd("switch replica") +test_run:cmd("switch errinj") --- - true ... @@ -211,7 +211,7 @@ s:replace{9000, "won't make it"} --- - [9000, 'won''t make it'] ... -test_run:cmd("switch replica") +test_run:cmd("switch errinj") --- - true ... @@ -239,7 +239,7 @@ test_run:cmd("switch default") test_f(61, true) --- ... -test_run:cmd("switch replica") +test_run:cmd("switch errinj") --- - true ... @@ -251,11 +251,11 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server errinj") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server errinj") --- - true ... @@ -264,11 +264,11 @@ test_run:cmd("cleanup server replica") box.cfg{replication_timeout = 0.0001} --- ... -test_run:cmd("start server replica") +test_run:cmd("start server errinj") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch errinj") --- - true ... @@ -291,7 +291,7 @@ errinj.set("ERRINJ_RELAY_REPORT_INTERVAL", 5) box.cfg{replication_timeout = 0.05} --- ... -test_run:cmd("switch replica") +test_run:cmd("switch errinj") --- - true ... @@ -326,7 +326,7 @@ errinj.set("ERRINJ_RELAY_REPORT_INTERVAL", 0) box.cfg{replication_timeout = 5} --- ... -test_run:cmd("switch replica") +test_run:cmd("switch errinj") --- - true ... @@ -346,11 +346,11 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server errinj") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server errinj") --- - true ... @@ -361,11 +361,11 @@ errinj.set("ERRINJ_RELAY_EXIT_DELAY", 0.01) --- - ok ... -test_run:cmd("start server replica") +test_run:cmd("start server errinj") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch errinj") --- - true ... @@ -396,11 +396,11 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server errinj") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server errinj") --- - true ... @@ -411,15 +411,15 @@ errinj.set("ERRINJ_RELAY_EXIT_DELAY", 0) box.cfg{replication_timeout = 0.01} --- ... -test_run:cmd("create server replica_timeout with rpl_master=default, script='replication/replica_timeout.lua'") +test_run:cmd("create server errinj_timeout with rpl_master=default, script='replication/replica_timeout.lua'") --- - true ... -test_run:cmd("start server replica_timeout with args='0.01 0.5'") +test_run:cmd("start server errinj_timeout with args='0.01 0.5'") --- - true ... -test_run:cmd("switch replica_timeout") +test_run:cmd("switch errinj_timeout") --- - true ... @@ -441,7 +441,7 @@ errinj.set("ERRINJ_RELAY_REPORT_INTERVAL", 5) --- - ok ... -test_run:cmd("switch replica_timeout") +test_run:cmd("switch errinj_timeout") --- - true ... @@ -457,11 +457,11 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica_timeout") +test_run:cmd("stop server errinj_timeout") --- - true ... -test_run:cmd("cleanup server replica_timeout") +test_run:cmd("cleanup server errinj_timeout") --- - true ... @@ -471,11 +471,11 @@ errinj.set("ERRINJ_RELAY_REPORT_INTERVAL", 0) ... -- Check replica's ACKs don't prevent the master from sending -- heartbeat messages (gh-3160). -test_run:cmd("start server replica_timeout with args='0.009 0.5'") +test_run:cmd("start server errinj_timeout with args='0.009 0.5'") --- - true ... -test_run:cmd("switch replica_timeout") +test_run:cmd("switch errinj_timeout") --- - true ... @@ -500,11 +500,11 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica_timeout") +test_run:cmd("stop server errinj_timeout") --- - true ... -test_run:cmd("cleanup server replica_timeout") +test_run:cmd("cleanup server errinj_timeout") --- - true ... @@ -519,11 +519,11 @@ for i = 0, 9999 do box.space.test:replace({i, 4, 5, 'test'}) end -- during the join stage, i.e. a replica with a minuscule -- timeout successfully bootstraps and breaks connection only -- after subscribe. -test_run:cmd("start server replica_timeout with args='0.00001 0.5'") +test_run:cmd("start server errinj_timeout with args='0.00001 0.5'") --- - true ... -test_run:cmd("switch replica_timeout") +test_run:cmd("switch errinj_timeout") --- - true ... @@ -549,11 +549,11 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica_timeout") +test_run:cmd("stop server errinj_timeout") --- - true ... -test_run:cmd("cleanup server replica_timeout") +test_run:cmd("cleanup server errinj_timeout") --- - true ... diff --git a/test/replication/errinj.test.lua b/test/replication/errinj.test.lua index 6522df9d8..8459bf280 100644 --- a/test/replication/errinj.test.lua +++ b/test/replication/errinj.test.lua @@ -8,9 +8,9 @@ box.schema.user.grant('guest', 'replication') s = box.schema.space.create('test', {engine = engine}); index = s:create_index('primary') -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("create server errinj with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server errinj") +test_run:cmd("switch errinj") fiber = require('fiber') @@ -55,7 +55,7 @@ errinj.set("ERRINJ_WAL_WRITE_PARTIAL", -1) test_f(11, true) test_f(21, true) -test_run:cmd("switch replica") +test_run:cmd("switch errinj") wait_repl(30) test_run:cmd("switch default") @@ -69,7 +69,7 @@ errinj.set("ERRINJ_WAL_WRITE_DISK", false) test_f(31, true) test_f(41, true) -test_run:cmd("switch replica") +test_run:cmd("switch errinj") wait_repl(50) test_run:cmd("switch default") @@ -79,7 +79,7 @@ box.space.test.index[0]:count() errinj.set("ERRINJ_WAL_WRITE_EOF", true) box.snapshot() test_f(51, true) -test_run:cmd("switch replica") +test_run:cmd("switch errinj") wait_repl(60) test_run:cmd("switch default") errinj.set("ERRINJ_WAL_WRITE_EOF", false) @@ -92,11 +92,11 @@ box.snapshot() -- 3. Restore replication. -- 4. Generate some records on the master. -- 5. Make sure they'll make it to the slave. -test_run:cmd("switch replica") +test_run:cmd("switch errinj") box.error.injection.set("ERRINJ_WAL_WRITE", true) test_run:cmd("switch default") s:replace{9000, "won't make it"} -test_run:cmd("switch replica") +test_run:cmd("switch errinj") while box.info.replication[1].upstream.status == 'follow' do fiber.sleep(0.0001) end box.error.injection.set("ERRINJ_WAL_WRITE", false) s:replace{9001, "bump lsn"} @@ -104,19 +104,19 @@ box.cfg{replication={}} box.cfg{replication = os.getenv('MASTER')} test_run:cmd("switch default") test_f(61, true) -test_run:cmd("switch replica") +test_run:cmd("switch errinj") wait_repl(70) test_run:cmd("switch default") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") +test_run:cmd("stop server errinj") +test_run:cmd("cleanup server errinj") -- Set minuscule timeout to make replication stop -- immediately after join. box.cfg{replication_timeout = 0.0001} -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("start server errinj") +test_run:cmd("switch errinj") fiber = require'fiber' while box.info.replication[1].upstream.message ~= 'timed out' do fiber.sleep(0.0001) end @@ -125,7 +125,7 @@ test_run:cmd("switch default") -- to trigger acks on the replica. errinj.set("ERRINJ_RELAY_REPORT_INTERVAL", 5) box.cfg{replication_timeout = 0.05} -test_run:cmd("switch replica") +test_run:cmd("switch errinj") -- wait for reconnect while box.info.replication[1].upstream.status ~= 'follow' do fiber.sleep(0.0001) end box.info.replication[1].upstream.status @@ -138,7 +138,7 @@ test_run:cmd("switch default") errinj.set("ERRINJ_RELAY_REPORT_INTERVAL", 0) box.cfg{replication_timeout = 5} -test_run:cmd("switch replica") +test_run:cmd("switch errinj") -- wait for reconnect while box.info.replication[1].upstream.status ~= 'follow' do fiber.sleep(0.0001) end -- wait for ack timeout again, should be ok @@ -146,14 +146,14 @@ fiber.sleep(0.01) {box.info.replication[1].upstream.status, box.info.replication[1].upstream.message} test_run:cmd("switch default") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") +test_run:cmd("stop server errinj") +test_run:cmd("cleanup server errinj") errinj = box.error.injection errinj.set("ERRINJ_RELAY_EXIT_DELAY", 0.01) -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("start server errinj") +test_run:cmd("switch errinj") fiber = require('fiber') old_repl = box.cfg.replication -- shutdown applier @@ -165,15 +165,15 @@ while box.info.replication[1].upstream.status ~= 'disconnected' do fiber.sleep(0 while box.info.replication[1].upstream.status ~= 'follow' do fiber.sleep(0.0001) end test_run:cmd("switch default") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") +test_run:cmd("stop server errinj") +test_run:cmd("cleanup server errinj") errinj.set("ERRINJ_RELAY_EXIT_DELAY", 0) box.cfg{replication_timeout = 0.01} -test_run:cmd("create server replica_timeout with rpl_master=default, script='replication/replica_timeout.lua'") -test_run:cmd("start server replica_timeout with args='0.01 0.5'") -test_run:cmd("switch replica_timeout") +test_run:cmd("create server errinj_timeout with rpl_master=default, script='replication/replica_timeout.lua'") +test_run:cmd("start server errinj_timeout with args='0.01 0.5'") +test_run:cmd("switch errinj_timeout") fiber = require('fiber') while box.info.replication[1].upstream.status ~= 'follow' do fiber.sleep(0.0001) end @@ -182,7 +182,7 @@ box.info.replication[1].upstream.status test_run:cmd("switch default") errinj.set("ERRINJ_RELAY_REPORT_INTERVAL", 5) -test_run:cmd("switch replica_timeout") +test_run:cmd("switch errinj_timeout") -- Check replica's disconnection on timeout (gh-3025). -- If master stops send heartbeat messages to replica, -- due to infinite read timeout connection never breaks, @@ -191,15 +191,15 @@ test_run:cmd("switch replica_timeout") while box.info.replication[1].upstream.message ~= 'timed out' do fiber.sleep(0.0001) end test_run:cmd("switch default") -test_run:cmd("stop server replica_timeout") -test_run:cmd("cleanup server replica_timeout") +test_run:cmd("stop server errinj_timeout") +test_run:cmd("cleanup server errinj_timeout") errinj.set("ERRINJ_RELAY_REPORT_INTERVAL", 0) -- Check replica's ACKs don't prevent the master from sending -- heartbeat messages (gh-3160). -test_run:cmd("start server replica_timeout with args='0.009 0.5'") -test_run:cmd("switch replica_timeout") +test_run:cmd("start server errinj_timeout with args='0.009 0.5'") +test_run:cmd("switch errinj_timeout") fiber = require('fiber') while box.info.replication[1].upstream.status ~= 'follow' do fiber.sleep(0.0001) end @@ -208,8 +208,8 @@ for i = 0, 15 do fiber.sleep(0.01) if box.info.replication[1].upstream.status ~= test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status test_run:cmd("switch default") -test_run:cmd("stop server replica_timeout") -test_run:cmd("cleanup server replica_timeout") +test_run:cmd("stop server errinj_timeout") +test_run:cmd("cleanup server errinj_timeout") box.snapshot() for i = 0, 9999 do box.space.test:replace({i, 4, 5, 'test'}) end @@ -218,8 +218,8 @@ for i = 0, 9999 do box.space.test:replace({i, 4, 5, 'test'}) end -- during the join stage, i.e. a replica with a minuscule -- timeout successfully bootstraps and breaks connection only -- after subscribe. -test_run:cmd("start server replica_timeout with args='0.00001 0.5'") -test_run:cmd("switch replica_timeout") +test_run:cmd("start server errinj_timeout with args='0.00001 0.5'") +test_run:cmd("switch errinj_timeout") fiber = require('fiber') while box.info.replication[1].upstream.message ~= 'timed out' do fiber.sleep(0.0001) end @@ -227,5 +227,5 @@ test_run:cmd("stop server default") test_run:cmd("deploy server default") test_run:cmd("start server default") test_run:cmd("switch default") -test_run:cmd("stop server replica_timeout") -test_run:cmd("cleanup server replica_timeout") +test_run:cmd("stop server errinj_timeout") +test_run:cmd("cleanup server errinj_timeout") diff --git a/test/replication/force_recovery.result b/test/replication/force_recovery.result index d3539e7c8..fb93cfcfd 100644 --- a/test/replication/force_recovery.result +++ b/test/replication/force_recovery.result @@ -17,16 +17,16 @@ box.schema.user.grant('guest', 'replication') --- ... -- Deploy a replica. -test_run:cmd("create server test with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server force_recovery with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server test") +test_run:cmd("start server force_recovery") --- - true ... -- Stop the replica and wait for the relay thread to exit. -test_run:cmd("stop server test") +test_run:cmd("stop server force_recovery") --- - true ... @@ -63,11 +63,11 @@ fio.unlink(xlog) box.cfg{force_recovery = true} --- ... -test_run:cmd("start server test") +test_run:cmd("start server force_recovery") --- - true ... -test_run:cmd("switch test") +test_run:cmd("switch force_recovery") --- - true ... @@ -87,15 +87,15 @@ box.cfg{force_recovery = false} --- ... -- Cleanup. -test_run:cmd("stop server test") +test_run:cmd("stop server force_recovery") --- - true ... -test_run:cmd("cleanup server test") +test_run:cmd("cleanup server force_recovery") --- - true ... -test_run:cmd("delete server test") +test_run:cmd("delete server force_recovery") --- - true ... diff --git a/test/replication/force_recovery.test.lua b/test/replication/force_recovery.test.lua index 7669d7f22..3582f9788 100644 --- a/test/replication/force_recovery.test.lua +++ b/test/replication/force_recovery.test.lua @@ -9,11 +9,11 @@ _ = box.space.test:create_index('primary') box.schema.user.grant('guest', 'replication') -- Deploy a replica. -test_run:cmd("create server test with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server test") +test_run:cmd("create server force_recovery with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server force_recovery") -- Stop the replica and wait for the relay thread to exit. -test_run:cmd("stop server test") +test_run:cmd("stop server force_recovery") test_run:wait_cond(function() return box.info.replication[2].downstream.status == 'stopped' end) or box.info.replication[2].downstream.status -- Delete an xlog file that is needed by the replica. @@ -27,17 +27,17 @@ fio.unlink(xlog) -- Check that even though box.cfg.force_recovery is set, -- replication will still fail due to LSN gap. box.cfg{force_recovery = true} -test_run:cmd("start server test") -test_run:cmd("switch test") +test_run:cmd("start server force_recovery") +test_run:cmd("switch force_recovery") box.space.test:select() test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'stopped' end) or box.info test_run:cmd("switch default") box.cfg{force_recovery = false} -- Cleanup. -test_run:cmd("stop server test") -test_run:cmd("cleanup server test") -test_run:cmd("delete server test") +test_run:cmd("stop server force_recovery") +test_run:cmd("cleanup server force_recovery") +test_run:cmd("delete server force_recovery") test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') box.space.test:drop() diff --git a/test/replication/gc.result b/test/replication/gc.result index 950697112..e662857f0 100644 --- a/test/replication/gc.result +++ b/test/replication/gc.result @@ -16,7 +16,7 @@ fio = require('fio') test_run:cleanup_cluster() --- ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server gc with rpl_master=default, script='replication/replica.lua'") --- - true ... @@ -105,7 +105,7 @@ test_run:cmd("setopt delimiter ''"); --- ... -- Start the replica. -test_run:cmd("start server replica") +test_run:cmd("start server gc") --- - true ... @@ -113,7 +113,7 @@ test_run:cmd("start server replica") -- would have normally removed the snapshot the replica was -- bootstrapped from, the replica should still receive all -- data from the master. Check it. -test_run:cmd("switch replica") +test_run:cmd("switch gc") --- - true ... @@ -183,7 +183,7 @@ box.error.injection.set("ERRINJ_RELAY_SEND_DELAY", false) - ok ... -- Check that the replica received all data from the master. -test_run:cmd("switch replica") +test_run:cmd("switch gc") --- - true ... @@ -214,7 +214,7 @@ wait_xlog(0) -- replica until it receives a confirmation that the data has -- been applied (gh-2825). -- -test_run:cmd("switch replica") +test_run:cmd("switch gc") --- - true ... @@ -252,7 +252,7 @@ wait_xlog(2) --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch gc") --- - true ... @@ -265,9 +265,9 @@ box.cfg{replication = {}} --- ... -- Restart the replica to reestablish replication. -test_run:cmd("restart server replica") +test_run:cmd("restart server gc") -- Wait for the replica to catch up. -test_run:cmd("switch replica") +test_run:cmd("switch gc") --- - true ... @@ -293,11 +293,7 @@ wait_xlog(1) - true ... -- Stop the replica. -test_run:cmd("stop server replica") ---- -- true -... -test_run:cmd("cleanup server replica") +replica_set.hibernate(test_run, 'gc') --- - true ... @@ -354,22 +350,25 @@ box.snapshot() --- - ok ... -replica_set.join(test_run, 3) +test_name = 'gc' --- ... -replica_set.stop_all(test_run) +replica_set.join(test_run, test_name, 3) +--- +... +replica_set.stop_all(test_run, test_name) --- ... for i = 11, 50 do s:replace{i} if i % 10 == 0 then box.snapshot() end end --- ... -replica_set.start_all(test_run) +replica_set.start_all(test_run, test_name) --- ... -replica_set.wait_all(test_run) +replica_set.wait_all(test_run, test_name) --- ... -replica_set.drop_all(test_run) +replica_set.prune_all(test_run, test_name) --- ... -- @@ -381,11 +380,11 @@ fio = require('fio') --- ... -- Start a replica and set it up as a master for this instance. -test_run:cmd("start server replica") +test_run:cmd("start server gc") --- - true ... -replica_port = test_run:eval('replica', 'return box.cfg.listen')[1] +replica_port = test_run:eval('gc', 'return box.cfg.listen')[1] --- ... replica_port ~= nil @@ -396,15 +395,7 @@ box.cfg{replication = replica_port} --- ... -- Stop the replica and write a few WALs. -test_run:cmd("stop server replica") ---- -- true -... -test_run:cmd("cleanup server replica") ---- -- true -... -test_run:cmd("delete server replica") +replica_set.drop(test_run, 'gc') --- - true ... diff --git a/test/replication/gc.test.lua b/test/replication/gc.test.lua index d9c6960fd..55f858132 100644 --- a/test/replication/gc.test.lua +++ b/test/replication/gc.test.lua @@ -5,7 +5,7 @@ fiber = require('fiber') fio = require('fio') test_run:cleanup_cluster() -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server gc with rpl_master=default, script='replication/replica.lua'") -- Make each snapshot trigger garbage collection. default_checkpoint_count = box.cfg.checkpoint_count @@ -56,13 +56,13 @@ end) test_run:cmd("setopt delimiter ''"); -- Start the replica. -test_run:cmd("start server replica") +test_run:cmd("start server gc") -- Despite the fact that we invoked garbage collection that -- would have normally removed the snapshot the replica was -- bootstrapped from, the replica should still receive all -- data from the master. Check it. -test_run:cmd("switch replica") +test_run:cmd("switch gc") test_run:wait_cond(function() return box.space.test:count() == 200 end) or box.space.test:count() box.space.test:count() test_run:cmd("switch default") @@ -94,7 +94,7 @@ wait_xlog(2) box.error.injection.set("ERRINJ_RELAY_SEND_DELAY", false) -- Check that the replica received all data from the master. -test_run:cmd("switch replica") +test_run:cmd("switch gc") test_run:wait_cond(function() return box.space.test:count() == 300 end) or box.space.test:count() box.space.test:count() test_run:cmd("switch default") @@ -108,7 +108,7 @@ wait_xlog(0) -- replica until it receives a confirmation that the data has -- been applied (gh-2825). -- -test_run:cmd("switch replica") +test_run:cmd("switch gc") -- Prevent the replica from applying any rows. box.error.injection.set("ERRINJ_WAL_DELAY", true) test_run:cmd("switch default") @@ -122,14 +122,14 @@ fiber.sleep(0.1) -- wait for master to relay data -- the old snapshot. wait_gc(1) wait_xlog(2) -test_run:cmd("switch replica") +test_run:cmd("switch gc") -- Unblock the replica and break replication. box.error.injection.set("ERRINJ_WAL_DELAY", false) box.cfg{replication = {}} -- Restart the replica to reestablish replication. -test_run:cmd("restart server replica") +test_run:cmd("restart server gc") -- Wait for the replica to catch up. -test_run:cmd("switch replica") +test_run:cmd("switch gc") test_run:wait_cond(function() return box.space.test:count() == 310 end) or box.space.test:count() box.space.test:count() test_run:cmd("switch default") @@ -137,8 +137,7 @@ test_run:cmd("switch default") wait_gc(1) wait_xlog(1) -- Stop the replica. -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") +replica_set.hibernate(test_run, 'gc') -- Invoke garbage collection. Check that it removes the old -- checkpoint, but keeps the xlog last used by the replica. @@ -164,14 +163,15 @@ s:truncate() for i = 1, 10 do s:replace{i} end box.snapshot() -replica_set.join(test_run, 3) -replica_set.stop_all(test_run) +test_name = 'gc' +replica_set.join(test_run, test_name, 3) +replica_set.stop_all(test_run, test_name) for i = 11, 50 do s:replace{i} if i % 10 == 0 then box.snapshot() end end -replica_set.start_all(test_run) -replica_set.wait_all(test_run) -replica_set.drop_all(test_run) +replica_set.start_all(test_run, test_name) +replica_set.wait_all(test_run, test_name) +replica_set.prune_all(test_run, test_name) -- -- Check that once a replica is removed from the cluster table, @@ -181,15 +181,13 @@ replica_set.drop_all(test_run) fio = require('fio') -- Start a replica and set it up as a master for this instance. -test_run:cmd("start server replica") -replica_port = test_run:eval('replica', 'return box.cfg.listen')[1] +test_run:cmd("start server gc") +replica_port = test_run:eval('gc', 'return box.cfg.listen')[1] replica_port ~= nil box.cfg{replication = replica_port} -- Stop the replica and write a few WALs. -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +replica_set.drop(test_run, 'gc') _ = s:auto_increment{} box.snapshot() _ = s:auto_increment{} diff --git a/test/replication/gc_no_space.result b/test/replication/gc_no_space.result index e860ab00f..5933ff11f 100644 --- a/test/replication/gc_no_space.result +++ b/test/replication/gc_no_space.result @@ -67,19 +67,19 @@ box.snapshot() -- -- Create a few dead replicas to pin WAL files. -- -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server gc_no_space with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server gc_no_space") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server gc_no_space") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server gc_no_space") --- - true ... @@ -91,15 +91,15 @@ box.snapshot() --- - ok ... -test_run:cmd("start server replica") +test_run:cmd("start server gc_no_space") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server gc_no_space") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server gc_no_space") --- - true ... @@ -111,19 +111,19 @@ box.snapshot() --- - ok ... -test_run:cmd("start server replica") +test_run:cmd("start server gc_no_space") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server gc_no_space") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server gc_no_space") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server gc_no_space") --- - true ... diff --git a/test/replication/gc_no_space.test.lua b/test/replication/gc_no_space.test.lua index 98ccd401b..0b30f9ff2 100644 --- a/test/replication/gc_no_space.test.lua +++ b/test/replication/gc_no_space.test.lua @@ -39,25 +39,25 @@ box.snapshot() -- -- Create a few dead replicas to pin WAL files. -- -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") +test_run:cmd("create server gc_no_space with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server gc_no_space") +test_run:cmd("stop server gc_no_space") +test_run:cmd("cleanup server gc_no_space") s:auto_increment{} box.snapshot() -test_run:cmd("start server replica") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") +test_run:cmd("start server gc_no_space") +test_run:cmd("stop server gc_no_space") +test_run:cmd("cleanup server gc_no_space") s:auto_increment{} box.snapshot() -test_run:cmd("start server replica") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("start server gc_no_space") +test_run:cmd("stop server gc_no_space") +test_run:cmd("cleanup server gc_no_space") +test_run:cmd("delete server gc_no_space") -- -- Make a few checkpoints and check that old WAL files are not diff --git a/test/replication/hot_standby.result b/test/replication/hot_standby.result index b140887df..f840caa1f 100644 --- a/test/replication/hot_standby.result +++ b/test/replication/hot_standby.result @@ -20,7 +20,7 @@ test_run:cmd("create server hot_standby with script='replication/hot_standby.lua --- - true ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server hot_standby_replica with rpl_master=default, script='replication/replica.lua'") --- - true ... @@ -28,7 +28,7 @@ test_run:cmd("start server hot_standby") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server hot_standby_replica") --- - true ... @@ -36,7 +36,7 @@ test_run:cmd("setopt delimiter ';'") --- - true ... -test_run:cmd("set connection default, hot_standby, replica") +test_run:cmd("set connection default, hot_standby, hot_standby_replica") fiber = require('fiber'); --- ... @@ -95,7 +95,7 @@ test_run:cmd("setopt delimiter ''"); --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch hot_standby_replica") --- - true ... @@ -131,7 +131,7 @@ index = space:create_index('primary', {type = 'tree'}) --- ... -- set begin lsn on master, replica and hot_standby. -test_run:cmd("set variable replica_port to 'replica.listen'") +test_run:cmd("set variable replica_port to 'hot_standby_replica.listen'") --- - true ... @@ -203,7 +203,7 @@ test_run:cmd("switch hot_standby") _wait_lsn(10) --- ... -test_run:cmd("switch replica") +test_run:cmd("switch hot_standby_replica") --- - true ... @@ -234,7 +234,7 @@ test_run:cmd("switch hot_standby") while box.info.status ~= 'running' do fiber.sleep(0.001) end --- ... -test_run:cmd("switch replica") +test_run:cmd("switch hot_standby_replica") --- - true ... @@ -290,7 +290,7 @@ _select(11, 20) - [19, 'the tuple 19'] - [20, 'the tuple 20'] ... -test_run:cmd("switch replica") +test_run:cmd("switch hot_standby_replica") --- - true ... @@ -334,15 +334,15 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server hot_standby_replica") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server hot_standby_replica") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server hot_standby_replica") --- - true ... diff --git a/test/replication/hot_standby.test.lua b/test/replication/hot_standby.test.lua index f43982f15..94bb29795 100644 --- a/test/replication/hot_standby.test.lua +++ b/test/replication/hot_standby.test.lua @@ -6,12 +6,12 @@ box.schema.user.grant('guest', 'replication') box.schema.func.create('_set_pri_lsn') box.schema.user.grant('guest', 'execute', 'function', '_set_pri_lsn') test_run:cmd("create server hot_standby with script='replication/hot_standby.lua', rpl_master=default") -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server hot_standby_replica with rpl_master=default, script='replication/replica.lua'") test_run:cmd("start server hot_standby") -test_run:cmd("start server replica") +test_run:cmd("start server hot_standby_replica") test_run:cmd("setopt delimiter ';'") -test_run:cmd("set connection default, hot_standby, replica") +test_run:cmd("set connection default, hot_standby, hot_standby_replica") fiber = require('fiber'); while box.info.id == 0 do fiber.sleep(0.01) end; while box.space['_priv']:len() < 1 do fiber.sleep(0.001) end; @@ -60,7 +60,7 @@ do end; test_run:cmd("setopt delimiter ''"); -test_run:cmd("switch replica") +test_run:cmd("switch hot_standby_replica") fiber = require('fiber') test_run:cmd("switch hot_standby") fiber = require('fiber') @@ -73,7 +73,7 @@ space = box.schema.space.create('tweedledum', {engine = engine}) index = space:create_index('primary', {type = 'tree'}) -- set begin lsn on master, replica and hot_standby. -test_run:cmd("set variable replica_port to 'replica.listen'") +test_run:cmd("set variable replica_port to 'hot_standby_replica.listen'") REPLICA = require('uri').parse(tostring(replica_port)) REPLICA ~= nil a = (require 'net.box').connect(REPLICA.host, REPLICA.service) @@ -93,14 +93,14 @@ _select(1, 10) test_run:cmd("switch hot_standby") _wait_lsn(10) -test_run:cmd("switch replica") +test_run:cmd("switch hot_standby_replica") _wait_lsn(10) _select(1, 10) test_run:cmd("stop server default") test_run:cmd("switch hot_standby") while box.info.status ~= 'running' do fiber.sleep(0.001) end -test_run:cmd("switch replica") +test_run:cmd("switch hot_standby_replica") -- hot_standby.listen is garbage, since hot_standby.lua -- uses MASTER environment variable for its listen @@ -115,7 +115,7 @@ test_run:cmd("switch hot_standby") _insert(11, 20) _select(11, 20) -test_run:cmd("switch replica") +test_run:cmd("switch hot_standby_replica") _wait_lsn(10) _select(11, 20) @@ -125,7 +125,7 @@ test_run:cmd("delete server hot_standby") test_run:cmd("deploy server default") test_run:cmd("start server default") test_run:cmd("switch default") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server hot_standby_replica") +test_run:cmd("cleanup server hot_standby_replica") +test_run:cmd("delete server hot_standby_replica") test_run:cleanup_cluster() diff --git a/test/replication/join_vclock.result b/test/replication/join_vclock.result index d5abeb750..d4f69626e 100644 --- a/test/replication/join_vclock.result +++ b/test/replication/join_vclock.result @@ -41,10 +41,10 @@ function repl_f() local i = 0 while not done do s:replace({i, i}) fiber.sleep(0. _ = fiber.create(repl_f) --- ... -replica_set.join(test_run, 1) +replica_set.join(test_run, "join_vclock") --- ... -test_run:cmd("switch replica1") +test_run:cmd("switch join_vclock") --- - true ... @@ -63,7 +63,7 @@ errinj.set("ERRINJ_RELAY_FINAL_SLEEP", false) --- - ok ... -test_run:cmd("switch replica1") +test_run:cmd("switch join_vclock") --- - true ... @@ -79,8 +79,9 @@ test_run:cmd("switch default") --- - true ... -replica_set.drop_all(test_run) +replica_set.prune(test_run, "join_vclock") --- +- true ... box.space.test:drop() --- diff --git a/test/replication/join_vclock.test.lua b/test/replication/join_vclock.test.lua index 2a06739c2..94de3ce06 100644 --- a/test/replication/join_vclock.test.lua +++ b/test/replication/join_vclock.test.lua @@ -17,19 +17,19 @@ done = false function repl_f() local i = 0 while not done do s:replace({i, i}) fiber.sleep(0.001) i = i + 1 end ch:put(true) end _ = fiber.create(repl_f) -replica_set.join(test_run, 1) -test_run:cmd("switch replica1") +replica_set.join(test_run, "join_vclock") +test_run:cmd("switch join_vclock") test_run:cmd("switch default") done = true ch:get() errinj.set("ERRINJ_RELAY_FINAL_SLEEP", false) -test_run:cmd("switch replica1") +test_run:cmd("switch join_vclock") test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status test_run:wait_cond(function() return box.space.test.index.primary:max()[1] == box.space.test.index[0]:count() - 1 end) or box.space.test.index[0]:count() test_run:cmd("switch default") -replica_set.drop_all(test_run) +replica_set.prune(test_run, "join_vclock") box.space.test:drop() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/local_spaces.result b/test/replication/local_spaces.result index ed1b76da8..da11ebf8c 100644 --- a/test/replication/local_spaces.result +++ b/test/replication/local_spaces.result @@ -96,15 +96,15 @@ _ = s3:insert{2} box.schema.user.grant('guest', 'replication') --- ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server local_spaces with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server local_spaces") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch local_spaces") --- - true ... @@ -162,10 +162,10 @@ _ = s3:insert{3} vclock = test_run:get_vclock('default') --- ... -_ = test_run:wait_vclock('replica', vclock) +_ = test_run:wait_vclock('local_spaces', vclock) --- ... -test_run:cmd("switch replica") +test_run:cmd("switch local_spaces") --- - true ... @@ -187,7 +187,7 @@ box.space.test3:select() - [2, 2, 2] - [3, 3, 3] ... -test_run:cmd("restart server replica") +test_run:cmd("restart server local_spaces") box.space.test1:select() --- - - [1] @@ -208,15 +208,15 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server local_spaces") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server local_spaces") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server local_spaces") --- - true ... diff --git a/test/replication/local_spaces.test.lua b/test/replication/local_spaces.test.lua index bb7294538..45954b1cd 100644 --- a/test/replication/local_spaces.test.lua +++ b/test/replication/local_spaces.test.lua @@ -42,10 +42,10 @@ _ = s2:insert{2} _ = s3:insert{2} box.schema.user.grant('guest', 'replication') -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") +test_run:cmd("create server local_spaces with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server local_spaces") -test_run:cmd("switch replica") +test_run:cmd("switch local_spaces") box.space.test1.is_local box.space.test2.is_local box.space.test3.is_local @@ -62,21 +62,21 @@ _ = s1:insert{3} _ = s2:insert{3} _ = s3:insert{3} vclock = test_run:get_vclock('default') -_ = test_run:wait_vclock('replica', vclock) +_ = test_run:wait_vclock('local_spaces', vclock) -test_run:cmd("switch replica") +test_run:cmd("switch local_spaces") box.space.test1:select() box.space.test2:select() box.space.test3:select() -test_run:cmd("restart server replica") +test_run:cmd("restart server local_spaces") box.space.test1:select() box.space.test2:select() box.space.test3:select() test_run:cmd("switch default") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server local_spaces") +test_run:cmd("cleanup server local_spaces") +test_run:cmd("delete server local_spaces") test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/lua/fast_replica.lua b/test/replication/lua/fast_replica.lua index 8c772c41f..b98598de5 100644 --- a/test/replication/lua/fast_replica.lua +++ b/test/replication/lua/fast_replica.lua @@ -1,18 +1,23 @@ -function join(inspector, n) - local path = os.getenv('TARANTOOL_SRC_DIR') +function create(inspector, name, replica) + replica = replica or 'replica' + os.execute('echo "Creating replica '..name..'"') + os.execute('mkdir -p tmp') + os.execute('cp '..os.getenv('TARANTOOL_SRC_DIR')..'/test/replication/'..replica..'.lua ./tmp/'..name..'.lua') + os.execute('chmod +x ./tmp/'..name..'.lua') + inspector:cmd("create server "..name.." with rpl_master=default, script='"..box.cfg.wal_dir.."/../tmp/"..name..".lua'") +end + +function join(inspector, name, n, replica) + n = n or 1 for i=1,n do local rid = tostring(i) - os.execute('mkdir -p tmp') - os.execute('cp '..path..'/test/replication/replica.lua ./tmp/replica'..rid..'.lua') - os.execute('chmod +x ./tmp/replica'..rid..'.lua') - local out_dir = box.cfg.wal_dir - inspector:cmd("create server replica"..rid.." with rpl_master=default, script='"..out_dir.."/../tmp/replica"..rid..".lua'") - inspector:cmd("start server replica"..rid) + if n == 1 then rid = '' end + create(inspector, name..rid, replica) + start(inspector, name..rid) end end - function call_all(callback) local all = box.space._cluster:select{} for _, tuple in pairs(all) do @@ -24,45 +29,91 @@ function call_all(callback) end function unregister(inspector, id) - box.space._cluster:delete{id} + id = id or 2 + if box.space._cluster:delete{id} then + return true + end + return false +end + +function id_to_str(id) + local strnum + if id == nil then + strnum = '' + else + strnum = tostring(id - 1) + end + return strnum +end + +-- replica commands + +function start(inspector, name, id) + return inspector:cmd('start server '..name..id_to_str(id)) +end + +function stop(inspector, name, id) + return inspector:cmd('stop server '..name..id_to_str(id)) +end + +function cleanup(inspector, name, id) + return inspector:cmd('cleanup server '..name..id_to_str(id)) +end + +function wait(inspector, name, id) + return inspector:wait_lsn(name..id_to_str(id), 'default') end -function start(inspector, id) - inspector:cmd('start server replica'..tostring(id - 1)) +function delete(inspector, name, id) + return inspector:cmd('delete server '..name..id_to_str(id)) end -function stop(inspector, id) - inspector:cmd('stop server replica'..tostring(id - 1)) +-- replica modes + +function hibernate(inspector, name, id) + return stop(inspector, name, id) and cleanup(inspector, name, id) end -function wait(inspector, id) - inspector:wait_lsn('replica'..tostring(id - 1), 'default') +function drop(inspector, name, id) + return hibernate(inspector, name, id) and delete(inspector, name, id) end -function delete(inspector, id) - inspector:cmd('stop server replica'..tostring(id - 1)) - inspector:cmd('delete server replica'..tostring(id - 1)) +function prune(inspector, name, id) + return unregister(inspector, id) and drop(inspector, name, id) +end + +-- multi calls + +function start_all(inspector, name) + call_all(function (id) start(inspector, name, id) end) end -function drop(inspector, id) - unregister(inspector, id) - delete(inspector, id) +function stop_all(inspector, name) + call_all(function (id) stop(inspector, name, id) end) end -function start_all(inspector) - call_all(function (id) start(inspector, id) end) +function cleanup_all(inspector, name) + call_all(function (id) cleanup(inspector, name, id) end) end -function stop_all(inspector) - call_all(function (id) stop(inspector, id) end) +function wait_all(inspector, name) + call_all(function (id) wait(inspector, name, id) end) end -function wait_all(inspector) - call_all(function (id) wait(inspector, id) end) +function delete_all(inspector, name) + call_all(function (id) delete(inspector, name, id) end) end -function drop_all(inspector) - call_all(function (id) drop(inspector, id) end) +function hibernate_all(inspector, name) + call_all(function (id) hibernate(inspector, name, id) end) +end + +function drop_all(inspector, name) + call_all(function (id) drop(inspector, name, id) end) +end + +function prune_all(inspector, name) + call_all(function (id) prune(inspector, name, id) end) end function vclock_diff(left, right) @@ -79,12 +130,24 @@ function vclock_diff(left, right) end return { + create = create; join = join; + start = start; start_all = start_all; + stop = stop; stop_all = stop_all; + cleanup = cleanup; + cleanup_all = cleanup_all; + wait = wait; wait_all = wait_all; + delete = delete; + delete_all = delete_all; + hibernate = hibernate; + hibernate_all = hibernate_all; + drop = drop; drop_all = drop_all; + prune = prune; + prune_all = prune_all; vclock_diff = vclock_diff; unregister = unregister; - delete = delete; } diff --git a/test/replication/misc.lua b/test/replication/misc.lua new file mode 100644 index 000000000..65cf8c8fe --- /dev/null +++ b/test/replication/misc.lua @@ -0,0 +1,37 @@ +#!/usr/bin/env tarantool + +-- get instance name from filename (misc1.lua => misc1) +local INSTANCE_ID = string.match(arg[0], "%d") +local USER = 'cluster' +local PASSWORD = 'somepassword' +local SOCKET_DIR = require('fio').cwd() +local TIMEOUT = tonumber(arg[1]) +local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 60.0 + +local function instance_uri(instance_id) + --return 'localhost:'..(3310 + instance_id) + return SOCKET_DIR..'/misc'..instance_id..'.sock'; +end + +-- start console first +require('console').listen(os.getenv('ADMIN')) + +box.cfg({ + listen = instance_uri(INSTANCE_ID); +-- log_level = 7; + replication = { + USER..':'..PASSWORD..'@'..instance_uri(1); + USER..':'..PASSWORD..'@'..instance_uri(2); + USER..':'..PASSWORD..'@'..instance_uri(3); + }; + replication_timeout = TIMEOUT; + replication_connect_timeout = CON_TIMEOUT; +}) + +box.once("bootstrap", function() + local test_run = require('test_run').new() + box.schema.user.create(USER, { password = PASSWORD }) + box.schema.user.grant(USER, 'replication') + box.schema.space.create('test', {engine = test_run:get_cfg('engine')}) + box.space.test:create_index('primary') +end) diff --git a/test/replication/misc.result b/test/replication/misc.result index f32bbd531..5226f5f99 100644 --- a/test/replication/misc.result +++ b/test/replication/misc.result @@ -54,41 +54,41 @@ box.cfg{replication_timeout = replication_timeout, replication_connect_timeout = replica_uuid = uuid.new() --- ... -test_run:cmd('create server test with rpl_master=default, script="replication/replica_uuid.lua"') +test_run:cmd('create server misc_gh3111 with rpl_master=default, script="replication/replica_uuid.lua"') --- - true ... -test_run:cmd(string.format('start server test with args="%s"', replica_uuid)) +test_run:cmd(string.format('start server misc_gh3111 with args="%s"', replica_uuid)) --- - true ... -test_run:cmd('stop server test') +test_run:cmd('stop server misc_gh3111') --- - true ... -test_run:cmd('cleanup server test') +test_run:cmd('cleanup server misc_gh3111') --- - true ... box.cfg{read_only = true} --- ... -test_run:cmd(string.format('start server test with args="%s"', replica_uuid)) +test_run:cmd(string.format('start server misc_gh3111 with args="%s"', replica_uuid)) --- - true ... -test_run:cmd('stop server test') +test_run:cmd('stop server misc_gh3111') --- - true ... -test_run:cmd('cleanup server test') +test_run:cmd('cleanup server misc_gh3111') --- - true ... box.cfg{read_only = false} --- ... -test_run:cmd('delete server test') +test_run:cmd('delete server misc_gh3111') --- - true ... @@ -96,7 +96,7 @@ test_run:cleanup_cluster() --- ... -- gh-3160 - Send heartbeats if there are changes from a remote master only -SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } +SERVERS = { 'misc1', 'misc2', 'misc3' } --- ... -- Deploy a cluster. @@ -106,7 +106,7 @@ test_run:create_cluster(SERVERS, "replication", {args="0.1"}) test_run:wait_fullmesh(SERVERS) --- ... -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch misc1") --- - true ... @@ -116,7 +116,7 @@ test_run = require('test_run').new() box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01} --- ... -test_run:cmd("switch autobootstrap2") +test_run:cmd("switch misc2") --- - true ... @@ -126,7 +126,7 @@ test_run = require('test_run').new() box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01} --- ... -test_run:cmd("switch autobootstrap3") +test_run:cmd("switch misc3") --- - true ... @@ -180,7 +180,7 @@ test_timeout() ... -- gh-3247 - Sequence-generated value is not replicated in case -- the request was sent via iproto. -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch misc1") --- - true ... @@ -217,13 +217,13 @@ box.space.space1:select{} --- - - [2, 1, 'data'] ... -vclock = test_run:get_vclock("autobootstrap1") +vclock = test_run:get_vclock("misc1") --- ... -_ = test_run:wait_vclock("autobootstrap2", vclock) +_ = test_run:wait_vclock("misc2", vclock) --- ... -test_run:cmd("switch autobootstrap2") +test_run:cmd("switch misc2") --- - true ... @@ -231,7 +231,7 @@ box.space.space1:select{} --- - - [2, 1, 'data'] ... -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch misc1") --- - true ... @@ -268,15 +268,15 @@ lim.rlim_cur = 64 rlimit.setrlimit(rlimit.RLIMIT_NOFILE, lim) --- ... -test_run:cmd('create server sock with rpl_master=default, script="replication/replica.lua"') +test_run:cmd('create server misc_gh3642 with rpl_master=default, script="replication/replica.lua"') --- - true ... -test_run:cmd('start server sock') +test_run:cmd('start server misc_gh3642') --- - true ... -test_run:cmd('switch sock') +test_run:cmd('switch misc_gh3642') --- - true ... @@ -318,15 +318,15 @@ lim.rlim_cur = old_fno rlimit.setrlimit(rlimit.RLIMIT_NOFILE, lim) --- ... -test_run:cmd("stop server sock") +test_run:cmd("stop server misc_gh3642") --- - true ... -test_run:cmd("cleanup server sock") +test_run:cmd("cleanup server misc_gh3642") --- - true ... -test_run:cmd("delete server sock") +test_run:cmd("delete server misc_gh3642") --- - true ... @@ -337,42 +337,42 @@ box.schema.user.revoke('guest', 'replication') --- ... -- gh-3510 assertion failure in replica_on_applier_disconnect() -test_run:cmd('create server er_load1 with script="replication/er_load1.lua"') +test_run:cmd('create server misc_gh3510_1 with script="replication/er_load1.lua"') --- - true ... -test_run:cmd('create server er_load2 with script="replication/er_load2.lua"') +test_run:cmd('create server misc_gh3510_2 with script="replication/er_load2.lua"') --- - true ... -test_run:cmd('start server er_load1 with wait=False, wait_load=False') +test_run:cmd('start server misc_gh3510_1 with wait=False, wait_load=False') --- - true ... --- instance er_load2 will fail with error ER_READONLY. this is ok. --- We only test here that er_load1 doesn't assert. -test_run:cmd('start server er_load2 with wait=True, wait_load=True, crash_expected = True') +-- instance misc_gh3510_2 will fail with error ER_READONLY. this is ok. +-- We only test here that misc_gh3510_1 doesn't assert. +test_run:cmd('start server misc_gh3510_2 with wait=True, wait_load=True, crash_expected = True') --- - false ... -test_run:cmd('stop server er_load1') +test_run:cmd('stop server misc_gh3510_1') --- - true ... --- er_load2 exits automatically. -test_run:cmd('cleanup server er_load1') +-- misc_gh3510_2 exits automatically. +test_run:cmd('cleanup server misc_gh3510_1') --- - true ... -test_run:cmd('cleanup server er_load2') +test_run:cmd('cleanup server misc_gh3510_2') --- - true ... -test_run:cmd('delete server er_load1') +test_run:cmd('delete server misc_gh3510_1') --- - true ... -test_run:cmd('delete server er_load2') +test_run:cmd('delete server misc_gh3510_2') --- - true ... @@ -386,11 +386,11 @@ test_run:cleanup_cluster() fiber = require('fiber') --- ... -test_run:cmd("create server replica_auth with rpl_master=default, script='replication/replica_auth.lua'") +test_run:cmd("create server misc_gh3637 with rpl_master=default, script='replication/replica_auth.lua'") --- - true ... -test_run:cmd("start server replica_auth with wait=False, wait_load=False, args='cluster:pass 0.05'") +test_run:cmd("start server misc_gh3637 with wait=False, wait_load=False, args='cluster:pass 0.05'") --- - true ... @@ -410,18 +410,18 @@ while box.info.replication[2] == nil do fiber.sleep(0.01) end vclock = test_run:get_vclock('default') --- ... -_ = test_run:wait_vclock('replica_auth', vclock) +_ = test_run:wait_vclock('misc_gh3637', vclock) --- ... -test_run:cmd("stop server replica_auth") +test_run:cmd("stop server misc_gh3637") --- - true ... -test_run:cmd("cleanup server replica_auth") +test_run:cmd("cleanup server misc_gh3637") --- - true ... -test_run:cmd("delete server replica_auth") +test_run:cmd("delete server misc_gh3637") --- - true ... @@ -438,15 +438,15 @@ box.schema.user.drop('cluster') box.schema.user.grant('guest', 'replication') --- ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server misc_gh3610 with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server misc_gh3610") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch misc_gh3610") --- - true ... @@ -469,7 +469,7 @@ listen = box.cfg.listen box.cfg{listen = ''} --- ... -test_run:cmd("switch replica") +test_run:cmd("switch misc_gh3610") --- - true ... @@ -486,18 +486,18 @@ test_run:cmd("switch default") box.cfg{listen = listen} --- ... -while test_run:grep_log('replica', 'duplicate connection') == nil do fiber.sleep(0.01) end +while test_run:grep_log('misc_gh3610', 'duplicate connection') == nil do fiber.sleep(0.01) end --- ... -test_run:cmd("stop server replica") +test_run:cmd("stop server misc_gh3610") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server misc_gh3610") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server misc_gh3610") --- - true ... @@ -514,11 +514,11 @@ box.schema.user.revoke('guest', 'replication') box.schema.user.grant('guest', 'replication') --- ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server misc_gh3711 with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server misc_gh3711") --- - true ... @@ -528,7 +528,7 @@ test_run:cmd("start server replica") box.schema.user.revoke('guest', 'replication') --- ... -test_run:cmd("switch replica") +test_run:cmd("switch misc_gh3711") --- - true ... @@ -557,7 +557,7 @@ test_run:cmd("switch default") box.schema.user.grant('guest', 'replication') --- ... -test_run:cmd("switch replica") +test_run:cmd("switch misc_gh3711") --- - true ... @@ -574,7 +574,7 @@ test_run:cmd("switch default") box.schema.user.revoke('guest', 'replication') --- ... -test_run:cmd("switch replica") +test_run:cmd("switch misc_gh3711") --- - true ... @@ -589,15 +589,15 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server misc_gh3711") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server misc_gh3711") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server misc_gh3711") --- - true ... @@ -607,18 +607,18 @@ test_run:cleanup_cluster() -- -- gh-3704 move cluster id check to replica -- -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server misc_gh3704 with rpl_master=default, script='replication/replica.lua'") --- - true ... box.schema.user.grant("guest", "replication") --- ... -test_run:cmd("start server replica") +test_run:cmd("start server misc_gh3704") --- - true ... -test_run:grep_log("replica", "REPLICASET_UUID_MISMATCH") +test_run:grep_log("misc_gh3704", "REPLICASET_UUID_MISMATCH") --- - null ... @@ -627,7 +627,7 @@ box.info.replication[2].downstream.status - follow ... -- change master's cluster uuid and check that replica doesn't connect. -test_run:cmd("stop server replica") +test_run:cmd("stop server misc_gh3704") --- - true ... @@ -635,11 +635,11 @@ _ = box.space._schema:replace{'cluster', tostring(uuid.new())} --- ... -- master believes replica is in cluster, but their cluster UUIDs differ. -test_run:cmd("start server replica") +test_run:cmd("start server misc_gh3704") --- - true ... -test_run:wait_log("replica", "REPLICASET_UUID_MISMATCH", nil, 1.0) +test_run:wait_log("misc_gh3704", "REPLICASET_UUID_MISMATCH", nil, 1.0) --- - REPLICASET_UUID_MISMATCH ... @@ -647,15 +647,15 @@ test_run:wait_cond(function() return box.info.replication[2].downstream.status = --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server misc_gh3704") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server misc_gh3704") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server misc_gh3704") --- - true ... diff --git a/test/replication/misc.test.lua b/test/replication/misc.test.lua index ee4584333..f60eec526 100644 --- a/test/replication/misc.test.lua +++ b/test/replication/misc.test.lua @@ -23,31 +23,31 @@ box.cfg{replication_timeout = replication_timeout, replication_connect_timeout = -- gh-3111 - Allow to rebootstrap a replica from a read-only master replica_uuid = uuid.new() -test_run:cmd('create server test with rpl_master=default, script="replication/replica_uuid.lua"') -test_run:cmd(string.format('start server test with args="%s"', replica_uuid)) -test_run:cmd('stop server test') -test_run:cmd('cleanup server test') +test_run:cmd('create server misc_gh3111 with rpl_master=default, script="replication/replica_uuid.lua"') +test_run:cmd(string.format('start server misc_gh3111 with args="%s"', replica_uuid)) +test_run:cmd('stop server misc_gh3111') +test_run:cmd('cleanup server misc_gh3111') box.cfg{read_only = true} -test_run:cmd(string.format('start server test with args="%s"', replica_uuid)) -test_run:cmd('stop server test') -test_run:cmd('cleanup server test') +test_run:cmd(string.format('start server misc_gh3111 with args="%s"', replica_uuid)) +test_run:cmd('stop server misc_gh3111') +test_run:cmd('cleanup server misc_gh3111') box.cfg{read_only = false} -test_run:cmd('delete server test') +test_run:cmd('delete server misc_gh3111') test_run:cleanup_cluster() -- gh-3160 - Send heartbeats if there are changes from a remote master only -SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } +SERVERS = { 'misc1', 'misc2', 'misc3' } -- Deploy a cluster. test_run:create_cluster(SERVERS, "replication", {args="0.1"}) test_run:wait_fullmesh(SERVERS) -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch misc1") test_run = require('test_run').new() box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01} -test_run:cmd("switch autobootstrap2") +test_run:cmd("switch misc2") test_run = require('test_run').new() box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01} -test_run:cmd("switch autobootstrap3") +test_run:cmd("switch misc3") test_run = require('test_run').new() fiber=require('fiber') box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01} @@ -78,7 +78,7 @@ test_timeout() -- gh-3247 - Sequence-generated value is not replicated in case -- the request was sent via iproto. -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch misc1") net_box = require('net.box') _ = box.schema.space.create('space1') _ = box.schema.sequence.create('seq') @@ -89,11 +89,11 @@ c = net_box.connect(box.cfg.listen) c.space.space1:insert{box.NULL, "data"} -- fails, but bumps sequence value c.space.space1:insert{box.NULL, 1, "data"} box.space.space1:select{} -vclock = test_run:get_vclock("autobootstrap1") -_ = test_run:wait_vclock("autobootstrap2", vclock) -test_run:cmd("switch autobootstrap2") +vclock = test_run:get_vclock("misc1") +_ = test_run:wait_vclock("misc2", vclock) +test_run:cmd("switch misc2") box.space.space1:select{} -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch misc1") box.space.space1:drop() test_run:cmd("switch default") @@ -109,9 +109,9 @@ old_fno = lim.rlim_cur lim.rlim_cur = 64 rlimit.setrlimit(rlimit.RLIMIT_NOFILE, lim) -test_run:cmd('create server sock with rpl_master=default, script="replication/replica.lua"') -test_run:cmd('start server sock') -test_run:cmd('switch sock') +test_run:cmd('create server misc_gh3642 with rpl_master=default, script="replication/replica.lua"') +test_run:cmd('start server misc_gh3642') +test_run:cmd('switch misc_gh3642') test_run = require('test_run').new() fiber = require('fiber') test_run:cmd("setopt delimiter ';'") @@ -132,26 +132,26 @@ test_run:cmd('switch default') lim.rlim_cur = old_fno rlimit.setrlimit(rlimit.RLIMIT_NOFILE, lim) -test_run:cmd("stop server sock") -test_run:cmd("cleanup server sock") -test_run:cmd("delete server sock") +test_run:cmd("stop server misc_gh3642") +test_run:cmd("cleanup server misc_gh3642") +test_run:cmd("delete server misc_gh3642") test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') -- gh-3510 assertion failure in replica_on_applier_disconnect() -test_run:cmd('create server er_load1 with script="replication/er_load1.lua"') -test_run:cmd('create server er_load2 with script="replication/er_load2.lua"') -test_run:cmd('start server er_load1 with wait=False, wait_load=False') --- instance er_load2 will fail with error ER_READONLY. this is ok. --- We only test here that er_load1 doesn't assert. -test_run:cmd('start server er_load2 with wait=True, wait_load=True, crash_expected = True') -test_run:cmd('stop server er_load1') --- er_load2 exits automatically. -test_run:cmd('cleanup server er_load1') -test_run:cmd('cleanup server er_load2') -test_run:cmd('delete server er_load1') -test_run:cmd('delete server er_load2') +test_run:cmd('create server misc_gh3510_1 with script="replication/er_load1.lua"') +test_run:cmd('create server misc_gh3510_2 with script="replication/er_load2.lua"') +test_run:cmd('start server misc_gh3510_1 with wait=False, wait_load=False') +-- instance misc_gh3510_2 will fail with error ER_READONLY. this is ok. +-- We only test here that misc_gh3510_1 doesn't assert. +test_run:cmd('start server misc_gh3510_2 with wait=True, wait_load=True, crash_expected = True') +test_run:cmd('stop server misc_gh3510_1') +-- misc_gh3510_2 exits automatically. +test_run:cmd('cleanup server misc_gh3510_1') +test_run:cmd('cleanup server misc_gh3510_2') +test_run:cmd('delete server misc_gh3510_1') +test_run:cmd('delete server misc_gh3510_2') test_run:cleanup_cluster() -- @@ -159,8 +159,8 @@ test_run:cleanup_cluster() -- an error. Now check that we don't hang and successfully connect. -- fiber = require('fiber') -test_run:cmd("create server replica_auth with rpl_master=default, script='replication/replica_auth.lua'") -test_run:cmd("start server replica_auth with wait=False, wait_load=False, args='cluster:pass 0.05'") +test_run:cmd("create server misc_gh3637 with rpl_master=default, script='replication/replica_auth.lua'") +test_run:cmd("start server misc_gh3637 with wait=False, wait_load=False, args='cluster:pass 0.05'") -- Wait a bit to make sure replica waits till user is created. fiber.sleep(0.1) box.schema.user.create('cluster', {password='pass'}) @@ -168,11 +168,11 @@ box.schema.user.grant('cluster', 'replication') while box.info.replication[2] == nil do fiber.sleep(0.01) end vclock = test_run:get_vclock('default') -_ = test_run:wait_vclock('replica_auth', vclock) +_ = test_run:wait_vclock('misc_gh3637', vclock) -test_run:cmd("stop server replica_auth") -test_run:cmd("cleanup server replica_auth") -test_run:cmd("delete server replica_auth") +test_run:cmd("stop server misc_gh3637") +test_run:cmd("cleanup server misc_gh3637") +test_run:cmd("delete server misc_gh3637") test_run:cleanup_cluster() box.schema.user.drop('cluster') @@ -182,9 +182,9 @@ box.schema.user.drop('cluster') -- when trying to connect to the same master twice. -- box.schema.user.grant('guest', 'replication') -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("create server misc_gh3610 with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server misc_gh3610") +test_run:cmd("switch misc_gh3610") replication = box.cfg.replication[1] box.cfg{replication = {replication, replication}} @@ -193,17 +193,17 @@ test_run:cmd("switch default") listen = box.cfg.listen box.cfg{listen = ''} -test_run:cmd("switch replica") +test_run:cmd("switch misc_gh3610") box.cfg{replication_connect_quorum = 0, replication_connect_timeout = 0.01} box.cfg{replication = {replication, replication}} test_run:cmd("switch default") box.cfg{listen = listen} -while test_run:grep_log('replica', 'duplicate connection') == nil do fiber.sleep(0.01) end +while test_run:grep_log('misc_gh3610', 'duplicate connection') == nil do fiber.sleep(0.01) end -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server misc_gh3610") +test_run:cmd("cleanup server misc_gh3610") +test_run:cmd("delete server misc_gh3610") test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') @@ -212,14 +212,14 @@ box.schema.user.revoke('guest', 'replication') -- configuration didn't change. -- box.schema.user.grant('guest', 'replication') -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") +test_run:cmd("create server misc_gh3711 with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server misc_gh3711") -- Access rights are checked only during reconnect. If the new -- and old configurations are equivalent, no reconnect will be -- issued and replication should continue working. box.schema.user.revoke('guest', 'replication') -test_run:cmd("switch replica") +test_run:cmd("switch misc_gh3711") replication = box.cfg.replication[1] box.cfg{replication = {replication}} box.info.status == 'running' @@ -229,39 +229,39 @@ box.info.status == 'running' -- Check that comparison of tables works as expected as well. test_run:cmd("switch default") box.schema.user.grant('guest', 'replication') -test_run:cmd("switch replica") +test_run:cmd("switch misc_gh3711") replication = box.cfg.replication table.insert(replication, box.cfg.listen) test_run:cmd("switch default") box.schema.user.revoke('guest', 'replication') -test_run:cmd("switch replica") +test_run:cmd("switch misc_gh3711") box.cfg{replication = replication} box.info.status == 'running' test_run:cmd("switch default") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server misc_gh3711") +test_run:cmd("cleanup server misc_gh3711") +test_run:cmd("delete server misc_gh3711") test_run:cleanup_cluster() -- -- gh-3704 move cluster id check to replica -- -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server misc_gh3704 with rpl_master=default, script='replication/replica.lua'") box.schema.user.grant("guest", "replication") -test_run:cmd("start server replica") -test_run:grep_log("replica", "REPLICASET_UUID_MISMATCH") +test_run:cmd("start server misc_gh3704") +test_run:grep_log("misc_gh3704", "REPLICASET_UUID_MISMATCH") box.info.replication[2].downstream.status -- change master's cluster uuid and check that replica doesn't connect. -test_run:cmd("stop server replica") +test_run:cmd("stop server misc_gh3704") _ = box.space._schema:replace{'cluster', tostring(uuid.new())} -- master believes replica is in cluster, but their cluster UUIDs differ. -test_run:cmd("start server replica") -test_run:wait_log("replica", "REPLICASET_UUID_MISMATCH", nil, 1.0) +test_run:cmd("start server misc_gh3704") +test_run:wait_log("misc_gh3704", "REPLICASET_UUID_MISMATCH", nil, 1.0) test_run:wait_cond(function() return box.info.replication[2].downstream.status == 'stopped' end) or box.info.replication[2].downstream.status -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server misc_gh3704") +test_run:cmd("cleanup server misc_gh3704") +test_run:cmd("delete server misc_gh3704") test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/misc1.lua b/test/replication/misc1.lua new file mode 120000 index 000000000..ced948b89 --- /dev/null +++ b/test/replication/misc1.lua @@ -0,0 +1 @@ +misc.lua \ No newline at end of file diff --git a/test/replication/misc2.lua b/test/replication/misc2.lua new file mode 120000 index 000000000..ced948b89 --- /dev/null +++ b/test/replication/misc2.lua @@ -0,0 +1 @@ +misc.lua \ No newline at end of file diff --git a/test/replication/misc3.lua b/test/replication/misc3.lua new file mode 120000 index 000000000..ced948b89 --- /dev/null +++ b/test/replication/misc3.lua @@ -0,0 +1 @@ +misc.lua \ No newline at end of file diff --git a/test/replication/on_replace.result b/test/replication/on_replace.result index bb1e3e8c8..3aa0dd38e 100644 --- a/test/replication/on_replace.result +++ b/test/replication/on_replace.result @@ -19,15 +19,15 @@ _ = box.space.test:create_index('primary') box.schema.user.grant('guest', 'replication') --- ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server on_replace with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server on_replace") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch on_replace") --- - true ... @@ -59,7 +59,7 @@ box.space.test:insert{2} --- - [2] ... -test_run:cmd("switch replica") +test_run:cmd("switch on_replace") --- - true ... @@ -83,15 +83,15 @@ test_run:cmd("switch default") -- -- cleanup -- -test_run:cmd("stop server replica") +test_run:cmd("stop server on_replace") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server on_replace") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server on_replace") --- - true ... diff --git a/test/replication/on_replace.test.lua b/test/replication/on_replace.test.lua index 779dbf768..d0a403218 100644 --- a/test/replication/on_replace.test.lua +++ b/test/replication/on_replace.test.lua @@ -10,9 +10,9 @@ _ = box.schema.space.create('test') _ = box.space.test:create_index('primary') box.schema.user.grant('guest', 'replication') -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("create server on_replace with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server on_replace") +test_run:cmd("switch on_replace") session_type = nil -- -- gh-2642: box.session.type() in replication applier @@ -25,7 +25,7 @@ box.space.test:insert{1} session_type test_run:cmd("switch default") box.space.test:insert{2} -test_run:cmd("switch replica") +test_run:cmd("switch on_replace") fiber = require('fiber') while box.space.test:count() < 2 do fiber.sleep(0.01) end -- @@ -36,9 +36,9 @@ test_run:cmd("switch default") -- -- cleanup -- -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server on_replace") +test_run:cmd("cleanup server on_replace") +test_run:cmd("delete server on_replace") test_run:cleanup_cluster() box.space.test:drop() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/prune.result b/test/replication/prune.result index 1a130df40..07b0e8c04 100644 --- a/test/replication/prune.result +++ b/test/replication/prune.result @@ -7,10 +7,10 @@ print 'gh-806: cant prune old replicas by deleting their server ids' print '-------------------------------------------------------------' --- ... -env = require('test_run') +test_name = 'tp1_prune' --- ... -test_run = env.new() +test_run = require('test_run').new() --- ... engine = test_run:get_cfg('engine') @@ -43,7 +43,7 @@ for i=1,10 do space:insert{i, 'test'} end --- ... -- create max number of replicas and check -replica_set.join(test_run, box.schema.REPLICA_MAX - 2) +replica_set.join(test_run, test_name, box.schema.REPLICA_MAX - 2) --- ... while box.space._cluster:len() ~= box.schema.REPLICA_MAX - 1 do fiber.sleep(0.001) end @@ -62,7 +62,7 @@ box.space._cluster:insert{box.schema.REPLICA_MAX, uuid.str()} - error: 'Replica count limit reached: 32' ... -- Delete all replication nodes -replica_set.drop_all(test_run) +replica_set.prune_all(test_run, test_name) --- ... box.space._cluster:len() == 1 @@ -76,6 +76,9 @@ box.snapshot() ... -- Master is not crashed then recovering xlog with {replica_id: 0} in header test_run:cmd('restart server default') +test_name = 'tp2_prune' +--- +... replica_set = require('fast_replica') --- ... @@ -83,14 +86,14 @@ fiber = require('fiber') --- ... -- Rejoin replica and check -replica_set.join(test_run, 1) +replica_set.join(test_run, test_name, 1) --- ... while box.space._cluster:len() ~= 2 do fiber.sleep(0.001) end --- ... -- Check server ids -test_run:cmd('eval replica1 "return box.info.id"') +test_run:cmd('eval '..test_name..' "return box.info.id"') --- - [2] ... @@ -99,22 +102,23 @@ box.space._cluster:len() == 2 - true ... -- Cleanup -replica_set.drop_all(test_run) +replica_set.prune(test_run, test_name) --- +- true ... box.space._cluster:len() == 1 --- - true ... -- delete replica from master -replica_set.join(test_run, 1) +replica_set.join(test_run, test_name, 1) --- ... while box.space._cluster:len() ~= 2 do fiber.sleep(0.001) end --- ... -- Check server ids -test_run:cmd('eval replica1 "return box.info.id"') +test_run:cmd('eval '..test_name..' "return box.info.id"') --- - [2] ... @@ -122,18 +126,19 @@ box.space._cluster:len() == 2 --- - true ... -replica_set.unregister(test_run, 2) +replica_set.unregister(test_run) --- +- true ... -while test_run:cmd('eval replica1 "box.info.replication[1].upstream.status"')[1] ~= 'stopped' do fiber.sleep(0.001) end +while test_run:cmd('eval '..test_name..' "box.info.replication[1].upstream.status"')[1] ~= 'stopped' do fiber.sleep(0.001) end --- ... -test_run:cmd('eval replica1 "box.info.replication[1].upstream.message"') +test_run:cmd('eval '..test_name..' "box.info.replication[1].upstream.message"') --- - ['The local instance id 2 is read-only'] ... -- restart replica and check that replica isn't able to join to cluster -test_run:cmd('restart server replica1') +test_run:cmd('restart server '..test_name) --- - true ... @@ -145,16 +150,17 @@ box.space._cluster:len() == 1 --- - true ... -test_run:cmd('eval replica1 "box.info.replication[1].upstream.status"') +test_run:cmd('eval '..test_name..' "box.info.replication[1].upstream.status"') --- - ['stopped'] ... -test_run:cmd('eval replica1 "box.info.replication[1].upstream.message"')[1]:match("is not registered with replica set") ~= nil +test_run:cmd('eval '..test_name..' "box.info.replication[1].upstream.message"')[1]:match("is not registered with replica set") ~= nil --- - true ... -replica_set.delete(test_run, 2) +replica_set.drop(test_run, test_name) --- +- true ... box.space.test:drop() --- diff --git a/test/replication/prune.test.lua b/test/replication/prune.test.lua index 80847325b..d78596c1d 100644 --- a/test/replication/prune.test.lua +++ b/test/replication/prune.test.lua @@ -2,8 +2,8 @@ print '-------------------------------------------------------------' print 'gh-806: cant prune old replicas by deleting their server ids' print '-------------------------------------------------------------' -env = require('test_run') -test_run = env.new() +test_name = 'tp1_prune' +test_run = require('test_run').new() engine = test_run:get_cfg('engine') replica_set = require('fast_replica') fiber = require('fiber') @@ -20,7 +20,7 @@ index = box.space.test:create_index('primary') for i=1,10 do space:insert{i, 'test'} end -- create max number of replicas and check -replica_set.join(test_run, box.schema.REPLICA_MAX - 2) +replica_set.join(test_run, test_name, box.schema.REPLICA_MAX - 2) while box.space._cluster:len() ~= box.schema.REPLICA_MAX - 1 do fiber.sleep(0.001) end box.space._cluster:len() == box.schema.REPLICA_MAX - 1 @@ -30,49 +30,50 @@ uuid = require('uuid') box.space._cluster:insert{box.schema.REPLICA_MAX, uuid.str()} -- Delete all replication nodes -replica_set.drop_all(test_run) +replica_set.prune_all(test_run, test_name) box.space._cluster:len() == 1 -- Save a snapshot without removed replicas in vclock box.snapshot() + -- Master is not crashed then recovering xlog with {replica_id: 0} in header test_run:cmd('restart server default') +test_name = 'tp2_prune' replica_set = require('fast_replica') fiber = require('fiber') -- Rejoin replica and check -replica_set.join(test_run, 1) +replica_set.join(test_run, test_name, 1) while box.space._cluster:len() ~= 2 do fiber.sleep(0.001) end -- Check server ids -test_run:cmd('eval replica1 "return box.info.id"') +test_run:cmd('eval '..test_name..' "return box.info.id"') box.space._cluster:len() == 2 -- Cleanup -replica_set.drop_all(test_run) +replica_set.prune(test_run, test_name) box.space._cluster:len() == 1 -- delete replica from master -replica_set.join(test_run, 1) +replica_set.join(test_run, test_name, 1) while box.space._cluster:len() ~= 2 do fiber.sleep(0.001) end -- Check server ids -test_run:cmd('eval replica1 "return box.info.id"') +test_run:cmd('eval '..test_name..' "return box.info.id"') box.space._cluster:len() == 2 -replica_set.unregister(test_run, 2) +replica_set.unregister(test_run) -while test_run:cmd('eval replica1 "box.info.replication[1].upstream.status"')[1] ~= 'stopped' do fiber.sleep(0.001) end -test_run:cmd('eval replica1 "box.info.replication[1].upstream.message"') +while test_run:cmd('eval '..test_name..' "box.info.replication[1].upstream.status"')[1] ~= 'stopped' do fiber.sleep(0.001) end +test_run:cmd('eval '..test_name..' "box.info.replication[1].upstream.message"') -- restart replica and check that replica isn't able to join to cluster -test_run:cmd('restart server replica1') +test_run:cmd('restart server '..test_name) test_run:cmd('switch default') box.space._cluster:len() == 1 -test_run:cmd('eval replica1 "box.info.replication[1].upstream.status"') -test_run:cmd('eval replica1 "box.info.replication[1].upstream.message"')[1]:match("is not registered with replica set") ~= nil -replica_set.delete(test_run, 2) +test_run:cmd('eval '..test_name..' "box.info.replication[1].upstream.status"') +test_run:cmd('eval '..test_name..' "box.info.replication[1].upstream.message"')[1]:match("is not registered with replica set") ~= nil +replica_set.drop(test_run, test_name) box.space.test:drop() - box.schema.user.revoke('guest', 'read,write,execute', 'universe') diff --git a/test/replication/quorum.result b/test/replication/quorum.result index 09bfbc7ec..d569d15ad 100644 --- a/test/replication/quorum.result +++ b/test/replication/quorum.result @@ -256,15 +256,15 @@ space:insert{1} --- - [1] ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica_no_quorum.lua'") +test_run:cmd("create server quorum_gh3278 with rpl_master=default, script='replication/replica_no_quorum.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server quorum_gh3278") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch quorum_gh3278") --- - true ... @@ -280,7 +280,7 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server quorum_gh3278") --- - true ... @@ -290,11 +290,11 @@ listen = box.cfg.listen box.cfg{listen = ''} --- ... -test_run:cmd("start server replica") +test_run:cmd("start server quorum_gh3278") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch quorum_gh3278") --- - true ... @@ -317,10 +317,10 @@ space:insert{2} vclock = test_run:get_vclock("default") --- ... -_ = test_run:wait_vclock("replica", vclock) +_ = test_run:wait_vclock("quorum_gh3278", vclock) --- ... -test_run:cmd("switch replica") +test_run:cmd("switch quorum_gh3278") --- - true ... @@ -337,11 +337,11 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server quorum_gh3278") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server quorum_gh3278") --- - true ... @@ -406,7 +406,7 @@ test_run:drop_cluster(SERVERS) box.schema.user.grant('guest', 'replication') --- ... -test_run:cmd('create server replica_quorum with script="replication/replica_quorum.lua"') +test_run:cmd('create server quorum with script="replication/replica_quorum.lua"') --- - true ... @@ -414,11 +414,11 @@ test_run:cmd('create server replica_quorum with script="replication/replica_quor -- replication_connect_timeout. -- If replication_connect_quorum was ignored here, the instance -- would exit with an error. -test_run:cmd('start server replica_quorum with wait=True, wait_load=True, args="1 0.05 0.1"') +test_run:cmd('start server quorum with wait=True, wait_load=True, args="1 0.05 0.1"') --- - true ... -test_run:cmd('switch replica_quorum') +test_run:cmd('switch quorum') --- - true ... @@ -435,15 +435,15 @@ test_run:cmd('switch default') --- - true ... -test_run:cmd('stop server replica_quorum') +test_run:cmd('stop server quorum') --- - true ... -test_run:cmd('cleanup server replica_quorum') +test_run:cmd('cleanup server quorum') --- - true ... -test_run:cmd('delete server replica_quorum') +test_run:cmd('delete server quorum') --- - true ... diff --git a/test/replication/quorum.test.lua b/test/replication/quorum.test.lua index d67bf0f73..e32228d29 100644 --- a/test/replication/quorum.test.lua +++ b/test/replication/quorum.test.lua @@ -107,30 +107,30 @@ space = box.schema.space.create('test', {engine = test_run:get_cfg('engine')}); index = box.space.test:create_index('primary') -- Insert something just to check that replica with quorum = 0 works as expected. space:insert{1} -test_run:cmd("create server replica with rpl_master=default, script='replication/replica_no_quorum.lua'") -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("create server quorum_gh3278 with rpl_master=default, script='replication/replica_no_quorum.lua'") +test_run:cmd("start server quorum_gh3278") +test_run:cmd("switch quorum_gh3278") test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status box.space.test:select() test_run:cmd("switch default") -test_run:cmd("stop server replica") +test_run:cmd("stop server quorum_gh3278") listen = box.cfg.listen box.cfg{listen = ''} -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("start server quorum_gh3278") +test_run:cmd("switch quorum_gh3278") test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status test_run:cmd("switch default") -- Check that replica is able to reconnect, case was broken with earlier quorum "fix". box.cfg{listen = listen} space:insert{2} vclock = test_run:get_vclock("default") -_ = test_run:wait_vclock("replica", vclock) -test_run:cmd("switch replica") +_ = test_run:wait_vclock("quorum_gh3278", vclock) +test_run:cmd("switch quorum_gh3278") test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status box.space.test:select() test_run:cmd("switch default") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") +test_run:cmd("stop server quorum_gh3278") +test_run:cmd("cleanup server quorum_gh3278") space:drop() box.schema.user.revoke('guest', 'replication') -- Second case, check that master-master works. @@ -154,20 +154,20 @@ test_run:drop_cluster(SERVERS) -- Test that quorum is not ignored neither during bootstrap, nor -- during reconfiguration. box.schema.user.grant('guest', 'replication') -test_run:cmd('create server replica_quorum with script="replication/replica_quorum.lua"') +test_run:cmd('create server quorum with script="replication/replica_quorum.lua"') -- Arguments are: replication_connect_quorum, replication_timeout -- replication_connect_timeout. -- If replication_connect_quorum was ignored here, the instance -- would exit with an error. -test_run:cmd('start server replica_quorum with wait=True, wait_load=True, args="1 0.05 0.1"') -test_run:cmd('switch replica_quorum') +test_run:cmd('start server quorum with wait=True, wait_load=True, args="1 0.05 0.1"') +test_run:cmd('switch quorum') -- If replication_connect_quorum was ignored here, the instance -- would exit with an error. box.cfg{replication={INSTANCE_URI, nonexistent_uri(1)}} box.info.id test_run:cmd('switch default') -test_run:cmd('stop server replica_quorum') -test_run:cmd('cleanup server replica_quorum') -test_run:cmd('delete server replica_quorum') +test_run:cmd('stop server quorum') +test_run:cmd('cleanup server quorum') +test_run:cmd('delete server quorum') test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/recover_missing_xlog.lua b/test/replication/recover_missing_xlog.lua new file mode 100644 index 000000000..5d3eeddee --- /dev/null +++ b/test/replication/recover_missing_xlog.lua @@ -0,0 +1,37 @@ +#!/usr/bin/env tarantool + +-- get instance name from filename (recover_missing_xlog1.lua => recover_missing_xlog1) +local INSTANCE_ID = string.match(arg[0], "%d") +local USER = 'cluster' +local PASSWORD = 'somepassword' +local SOCKET_DIR = require('fio').cwd() +local TIMEOUT = tonumber(arg[1]) +local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 60.0 + +local function instance_uri(instance_id) + --return 'localhost:'..(3310 + instance_id) + return SOCKET_DIR..'/recover_missing_xlog'..instance_id..'.sock'; +end + +-- start console first +require('console').listen(os.getenv('ADMIN')) + +box.cfg({ + listen = instance_uri(INSTANCE_ID); +-- log_level = 7; + replication = { + USER..':'..PASSWORD..'@'..instance_uri(1); + USER..':'..PASSWORD..'@'..instance_uri(2); + USER..':'..PASSWORD..'@'..instance_uri(3); + }; + replication_timeout = TIMEOUT; + replication_connect_timeout = CON_TIMEOUT; +}) + +box.once("bootstrap", function() + local test_run = require('test_run').new() + box.schema.user.create(USER, { password = PASSWORD }) + box.schema.user.grant(USER, 'replication') + box.schema.space.create('test', {engine = test_run:get_cfg('engine')}) + box.space.test:create_index('primary') +end) diff --git a/test/replication/recover_missing_xlog.result b/test/replication/recover_missing_xlog.result index ef4c29e50..76f55709c 100644 --- a/test/replication/recover_missing_xlog.result +++ b/test/replication/recover_missing_xlog.result @@ -4,18 +4,16 @@ env = require('test_run') test_run = env.new() --- ... -SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } +SERVERS = { 'recover_missing_xlog1', 'recover_missing_xlog2', 'recover_missing_xlog3' } --- ... --- Start servers test_run:create_cluster(SERVERS, "replication", {args="0.1"}) --- ... --- Wait for full mesh test_run:wait_fullmesh(SERVERS) --- ... -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch recover_missing_xlog1") --- - true ... @@ -30,13 +28,13 @@ test_run:cmd('switch default') --- - true ... -vclock1 = test_run:get_vclock('autobootstrap1') +vclock1 = test_run:get_vclock('recover_missing_xlog1') --- ... vclock2 = test_run:wait_cluster_vclock(SERVERS, vclock1) --- ... -test_run:cmd("switch autobootstrap2") +test_run:cmd("switch recover_missing_xlog2") --- - true ... @@ -48,7 +46,7 @@ box.error.injection.set("ERRINJ_RELAY_TIMEOUT", 0.01) --- - ok ... -test_run:cmd("stop server autobootstrap1") +test_run:cmd("stop server recover_missing_xlog1") --- - true ... @@ -62,18 +60,18 @@ fio = require('fio') -- all missing data from replica. -- Also check that there is no concurrency, i.e. master is -- in 'read-only' mode unless it receives all data. -list = fio.glob(fio.pathjoin(fio.abspath("."), 'autobootstrap1/*.xlog')) +list = fio.glob(fio.pathjoin(fio.abspath("."), 'recover_missing_xlog1/*.xlog')) --- ... fio.unlink(list[#list]) --- - true ... -test_run:cmd('start server autobootstrap1 with args="0.1 0.5"') +test_run:cmd('start server recover_missing_xlog1 with args="0.1 0.5"') --- - true ... -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch recover_missing_xlog1") --- - true ... diff --git a/test/replication/recover_missing_xlog.test.lua b/test/replication/recover_missing_xlog.test.lua index 2cd73520f..73eb405dd 100644 --- a/test/replication/recover_missing_xlog.test.lua +++ b/test/replication/recover_missing_xlog.test.lua @@ -1,24 +1,22 @@ env = require('test_run') test_run = env.new() -SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } --- Start servers +SERVERS = { 'recover_missing_xlog1', 'recover_missing_xlog2', 'recover_missing_xlog3' } test_run:create_cluster(SERVERS, "replication", {args="0.1"}) --- Wait for full mesh test_run:wait_fullmesh(SERVERS) -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch recover_missing_xlog1") for i = 0, 9 do box.space.test:insert{i, 'test' .. i} end box.space.test:count() test_run:cmd('switch default') -vclock1 = test_run:get_vclock('autobootstrap1') +vclock1 = test_run:get_vclock('recover_missing_xlog1') vclock2 = test_run:wait_cluster_vclock(SERVERS, vclock1) -test_run:cmd("switch autobootstrap2") +test_run:cmd("switch recover_missing_xlog2") box.space.test:count() box.error.injection.set("ERRINJ_RELAY_TIMEOUT", 0.01) -test_run:cmd("stop server autobootstrap1") +test_run:cmd("stop server recover_missing_xlog1") fio = require('fio') -- This test checks ability to recover missing local data -- from remote replica. See #3210. @@ -27,11 +25,11 @@ fio = require('fio') -- all missing data from replica. -- Also check that there is no concurrency, i.e. master is -- in 'read-only' mode unless it receives all data. -list = fio.glob(fio.pathjoin(fio.abspath("."), 'autobootstrap1/*.xlog')) +list = fio.glob(fio.pathjoin(fio.abspath("."), 'recover_missing_xlog1/*.xlog')) fio.unlink(list[#list]) -test_run:cmd('start server autobootstrap1 with args="0.1 0.5"') +test_run:cmd('start server recover_missing_xlog1 with args="0.1 0.5"') -test_run:cmd("switch autobootstrap1") +test_run:cmd("switch recover_missing_xlog1") for i = 10, 19 do box.space.test:insert{i, 'test' .. i} end fiber = require('fiber') box.space.test:select() diff --git a/test/replication/recover_missing_xlog1.lua b/test/replication/recover_missing_xlog1.lua new file mode 120000 index 000000000..4102da849 --- /dev/null +++ b/test/replication/recover_missing_xlog1.lua @@ -0,0 +1 @@ +recover_missing_xlog.lua \ No newline at end of file diff --git a/test/replication/recover_missing_xlog2.lua b/test/replication/recover_missing_xlog2.lua new file mode 120000 index 000000000..4102da849 --- /dev/null +++ b/test/replication/recover_missing_xlog2.lua @@ -0,0 +1 @@ +recover_missing_xlog.lua \ No newline at end of file diff --git a/test/replication/recover_missing_xlog3.lua b/test/replication/recover_missing_xlog3.lua new file mode 120000 index 000000000..4102da849 --- /dev/null +++ b/test/replication/recover_missing_xlog3.lua @@ -0,0 +1 @@ +recover_missing_xlog.lua \ No newline at end of file diff --git a/test/replication/replica_rejoin.result b/test/replication/replica_rejoin.result index 9c8c9cf52..93e9e450e 100644 --- a/test/replication/replica_rejoin.result +++ b/test/replication/replica_rejoin.result @@ -33,15 +33,15 @@ _ = box.space.test:insert{3} --- ... -- Join a replica, then stop it. -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server replica_rejoin with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server replica_rejoin") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch replica_rejoin") --- - true ... @@ -59,7 +59,7 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server replica_rejoin") --- - true ... @@ -111,7 +111,7 @@ box.cfg{checkpoint_count = checkpoint_count} ... -- Restart the replica. Since xlogs have been removed, -- it is supposed to rejoin without changing id. -test_run:cmd("start server replica") +test_run:cmd("start server replica_rejoin") --- - true ... @@ -119,7 +119,7 @@ box.info.replication[2].downstream.vclock ~= nil or box.info --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch replica_rejoin") --- - true ... @@ -144,10 +144,10 @@ for i = 10, 30, 10 do box.space.test:update(i, {{'!', 1, i}}) end vclock = test_run:get_vclock('default') --- ... -_ = test_run:wait_vclock('replica', vclock) +_ = test_run:wait_vclock('replica_rejoin', vclock) --- ... -test_run:cmd("switch replica") +test_run:cmd("switch replica_rejoin") --- - true ... @@ -158,7 +158,7 @@ box.space.test:select() - [30, 30] ... -- Check that restart works as usual. -test_run:cmd("restart server replica") +test_run:cmd("restart server replica_rejoin") box.info.replication[1].upstream.status == 'follow' or box.info --- - true @@ -179,7 +179,7 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server replica_rejoin") --- - true ... @@ -210,11 +210,11 @@ test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*. box.cfg{checkpoint_count = checkpoint_count} --- ... -test_run:cmd("start server replica") +test_run:cmd("start server replica_rejoin") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch replica_rejoin") --- - true ... @@ -238,11 +238,11 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server replica_rejoin") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server replica_rejoin") --- - true ... @@ -252,12 +252,12 @@ test_run:cleanup_cluster() box.space.test:truncate() --- ... -test_run:cmd("start server replica") +test_run:cmd("start server replica_rejoin") --- - true ... -- Subscribe the master to the replica. -replica_listen = test_run:cmd("eval replica 'return box.cfg.listen'") +replica_listen = test_run:cmd("eval replica_rejoin 'return box.cfg.listen'") --- ... replica_listen ~= nil @@ -268,7 +268,7 @@ box.cfg{replication = replica_listen} --- ... -- Unsubscribe the replica from the master. -test_run:cmd("switch replica") +test_run:cmd("switch replica_rejoin") --- - true ... @@ -285,14 +285,14 @@ box.space.test:replace{1} - [1] ... -- Bump vclock on the replica. -test_run:cmd("switch replica") +test_run:cmd("switch replica_rejoin") --- - true ... for i = 1, 10 do box.space.test:replace{2} end --- ... -vclock = test_run:get_vclock('replica') +vclock = test_run:get_vclock('replica_rejoin') --- ... _ = test_run:wait_vclock('default', vclock) @@ -304,7 +304,7 @@ test_run:cmd("switch default") - true ... test_run:cmd("restart server default") -replica_listen = test_run:cmd("eval replica 'return box.cfg.listen'") +replica_listen = test_run:cmd("eval replica_rejoin 'return box.cfg.listen'") --- ... replica_listen ~= nil @@ -335,21 +335,21 @@ test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*. - true ... -- Bump vclock on the replica again. -test_run:cmd("switch replica") +test_run:cmd("switch replica_rejoin") --- - true ... for i = 1, 10 do box.space.test:replace{2} end --- ... -vclock = test_run:get_vclock('replica') +vclock = test_run:get_vclock('replica_rejoin') --- ... _ = test_run:wait_vclock('default', vclock) --- ... -- Restart the replica. It should successfully rebootstrap. -test_run:cmd("restart server replica") +test_run:cmd("restart server replica_rejoin") box.space.test:select() --- - - [1] @@ -371,15 +371,15 @@ test_run:cmd("switch default") box.cfg{replication = ''} --- ... -test_run:cmd("stop server replica") +test_run:cmd("stop server replica_rejoin") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server replica_rejoin") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server replica_rejoin") --- - true ... diff --git a/test/replication/replica_rejoin.test.lua b/test/replication/replica_rejoin.test.lua index 934aad058..9dcb438bf 100644 --- a/test/replication/replica_rejoin.test.lua +++ b/test/replication/replica_rejoin.test.lua @@ -16,13 +16,13 @@ _ = box.space.test:insert{2} _ = box.space.test:insert{3} -- Join a replica, then stop it. -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("create server replica_rejoin with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server replica_rejoin") +test_run:cmd("switch replica_rejoin") test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status box.space.test:select() test_run:cmd("switch default") -test_run:cmd("stop server replica") +test_run:cmd("stop server replica_rejoin") -- Restart the server to purge the replica from -- the garbage collection state. @@ -45,9 +45,9 @@ box.cfg{checkpoint_count = checkpoint_count} -- Restart the replica. Since xlogs have been removed, -- it is supposed to rejoin without changing id. -test_run:cmd("start server replica") +test_run:cmd("start server replica_rejoin") box.info.replication[2].downstream.vclock ~= nil or box.info -test_run:cmd("switch replica") +test_run:cmd("switch replica_rejoin") test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status box.space.test:select() test_run:cmd("switch default") @@ -55,12 +55,12 @@ test_run:cmd("switch default") -- Make sure the replica follows new changes. for i = 10, 30, 10 do box.space.test:update(i, {{'!', 1, i}}) end vclock = test_run:get_vclock('default') -_ = test_run:wait_vclock('replica', vclock) -test_run:cmd("switch replica") +_ = test_run:wait_vclock('replica_rejoin', vclock) +test_run:cmd("switch replica_rejoin") box.space.test:select() -- Check that restart works as usual. -test_run:cmd("restart server replica") +test_run:cmd("restart server replica_rejoin") box.info.replication[1].upstream.status == 'follow' or box.info box.space.test:select() @@ -68,7 +68,7 @@ box.space.test:select() -- is strictly behind the master. box.space.test:replace{1, 2, 3} -- bumps LSN on the replica test_run:cmd("switch default") -test_run:cmd("stop server replica") +test_run:cmd("stop server replica_rejoin") test_run:cmd("restart server default") checkpoint_count = box.cfg.checkpoint_count box.cfg{checkpoint_count = 1} @@ -78,8 +78,8 @@ for i = 1, 3 do box.space.test:insert{i * 100} end fio = require('fio') test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog') box.cfg{checkpoint_count = checkpoint_count} -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("start server replica_rejoin") +test_run:cmd("switch replica_rejoin") box.info.status -- orphan box.space.test:select() @@ -90,30 +90,30 @@ box.space.test:select() -- Bootstrap a new replica. test_run:cmd("switch default") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") +test_run:cmd("stop server replica_rejoin") +test_run:cmd("cleanup server replica_rejoin") test_run:cleanup_cluster() box.space.test:truncate() -test_run:cmd("start server replica") +test_run:cmd("start server replica_rejoin") -- Subscribe the master to the replica. -replica_listen = test_run:cmd("eval replica 'return box.cfg.listen'") +replica_listen = test_run:cmd("eval replica_rejoin 'return box.cfg.listen'") replica_listen ~= nil box.cfg{replication = replica_listen} -- Unsubscribe the replica from the master. -test_run:cmd("switch replica") +test_run:cmd("switch replica_rejoin") box.cfg{replication = ''} -- Bump vclock on the master. test_run:cmd("switch default") box.space.test:replace{1} -- Bump vclock on the replica. -test_run:cmd("switch replica") +test_run:cmd("switch replica_rejoin") for i = 1, 10 do box.space.test:replace{2} end -vclock = test_run:get_vclock('replica') +vclock = test_run:get_vclock('replica_rejoin') _ = test_run:wait_vclock('default', vclock) -- Restart the master and force garbage collection. test_run:cmd("switch default") test_run:cmd("restart server default") -replica_listen = test_run:cmd("eval replica 'return box.cfg.listen'") +replica_listen = test_run:cmd("eval replica_rejoin 'return box.cfg.listen'") replica_listen ~= nil box.cfg{replication = replica_listen} default_checkpoint_count = box.cfg.checkpoint_count @@ -123,12 +123,12 @@ box.cfg{checkpoint_count = default_checkpoint_count} fio = require('fio') test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog') -- Bump vclock on the replica again. -test_run:cmd("switch replica") +test_run:cmd("switch replica_rejoin") for i = 1, 10 do box.space.test:replace{2} end -vclock = test_run:get_vclock('replica') +vclock = test_run:get_vclock('replica_rejoin') _ = test_run:wait_vclock('default', vclock) -- Restart the replica. It should successfully rebootstrap. -test_run:cmd("restart server replica") +test_run:cmd("restart server replica_rejoin") box.space.test:select() box.snapshot() box.space.test:replace{2} @@ -136,9 +136,9 @@ box.space.test:replace{2} -- Cleanup. test_run:cmd("switch default") box.cfg{replication = ''} -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server replica_rejoin") +test_run:cmd("cleanup server replica_rejoin") +test_run:cmd("delete server replica_rejoin") test_run:cleanup_cluster() box.space.test:drop() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/replica_uuid_ro1.lua b/test/replication/replica_uuid_ro1.lua deleted file mode 120000 index 342d71c57..000000000 --- a/test/replication/replica_uuid_ro1.lua +++ /dev/null @@ -1 +0,0 @@ -replica_uuid_ro.lua \ No newline at end of file diff --git a/test/replication/replica_uuid_ro2.lua b/test/replication/replica_uuid_ro2.lua deleted file mode 120000 index 342d71c57..000000000 --- a/test/replication/replica_uuid_ro2.lua +++ /dev/null @@ -1 +0,0 @@ -replica_uuid_ro.lua \ No newline at end of file diff --git a/test/replication/replica_uuid_ro3.lua b/test/replication/replica_uuid_ro3.lua deleted file mode 120000 index 342d71c57..000000000 --- a/test/replication/replica_uuid_ro3.lua +++ /dev/null @@ -1 +0,0 @@ -replica_uuid_ro.lua \ No newline at end of file diff --git a/test/replication/replica_uuid_ro.lua b/test/replication/replicaset_ro_mostly.lua similarity index 83% rename from test/replication/replica_uuid_ro.lua rename to test/replication/replicaset_ro_mostly.lua index d5ba55852..fccd4eb3c 100644 --- a/test/replication/replica_uuid_ro.lua +++ b/test/replication/replicaset_ro_mostly.lua @@ -1,17 +1,17 @@ #!/usr/bin/env tarantool --- get instance name from filename (replica_uuid_ro1.lua => replica_uuid_ro1) +-- get instance name from filename (replicaset_ro_mostly1.lua => replicaset_ro_mostly1) local INSTANCE_ID = string.match(arg[0], "%d") local USER = 'cluster' local PASSWORD = 'somepassword' local SOCKET_DIR = require('fio').cwd() local TIMEOUT = tonumber(arg[2]) -local CON_TIMEOUT = arg[3] and tonumber(arg[3]) or 30.0 +local CON_TIMEOUT = arg[3] and tonumber(arg[3]) or 60.0 local function instance_uri(instance_id) --return 'localhost:'..(3310 + instance_id) - return SOCKET_DIR..'/replica_uuid_ro'..instance_id..'.sock'; + return SOCKET_DIR..'/replicaset_ro_mostly'..instance_id..'.sock'; end -- start console first diff --git a/test/replication/replicaset_ro_mostly.result b/test/replication/replicaset_ro_mostly.result index 1ce7d6f8e..43f0b489b 100644 --- a/test/replication/replicaset_ro_mostly.result +++ b/test/replication/replicaset_ro_mostly.result @@ -3,7 +3,7 @@ test_run = require('test_run').new() --- ... -SERVERS = {'replica_uuid_ro1', 'replica_uuid_ro2'} +SERVERS = {'replicaset_ro_mostly1', 'replicaset_ro_mostly2'} --- ... uuid = require('uuid') @@ -56,7 +56,7 @@ test_run:wait_fullmesh(SERVERS) --- ... -- Add third replica -name = 'replica_uuid_ro3' +name = 'replicaset_ro_mostly3' --- ... test_run:cmd(create_cluster_cmd1:format(name, name)) @@ -67,7 +67,7 @@ test_run:cmd(create_cluster_cmd2:format(name, uuid.new(), "0.1")) --- - true ... -test_run:cmd('switch replica_uuid_ro3') +test_run:cmd('switch replicaset_ro_mostly3') --- - true ... diff --git a/test/replication/replicaset_ro_mostly.test.lua b/test/replication/replicaset_ro_mostly.test.lua index c75af7218..0627d8316 100644 --- a/test/replication/replicaset_ro_mostly.test.lua +++ b/test/replication/replicaset_ro_mostly.test.lua @@ -2,7 +2,7 @@ -- Old behaviour: failed, since read-only is chosen by uuid. test_run = require('test_run').new() -SERVERS = {'replica_uuid_ro1', 'replica_uuid_ro2'} +SERVERS = {'replicaset_ro_mostly1', 'replicaset_ro_mostly2'} uuid = require('uuid') uuid1 = uuid.new() @@ -30,10 +30,10 @@ create_cluster_uuid(SERVERS, UUID) test_run:wait_fullmesh(SERVERS) -- Add third replica -name = 'replica_uuid_ro3' +name = 'replicaset_ro_mostly3' test_run:cmd(create_cluster_cmd1:format(name, name)) test_run:cmd(create_cluster_cmd2:format(name, uuid.new(), "0.1")) -test_run:cmd('switch replica_uuid_ro3') +test_run:cmd('switch replicaset_ro_mostly3') test_run:cmd('switch default') -- Cleanup. diff --git a/test/replication/replicaset_ro_mostly1.lua b/test/replication/replicaset_ro_mostly1.lua new file mode 120000 index 000000000..dc050de06 --- /dev/null +++ b/test/replication/replicaset_ro_mostly1.lua @@ -0,0 +1 @@ +replicaset_ro_mostly.lua \ No newline at end of file diff --git a/test/replication/replicaset_ro_mostly2.lua b/test/replication/replicaset_ro_mostly2.lua new file mode 120000 index 000000000..dc050de06 --- /dev/null +++ b/test/replication/replicaset_ro_mostly2.lua @@ -0,0 +1 @@ +replicaset_ro_mostly.lua \ No newline at end of file diff --git a/test/replication/replicaset_ro_mostly3.lua b/test/replication/replicaset_ro_mostly3.lua new file mode 120000 index 000000000..dc050de06 --- /dev/null +++ b/test/replication/replicaset_ro_mostly3.lua @@ -0,0 +1 @@ +replicaset_ro_mostly.lua \ No newline at end of file diff --git a/test/replication/show_error_on_disconnect.lua b/test/replication/show_error_on_disconnect.lua new file mode 100644 index 000000000..6aae11fcf --- /dev/null +++ b/test/replication/show_error_on_disconnect.lua @@ -0,0 +1,38 @@ +#!/usr/bin/env tarantool + +-- get instance name from filename (show_error_on_disconnect1.lua => show_error_on_disconnect) +local INSTANCE_ID = string.match(arg[0], "%d") + +local SOCKET_DIR = require('fio').cwd() + +local TIMEOUT = tonumber(arg[1]) +local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 60.0 + +local function instance_uri(instance_id) + --return 'localhost:'..(3310 + instance_id) + return SOCKET_DIR..'/show_error_on_disconnect'..instance_id..'.sock'; +end + +-- start console first +require('console').listen(os.getenv('ADMIN')) + +box.cfg({ + listen = instance_uri(INSTANCE_ID); +-- log_level = 7; + replication = { + instance_uri(1); + instance_uri(2); + }; + replication_connect_quorum = 0; + replication_timeout = TIMEOUT; + replication_connect_timeout = CON_TIMEOUT; +}) + +test_run = require('test_run').new() +engine = test_run:get_cfg('engine') + +box.once("bootstrap", function() + box.schema.user.grant("guest", 'replication') + box.schema.space.create('test', {engine = engine}) + box.space.test:create_index('primary') +end) diff --git a/test/replication/show_error_on_disconnect.result b/test/replication/show_error_on_disconnect.result index 886351449..a1afd1038 100644 --- a/test/replication/show_error_on_disconnect.result +++ b/test/replication/show_error_on_disconnect.result @@ -6,7 +6,7 @@ test_run = require('test_run').new() --- ... -SERVERS = {'master_quorum1', 'master_quorum2'} +SERVERS = {'show_error_on_disconnect1', 'show_error_on_disconnect2'} --- ... -- Deploy a cluster. @@ -16,7 +16,7 @@ test_run:create_cluster(SERVERS) test_run:wait_fullmesh(SERVERS) --- ... -test_run:cmd("switch master_quorum1") +test_run:cmd("switch show_error_on_disconnect1") --- - true ... @@ -26,7 +26,7 @@ repl = box.cfg.replication box.cfg{replication = ""} --- ... -test_run:cmd("switch master_quorum2") +test_run:cmd("switch show_error_on_disconnect2") --- - true ... @@ -46,7 +46,7 @@ box.snapshot() --- - ok ... --- Manually remove all xlogs on master_quorum2 to break replication to master_quorum1. +-- Manually remove all xlogs on show_error_on_disconnect2 to break replication to show_error_on_disconnect1. fio = require('fio') --- ... @@ -58,7 +58,7 @@ box.space.test:insert{3} - [3] ... -- Check error reporting. -test_run:cmd("switch master_quorum1") +test_run:cmd("switch show_error_on_disconnect1") --- - true ... @@ -83,7 +83,7 @@ box.info.replication[other_id].upstream.message:match("Missing") --- - Missing ... -test_run:cmd("switch master_quorum2") +test_run:cmd("switch show_error_on_disconnect2") --- - true ... diff --git a/test/replication/show_error_on_disconnect.test.lua b/test/replication/show_error_on_disconnect.test.lua index aa01f25f1..abe7218d4 100644 --- a/test/replication/show_error_on_disconnect.test.lua +++ b/test/replication/show_error_on_disconnect.test.lua @@ -4,35 +4,35 @@ -- The goal here is to see same error message on both side. -- test_run = require('test_run').new() -SERVERS = {'master_quorum1', 'master_quorum2'} +SERVERS = {'show_error_on_disconnect1', 'show_error_on_disconnect2'} -- Deploy a cluster. test_run:create_cluster(SERVERS) test_run:wait_fullmesh(SERVERS) -test_run:cmd("switch master_quorum1") +test_run:cmd("switch show_error_on_disconnect1") repl = box.cfg.replication box.cfg{replication = ""} -test_run:cmd("switch master_quorum2") +test_run:cmd("switch show_error_on_disconnect2") box.space.test:insert{1} box.snapshot() box.space.test:insert{2} box.snapshot() --- Manually remove all xlogs on master_quorum2 to break replication to master_quorum1. +-- Manually remove all xlogs on show_error_on_disconnect2 to break replication to show_error_on_disconnect1. fio = require('fio') for _, path in ipairs(fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog'))) do fio.unlink(path) end box.space.test:insert{3} -- Check error reporting. -test_run:cmd("switch master_quorum1") +test_run:cmd("switch show_error_on_disconnect1") box.cfg{replication = repl} require('fiber').sleep(0.1) box.space.test:select() other_id = box.info.id % 2 + 1 test_run:wait_cond(function() return box.info.replication[other_id].upstream.status == 'stopped' end) or box.info.replication[other_id].upstream.status box.info.replication[other_id].upstream.message:match("Missing") -test_run:cmd("switch master_quorum2") +test_run:cmd("switch show_error_on_disconnect2") box.space.test:select() other_id = box.info.id % 2 + 1 test_run:wait_cond(function() return box.info.replication[other_id].upstream.status == 'follow' end) or box.info.replication[other_id].upstream.status diff --git a/test/replication/show_error_on_disconnect1.lua b/test/replication/show_error_on_disconnect1.lua new file mode 120000 index 000000000..d3e693ad6 --- /dev/null +++ b/test/replication/show_error_on_disconnect1.lua @@ -0,0 +1 @@ +show_error_on_disconnect.lua \ No newline at end of file diff --git a/test/replication/show_error_on_disconnect2.lua b/test/replication/show_error_on_disconnect2.lua new file mode 120000 index 000000000..d3e693ad6 --- /dev/null +++ b/test/replication/show_error_on_disconnect2.lua @@ -0,0 +1 @@ +show_error_on_disconnect.lua \ No newline at end of file diff --git a/test/replication/show_error_on_disconnect3.lua b/test/replication/show_error_on_disconnect3.lua new file mode 120000 index 000000000..d3e693ad6 --- /dev/null +++ b/test/replication/show_error_on_disconnect3.lua @@ -0,0 +1 @@ +show_error_on_disconnect.lua \ No newline at end of file diff --git a/test/replication/skip_conflict_row.result b/test/replication/skip_conflict_row.result index 573424a2c..388ceb80b 100644 --- a/test/replication/skip_conflict_row.result +++ b/test/replication/skip_conflict_row.result @@ -16,15 +16,15 @@ space = box.schema.space.create('test', {engine = engine}); index = box.space.test:create_index('primary') --- ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server skip_conflict_row with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server skip_conflict_row") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch skip_conflict_row") --- - true ... @@ -54,10 +54,10 @@ test_run:wait_cond(function() return box.info.status == 'running' end) or box.in vclock = test_run:get_vclock('default') --- ... -_ = test_run:wait_vclock("replica", vclock) +_ = test_run:wait_vclock("skip_conflict_row", vclock) --- ... -test_run:cmd("switch replica") +test_run:cmd("switch skip_conflict_row") --- - true ... @@ -84,11 +84,11 @@ test_run:wait_cond(function() return box.info.status == 'running' end) or box.in ... -- gh-2283: test that if replication_skip_conflict is off vclock -- is not advanced on errors. -test_run:cmd("restart server replica") +test_run:cmd("restart server skip_conflict_row") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch skip_conflict_row") --- - true ... @@ -111,7 +111,7 @@ box.space.test:insert{4} --- - [4] ... -test_run:cmd("switch replica") +test_run:cmd("switch skip_conflict_row") --- - true ... @@ -132,7 +132,7 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("restart server replica") +test_run:cmd("restart server skip_conflict_row") --- - true ... @@ -161,11 +161,11 @@ test_run:cmd("switch default") box.space.test:truncate() --- ... -test_run:cmd("restart server replica") +test_run:cmd("restart server skip_conflict_row") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch skip_conflict_row") --- - true ... @@ -191,7 +191,7 @@ test_run:cmd("switch default") for i = 1, 10 do box.space.test:insert({i, 'm'}) end --- ... -test_run:cmd("switch replica") +test_run:cmd("switch skip_conflict_row") --- - true ... @@ -213,18 +213,18 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server skip_conflict_row") --- - true ... for i = 11, 20 do box.space.test:insert({i, 'm'}) end --- ... -test_run:cmd("start server replica") +test_run:cmd("start server skip_conflict_row") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch skip_conflict_row") --- - true ... @@ -250,15 +250,15 @@ test_run:cmd("switch default") - true ... -- cleanup -test_run:cmd("stop server replica") +test_run:cmd("stop server skip_conflict_row") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server skip_conflict_row") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server skip_conflict_row") --- - true ... diff --git a/test/replication/skip_conflict_row.test.lua b/test/replication/skip_conflict_row.test.lua index 914e3486b..e86295dd3 100644 --- a/test/replication/skip_conflict_row.test.lua +++ b/test/replication/skip_conflict_row.test.lua @@ -7,9 +7,9 @@ box.schema.user.grant('guest', 'replication') space = box.schema.space.create('test', {engine = engine}); index = box.space.test:create_index('primary') -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("create server skip_conflict_row with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server skip_conflict_row") +test_run:cmd("switch skip_conflict_row") box.cfg{replication_skip_conflict = true} box.space.test:insert{1} @@ -19,8 +19,8 @@ space:insert{2} test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status vclock = test_run:get_vclock('default') -_ = test_run:wait_vclock("replica", vclock) -test_run:cmd("switch replica") +_ = test_run:wait_vclock("skip_conflict_row", vclock) +test_run:cmd("switch skip_conflict_row") box.info.replication[1].upstream.message test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status box.space.test:select() @@ -30,20 +30,20 @@ test_run:wait_cond(function() return box.info.status == 'running' end) or box.in -- gh-2283: test that if replication_skip_conflict is off vclock -- is not advanced on errors. -test_run:cmd("restart server replica") -test_run:cmd("switch replica") +test_run:cmd("restart server skip_conflict_row") +test_run:cmd("switch skip_conflict_row") box.space.test:insert{3} lsn1 = box.info.vclock[1] test_run:cmd("switch default") box.space.test:insert{3, 3} box.space.test:insert{4} -test_run:cmd("switch replica") +test_run:cmd("switch skip_conflict_row") -- lsn is not promoted lsn1 == box.info.vclock[1] test_run:wait_cond(function() return box.info.replication[1].upstream.message == "Duplicate key exists in unique index 'primary' in space 'test'" end) or box.info.replication[1].upstream.message test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'stopped' end) or box.info.replication[1].upstream.status test_run:cmd("switch default") -test_run:cmd("restart server replica") +test_run:cmd("restart server skip_conflict_row") -- applier is not in follow state box.info.replication[1].upstream.message @@ -57,8 +57,8 @@ test_run:cmd("switch default") -- test if nop were really written box.space.test:truncate() -test_run:cmd("restart server replica") -test_run:cmd("switch replica") +test_run:cmd("restart server skip_conflict_row") +test_run:cmd("switch skip_conflict_row") test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status -- write some conflicting records on slave for i = 1, 10 do box.space.test:insert({i, 'r'}) end @@ -69,7 +69,7 @@ v1 = box.info.vclock[1] test_run:cmd("switch default") for i = 1, 10 do box.space.test:insert({i, 'm'}) end -test_run:cmd("switch replica") +test_run:cmd("switch skip_conflict_row") test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status -- lsn should be incremented @@ -78,18 +78,18 @@ test_run:wait_cond(function() return box.info.replication[1].upstream.status == -- restart server and check replication continues from nop-ed vclock test_run:cmd("switch default") -test_run:cmd("stop server replica") +test_run:cmd("stop server skip_conflict_row") for i = 11, 20 do box.space.test:insert({i, 'm'}) end -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("start server skip_conflict_row") +test_run:cmd("switch skip_conflict_row") test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status box.space.test:select({11}, {iterator = "GE"}) test_run:cmd("switch default") -- cleanup -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server skip_conflict_row") +test_run:cmd("cleanup server skip_conflict_row") +test_run:cmd("delete server skip_conflict_row") test_run:cleanup_cluster() box.space.test:drop() box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/status.result b/test/replication/status.result index b569196a0..97a7a7e99 100644 --- a/test/replication/status.result +++ b/test/replication/status.result @@ -82,11 +82,11 @@ master.downstream == nil - true ... -- Start Master -> Slave replication -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server status with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server status") --- - true ... @@ -145,7 +145,7 @@ master.downstream == nil - true ... -- replica's status -replica_id = test_run:get_server_id('replica') +replica_id = test_run:get_server_id('status') --- ... box.info.vclock[replica_id] == nil @@ -187,7 +187,7 @@ replica.downstream.vclock[replica_id] == box.info.vclock[replica_id] -- -- Replica -- -test_run:cmd('switch replica') +test_run:cmd('switch status') --- - true ... @@ -282,7 +282,7 @@ replica.downstream == nil -- -- ClientError during replication -- -test_run:cmd('switch replica') +test_run:cmd('switch status') --- - true ... @@ -298,7 +298,7 @@ box.space._schema:insert({'dup'}) --- - ['dup'] ... -test_run:cmd('switch replica') +test_run:cmd('switch status') --- - true ... @@ -318,7 +318,7 @@ test_run:cmd("push filter ', lsn: [0-9]+' to ', lsn: '") --- - true ... -test_run:grep_log('replica', 'error applying row: .*') +test_run:grep_log('status', 'error applying row: .*') --- - 'error applying row: {type: ''INSERT'', replica_id: 1, lsn: , space_id: 272, index_id: 0, tuple: ["dup"]}' @@ -330,11 +330,11 @@ test_run:cmd("clear filter") -- -- Check box.info.replication login -- -test_run:cmd('switch replica') +test_run:cmd('switch status') --- - true ... -test_run:cmd("set variable master_port to 'replica.master'") +test_run:cmd("set variable master_port to 'status.master'") --- - true ... @@ -380,15 +380,15 @@ test_run:cmd('switch default') box.schema.user.revoke('guest', 'replication') --- ... -test_run:cmd("stop server replica") +test_run:cmd("stop server status") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server status") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server status") --- - true ... diff --git a/test/replication/status.test.lua b/test/replication/status.test.lua index c1e363043..d776c45ff 100644 --- a/test/replication/status.test.lua +++ b/test/replication/status.test.lua @@ -32,8 +32,8 @@ master.upstream == nil master.downstream == nil -- Start Master -> Slave replication -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") +test_run:cmd("create server status with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server status") -- -- Master @@ -56,7 +56,7 @@ master.upstream == nil master.downstream == nil -- replica's status -replica_id = test_run:get_server_id('replica') +replica_id = test_run:get_server_id('status') box.info.vclock[replica_id] == nil replica = box.info.replication[replica_id] replica.id == replica_id @@ -71,7 +71,7 @@ replica.downstream.vclock[replica_id] == box.info.vclock[replica_id] -- -- Replica -- -test_run:cmd('switch replica') +test_run:cmd('switch status') #box.info.vclock == 1 -- box.info.vclock[replica_id] is nil #box.info.replication == 2 @@ -105,23 +105,23 @@ replica.downstream == nil -- -- ClientError during replication -- -test_run:cmd('switch replica') +test_run:cmd('switch status') box.space._schema:insert({'dup'}) test_run:cmd('switch default') box.space._schema:insert({'dup'}) -test_run:cmd('switch replica') +test_run:cmd('switch status') test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'stopped' and box.info.replication[1].upstream.message:match('Duplicate') ~= nil end) test_run:cmd('switch default') box.space._schema:delete({'dup'}) test_run:cmd("push filter ', lsn: [0-9]+' to ', lsn: '") -test_run:grep_log('replica', 'error applying row: .*') +test_run:grep_log('status', 'error applying row: .*') test_run:cmd("clear filter") -- -- Check box.info.replication login -- -test_run:cmd('switch replica') -test_run:cmd("set variable master_port to 'replica.master'") +test_run:cmd('switch status') +test_run:cmd("set variable master_port to 'status.master'") replica_uri = os.getenv("LISTEN") box.cfg{replication = {"guest@localhost:" .. master_port, replica_uri}} @@ -139,7 +139,7 @@ test_run:cmd('switch default') -- Cleanup -- box.schema.user.revoke('guest', 'replication') -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server status") +test_run:cmd("cleanup server status") +test_run:cmd("delete server status") test_run:cleanup_cluster() diff --git a/test/replication/sync.result b/test/replication/sync.result index 2375ddb96..c615961fb 100644 --- a/test/replication/sync.result +++ b/test/replication/sync.result @@ -66,15 +66,15 @@ test_run:cmd("setopt delimiter ''"); - true ... -- Deploy a replica. -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server sync with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server sync") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch sync") --- - true ... @@ -93,7 +93,7 @@ test_run:cmd("switch default") fill() --- ... -test_run:cmd("switch replica") +test_run:cmd("switch sync") --- - true ... @@ -136,7 +136,7 @@ test_run:cmd("switch default") fill() --- ... -test_run:cmd("switch replica") +test_run:cmd("switch sync") --- - true ... @@ -177,7 +177,7 @@ test_run:cmd("switch default") fill() --- ... -test_run:cmd("switch replica") +test_run:cmd("switch sync") --- - true ... @@ -260,7 +260,7 @@ test_run:cmd("setopt delimiter ''"); --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch sync") --- - true ... @@ -285,7 +285,7 @@ test_run:wait_cond(function() return box.info.replication[1].upstream.status == --- - true ... -test_run:wait_log("replica", "ER_CFG.*", nil, 200) +test_run:wait_log("sync", "ER_CFG.*", nil, 200) --- - 'ER_CFG: Incorrect value for option ''replication'': duplicate connection with the same replica UUID' @@ -294,7 +294,7 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server sync") --- - true ... @@ -311,11 +311,11 @@ box.error.injection.set('ERRINJ_WAL_WRITE_DISK', false) --- - ok ... -test_run:cmd("start server replica") +test_run:cmd("start server sync") --- - true ... -test_run:cmd("switch replica") +test_run:cmd("switch sync") --- - true ... @@ -331,15 +331,15 @@ test_run:cmd("switch default") --- - true ... -test_run:cmd("stop server replica") +test_run:cmd("stop server sync") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server sync") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server sync") --- - true ... diff --git a/test/replication/sync.test.lua b/test/replication/sync.test.lua index 2d15aeec7..463512dc6 100644 --- a/test/replication/sync.test.lua +++ b/test/replication/sync.test.lua @@ -46,9 +46,9 @@ end; test_run:cmd("setopt delimiter ''"); -- Deploy a replica. -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("create server sync with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server sync") +test_run:cmd("switch sync") -- Stop replication. replication = box.cfg.replication @@ -57,7 +57,7 @@ box.cfg{replication = {}} -- Fill the space. test_run:cmd("switch default") fill() -test_run:cmd("switch replica") +test_run:cmd("switch sync") ----------------------------------------------------------------------------------------------------- -- Resume replication. @@ -78,7 +78,7 @@ box.cfg{replication = {}} -- Fill the space. test_run:cmd("switch default") fill() -test_run:cmd("switch replica") +test_run:cmd("switch sync") ----------------------------------------------------------------------------------------------------- -- Resume replication @@ -101,7 +101,7 @@ box.cfg{replication = {}} -- Fill the space. test_run:cmd("switch default") fill() -test_run:cmd("switch replica") +test_run:cmd("switch sync") ----------------------------------------------------------------------------------------------------- -- Resume replication @@ -145,7 +145,7 @@ _ = fiber.create(function() box.error.injection.set('ERRINJ_WAL_DELAY', false) end); test_run:cmd("setopt delimiter ''"); -test_run:cmd("switch replica") +test_run:cmd("switch sync") replication = box.cfg.replication box.cfg{replication = {}} @@ -153,24 +153,24 @@ box.cfg{replication = replication} test_run:wait_cond(function() return box.info.status == 'running' end) box.info.ro -- false test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status -test_run:wait_log("replica", "ER_CFG.*", nil, 200) +test_run:wait_log("sync", "ER_CFG.*", nil, 200) test_run:cmd("switch default") -test_run:cmd("stop server replica") +test_run:cmd("stop server sync") -- gh-3830: Sync fails if there's a gap at the end of the master's WAL. box.error.injection.set('ERRINJ_WAL_WRITE_DISK', true) box.space.test:replace{123456789} box.error.injection.set('ERRINJ_WAL_WRITE_DISK', false) -test_run:cmd("start server replica") -test_run:cmd("switch replica") +test_run:cmd("start server sync") +test_run:cmd("switch sync") test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status box.info.ro -- false test_run:cmd("switch default") -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server sync") +test_run:cmd("cleanup server sync") +test_run:cmd("delete server sync") test_run:cleanup_cluster() box.space.test:drop() diff --git a/test/replication/wal_rw_stress.result b/test/replication/wal_rw_stress.result index cfb2f8a9e..7c8912ae3 100644 --- a/test/replication/wal_rw_stress.result +++ b/test/replication/wal_rw_stress.result @@ -15,20 +15,20 @@ _ = s:create_index('primary') box.schema.user.grant('guest', 'replication') --- ... -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("create server wal_rw_stress with rpl_master=default, script='replication/replica.lua'") --- - true ... -test_run:cmd("start server replica") +test_run:cmd("start server wal_rw_stress") --- - true ... -- Setup replica => master channel. -box.cfg{replication = test_run:cmd("eval replica 'return box.cfg.listen'")} +box.cfg{replication = test_run:cmd("eval wal_rw_stress 'return box.cfg.listen'")} --- ... --- Disable master => replica channel. -test_run:cmd("switch replica") +-- Disable master => wal_rw_stress channel. +test_run:cmd("switch wal_rw_stress") --- - true ... @@ -60,11 +60,11 @@ test_run:cmd("setopt delimiter ''"); --- - true ... --- Enable master => replica channel and wait for the replica to catch up. --- The relay handling replica => master channel on the replica will read +-- Enable master => wal_rw_stress channel and wait for the replica to catch up. +-- The relay handling wal_rw_stress => master channel on the replica will read -- an xlog while the applier is writing to it. Although applier and relay -- are running in different threads, there shouldn't be any rw errors. -test_run:cmd("switch replica") +test_run:cmd("switch wal_rw_stress") --- - true ... @@ -83,15 +83,15 @@ test_run:cmd("switch default") box.cfg{replication = {}} --- ... -test_run:cmd("stop server replica") +test_run:cmd("stop server wal_rw_stress") --- - true ... -test_run:cmd("cleanup server replica") +test_run:cmd("cleanup server wal_rw_stress") --- - true ... -test_run:cmd("delete server replica") +test_run:cmd("delete server wal_rw_stress") --- - true ... diff --git a/test/replication/wal_rw_stress.test.lua b/test/replication/wal_rw_stress.test.lua index 48d68c5ac..909e71ae9 100644 --- a/test/replication/wal_rw_stress.test.lua +++ b/test/replication/wal_rw_stress.test.lua @@ -9,14 +9,14 @@ _ = s:create_index('primary') -- Deploy a replica. box.schema.user.grant('guest', 'replication') -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") -test_run:cmd("start server replica") +test_run:cmd("create server wal_rw_stress with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server wal_rw_stress") -- Setup replica => master channel. -box.cfg{replication = test_run:cmd("eval replica 'return box.cfg.listen'")} +box.cfg{replication = test_run:cmd("eval wal_rw_stress 'return box.cfg.listen'")} --- Disable master => replica channel. -test_run:cmd("switch replica") +-- Disable master => wal_rw_stress channel. +test_run:cmd("switch wal_rw_stress") replication = box.cfg.replication box.cfg{replication = {}} test_run:cmd("switch default") @@ -32,20 +32,20 @@ for i = 1, 100 do end; test_run:cmd("setopt delimiter ''"); --- Enable master => replica channel and wait for the replica to catch up. --- The relay handling replica => master channel on the replica will read +-- Enable master => wal_rw_stress channel and wait for the replica to catch up. +-- The relay handling wal_rw_stress => master channel on the replica will read -- an xlog while the applier is writing to it. Although applier and relay -- are running in different threads, there shouldn't be any rw errors. -test_run:cmd("switch replica") +test_run:cmd("switch wal_rw_stress") box.cfg{replication = replication} test_run:wait_cond(function() return box.info.replication[1].downstream.status ~= 'stopped' end) or box.info test_run:cmd("switch default") -- Cleanup. box.cfg{replication = {}} -test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") -test_run:cmd("delete server replica") +test_run:cmd("stop server wal_rw_stress") +test_run:cmd("cleanup server wal_rw_stress") +test_run:cmd("delete server wal_rw_stress") test_run:cleanup_cluster() box.schema.user.revoke('guest', 'replication') s:drop() -- 2.17.1