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 8E5E8714B5; Tue, 5 Oct 2021 16:55:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8E5E8714B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1633442126; bh=sEqrsF+j5rISD/yccuZbwv3kudhb0y0XCi0Io53ChfY=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=q1Str/KDQK5tBx73BzjkMOieDiaqqxr2EFRajIYUmGvwtNaGkDCSZkgpmoQm0z1q6 BCNupgCD2S7xIzNvnnSXMCYqajrSxD/H4WNRiXu9/k0orCvlv77FccmZhX1hS0Mcjr G+41o15k64n74L3FJgkyERiunD6VNeJ8XtYU/XR4= Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (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 21C46714B5 for ; Tue, 5 Oct 2021 16:55:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 21C46714B5 Received: by smtp63.i.mail.ru with esmtpa (envelope-from ) id 1mXkuj-00080e-3y; Tue, 05 Oct 2021 16:55:25 +0300 To: Cyrill Gorcunov Cc: tml , Vladislav Shpilevoy References: <20210930094445.316694-1-gorcunov@gmail.com> <20210930094445.316694-4-gorcunov@gmail.com> <42713720-689c-221c-29a4-7087ccbc472f@tarantool.org> Message-ID: <1c992b36-7ad4-c68b-5252-69a6f1a7b67a@tarantool.org> Date: Tue, 5 Oct 2021 16:55:24 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9064ADF4728AA0EE9F29F6F937CFD73092774A1760F25EB43182A05F5380850406F642FC58B39E23E2D51141AEC6D80BEEBBD8D78FE188BC8A5844592449B4C37 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7C6A43EB42C8B28B9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637CFA2FDEB3954FDBC8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8AA8343D63DCE9091A3150965931FE150117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAA867293B0326636D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8BF1175FABE1C0F9B6A471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CAA44A86D94E7BBB043847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A523E1E75B850D0139DA2B67AA312F941EE0109AA5B7D6D621D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75C4D20244F7083972410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AF12ADB97C97CD89D03C2B071F160429AE16430475E5C32CF42DD088B91FD596B2BA562CB743A9EE1D7E09C32AA3244CFC993F58AE868676FD58487A970F7297D08D48398F32B4A6FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojhAh8SZXECpAMDW8IohHTYg== X-Mailru-Sender: 3B9A0136629DC9125D61937A2360A446E5393589FE9FBB60C923853AA242906BD2B26EF2F3444B96424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v19 3/3] test: add gh-6036-qsync-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: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 05.10.2021 00:16, Cyrill Gorcunov пишет: > On Fri, Oct 01, 2021 at 03:30:41PM +0300, Serge Petrenko wrote: >> Thanks for the test! >> Please, find a couple of comments below. >> I think the test won't be flaky anymore once you fix my comments. > Thanks for comments, Serge! > >>> + >>> +box.once("bootstrap", function() >>> + box.schema.user.grant('guest', 'super') >>> +end) >> Looks like "election_replica.lua" suits our needs perfectly now. >> No need to introduce a new instance file. > yup, I updated the test, thanks! > >>> +test_run:wait_cond(function() return box.space.test:get{1} ~= nil end) >>> + | --- >>> + | - true >>> + | ... >>> + >> >> You may replace both calls with test_run:wait_lsn('master', 'replica') >> Even without switching. > Actually I need switch, otherwise i got stuck, so I use > > test_run:switch("master") > box.ctl.promote() > s = box.schema.create_space('test', {is_sync = true}) > _ = s:create_index('pk') > s:insert{1} > > test_run:switch("replica1") > test_run:wait_lsn('replica1', 'master') > > test_run:switch("replica2") > test_run:wait_lsn('replica2', 'master') > > > which works just fine Yep, that's what I meant. > >>> + >>> +-- >>> +-- Make replica1 been a leader and start writting data, >>> +-- the PROMOTE request get queued on replica2 and not >>> +-- yet processed, same time INSERT won't complete either >>> +-- waiting for PROMOTE completion first. >>> +test_run:switch("replica1") >>> + | --- >>> + | - true >>> + | ... >>> +box.ctl.promote() >>> + | --- >>> + | ... >>> +_ = require('fiber').create(function() box.space.test:insert{2} end) >>> + | --- >>> + | ... >>> + >>> +-- >> Prior to doing something on master, you should make sure >> replica2 has received the promote. >> "wait_lsn" won't work here, because WAL is disabled. You may try >> test_run:wait_cond(function() return box.space.test:get{2} ~= nil end) > Wait, this moment is dubious. Look, once we issue promote it get > stuck inside journal write procedure so the next "insert" won't > proceed until the promote finished. I understand that you point > to the potential race here because even promote() command may get > finished but slowed down on nework level and simply reach replica2 > out of other calls. I think without aditional debug output (such > as promote term exposed via box.info I did in previous series) we > can't be sure about timings and it seems that i've to return back > the box.info patch. I mean currently the command > > test_run:wait_cond(function() return box.space.test:get{2} ~= nil end) > > stucks forever because promote yet not finished and next 'insert' simply > has not been applied. Ok, I see. I didn't think of that at first. Look, your `box.info` patch won't help here as well. Since promote is blocked on its way to WAL, it isn't applied yet, so we won't see the term increase. There is a way to dect a blocked promote: There's ERRINJ_WAL_WRITE_COUNT. It's incremented each time you call wal_write. Even before the write is blocked. So you need to save ERRINJ_WAL_WRITE_COUNT, then do promote on replica1, then return to replica2 and wait until ERRINJ_WAL_WRITE_COUNT gets bigger than your saved value. -- Serge Petrenko