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 EEC936FC8F; Sun, 12 Sep 2021 18:46:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EEC936FC8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1631461585; bh=IDGnnMCaTqpQDyggUfvhC5FClwo2b83E29SJIbKbXIY=; 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=FIRaN6FWTKOfxvwHc6+A/eyk6ZDOneuj9P+G/DpyRbBMqkLesDQ09Loe3I2P8cGFR 1C+UpRyUWT0gsvi8kDQ+8QmZHuQhFaXzIOxGb7qrtIwDOe1HKKW+t0jBp/FlQLSYQF 8pngw0eUHzj2kdjIg6EDPD07KzQUsvezexW9qoKo= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (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 23259718A3 for ; Sun, 12 Sep 2021 18:44:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 23259718A3 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1mPReU-0005NN-Gp; Sun, 12 Sep 2021 18:44:18 +0300 To: Cyrill Gorcunov , tml References: <20210910152910.607398-1-gorcunov@gmail.com> <20210910152910.607398-7-gorcunov@gmail.com> Message-ID: <2341bf9e-e46a-2d87-9d74-5a6fefe2787f@tarantool.org> Date: Sun, 12 Sep 2021 17:44:17 +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: <20210910152910.607398-7-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD91AE02D33A9C88A2F5B11AABA1A86F90E3128B236C8D9319300894C459B0CD1B909640B7CA52B586C0DBAD1CCDCB4DB6A06C63B2D39B5180C32F1CFC60563ED00 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F16C4DE526EFCC04EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F78F3D6E0D6791938638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8D59DE8CA39AF40FB0E948E20A16E03B5117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18CB629EEF1311BF91D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6A1DCCEB63E2F10FB089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A575AE1547A7C405032E96F5C1C287C18BF560249100E001A0D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA756665624D6DDF07B5410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A150564C13026C18CB2097F7773F6E95C6B8011C02611CA0CD57D9083C76997FB18E3E663D38A3261D7E09C32AA3244C9E3C936C46ED017295EEA310AC4806FC8894E9C85370243EFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojuaewUBhMl4xc+ss/cbddUw== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D3764432DA9F0626A7BA3E9DD0171B5893841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v14 6/6] test: add replication/gh-6036-rollback-confirm 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 3 comments below. > diff --git a/test/replication/gh-6036-rollback-confirm.result b/test/replication/gh-6036-rollback-confirm.result > new file mode 100644 > index 000000000..e85f6af37 > --- /dev/null > +++ b/test/replication/gh-6036-rollback-confirm.result <...> > +-- Connect master to the replica and write a record. Since the quorum > +-- value is bigger than number of nodes in a cluster it will be rolled > +-- back later. > +test_run:switch('master') > + | --- > + | - true > + | ... > +box.cfg({ \ > + replication = { \ > + "unix/:./master.sock", \ > + "unix/:./replica.sock", \ > + }, \ > +}) > + | --- > + | ... > +_ = box.schema.create_space('sync', {is_sync = true}) > + | --- > + | ... > +_ = box.space.sync:create_index('pk') > + | --- > + | ... > + > +-- > +-- Wait the record to appear on the master. > +f = require('fiber').create(function() box.space.sync:replace{1} end) > + | --- > + | ... > +test_run:wait_cond(function() return box.space.sync:get({1}) ~= nil end, 100) 1. Why do you need a custom wait_cond timeout? > + | --- > + | - true > + | ... > +box.space.sync:select{} > + | --- > + | - - [1] > + | ... > + > +-- > +-- Wait the record from master get written and then > +-- drop the replication. > +test_run:switch('replica') > + | --- > + | - true > + | ... > +test_run:wait_cond(function() return box.space.sync:get({1}) ~= nil end, 100) > + | --- > + | - true > + | ... > +box.space.sync:select{} 2. You don't need the waiting on the master if you wait for the same on the replica. It couldn't get there before master itself. > + | --- > + | - - [1] > + | ... > +box.cfg{replication = {}} > + | --- > + | ... > + > +-- > +-- Then we jump back to the master and drop the replication, > +-- thus unconfirmed record get rolled back. > +test_run:switch('master') > + | --- > + | - true > + | ... > +box.cfg({ \ > + replication = {}, \ > + replication_synchro_timeout = 0.001, \ > + election_mode = 'manual', \ > +}) > + | --- > + | ... > +while f:status() ~= 'dead' do require('fiber').sleep(0.1) end > + | --- > + | ... > +test_run:wait_cond(function() return box.space.sync:get({1}) == nil end, 100) > + | --- > + | - true > + | ... > + > +-- > +-- Force the replica to become a RAFT leader and > +-- commit this new record. > +test_run:switch('replica') > + | --- > + | - true > + | ... > +box.cfg({ \ > + replication_synchro_quorum = 1, \ > + election_mode = 'manual' \ > +}) > + | --- > + | ... > +box.ctl.promote() > + | --- > + | ... > +box.space.sync:select{} > + | --- > + | - - [1] > + | ... > + > +-- > +-- Connect master back to the replica, it should > +-- be refused. > +test_run:switch('master') > + | --- > + | - true > + | ... > +box.cfg({ \ > + replication = { \ > + "unix/:./replica.sock", \ > + }, \ > +}) > + | --- > + | ... > +box.space.sync:select{} > + | --- > + | - [] > + | ... > +test_run:wait_cond(function() return \ > + test_run:grep_log('master', \ > + 'rejecting PROMOTE') ~= nil end, 100) \ > +test_run:wait_cond(function() return \ > + test_run:grep_log('master', \ > + 'ER_CLUSTER_SPLIT') ~= nil end, 100) 3. Why do you need these 2 conds with \? The only reason for using \ between multiple statements is to prevent yields. Why can't you have yields between the two wait_cond() calls? Also could you make one cond with 'grep_log() and grep_log()'?