From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [94.100.177.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 41413445320 for ; Wed, 15 Jul 2020 01:44:51 +0300 (MSK) From: Vladislav Shpilevoy Date: Wed, 15 Jul 2020 00:44:46 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 2/2] test: fix flaky qsync_snapshots.test.lua List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, avtikhon@tarantool.org There was a test case about master writing a transaction, replica stating snapshot, master writing rollback, and replica canceling the snapshot. Because its data was spoiled with rolled back data. Sometimes it could happen that the master started writing the transaction to WAL in a newly created fiber, then the test switched to replica, successfully created the snapshot, and only then the data from master was received. As a result, the following rollback didn't affect the already finished snapshot. The patch forces the replica wait for receipt of dirty data from master before starting the snapshot. Closes #5167 --- test/replication/qsync_snapshots.result | 4 ++++ test/replication/qsync_snapshots.test.lua | 1 + 2 files changed, 5 insertions(+) diff --git a/test/replication/qsync_snapshots.result b/test/replication/qsync_snapshots.result index 2a126087a..782ffd482 100644 --- a/test/replication/qsync_snapshots.result +++ b/test/replication/qsync_snapshots.result @@ -204,6 +204,10 @@ fiber = require('fiber') box.cfg{replication_synchro_timeout=1000} | --- | ... +test_run:wait_cond(function() return box.space.sync:count() == 1 end) + | --- + | - true + | ... ok, err = nil | --- | ... diff --git a/test/replication/qsync_snapshots.test.lua b/test/replication/qsync_snapshots.test.lua index 0db61da95..979f04d5f 100644 --- a/test/replication/qsync_snapshots.test.lua +++ b/test/replication/qsync_snapshots.test.lua @@ -97,6 +97,7 @@ end) test_run:switch('replica') fiber = require('fiber') box.cfg{replication_synchro_timeout=1000} +test_run:wait_cond(function() return box.space.sync:count() == 1 end) ok, err = nil f = fiber.create(function() ok, err = pcall(box.snapshot) end) -- 2.21.1 (Apple Git-122.3)