Tarantool development patches archive
 help / color / mirror / Atom feed
From: Yan Shtunder via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org
Cc: Yan Shtunder <ya.shtunder@gmail.com>
Subject: [Tarantool-patches] [PATCH v2] replication: removing anonymous replicas from synchro quorum
Date: Wed,  6 Oct 2021 11:44:16 +0300	[thread overview]
Message-ID: <20211006084416.8445-1-ya.shtunder@gmail.com> (raw)

Transactions have to committed after they reaches quorum of "real"
cluster members. Therefore, anonymous replicas don't have to
participate in the quorum.

Closes #5418
---
Issue: https://github.com/tarantool/tarantool/issues/5418
Patch: https://github.com/tarantool/tarantool/tree/yshtunder/gh-5418-qsync-with-anon-replicas

 test/replication-luatest/gh_5418_test.lua     |   6 +-
 .../{master.lua => master_quorum.lua}         |   0
 .../{replica.lua => replica_anon.lua}         |   0
 test/replication/qsync_with_anon.result       | 130 ------------------
 test/replication/qsync_with_anon.test.lua     |  55 --------
 5 files changed, 2 insertions(+), 189 deletions(-)
 rename test/replication-luatest/instance_files/{master.lua => master_quorum.lua} (100%)
 rename test/replication-luatest/instance_files/{replica.lua => replica_anon.lua} (100%)
 delete mode 100644 test/replication/qsync_with_anon.result
 delete mode 100644 test/replication/qsync_with_anon.test.lua

diff --git a/test/replication-luatest/gh_5418_test.lua b/test/replication-luatest/gh_5418_test.lua
index 858fe342f..36c83fe68 100644
--- a/test/replication-luatest/gh_5418_test.lua
+++ b/test/replication-luatest/gh_5418_test.lua
@@ -10,18 +10,16 @@ local Server = t.Server
 g.before_all(function()
     g.master = Server:new({
         alias = 'master',
-        command = './test/replication-luatest/instance_files/master.lua',
+        command = './test/replication-luatest/instance_files/master_quorum.lua',
         workdir = fio.tempdir(),
-        http_port = 8081,
         net_box_port = 13301,
     })

     g.replica = Server:new({
         alias = 'replica',
-        command = './test/replication-luatest/instance_files/replica.lua',
+        command = './test/replication-luatest/instance_files/replica_anon.lua',
         workdir = fio.tempdir(),
         env = {TARANTOOL_MASTER = '13301'},
-        http_port = 8082,
         net_box_port = 13302,
     })

diff --git a/test/replication-luatest/instance_files/master.lua b/test/replication-luatest/instance_files/master_quorum.lua
similarity index 100%
rename from test/replication-luatest/instance_files/master.lua
rename to test/replication-luatest/instance_files/master_quorum.lua
diff --git a/test/replication-luatest/instance_files/replica.lua b/test/replication-luatest/instance_files/replica_anon.lua
similarity index 100%
rename from test/replication-luatest/instance_files/replica.lua
rename to test/replication-luatest/instance_files/replica_anon.lua
diff --git a/test/replication/qsync_with_anon.result b/test/replication/qsync_with_anon.result
deleted file mode 100644
index 0522a09f8..000000000
--- a/test/replication/qsync_with_anon.result
+++ /dev/null
@@ -1,130 +0,0 @@
--- test-run result file version 2
-test_run = require('test_run').new()
- | ---
- | ...
-
-NUM_INSTANCES = 2
- | ---
- | ...
-
-box.schema.user.grant('guest', 'replication')
- | ---
- | ...
-box.cfg{replication_synchro_quorum=NUM_INSTANCES}
- | ---
- | ...
-_ = box.schema.space.create('sync', {is_sync=true})
- | ---
- | ...
-_ = box.space.sync:create_index('pk')
- | ---
- | ...
-box.ctl.promote()
- | ---
- | ...
--- Testcase body.
-test_run:switch('default')
- | ---
- | - true
- | ...
-box.space.sync:insert{1} -- success
- | ---
- | - [1]
- | ...
-box.space.sync:insert{2} -- success
- | ---
- | - [2]
- | ...
-box.space.sync:insert{3} -- success
- | ---
- | - [3]
- | ...
-test_run:cmd('switch replica_anon')
- | ---
- | - true
- | ...
-box.space.sync:select{} -- 1, 2, 3
- | ---
- | - - [1]
- |   - [2]
- |   - [3]
- | ...
--- Testcase cleanup.
-test_run:switch('default')
- | ---
- | - true
- | ...
-box.space.sync:drop()
- | ---
- | ...
-
-
--- Setup a cluster with anonymous replica
-test_run:cmd('create server replica_anon with rpl_master=default,\
-              script="replication/anon1.lua"')
- | ---
- | - true
- | ...
-test_run:cmd('start server replica_anon')
- | ---
- | - true
- | ...
-
-
--- Testcase
-box.space.sync:insert{1}    -- error
- | ---
- | - error: Quorum collection for a synchronous transaction is timed out
- | ...
-box.space.sync:insert{3}    -- error
- | ---
- | - error: Quorum collection for a synchronous transaction is timed out
- | ...
-test_run:cmd('switch replica_anon')
- | ---
- | - true
- | ...
-box.space.sync:select{}     -- []
- | ---
- | - []
- | ...
-
--- Testcase cleanup
-test_run:switch('default')
- | ---
- | - true
- | ...
-box.space.sync:drop()
- | ---
- | ...
-
-
--- Teardown
-test_run:cmd('stop server replica_anon')
- | ---
- | - true
- | ...
-test_run:cmd('cleanup server replica_anon')
- | ---
- | - true
- | ...
-test_run:cmd('delete server replica_anon')
- | ---
- | - true
- | ...
-
-box.schema.user.revoke('guest', 'replication')
- | ---
- | ...
-box.cfg{                                                                        \
-    replication_synchro_quorum = orig_synchro_quorum,                           \
-    replication_synchro_timeout = orig_synchro_timeout,                         \
-}
- | ---
- | ...
-box.ctl.demote()
- | ---
- | ...
-test_run:cleanup_cluster()
- | ---
- | ...
diff --git a/test/replication/qsync_with_anon.test.lua b/test/replication/qsync_with_anon.test.lua
deleted file mode 100644
index 05a56c8ef..000000000
--- a/test/replication/qsync_with_anon.test.lua
+++ /dev/null
@@ -1,55 +0,0 @@
-test_run = require('test_run').new()
-
-NUM_INSTANCES = 2
-
-box.schema.user.grant('guest', 'replication')
-box.cfg{replication_synchro_quorum=NUM_INSTANCES}
-_ = box.schema.space.create('sync', {is_sync=true})
-_ = box.space.sync:create_index('pk')
-<<<<<<< HEAD
-=======
-box.ctl.promote()
--- Testcase body.
-test_run:switch('default')
-box.space.sync:insert{1} -- success
-box.space.sync:insert{2} -- success
-box.space.sync:insert{3} -- success
-test_run:cmd('switch replica_anon')
-box.space.sync:select{} -- 1, 2, 3
--- Testcase cleanup.
-test_run:switch('default')
-box.space.sync:drop()
->>>>>>> box: introduce `box.ctl.demote`
-
-
--- Setup a cluster with anonymous replica
-test_run:cmd('create server replica_anon with rpl_master=default,\
-              script="replication/anon1.lua"')
-test_run:cmd('start server replica_anon')
-
-
--- Testcase
-box.space.sync:insert{1}    -- error
-box.space.sync:insert{3}    -- error
-test_run:cmd('switch replica_anon')
-box.space.sync:select{}     -- []
-
--- Testcase cleanup
-test_run:switch('default')
-box.space.sync:drop()
-
-
--- Teardown
-test_run:cmd('stop server replica_anon')
-test_run:cmd('cleanup server replica_anon')
-test_run:cmd('delete server replica_anon')
-<<<<<<< HEAD
-=======
-box.schema.user.revoke('guest', 'replication')
-box.cfg{                                                                        \
-    replication_synchro_quorum = orig_synchro_quorum,                           \
-    replication_synchro_timeout = orig_synchro_timeout,                         \
-}
-box.ctl.demote()
-test_run:cleanup_cluster()
->>>>>>> box: introduce `box.ctl.demote`
--
2.25.1


                 reply	other threads:[~2021-10-06  8:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211006084416.8445-1-ya.shtunder@gmail.com \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=ya.shtunder@gmail.com \
    --subject='Re: [Tarantool-patches] [PATCH v2] replication: removing anonymous replicas from synchro 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