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 0C8D86EC55; Tue, 27 Jul 2021 02:45:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0C8D86EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1627343129; bh=EUELGnSwRtr2SZy0iITC16rzKQ6WuabXzfWiVIfruUg=; 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=EztBO8PjYAgM3TouLRSD9asT5hXR5IPvUjprc4QiSBTXbWuYWSSbyQ4XXAwfVDG+k uTXoMgUW8Q/9RF30jkWK2zrQsfCrjP/1Txv+ueW+yeenxFcohI4FEiawZcpywE1eMY wB8lH82GpEsi76yj2p0mDWnbOhyCki8IWoVirS/I= 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 AF8A96EC5C for ; Tue, 27 Jul 2021 02:45:12 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AF8A96EC5C Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1m8AHY-0003mx-56; Tue, 27 Jul 2021 02:45:12 +0300 To: Serge Petrenko , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: Message-ID: <82fb422a-7a6c-d52f-06ba-8e053b2cd8bb@tarantool.org> Date: Tue, 27 Jul 2021 01:45:11 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C33D83595CA30D6DC5179D1C9A908C47E5182A05F538085040342EA394DA48E7805B772890FAB5CAA9C08912408B1682E7C77FC5F83C4DFF66 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE71994F8570CDD924EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E16D8B060A9A23898638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D87DFCAF3684FABAA83238E83DE6B54579117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC049C5FA07E1E73E1A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520B28585415E75ADA9C26CFBAC0749D213D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505B043F014BEAB095957162FC52284435C X-C1DE0DAB: 0D63561A33F958A5B9CB4443B25E75F33D2FCB9383A91D502CBE2CE93FB4952CD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA753530422897FB34C3410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3414C91BA6844B96CA2DDBAF3AC2360F0463A08B05BFF24170FC3B3F36617F19587CB5FD5F32B6A2291D7E09C32AA3244C8EDF18C61EB43B53BD03A3C69E865084CE0B41342B755BCDFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojMEANdStWW58egtST5BFGAw== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DB11E19CC266112D490E87563043139AF3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 10/16] box: make promote always bump the term 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 fixes! > diff --git a/src/box/raft.c b/src/box/raft.c > index eb62e9630..35c471f58 100644 > --- a/src/box/raft.c > +++ b/src/box/raft.c > @@ -394,6 +394,46 @@ box_raft_wait_term_outcome(void) <...> > + > +int > +box_raft_wait_term_persisted(void) > +{ > + if (box_raft()->term == box_raft()->volatile_term) > + return 0; > + struct raft_wait_persisted_data data = { > + .waiter = fiber(), > + .term = box_raft()->volatile_term, > + }; > + struct trigger trig; > + trigger_create(&trig, box_raft_wait_term_persisted_f, &data, NULL); > + raft_on_update(box_raft(), &trig); > + > + do { > + fiber_yield(); > + } while (box_raft()->term < data.term && !fiber_is_cancelled()); Could I ask you please to cache box_raft() into a variable? It would be shorter and slightly easier to read. > + > + trigger_clear(&trig); > + if (fiber_is_cancelled()) { > + diag_set(FiberIsCancelled); > + return -1; > + } > + return 0; > +}