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 52C0D6EC58; Thu, 27 May 2021 11:24:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 52C0D6EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1622103856; bh=pfofRszaoLfXA68NNRsi3hsyVfTRxgJf1/U4dHm7vXg=; 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=Tmqby1Q8xmL51bj0Ia+lBeT6Iu8ay1PZI6SsGyeP5emGPe+1a9LOqxZG9lk1YjIyV hNs2eu/JzfXyxH1rM+B+1nXR74sqpM7UFjfniEqWYIXodmjdPXASBpIpZX1ZEY7xm2 1/Tp0oTvolHhGNbcGCw7E8su0Hf9gApODl3pevrQ= Received: from smtp31.i.mail.ru (smtp31.i.mail.ru [94.100.177.91]) (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 8EDB46EC58 for ; Thu, 27 May 2021 11:24:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8EDB46EC58 Received: by smtp31.i.mail.ru with esmtpa (envelope-from ) id 1lmBJO-00053f-GU; Thu, 27 May 2021 11:24:15 +0300 To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, yaroslav.dynnikov@tarantool.org References: <8d7e89a4884559963c02719fca0dc0720632fc73.1621975324.git.v.shpilevoy@tarantool.org> <7284b714-dfa7-026e-5979-2d5eb3e55386@tarantool.org> <25369324-54cd-1611-c39a-0c4a1e8686a6@tarantool.org> Message-ID: Date: Thu, 27 May 2021 11:24:13 +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: <25369324-54cd-1611-c39a-0c4a1e8686a6@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9157EECD0FDB90B9A60631225C742FB44676004EC60CDF90400894C459B0CD1B96F491CE68C2C956E0FB0C101083B210C02D3C5E87376242663C3B99123503CBA X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75840EB8CDBC1001FEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637670E1B164B70895C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D88CE02CDD924B83A98A48FAEA6204D0C0117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC2EE5AD8F952D28FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE0AC5B80A05675ACD1AB2475877E8919AD8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3568FCE88E0C8489D040F9FF01DFDA4A8C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637870CFFD37CCFDD3AEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24209795067102C07E8F7B195E1C978311807F349C2D6430AE39BF8F5EB72FA2C X-C1DE0DAB: 0D63561A33F958A530B1FCB6C3070683E8DD3F6EA40120F04BEB0AA08DA0FCE7D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75E3127721F5A72C97410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D341C998A3771F041538F53DA2FC9B48D2A4A82F40E695EBFC38431EEC7169FF576E81E9C41F5D0598F1D7E09C32AA3244CF79F4BD1002C4DBD578B46EC21087347408A6A02710B7304FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojywAFAsvjBJgrzRRX/ucZsg== X-Mailru-Sender: 583F1D7ACE8F49BD07526C4546A62CBF9AC69E119256EF0C0A33AE4D26A45E8670476F2DCB4AB6A323E75C7104EB1B885DEE61814008E47C7013064206BFB89F93956FB04BA385BE9437F6177E88F7363CDA0F3B3F5B9367 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" Thanks for your answers! LGTM. On 26.05.2021 21:44, Vladislav Shpilevoy wrote: > Hi! Thanks for the review! > >>> 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? > bucket_recv_xc() is called only from bucket_recv() via pcall. > Bucket_recv() does the rollback. I have the _xc() version so > as not to wrap into pcalls everything, and as a protection > against potential OOM. For instance, when I create a table > in there like `{bucket_id, recvg, from}` - it might fail too, > AFAIU. Thanks for explanation. >>> +                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? > Because `tuple` is a Lua table. When formatted into %s in the error > message, it turns into 'table 0x......' instead of showing the > content, while tuple objects have a nice serializer. > Yes, I missed it. But if it's lua table (not box.tuple) it's OK. >> AFAIU box.tuple.new doesn't just increment tuple ref-counter and construct new tuple. > It does exactly this. > >> Rebalancing is quite CPU-intensive operation so I'm not sure that such behaviour doesn't >> >> make error case worse. > I thought about it, but decided that it is not worth optimizing the > error case. It is better to provide a good error message. I also > thought about using json.encode() to avoid 'table 0x.....' problem, > but decided I don't want to introduce a dependency on the entire json > module just for this. Ok, agree.