From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Cyrill Gorcunov <gorcunov@gmail.com>, tml <tarantool-patches@dev.tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v14 6/6] test: add replication/gh-6036-rollback-confirm Date: Sun, 12 Sep 2021 17:44:17 +0200 [thread overview] Message-ID: <2341bf9e-e46a-2d87-9d74-5a6fefe2787f@tarantool.org> (raw) In-Reply-To: <20210910152910.607398-7-gorcunov@gmail.com> Thanks for the patch! See 3 comments below. > diff --git a/test/replication/gh-6036-rollback-confirm.result b/test/replication/gh-6036-rollback-confirm.result > new file mode 100644 > index 000000000..e85f6af37 > --- /dev/null > +++ b/test/replication/gh-6036-rollback-confirm.result <...> > +-- Connect master to the replica and write a record. Since the quorum > +-- value is bigger than number of nodes in a cluster it will be rolled > +-- back later. > +test_run:switch('master') > + | --- > + | - true > + | ... > +box.cfg({ \ > + replication = { \ > + "unix/:./master.sock", \ > + "unix/:./replica.sock", \ > + }, \ > +}) > + | --- > + | ... > +_ = box.schema.create_space('sync', {is_sync = true}) > + | --- > + | ... > +_ = box.space.sync:create_index('pk') > + | --- > + | ... > + > +-- > +-- Wait the record to appear on the master. > +f = require('fiber').create(function() box.space.sync:replace{1} end) > + | --- > + | ... > +test_run:wait_cond(function() return box.space.sync:get({1}) ~= nil end, 100) 1. Why do you need a custom wait_cond timeout? > + | --- > + | - true > + | ... > +box.space.sync:select{} > + | --- > + | - - [1] > + | ... > + > +-- > +-- Wait the record from master get written and then > +-- drop the replication. > +test_run:switch('replica') > + | --- > + | - true > + | ... > +test_run:wait_cond(function() return box.space.sync:get({1}) ~= nil end, 100) > + | --- > + | - true > + | ... > +box.space.sync:select{} 2. You don't need the waiting on the master if you wait for the same on the replica. It couldn't get there before master itself. > + | --- > + | - - [1] > + | ... > +box.cfg{replication = {}} > + | --- > + | ... > + > +-- > +-- Then we jump back to the master and drop the replication, > +-- thus unconfirmed record get rolled back. > +test_run:switch('master') > + | --- > + | - true > + | ... > +box.cfg({ \ > + replication = {}, \ > + replication_synchro_timeout = 0.001, \ > + election_mode = 'manual', \ > +}) > + | --- > + | ... > +while f:status() ~= 'dead' do require('fiber').sleep(0.1) end > + | --- > + | ... > +test_run:wait_cond(function() return box.space.sync:get({1}) == nil end, 100) > + | --- > + | - true > + | ... > + > +-- > +-- Force the replica to become a RAFT leader and > +-- commit this new record. > +test_run:switch('replica') > + | --- > + | - true > + | ... > +box.cfg({ \ > + replication_synchro_quorum = 1, \ > + election_mode = 'manual' \ > +}) > + | --- > + | ... > +box.ctl.promote() > + | --- > + | ... > +box.space.sync:select{} > + | --- > + | - - [1] > + | ... > + > +-- > +-- Connect master back to the replica, it should > +-- be refused. > +test_run:switch('master') > + | --- > + | - true > + | ... > +box.cfg({ \ > + replication = { \ > + "unix/:./replica.sock", \ > + }, \ > +}) > + | --- > + | ... > +box.space.sync:select{} > + | --- > + | - [] > + | ... > +test_run:wait_cond(function() return \ > + test_run:grep_log('master', \ > + 'rejecting PROMOTE') ~= nil end, 100) \ > +test_run:wait_cond(function() return \ > + test_run:grep_log('master', \ > + 'ER_CLUSTER_SPLIT') ~= nil end, 100) 3. Why do you need these 2 conds with \? The only reason for using \ between multiple statements is to prevent yields. Why can't you have yields between the two wait_cond() calls? Also could you make one cond with 'grep_log() and grep_log()'?
next prev parent reply other threads:[~2021-09-12 15:46 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-10 15:29 [Tarantool-patches] [PATCH v14 0/6] qsync: implement packets filtering Cyrill Gorcunov via Tarantool-patches 2021-09-10 15:29 ` [Tarantool-patches] [PATCH v14 1/6] qsync: track confirmed lsn number on reads Cyrill Gorcunov via Tarantool-patches 2021-09-12 15:44 ` Vladislav Shpilevoy via Tarantool-patches 2021-09-12 22:18 ` Cyrill Gorcunov via Tarantool-patches 2021-09-13 8:33 ` Serge Petrenko via Tarantool-patches 2021-09-13 8:50 ` Serge Petrenko via Tarantool-patches 2021-09-10 15:29 ` [Tarantool-patches] [PATCH v14 2/6] qsync: update confirmed lsn on initial promote request Cyrill Gorcunov via Tarantool-patches 2021-09-12 15:44 ` Vladislav Shpilevoy via Tarantool-patches 2021-09-12 22:25 ` Cyrill Gorcunov via Tarantool-patches 2021-09-13 8:52 ` Serge Petrenko via Tarantool-patches 2021-09-13 14:20 ` [Tarantool-patches] [RFC] qsync: overall design Cyrill Gorcunov via Tarantool-patches 2021-09-10 15:29 ` [Tarantool-patches] [PATCH v14 3/6] latch: add latch_is_locked helper Cyrill Gorcunov via Tarantool-patches 2021-09-10 15:29 ` [Tarantool-patches] [PATCH v14 4/6] qsync: order access to the limbo terms Cyrill Gorcunov via Tarantool-patches 2021-09-12 15:44 ` Vladislav Shpilevoy via Tarantool-patches 2021-09-13 10:52 ` Cyrill Gorcunov via Tarantool-patches 2021-09-10 15:29 ` [Tarantool-patches] [PATCH v14 5/6] qsync: filter incoming synchro requests Cyrill Gorcunov via Tarantool-patches 2021-09-12 15:44 ` Vladislav Shpilevoy via Tarantool-patches 2021-09-14 19:41 ` Cyrill Gorcunov via Tarantool-patches 2021-09-10 15:29 ` [Tarantool-patches] [PATCH v14 6/6] test: add replication/gh-6036-rollback-confirm Cyrill Gorcunov via Tarantool-patches 2021-09-12 15:44 ` Vladislav Shpilevoy via Tarantool-patches [this message] 2021-09-12 15:43 ` [Tarantool-patches] [PATCH v14 0/6] qsync: implement packets filtering Vladislav Shpilevoy via Tarantool-patches
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=2341bf9e-e46a-2d87-9d74-5a6fefe2787f@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=gorcunov@gmail.com \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v14 6/6] test: add replication/gh-6036-rollback-confirm' \ /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