[Tarantool-patches] [PATCH v3] replication: removing anonymous replicas from synchro quorum
sergos
sergos at tarantool.org
Thu Nov 11 18:04:50 MSK 2021
Hi!
Thanks for the patch!
Just a nit in message and a question re the test below.
Sergos.
The changelog is from https://github.com/tarantool/tarantool/commit/b9feb3853fbce389471ad3022307942aa92e8ea7
> Transactions should be committed after they reach quorum of "real"
> cluster members. Therefore, anonymous replicas don't have to
I would rephrase it as ‘replicas shouldn’t participate’
> participate in the quorum.
>
>> +++ b/test/replication-luatest/gh_5418_qsync_with_anon_test.lua
>> @@ -0,0 +1,62 @@
>> +local t = require('luatest')
>> +local cluster = require('test.luatest_helpers.cluster')
>> +local helpers = require('test.luatest_helpers')
>> +
>> +local g = t.group('gh-5418', {{engine = 'memtx'}, {engine = 'vinyl'}})
>> +
>> +g.before_each(function(cg)
>> + local engine = cg.params.engine
>> +
>> + cg.cluster = cluster:new({})
>> +
>> + local box_cfg = {
>> + replication = {
>> + helpers.instance_uri('master')
>> + },
>> + replication_synchro_quorum = 2,
>> + replication_timeout = 1
>> + }
>> +
>> + cg.master = cg.cluster:build_server({alias = 'master', engine = engine, box_cfg = box_cfg})
>> +
>> + local box_cfg = {
>> + replication = {
>> + helpers.instance_uri('master'),
>> + helpers.instance_uri('replica')
>> + },
>> + replication_timeout = 1,
>> + replication_connect_timeout = 4,
>> + read_only = true,
>> + replication_anon = true
>> + }
>> +
>> + cg.replica = cg.cluster:build_server({alias = 'replica', engine = engine, box_cfg = box_cfg})
>> +
>> + cg.cluster:add_server(cg.master)
>> + cg.cluster:add_server(cg.replica)
>> + cg.cluster:start()
>> +end)
>> +
>> +
>> +g.after_each(function(cg)
>> + cg.cluster.servers = nil
>> + cg.cluster:drop()
>> +end)
>> +
>> +
>> +g.test_qsync_with_anon = function(cg)
>> + cg.master:eval("box.schema.space.create('sync', {is_sync = true})")
>> + cg.master:eval("box.space.sync:create_index('pk')")
>> + cg.master:eval("box.ctl.promote()")
>> +
>> + t.assert_error_msg_content_equals("Quorum collection for a synchronous transaction is timed out",
>> + function() cg.master:eval("return box.space.sync:insert{1}") end)
>> +
>> + -- Wait until everything is replicated from the master to the replica
>> + local vclock = cg.master:eval("return box.info.vclock")
>> + vclock[0] = nil
>> + helpers:wait_vclock(cg.replica, vclock)
>> +
By this point the insert() is replicated from the master. I wonder if ROLLBACK
will be delivered to the replica by the time of select()?
>> + t.assert_equals(cg.master:eval("return box.space.sync:select()"), {})
>> + t.assert_equals(cg.replica:eval("return box.space.sync:select()"), {})
>> +end
More information about the Tarantool-patches
mailing list