Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Konstantin Belyavskiy <k.belyavskiy@tarantool.org>
Cc: georgy@tarantool.org, tarantool-patches@freelists.org
Subject: Re: [PATCH] replication: fix bug with zero replication_connect_quorum
Date: Mon, 9 Apr 2018 11:41:13 +0300	[thread overview]
Message-ID: <20180409084113.lhdykgem35qgdl6d@esperanza> (raw)
In-Reply-To: <20180409080404.9844-1-k.belyavskiy@tarantool.org>

v2 tag missing, changes since v1 missing

Please read and follow

  https://tarantool.io/en/doc/1.9/dev_guide/developer_guidelines.html#how-to-submit-a-patch-for-review

On Mon, Apr 09, 2018 at 11:04:04AM +0300, Konstantin Belyavskiy wrote:
> diff --git a/test/replication/quorum.test.lua b/test/replication/quorum.test.lua
> index 856006843..d92ed23a6 100644
> --- a/test/replication/quorum.test.lua
> +++ b/test/replication/quorum.test.lua
> @@ -97,3 +97,28 @@ box.info.replication[4].upstream.status
>  -- Cleanup.
>  test_run:cmd('switch default')
>  test_run:drop_cluster(SERVERS)
> +
> +--
> +-- gh-3278: test different replication and replication_connect_quorum configs.
> +--
> +
> +-- For next test try to find port with no tarantool running on it.
> +remote = require('net.box')
> +attempt = 0
> +port = 32768 + math.random(32768)
> +test_run:cmd("setopt delimiter ';'")
> +while attempt < 10 do
> +    s = remote.connect('localhost:'..port)
> +    if s.state ~= 'error' then
> +        port = 32768 + math.random(32768)
> +        attempt = attempt + 1
> +    else
> +        break
> +    end
> +end;
> +test_run:cmd("setopt delimiter ''");
> +test_run:cmd("create server replica with rpl_master=default, script='replication/replica_params.lua'")
> +test_run:cmd("start server replica with args='0 0 "..port.."'")
> +test_run:cmd("restart server replica with args='0 1 "..port.."'")
> +test_run:cmd('switch replica')
> +box.info.status -- running (old: orphan)
> diff --git a/test/replication/replica_params.lua b/test/replication/replica_params.lua
> new file mode 100644
> index 000000000..4f8ee5d0a
> --- /dev/null
> +++ b/test/replication/replica_params.lua
> @@ -0,0 +1,23 @@
> +#!/usr/bin/env tarantool
> +
> +local quorum = tonumber(arg[1])
> +local n_replics = tonumber(arg[2])
> +local addr = '127.0.0.1:'..arg[3]
> +listen = os.getenv("LISTEN")
> +-- Test different replicaset configurations:
> +-- First, when the only address in the replicaset is itself.
> +repl = {}
> +-- To test situation with second master unavailable, add
> +-- second address (should be empty).
> +if n_replics == 1 then repl = { addr } end
> +if n_replics == 2 then repl = { listen, addr } end
> +
> +box.cfg({
> +    listen              = listen,
> +    replication         = repl,
> +    memtx_memory        = 100 * 1024 * 1024,
> +    replication_connect_quorum = quorum,
> +    replication_connect_timeout = 0.1,
> +})
> +
> +require('console').listen(os.getenv('ADMIN'))

Why all this complexity? Why don't you just use the test case from
my previous email? It's much more straightforward and easier to
understand. All you need to do is create replica_no_quorum.lua that
has replication_connect_quorum=0 and replication_connect_timeout=0.1
and then add the following test case to replication/quorum.test.lua:

box.schema.user.grant('guest', 'replication')
test_run:cmd("create server replica with rpl_master=default, script='replication/replica_no_quorum.lua'")
test_run:cmd("start server replica")
test_run:cmd("switch replica")
box.info.status -- running
test_run:cmd("switch default")
test_run:cmd("stop server replica")
listen = box.cfg.listen
box.cfg{listen = ''}
test_run:cmd("start server replica")
test_run:cmd("switch replica")
box.info.status -- running
test_run:cmd("switch default")
test_run:cmd("stop server replica")
test_run:cmd("cleanup server replica")
box.schema.user.revoke('guest', 'replication')
box.cfg{listen = listen}

  reply	other threads:[~2018-04-09  8:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-09  8:04 Konstantin Belyavskiy
2018-04-09  8:41 ` Vladimir Davydov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-04-06  8:39 Konstantin Belyavskiy
2018-04-07 14:55 ` 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=20180409084113.lhdykgem35qgdl6d@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=georgy@tarantool.org \
    --cc=k.belyavskiy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH] replication: fix bug with zero replication_connect_quorum' \
    /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