Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Mergen Imeev <imeevma@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v1 1/1] sql: do not reset region on select
Date: Wed, 23 Dec 2020 15:58:13 +0100	[thread overview]
Message-ID: <33827e0c-34fb-8ea6-226c-7529669f1fdd@tarantool.org> (raw)
In-Reply-To: <20201222193039.GA293899@tarantool.org>

Hi! Thanks for the fixes!

Consider below some review fixes, which I also pushed on top
of the branch in a separate commit. Please, review, and if
you agree, then squash and proceed to a second review with LGTM
from me.

Talking of your findings about region being used only by vinyl,
I think it is worth dropping these RO statements entirely then.
But better do it in scope of
https://github.com/tarantool/tarantool/issues/5501, if it will
be even possible.

====================
diff --git a/test/sql/gh-5427-lua-func-changes-result.result b/test/sql/gh-5427-lua-func-changes-result.result
index 25a958bc2..7175ea78a 100644
--- a/test/sql/gh-5427-lua-func-changes-result.result
+++ b/test/sql/gh-5427-lua-func-changes-result.result
@@ -22,82 +22,57 @@ test_run:cmd("setopt delimiter ';'");
  | - true
  | ...
 box.schema.func.create('CORRUPT_SELECT', {
-    language = 'LUA',
     returns = 'integer',
     body = [[
-        function(x)
+        function()
             box.space.T:select()
             return 1
         end]],
-    is_sandboxed = false,
-    param_list = { "string" },
-    exports = { 'LUA', 'SQL' },
-    is_deterministic = false,
-    if_not_exists = true
+    exports = {'LUA', 'SQL'},
 });
  | ---
  | ...
 box.schema.func.create('CORRUPT_GET', {
-    language = 'LUA',
     returns = 'integer',
     body = [[
-        function(x)
+        function()
             box.space.T:get('aaaaaaaaaaaa')
             return 1
         end]],
-    is_sandboxed = false,
-    param_list = { "string" },
-    exports = { 'LUA', 'SQL' },
-    is_deterministic = false,
-    if_not_exists = true
+    exports = {'LUA', 'SQL'},
 });
  | ---
  | ...
 box.schema.func.create('CORRUPT_COUNT', {
-    language = 'LUA',
     returns = 'integer',
     body = [[
-        function(x)
+        function()
             box.space.T:count()
             return 1
         end]],
-    is_sandboxed = false,
-    param_list = { "string" },
-    exports = { 'LUA', 'SQL' },
-    is_deterministic = false,
-    if_not_exists = true
+    exports = {'LUA', 'SQL'},
 });
  | ---
  | ...
 box.schema.func.create('CORRUPT_MAX', {
-    language = 'LUA',
     returns = 'integer',
     body = [[
-        function(x)
+        function()
             box.space.T.index[0]:max()
             return 1
         end]],
-    is_sandboxed = false,
-    param_list = { "string" },
-    exports = { 'LUA', 'SQL' },
-    is_deterministic = false,
-    if_not_exists = true
+    exports = {'LUA', 'SQL'},
 });
  | ---
  | ...
 box.schema.func.create('CORRUPT_MIN', {
-    language = 'LUA',
     returns = 'integer',
     body = [[
-        function(x)
+        function()
             box.space.T.index[0]:min()
             return 1
         end]],
-    is_sandboxed = false,
-    param_list = { "string" },
-    exports = { 'LUA', 'SQL' },
-    is_deterministic = false,
-    if_not_exists = true
+    exports = {'LUA', 'SQL'},
 });
  | ---
  | ...
@@ -109,7 +84,7 @@ test_run:cmd("setopt delimiter ''");
 values = {"aaaaaaaaaaaa", "aaaaaaaaaaaa"}
  | ---
  | ...
-query = [[select %s(t.b) from t where t.b = ? and t.b <= ? order by t.b;]]
+query = [[select %s() from t where t.b = ? and t.b <= ? order by t.b;]]
  | ---
  | ...
 box.execute(string.format(query, 'CORRUPT_SELECT'), values)
@@ -157,18 +132,18 @@ box.execute([[DROP TABLE t;]])
  | - row_count: 1
  | ...
 
-_ = box.space._func.index['name']:delete('CORRUPT_SELECT')
+box.func.CORRUPT_SELECT:drop()
  | ---
  | ...
-_ = box.space._func.index['name']:delete('CORRUPT_GET')
+box.func.CORRUPT_GET:drop()
  | ---
  | ...
-_ = box.space._func.index['name']:delete('CORRUPT_COUNT')
+box.func.CORRUPT_COUNT:drop()
  | ---
  | ...
-_ = box.space._func.index['name']:delete('CORRUPT_MAX')
+box.func.CORRUPT_MAX:drop()
  | ---
  | ...
-_ = box.space._func.index['name']:delete('CORRUPT_MIN')
+box.func.CORRUPT_MIN:drop()
  | ---
  | ...
