[Tarantool-patches] [PATCH v2 5/6] test: fix replication/election_qsync_stress test
Serge Petrenko
sergepetrenko at tarantool.org
Wed Dec 23 14:59:23 MSK 2020
The test involves writing synchronous transactions on one node and
making other nodes confirm these transactions after its death.
In order for the test to work properly we need to make sure the old
node replicates all its transactions to peers before killing it.
Otherwise once the node is resurrected it'll have newer data, not
present on other nodes, which leads to their vclocks being incompatible
and noone becoming the new leader and hanging the test.
Follow-up #5435
---
test/replication/election_qsync_stress.result | 7 ++++++-
test/replication/election_qsync_stress.test.lua | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/test/replication/election_qsync_stress.result b/test/replication/election_qsync_stress.result
index 1380c910b..2646995ee 100644
--- a/test/replication/election_qsync_stress.result
+++ b/test/replication/election_qsync_stress.result
@@ -88,8 +88,13 @@ test_run:cmd('setopt delimiter ";"')
| ...
for i = 1,10 do
c:eval('box.cfg{replication_synchro_quorum=4, replication_synchro_timeout=1000}')
+ lsn = c:eval('return box.info.lsn')
c.space.test:insert({i}, {is_async=true})
- test_run:wait_cond(function() return c.space.test:get{i} ~= nil end)
+ test_run:wait_cond(function() return c:eval('return box.info.lsn') > lsn end)
+ r1_nr = old_leader_nr % 3 + 1
+ r2_nr = (old_leader_nr + 1) % 3 + 1
+ test_run:wait_lsn('election_replica'..r1_nr, 'election_replica'..old_leader_nr)
+ test_run:wait_lsn('election_replica'..r2_nr, 'election_replica'..old_leader_nr)
test_run:cmd('stop server '..old_leader)
nrs[old_leader_nr] = false
new_leader_nr = get_leader(nrs)
diff --git a/test/replication/election_qsync_stress.test.lua b/test/replication/election_qsync_stress.test.lua
index d70601cc5..5e5905f23 100644
--- a/test/replication/election_qsync_stress.test.lua
+++ b/test/replication/election_qsync_stress.test.lua
@@ -50,8 +50,13 @@ _ = c:eval('box.space.test:create_index("pk")')
test_run:cmd('setopt delimiter ";"')
for i = 1,10 do
c:eval('box.cfg{replication_synchro_quorum=4, replication_synchro_timeout=1000}')
+ lsn = c:eval('return box.info.lsn')
c.space.test:insert({i}, {is_async=true})
- test_run:wait_cond(function() return c.space.test:get{i} ~= nil end)
+ test_run:wait_cond(function() return c:eval('return box.info.lsn') > lsn end)
+ r1_nr = old_leader_nr % 3 + 1
+ r2_nr = (old_leader_nr + 1) % 3 + 1
+ test_run:wait_lsn('election_replica'..r1_nr, 'election_replica'..old_leader_nr)
+ test_run:wait_lsn('election_replica'..r2_nr, 'election_replica'..old_leader_nr)
test_run:cmd('stop server '..old_leader)
nrs[old_leader_nr] = false
new_leader_nr = get_leader(nrs)
--
2.24.3 (Apple Git-128)
More information about the Tarantool-patches
mailing list