[Tarantool-patches] [PATCH 1/2] test: fix flaky qsync_snapshots.test.lua again

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Jul 23 02:57:01 MSK 2020


One of the test cases started a sync transaction on master,
switched to replica, and tried to do some actions assuming that
the latest master data has arrived here.

But in fact the replica could be far behind the master. It could
still contain data from the previous test case. That led to a
bug, when it looked like if the replica had some data committed
on it, but not committed on master - this was just data from the
previous test case.

The issue is solved by flushing master's state to replica via
making a successful sync transaction.

Closes #5167
---
 test/replication/qsync_snapshots.result   | 8 +++++++-
 test/replication/qsync_snapshots.test.lua | 4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/replication/qsync_snapshots.result b/test/replication/qsync_snapshots.result
index 782ffd482..cafdd63c8 100644
--- a/test/replication/qsync_snapshots.result
+++ b/test/replication/qsync_snapshots.result
@@ -176,8 +176,14 @@ _ = box.schema.space.create('sync', {is_sync=true, engine=engine})
 _ = box.space.sync:create_index('pk')
  | ---
  | ...
+-- Write something to flush the current master's state to replica.
+_ = box.space.sync:insert{1}
+ | ---
+ | ...
+_ = box.space.sync:delete{1}
+ | ---
+ | ...
 
--- Testcase body.
 test_run:switch('default')
  | ---
  | - true
diff --git a/test/replication/qsync_snapshots.test.lua b/test/replication/qsync_snapshots.test.lua
index 979f04d5f..590610974 100644
--- a/test/replication/qsync_snapshots.test.lua
+++ b/test/replication/qsync_snapshots.test.lua
@@ -85,8 +85,10 @@ test_run:switch('default')
 box.cfg{replication_synchro_quorum=NUM_INSTANCES, replication_synchro_timeout=1000}
 _ = box.schema.space.create('sync', {is_sync=true, engine=engine})
 _ = box.space.sync:create_index('pk')
+-- Write something to flush the current master's state to replica.
+_ = box.space.sync:insert{1}
+_ = box.space.sync:delete{1}
 
--- Testcase body.
 test_run:switch('default')
 box.cfg{replication_synchro_quorum=BROKEN_QUORUM}
 ok, err = nil
-- 
2.21.1 (Apple Git-122.3)



More information about the Tarantool-patches mailing list