Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH] test: don't leave open read views after vinyl/iterator
@ 2019-03-15 14:09 Vladimir Davydov
  2019-03-15 14:09 ` Vladimir Davydov
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Davydov @ 2019-03-15 14:09 UTC (permalink / raw)
  To: tarantool-patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-15 14:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 14:09 [PATCH] test: don't leave open read views after vinyl/iterator Vladimir Davydov
2019-03-15 14:09 ` Vladimir Davydov

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