From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH] test: don't leave open read views after vinyl/iterator Date: Fri, 15 Mar 2019 17:09:03 +0300 Message-Id: <65061cb4d595bdc09ac1bda50a0dfed090438950.1552658906.git.vdavydov.dev@gmail.com> To: tarantool-patches@freelists.org List-ID: 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