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 41E5F6EC58; Wed, 26 May 2021 12:03:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 41E5F6EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1622019806; bh=ZhQ9l9GAljmp3Lg3S0Uya4yQkTvOIcUxfUe9SI32nLA=; 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=p4HEXO2otk7Ek35jbqLqnnHDDpf3lExLEAyZ1L8wn7CvlDX1J7w0raKNtWa5+hWcM SGLoyO6cj1fGddaFBx5vgKDg06JJGUUE4QWYF+leQGeHAZDL4hXmdCQQL9Ktfg50c/ 0xy8m18Cm3qOhDRyoW3995WrzQXx3kPzkbY87B3E= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 C8F806EC58 for ; Wed, 26 May 2021 12:03:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C8F806EC58 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1llpRj-0005mR-Mk; Wed, 26 May 2021 12:03:24 +0300 To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, yaroslav.dynnikov@tarantool.org References: <8d7e89a4884559963c02719fca0dc0720632fc73.1621975324.git.v.shpilevoy@tarantool.org> Message-ID: <7284b714-dfa7-026e-5979-2d5eb3e55386@tarantool.org> Date: Wed, 26 May 2021 12:03:18 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <8d7e89a4884559963c02719fca0dc0720632fc73.1621975324.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: 4F1203BC0FB41BD9F4D89F53055293B7B476AE2F0FE38070A482055F3B604B06182A05F538085040DEE68823BF95FB9983E3F61E63C7B835D76075E88495EF34B5FE5ED3E568816C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7387B291F9AC4D188EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006371777B963B59186248638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8F0ECFEEC7CABDD5742BEC8DF815D95F4117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC292D688DDAD4E7BC389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8ED96AA85C75E140D117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637149D0840703ADBE5EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A5264D0B896A93ECD7212AFD44B58B4800CFECC20F72819259D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75E3127721F5A72C97410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AC6E62257D6CD1C97A8D878BD49438C75297FFD9F5DC85FF31400A9E183A2CA9DC97CF255A694D341D7E09C32AA3244C04633F21EB875D00722666F88308CFDA259227199D06760AFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojiWl9Rlzdedk37sOuvliUvQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638224FAB845A751EBB1D5FA620944CF53A0ED914C8E9159AEB641742365360198A7AFB559BB5D741EB964E30AD2C116090084C994F938BAD770067EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH vshard 1/1] rebalancer: give more info at bucket_recv() fail 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" Hi! Thanks for your patch. Two minor comments below. On 25.05.2021 23:42, Vladislav Shpilevoy wrote: > +-- > -- Bucket transfer > -- > -- Transfer to unknown replicaset. > diff --git a/test/storage/storage.test.lua b/test/storage/storage.test.lua > index 494e2e8..d1f3f50 100644 > --- a/test/storage/storage.test.lua > +++ b/test/storage/storage.test.lua > @@ -125,6 +125,23 @@ vshard.storage.bucket_recv(100, 'from_uuid', {{1000, {{1}}}}) > res, err = vshard.storage.bucket_recv(4, util.replicasets[2], {{1000, {{1}}}}) > util.portable_error(err) > while box.space._bucket:get{4} do vshard.storage.recovery_wakeup() fiber.sleep(0.01) end > +-- > +-- gh-275: detailed info when couldn't insert into a space. > +-- > +res, err = vshard.storage.bucket_recv( \ > + 4, util.replicasets[2], {{box.space.test.id, {{9, 4}, {10, 4}, {1, 4}}}}) > +assert(not res) > +assert(err.space == 'test') > +assert(err.bucket_id == 4) > +assert(tostring(err.tuple) == '[1, 4]') > +assert(err.reason:match('Duplicate key exists') ~= nil) > +err = err.message > +assert(err:match('bucket 4 data in space "test" at tuple %[1, 4%]') ~= nil) > +assert(err:match('Duplicate key exists') ~= nil) > +while box.space._bucket:get{4} do \ > + vshard.storage.recovery_wakeup() fiber.sleep(0.01) \ > +end > +assert(box.space.test:get{9} == nil and box.space.test:get{10} == nil) > > -- > -- Bucket transfer > diff --git a/vshard/error.lua b/vshard/error.lua > index b02bfe9..bcbcd71 100644 > --- a/vshard/error.lua > +++ b/vshard/error.lua > @@ -149,6 +149,11 @@ local error_message_template = { > msg = 'Can not delete a storage ref: %s', > args = {'reason'}, > }, > + [30] = { > + name = 'BUCKET_RECV_DATA_ERROR', > + msg = 'Can not receive the bucket %s data in space "%s" at tuple %s: %s', > + args = {'bucket_id', 'space', 'tuple', 'reason'}, > + } > } > > -- > diff --git a/vshard/storage/init.lua b/vshard/storage/init.lua > index 63e0398..7045d91 100644 > --- a/vshard/storage/init.lua > +++ b/vshard/storage/init.lua > @@ -1254,7 +1254,13 @@ local function bucket_recv_xc(bucket_id, from, data, opts) > end > box.begin() > for _, tuple in ipairs(space_data) do > - space:insert(tuple) > + local ok, err = pcall(space.insert, space, tuple) > + if not ok then > + box.rollback() Am I right that before a patch nobody rolled back transaction is case of error? How did it work? > + return nil, lerror.vshard(lerror.code.BUCKET_RECV_DATA_ERROR, > + bucket_id, space.name, > + box.tuple.new(tuple), err) > + end Do you really need `box.tuple.new` here. Why just `tuple` is not enough? AFAIU box.tuple.new doesn't just increment tuple ref-counter and construct new tuple. Rebalancing is quite CPU-intensive operation so I'm not sure that such behaviour doesn't make error case worse. > limit = limit - 1 > if limit == 0 then > box.commit()