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 650CB6EC40; Mon, 5 Jul 2021 12:25:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 650CB6EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1625477120; bh=CEv8StUcCKAvARBhf+hXxK7pWptYAgbkQQSttbHjmtU=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=xanlRMsXk7vaJOeqB6b/rHqEVle6tLMMAKB07MTnJqC1Qq4XOWPKqO3W6jd5ZtnHL gGD4zCusfAME7T6FQ3LFcVnzQqKCZJuf52Og7OR69DEAFARx/k8EqaRws/Jdz3RH45 RvwfIOHWMUyDP491sw9TT4jqEWk9b9NE2oE1nPRY= Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [94.100.177.95]) (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 E796C6EC41 for ; Mon, 5 Jul 2021 12:24:12 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E796C6EC41 Received: by smtp35.i.mail.ru with esmtpa (envelope-from ) id 1m0Kpo-0006uC-6H; Mon, 05 Jul 2021 12:24:12 +0300 To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, yaroslav.dynnikov@tarantool.org References: <1b0facbff8f285ec54c03a3ec68fca777f4828a3.1625177222.git.v.shpilevoy@tarantool.org> <2dc3ff07-5f6e-294f-670a-5dcc5948c839@tarantool.org> <6073e325-a77b-c5c1-8950-950f41c36ac3@tarantool.org> Message-ID: <7621af8d-7918-950d-4911-dec06cadb95b@tarantool.org> Date: Mon, 5 Jul 2021 12:24:11 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <6073e325-a77b-c5c1-8950-950f41c36ac3@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD954DFF1DC42D673FBE6C6848F3EB6EB89AE0756428E32ECE9182A05F538085040973F26C8439CBB9CC010B8D330BEBABFE60F8D8F76E5C63196B205E8BAD43022 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F2919D563845004AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006371A00CE7BDCE207EB8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8C0E5C2D594718E84252DB255048551F3117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC5F0C88D684269EDEA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352026055571C92BF10FE5D25F19253116ADD2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE4B6963042765DA4B043FB282AF95FB6BD8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3568FCE88E0C8489DAD7EC71F1DB88427C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637A7EFCB0EB5ACB161EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24209795067102C07E8F7B195E1C97831B417EAECEF95D73E916D7973594ED144 X-C1DE0DAB: 0D63561A33F958A57983333B4B1A8873473BCD73D89097BA74A3D6604B002617D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7569E77FCA7B33833F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D348D68DCC07DD06FF5502A05265DA18F594BD4239C80168780EC4EC398ECFD8DF626D1E1C29E0C2C6A1D7E09C32AA3244CE051E4E13B1EDE167E77BD11B36A9FB83A92A9747B6CC886FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj5fH2RN9TpJkSujDAhlrS1Q== X-Mailru-Sender: 583F1D7ACE8F49BD07526C4546A62CBFCE1C880F3EF40AFCAAFF9AE3AEB68CFF951A21FE2E6BE56723E75C7104EB1B885DEE61814008E47C7013064206BFB89F93956FB04BA385BE9437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH vshard 6/6] router: update master using a hint from storage 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 answers. I have following questions:   - After changes in previous patch I think it could be better to use "master_search_wakeup" instead of master_search_fiber:wakeup()   - Should we document somehow `update_master` method for replicaset object? Or maybe it even shouldn't be a part of public API? On 03.07.2021 00:36, Vladislav Shpilevoy wrote: > Thanks for the review! > >>> diff --git a/vshard/error.lua b/vshard/error.lua >>> index e2d1a31..fa7bdaa 100644 >>> --- a/vshard/error.lua >>> +++ b/vshard/error.lua >>> @@ -20,7 +20,7 @@ local error_message_template = { >>>       [2] = { >>>           name = 'NON_MASTER', >>>           msg = 'Replica %s is not a master for replicaset %s anymore', >>> -        args = {'replica_uuid', 'replicaset_uuid'} >>> +        args = {'replica_uuid', 'replicaset_uuid', 'master_uuid'} >> Error format string still contains only 2 arguments. Is it ok? > Yes. All the 'args' are remembered as the error object attributes. > I can use it to attach information which I don't want to add to > the message or simply can't. > > Here I can't, because master_uuid might be nil. If it would be in > the format, it would be displayed as 'nil' sometimes, which would be > confusing. > >>> diff --git a/vshard/replicaset.lua b/vshard/replicaset.lua >>> index 7747258..660c786 100644 >>> --- a/vshard/replicaset.lua >>> +++ b/vshard/replicaset.lua >>> @@ -570,6 +570,70 @@ local function rebind_replicasets(replicasets, old_replicasets) >>>       end >>>   end >>>   +-- >>> +-- Let the replicaset know @a old_master_uuid is not a master anymore, should >>> +-- use @a candidate_uuid instead. >>> +-- Returns whether the request, which brought this information, can be retried. >>> +-- >>> +local function replicaset_update_master(replicaset, old_master_uuid, >>> +                                        candidate_uuid) >>> +    local is_auto = replicaset.is_auto_master >>> +    local replicaset_uuid = replicaset.uuid >>> +    if old_master_uuid == candidate_uuid then >>> +        -- It should not happen ever, but be ready to everything. >>> +        log.warn('Replica %s in replicaset %s reports self as both master '.. >>> +                 'and not master', master_uuid, replicaset_uuid) >>> +        return is_auto >>> +    end >>> +    local master = replicaset.master >>> +    if not master then >>> +        if not is_auto or not candidate_uuid then >>> +            return is_auto >>> +        end >>> +        local candidate = replicaset.replicas[candidate_uuid] >> AFAIU it means that candidate_uuid doesn't belong to replicaset. >> >> Why is it true? > It can happen if router config is different from the storage's due > to any reason. If the master is not in router's config, it won't be > able to find it by UUID.