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 042396EC40; Sun, 26 Sep 2021 17:30:42 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 042396EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1632666642; bh=rvMB4bW9Bjmz240wI6vrB8geLmVa0t913/4HcyK/O6w=; 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=KzCEdbW6A9oPWIo88dpJ7oFnUSnLrEAizVhMj1zQuqIWnx0cebXSUXpxfAzepMfzt K2qK9RgFX7vGWi26vlJutpFDyZN/ppRu2HeEzZIDEpotCDt4ks+vg/vRWk7NTEwH/a SAv76cuMWlkVFAGti06n+kpyRaIpI02x/xD72pMs= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (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 665B66EC40 for ; Sun, 26 Sep 2021 17:30:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 665B66EC40 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mUVAt-0004Pq-OE; Sun, 26 Sep 2021 17:30:40 +0300 To: Cyrill Gorcunov , tml References: <20210922130535.79479-1-gorcunov@gmail.com> <20210922130535.79479-6-gorcunov@gmail.com> Message-ID: <75b1d7bf-a057-d318-945b-86668715ae51@tarantool.org> Date: Sun, 26 Sep 2021 16:30:38 +0200 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: <20210922130535.79479-6-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD96A58C36AA2E99649E150573C3DCDB299E3703FF91371DAED182A05F538085040E2CF7ADC19BE7D10399418720E3E53364E9F4E0609CBD0894E8021A5D7A495D3 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BD76697DAE49F8B0EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063725FA9CD6081C82518638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8D7C29146B3DEB8CA3B8C44C82D46A8A1117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAA867293B0326636D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8BF1175FABE1C0F9B6A471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C565C1E6824D8037B43847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A5E268BE36BDFB8E25F9FAF552EB9CD8F7AFEAF1B3ED80730CD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75BFC02AB3DF06BA5A410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3480A9008907CB2FD0C666D901D02896C433A4A7DE3DE2CAC465705487196ED9721E119498D4AA4DDE1D7E09C32AA3244C18DFED91C800DF5114854FFA6C675541F522A1CF68F4BE05729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojP2ll4YlUPyZ5ARkbP3qIKA== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DD04B41F596603DE52E3413D49907CC5E3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v17 5/5] test: add gh-6036-term-order test 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the patch! See 6 comments below. > diff --git a/test/replication/gh-6036-order-node.lua b/test/replication/gh-6036-order-node.lua > new file mode 100644 > index 000000000..b22a7cb4c > --- /dev/null > +++ b/test/replication/gh-6036-order-node.lua > @@ -0,0 +1,60 @@ > +local INSTANCE_ID = string.match(arg[0], "gh%-6036%-order%-(.+)%.lua") > + > +local function unix_socket(name) > + return "unix/:./" .. name .. '.sock'; > +end > + > +require('console').listen(os.getenv('ADMIN')) > + > +if INSTANCE_ID == "master" then > + box.cfg({ > + listen = unix_socket(INSTANCE_ID), > + replication = { > + unix_socket(INSTANCE_ID), > + unix_socket("replica1"), > + unix_socket("replica2"), > + }, > + replication_connect_quorum = 1, > + replication_synchro_quorum = 1, > + replication_synchro_timeout = 10000, > + replication_sync_timeout = 5, 1. Why do you need sync_timeout 5? > + read_only = false, > + election_mode = "off", > + }) > +elseif INSTANCE_ID == "replica1" then > + box.cfg({ > + listen = unix_socket(INSTANCE_ID), > + replication = { > + unix_socket("master"), > + unix_socket(INSTANCE_ID), > + unix_socket("replica2"), > + }, > + replication_connect_quorum = 1, > + replication_synchro_quorum = 1, > + replication_synchro_timeout = 10000, > + replication_sync_timeout = 5, > + read_only = false, > + election_mode = "off", > + }) > +else > + assert(INSTANCE_ID == "replica2") > + box.cfg({ > + listen = unix_socket(INSTANCE_ID), > + replication = { > + unix_socket("master"), > + unix_socket("replica1"), > + unix_socket(INSTANCE_ID), > + }, > + replication_connect_quorum = 1, > + replication_synchro_quorum = 1, > + replication_synchro_timeout = 10000, > + replication_sync_timeout = 5, > + read_only = true, > + election_mode = "off", > + }) > +end > + > +--box.ctl.wait_rw() 2. Please, remove commented out code. > +box.once("bootstrap", function() > + box.schema.user.grant('guest', 'super') > +end) > diff --git a/test/replication/gh-6036-term-order.result b/test/replication/gh-6036-term-order.result > new file mode 100644 > index 000000000..6b19fc2c8 > --- /dev/null > +++ b/test/replication/gh-6036-term-order.result 3. Please, use prefix gh-####-qsync to be consistent with other qsync tests. Having 'qsync' in the test name helps to run all qsync tests in a single command python test-run.py qsync > @@ -0,0 +1,216 @@ > +-- test-run result file version 2 > +-- > +-- gh-6036: verify that terms are locked when we're inside journal > +-- write routine, because parallel appliers may ignore the fact that > +-- the term is updated already but not yet written leading to data > +-- inconsistency. > +-- > +test_run = require('test_run').new() > + | --- > + | ... > + > +test_run:cmd('create server master with script="replication/gh-6036-order-master.lua"') > + | --- > + | - true > + | ... > +test_run:cmd('create server replica1 with script="replication/gh-6036-order-replica1.lua"') > + | --- > + | - true > + | ... > +test_run:cmd('create server replica2 with script="replication/gh-6036-order-replica2.lua"') > + | --- > + | - true > + | ... > + > +test_run:cmd('start server master with wait=False') > + | --- > + | - true > + | ... > +test_run:cmd('start server replica1 with wait=False') > + | --- > + | - true > + | ... > +test_run:cmd('start server replica2 with wait=False') > + | --- > + | - true > + | ... > + > +test_run:wait_fullmesh({"master", "replica1", "replica2"}) > + | --- > + | ... > + > +test_run:switch("master") > + | --- > + | - true > + | ... > +box.ctl.demote() > + | --- > + | ... > + > +test_run:switch("replica1") > + | --- > + | - true > + | ... > +box.ctl.demote() > + | --- > + | ... > + > +test_run:switch("replica2") > + | --- > + | - true > + | ... > +box.ctl.demote() 4. I dropped all 3 demotes and the test passed. Why do you need them? > + | --- > + | ... > + > +-- > +-- Drop connection between master and replica1. > +test_run:switch("master") > + | --- > + | - true > + | ... > +box.cfg({ \ > + replication = { \ > + "unix/:./master.sock", \ > + "unix/:./replica2.sock", \ > + }, \ > +}) > + | --- > + | ... > +test_run:switch("replica1") > + | --- > + | - true > + | ... > +box.cfg({ \ > + replication = { \ > + "unix/:./replica1.sock", \ > + "unix/:./replica2.sock", \ > + }, \ > +}) > + | --- > + | ... > + > +-- > +-- Initiate disk delay and remember the max term seen so far. > +test_run:switch("replica2") > + | --- > + | - true > + | ... > +box.error.injection.set('ERRINJ_WAL_DELAY', true) > + | --- > + | - ok > + | ... > +term_max_replica2 = box.info.synchro.promote.term_max > + | --- > + | ... > + > +-- > +-- Ping-pong the promote action between master and > +-- replica1 nodes, the term updates get queued on > +-- replica2 because of disk being disabled. > +test_run:switch("master") > + | --- > + | - true > + | ... > +box.ctl.promote() > + | --- > + | ... > +box.ctl.demote() > + | --- > + | ... > + > +test_run:switch("replica1") > + | --- > + | - true > + | ... > +box.ctl.promote() > + | --- > + | ... > +box.ctl.demote() > + | --- > + | ... > + > +test_run:switch("master") > + | --- > + | - true > + | ... > +box.ctl.promote() > + | --- > + | ... > + > +-- > +-- Since we're guarding max promote term make sure that > +-- 1) The max term has not yet been updated because WAL > +-- is in sleeping state. > +-- 2) Max term on master and replica1 nodes are greater > +-- than we have now because terms update is locked. > +-- 3) Once WAL is unlocked we make sure that terms has > +-- reached us. > +test_run:switch("replica2") > + | --- > + | - true > + | ... > +assert(term_max_replica2 == box.info.synchro.promote.term_max) > + | --- > + | - true > + | ... > + > +term_max_master = test_run:eval('master', 'box.info.synchro.promote.term_max')[1] > + | --- > + | ... > +term_max_replica1 = test_run:eval('replica1', 'box.info.synchro.promote.term_max')[1] > + | --- > + | ... > +assert(term_max_master > term_max_replica2) > + | --- > + | - true > + | ... > +assert(term_max_replica1 > term_max_replica2) > + | --- > + | - true > + | ... > +term_max_wait4 = term_max_master > + | --- > + | ... > +if term_max_wait4 < term_max_replica1 then term_max_wait4 = term_max_replica1 end 5. How is it possible? The master did more promotes, it should have a bigger term for sure. > + | --- > + | ... > + > +box.error.injection.set('ERRINJ_WAL_DELAY', false) > + | --- > + | - ok > + | ... > +test_run:wait_cond(function() return box.info.synchro.promote.term_max == term_max_wait4 end) > + | --- > + | - true > + | ... > + > +test_run:switch("default") > + | --- > + | - true > + | ... > +test_run:cmd('stop server master') > + | --- > + | - true > + | ... > +test_run:cmd('stop server replica1') > + | --- > + | - true > + | ... > +test_run:cmd('stop server replica2') > + | --- > + | - true > + | ... > + > +test_run:cmd('delete server master') > + | --- > + | - true > + | ... > +test_run:cmd('delete server replica1') > + | --- > + | - true > + | ... > +test_run:cmd('delete server replica2') 6. Can you add some data to the test? Which before the patches was applied, and now is rejected/nopified. Otherwise you added a lock, tested the lock, but if I move the data filtering before the lock, your test still will pass.