diff --git a/test/sql/gh-5427-lua-func-changes-result.test.lua b/test/sql/gh-5427-lua-func-changes-result.test.lua
index 98959de0b..edbbc9ee4 100644
--- a/test/sql/gh-5427-lua-func-changes-result.test.lua
+++ b/test/sql/gh-5427-lua-func-changes-result.test.lua
@@ -6,79 +6,54 @@ box.execute([[CREATE TABLE t (b STRING PRIMARY KEY);]])
 box.execute([[INSERT INTO t VALUES ('aaaaaaaaaaaa');]])
 test_run:cmd("setopt delimiter ';'");
 box.schema.func.create('CORRUPT_SELECT', {
-    language = 'LUA',
     returns = 'integer',
     body = [[
-        function(x)
+        function()
             box.space.T:select()
             return 1
         end]],
-    is_sandboxed = false,
-    param_list = { "string" },
-    exports = { 'LUA', 'SQL' },
-    is_deterministic = false,
-    if_not_exists = true
+    exports = {'LUA', 'SQL'},
 });
 box.schema.func.create('CORRUPT_GET', {
-    language = 'LUA',
     returns = 'integer',
     body = [[
-        function(x)
+        function()
             box.space.T:get('aaaaaaaaaaaa')
             return 1
         end]],
-    is_sandboxed = false,
-    param_list = { "string" },
-    exports = { 'LUA', 'SQL' },
-    is_deterministic = false,
-    if_not_exists = true
+    exports = {'LUA', 'SQL'},
 });
 box.schema.func.create('CORRUPT_COUNT', {
-    language = 'LUA',
     returns = 'integer',
     body = [[
-        function(x)
+        function()
             box.space.T:count()
             return 1
         end]],
-    is_sandboxed = false,
-    param_list = { "string" },
-    exports = { 'LUA', 'SQL' },
-    is_deterministic = false,
-    if_not_exists = true
+    exports = {'LUA', 'SQL'},
 });
 box.schema.func.create('CORRUPT_MAX', {
-    language = 'LUA',
     returns = 'integer',
     body = [[
-        function(x)
+        function()
             box.space.T.index[0]:max()
             return 1
         end]],
-    is_sandboxed = false,
-    param_list = { "string" },
-    exports = { 'LUA', 'SQL' },
-    is_deterministic = false,
-    if_not_exists = true
+    exports = {'LUA', 'SQL'},
 });
 box.schema.func.create('CORRUPT_MIN', {
-    language = 'LUA',
     returns = 'integer',
     body = [[
-        function(x)
+        function()
             box.space.T.index[0]:min()
             return 1
         end]],
-    is_sandboxed = false,
-    param_list = { "string" },
-    exports = { 'LUA', 'SQL' },
-    is_deterministic = false,
-    if_not_exists = true
+    exports = {'LUA', 'SQL'},
 });
 test_run:cmd("setopt delimiter ''");
 
 values = {"aaaaaaaaaaaa", "aaaaaaaaaaaa"}
-query = [[select %s(t.b) from t where t.b = ? and t.b <= ? order by t.b;]]
+query = [[select %s() from t where t.b = ? and t.b <= ? order by t.b;]]
 box.execute(string.format(query, 'CORRUPT_SELECT'), values)
 box.execute(string.format(query, 'CORRUPT_GET'), values)
 box.execute(string.format(query, 'CORRUPT_COUNT'), values)
@@ -86,8 +61,8 @@ box.execute(string.format(query, 'CORRUPT_MAX'), values)
 box.execute(string.format(query, 'CORRUPT_MIN'), values)
 box.execute([[DROP TABLE t;]])
 
-_ = box.space._func.index['name']:delete('CORRUPT_SELECT')
-_ = box.space._func.index['name']:delete('CORRUPT_GET')
-_ = box.space._func.index['name']:delete('CORRUPT_COUNT')
-_ = box.space._func.index['name']:delete('CORRUPT_MAX')
-_ = box.space._func.index['name']:delete('CORRUPT_MIN')
+box.func.CORRUPT_SELECT:drop()
+box.func.CORRUPT_GET:drop()
+box.func.CORRUPT_COUNT:drop()
+box.func.CORRUPT_MAX:drop()
+box.func.CORRUPT_MIN:drop()

  reply	other threads:[~2020-12-23 14:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02  9:49 imeevma
2020-11-04 22:14 ` Vladislav Shpilevoy
2020-12-16  5:34   ` Mergen Imeev
2020-12-17 22:04     ` Vladislav Shpilevoy
2020-12-22 19:30       ` Mergen Imeev
2020-12-23 14:58         ` Vladislav Shpilevoy [this message]
2020-12-23 19:20           ` Mergen Imeev
2020-12-23 19:15 imeevma
2020-12-24 10:48 ` Nikita Pettik
2020-12-24 10:58   ` Nikita Pettik

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=33827e0c-34fb-8ea6-226c-7529669f1fdd@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 1/1] sql: do not reset region on select' \
    /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