Tarantool development patches archive
 help / color / mirror / Atom feed
From: Mergen Imeev <imeevma@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org, kostja@tarantool.org
Subject: [tarantool-patches] Re: [PATCH v9 3/7] sql: remove box.sql.debug()
Date: Mon, 25 Mar 2019 22:39:52 +0300	[thread overview]
Message-ID: <20190325193952.GB11766@tarantool.org> (raw)
In-Reply-To: <20190322154607.GE6548@chai>

Hi! Thank you for review! My answer, diff and new patch below.

On Fri, Mar 22, 2019 at 06:46:07PM +0300, Konstantin Osipov wrote:
> * imeevma@tarantool.org <imeevma@tarantool.org> [19/03/22 13:57]:
> > Due to removing of box.sql.execute() it makes sense to remove
> > box.sql.debug() and move SQL info to box.info.
> 
> This looks like statistics, not info, so should be moved to
> box.stat.
> 
Fixed, moved to box.stat.
> 
> -- 
> Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
> http://tarantool.io - www.twitter.com/kostja_osipov
> 


Diff:

diff --git a/src/box/lua/info.c b/src/box/lua/info.c
index 707cd28..76b5646 100644
--- a/src/box/lua/info.c
+++ b/src/box/lua/info.c
@@ -45,7 +45,6 @@
 #include "box/gc.h"
 #include "box/engine.h"
 #include "box/vinyl.h"
-#include "box/sql.h"
 #include "main.h"
 #include "version.h"
 #include "box/box.h"
@@ -202,15 +201,6 @@ lbox_info_replication(struct lua_State *L)
 }
 
 static int
