* [Tarantool-patches] [PATCH v2] replication: removing anonymous replicas from synchro quorum
@ 2021-10-06 8:44 Yan Shtunder via Tarantool-patches
0 siblings, 0 replies; only message in thread
From: Yan Shtunder via Tarantool-patches @ 2021-10-06 8:44 UTC (permalink / raw)
To: tarantool-patches; +Cc: Yan Shtunder
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-06 8:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06 8:44 [Tarantool-patches] [PATCH v2] replication: removing anonymous replicas from synchro quorum Yan Shtunder via Tarantool-patches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox