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 DCD766ECE3; Thu, 13 Jan 2022 13:13:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DCD766ECE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1642068791; bh=3F6QgJ/iMllmLWHqauWvMpFiVHSMCzEKBwNMlAgFIbg=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=C76IAYpo9a2FhUmCucXDa13vhxkkAl6Ux76JiU68A/vIqWpu6S1dPqCPLkOzhpPn2 AoJVUuhJEHhL+yLQHc9eIP/0lSNGTuLJ2vl7Babl+8ijwLqtuBVBUyCpmEN922/qi/ 1zSWGOeqi3s2YtXhUugh1gfdX6EzFOPi0L9NtOWM= Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (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 1C51E6ECE3 for ; Thu, 13 Jan 2022 13:13:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1C51E6ECE3 Received: by smtp37.i.mail.ru with esmtpa (envelope-from ) id 1n7x6S-0002zD-AX; Thu, 13 Jan 2022 13:13:08 +0300 Message-ID: <5cc5a52d-e6a7-b4cc-d2a1-23a9b1758288@tarantool.org> Date: Thu, 13 Jan 2022 13:13:07 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Content-Language: en-GB To: Vladislav Shpilevoy , Cyrill Gorcunov Cc: tml References: <20211230202347.353494-1-gorcunov@gmail.com> <20211230202347.353494-3-gorcunov@gmail.com> <1641824923.419591282@f764.i.mail.ru> <77b533c1-0c2f-c11d-0aa6-4109674a7025@tarantool.org> <63f0bdcc-4ab1-6fa9-411f-ddce6e0aa215@tarantool.org> In-Reply-To: <63f0bdcc-4ab1-6fa9-411f-ddce6e0aa215@tarantool.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD99D69EC10612BAE3729B5DF223B695BBC09B86105001BB43E182A05F5380850405DE5695DB0F2D2EAF68FE295D9BDACAA24FA809A4F1833C1ACF8ADF263113FE9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74EB183AD45C8BEFBEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E25DEE08FA4D750E8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8E95AD44A05B6C25B1E0D6D274D2EE669117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAE9A1BBD95851C5BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FF04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EEC65AC60A1F0286FEA9539A8B24243104D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3457EE4B4996FC546040F9FF01DFDA4A8C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637C970FD8DF19C51D2EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A5B4502A840307A4C7E4E5EC701C3F0A4E0A64CEE862291231D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA754D8E939D8DBE9AFC410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34B3611847B8BC2D0B8D47CF12F4E0355912BDABA0D8CAD41D1F5F0F2F4BDB4CB15743FD1606B3169F1D7E09C32AA3244CC3134871C90B70765C9DBE760A134EDE30452B15D76AEC14FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojEcbRopUAko1uQqu9Rjrv5Q== X-Mailru-Sender: 583F1D7ACE8F49BD7B46BC6C7C9DD5A8D70994E51CAC938C3A78FE3F74A18581CC370D87315486AC424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BCB0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v27 2/3] qsync: order access to the limbo terms 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" 13.01.2022 00:30, Vladislav Shpilevoy пишет: > Hi! > > On 12.01.2022 15:01, Serge Petrenko wrote: >> >> 11.01.2022 23:39, Cyrill Gorcunov пишет: >>> On Mon, Jan 10, 2022 at 05:28:43PM +0300, Serge Petrenko wrote: >>>>     Hi! Thanks for the patch! >>>>          box_issue_promote() and box_issue_demote() need fine-grained locking >>>>     anyway. >>>>     Otherwise it’s possible that promote() is already issued, but not yet >>>>     written to WAL, and some >>>>     outdated request is applied by applier at that exact moment. >>> True. And in previous series Vlad has asked to not move in code which is >>> not covered by tests. So I think this is a task for the next part. Currently >>> we cover only the race between appliers. >> Let's ask Vlad, then. >> >> I feel like we should fix this now, not waiting for a full fine-grained locking >> patch. >> >> First of all, this is a known bug (and fine-grained locking was meant to >> cover everything we don't know of, just in case). > I am not sure I understand what you both are talking about here. Sergey, do > you mean 'fine-grained locking' as big critical sections covering a lot of > code at once or as many small critical sections? I mean "locking every limbo function", like Cyrill tried to do that in the previous patch version. > > I am confused because of this sentence. "Cover everything we don't know" is > rather opposite to fine-grained locking. I voted for big locks because > apparently it was too hard to implement smaller more precise locks. > >> Besides, simply locking issue_promote/issue_demote should be >> much easier than implementing the fine-grained locking patch. > Yes. I remember the proposal was to lock entire promote/demote and other > qsync/raft functions from beginning to end. Because it should be relatively > easy. I didn't look at the code in this patch though, can't comment it. This particular patch only locks applier_apply_synchro_request(), txn_limbo_process() and txn_limbo_is_replica_outdated(), so that applier cannot apply a request from an already stale term. My proposal is to lock box_issue_promote() and box_issue_demote() (not whole promote/demote) to get rid of another race: when promote is written to WAL, but not yed processed. What you're talking about is what I call "fine grained locking", and it turned out rather hard to implement, so Cyrill abandoned this idea for now. -- Serge Petrenko