Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: tarantool-patches@dev.tarantool.org
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Subject: [Tarantool-patches] [PATCH] test: fix vinyl/deferred_delete failure
Date: Mon, 30 Mar 2020 21:03:39 +0300	[thread overview]
Message-ID: <927baef2bc5177f8b9cdd0ba5e7f259b5fc200a3.1585591162.git.korablev@tarantool.org> (raw)

From: Vladimir Davydov <vdavydov.dev@gmail.com>

The patch fixes the following test failure:

 | --- vinyl/deferred_delete.result        Fri Mar 15 18:17:05 2019
 | +++ vinyl/deferred_delete.reject        Fri Mar 15 18:18:18 2019
 | @@ -577,7 +577,7 @@
 |  ...
 |  sk:stat().rows -- ditto
 |  ---
 | -- 5
 | +- 25
 |  ...
 |  s:drop()
 |  ---

The failure was introduced by commit 6dd0d2fb7e0e ("vinyl: do not apply
run_count_per_level to the last level"). Due to the commit compaction of
the secondary index may happen before compaction of the primary index,
in which case deferred DELETE statements won't make it to the secondary
index in time against the test expectation. Fix this by making the first
run big enough to prevent major compaction from kicking in.

Follow-up #3657
Closes #4047

(cherry picked from commit 5433435d6f2cdc0c5524df649f39deb7d02d1dce)
---
Branch: https://github.com/tarantool/tarantool/tree/np/deferred-delete-test-fix

This patch was forgotten to be cherry-picked on 1.10 branch while was
pushed to master. As a result, vinyl/deferred_delete.test.lua sometimes
fails (see https://github.com/tarantool/tarantool/issues/4248).

 test/vinyl/deferred_delete.result   | 36 ++++++++++++++++++-----------
 test/vinyl/deferred_delete.test.lua | 18 ++++++++++-----
 2 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/test/vinyl/deferred_delete.result b/test/vinyl/deferred_delete.result
index 3c8dbe5b6..23c93f0f5 100644
--- a/test/vinyl/deferred_delete.result
+++ b/test/vinyl/deferred_delete.result
@@ -575,6 +575,14 @@ pk = s:create_index('pk', {run_count_per_level = 10})
 sk = s:create_index('sk', {run_count_per_level = 10, parts = {2, 'unsigned'}, unique = false})
 ---
 ...
+-- Write a run big enough to prevent major compaction from kicking in
+-- (run_count_per_level is ignored on the last level - see gh-3657).
+dummy_rows = 100
+---
+...
+for i = 1001, 1000 + dummy_rows do s:replace{i, i} end
+---
+...
 for i = 1, 10 do s:replace{i, i} end
 ---
 ...
@@ -597,19 +605,19 @@ for i = 2, 10, 2 do s:replace{i, i * 100} end
 box.commit()
 ---
 ...
-sk:select()
+sk:select({1000}, {iterator = 'le'})
 ---
-- - [2, 200]
-  - [4, 400]
-  - [6, 600]
+- - [10, 1000]
   - [8, 800]
-  - [10, 1000]
+  - [6, 600]
+  - [4, 400]
+  - [2, 200]
 ...
-pk:stat().rows -- 10 old REPLACEs + 5 DELETEs + 5 new REPLACEs
+pk:stat().rows - dummy_rows -- 10 old REPLACEs + 5 DELETEs + 5 new REPLACEs
 ---
 - 20
 ...
-sk:stat().rows -- 10 old REPLACEs + 5 new REPLACEs
+sk:stat().rows - dummy_rows -- 10 old REPLACEs + 5 new REPLACEs
 ---
 - 15
 ...
@@ -635,19 +643,19 @@ sk:compact()
 while sk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end
 ---
 ...
-sk:select()
+sk:select({1000}, {iterator = 'le'})
 ---
-- - [2, 200]
-  - [4, 400]
-  - [6, 600]
+- - [10, 1000]
   - [8, 800]
-  - [10, 1000]
+  - [6, 600]
+  - [4, 400]
+  - [2, 200]
 ...
-pk:stat().rows -- 5 new REPLACEs
+pk:stat().rows - dummy_rows -- 5 new REPLACEs
 ---
 - 5
 ...
-sk:stat().rows -- ditto
+sk:stat().rows - dummy_rows -- ditto
 ---
 - 5
 ...
diff --git a/test/vinyl/deferred_delete.test.lua b/test/vinyl/deferred_delete.test.lua
index a4d41ec88..1bce954c5 100644
--- a/test/vinyl/deferred_delete.test.lua
+++ b/test/vinyl/deferred_delete.test.lua
@@ -202,6 +202,12 @@ s:drop()
 s = box.schema.space.create('test', {engine = 'vinyl'})
 pk = s:create_index('pk', {run_count_per_level = 10})
 sk = s:create_index('sk', {run_count_per_level = 10, parts = {2, 'unsigned'}, unique = false})
+
+-- Write a run big enough to prevent major compaction from kicking in
+-- (run_count_per_level is ignored on the last level - see gh-3657).
+dummy_rows = 100
+for i = 1001, 1000 + dummy_rows do s:replace{i, i} end
+
 for i = 1, 10 do s:replace{i, i} end
 box.snapshot()
 
@@ -211,10 +217,10 @@ for i = 1, 10, 2 do s:delete{i} end
 for i = 2, 10, 2 do s:replace{i, i * 100} end
 box.commit()
 
-sk:select()
+sk:select({1000}, {iterator = 'le'})
 
-pk:stat().rows -- 10 old REPLACEs + 5 DELETEs + 5 new REPLACEs
-sk:stat().rows -- 10 old REPLACEs + 5 new REPLACEs
+pk:stat().rows - dummy_rows -- 10 old REPLACEs + 5 DELETEs + 5 new REPLACEs
+sk:stat().rows - dummy_rows -- 10 old REPLACEs + 5 new REPLACEs
 
 -- Compact the primary index to generate deferred DELETEs.
 box.snapshot()
@@ -226,10 +232,10 @@ box.snapshot()
 sk:compact()
 while sk:stat().disk.compaction.count == 0 do fiber.sleep(0.001) end
 
-sk:select()
+sk:select({1000}, {iterator = 'le'})
 
-pk:stat().rows -- 5 new REPLACEs
-sk:stat().rows -- ditto
+pk:stat().rows - dummy_rows -- 5 new REPLACEs
+sk:stat().rows - dummy_rows -- ditto
 
 s:drop()
 
-- 
2.17.1

                 reply	other threads:[~2020-03-30 18:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=927baef2bc5177f8b9cdd0ba5e7f259b5fc200a3.1585591162.git.korablev@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [Tarantool-patches] [PATCH] test: fix vinyl/deferred_delete 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