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 30C2B6ECC0; Tue, 7 Dec 2021 09:50:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 30C2B6ECC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1638859805; bh=SIXE9GTfw6jZGJve+847Hc2qgxq38Gigu9YjyayuZyw=; 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=lt+DYDifNuNYKnf/V+M4zavk9iWGQrV0a3+OFCn3Sye6+8FZ/m7EGwcsbJ04m9YHh Ypj7f3omED8/ieL1yUo0RMR1I64AuIqPQBJgq/z7Vi6XDa7pTKVcE0ykJsrNlXnCJ0 gnjhWyLdRkxdZ5HNrkaqDz+sjd00/M5o8EE4HmQY= Received: from smtp56.i.mail.ru (smtp56.i.mail.ru [217.69.128.36]) (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 D76126ECC0 for ; Tue, 7 Dec 2021 09:50:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D76126ECC0 Received: by smtp56.i.mail.ru with esmtpa (envelope-from ) id 1muUIa-000215-86; Tue, 07 Dec 2021 09:50:00 +0300 Message-ID: <633b9699-f39a-d526-cfa5-03259c1f6c0b@tarantool.org> Date: Tue, 7 Dec 2021 09:49:59 +0300 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 To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org References: <36c68a48a627c8af98fb6f9809d2661abcd93658.1638577114.git.v.shpilevoy@tarantool.org> <03bd48be-b017-a48f-773e-f4b8e95f8cf5@tarantool.org> <3c1aff55-004d-183a-4b94-be663255a310@tarantool.org> In-Reply-To: <3c1aff55-004d-183a-4b94-be663255a310@tarantool.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD99F281DB1F96F126D0F9D4A7CCE332392263C82E7EF727BBA00894C459B0CD1B97A74EE1704DC8116E45D7CF16CE4FD71DE28C094B8C19E9B242CE91CCB49B96E X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7CA8E915ACC910FBDEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637C867FEFF36BCDF178638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D858B17EEDBA153ECDC01A7507EE9075AE117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCC908CD1B87A134A2A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520B1593CA6EC85F86D618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE4B6963042765DA4B4782AAF36435267CD8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3568FCE88E0C8489D040F9FF01DFDA4A8C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637AF8E4F18C523FAA9EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A5E07C643B60DFC7074F76BEEEA0AE893E018AD1234C538E18D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7506FE1F977233B9BB410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34682FD2D2951524C51BAFDD48FDAE2526E9C88B2D70D33C02CDA319958F791792892E8AD43AE2F9AA1D7E09C32AA3244C4633F1DBE9B4AAA5208F1425D5A3D0ECCE0B41342B755BCD729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojTrkTMKMUi4VAvBU6nGxCDg== X-Mailru-Sender: 583F1D7ACE8F49BD1042885CEC987B6BAE4711FE139EEFE61145B60833592E5081AE5054A97140B97019711D9D5B048E1458020726E2BC9FD5ECBA0B92C0A936CDC7563AA7CEBD2872D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH vshard 2/2] router: don't fallback RO to master right away 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: Oleg Babin via Tarantool-patches Reply-To: Oleg Babin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for your fixes. LGTM. On 07.12.2021 02:56, Vladislav Shpilevoy wrote: > Thanks for the review! > > On 05.12.2021 18:53, Oleg Babin wrote: >> Thanks for your patch. See one comment below. >> >> Also as I see CI is red on your branch. Is it related to your changes? > Yes, I didn't update .result file in one of the tests. Done now. > >>> diff --git a/vshard/replicaset.lua b/vshard/replicaset.lua >>> index 174c761..93f210e 100644 >>> --- a/vshard/replicaset.lua >>> +++ b/vshard/replicaset.lua >>> @@ -455,18 +455,25 @@ local function replicaset_template_multicallro(prefer_replica, balance) >>>                       return r >>>                   end >>>               end >>> -        elseif prefer_replica then >>> -            r = replicaset.replica >>> +        else >>> +            local start_r = replicaset.replica >>> +            r = start_r >>>               while r do >>> -                if r:is_connected() and r ~= master then >>> +                if r:is_connected() and (not prefer_replica or r ~= master) then >>>                       return r >>>                   end >>>                   r = r.next_by_priority >>>               end >>> -        else >>> -            r = replicaset.replica >>> -            if r and r:is_connected() then >>> -                return r >>> +            -- Iteration above could start not from the best prio replica. >>> +            -- Check the beginning of the list too. >>> +            for _, r in pairs(replicaset.priority_list) do >> pairs can't be jitted (at least now until https://github.com/tarantool/tarantool/issues/6475). >> >> Also pairs don't give any guarantees about iteration order. Could it be replaced with ipairs? > It can be. Replaced with ipairs on the branch.