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 81D6C6F3E5; Sun, 7 Nov 2021 19:45:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 81D6C6F3E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1636303509; bh=H/rzrZC8rzt/qXSQg76uvgcy26spCcl+4cKPmCfN/Ls=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=qIOqljQvaubk0/QcduPQUnBlJWuhqRBvQhAghixqDpMWWuXyx1IgDKa6Sq3GzVZD/ f7m3Pww8A3/tYtCt5gchmRTMIPu3AYXiYuxQGaZbmqzNyeDhwHD6TGHG5avth/blP8 sInVIRgX9NImkRfeg9wvmUSlw+Ms4KrZJG/6LsBc= 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 DBA1F6F3E5 for ; Sun, 7 Nov 2021 19:45:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DBA1F6F3E5 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mjlI1-0005YQ-9N; Sun, 07 Nov 2021 19:45:05 +0300 Message-ID: <4b4d9d85-09cd-22d4-172e-1268e921074a@tarantool.org> Date: Sun, 7 Nov 2021 17:45:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Content-Language: en-US To: Cyrill Gorcunov , Vladislav Shpilevoy via Tarantool-patches References: <99799340f06652929897e363e42a5227d12277a1.1636156453.git.v.shpilevoy@tarantool.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9F9D976862A30D4FE6BDAF562149F474AA3F6EFF79A372AD4182A05F538085040205401A5168CC48FF68C0D6A4166AD0C78646D75C5A6F252100D73A8A01C47F3 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE779AAD18609327F83EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BC4B0F5721B555078638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D811A8C365C4CC6D70A2642F6DF4463481117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC60CDF180582EB8FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FC26CFBAC0749D213D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6B1CFA6D474D4A6A4089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB78D6D0BB59C9AE7EFFE8F7B195E1C978313CFD6A35C3EC589FDFDF0179112761E5 X-C1DE0DAB: 0D63561A33F958A53D216F2F1E18BEB90AD2A5AFCB36DA85238C166038252AF2D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA753753CEE10E4ED4A7410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D346AD04FDA812EEFF13DC317F4376466C39DC70DE0731AC1F880F9067836F4D0D78F8DA91E5431B7191D7E09C32AA3244CDD38473A7EF5B4586D304ED889FAF19F69B6CAE0477E908D729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj9/1IdNVT2RamozLn7xhpeA== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D527913C8A3EA0328F21BDFC974902C723841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 9/9] box: enrich ER_READONLY with new details 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" On 06.11.2021 20:30, Cyrill Gorcunov via Tarantool-patches wrote: > On Sat, Nov 06, 2021 at 12:56:40AM +0100, Vladislav Shpilevoy via Tarantool-patches wrote: >> + if (raft_is_ro(raft)) { >> + error_field_set_str(e, "reason", "election"); >> + error_field_set_str(e, "state", raft_state_str(raft->state)); >> + error_field_set_uint(e, "term", raft->volatile_term); >> + uint32_t id = raft->leader; >> + if (id != REPLICA_ID_NIL) { >> + error_field_set_uint(e, "leader_id", id); >> + struct replica *r = replica_by_id(id); > > Why do we need an additional variable here instead of raft->leader? > To shrink code left? > >> + } else if (txn_limbo_is_ro(&txn_limbo)) { >> + error_field_set_str(e, "reason", "synchro"); >> + uint32_t id = txn_limbo.owner_id; >> + error_field_set_uint(e, "queue_owner_id", id); >> + error_field_set_uint(e, "term", raft->volatile_term); >> + struct replica *r = replica_by_id(id); > > And here too. Just wondering. I like to avoid '->' when it is used for the same member more than once. Also it shrinks the code a bit, yes.