Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>,
	tml <tarantool-patches@dev.tarantool.org>
Cc: Mons Anderson <v.perepelitsa@corp.mail.ru>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v4 3/3] test: add replication/gh-5446-qsync-eval-quorum.test.lua
Date: Wed, 16 Dec 2020 16:25:48 +0300	[thread overview]
Message-ID: <cdffbd9f-da2a-5b02-b185-f88e755ccc8c@tarantool.org> (raw)
In-Reply-To: <20201214113935.1040421-4-gorcunov@gmail.com>


14.12.2020 14:39, Cyrill Gorcunov пишет:
> Part-of #5446


Thanks!

LGTM.


> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
>   .../gh-5446-qsync-eval-quorum.result          | 268 ++++++++++++++++++
>   .../gh-5446-qsync-eval-quorum.test.lua        | 107 +++++++
>   test/replication/replica-quorum-1.lua         |   1 +
>   test/replication/replica-quorum-2.lua         |   1 +
>   test/replication/replica-quorum-3.lua         |   1 +
>   test/replication/replica-quorum-4.lua         |   1 +
>   test/replication/replica-quorum-5.lua         |   1 +
>   test/replication/replica-quorum-6.lua         |   1 +
>   8 files changed, 381 insertions(+)
>   create mode 100644 test/replication/gh-5446-qsync-eval-quorum.result
>   create mode 100644 test/replication/gh-5446-qsync-eval-quorum.test.lua
>   create mode 120000 test/replication/replica-quorum-1.lua
>   create mode 120000 test/replication/replica-quorum-2.lua
>   create mode 120000 test/replication/replica-quorum-3.lua
>   create mode 120000 test/replication/replica-quorum-4.lua
>   create mode 120000 test/replication/replica-quorum-5.lua
>   create mode 120000 test/replication/replica-quorum-6.lua
>
> diff --git a/test/replication/gh-5446-qsync-eval-quorum.result b/test/replication/gh-5446-qsync-eval-quorum.result
> new file mode 100644
> index 000000000..db0f8e91f
> --- /dev/null
> +++ b/test/replication/gh-5446-qsync-eval-quorum.result
> @@ -0,0 +1,268 @@
> +-- test-run result file version 2
> +test_run = require('test_run').new()
> + | ---
> + | ...
> +engine = test_run:get_cfg('engine')
> + | ---
> + | ...
> +
> +box.schema.user.grant('guest', 'replication')
> + | ---
> + | ...
> +
> +-- Test syntax error
> +box.cfg{replication_synchro_quorum = "aaa"}
> + | ---
> + | - error: 'Incorrect value for option ''replication_synchro_quorum'': [string "local
> + |     expr = [[aaa]]..."]:7: Expression should return a number'
> + | ...
> +
> +-- Test out of bounds values
> +box.cfg{replication_synchro_quorum = "N+1"}
> + | ---
> + | - error: 'Incorrect value for option ''replication_synchro_quorum'': evaluated value
> + |     is out of range'
> + | ...
> +box.cfg{replication_synchro_quorum = "N-1"}
> + | ---
> + | - error: 'Incorrect value for option ''replication_synchro_quorum'': evaluated value
> + |     is out of range'
> + | ...
> +
> +-- Use canonical majority formula
> +box.cfg { replication_synchro_quorum = "N/2+1", replication_synchro_timeout = 1000 }
> + | ---
> + | ...
> +match = 'set \'replication_synchro_quorum\' configuration option to \"N\\/2%+1'
> + | ---
> + | ...
> +test_run:grep_log("default", match) ~= nil
> + | ---
> + | - true
> + | ...
> +
> +-- Create a sync space we will operate on
> +_ = box.schema.space.create('sync', {is_sync = true, engine = engine})
> + | ---
> + | ...
> +s = box.space.sync
> + | ---
> + | ...
> +s:format({{name = 'id', type = 'unsigned'}, {name = 'value', type = 'unsigned'}})
> + | ---
> + | ...
> +_ = s:create_index('primary', {parts = {'id'}})
> + | ---
> + | ...
> +s:insert{1, 1}
> + | ---
> + | - [1, 1]
> + | ...
> +
> +test_run:cmd('create server replica1 with rpl_master=default,\
> +              script="replication/replica-quorum-1.lua"')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('start server replica1 with wait=True, wait_load=True')
> + | ---
> + | - true
> + | ...
> +
> +-- 1 replica -> replication_synchro_quorum = 2/2 + 1 = 2
> +match = 'update replication_synchro_quorum = 2'
> + | ---
> + | ...
> +test_run:grep_log("default", match) ~= nil
> + | ---
> + | - true
> + | ...
> +
> +test_run:cmd('create server replica2 with rpl_master=default,\
> +              script="replication/replica-quorum-2.lua"')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('start server replica2 with wait=True, wait_load=True')
> + | ---
> + | - true
> + | ...
> +
> +-- 2 replicas -> replication_synchro_quorum = 3/2 + 1 = 2
> +match = 'update replication_synchro_quorum = 2'
> + | ---
> + | ...
> +test_run:grep_log("default", match) ~= nil
> + | ---
> + | - true
> + | ...
> +
> +test_run:cmd('create server replica3 with rpl_master=default,\
> +              script="replication/replica-quorum-3.lua"')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('start server replica3 with wait=True, wait_load=True')
> + | ---
> + | - true
> + | ...
> +
> +-- 3 replicas -> replication_synchro_quorum = 4/2 + 1 = 3
> +match = 'update replication_synchro_quorum = 3'
> + | ---
> + | ...
> +test_run:grep_log("default", match) ~= nil
> + | ---
> + | - true
> + | ...
> +
> +test_run:cmd('create server replica4 with rpl_master=default,\
> +              script="replication/replica-quorum-4.lua"')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('start server replica4 with wait=True, wait_load=True')
> + | ---
> + | - true
> + | ...
> +
> +-- 4 replicas -> replication_synchro_quorum = 5/2 + 1 = 3
> +match = 'update replication_synchro_quorum = 3'
> + | ---
> + | ...
> +test_run:grep_log("default", match) ~= nil
> + | ---
> + | - true
> + | ...
> +
> +test_run:cmd('create server replica5 with rpl_master=default,\
> +              script="replication/replica-quorum-5.lua"')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('start server replica5 with wait=True, wait_load=True')
> + | ---
> + | - true
> + | ...
> +
> +test_run:cmd('create server replica6 with rpl_master=default,\
> +              script="replication/replica-quorum-6.lua"')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('start server replica6 with wait=True, wait_load=True')
> + | ---
> + | - true
> + | ...
> +
> +-- 6 replicas -> replication_synchro_quorum = 7/2 + 1 = 4
> +match = 'update replication_synchro_quorum = 4'
> + | ---
> + | ...
> +test_run:grep_log("default", match) ~= nil
> + | ---
> + | - true
> + | ...
> +
> +-- 5 replicas left, the commit should pass
> +test_run:cmd('stop server replica1')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('delete server replica1')
> + | ---
> + | - true
> + | ...
> +s:insert{2, 2}
> + | ---
> + | - [2, 2]
> + | ...
> +
> +-- 4 replicas left,the commit should pass
> +test_run:cmd('stop server replica2')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('delete server replica2')
> + | ---
> + | - true
> + | ...
> +s:insert{3, 3}
> + | ---
> + | - [3, 3]
> + | ...
> +
> +-- 3 replicas left, the commit should pass
> +test_run:cmd('stop server replica3')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('delete server replica3')
> + | ---
> + | - true
> + | ...
> +s:insert{4, 4}
> + | ---
> + | - [4, 4]
> + | ...
> +
> +-- 2 replicas left, the commit should NOT pass
> +--
> +-- The replication_synchro_timeout set to a small value to not wait
> +-- for very long for the case where we know the commit should
> +-- not pass since replicas are stopped.
> +box.cfg { replication_synchro_timeout = 0.5 }
> + | ---
> + | ...
> +test_run:cmd('stop server replica4')
> + | ---
> + | - true
> + | ...
> +s:insert{5, 5}
> + | ---
> + | - error: Quorum collection for a synchronous transaction is timed out
> + | ...
> +-- restore it back and retry
> +test_run:cmd('start server replica4 with wait=True, wait_load=True')
> + | ---
> + | - true
> + | ...
> +box.cfg { replication_synchro_timeout = 1000 }
> + | ---
> + | ...
> +s:insert{5, 5}
> + | ---
> + | - [5, 5]
> + | ...
> +test_run:cmd('stop server replica4')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('delete server replica4')
> + | ---
> + | - true
> + | ...
> +
> +-- cleanup leftovers
> +
> +test_run:cmd('stop server replica5')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('delete server replica5')
> + | ---
> + | - true
> + | ...
> +
> +test_run:cmd('stop server replica6')
> + | ---
> + | - true
> + | ...
> +test_run:cmd('delete server replica6')
> + | ---
> + | - true
> + | ...
> +
> +box.schema.user.revoke('guest', 'replication')
> + | ---
> + | ...
> diff --git a/test/replication/gh-5446-qsync-eval-quorum.test.lua b/test/replication/gh-5446-qsync-eval-quorum.test.lua
> new file mode 100644
> index 000000000..2ecfa8c3e
> --- /dev/null
> +++ b/test/replication/gh-5446-qsync-eval-quorum.test.lua
> @@ -0,0 +1,107 @@
> +test_run = require('test_run').new()
> +engine = test_run:get_cfg('engine')
> +
> +box.schema.user.grant('guest', 'replication')
> +
> +-- Test syntax error
> +box.cfg{replication_synchro_quorum = "aaa"}
> +
> +-- Test out of bounds values
> +box.cfg{replication_synchro_quorum = "N+1"}
> +box.cfg{replication_synchro_quorum = "N-1"}
> +
> +-- Use canonical majority formula
> +box.cfg { replication_synchro_quorum = "N/2+1", replication_synchro_timeout = 1000 }
> +match = 'set \'replication_synchro_quorum\' configuration option to \"N\\/2%+1'
> +test_run:grep_log("default", match) ~= nil
> +
> +-- Create a sync space we will operate on
> +_ = box.schema.space.create('sync', {is_sync = true, engine = engine})
> +s = box.space.sync
> +s:format({{name = 'id', type = 'unsigned'}, {name = 'value', type = 'unsigned'}})
> +_ = s:create_index('primary', {parts = {'id'}})
> +s:insert{1, 1}
> +
> +test_run:cmd('create server replica1 with rpl_master=default,\
> +              script="replication/replica-quorum-1.lua"')
> +test_run:cmd('start server replica1 with wait=True, wait_load=True')
> +
> +-- 1 replica -> replication_synchro_quorum = 2/2 + 1 = 2
> +match = 'update replication_synchro_quorum = 2'
> +test_run:grep_log("default", match) ~= nil
> +
> +test_run:cmd('create server replica2 with rpl_master=default,\
> +              script="replication/replica-quorum-2.lua"')
> +test_run:cmd('start server replica2 with wait=True, wait_load=True')
> +
> +-- 2 replicas -> replication_synchro_quorum = 3/2 + 1 = 2
> +match = 'update replication_synchro_quorum = 2'
> +test_run:grep_log("default", match) ~= nil
> +
> +test_run:cmd('create server replica3 with rpl_master=default,\
> +              script="replication/replica-quorum-3.lua"')
> +test_run:cmd('start server replica3 with wait=True, wait_load=True')
> +
> +-- 3 replicas -> replication_synchro_quorum = 4/2 + 1 = 3
> +match = 'update replication_synchro_quorum = 3'
> +test_run:grep_log("default", match) ~= nil
> +
> +test_run:cmd('create server replica4 with rpl_master=default,\
> +              script="replication/replica-quorum-4.lua"')
> +test_run:cmd('start server replica4 with wait=True, wait_load=True')
> +
> +-- 4 replicas -> replication_synchro_quorum = 5/2 + 1 = 3
> +match = 'update replication_synchro_quorum = 3'
> +test_run:grep_log("default", match) ~= nil
> +
> +test_run:cmd('create server replica5 with rpl_master=default,\
> +              script="replication/replica-quorum-5.lua"')
> +test_run:cmd('start server replica5 with wait=True, wait_load=True')
> +
> +test_run:cmd('create server replica6 with rpl_master=default,\
> +              script="replication/replica-quorum-6.lua"')
> +test_run:cmd('start server replica6 with wait=True, wait_load=True')
> +
> +-- 6 replicas -> replication_synchro_quorum = 7/2 + 1 = 4
> +match = 'update replication_synchro_quorum = 4'
> +test_run:grep_log("default", match) ~= nil
> +
> +-- 5 replicas left, the commit should pass
> +test_run:cmd('stop server replica1')
> +test_run:cmd('delete server replica1')
> +s:insert{2, 2}
> +
> +-- 4 replicas left,the commit should pass
> +test_run:cmd('stop server replica2')
> +test_run:cmd('delete server replica2')
> +s:insert{3, 3}
> +
> +-- 3 replicas left, the commit should pass
> +test_run:cmd('stop server replica3')
> +test_run:cmd('delete server replica3')
> +s:insert{4, 4}
> +
> +-- 2 replicas left, the commit should NOT pass
> +--
> +-- The replication_synchro_timeout set to a small value to not wait
> +-- for very long for the case where we know the commit should
> +-- not pass since replicas are stopped.
> +box.cfg { replication_synchro_timeout = 0.5 }
> +test_run:cmd('stop server replica4')
> +s:insert{5, 5}
> +-- restore it back and retry
> +test_run:cmd('start server replica4 with wait=True, wait_load=True')
> +box.cfg { replication_synchro_timeout = 1000 }
> +s:insert{5, 5}
> +test_run:cmd('stop server replica4')
> +test_run:cmd('delete server replica4')
> +
> +-- cleanup leftovers
> +
> +test_run:cmd('stop server replica5')
> +test_run:cmd('delete server replica5')
> +
> +test_run:cmd('stop server replica6')
> +test_run:cmd('delete server replica6')
> +
> +box.schema.user.revoke('guest', 'replication')
> diff --git a/test/replication/replica-quorum-1.lua b/test/replication/replica-quorum-1.lua
> new file mode 120000
> index 000000000..da69ac81c
> --- /dev/null
> +++ b/test/replication/replica-quorum-1.lua
> @@ -0,0 +1 @@
> +replica.lua
> \ No newline at end of file
> diff --git a/test/replication/replica-quorum-2.lua b/test/replication/replica-quorum-2.lua
> new file mode 120000
> index 000000000..da69ac81c
> --- /dev/null
> +++ b/test/replication/replica-quorum-2.lua
> @@ -0,0 +1 @@
> +replica.lua
> \ No newline at end of file
> diff --git a/test/replication/replica-quorum-3.lua b/test/replication/replica-quorum-3.lua
> new file mode 120000
> index 000000000..da69ac81c
> --- /dev/null
> +++ b/test/replication/replica-quorum-3.lua
> @@ -0,0 +1 @@
> +replica.lua
> \ No newline at end of file
> diff --git a/test/replication/replica-quorum-4.lua b/test/replication/replica-quorum-4.lua
> new file mode 120000
> index 000000000..da69ac81c
> --- /dev/null
> +++ b/test/replication/replica-quorum-4.lua
> @@ -0,0 +1 @@
> +replica.lua
> \ No newline at end of file
> diff --git a/test/replication/replica-quorum-5.lua b/test/replication/replica-quorum-5.lua
> new file mode 120000
> index 000000000..da69ac81c
> --- /dev/null
> +++ b/test/replication/replica-quorum-5.lua
> @@ -0,0 +1 @@
> +replica.lua
> \ No newline at end of file
> diff --git a/test/replication/replica-quorum-6.lua b/test/replication/replica-quorum-6.lua
> new file mode 120000
> index 000000000..da69ac81c
> --- /dev/null
> +++ b/test/replication/replica-quorum-6.lua
> @@ -0,0 +1 @@
> +replica.lua
> \ No newline at end of file

