Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: vdavydov.dev@gmail.com
Cc: tarantool-patches@freelists.org,
	Serge Petrenko <sergepetrenko@tarantool.org>
Subject: [PATCH] test: fix engine/ddl occasional failure
Date: Mon, 27 Aug 2018 11:26:05 +0300	[thread overview]
Message-ID: <20180827082605.26670-1-sergepetrenko@tarantool.org> (raw)

Sometimes the test failed with output similar to the one below:

    [001] engine/ddl.test.lua	memtx           [ fail ]
    [001]
    [001] Test failed! Result content mismatch:
    [001] --- engine/ddl.result	Mon Aug 27 09:35:19 2018
    [001] +++ engine/ddl.reject	Mon Aug 27 11:12:47 2018
    [001] @@ -1932,7 +1932,7 @@
    [001]  ...
    [001]  s.index.pk:select()
    [001]  ---
    [001] -- - [1, 1, 11]
    [001] +- - [1, 1, 8]
    [001]  ...
    [001]  s.index.sk:select()
    [001]  ---

This happened due to a race condition in a test case added for
issue #3578.
To fix it we need to move c:get() above s.index.pk:select() to
make sure we actually wait for the fiber function to complete
before checking results.

Follow-up #3578.
---
https://github.com/tarantool/tarantool/issues/3578
https://github.com/tarantool/tarantool/tree/sp/engine-ddl-test-race
 test/engine/ddl.result   | 8 ++++----
 test/engine/ddl.test.lua | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/test/engine/ddl.result b/test/engine/ddl.result
index d1df0366f..ead00f9cb 100644
--- a/test/engine/ddl.result
+++ b/test/engine/ddl.result
@@ -1930,6 +1930,10 @@ _ = fiber.create(function() for i = 1, 10 do s:update(1, {{'+', 3, 1}}) end c:pu
 _ = s:create_index('sk', {parts = {2, 'unsigned'}})
 ---
 ...
+c:get()
+---
+- true
+...
 s.index.pk:select()
 ---
 - - [1, 1, 11]
@@ -1938,10 +1942,6 @@ s.index.sk:select()
 ---
 - - [1, 1, 11]
 ...
-c:get()
----
-- true
-...
 s:drop()
 ---
 ...
diff --git a/test/engine/ddl.test.lua b/test/engine/ddl.test.lua
index 89666b863..757e60b02 100644
--- a/test/engine/ddl.test.lua
+++ b/test/engine/ddl.test.lua
@@ -702,10 +702,11 @@ c = fiber.channel(1)
 _ = fiber.create(function() for i = 1, 10 do s:update(1, {{'+', 3, 1}}) end c:put(true) end)
 
 _ = s:create_index('sk', {parts = {2, 'unsigned'}})
+
+c:get()
 s.index.pk:select()
 s.index.sk:select()
 
-c:get()
 s:drop()
 
 --
-- 
2.15.2 (Apple Git-101.1)

             reply	other threads:[~2018-08-27  8:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27  8:26 Serge Petrenko [this message]
2018-08-27  9:17 ` 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=20180827082605.26670-1-sergepetrenko@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH] test: fix engine/ddl occasional failure' \
    /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