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 DC66C6ECC0; Tue, 7 Dec 2021 02:56:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DC66C6ECC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1638834992; bh=7LRsTP7YkQhsZTjwFzlSUvKiZ20qPhj7W+YwHKZrzTw=; 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=CUffjLj0JEmD6Bt8aqhfj5M3/DCOV5VNwj9iaoApP8Pm+DsEBqd4Mo9luGw1/nxj0 4RpMlv6hCpDHXJieJ96Z8YApckJn3tGzx302Ky+eY56OkjK1gPgzwjxXd3R2qSdn/p 5tlWQlXrIQYyAXjYZDApj/bNdQj6rJ7zd0+9Q1G4= 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 ED5626ECC0 for ; Tue, 7 Dec 2021 02:56:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org ED5626ECC0 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1muNqQ-0000uX-99; Tue, 07 Dec 2021 02:56:30 +0300 Message-ID: <3c1aff55-004d-183a-4b94-be663255a310@tarantool.org> Date: Tue, 7 Dec 2021 00:56:29 +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.2 Content-Language: en-US To: Oleg Babin , tarantool-patches@dev.tarantool.org References: <36c68a48a627c8af98fb6f9809d2661abcd93658.1638577114.git.v.shpilevoy@tarantool.org> <03bd48be-b017-a48f-773e-f4b8e95f8cf5@tarantool.org> In-Reply-To: <03bd48be-b017-a48f-773e-f4b8e95f8cf5@tarantool.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD99F281DB1F96F126D0F9D4A7CCE332392263C82E7EF727BBA00894C459B0CD1B93032400655DC58BB4F7442DC062E84343A3B76CB9859A8B83E4D764DDA6573C6 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7CA8E915ACC910FBDEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378D08D652E28591A78638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D86AF303EBAC18BD17A1C645ED85FA3881117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC5FC25ED3FCEC3375A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520140C956E756FBB7A6FD1C55BDD38FC3FD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B66F6A3E018CF4DC80089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A532794E8EA4F227BAAB87BFD11841C995E940CE44B9BE76C5D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7506FE1F977233B9BB410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34C2E47CA9A56060907BEAFCA6BB4DA9DC88C01DC3207C82B62FF719F6421F6591377E3ADEA2A184AA1D7E09C32AA3244C218C39064FF617515B02A8E8DCECC9AC5595C85A795C7BAE729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojTrkTMKMUi4VULECCz8u84Q== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D1B01A83CE7A0EE5E69518359329C5AA93841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E25FEEDEB644C299C0ED14614B50AE0675 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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.