-- 
Serge Petrenko

  reply	other threads:[~2020-12-16 13:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 11:39 [Tarantool-patches] [PATCH v4 0/3] qsync: evaluate replication_synchro_quorum dynamically Cyrill Gorcunov
2020-12-14 11:39 ` [Tarantool-patches] [PATCH v4 1/3] cfg: add cfg_isnumber helper Cyrill Gorcunov
2020-12-14 11:39 ` [Tarantool-patches] [PATCH v4 2/3] cfg: support symbolic evaluation of replication_synchro_quorum Cyrill Gorcunov
2020-12-16 13:21   ` Serge Petrenko
2020-12-16 13:35     ` Cyrill Gorcunov
2020-12-17 23:17   ` Vladislav Shpilevoy
2020-12-18  7:25     ` Cyrill Gorcunov
2020-12-20 17:01       ` Vladislav Shpilevoy
2020-12-20 18:28         ` Cyrill Gorcunov
2020-12-21 17:48   ` Vladislav Shpilevoy
2020-12-21 17:49     ` Vladislav Shpilevoy
2020-12-21 20:02     ` Cyrill Gorcunov
2020-12-21 20:12       ` Cyrill Gorcunov
2020-12-14 11:39 ` [Tarantool-patches] [PATCH v4 3/3] test: add replication/gh-5446-qsync-eval-quorum.test.lua Cyrill Gorcunov
2020-12-16 13:25   ` Serge Petrenko [this message]
2020-12-17 23:18   ` Vladislav Shpilevoy
2020-12-18  8:14     ` Cyrill Gorcunov
2020-12-20 17:01       ` Vladislav Shpilevoy
2020-12-20 18:27         ` Cyrill Gorcunov
2020-12-21 16:05         ` Cyrill Gorcunov

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=cdffbd9f-da2a-5b02-b185-f88e755ccc8c@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.perepelitsa@corp.mail.ru \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v4 3/3] test: add replication/gh-5446-qsync-eval-quorum.test.lua' \
    /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