Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: tarantool-patches@freelists.org
Subject: [PATCH] test: don't leave open read views after vinyl/iterator
Date: Fri, 15 Mar 2019 17:09:03 +0300	[thread overview]
Message-ID: <65061cb4d595bdc09ac1bda50a0dfed090438950.1552658906.git.vdavydov.dev@gmail.com> (raw)

An open iterator may disrupt the following test run, because it may
prevent dump/compaction from purging stale rows. In particular,
iterators left by vinyl/iterator result in the following test failure:

 | --- vinyl/deferred_delete.result        Mon Feb 11 19:14:01 2019
 | +++ vinyl/deferred_delete.reject        Fri Mar 15 16:21:11 2019
 | @@ -155,7 +155,7 @@
 |  ...
 |  pk:stat().rows -- 5 new REPLACEs
 |  ---
 | -- 5
 | +- 10
 |  ...
 |  i1:stat().rows -- 10 old REPLACE + 5 new REPLACEs + 10 deferred DELETEs
 |  ---

Fix this by calling the Lua garbage collector to delete all dangling
iterators in the end of vinyl/iterator test.

Closes #3862
---
https://github.com/tarantool/tarantool/issues/3862

 test/vinyl/iterator.result   | 13 +++++++++++++
 test/vinyl/iterator.test.lua |  6 ++++++
 2 files changed, 19 insertions(+)

diff --git a/test/vinyl/iterator.result b/test/vinyl/iterator.result
index 48f05246..0ef2a1b4 100644
--- a/test/vinyl/iterator.result
+++ b/test/vinyl/iterator.result
@@ -1937,6 +1937,9 @@ s:select{1}
 ---
 - - [1, 4]
 ...
+itr = nil
+---
+...
 s:drop()
 ---
 ...
@@ -2307,3 +2310,13 @@ box.commit()
 s:drop()
 ---
 ...
+-- Collect all iterators to make sure no read views are left behind,
+-- as they might disrupt the following test run.
+collectgarbage()
+---
+- 0
+...
+box.stat.vinyl().tx.read_views -- 0
+---
+- 0
+...
diff --git a/test/vinyl/iterator.test.lua b/test/vinyl/iterator.test.lua
index 2e67079c..8d2a8593 100644
--- a/test/vinyl/iterator.test.lua
+++ b/test/vinyl/iterator.test.lua
@@ -653,6 +653,7 @@ iterator_next(itr)
 for i=1,10 do s:upsert({i, 1}, {{'+', 2, 1}}) end
 iterator_next(itr)
 s:select{1}
+itr = nil
 
 s:drop()
 
@@ -814,3 +815,8 @@ c:get() -- error
 box.commit()
 
 s:drop()
+
+-- Collect all iterators to make sure no read views are left behind,
+-- as they might disrupt the following test run.
+collectgarbage()
+box.stat.vinyl().tx.read_views -- 0
-- 
2.11.0

             reply	other threads:[~2019-03-15 14:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15 14:09 Vladimir Davydov [this message]
2019-03-15 14:09 ` 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=65061cb4d595bdc09ac1bda50a0dfed090438950.1552658906.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH] test: don'\''t leave open read views after vinyl/iterator' \
    /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