From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id BFA2A2B798 for ; Fri, 29 Mar 2019 17:06:12 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7K-EKcXb1d5j for ; Fri, 29 Mar 2019 17:06:12 -0400 (EDT) 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 turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 72A662B795 for ; Fri, 29 Mar 2019 17:06:12 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v9 7/7] sql: remove box.sql.execute() References: <40ed2682703f6c62298587dd74d997f71c124411.1553251042.git.imeevma@gmail.com> <20190328201305.GA16354@tarantool.org> From: Vladislav Shpilevoy Message-ID: <962cb5c9-4fa7-9e8a-f7b6-9d3cd6538f2d@tarantool.org> Date: Sat, 30 Mar 2019 00:06:09 +0300 MIME-Version: 1.0 In-Reply-To: <20190328201305.GA16354@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Mergen Imeev Cc: tarantool-patches@freelists.org Thanks for the fixes! On 28/03/2019 23:13, Mergen Imeev wrote: > Hi! Thank you for review. My answers, diff and new patch below. > > On Wed, Mar 27, 2019 at 12:48:17AM +0300, Vladislav Shpilevoy wrote: >> Thanks for the patch! See 5 comments below. >> >>> diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua >>> index 6c9a820..5530b2c 100644 >>> --- a/src/box/lua/load_cfg.lua >>> +++ b/src/box/lua/load_cfg.lua >>> @@ -505,17 +505,14 @@ end >>> box.cfg = locked(load_cfg) >>> >>> -- >>> --- This makes possible do box.sql.execute without calling box.cfg >>> +-- This makes possible do box.execute without calling box.cfg >>> -- manually. The load_cfg call overwrites following table and >> >> 1. There are no metatable anymore as I see. At least an explicit. >> Do you really call load_cfg on every single box.execute() call? >> If you do - please, do not. It is too slow. Use metatables. >> > After load_cfg() is executed, this version of box.execute() will > be replaced by a new one, and load_cfg() will no longer be > executed. At the same time, if load_cfg() does not replace this > box.execute() with a new one, Tarantool may hang. Not sure that > metatables can fix this problem. Should I use metatables or it is > enough to fix comment? This issue should be automatically fixed > after feature "load cfg after anything from box is called". Sorry, now I see that in the previous patch box.execute replaces any other 'box.execute' versions on load_cfg() invocation. It is ok. > >>> diff --git a/test/sql-tap/orderby9.test.lua b/test/sql-tap/orderby9.test.lua >>> index 191c21b..13f9ec6 100755 >>> --- a/test/sql-tap/orderby9.test.lua >>> +++ b/test/sql-tap/orderby9.test.lua >>> @@ -41,6 +41,7 @@ test:do_test( >>> -- separately for the result set and the ORDER BY clause, then the output >>> -- order will be random. >>> local l1 = test:execsql("SELECT random() AS y FROM t1 ORDER BY 1;") >>> + for k,_ in pairs(l1) do l1[k] = tonumber(l1[k]) end >>> local l2 = table.deepcopy(l1) >>> table.sort(l1) >>> return test.is_deeply_regex(l1, l2) >>> @@ -50,6 +51,7 @@ test:do_test( >>> 1.1, >>> function() >>> local l1 = test:execsql("SELECT random() AS y FROM t1 ORDER BY random();") >>> + for k,_ in pairs(l1) do l1[k] = tonumber(l1[k]) end >> >> 4. And in these two hunks? >> > I did this because values returned by test:execsql weren't > numbers. They were cdata. Due to this they were sorted not > the way it was expected. Apparently looks like a bug: numbers should be compared correctly. I confirmed that via a simple test case and opened a bug: https://github.com/tarantool/tarantool/issues/4089 In your test I added a comment: -- Big random() numbers are cdata, but cdata numbers can -- not be compared nor sorted correctly.