From: Sergey Bronnikov <sergeyb@tarantool.org> To: Serge Petrenko <sergepetrenko@tarantool.org>, tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org Subject: Re: [Tarantool-patches] [PATCH 1/3 v2] replication: test clear_synchro_queue() function Date: Mon, 16 Nov 2020 14:11:51 +0300 [thread overview] Message-ID: <e0f08dad-6e87-7309-5988-d500525dbb54@tarantool.org> (raw) In-Reply-To: <07e4c4aa-0360-d2d4-8c80-40a61c150d14@tarantool.org> Hi, Serge! thanks for review! On 13.11.2020 16:12, Serge Petrenko wrote: > > 12.11.2020 12:10, sergeyb@tarantool.org пишет: >> From: Sergey Bronnikov <sergeyb@tarantool.org> >> >> Part of #5055 >> Part of #4849 > > Hi! Thanks for the patch! > > Please see 2 comments below. > >> --- >> test/replication/qsync_basic.result | 136 ++++++++++++++++++++++++++ >> test/replication/qsync_basic.test.lua | 50 ++++++++++ >> 2 files changed, 186 insertions(+) >> >> diff --git a/test/replication/qsync_basic.result >> b/test/replication/qsync_basic.result >> index bd3c3cce1..e848e305a 100644 >> --- a/test/replication/qsync_basic.result >> +++ b/test/replication/qsync_basic.result >> @@ -32,6 +32,13 @@ s2.is_sync >> | - false >> | ... >> +-- >> +-- gh-4849: clear synchro queue with unconfigured box >> +-- > > What do you mean by `unconfigured box`? > > box.cfg is called when the default instance (master.lua) is started, > before > the first test line. Missed it. > > If you really want to test `box.ctl.clear_synchro_queue` before box.cfg, > you need to do it in `app-tap/cfg.test.lua`. It has all the tests for > `box.ctl` options. Removed testcase from qsync_basic.test.lua and added it to app-tap/cfg.test.lua: --- a/test/replication/qsync_basic.test.lua +++ b/test/replication/qsync_basic.test.lua @@ -13,11 +13,6 @@ s1:select{} s2 = box.schema.create_space('test2') s2.is_sync --- --- gh-4849: clear synchro queue with unconfigured box --- -box.ctl.clear_synchro_queue() - -- Net.box takes sync into account. box.schema.user.grant('guest', 'super') netbox = require('net.box') --- a/test/app-tap/cfg.test.lua +++ b/test/app-tap/cfg.test.lua @@ -3,7 +3,13 @@ local fiber = require('fiber') local tap = require('tap') local test = tap.test("cfg") -test:plan(11) +test:plan(12) + +-- +-- gh-4849: clear synchro queue is null with unconfigured box +-- +local ok, err = pcall(box.ctl.clear_synchro_queue(), nil) +test:isnil(ok, 'execute clear_synchro_queue with unconfigured box') -- -- gh-4282: box.cfg should not allow nor just ignore nil UUID. >> +box.ctl.clear_synchro_queue() >> + | --- >> + | ... >> + >> -- Net.box takes sync into account. >> box.schema.user.grant('guest', 'super') >> | --- >> @@ -637,6 +644,135 @@ box.space.sync:count() >> | - 0 >> | ... >> +-- >> +-- gh-4849: clear synchro queue on a master >> +-- >> +test_run:switch('default') >> + | --- >> + | - true >> + | ... >> +box.cfg{replication_synchro_quorum = 3, replication_synchro_timeout >> = 1000} >> + | --- >> + | ... >> +ok, err = nil >> + | --- >> + | ... >> +f = fiber.create(function() \ >> + ok, err = pcall(box.space.sync.insert, box.space.sync, >> {10}) \ >> +end) >> + | --- >> + | ... >> +f:status() >> + | --- >> + | - suspended >> + | ... >> +test_run:switch('replica') >> + | --- >> + | - true >> + | ... >> +test_run:wait_cond(function() return box.space.sync:get{10} ~= nil end) >> + | --- >> + | - true >> + | ... >> +test_run:switch('default') >> + | --- >> + | - true >> + | ... >> +box.cfg{replication_synchro_timeout = 0.1} >> + | --- >> + | ... >> +box.ctl.clear_synchro_queue() >> + | --- >> + | ... >> +test_run:switch('replica') >> + | --- >> + | - true >> + | ... >> +test_run:wait_cond(function() return box.space.sync:get{10} == nil end) >> + | --- >> + | - true >> + | ... >> +test_run:switch('default') >> + | --- >> + | - true >> + | ... >> +test_run:wait_cond(function() return f:status() == 'dead' end) >> + | --- >> + | - true >> + | ... >> +ok, err >> + | --- >> + | - false >> + | - Quorum collection for a synchronous transaction is timed out >> + | ... >> +test_run:wait_cond(function() return box.space.sync:get{10} == nil end) >> + | --- >> + | - true >> + | ... >> + >> +-- >> +-- gh-4849: clear synchro queue on a replica, make sure no crashes >> +-- >> +test_run:switch('default') >> + | --- >> + | - true >> + | ... >> +box.cfg{replication_synchro_quorum = 3, replication_synchro_timeout >> = 1000} >> + | --- >> + | ... >> +ok, err = nil >> + | --- >> + | ... >> +f = fiber.create(function() \ >> + ok, err = pcall(box.space.sync.insert, box.space.sync, >> {9}) \ >> +end) >> + | --- >> + | ... >> +f.status() >> + | --- >> + | - running >> + | ... > > > typo: should be `f:status()` Updated: --- a/test/replication/qsync_basic.test.lua +++ b/test/replication/qsync_basic.test.lua @@ -284,7 +284,7 @@ ok, err = nil f = fiber.create(function() \ ok, err = pcall(box.space.sync.insert, box.space.sync, {9}) \ end) -f.status() +f:status() test_run:wait_cond(function() return box.space.sync:get{9} ~= nil end) test_run:switch('replica') box.cfg{replication_synchro_quorum = 3, replication_synchro_timeout=0.01} > > >> +test_run:wait_cond(function() return box.space.sync:get{9} ~= nil end) >> + | --- >> + | - true >> + | ... >> +test_run:switch('replica') >> + | --- >> + | - true >> + | ... >> +box.cfg{replication_synchro_quorum = 3, >> replication_synchro_timeout=0.01} >> + | --- >> + | ... >> +box.ctl.clear_synchro_queue() >> + | --- >> + | ... >> +test_run:wait_cond(function() return box.space.sync:get{9} == nil end) >> + | --- >> + | - true >> + | ... >> +test_run:switch('default') >> + | --- >> + | - true >> + | ... >> +box.cfg{replication_synchro_timeout=0.01} >> + | --- >> + | ... >> +test_run:wait_cond(function() return f:status() == 'dead' end) >> + | --- >> + | - true >> + | ... >> +ok, err >> + | --- >> + | - false >> + | - Quorum collection for a synchronous transaction is timed out >> + | ... >> +test_run:wait_cond(function() return box.space.sync:get{9} == nil end) >> + | --- >> + | - true >> + | ... >> + >> +-- Note: cluster may be in a broken state here due to nature of >> previous test. >> + >> -- Cleanup. >> test_run:cmd('switch default') >> | --- >> diff --git a/test/replication/qsync_basic.test.lua >> b/test/replication/qsync_basic.test.lua >> index 94235547d..523dfa779 100644 >> --- a/test/replication/qsync_basic.test.lua >> +++ b/test/replication/qsync_basic.test.lua >> @@ -13,6 +13,11 @@ s1:select{} >> s2 = box.schema.create_space('test2') >> s2.is_sync >> +-- >> +-- gh-4849: clear synchro queue with unconfigured box >> +-- >> +box.ctl.clear_synchro_queue() >> + >> -- Net.box takes sync into account. >> box.schema.user.grant('guest', 'super') >> netbox = require('net.box') >> @@ -248,6 +253,51 @@ for i = 1, 100 do box.space.sync:delete{i} end >> test_run:cmd('switch replica') >> box.space.sync:count() >> +-- >> +-- gh-4849: clear synchro queue on a master >> +-- >> +test_run:switch('default') >> +box.cfg{replication_synchro_quorum = 3, replication_synchro_timeout >> = 1000} >> +ok, err = nil >> +f = fiber.create(function() \ >> + ok, err = pcall(box.space.sync.insert, box.space.sync, >> {10}) \ >> +end) >> +f:status() >> +test_run:switch('replica') >> +test_run:wait_cond(function() return box.space.sync:get{10} ~= nil end) >> +test_run:switch('default') >> +box.cfg{replication_synchro_timeout = 0.1} >> +box.ctl.clear_synchro_queue() >> +test_run:switch('replica') >> +test_run:wait_cond(function() return box.space.sync:get{10} == nil end) >> +test_run:switch('default') >> +test_run:wait_cond(function() return f:status() == 'dead' end) >> +ok, err >> +test_run:wait_cond(function() return box.space.sync:get{10} == nil end) >> + >> +-- >> +-- gh-4849: clear synchro queue on a replica, make sure no crashes >> +-- >> +test_run:switch('default') >> +box.cfg{replication_synchro_quorum = 3, replication_synchro_timeout >> = 1000} >> +ok, err = nil >> +f = fiber.create(function() \ >> + ok, err = pcall(box.space.sync.insert, box.space.sync, >> {9}) \ >> +end) >> +f.status() >> +test_run:wait_cond(function() return box.space.sync:get{9} ~= nil end) >> +test_run:switch('replica') >> +box.cfg{replication_synchro_quorum = 3, >> replication_synchro_timeout=0.01} >> +box.ctl.clear_synchro_queue() >> +test_run:wait_cond(function() return box.space.sync:get{9} == nil end) >> +test_run:switch('default') >> +box.cfg{replication_synchro_timeout=0.01} >> +test_run:wait_cond(function() return f:status() == 'dead' end) >> +ok, err >> +test_run:wait_cond(function() return box.space.sync:get{9} == nil end) >> + >> +-- Note: cluster may be in a broken state here due to nature of >> previous test. >> + >> -- Cleanup. >> test_run:cmd('switch default') >
next prev parent reply other threads:[~2020-11-16 11:11 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-12 9:10 [Tarantool-patches] [PATCH 0/3 v2] Additional qsync tests sergeyb 2020-11-12 9:10 ` [Tarantool-patches] [PATCH 1/3 v2] replication: test clear_synchro_queue() function sergeyb 2020-11-13 13:12 ` Serge Petrenko 2020-11-16 11:11 ` Sergey Bronnikov [this message] 2020-11-16 14:44 ` Serge Petrenko 2020-11-12 9:10 ` [Tarantool-patches] [PATCH 2/3 v2] replication: add test with random leaders promotion and demotion sergeyb 2020-11-13 15:10 ` Serge Petrenko 2020-11-16 9:10 ` Sergey Bronnikov 2020-11-16 14:00 ` Sergey Bronnikov 2020-11-16 14:48 ` Serge Petrenko 2020-11-16 14:53 ` Serge Petrenko 2020-11-16 16:04 ` Sergey Bronnikov 2020-11-12 9:11 ` [Tarantool-patches] [PATCH 3/3 v2] replication: add test with change space sync mode in a loop sergeyb 2020-11-13 14:05 ` Serge Petrenko
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=e0f08dad-6e87-7309-5988-d500525dbb54@tarantool.org \ --to=sergeyb@tarantool.org \ --cc=sergepetrenko@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 1/3 v2] replication: test clear_synchro_queue() function' \ /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