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 B306F70361; Wed, 10 Feb 2021 11:59:12 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B306F70361 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1612947552; bh=HhOswDqHZkRf+X8E80YmH8C1QU1FnnFrAeKrXumIBLY=; 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=aFgdgdYAdzUxtLab02c7JiCfv+wzn84mhO1eRkSxUQCgNXUXXqiERy+41Zn+sHxVy MiG7HK2lEGHKmpBEBur2u4UnO3ZyxkB1TqQnScJW14wQwy4KKRnE+3UWT4QdQWSQFb vHagpzv6DfFjMw6CASlx8c+C8L6qBAGfF80kzMKI= Received: from smtp17.mail.ru (smtp17.mail.ru [94.100.176.154]) (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 455CC70361 for ; Wed, 10 Feb 2021 11:59:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 455CC70361 Received: by smtp17.mail.ru with esmtpa (envelope-from ) id 1l9lKv-0007uL-7y; Wed, 10 Feb 2021 11:59:01 +0300 To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, yaroslav.dynnikov@tarantool.org References: <7cf081ec78f104b2a95918685733d823495a43ed.1612914070.git.v.shpilevoy@tarantool.org> Message-ID: <859c6dd6-3c84-f2ba-391b-49a669dc2d6b@tarantool.org> Date: Wed, 10 Feb 2021 11:59:00 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <7cf081ec78f104b2a95918685733d823495a43ed.1612914070.git.v.shpilevoy@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD953AC099BC0052A9C55152E5B36F7009490E3DBC75EBFD4CE182A05F5380850409539BB5D9B1F39FC274261D49717AD2B1F5F191E8E66146F69AB3141027135A2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7227E4400968B082FEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637603D0B7FC8E46DFC8638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC8767A9B625D33EB406D01541774F853DE6BAAA054DA1D214389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C068077CCD40B79AC98941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B690CCD2EB80CC9620CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249BCC2EE020E0ABDE576E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8BC27B326D59C7CDB83AA81AA40904B5D9DBF02ECDB25306B2B25CBF701D1BE8734AD6D5ED66289B5278DA827A17800CE7AD122C37AACC1F0267F23339F89546C5A8DF7F3B2552694A6FED454B719173D6725E5C173C3A84C32C5FCA5927F7B458089D37D7C0E48F6C5571747095F342E857739F23D657EF2B6825BDBE14D8E7028C9DFF55498CEFB0BD9CCCA9EDD067B1EDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A577F89DFB4EA88C77584933BD036BA8CFE240819CD8ED093BD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75F04B387B5D7535DE410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D346F8291983715AC66BA7AA91F62F8FF858D094712D49BBEB82AB5B4464F0F5DBE3C67B6896674E2291D7E09C32AA3244C316462D38EA2A0DA2B965EAF61A844A6D08D48398F32B4A6FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojmMmQ+JvDeDHC1GQG4wEYTQ== X-Mailru-Sender: E02534FE7B43636DC6DBEBE9641397946392732BF2ADA6B31D527312F4D3023272B8225D32E4C6AF23E75C7104EB1B885DEE61814008E47C7013064206BFB89F93956FB04BA385BE9437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 4/9] storage: bucket_recv() should check rs lock 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 patch. LGTM. On 10/02/2021 02:46, Vladislav Shpilevoy wrote: > Locked replicaset (via config) should not allow any bucket moves > from or to the replicaset. > > But the lock check was only done by bucket_send(). Bucket_recv() > allowed to receive a bucket even if the replicaset is locked. The > patch fixes it. > > It didn't affect automatic bucket sends, because lock is > accounted by the rebalancer from the config. Only manual bucket > moves could have this bug. > --- > test/rebalancer/rebalancer_lock_and_pin.result | 14 ++++++++++++++ > test/rebalancer/rebalancer_lock_and_pin.test.lua | 4 ++++ > vshard/storage/init.lua | 3 +++ > 3 files changed, 21 insertions(+) > > diff --git a/test/rebalancer/rebalancer_lock_and_pin.result b/test/rebalancer/rebalancer_lock_and_pin.result > index 51dd36e..0bb4f45 100644 > --- a/test/rebalancer/rebalancer_lock_and_pin.result > +++ b/test/rebalancer/rebalancer_lock_and_pin.result > @@ -156,6 +156,20 @@ vshard.storage.bucket_send(1, util.replicasets[2]) > message: Replicaset is locked > code: 19 > ... > +test_run:switch('box_2_a') > +--- > +- true > +... > +-- Does not allow to receive either. Send from a non-locked replicaset to a > +-- locked one fails. > +vshard.storage.bucket_send(101, util.replicasets[1]) > +--- > +- null > +- type: ShardingError > + code: 19 > + name: REPLICASET_IS_LOCKED > + message: Replicaset is locked > +... > -- > -- Vshard ensures that if a replicaset is locked, then it will not > -- allow to change its bucket set even if a rebalancer does not > diff --git a/test/rebalancer/rebalancer_lock_and_pin.test.lua b/test/rebalancer/rebalancer_lock_and_pin.test.lua > index c3412c1..7b87004 100644 > --- a/test/rebalancer/rebalancer_lock_and_pin.test.lua > +++ b/test/rebalancer/rebalancer_lock_and_pin.test.lua > @@ -69,6 +69,10 @@ info.lock > -- explicitly. > -- > vshard.storage.bucket_send(1, util.replicasets[2]) > +test_run:switch('box_2_a') > +-- Does not allow to receive either. Send from a non-locked replicaset to a > +-- locked one fails. > +vshard.storage.bucket_send(101, util.replicasets[1]) > > -- > -- Vshard ensures that if a replicaset is locked, then it will not > diff --git a/vshard/storage/init.lua b/vshard/storage/init.lua > index c7335fc..298df71 100644 > --- a/vshard/storage/init.lua > +++ b/vshard/storage/init.lua > @@ -995,6 +995,9 @@ local function bucket_recv_xc(bucket_id, from, data, opts) > return nil, lerror.vshard(lerror.code.WRONG_BUCKET, bucket_id, msg, > from) > end > + if is_this_replicaset_locked() then > + return nil, lerror.vshard(lerror.code.REPLICASET_IS_LOCKED) > + end > if not bucket_receiving_quota_add(-1) then > return nil, lerror.vshard(lerror.code.TOO_MANY_RECEIVING) > end