Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To fix flaky issues of replication/misc.test.lua the test had to be divided into smaller tests to be able to localize the flaky results: gh-2991-misc-asserts-on-update.test.lua gh-3111-misc-rebootstrap-from-ro-master.test.lua gh-3160-misc-heartbeats-on-master-changes.test.lua gh-3247-misc-iproto-sequence-value-not-replicated.test.lua gh-3510-misc-assert-replica-on-applier-disconnect.test.lua gh-3606-misc-crash-on-box-concurrent-update.test.lua gh-3610-misc-assert-connecting-master-twice.test.lua gh-3637-misc-error-on-replica-auth-fail.test.lua gh-3642-misc-no-socket-leak-on-replica-disconnect.test.lua gh-3711-misc-no-restart-on-same-configuration.test.lua gh-3760-misc-return-on-quorum-0.test.lua gh-4399-misc-no-failure-on-error-reading-wal.test.lua gh-4424-misc-orphan-on-reconfiguration-error.test.lua Needed for #4940 (cherry picked from commit c7e6627)
- Loading branch information
Showing
31 changed files
with
1,281 additions
and
1,148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
-- gh-2991 - Tarantool asserts on box.cfg.replication update if one of | ||
-- servers is dead | ||
replication_timeout = box.cfg.replication_timeout | ||
--- | ||
... | ||
replication_connect_timeout = box.cfg.replication_connect_timeout | ||
--- | ||
... | ||
box.cfg{replication_timeout=0.05, replication_connect_timeout=0.05, replication={}} | ||
--- | ||
... | ||
box.cfg{replication_connect_quorum=2} | ||
--- | ||
... | ||
box.cfg{replication = {'127.0.0.1:12345', box.cfg.listen}} | ||
--- | ||
... | ||
box.info.status | ||
--- | ||
- orphan | ||
... | ||
box.info.ro | ||
--- | ||
- true | ||
... | ||
box.cfg{replication = "", replication_timeout = replication_timeout, \ | ||
replication_connect_timeout = replication_connect_timeout} | ||
--- | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- gh-2991 - Tarantool asserts on box.cfg.replication update if one of | ||
-- servers is dead | ||
replication_timeout = box.cfg.replication_timeout | ||
replication_connect_timeout = box.cfg.replication_connect_timeout | ||
box.cfg{replication_timeout=0.05, replication_connect_timeout=0.05, replication={}} | ||
box.cfg{replication_connect_quorum=2} | ||
box.cfg{replication = {'127.0.0.1:12345', box.cfg.listen}} | ||
box.info.status | ||
box.info.ro | ||
box.cfg{replication = "", replication_timeout = replication_timeout, \ | ||
replication_connect_timeout = replication_connect_timeout} |
58 changes: 58 additions & 0 deletions
58
test/replication/gh-3111-misc-rebootstrap-from-ro-master.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
test_run = require('test_run').new() | ||
--- | ||
... | ||
test_run:cmd("restart server default") | ||
uuid = require('uuid') | ||
--- | ||
... | ||
box.schema.user.grant('guest', 'replication') | ||
--- | ||
... | ||
-- 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"') | ||
--- | ||
- true | ||
... | ||
test_run:cmd(string.format('start server test with args="%s"', replica_uuid)) | ||
--- | ||
- true | ||
... | ||
test_run:cmd('stop server test') | ||
--- | ||
- true | ||
... | ||
test_run:cmd('cleanup server test') | ||
--- | ||
- true | ||
... | ||
box.cfg{read_only = true} | ||
--- | ||
... | ||
test_run:cmd(string.format('start server test with args="%s"', replica_uuid)) | ||
--- | ||
- true | ||
... | ||
test_run:cmd('stop server test') | ||
--- | ||
- true | ||
... | ||
test_run:cmd('cleanup server test') | ||
--- | ||
- true | ||
... | ||
box.cfg{read_only = false} | ||
--- | ||
... | ||
test_run:cmd('delete server test') | ||
--- | ||
- true | ||
... | ||
test_run:cleanup_cluster() | ||
--- | ||
... | ||
box.schema.user.revoke('guest', 'replication') | ||
--- | ||
... |
20 changes: 20 additions & 0 deletions
20
test/replication/gh-3111-misc-rebootstrap-from-ro-master.test.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
test_run = require('test_run').new() | ||
test_run:cmd("restart server default") | ||
uuid = require('uuid') | ||
|
||
box.schema.user.grant('guest', 'replication') | ||
|
||
-- 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') | ||
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') | ||
box.cfg{read_only = false} | ||
test_run:cmd('delete server test') | ||
test_run:cleanup_cluster() | ||
box.schema.user.revoke('guest', 'replication') |
67 changes: 67 additions & 0 deletions
67
test/replication/gh-3160-misc-heartbeats-on-master-changes.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
test_run = require('test_run').new() | ||
--- | ||
... | ||
-- gh-3160 - Send heartbeats if there are changes from a remote master only | ||
SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } | ||
--- | ||
... | ||
-- Deploy a cluster. | ||
test_run:create_cluster(SERVERS, "replication", {args="0.03"}) | ||
--- | ||
... | ||
test_run:wait_fullmesh(SERVERS) | ||
--- | ||
... | ||
test_run:cmd("switch autobootstrap3") | ||
--- | ||
- true | ||
... | ||
test_run = require('test_run').new() | ||
--- | ||
... | ||
_ = box.schema.space.create('test_timeout'):create_index('pk') | ||
--- | ||
... | ||
test_run:cmd("setopt delimiter ';'") | ||
--- | ||
- true | ||
... | ||
function wait_not_follow(replicaA, replicaB) | ||
return test_run:wait_cond(function() | ||
return replicaA.status ~= 'follow' or replicaB.status ~= 'follow' | ||
end, box.cfg.replication_timeout) | ||
end; | ||
--- | ||
... | ||
function test_timeout() | ||
local replicaA = box.info.replication[1].upstream or box.info.replication[2].upstream | ||
local replicaB = box.info.replication[3].upstream or box.info.replication[2].upstream | ||
local follows = test_run:wait_cond(function() | ||
return replicaA.status == 'follow' or replicaB.status == 'follow' | ||
end) | ||
if not follows then error('replicas are not in the follow status') end | ||
for i = 0, 99 do | ||
box.space.test_timeout:replace({1}) | ||
if wait_not_follow(replicaA, replicaB) then | ||
return error(box.info.replication) | ||
end | ||
end | ||
return true | ||
end; | ||
--- | ||
... | ||
test_run:cmd("setopt delimiter ''"); | ||
--- | ||
- true | ||
... | ||
test_timeout() | ||
--- | ||
- true | ||
... | ||
test_run:cmd("switch default") | ||
--- | ||
- true | ||
... | ||
test_run:drop_cluster(SERVERS) | ||
--- | ||
... |
37 changes: 37 additions & 0 deletions
37
test/replication/gh-3160-misc-heartbeats-on-master-changes.test.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
test_run = require('test_run').new() | ||
|
||
-- gh-3160 - Send heartbeats if there are changes from a remote master only | ||
SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } | ||
|
||
-- Deploy a cluster. | ||
test_run:create_cluster(SERVERS, "replication", {args="0.03"}) | ||
test_run:wait_fullmesh(SERVERS) | ||
test_run:cmd("switch autobootstrap3") | ||
test_run = require('test_run').new() | ||
_ = box.schema.space.create('test_timeout'):create_index('pk') | ||
test_run:cmd("setopt delimiter ';'") | ||
function wait_not_follow(replicaA, replicaB) | ||
return test_run:wait_cond(function() | ||
return replicaA.status ~= 'follow' or replicaB.status ~= 'follow' | ||
end, box.cfg.replication_timeout) | ||
end; | ||
function test_timeout() | ||
local replicaA = box.info.replication[1].upstream or box.info.replication[2].upstream | ||
local replicaB = box.info.replication[3].upstream or box.info.replication[2].upstream | ||
local follows = test_run:wait_cond(function() | ||
return replicaA.status == 'follow' or replicaB.status == 'follow' | ||
end) | ||
if not follows then error('replicas are not in the follow status') end | ||
for i = 0, 99 do | ||
box.space.test_timeout:replace({1}) | ||
if wait_not_follow(replicaA, replicaB) then | ||
return error(box.info.replication) | ||
end | ||
end | ||
return true | ||
end; | ||
test_run:cmd("setopt delimiter ''"); | ||
test_timeout() | ||
|
||
test_run:cmd("switch default") | ||
test_run:drop_cluster(SERVERS) |
87 changes: 87 additions & 0 deletions
87
test/replication/gh-3247-misc-iproto-sequence-value-not-replicated.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
test_run = require('test_run').new() | ||
--- | ||
... | ||
test_run:cmd("restart server default") | ||
-- Deploy a cluster. | ||
SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } | ||
--- | ||
... | ||
test_run:create_cluster(SERVERS, "replication", {args="0.03"}) | ||
--- | ||
... | ||
test_run:wait_fullmesh(SERVERS) | ||
--- | ||
... | ||
-- gh-3247 - Sequence-generated value is not replicated in case | ||
-- the request was sent via iproto. | ||
test_run:cmd("switch autobootstrap1") | ||
--- | ||
- true | ||
... | ||
net_box = require('net.box') | ||
--- | ||
... | ||
_ = box.schema.space.create('space1') | ||
--- | ||
... | ||
_ = box.schema.sequence.create('seq') | ||
--- | ||
... | ||
_ = box.space.space1:create_index('primary', {sequence = true} ) | ||
--- | ||
... | ||
_ = box.space.space1:create_index('secondary', {parts = {2, 'unsigned'}}) | ||
--- | ||
... | ||
box.schema.user.grant('guest', 'read,write', 'space', 'space1') | ||
--- | ||
... | ||
c = net_box.connect(box.cfg.listen) | ||
--- | ||
... | ||
c.space.space1:insert{box.NULL, "data"} -- fails, but bumps sequence value | ||
--- | ||
- error: 'Tuple field 2 type does not match one required by operation: expected unsigned' | ||
... | ||
c.space.space1:insert{box.NULL, 1, "data"} | ||
--- | ||
- [2, 1, 'data'] | ||
... | ||
box.space.space1:select{} | ||
--- | ||
- - [2, 1, 'data'] | ||
... | ||
vclock = test_run:get_vclock("autobootstrap1") | ||
--- | ||
... | ||
vclock[0] = nil | ||
--- | ||
... | ||
_ = test_run:wait_vclock("autobootstrap2", vclock) | ||
--- | ||
... | ||
test_run:cmd("switch autobootstrap2") | ||
--- | ||
- true | ||
... | ||
box.space.space1:select{} | ||
--- | ||
- - [2, 1, 'data'] | ||
... | ||
test_run:cmd("switch autobootstrap1") | ||
--- | ||
- true | ||
... | ||
box.space.space1:drop() | ||
--- | ||
... | ||
test_run:cmd("switch default") | ||
--- | ||
- true | ||
... | ||
test_run:drop_cluster(SERVERS) | ||
--- | ||
... | ||
test_run:cleanup_cluster() | ||
--- | ||
... |
32 changes: 32 additions & 0 deletions
32
test/replication/gh-3247-misc-iproto-sequence-value-not-replicated.test.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
test_run = require('test_run').new() | ||
test_run:cmd("restart server default") | ||
|
||
-- Deploy a cluster. | ||
SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } | ||
test_run:create_cluster(SERVERS, "replication", {args="0.03"}) | ||
test_run:wait_fullmesh(SERVERS) | ||
|
||
-- gh-3247 - Sequence-generated value is not replicated in case | ||
-- the request was sent via iproto. | ||
test_run:cmd("switch autobootstrap1") | ||
net_box = require('net.box') | ||
_ = box.schema.space.create('space1') | ||
_ = box.schema.sequence.create('seq') | ||
_ = box.space.space1:create_index('primary', {sequence = true} ) | ||
_ = box.space.space1:create_index('secondary', {parts = {2, 'unsigned'}}) | ||
box.schema.user.grant('guest', 'read,write', 'space', 'space1') | ||
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") | ||
vclock[0] = nil | ||
_ = test_run:wait_vclock("autobootstrap2", vclock) | ||
test_run:cmd("switch autobootstrap2") | ||
box.space.space1:select{} | ||
test_run:cmd("switch autobootstrap1") | ||
box.space.space1:drop() | ||
|
||
test_run:cmd("switch default") | ||
test_run:drop_cluster(SERVERS) | ||
test_run:cleanup_cluster() |
46 changes: 46 additions & 0 deletions
46
test/replication/gh-3510-misc-assert-replica-on-applier-disconnect.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
test_run = require('test_run').new() | ||
--- | ||
... | ||
-- gh-3510 assertion failure in replica_on_applier_disconnect() | ||
test_run:cmd('create server er_load1 with script="replication/er_load1.lua"') | ||
--- | ||
- true | ||
... | ||
test_run:cmd('create server er_load2 with script="replication/er_load2.lua"') | ||
--- | ||
- true | ||
... | ||
test_run:cmd('start server er_load1 with wait=False, wait_load=False') | ||
--- | ||
- true | ||
... | ||
-- Instance er_load2 will fail with error ER_REPLICASET_UUID_MISMATCH. | ||
-- This is OK since 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') | ||
--- | ||
- false | ||
... | ||
test_run:cmd('stop server er_load1') | ||
--- | ||
- true | ||
... | ||
-- er_load2 exits automatically. | ||
test_run:cmd('cleanup server er_load1') | ||
--- | ||
- true | ||
... | ||
test_run:cmd('cleanup server er_load2') | ||
--- | ||
- true | ||
... | ||
test_run:cmd('delete server er_load1') | ||
--- | ||
- true | ||
... | ||
test_run:cmd('delete server er_load2') | ||
--- | ||
- true | ||
... | ||
test_run:cleanup_cluster() | ||
--- | ||
... |
Oops, something went wrong.