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 5036370361; Wed, 10 Feb 2021 02:48:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5036370361 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1612914500; bh=zoJqYFfN7mkb5KcM1JVkBWebNe7wAi1Xyc2I35Ogkyk=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=PNmSsH6rCGnw9MvX1SgMZ52KJ6EDXNmnpCaKGgEo7hYpDS5+mrcCxGYs/XWy/KVrE MilSrKxWWrxSMcdfVCqLcfIFelWenpkW7I4TMjFPcGeBbsLQ2jGIB5iAl5hjUPW2wg DJxv5iIXdTEloqUref1tcq3XyXwhmMvWNtrfd+8U= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 C3C326AABC for ; Wed, 10 Feb 2021 02:46:23 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C3C326AABC Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1l9ci3-0002gH-SY; Wed, 10 Feb 2021 02:46:20 +0300 To: tarantool-patches@dev.tarantool.org, olegrok@tarantool.org, yaroslav.dynnikov@tarantool.org Date: Wed, 10 Feb 2021 00:46:10 +0100 Message-Id: <7cf081ec78f104b2a95918685733d823495a43ed.1612914070.git.v.shpilevoy@tarantool.org> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD953AC099BC0052A9CC9F923E808BA4A11AAD7C69F0036037C182A05F5380850406E1D81044D27A618B42436F29B4917C5BAB99116B5AA3CACAC41A73F4A09A0CD X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE779AAD18609327F83EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063790C8302959DAAF098638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FCA6073DB25481D6C53D9D34D4BF0EB70C1CA075312368676C389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0B882963B8E9439758941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6F2625F01C5EFA1CFA471835C12D1D977C4224003CC836476EC64975D915A344093EC92FD9297F6718AA50765F7900637427B078F297B269AA7F4EDE966BC389F395957E7521B51C24C7702A67D5C33162DBA43225CD8A89F616AD31D0D18CD5CCE5475246E174218B5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DBAF038BB36E94EA6B574AF45C6390F7469DAA53EE0834AAEE X-B7AD71C0: 2623F767319EFA42AC98609FCEE262F9192335DD689A58EBAE0174B7F1092AFBF26F4FBC8AC6E91E8E2298FCCC56B1E6 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C4C7A0BC55FA0FE5FCA6073DB25481D6C53D9D34D4BF0EB70C4D3E0C204176487FB1881A6453793CE9C32612AADDFBE061C61BE10805914D3804EBA3D8E7E5B87ABF8C51168CD8EBDB791E6C230873D55CDC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D347130F804358653A6474516BC61C98C41716D50AEDA47966CF2888C6BFB83C9BA549DABB28157D9591D7E09C32AA3244CAFC599D8C73C14319BB0C4B7218E0B5B9CA7333006C390A0FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojmMmQ+JvDeDF6lV94E/h6xA== X-Mailru-Sender: 689FA8AB762F73936BC43F508A06382225E63E5B98DE2D361260EC30889790783841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: [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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 -- 2.24.3 (Apple Git-128)