From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 1762E4765E0 for ; Wed, 23 Dec 2020 17:58:15 +0300 (MSK) References: <46f1c499-b84b-7c4a-d8a1-189d3c5965d9@tarantool.org> <20201216053456.GA526090@tarantool.org> <60e8b082-4678-4e02-13e0-22ad74cc1c91@tarantool.org> <20201222193039.GA293899@tarantool.org> From: Vladislav Shpilevoy Message-ID: <33827e0c-34fb-8ea6-226c-7529669f1fdd@tarantool.org> Date: Wed, 23 Dec 2020 15:58:13 +0100 MIME-Version: 1.0 In-Reply-To: <20201222193039.GA293899@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v1 1/1] sql: do not reset region on select List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mergen Imeev Cc: tarantool-patches@dev.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()