[Tarantool-patches] [PATCH v1 1/1] sql: do not reset region on select
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Wed Dec 23 17:58:13 MSK 2020
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()
More information about the Tarantool-patches
mailing list