From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 88CE47118D; Mon, 25 Oct 2021 16:32:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 88CE47118D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1635168723; bh=n9p4/0+BwiISgdQtSHGE1wLlOPWMUx1tBptmTGIOJks=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=sPXt1YDcPObWTiM7rkcHeKmX7G1Mbh3rhOklBgyiHDh/yVrhobyfGFFqfbh+QPyCo 6ov0a9qHHmR/3TYGmngwC58lqK6Qc+mhiD6HTMCGo4pYL7WBvwCTwzTlq4Z3zoJp+d riGL9rzcjiM7fQczBntey55dVIxdT+kh2xuKWw38= Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 2B8B57118D for ; Mon, 25 Oct 2021 16:32:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2B8B57118D Received: by smtp34.i.mail.ru with esmtpa (envelope-from ) id 1mf053-00007y-KD; Mon, 25 Oct 2021 16:32:02 +0300 To: Yan Shtunder , tarantool-patches@dev.tarantool.org References: <20211025095223.22521-1-ya.shtunder@gmail.com> Message-ID: <665ef444-80de-4848-f9f0-a3ccc6e7c059@tarantool.org> Date: Mon, 25 Oct 2021 16:32:01 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211025095223.22521-1-ya.shtunder@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D1D35DBD2D15487E4274513AD34F4DF9D3103CEBF61746E9182A05F5380850405D787EDDC327865FB1C04837182B948A20C0338EA4545268D1E390BCAEE2BAB0 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70C5E0F71D77D667BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637CD1DFD3ABA64F6568638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D82A68B8CD67A573D6443817551484E15F117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18CB629EEF1311BF91D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6D0C9BB9AE6BD5D69089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A5EF40F9440C74AD99A2C7A08C966B1E7246878DD544DB2486D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75FA7FF33AA1A4D21C410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D344888A9AABCDD32255CF920E936AD250D47A10155B83AFA8A7559A2613B000686F0F521530B79C20B1D7E09C32AA3244CA826D8A9181B644F371234EB4D213E4B725D5B54B2FE4575729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojPL6H901iH3EFQt6HodC6aw== X-Mailru-Sender: 3B9A0136629DC9125D61937A2360A446573C2785DA8D2502DBA797E64B3856AE065D0E68F1A78D77424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v3] replication: removing anonymous replicas from synchro quorum X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 25.10.2021 12:52, Yan Shtunder via Tarantool-patches пишет: Hi! Good job on porting the test to the current luatest version! Please, find a couple of comments below. > Transactions have to committed after they reaches quorum of "real" Nit: better say "Transactions should be committed". reaches -> reach. > 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 > > src/box/relay.cc | 3 +- > test/replication-luatest/gh_5418_test.lua | 82 +++++++++++++++++++++++ > 2 files changed, 84 insertions(+), 1 deletion(-) > create mode 100644 test/replication-luatest/gh_5418_test.lua > > diff --git a/src/box/relay.cc b/src/box/relay.cc > index f5852df7b..cf569e8e2 100644 > --- a/src/box/relay.cc > +++ b/src/box/relay.cc > @@ -543,6 +543,7 @@ tx_status_update(struct cmsg *msg) > struct replication_ack ack; > ack.source = status->relay->replica->id; > ack.vclock = &status->vclock; > + bool anon = status->relay->replica->anon; > /* > * Let pending synchronous transactions know, which of > * them were successfully sent to the replica. Acks are > @@ -550,7 +551,7 @@ tx_status_update(struct cmsg *msg) > * the single master in 100% so far). Other instances wait > * for master's CONFIRM message instead. > */ > - if (txn_limbo.owner_id == instance_id) { > + if (txn_limbo.owner_id == instance_id && !anon) { > txn_limbo_ack(&txn_limbo, ack.source, > vclock_get(ack.vclock, instance_id)); > } I can't build your patch to test it manually, compilation fails with some ERRINJ-related errors. Seems like the commit "replication: fill replicaset.applier.vclock after local recovery" you have on the branch is extraneous. And it causes the error. Please remove it. > diff --git a/test/replication-luatest/gh_5418_test.lua b/test/replication-luatest/gh_5418_test.lua > new file mode 100644 > index 000000000..265d28ccb > --- /dev/null > +++ b/test/replication-luatest/gh_5418_test.lua Please, find a more informative test name. For example, "gh_5418_qsync_with_anon_test.lua* > @@ -0,0 +1,82 @@ > +local fio = require('fio') > +local log = require('log') > +local fiber = require('fiber') > +local t = require('luatest') > +local cluster = require('test.luatest_helpers.cluster') > +local helpers = require('test.luatest_helpers.helpers') > + > +local g = t.group('gh-5418') > + > +g.before_test('test_qsync_with_anon', function() > + g.cluster = cluster:new({}) > + > + local box_cfg = { > + replication = {helpers.instance_uri('master')}, > + replication_synchro_quorum = 2, > + replication_timeout = 0.1 > + } > + > + g.master = g.cluster:build_server({alias = 'master'}, engine, box_cfg) > + > + local box_cfg = { > + replication = { > + helpers.instance_uri('master'), > + helpers.instance_uri('replica') > + }, > + replication_timeout = 0.1, > + replication_connect_timeout = 0.5, > + read_only = true, > + replication_anon = true > + } > + > + g.replica = g.cluster:build_server({alias = 'replica'}, engine, box_cfg) > + > + g.cluster:join_server(g.master) > + g.cluster:join_server(g.replica) > + g.cluster:start() > + log.info('Everything is started') > +end) > + > +g.after_test('test_qsync_with_anon', function() > + g.cluster:stop() > + fio.rmtree(g.master.workdir) > + fio.rmtree(g.replica.workdir) > +end) > + > +local function wait_vclock(timeout) > + local started_at = fiber.clock() > + local lsn = g.master:eval("return box.info.vclock[1]") > + > + local _, tbl = g.master:eval("return next(box.info.replication_anon())") > + local to_lsn = tbl.downstream.vclock[1] > + > + while to_lsn == nil or to_lsn < lsn do > + fiber.sleep(0.001) > + > + if (fiber.clock() - started_at) > timeout then > + return false > + end > + > + _, tbl = g.master:eval("return next(box.info.replication_anon())") > + to_lsn = tbl.downstream.vclock[1] > + > + log.info(string.format("master lsn: %d; replica_anon lsn: %d", > + lsn, to_lsn)) > + end > + > + return true > +end > + > +g.test_qsync_with_anon = function() > + g.master:eval("box.schema.space.create('sync', {is_sync = true})") > + g.master:eval("box.space.sync:create_index('pk')") > + > + t.assert_error_msg_content_equals("Quorum collection for a synchronous transaction is timed out", > + function() g.master:eval("return box.space.sync:insert{1}") end) > + > + -- Wait until everything is replicated from the master to the replica > + t.assert(wait_vclock(1)) Please, use `t.helpers.retrying()` here. It receives a timeout and a function to call. Like `t.helpter.retrying({timeout=5}, wait_vclock)` And wait_vclock should simply return true or false based on whether the replica has reached master's vclock. Also, please choose a bigger timeout. Like 5 or 10 seconds. Otherwise the test will be flaky on slow testing machines in our CI. > + > + t.assert_equals(g.master:eval("return box.space.sync:select()"), {}) > + t.assert_equals(g.replica:eval("return box.space.sync:select()"), {}) > +end > -- > 2.25.1 > -- Serge Petrenko