From: Vladimir Davydov <vdavydov.dev@gmail.com> To: kostja@tarantool.org Cc: tarantool-patches@freelists.org Subject: [PATCH 4/6] test: make vinyl/replica_rejoin more stable Date: Sun, 30 Jun 2019 22:40:17 +0300 [thread overview] Message-ID: <62314c2482b5d12671e713ee08f47f266e153610.1561922496.git.vdavydov.dev@gmail.com> (raw) In-Reply-To: <cover.1561922496.git.vdavydov.dev@gmail.com> In-Reply-To: <cover.1561922496.git.vdavydov.dev@gmail.com> The test checks that files left after rebootstrap are removed by the garbage collector. It does that by printing file names to the result file. This is inherently unstable, because should timing change, and we can easily get an extra dump or compaction resulting in a different set of files and hence test failure. Let's rewrite the test so that it checks that files are actually removed using fio.path.exists(). --- test/vinyl/replica_rejoin.result | 119 ++++++++++++++++++------------------- test/vinyl/replica_rejoin.test.lua | 34 ++++++----- 2 files changed, 79 insertions(+), 74 deletions(-) diff --git a/test/vinyl/replica_rejoin.result b/test/vinyl/replica_rejoin.result index 1dfcb91b..6e8156fe 100644 --- a/test/vinyl/replica_rejoin.result +++ b/test/vinyl/replica_rejoin.result @@ -11,6 +11,12 @@ test_run = env.new() box.schema.user.grant('guest', 'replication') --- ... +_ = box.schema.space.create('mem') +--- +... +_ = box.space.mem:create_index('pk', {parts = {1, 'string'}}) +--- +... _ = box.schema.space.create('test', { id = 9000, engine = 'vinyl' }) --- ... @@ -36,28 +42,12 @@ test_run:cmd("start server replica") --- - true ... -test_run:cmd("switch replica") +files = test_run:eval("replica", "fio = require('fio') return fio.glob(fio.pathjoin(box.cfg.vinyl_dir, box.space.test.id, 0, '*'))")[1] --- -- true ... -fio = require('fio') +_ = box.space.mem:replace{'files', files} --- ... -fio.chdir(box.cfg.vinyl_dir) ---- -- true -... -fio.glob(fio.pathjoin(box.space.test.id, 0, '*')) ---- -- - 9000/0/00000000000000000002.index - - 9000/0/00000000000000000002.run - - 9000/0/00000000000000000004.index - - 9000/0/00000000000000000004.run -... -test_run:cmd("switch default") ---- -- true -... test_run:cmd("stop server replica") --- - true @@ -97,20 +87,6 @@ box.snapshot() --- - ok ... -fio = require('fio') ---- -... -fio.chdir(box.cfg.vinyl_dir) ---- -- true -... -fio.glob(fio.pathjoin(box.space.test.id, 0, '*')) ---- -- - 9000/0/00000000000000000008.index - - 9000/0/00000000000000000008.run - - 9000/0/00000000000000000010.index - - 9000/0/00000000000000000010.run -... box.space.test:count() -- 99 --- - 99 @@ -119,6 +95,28 @@ test_run:cmd("switch default") --- - true ... +files = box.space.mem:get('files')[2] +--- +... +ok = true +--- +... +fio = require('fio') +--- +... +for _, f in ipairs(files) do ok = ok and not fio.path.exists(f) end +--- +... +ok +--- +- true +... +files = test_run:eval("replica", "fio = require('fio') return fio.glob(fio.pathjoin(box.cfg.vinyl_dir, box.space.test.id, 0, '*'))")[1] +--- +... +_ = box.space.mem:replace{'files', files} +--- +... test_run:cmd("stop server replica") --- - true @@ -164,20 +162,6 @@ test_run:cmd("switch replica") --- - true ... -fio = require('fio') ---- -... -fio.chdir(box.cfg.vinyl_dir) ---- -- true -... -fio.glob(fio.pathjoin(box.space.test.id, 0, '*')) ---- -- - 9000/0/00000000000000000008.index - - 9000/0/00000000000000000008.run - - 9000/0/00000000000000000010.index - - 9000/0/00000000000000000010.run -... box.space.test:count() -- 99 --- - 99 @@ -186,6 +170,16 @@ test_run:cmd("switch default") --- - true ... +old_files = box.space.mem:get('files')[2] +--- +... +new_files = test_run:eval("replica", "fio = require('fio') return fio.glob(fio.pathjoin(box.cfg.vinyl_dir, box.space.test.id, 0, '*'))")[1] +--- +... +#old_files == #new_files +--- +- true +... test_run:cmd("stop server replica") --- - true @@ -211,20 +205,6 @@ box.snapshot() --- - ok ... -fio = require('fio') ---- -... -fio.chdir(box.cfg.vinyl_dir) ---- -- true -... -fio.glob(fio.pathjoin(box.space.test.id, 0, '*')) ---- -- - 9000/0/00000000000000000022.index - - 9000/0/00000000000000000022.run - - 9000/0/00000000000000000024.index - - 9000/0/00000000000000000024.run -... box.space.test:count() -- 98 --- - 98 @@ -233,6 +213,22 @@ test_run:cmd("switch default") --- - true ... +files = box.space.mem:get('files')[2] +--- +... +ok = true +--- +... +fio = require('fio') +--- +... +for _, f in ipairs(files) do ok = ok and not fio.path.exists(f) end +--- +... +ok +--- +- true +... test_run:cmd("stop server replica") --- - true @@ -245,6 +241,9 @@ test_run:cmd("cleanup server replica") box.space.test:drop() --- ... +box.space.mem:drop() +--- +... box.schema.user.revoke('guest', 'replication') --- ... diff --git a/test/vinyl/replica_rejoin.test.lua b/test/vinyl/replica_rejoin.test.lua index 2c5a69e0..cbb17ef2 100644 --- a/test/vinyl/replica_rejoin.test.lua +++ b/test/vinyl/replica_rejoin.test.lua @@ -6,6 +6,8 @@ test_run = env.new() -- after rebootstrap. -- box.schema.user.grant('guest', 'replication') +_ = box.schema.space.create('mem') +_ = box.space.mem:create_index('pk', {parts = {1, 'string'}}) _ = box.schema.space.create('test', { id = 9000, engine = 'vinyl' }) _ = box.space.test:create_index('pk') pad = string.rep('x', 12 * 1024) @@ -15,11 +17,8 @@ box.snapshot() -- Join a replica. Check its files. test_run:cmd("create server replica with rpl_master=default, script='vinyl/replica_rejoin.lua'") test_run:cmd("start server replica") -test_run:cmd("switch replica") -fio = require('fio') -fio.chdir(box.cfg.vinyl_dir) -fio.glob(fio.pathjoin(box.space.test.id, 0, '*')) -test_run:cmd("switch default") +files = test_run:eval("replica", "fio = require('fio') return fio.glob(fio.pathjoin(box.cfg.vinyl_dir, box.space.test.id, 0, '*'))")[1] +_ = box.space.mem:replace{'files', files} test_run:cmd("stop server replica") -- Invoke garbage collector on the master. @@ -36,11 +35,15 @@ test_run:cmd("start server replica") test_run:cmd("switch replica") box.cfg{checkpoint_count = 1} box.snapshot() -fio = require('fio') -fio.chdir(box.cfg.vinyl_dir) -fio.glob(fio.pathjoin(box.space.test.id, 0, '*')) box.space.test:count() -- 99 test_run:cmd("switch default") +files = box.space.mem:get('files')[2] +ok = true +fio = require('fio') +for _, f in ipairs(files) do ok = ok and not fio.path.exists(f) end +ok +files = test_run:eval("replica", "fio = require('fio') return fio.glob(fio.pathjoin(box.cfg.vinyl_dir, box.space.test.id, 0, '*'))")[1] +_ = box.space.mem:replace{'files', files} test_run:cmd("stop server replica") -- Invoke garbage collector on the master. @@ -59,11 +62,11 @@ test_run:cmd("start server replica with crash_expected=True") -- fail test_run:cmd("start server replica with crash_expected=True") -- fail again test_run:cmd("start server replica with args='disable_replication'") test_run:cmd("switch replica") -fio = require('fio') -fio.chdir(box.cfg.vinyl_dir) -fio.glob(fio.pathjoin(box.space.test.id, 0, '*')) box.space.test:count() -- 99 test_run:cmd("switch default") +old_files = box.space.mem:get('files')[2] +new_files = test_run:eval("replica", "fio = require('fio') return fio.glob(fio.pathjoin(box.cfg.vinyl_dir, box.space.test.id, 0, '*'))")[1] +#old_files == #new_files test_run:cmd("stop server replica") box.error.injection.set('ERRINJ_RELAY_FINAL_JOIN', false) @@ -73,14 +76,17 @@ test_run:cmd("start server replica") test_run:cmd("switch replica") box.cfg{checkpoint_count = 1} box.snapshot() -fio = require('fio') -fio.chdir(box.cfg.vinyl_dir) -fio.glob(fio.pathjoin(box.space.test.id, 0, '*')) box.space.test:count() -- 98 test_run:cmd("switch default") +files = box.space.mem:get('files')[2] +ok = true +fio = require('fio') +for _, f in ipairs(files) do ok = ok and not fio.path.exists(f) end +ok test_run:cmd("stop server replica") -- Cleanup. test_run:cmd("cleanup server replica") box.space.test:drop() +box.space.mem:drop() box.schema.user.revoke('guest', 'replication') -- 2.11.0
next prev parent reply other threads:[~2019-06-30 19:40 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-30 19:40 [PATCH 0/6] Get rid of the schema lock Vladimir Davydov 2019-06-30 19:40 ` [PATCH 1/6] Add ERROR_INJECT_YIELD and ERROR_INJECT_SLEEP helpers Vladimir Davydov 2019-07-03 19:12 ` Konstantin Osipov 2019-07-04 15:50 ` Vladimir Davydov 2019-06-30 19:40 ` [PATCH 2/6] Replace ERRINJ_SNAP_WRITE_ROW_TIMEOUT with ERRINJ_SNAP_WRITE_DELAY Vladimir Davydov 2019-07-03 19:13 ` Konstantin Osipov 2019-07-04 15:51 ` Vladimir Davydov 2019-06-30 19:40 ` [PATCH 3/6] Don't take schema lock for checkpointing Vladimir Davydov 2019-07-03 19:21 ` Konstantin Osipov 2019-07-03 20:05 ` Vladimir Davydov 2019-06-30 19:40 ` Vladimir Davydov [this message] 2019-07-03 19:23 ` [PATCH 4/6] test: make vinyl/replica_rejoin more stable Konstantin Osipov 2019-07-04 15:51 ` Vladimir Davydov 2019-06-30 19:40 ` [PATCH 5/6] vinyl: don't yield while logging index creation Vladimir Davydov 2019-06-30 19:40 ` [PATCH 6/6] Replace schema lock with fine-grained locking Vladimir Davydov 2019-07-03 19:35 ` Konstantin Osipov 2019-07-03 19:56 ` Vladimir Davydov 2019-07-04 8:09 ` Konstantin Osipov 2019-07-04 17:06 ` Vladimir Davydov 2019-07-08 7:40 ` Konstantin Osipov 2019-07-08 8:41 ` Vladimir Davydov 2019-07-05 8:53 ` [PATCH 0/6] Get rid of the schema lock 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=62314c2482b5d12671e713ee08f47f266e153610.1561922496.git.vdavydov.dev@gmail.com \ --to=vdavydov.dev@gmail.com \ --cc=kostja@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [PATCH 4/6] test: make vinyl/replica_rejoin more stable' \ /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