[PATCH v1 1/1] vinyl: box/errinj.test.lua fails sporadically

imeevma at tarantool.org imeevma at tarantool.org
Wed Aug 8 19:15:30 MSK 2018


In some cases operation box.snapshot() was longer than
expected. This lead to situation when previous error
was repeated instead of new one. Now these errors
completely separated.

Closes #3599.
---
Branch:  imeevma/gh-3599-box-errinj-fails-sporadically
Issue: https://github.com/tarantool/tarantool/issues/3599

 test/box/errinj.result   | 22 ++++++++++++++++++----
 test/box/errinj.test.lua | 15 +++++++++++----
 2 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/test/box/errinj.result b/test/box/errinj.result
index 78aebf1..97546e5 100644
--- a/test/box/errinj.result
+++ b/test/box/errinj.result
@@ -1284,8 +1284,9 @@ errinj.set('ERRINJ_VY_LOG_FILE_RENAME', false)
 ---
 - ok
 ...
-for i = 1, 10 do box.space.test:insert{i} end
+errinj.set('ERRINJ_VY_GC', true)
 ---
+- ok
 ...
 errinj.set('ERRINJ_VY_SCHED_TIMEOUT', 0.001)
 ---
@@ -1295,20 +1296,29 @@ errinj.set('ERRINJ_VY_RUN_FILE_RENAME', true)
 ---
 - ok
 ...
+box.space.test:insert{1}
+---
+- [1]
+...
 box.snapshot() -- error
 ---
 - error: Error injection 'vinyl run file rename'
 ...
-errinj.set('ERRINJ_VY_INDEX_FILE_RENAME', true)
+errinj.set('ERRINJ_VY_RUN_FILE_RENAME', false)
 ---
 - ok
 ...
-errinj.set('ERRINJ_VY_RUN_FILE_RENAME', false)
+-- Wait for the scheduler to unthrottle.
+repeat fiber.sleep(0.001) until pcall(box.snapshot)
+---
+...
+errinj.set('ERRINJ_VY_INDEX_FILE_RENAME', true)
 ---
 - ok
 ...
-fiber.sleep(0.01)
+box.space.test:insert{2}
 ---
+- [2]
 ...
 box.snapshot() -- error
 ---
@@ -1322,6 +1332,10 @@ errinj.set('ERRINJ_VY_SCHED_TIMEOUT', 0)
 ---
 - ok
 ...
+errinj.set('ERRINJ_VY_GC', false)
+---
+- ok
+...
 #fio.glob(fio.pathjoin(box.cfg.vinyl_dir, '*.vylog.inprogress')) > 0
 ---
 - true
diff --git a/test/box/errinj.test.lua b/test/box/errinj.test.lua
index 04f09bd..5c0465e 100644
--- a/test/box/errinj.test.lua
+++ b/test/box/errinj.test.lua
@@ -448,17 +448,24 @@ errinj.set('ERRINJ_VY_LOG_FILE_RENAME', true)
 box.snapshot()
 errinj.set('ERRINJ_VY_LOG_FILE_RENAME', false)
 
-for i = 1, 10 do box.space.test:insert{i} end
-
+errinj.set('ERRINJ_VY_GC', true)
 errinj.set('ERRINJ_VY_SCHED_TIMEOUT', 0.001)
+
 errinj.set('ERRINJ_VY_RUN_FILE_RENAME', true)
+box.space.test:insert{1}
 box.snapshot() -- error
-errinj.set('ERRINJ_VY_INDEX_FILE_RENAME', true)
 errinj.set('ERRINJ_VY_RUN_FILE_RENAME', false)
-fiber.sleep(0.01)
+
+-- Wait for the scheduler to unthrottle.
+repeat fiber.sleep(0.001) until pcall(box.snapshot)
+
+errinj.set('ERRINJ_VY_INDEX_FILE_RENAME', true)
+box.space.test:insert{2}
 box.snapshot() -- error
 errinj.set('ERRINJ_VY_INDEX_FILE_RENAME', false)
+
 errinj.set('ERRINJ_VY_SCHED_TIMEOUT', 0)
+errinj.set('ERRINJ_VY_GC', false)
 
 #fio.glob(fio.pathjoin(box.cfg.vinyl_dir, '*.vylog.inprogress')) > 0
 #fio.glob(fio.pathjoin(box.cfg.vinyl_dir, box.space.test.id, 0, '*.run.inprogress')) > 0
-- 
2.7.4




More information about the Tarantool-patches mailing list