-lbox_info_sql_call(struct lua_State *L)
-{
-	struct info_handler info;
-	luaT_info_handler_create(&info, L);
-	sql_debug_info(&info);
-	return 1;
-}
-
-static int
 lbox_info_id(struct lua_State *L)
 {
 	/*
@@ -507,7 +497,6 @@ static const struct luaL_Reg lbox_info_dynamic_meta[] = {
 	{"memory", lbox_info_memory},
 	{"gc", lbox_info_gc},
 	{"vinyl", lbox_info_vinyl},
-	{"sql", lbox_info_sql_call},
 	{NULL, NULL}
 };
 
diff --git a/src/box/lua/stat.c b/src/box/lua/stat.c
index 1015253..ce0e9e9 100644
--- a/src/box/lua/stat.c
+++ b/src/box/lua/stat.c
@@ -42,6 +42,7 @@
 #include "box/iproto.h"
 #include "box/engine.h"
 #include "box/vinyl.h"
+#include "box/sql.h"
 #include "info/info.h"
 #include "lua/info.h"
 #include "lua/utils.h"
@@ -160,6 +161,15 @@ lbox_stat_net_call(struct lua_State *L)
 	return 1;
 }
 
+static int
+lbox_stat_sql(struct lua_State *L)
+{
+	struct info_handler info;
+	luaT_info_handler_create(&info, L);
+	sql_debug_info(&info);
+	return 1;
+}
+
 static const struct luaL_Reg lbox_stat_meta [] = {
 	{"__index", lbox_stat_index},
 	{"__call",  lbox_stat_call},
@@ -179,6 +189,7 @@ box_lua_stat_init(struct lua_State *L)
 	static const struct luaL_Reg statlib [] = {
 		{"vinyl", lbox_stat_vinyl},
 		{"reset", lbox_stat_reset},
+		{"sql", lbox_stat_sql},
 		{NULL, NULL}
 	};
 
diff --git a/test/box/info.result b/test/box/info.result
index 26377b1..3384631 100644
--- a/test/box/info.result
+++ b/test/box/info.result
@@ -83,7 +83,6 @@ t
   - replication
   - ro
   - signature
-  - sql
   - status
   - uptime
   - uuid
diff --git a/test/sql-tap/between.test.lua b/test/sql-tap/between.test.lua
index 79583af..1663e39 100755
--- a/test/sql-tap/between.test.lua
+++ b/test/sql-tap/between.test.lua
@@ -51,10 +51,10 @@ test:do_test(
 -- is done.  Then it appends the names of the table and index used.
 --
 local function queryplan(sql)
-    local sqlite_sort_count = box.info.sql.sql_sort_count
+    local sqlite_sort_count = box.stat.sql().sql_sort_count
     local data = test:execsql(sql)
     local x = "nosort"
-    if box.info.sql.sql_sort_count - sqlite_sort_count then
+    if box.stat.sql().sql_sort_count - sqlite_sort_count then
         x = "sort"
     end
     table.insert(data,x)
diff --git a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
index 57fbca6..bb8a498 100755
--- a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
+++ b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
@@ -5,9 +5,9 @@ test:plan(39)
 local function do_xfer_test(test, test_func, test_name, func, exp, opts)
     local opts = opts or {}
     local exp_xfer_count = opts.exp_xfer_count
-    local before = box.info.sql.sql_xfer_count
+    local before = box.stat.sql().sql_xfer_count
     test_func(test, test_name, func, exp)
-    local after = box.info.sql.sql_xfer_count
+    local after = box.stat.sql().sql_xfer_count
     test:is(after - before, exp_xfer_count,
                    test_name .. '-xfer-count')
 end
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 63c5d9b..05e2824 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -326,9 +326,9 @@ function test.do_select_tests(self, label, tests)
 end
 
 function test.sf_execsql(self, sql)
-    local old = box.info.sql.sql_search_count
+    local old = box.stat.sql().sql_search_count
     local r = test:execsql(sql)
-    local new = box.info.sql.sql_search_count - old
+    local new = box.stat.sql().sql_search_count - old
 
     return {new, r}
 end
diff --git a/test/sql-tap/minmax2.test.lua b/test/sql-tap/minmax2.test.lua
index e75709a..0e0f0d0 100755
--- a/test/sql-tap/minmax2.test.lua
+++ b/test/sql-tap/minmax2.test.lua
@@ -59,7 +59,7 @@ test:do_execsql_test(
 test:do_test(
     "minmax2-1.1",
     function()
-        sql_search_count = box.info.sql.sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT min(x) FROM t1"
     end, {
         -- <minmax2-1.1>
@@ -70,13 +70,13 @@ test:do_test(
 test:do_test(
     "minmax2-1.2",
     function()
-        return box.info.sql.sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
 test:do_test(
     "minmax2-1.3",
     function()
-        sql_search_count = box.info.sql.sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(x) FROM t1"
     end, {
         -- <minmax2-1.3>
@@ -87,14 +87,14 @@ test:do_test(
 test:do_test(
     "minmax2-1.4",
     function()
-        return box.info.sql.sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
 test:do_test(
     "minmax2-1.5",
     function()
         test:execsql "CREATE INDEX t1i1 ON t1(x DESC)"
-        sql_search_count = box.info.sql.sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT min(x) FROM t1"
     end, {
         -- <minmax2-1.5>
@@ -105,13 +105,13 @@ test:do_test(
 test:do_test(
     "minmax2-1.6",
     function()
-        return box.info.sql.sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 1)
 
 test:do_test(
     "minmax2-1.7",
     function()
-        sql_search_count = box.info.sql.sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(x) FROM t1"
     end, {
         -- <minmax2-1.7>
@@ -122,13 +122,13 @@ test:do_test(
 test:do_test(
     "minmax2-1.8",
     function()
-        return box.info.sql.sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
     "minmax2-1.9",
     function()
-        sql_search_count = box.info.sql.sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(y) FROM t1"
     end, {
         -- <minmax2-1.9>
@@ -139,7 +139,7 @@ test:do_test(
 test:do_test(
     "minmax2-1.10",
     function()
-        return box.info.sql.sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
 test:do_test(
@@ -149,7 +149,7 @@ test:do_test(
             CREATE TABLE t2(a INTEGER PRIMARY KEY, b INT );
             INSERT INTO t2 SELECT x, y FROM t1;
         ]]
-        sql_search_count = box.info.sql.sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT min(a) FROM t2"
     end, {
         -- <minmax2-2.0>
@@ -160,13 +160,13 @@ test:do_test(
 test:do_test(
     "minmax2-2.1",
     function()
-        return box.info.sql.sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
     "minmax2-2.2",
     function()
-        sql_search_count = box.info.sql.sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(a) FROM t2"
     end, {
         -- <minmax2-2.2>
@@ -177,7 +177,7 @@ test:do_test(
 test:do_test(
     "minmax2-2.3",
     function()
-        return box.info.sql.sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
@@ -186,7 +186,7 @@ test:do_test(
         test:execsql "INSERT INTO t2 VALUES((SELECT max(a) FROM t2)+1,999)"
 
 
-        sql_search_count = box.info.sql.sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(a) FROM t2"
     end, {
         -- <minmax2-3.0>
@@ -197,7 +197,7 @@ test:do_test(
 test:do_test(
     "minmax2-3.1",
     function()
-        return box.info.sql.sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
@@ -206,7 +206,7 @@ test:do_test(
         test:execsql "INSERT INTO t2 VALUES((SELECT max(a) FROM t2)+1,999)"
 
 
-        sql_search_count = box.info.sql.sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql " SELECT b FROM t2 WHERE a=(SELECT max(a) FROM t2) "
 
 
@@ -220,7 +220,7 @@ test:do_test(
 test:do_test(
     "minmax2-3.3",
     function()
-        return box.info.sql.sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 1)
 
 test:do_execsql_test(
diff --git a/test/sql-tap/minmax3.test.lua b/test/sql-tap/minmax3.test.lua
index 8cefd63..f1d9efc 100755
--- a/test/sql-tap/minmax3.test.lua
+++ b/test/sql-tap/minmax3.test.lua
@@ -24,9 +24,9 @@ test:plan(47)
 --
 
 local function count(sql)
-    local sql_search_count = box.info.sql.sql_search_count
+    local sql_search_count = box.stat.sql().sql_search_count
     local r = test:execsql(sql)
-    table.insert(r, box.info.sql.sql_search_count - sql_search_count)
+    table.insert(r, box.stat.sql().sql_search_count - sql_search_count)
     return r
 end
 
diff --git a/test/sql-tap/where2.test.lua b/test/sql-tap/where2.test.lua
index 831221c..4116ca9 100755
--- a/test/sql-tap/where2.test.lua
+++ b/test/sql-tap/where2.test.lua
@@ -62,10 +62,10 @@ test:do_test(
 -- Do an SQL statement.  Append the search count to the end of the result.
 --
 local function count(sql)
-    local sql_sort_count = box.info.sql.sql_sort_count
+    local sql_sort_count = box.stat.sql().sql_sort_count
     local r = test:execsql(sql)
-    print("lol "..(box.info.sql.sql_sort_count - sql_sort_count))
-    table.insert(r, box.info.sql.sql_sort_count - sql_sort_count)
+    print("lol "..(box.stat.sql().sql_sort_count - sql_sort_count))
+    table.insert(r, box.stat.sql().sql_sort_count - sql_sort_count)
     return r
 end
 
@@ -78,9 +78,9 @@ end
 --
 local function cksort(sql)
     local sort = "nosort"
-    local sql_sort_count = box.info.sql.sql_sort_count
+    local sql_sort_count = box.stat.sql().sql_sort_count
     local data = test:execsql(sql)
-    if sql_sort_count < box.info.sql.sql_sort_count then
+    if sql_sort_count < box.stat.sql().sql_sort_count then
             sort = 'sort'
     end
     table.insert(data, sort)
@@ -97,9 +97,9 @@ end
 --
 local function queryplan(sql)
     local sort = "nosort"
-    local sql_sort_count = box.info.sql.sql_sort_count
+    local sql_sort_count = box.stat.sql().sql_sort_count
     local data = test:execsql(sql)
-    if sql_sort_count < box.info.sql.sql_sort_count then
+    if sql_sort_count < box.stat.sql().sql_sort_count then
         sort = 'sort'
     end
     table.insert(data, sort)
diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
index 34d70ef..2c8cb45 100755
--- a/test/sql-tap/whereA.test.lua
+++ b/test/sql-tap/whereA.test.lua
@@ -193,9 +193,9 @@ test:do_test(
 -- Do an SQL statement.  Append the search count to the end of the result.
 --
 local function count(sql)
-    local sql_sort_count = box.info.sql.sql_sort_count
+    local sql_sort_count = box.stat.sql().sql_sort_count
     local r = test:execsql(sql)
-    table.insert(r, box.info.sql.sql_sort_count - sql_sort_count)
+    table.insert(r, box.stat.sql().sql_sort_count - sql_sort_count)
     return r
 end
 
diff --git a/test/sql-tap/whereD.test.lua b/test/sql-tap/whereD.test.lua
index 0973208..14dc8d3 100755
--- a/test/sql-tap/whereD.test.lua
+++ b/test/sql-tap/whereD.test.lua
@@ -234,10 +234,10 @@ local function do_searchcount_test(tn, sql, res)
     test:do_test(
         tn,
         function()
-            local sql_search_count = box.info.sql.sql_search_count
+            local sql_search_count = box.stat.sql().sql_search_count
             local r = test:execsql(sql)
             table.insert(r, "search")
-            table.insert(r, box.info.sql.sql_search_count - sql_search_count)
+            table.insert(r, box.stat.sql().sql_search_count - sql_search_count)
             return r
         end,
         res)
diff --git a/test/sql-tap/with2.test.lua b/test/sql-tap/with2.test.lua
index df6b0ec..48f7377 100755
--- a/test/sql-tap/with2.test.lua
+++ b/test/sql-tap/with2.test.lua
@@ -389,9 +389,9 @@ genstmt(255), {
 local function do_xfer_test(test, test_func, test_name, func, exp, opts)
     local opts = opts or {}
     local exp_xfer_count = opts.exp_xfer_count
-    local before = box.info.sql.sql_xfer_count
+    local before = box.stat.sql().sql_xfer_count
     test_func(test, test_name, func, exp)
-    local after = box.info.sql.sql_xfer_count
+    local after = box.stat.sql().sql_xfer_count
     test:is(after - before, exp_xfer_count,
                    test_name .. '-xfer-count')
 end


New patch:

commit 1e21fc73be5df524d500723bd3e47066475ee6b9
Author: Mergen Imeev <imeevma@gmail.com>
Date:   Thu Jan 31 14:09:51 2019 +0300

    sql: remove box.sql.debug()
    
    Due to removing of box.sql.execute() it makes sense to remove
    box.sql.debug() and move SQL statistics to box.stat.
    
    Part or #3505

diff --git a/src/box/lua/sql.c b/src/box/lua/sql.c
index ee20faa..cd6e75c 100644
--- a/src/box/lua/sql.c
+++ b/src/box/lua/sql.c
@@ -110,21 +110,11 @@ sqlerror:
 	return lua_error(L);
 }
 
-static int
-lua_sql_debug(struct lua_State *L)
-{
-	struct info_handler info;
-	luaT_info_handler_create(&info, L);
-	sql_debug_info(&info);
-	return 1;
-}
-
 void
 box_lua_sql_init(struct lua_State *L)
 {
 	static const struct luaL_Reg module_funcs [] = {
 		{"execute", lua_sql_execute},
-		{"debug", lua_sql_debug},
 		{NULL, NULL}
 	};
 
diff --git a/src/box/lua/stat.c b/src/box/lua/stat.c
index 1015253..ce0e9e9 100644
--- a/src/box/lua/stat.c
+++ b/src/box/lua/stat.c
@@ -42,6 +42,7 @@
 #include "box/iproto.h"
 #include "box/engine.h"
 #include "box/vinyl.h"
+#include "box/sql.h"
 #include "info/info.h"
 #include "lua/info.h"
 #include "lua/utils.h"
@@ -160,6 +161,15 @@ lbox_stat_net_call(struct lua_State *L)
 	return 1;
 }
 
+static int
+lbox_stat_sql(struct lua_State *L)
+{
+	struct info_handler info;
+	luaT_info_handler_create(&info, L);
+	sql_debug_info(&info);
+	return 1;
+}
+
 static const struct luaL_Reg lbox_stat_meta [] = {
 	{"__index", lbox_stat_index},
 	{"__call",  lbox_stat_call},
@@ -179,6 +189,7 @@ box_lua_stat_init(struct lua_State *L)
 	static const struct luaL_Reg statlib [] = {
 		{"vinyl", lbox_stat_vinyl},
 		{"reset", lbox_stat_reset},
+		{"sql", lbox_stat_sql},
 		{NULL, NULL}
 	};
 
diff --git a/test/sql-tap/analyze3.test.lua b/test/sql-tap/analyze3.test.lua
index 1396287..dcbea1d 100755
--- a/test/sql-tap/analyze3.test.lua
+++ b/test/sql-tap/analyze3.test.lua
@@ -48,15 +48,6 @@ testprefix = "analyze3"
 --               have been fixed.
 --
 
-local function eqp(sql)
-    return test:execsql("EXPLAIN QUERY PLAN"..sql)
-end
-
-local function sf_execsql(sql, db)
-    r = test:execsql(sql)
-    return {box.sql.debug().sql_search_count, r}
-end
-
 ---------------------------------------------------------------------------
 --
 -- analyze3-1.1.1: 
diff --git a/test/sql-tap/between.test.lua b/test/sql-tap/between.test.lua
index d56de4e..1663e39 100755
--- a/test/sql-tap/between.test.lua
+++ b/test/sql-tap/between.test.lua
@@ -51,10 +51,10 @@ test:do_test(
 -- is done.  Then it appends the names of the table and index used.
 --
 local function queryplan(sql)
-    local sql_sort_count = box.sql.debug().sql_sort_count
+    local sqlite_sort_count = box.stat.sql().sql_sort_count
     local data = test:execsql(sql)
     local x = "nosort"
-    if box.sql.debug().sql_sort_count - sql_sort_count then
+    if box.stat.sql().sql_sort_count - sqlite_sort_count then
         x = "sort"
     end
     table.insert(data,x)
diff --git a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
index 80a2a2d..bb8a498 100755
--- a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
+++ b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
@@ -5,9 +5,9 @@ test:plan(39)
 local function do_xfer_test(test, test_func, test_name, func, exp, opts)
     local opts = opts or {}
     local exp_xfer_count = opts.exp_xfer_count
-    local before = box.sql.debug().sql_xfer_count
+    local before = box.stat.sql().sql_xfer_count
     test_func(test, test_name, func, exp)
-    local after = box.sql.debug().sql_xfer_count
+    local after = box.stat.sql().sql_xfer_count
     test:is(after - before, exp_xfer_count,
                    test_name .. '-xfer-count')
 end
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 8aac64c..05e2824 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -326,9 +326,9 @@ function test.do_select_tests(self, label, tests)
 end
 
 function test.sf_execsql(self, sql)
-    local old = box.sql.debug().sql_search_count
+    local old = box.stat.sql().sql_search_count
     local r = test:execsql(sql)
-    local new = box.sql.debug().sql_search_count - old
+    local new = box.stat.sql().sql_search_count - old
 
     return {new, r}
 end
diff --git a/test/sql-tap/minmax2.test.lua b/test/sql-tap/minmax2.test.lua
index a6f840d..0e0f0d0 100755
--- a/test/sql-tap/minmax2.test.lua
+++ b/test/sql-tap/minmax2.test.lua
@@ -59,7 +59,7 @@ test:do_execsql_test(
 test:do_test(
     "minmax2-1.1",
     function()
-        sql_search_count = box.sql.debug().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT min(x) FROM t1"
     end, {
         -- <minmax2-1.1>
@@ -70,13 +70,13 @@ test:do_test(
 test:do_test(
     "minmax2-1.2",
     function()
-        return box.sql.debug().sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
 test:do_test(
     "minmax2-1.3",
     function()
-        sql_search_count = box.sql.debug().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(x) FROM t1"
     end, {
         -- <minmax2-1.3>
@@ -87,14 +87,14 @@ test:do_test(
 test:do_test(
     "minmax2-1.4",
     function()
-        return box.sql.debug().sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
 test:do_test(
     "minmax2-1.5",
     function()
         test:execsql "CREATE INDEX t1i1 ON t1(x DESC)"
-        sql_search_count = box.sql.debug().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT min(x) FROM t1"
     end, {
         -- <minmax2-1.5>
@@ -105,13 +105,13 @@ test:do_test(
 test:do_test(
     "minmax2-1.6",
     function()
-        return box.sql.debug().sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 1)
 
 test:do_test(
     "minmax2-1.7",
     function()
-        sql_search_count = box.sql.debug().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(x) FROM t1"
     end, {
         -- <minmax2-1.7>
@@ -122,13 +122,13 @@ test:do_test(
 test:do_test(
     "minmax2-1.8",
     function()
-        return box.sql.debug().sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
     "minmax2-1.9",
     function()
-        sql_search_count = box.sql.debug().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(y) FROM t1"
     end, {
         -- <minmax2-1.9>
@@ -139,7 +139,7 @@ test:do_test(
 test:do_test(
     "minmax2-1.10",
     function()
-        return box.sql.debug().sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
 test:do_test(
@@ -149,7 +149,7 @@ test:do_test(
             CREATE TABLE t2(a INTEGER PRIMARY KEY, b INT );
             INSERT INTO t2 SELECT x, y FROM t1;
         ]]
-        sql_search_count = box.sql.debug().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT min(a) FROM t2"
     end, {
         -- <minmax2-2.0>
@@ -160,13 +160,13 @@ test:do_test(
 test:do_test(
     "minmax2-2.1",
     function()
-        return box.sql.debug().sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
     "minmax2-2.2",
     function()
-        sql_search_count = box.sql.debug().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(a) FROM t2"
     end, {
         -- <minmax2-2.2>
@@ -177,7 +177,7 @@ test:do_test(
 test:do_test(
     "minmax2-2.3",
     function()
-        return box.sql.debug().sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
@@ -186,7 +186,7 @@ test:do_test(
         test:execsql "INSERT INTO t2 VALUES((SELECT max(a) FROM t2)+1,999)"
 
 
-        sql_search_count = box.sql.debug().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql "SELECT max(a) FROM t2"
     end, {
         -- <minmax2-3.0>
@@ -197,7 +197,7 @@ test:do_test(
 test:do_test(
     "minmax2-3.1",
     function()
-        return box.sql.debug().sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 0)
 
 test:do_test(
@@ -206,7 +206,7 @@ test:do_test(
         test:execsql "INSERT INTO t2 VALUES((SELECT max(a) FROM t2)+1,999)"
 
 
-        sql_search_count = box.sql.debug().sql_search_count
+        sql_search_count = box.stat.sql().sql_search_count
         return test:execsql " SELECT b FROM t2 WHERE a=(SELECT max(a) FROM t2) "
 
 
@@ -220,7 +220,7 @@ test:do_test(
 test:do_test(
     "minmax2-3.3",
     function()
-        return box.sql.debug().sql_search_count - sql_search_count
+        return box.stat.sql().sql_search_count - sql_search_count
     end, 1)
 
 test:do_execsql_test(
diff --git a/test/sql-tap/minmax3.test.lua b/test/sql-tap/minmax3.test.lua
index 3707575..f1d9efc 100755
--- a/test/sql-tap/minmax3.test.lua
+++ b/test/sql-tap/minmax3.test.lua
@@ -24,9 +24,9 @@ test:plan(47)
 --
 
 local function count(sql)
-    local sql_search_count = box.sql.debug().sql_search_count
+    local sql_search_count = box.stat.sql().sql_search_count
     local r = test:execsql(sql)
-    table.insert(r, box.sql.debug().sql_search_count - sql_search_count)
+    table.insert(r, box.stat.sql().sql_search_count - sql_search_count)
     return r
 end
 
diff --git a/test/sql-tap/where2.test.lua b/test/sql-tap/where2.test.lua
index 8eaf405..4116ca9 100755
--- a/test/sql-tap/where2.test.lua
+++ b/test/sql-tap/where2.test.lua
@@ -62,10 +62,10 @@ test:do_test(
 -- Do an SQL statement.  Append the search count to the end of the result.
 --
 local function count(sql)
-    local sql_sort_count = box.sql.debug().sql_sort_count
+    local sql_sort_count = box.stat.sql().sql_sort_count
     local r = test:execsql(sql)
-    print("lol "..(box.sql.debug().sql_sort_count - sql_sort_count))
-    table.insert(r, box.sql.debug().sql_sort_count - sql_sort_count)
+    print("lol "..(box.stat.sql().sql_sort_count - sql_sort_count))
+    table.insert(r, box.stat.sql().sql_sort_count - sql_sort_count)
     return r
 end
 
@@ -78,9 +78,9 @@ end
 --
 local function cksort(sql)
     local sort = "nosort"
-    local sql_sort_count = box.sql.debug().sql_sort_count
+    local sql_sort_count = box.stat.sql().sql_sort_count
     local data = test:execsql(sql)
-    if sql_sort_count < box.sql.debug().sql_sort_count then
+    if sql_sort_count < box.stat.sql().sql_sort_count then
             sort = 'sort'
     end
     table.insert(data, sort)
@@ -97,9 +97,9 @@ end
 --
 local function queryplan(sql)
     local sort = "nosort"
-    local sql_sort_count = box.sql.debug().sql_sort_count
+    local sql_sort_count = box.stat.sql().sql_sort_count
     local data = test:execsql(sql)
-    if sql_sort_count < box.sql.debug().sql_sort_count then
+    if sql_sort_count < box.stat.sql().sql_sort_count then
         sort = 'sort'
     end
     table.insert(data, sort)
diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
index b4a0f0a..2c8cb45 100755
--- a/test/sql-tap/whereA.test.lua
+++ b/test/sql-tap/whereA.test.lua
@@ -193,9 +193,9 @@ test:do_test(
 -- Do an SQL statement.  Append the search count to the end of the result.
 --
 local function count(sql)
-    local sql_sort_count = box.sql.debug().sql_sort_count
+    local sql_sort_count = box.stat.sql().sql_sort_count
     local r = test:execsql(sql)
-    table.insert(r, box.sql.debug().sql_sort_count - sql_sort_count)
+    table.insert(r, box.stat.sql().sql_sort_count - sql_sort_count)
     return r
 end
 
diff --git a/test/sql-tap/whereD.test.lua b/test/sql-tap/whereD.test.lua
index b103f3c..14dc8d3 100755
--- a/test/sql-tap/whereD.test.lua
+++ b/test/sql-tap/whereD.test.lua
@@ -234,10 +234,10 @@ local function do_searchcount_test(tn, sql, res)
     test:do_test(
         tn,
         function()
-            local sql_search_count = box.sql.debug().sql_search_count
+            local sql_search_count = box.stat.sql().sql_search_count
             local r = test:execsql(sql)
             table.insert(r, "search")
-            table.insert(r, box.sql.debug().sql_search_count - sql_search_count)
+            table.insert(r, box.stat.sql().sql_search_count - sql_search_count)
             return r
         end,
         res)
diff --git a/test/sql-tap/with2.test.lua b/test/sql-tap/with2.test.lua
index ca3f00e..48f7377 100755
--- a/test/sql-tap/with2.test.lua
+++ b/test/sql-tap/with2.test.lua
@@ -389,9 +389,9 @@ genstmt(255), {
 local function do_xfer_test(test, test_func, test_name, func, exp, opts)
     local opts = opts or {}
     local exp_xfer_count = opts.exp_xfer_count
-    local before = box.sql.debug().sql_xfer_count
+    local before = box.stat.sql().sql_xfer_count
     test_func(test, test_name, func, exp)
-    local after = box.sql.debug().sql_xfer_count
+    local after = box.stat.sql().sql_xfer_count
     test:is(after - before, exp_xfer_count,
                    test_name .. '-xfer-count')
 end

  reply	other threads:[~2019-03-25 19:39 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22 10:50 [tarantool-patches] [PATCH v9 0/7] sql: remove box.sql.execute imeevma
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 1/7] sql: add column name to SQL change counter imeevma
2019-03-22 15:42   ` [tarantool-patches] " Konstantin Osipov
2019-03-25 19:34     ` Mergen Imeev
2019-03-29 12:00   ` Kirill Yukhin
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 2/7] sql: fix error code for SQL errors in execute.c imeevma
2019-03-22 15:45   ` [tarantool-patches] " Konstantin Osipov
2019-03-26 21:48   ` Vladislav Shpilevoy
2019-03-27 11:43     ` Konstantin Osipov
2019-03-28 17:46     ` Mergen Imeev
2019-03-29 12:01   ` Kirill Yukhin
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 3/7] sql: remove box.sql.debug() imeevma
2019-03-22 15:46   ` [tarantool-patches] " Konstantin Osipov
2019-03-25 19:39     ` Mergen Imeev [this message]
2019-03-26 21:48       ` Vladislav Shpilevoy
2019-03-28 17:48         ` Mergen Imeev
2019-03-28 18:01           ` Vladislav Shpilevoy
2019-03-29 12:02   ` Kirill Yukhin
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 4/7] lua: remove exceptions from function luaL_tofield() imeevma
2019-03-22 15:53   ` [tarantool-patches] " Konstantin Osipov
2019-03-29 19:26     ` Vladislav Shpilevoy
2019-03-26 21:48   ` Vladislav Shpilevoy
2019-03-28 17:54     ` Mergen Imeev
2019-03-28 18:40       ` Vladislav Shpilevoy
2019-03-28 19:56         ` Mergen Imeev
2019-03-28 21:41           ` Mergen Imeev
2019-03-29 21:06           ` Vladislav Shpilevoy
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 5/7] iproto: create port_sql imeevma
2019-03-22 15:55   ` [tarantool-patches] " Konstantin Osipov
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 6/7] sql: create box.execute() imeevma
2019-03-22 15:57   ` [tarantool-patches] " Konstantin Osipov
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 7/7] sql: remove box.sql.execute() imeevma
2019-03-26 21:48   ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-28 20:13     ` Mergen Imeev
2019-03-29 21:06       ` Vladislav Shpilevoy
2019-03-29 21:07 ` [tarantool-patches] Re: [PATCH v9 0/7] sql: remove box.sql.execute Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190325193952.GB11766@tarantool.org \
    --to=imeevma@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH v9 3/7] sql: remove box.sql.debug()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox