From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Serge Petrenko Subject: [PATCH v4 2/3] Add arguments to replication test instances. Date: Tue, 14 Aug 2018 13:02:58 +0300 Message-Id: <464547006cf7e2cee43a6bca25d3d01b6725f632.1534240758.git.sergepetrenko@tarantool.org> In-Reply-To: References: In-Reply-To: References: To: tarantool-patches@freelists.org Cc: georgy@tarantool.org, vdavydov.dev@gmail.com, Serge Petrenko List-ID: Add start arguments to replication test instances to control replication_timeout and replication_connect_timeout settings between restarts. Prerequisite #3428 --- test/replication-py/init_storage.test.py | 2 +- test/replication-py/master.lua | 1 + test/replication-py/replica.lua | 1 + test/replication/autobootstrap.lua | 6 +++++- test/replication/autobootstrap.result | 4 ++-- test/replication/autobootstrap.test.lua | 4 ++-- test/replication/autobootstrap_guest.lua | 7 ++++++- test/replication/autobootstrap_guest.result | 2 +- test/replication/autobootstrap_guest.test.lua | 2 +- test/replication/before_replace.result | 8 ++++---- test/replication/before_replace.test.lua | 8 ++++---- test/replication/catch.result | 2 +- test/replication/catch.test.lua | 2 +- test/replication/ddl.lua | 7 ++++++- test/replication/ddl.result | 2 +- test/replication/ddl.test.lua | 2 +- test/replication/errinj.result | 6 +++--- test/replication/errinj.test.lua | 6 +++--- test/replication/master.lua | 1 + test/replication/master_quorum.lua | 7 ++++++- test/replication/misc.result | 2 +- test/replication/misc.test.lua | 2 +- test/replication/on_replace.lua | 14 +++++++++----- test/replication/on_replace.result | 2 +- test/replication/on_replace.test.lua | 2 +- test/replication/quorum.lua | 8 ++++++-- test/replication/quorum.result | 16 ++++++++-------- test/replication/quorum.test.lua | 16 ++++++++-------- test/replication/rebootstrap.lua | 8 ++++++-- test/replication/rebootstrap.result | 6 +++--- test/replication/rebootstrap.test.lua | 6 +++--- test/replication/recover_missing_xlog.result | 4 ++-- test/replication/recover_missing_xlog.test.lua | 4 ++-- test/replication/replica_no_quorum.lua | 3 ++- test/replication/replica_timeout.lua | 3 ++- test/replication/replica_uuid_ro.lua | 7 ++++++- test/replication/replicaset_ro_mostly.result | 8 +++++--- test/replication/replicaset_ro_mostly.test.lua | 8 +++++--- 38 files changed, 122 insertions(+), 77 deletions(-) diff --git a/test/replication-py/init_storage.test.py b/test/replication-py/init_storage.test.py index 0911a02c0..32b4639f1 100644 --- a/test/replication-py/init_storage.test.py +++ b/test/replication-py/init_storage.test.py @@ -57,7 +57,7 @@ print '-------------------------------------------------------------' server.stop() replica = TarantoolServer(server.ini) -replica.script = 'replication/replica.lua' +replica.script = 'replication-py/replica.lua' replica.vardir = server.vardir #os.path.join(server.vardir, 'replica') replica.rpl_master = master replica.deploy(wait=False) diff --git a/test/replication-py/master.lua b/test/replication-py/master.lua index 0f9f7a6f0..e924b5495 100644 --- a/test/replication-py/master.lua +++ b/test/replication-py/master.lua @@ -3,6 +3,7 @@ os = require('os') box.cfg({ listen = os.getenv("LISTEN"), memtx_memory = 107374182, + replication_timeout = 0.1 }) require('console').listen(os.getenv('ADMIN')) diff --git a/test/replication-py/replica.lua b/test/replication-py/replica.lua index 278291bba..32d888eff 100644 --- a/test/replication-py/replica.lua +++ b/test/replication-py/replica.lua @@ -7,6 +7,7 @@ box.cfg({ listen = os.getenv("LISTEN"), replication = os.getenv("MASTER"), memtx_memory = 107374182, + replication_timeout = 0.1 }) box_cfg_done = true diff --git a/test/replication/autobootstrap.lua b/test/replication/autobootstrap.lua index 4f55417ae..856b36e66 100644 --- a/test/replication/autobootstrap.lua +++ b/test/replication/autobootstrap.lua @@ -5,6 +5,9 @@ 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 30.0 + local function instance_uri(instance_id) --return 'localhost:'..(3310 + instance_id) return SOCKET_DIR..'/autobootstrap'..instance_id..'.sock'; @@ -21,7 +24,8 @@ box.cfg({ USER..':'..PASSWORD..'@'..instance_uri(2); USER..':'..PASSWORD..'@'..instance_uri(3); }; - replication_connect_timeout = 0.5, + replication_timeout = TIMEOUT; + replication_connect_timeout = CON_TIMEOUT; }) box.once("bootstrap", function() diff --git a/test/replication/autobootstrap.result b/test/replication/autobootstrap.result index 04aeb4315..91badc1f1 100644 --- a/test/replication/autobootstrap.result +++ b/test/replication/autobootstrap.result @@ -13,7 +13,7 @@ SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } -- -- Start servers -- -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) --- ... -- @@ -161,7 +161,7 @@ box.space.test_u:select() _ = test_run:cmd("switch autobootstrap1") --- ... -_ = test_run:cmd("restart server autobootstrap1 with cleanup=1") +_ = test_run:cmd("restart server autobootstrap1 with cleanup=1, args ='0.1 0.5'") _ = box.space.test_u:replace({5, 6, 7, 8}) --- ... diff --git a/test/replication/autobootstrap.test.lua b/test/replication/autobootstrap.test.lua index f1e2a9991..752d5f317 100644 --- a/test/replication/autobootstrap.test.lua +++ b/test/replication/autobootstrap.test.lua @@ -8,7 +8,7 @@ SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } -- -- Start servers -- -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) -- -- Wait for full mesh @@ -76,7 +76,7 @@ box.space.test_u:select() -- Rebootstrap one node and check that others follow. -- _ = test_run:cmd("switch autobootstrap1") -_ = test_run:cmd("restart server autobootstrap1 with cleanup=1") +_ = test_run:cmd("restart server autobootstrap1 with cleanup=1, args ='0.1 0.5'") _ = box.space.test_u:replace({5, 6, 7, 8}) box.space.test_u:select() diff --git a/test/replication/autobootstrap_guest.lua b/test/replication/autobootstrap_guest.lua index 40fef2c7a..d7176ae5b 100644 --- a/test/replication/autobootstrap_guest.lua +++ b/test/replication/autobootstrap_guest.lua @@ -4,6 +4,10 @@ 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 30.0 + local function instance_uri(instance_id) --return 'localhost:'..(3310 + instance_id) return SOCKET_DIR..'/autobootstrap_guest'..instance_id..'.sock'; @@ -20,7 +24,8 @@ box.cfg({ instance_uri(2); instance_uri(3); }; - replication_connect_timeout = 0.5, + replication_timeout = TIMEOUT; + replication_connect_timeout = CON_TIMEOUT; }) box.once("bootstrap", function() diff --git a/test/replication/autobootstrap_guest.result b/test/replication/autobootstrap_guest.result index 49f9bee01..1efef310c 100644 --- a/test/replication/autobootstrap_guest.result +++ b/test/replication/autobootstrap_guest.result @@ -13,7 +13,7 @@ SERVERS = { 'autobootstrap_guest1', 'autobootstrap_guest2', 'autobootstrap_guest -- -- Start servers -- -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) --- ... -- diff --git a/test/replication/autobootstrap_guest.test.lua b/test/replication/autobootstrap_guest.test.lua index 70250cff9..3aad8a4da 100644 --- a/test/replication/autobootstrap_guest.test.lua +++ b/test/replication/autobootstrap_guest.test.lua @@ -7,7 +7,7 @@ SERVERS = { 'autobootstrap_guest1', 'autobootstrap_guest2', 'autobootstrap_guest -- -- Start servers -- -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) -- -- Wait for full mesh diff --git a/test/replication/before_replace.result b/test/replication/before_replace.result index d561b4813..00f9bcb8b 100644 --- a/test/replication/before_replace.result +++ b/test/replication/before_replace.result @@ -11,7 +11,7 @@ SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } --- ... -- Deploy a cluster. -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) --- ... test_run:wait_fullmesh(SERVERS) @@ -125,7 +125,7 @@ box.space.test:select() - [9, 90] - [10, 100] ... -test_run:cmd('restart server autobootstrap1') +test_run:cmd('restart server autobootstrap1 with args="0.1 0.5"') box.space.test:select() --- - - [1, 10] @@ -156,7 +156,7 @@ box.space.test:select() - [9, 90] - [10, 100] ... -test_run:cmd('restart server autobootstrap2') +test_run:cmd('restart server autobootstrap2 with args="0.1 0.5"') box.space.test:select() --- - - [1, 10] @@ -187,7 +187,7 @@ box.space.test:select() - [9, 90] - [10, 100] ... -test_run:cmd('restart server autobootstrap3') +test_run:cmd('restart server autobootstrap3 with args="0.1 0.5"') box.space.test:select() --- - - [1, 10] diff --git a/test/replication/before_replace.test.lua b/test/replication/before_replace.test.lua index 2c6912d06..b49d438b4 100644 --- a/test/replication/before_replace.test.lua +++ b/test/replication/before_replace.test.lua @@ -7,7 +7,7 @@ test_run = env.new() SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } -- Deploy a cluster. -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) test_run:wait_fullmesh(SERVERS) -- Setup space:before_replace trigger on all replicas. @@ -54,15 +54,15 @@ vclock2 = test_run:wait_cluster_vclock(SERVERS, vclock) -- and the state persists after restart. test_run:cmd("switch autobootstrap1") box.space.test:select() -test_run:cmd('restart server autobootstrap1') +test_run:cmd('restart server autobootstrap1 with args="0.1 0.5"') box.space.test:select() test_run:cmd("switch autobootstrap2") box.space.test:select() -test_run:cmd('restart server autobootstrap2') +test_run:cmd('restart server autobootstrap2 with args="0.1 0.5"') box.space.test:select() test_run:cmd("switch autobootstrap3") box.space.test:select() -test_run:cmd('restart server autobootstrap3') +test_run:cmd('restart server autobootstrap3 with args="0.1 0.5"') box.space.test:select() diff --git a/test/replication/catch.result b/test/replication/catch.result index 91be32725..0f72e89e2 100644 --- a/test/replication/catch.result +++ b/test/replication/catch.result @@ -23,7 +23,7 @@ test_run:cmd("create server replica with rpl_master=default, script='replication --- - true ... -test_run:cmd("start server replica with args='1'") +test_run:cmd("start server replica with args='0.1'") --- - true ... diff --git a/test/replication/catch.test.lua b/test/replication/catch.test.lua index 2e2e97bc4..457f910e9 100644 --- a/test/replication/catch.test.lua +++ b/test/replication/catch.test.lua @@ -9,7 +9,7 @@ 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='1'") +test_run:cmd("start server replica with args='0.1'") test_run:cmd("switch replica") test_run:cmd("switch default") diff --git a/test/replication/ddl.lua b/test/replication/ddl.lua index 694f40eac..72cf1db69 100644 --- a/test/replication/ddl.lua +++ b/test/replication/ddl.lua @@ -5,6 +5,10 @@ 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 30.0 + local function instance_uri(instance_id) --return 'localhost:'..(3310 + instance_id) return SOCKET_DIR..'/autobootstrap'..instance_id..'.sock'; @@ -22,7 +26,8 @@ box.cfg({ USER..':'..PASSWORD..'@'..instance_uri(3); USER..':'..PASSWORD..'@'..instance_uri(4); }; - replication_connect_timeout = 0.5, + replication_timeout = TIMEOUT, + replication_connect_timeout = CON_TIMEOUT, }) box.once("bootstrap", function() diff --git a/test/replication/ddl.result b/test/replication/ddl.result index cc61fd4ce..8cd54cdfb 100644 --- a/test/replication/ddl.result +++ b/test/replication/ddl.result @@ -5,7 +5,7 @@ SERVERS = { 'ddl1', 'ddl2', 'ddl3', 'ddl4' } --- ... -- Deploy a cluster. -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) --- ... test_run:wait_fullmesh(SERVERS) diff --git a/test/replication/ddl.test.lua b/test/replication/ddl.test.lua index 4cf4ffa38..f56071adc 100644 --- a/test/replication/ddl.test.lua +++ b/test/replication/ddl.test.lua @@ -3,7 +3,7 @@ test_run = require('test_run').new() SERVERS = { 'ddl1', 'ddl2', 'ddl3', 'ddl4' } -- Deploy a cluster. -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) test_run:wait_fullmesh(SERVERS) test_run:cmd("switch ddl1") test_run = require('test_run').new() diff --git a/test/replication/errinj.result b/test/replication/errinj.result index ca8af2988..3fc432010 100644 --- a/test/replication/errinj.result +++ b/test/replication/errinj.result @@ -418,7 +418,7 @@ test_run:cmd("create server replica_timeout with rpl_master=default, script='rep --- - true ... -test_run:cmd("start server replica_timeout with args='0.01'") +test_run:cmd("start server replica_timeout with args='0.01 0.5'") --- - true ... @@ -474,7 +474,7 @@ 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'") +test_run:cmd("start server replica_timeout with args='0.009 0.5'") --- - true ... @@ -522,7 +522,7 @@ 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'") +test_run:cmd("start server replica_timeout with args='0.00001 0.5'") --- - true ... diff --git a/test/replication/errinj.test.lua b/test/replication/errinj.test.lua index 463d89a8f..37375f45e 100644 --- a/test/replication/errinj.test.lua +++ b/test/replication/errinj.test.lua @@ -173,7 +173,7 @@ 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'") +test_run:cmd("start server replica_timeout with args='0.01 0.5'") test_run:cmd("switch replica_timeout") fiber = require('fiber') @@ -199,7 +199,7 @@ 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'") +test_run:cmd("start server replica_timeout with args='0.009 0.5'") test_run:cmd("switch replica_timeout") fiber = require('fiber') @@ -219,7 +219,7 @@ 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'") +test_run:cmd("start server replica_timeout with args='0.00001 0.5'") test_run:cmd("switch replica_timeout") fiber = require('fiber') while box.info.replication[1].upstream.message ~= 'timed out' do fiber.sleep(0.0001) end diff --git a/test/replication/master.lua b/test/replication/master.lua index 6d431aaeb..9b96b7891 100644 --- a/test/replication/master.lua +++ b/test/replication/master.lua @@ -4,6 +4,7 @@ box.cfg({ listen = os.getenv("LISTEN"), memtx_memory = 107374182, replication_connect_timeout = 0.5, + replication_timeout = 0.1 }) require('console').listen(os.getenv('ADMIN')) diff --git a/test/replication/master_quorum.lua b/test/replication/master_quorum.lua index fb5f7ec2b..05272ac5e 100644 --- a/test/replication/master_quorum.lua +++ b/test/replication/master_quorum.lua @@ -4,6 +4,10 @@ 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 30.0 + local function instance_uri(instance_id) --return 'localhost:'..(3310 + instance_id) return SOCKET_DIR..'/master_quorum'..instance_id..'.sock'; @@ -20,7 +24,8 @@ box.cfg({ instance_uri(2); }; replication_connect_quorum = 0; - replication_connect_timeout = 0.1; + replication_timeout = TIMEOUT; + replication_connect_timeout = CON_TIMEOUT; }) test_run = require('test_run').new() diff --git a/test/replication/misc.result b/test/replication/misc.result index 9d9d010c0..9df2a2c4b 100644 --- a/test/replication/misc.result +++ b/test/replication/misc.result @@ -93,7 +93,7 @@ SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } --- ... -- Deploy a cluster. -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) --- ... test_run:wait_fullmesh(SERVERS) diff --git a/test/replication/misc.test.lua b/test/replication/misc.test.lua index da5a90239..979c5d58c 100644 --- a/test/replication/misc.test.lua +++ b/test/replication/misc.test.lua @@ -37,7 +37,7 @@ box.cfg{read_only = false} SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } -- Deploy a cluster. -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) test_run:wait_fullmesh(SERVERS) test_run:cmd("switch autobootstrap1") test_run = require('test_run').new() diff --git a/test/replication/on_replace.lua b/test/replication/on_replace.lua index 03f15d94c..40c12a9ea 100644 --- a/test/replication/on_replace.lua +++ b/test/replication/on_replace.lua @@ -5,6 +5,10 @@ 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 30.0 + local function instance_uri(instance_id) --return 'localhost:'..(3310 + instance_id) return SOCKET_DIR..'/on_replace'..instance_id..'.sock'; @@ -12,6 +16,9 @@ end -- start console first require('console').listen(os.getenv('ADMIN')) +env = require('test_run') +test_run = env.new() +engine = test_run:get_cfg('engine') box.cfg({ listen = instance_uri(INSTANCE_ID); @@ -20,13 +27,10 @@ box.cfg({ USER..':'..PASSWORD..'@'..instance_uri(1); USER..':'..PASSWORD..'@'..instance_uri(2); }; - replication_connect_timeout = 0.5, + replication_timeout = TIMEOUT, + replication_connect_timeout = CON_TIMEOUT, }) -env = require('test_run') -test_run = env.new() -engine = test_run:get_cfg('engine') - box.once("bootstrap", function() box.schema.user.create(USER, { password = PASSWORD }) box.schema.user.grant(USER, 'replication') diff --git a/test/replication/on_replace.result b/test/replication/on_replace.result index 1736c53b7..4ffa3b25a 100644 --- a/test/replication/on_replace.result +++ b/test/replication/on_replace.result @@ -98,7 +98,7 @@ box.schema.user.revoke('guest', 'replication') SERVERS = { 'on_replace1', 'on_replace2' } --- ... -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.2"}) --- ... test_run:wait_fullmesh(SERVERS) diff --git a/test/replication/on_replace.test.lua b/test/replication/on_replace.test.lua index 10bba2ddf..371b71cbd 100644 --- a/test/replication/on_replace.test.lua +++ b/test/replication/on_replace.test.lua @@ -44,7 +44,7 @@ box.schema.user.revoke('guest', 'replication') -- gh-2682 on_replace on slave server with data change SERVERS = { 'on_replace1', 'on_replace2' } -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.2"}) test_run:wait_fullmesh(SERVERS) test_run:cmd('switch on_replace1') diff --git a/test/replication/quorum.lua b/test/replication/quorum.lua index 9c7bf5c93..f61c8748f 100644 --- a/test/replication/quorum.lua +++ b/test/replication/quorum.lua @@ -4,6 +4,10 @@ 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 30.0 + local function instance_uri(instance_id) --return 'localhost:'..(3310 + instance_id) return SOCKET_DIR..'/quorum'..instance_id..'.sock'; @@ -14,9 +18,9 @@ require('console').listen(os.getenv('ADMIN')) box.cfg({ listen = instance_uri(INSTANCE_ID); - replication_timeout = 0.05; + replication_timeout = TIMEOUT; replication_sync_lag = 0.01; - replication_connect_timeout = 0.1; + replication_connect_timeout = CON_TIMEOUT; replication_connect_quorum = 3; replication = { instance_uri(1); diff --git a/test/replication/quorum.result b/test/replication/quorum.result index 8f6e7a070..a55b0d087 100644 --- a/test/replication/quorum.result +++ b/test/replication/quorum.result @@ -5,7 +5,7 @@ SERVERS = {'quorum1', 'quorum2', 'quorum3'} --- ... -- Deploy a cluster. -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) --- ... test_run:wait_fullmesh(SERVERS) @@ -27,7 +27,7 @@ test_run:cmd('switch quorum2') --- - true ... -test_run:cmd('restart server quorum2') +test_run:cmd('restart server quorum2 with args="0.1 0.5"') box.info.status -- orphan --- - orphan @@ -51,7 +51,7 @@ box.info.status -- running --- - running ... -test_run:cmd('restart server quorum2') +test_run:cmd('restart server quorum2 with args="0.1 0.5"') box.info.status -- orphan --- - orphan @@ -82,7 +82,7 @@ box.info.status -- running --- - running ... -test_run:cmd('restart server quorum2') +test_run:cmd('restart server quorum2 with args="0.1 0.5"') box.info.status -- orphan --- - orphan @@ -99,7 +99,7 @@ box.space.test:replace{100} -- error --- - error: Can't modify data because this instance is in read-only mode. ... -test_run:cmd('start server quorum1') +test_run:cmd('start server quorum1 with args="0.1 0.5"') --- - true ... @@ -158,7 +158,7 @@ fiber = require('fiber') fiber.sleep(0.1) --- ... -test_run:cmd('start server quorum1') +test_run:cmd('start server quorum1 with args="0.1 0.5"') --- - true ... @@ -196,7 +196,7 @@ test_run:cmd('switch quorum1') --- - true ... -test_run:cmd('restart server quorum1 with cleanup=1') +test_run:cmd('restart server quorum1 with cleanup=1, args="0.1 0.5"') box.space.test:count() -- 100 --- - 100 @@ -356,7 +356,7 @@ SERVERS = {'master_quorum1', 'master_quorum2'} --- ... -- Deploy a cluster. -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) --- ... test_run:wait_fullmesh(SERVERS) diff --git a/test/replication/quorum.test.lua b/test/replication/quorum.test.lua index 1df0ae1e7..8290f8ea5 100644 --- a/test/replication/quorum.test.lua +++ b/test/replication/quorum.test.lua @@ -3,7 +3,7 @@ test_run = require('test_run').new() SERVERS = {'quorum1', 'quorum2', 'quorum3'} -- Deploy a cluster. -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) test_run:wait_fullmesh(SERVERS) -- Stop one replica and try to restart another one. @@ -18,7 +18,7 @@ test_run:cmd('stop server quorum1') test_run:cmd('switch quorum2') -test_run:cmd('restart server quorum2') +test_run:cmd('restart server quorum2 with args="0.1 0.5"') box.info.status -- orphan box.ctl.wait_rw(0.001) -- timeout box.info.ro -- true @@ -26,7 +26,7 @@ box.space.test:replace{100} -- error box.cfg{replication={}} box.info.status -- running -test_run:cmd('restart server quorum2') +test_run:cmd('restart server quorum2 with args="0.1 0.5"') box.info.status -- orphan box.ctl.wait_rw(0.001) -- timeout box.info.ro -- true @@ -36,12 +36,12 @@ box.ctl.wait_rw() box.info.ro -- false box.info.status -- running -test_run:cmd('restart server quorum2') +test_run:cmd('restart server quorum2 with args="0.1 0.5"') box.info.status -- orphan box.ctl.wait_rw(0.001) -- timeout box.info.ro -- true box.space.test:replace{100} -- error -test_run:cmd('start server quorum1') +test_run:cmd('start server quorum1 with args="0.1 0.5"') box.ctl.wait_rw() box.info.ro -- false box.info.status -- running @@ -63,7 +63,7 @@ for i = 1, 100 do box.space.test:insert{i} end fiber = require('fiber') fiber.sleep(0.1) -test_run:cmd('start server quorum1') +test_run:cmd('start server quorum1 with args="0.1 0.5"') test_run:cmd('switch quorum1') box.space.test:count() -- 100 @@ -79,7 +79,7 @@ test_run:cmd('switch quorum2') box.snapshot() test_run:cmd('switch quorum1') -test_run:cmd('restart server quorum1 with cleanup=1') +test_run:cmd('restart server quorum1 with cleanup=1, args="0.1 0.5"') box.space.test:count() -- 100 @@ -136,7 +136,7 @@ box.schema.user.revoke('guest', 'replication') -- Second case, check that master-master works. SERVERS = {'master_quorum1', 'master_quorum2'} -- Deploy a cluster. -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) test_run:wait_fullmesh(SERVERS) test_run:cmd("switch master_quorum1") repl = box.cfg.replication diff --git a/test/replication/rebootstrap.lua b/test/replication/rebootstrap.lua index e743577e4..3e7d8f062 100644 --- a/test/replication/rebootstrap.lua +++ b/test/replication/rebootstrap.lua @@ -4,6 +4,10 @@ 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 30.0 + local function instance_uri(instance_id) return SOCKET_DIR..'/rebootstrap'..instance_id..'.sock'; end @@ -14,8 +18,8 @@ require('console').listen(os.getenv('ADMIN')) box.cfg({ listen = instance_uri(INSTANCE_ID), instance_uuid = '12345678-abcd-1234-abcd-123456789ef' .. INSTANCE_ID, - replication_timeout = 0.1, - replication_connect_timeout = 0.5, + replication_timeout = TIMEOUT, + replication_connect_timeout = CON_TIMEOUT, replication = { instance_uri(1); instance_uri(2); diff --git a/test/replication/rebootstrap.result b/test/replication/rebootstrap.result index afbfc8e65..ea390c19f 100644 --- a/test/replication/rebootstrap.result +++ b/test/replication/rebootstrap.result @@ -4,7 +4,7 @@ test_run = require('test_run').new() SERVERS = {'rebootstrap1', 'rebootstrap2'} --- ... -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) --- ... test_run:wait_fullmesh(SERVERS) @@ -20,11 +20,11 @@ test_run:cmd('stop server rebootstrap1') --- - true ... -test_run:cmd('restart server rebootstrap2 with cleanup=True, wait=False, wait_load=False') +test_run:cmd('restart server rebootstrap2 with cleanup=True, wait=False, wait_load=False, args="0.1 2.0"') --- - true ... -test_run:cmd('start server rebootstrap1') +test_run:cmd('start server rebootstrap1 with args="0.1 0.5"') --- - true ... diff --git a/test/replication/rebootstrap.test.lua b/test/replication/rebootstrap.test.lua index 954726ddb..8ddf77912 100644 --- a/test/replication/rebootstrap.test.lua +++ b/test/replication/rebootstrap.test.lua @@ -2,7 +2,7 @@ test_run = require('test_run').new() SERVERS = {'rebootstrap1', 'rebootstrap2'} -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) test_run:wait_fullmesh(SERVERS) -- @@ -12,8 +12,8 @@ test_run:wait_fullmesh(SERVERS) -- in 'orphan' mode. -- test_run:cmd('stop server rebootstrap1') -test_run:cmd('restart server rebootstrap2 with cleanup=True, wait=False, wait_load=False') -test_run:cmd('start server rebootstrap1') +test_run:cmd('restart server rebootstrap2 with cleanup=True, wait=False, wait_load=False, args="0.1 2.0"') +test_run:cmd('start server rebootstrap1 with args="0.1 0.5"') test_run:cmd('switch rebootstrap1') box.info.status -- running diff --git a/test/replication/recover_missing_xlog.result b/test/replication/recover_missing_xlog.result index 027f8761e..5ed05c635 100644 --- a/test/replication/recover_missing_xlog.result +++ b/test/replication/recover_missing_xlog.result @@ -8,7 +8,7 @@ SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } --- ... -- Start servers -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) --- ... -- Wait for full mesh @@ -66,7 +66,7 @@ fio.unlink(fio.pathjoin(fio.abspath("."), string.format('autobootstrap1/%020d.xl --- - true ... -test_run:cmd("start server autobootstrap1") +test_run:cmd('start server autobootstrap1 with args="0.1 0.5"') --- - true ... diff --git a/test/replication/recover_missing_xlog.test.lua b/test/replication/recover_missing_xlog.test.lua index 57bc7d31f..d2d378837 100644 --- a/test/replication/recover_missing_xlog.test.lua +++ b/test/replication/recover_missing_xlog.test.lua @@ -3,7 +3,7 @@ test_run = env.new() SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } -- Start servers -test_run:create_cluster(SERVERS) +test_run:create_cluster(SERVERS, "replication", {args="0.1"}) -- Wait for full mesh test_run:wait_fullmesh(SERVERS) @@ -28,7 +28,7 @@ fio = require('fio') -- Also check that there is no concurrency, i.e. master is -- in 'read-only' mode unless it receives all data. fio.unlink(fio.pathjoin(fio.abspath("."), string.format('autobootstrap1/%020d.xlog', 8))) -test_run:cmd("start server autobootstrap1") +test_run:cmd('start server autobootstrap1 with args="0.1 0.5"') test_run:cmd("switch autobootstrap1") for i = 10, 19 do box.space.test:insert{i, 'test' .. i} end diff --git a/test/replication/replica_no_quorum.lua b/test/replication/replica_no_quorum.lua index b9edeea94..c30c043cc 100644 --- a/test/replication/replica_no_quorum.lua +++ b/test/replication/replica_no_quorum.lua @@ -5,7 +5,8 @@ box.cfg({ replication = os.getenv("MASTER"), memtx_memory = 107374182, replication_connect_quorum = 0, - replication_connect_timeout = 0.1, + replication_timeout = 0.1, + replication_connect_timeout = 0.5, }) require('console').listen(os.getenv('ADMIN')) diff --git a/test/replication/replica_timeout.lua b/test/replication/replica_timeout.lua index 64f119763..38922fa3d 100644 --- a/test/replication/replica_timeout.lua +++ b/test/replication/replica_timeout.lua @@ -1,13 +1,14 @@ #!/usr/bin/env tarantool local TIMEOUT = tonumber(arg[1]) +local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 30.0 box.cfg({ listen = os.getenv("LISTEN"), replication = os.getenv("MASTER"), memtx_memory = 107374182, replication_timeout = TIMEOUT, - replication_connect_timeout = TIMEOUT * 3, + replication_connect_timeout = CON_TIMEOUT, }) require('console').listen(os.getenv('ADMIN')) diff --git a/test/replication/replica_uuid_ro.lua b/test/replication/replica_uuid_ro.lua index 8e1c6cc47..d5ba55852 100644 --- a/test/replication/replica_uuid_ro.lua +++ b/test/replication/replica_uuid_ro.lua @@ -5,6 +5,10 @@ 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 function instance_uri(instance_id) --return 'localhost:'..(3310 + instance_id) return SOCKET_DIR..'/replica_uuid_ro'..instance_id..'.sock'; @@ -22,7 +26,8 @@ box.cfg({ USER..':'..PASSWORD..'@'..instance_uri(2); }; read_only = (INSTANCE_ID ~= '1' and true or false); - replication_connect_timeout = 0.5, + replication_timeout = TIMEOUT; + replication_connect_timeout = CON_TIMEOUT; }) box.once("bootstrap", function() diff --git a/test/replication/replicaset_ro_mostly.result b/test/replication/replicaset_ro_mostly.result index b9e8f1fe8..1ce7d6f8e 100644 --- a/test/replication/replicaset_ro_mostly.result +++ b/test/replication/replicaset_ro_mostly.result @@ -27,7 +27,7 @@ UUID = sort({uuid1, uuid2}, sort_cmp) create_cluster_cmd1 = 'create server %s with script="replication/%s.lua"' --- ... -create_cluster_cmd2 = 'start server %s with args="%s", wait_load=False, wait=False' +create_cluster_cmd2 = 'start server %s with args="%s %s", wait_load=False, wait=False' --- ... test_run:cmd("setopt delimiter ';'") @@ -37,7 +37,9 @@ test_run:cmd("setopt delimiter ';'") function create_cluster_uuid(servers, uuids) for i, name in ipairs(servers) do test_run:cmd(create_cluster_cmd1:format(name, name)) - test_run:cmd(create_cluster_cmd2:format(name, uuids[i])) + end + for i, name in ipairs(servers) do + test_run:cmd(create_cluster_cmd2:format(name, uuids[i], "0.1")) end end; --- @@ -61,7 +63,7 @@ test_run:cmd(create_cluster_cmd1:format(name, name)) --- - true ... -test_run:cmd(create_cluster_cmd2:format(name, uuid.new())) +test_run:cmd(create_cluster_cmd2:format(name, uuid.new(), "0.1")) --- - true ... diff --git a/test/replication/replicaset_ro_mostly.test.lua b/test/replication/replicaset_ro_mostly.test.lua index f2c2d0d11..c75af7218 100644 --- a/test/replication/replicaset_ro_mostly.test.lua +++ b/test/replication/replicaset_ro_mostly.test.lua @@ -12,13 +12,15 @@ function sort(t) table.sort(t, sort_cmp) return t end UUID = sort({uuid1, uuid2}, sort_cmp) create_cluster_cmd1 = 'create server %s with script="replication/%s.lua"' -create_cluster_cmd2 = 'start server %s with args="%s", wait_load=False, wait=False' +create_cluster_cmd2 = 'start server %s with args="%s %s", wait_load=False, wait=False' test_run:cmd("setopt delimiter ';'") function create_cluster_uuid(servers, uuids) for i, name in ipairs(servers) do test_run:cmd(create_cluster_cmd1:format(name, name)) - test_run:cmd(create_cluster_cmd2:format(name, uuids[i])) + end + for i, name in ipairs(servers) do + test_run:cmd(create_cluster_cmd2:format(name, uuids[i], "0.1")) end end; test_run:cmd("setopt delimiter ''"); @@ -30,7 +32,7 @@ test_run:wait_fullmesh(SERVERS) -- Add third replica name = 'replica_uuid_ro3' test_run:cmd(create_cluster_cmd1:format(name, name)) -test_run:cmd(create_cluster_cmd2:format(name, uuid.new())) +test_run:cmd(create_cluster_cmd2:format(name, uuid.new(), "0.1")) test_run:cmd('switch replica_uuid_ro3') test_run:cmd('switch default') -- 2.15.2 (Apple Git-101.1)