Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Serge Petrenko <sergepetrenko@tarantool.org>
Subject: [tarantool-patches] [PATCH] Fix race condition in replication/gc test.
Date: Tue, 10 Jul 2018 11:08:16 +0300	[thread overview]
Message-ID: <20180710080816.78918-1-sergepetrenko@tarantool.org> (raw)

The test had a race condition: a replica could recieve updates before
we switch it off, which would cause master to delete one extra xlog
and the test to fail. Fix this by loosening checks. We now check if
there are 2 or 3 xlogs stored instead of only 3.
---
https://github.com/tarantool/tarantool/tree/sergepetrenko/replication-gc-test-fix

 test/replication/gc.result   | 5 ++++-
 test/replication/gc.test.lua | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/replication/gc.result b/test/replication/gc.result
index 992075594..7447abb62 100644
--- a/test/replication/gc.result
+++ b/test/replication/gc.result
@@ -315,7 +315,10 @@ box.snapshot()
 ---
 - true
 ...
-#fio.glob('./master/*.xlog') == 3 or fio.listdir('./master')
+ctr = #fio.glob('./master/*.xlog')
+---
+...
+ctr == 3 or ctr == 2 or fio.listdir('./master')
 ---
 - true
 ...
diff --git a/test/replication/gc.test.lua b/test/replication/gc.test.lua
index 92fb87446..95845193b 100644
--- a/test/replication/gc.test.lua
+++ b/test/replication/gc.test.lua
@@ -145,7 +145,8 @@ box.snapshot()
 _ = s:auto_increment{}
 box.snapshot()
 #box.info.gc().checkpoints == 1 or box.info.gc()
-#fio.glob('./master/*.xlog') == 3 or fio.listdir('./master')
+ctr = #fio.glob('./master/*.xlog')
+ctr == 3 or ctr == 2 or fio.listdir('./master')
 
 -- The xlog should only be deleted after the replica
 -- is unregistered.
-- 
2.15.2 (Apple Git-101.1)

             reply	other threads:[~2018-07-10  8:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10  8:08 Serge Petrenko [this message]
2018-07-10  8:18 ` Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180710080816.78918-1-sergepetrenko@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH] Fix race condition in replication/gc test.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox