Commit 1b00edc4 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-7011: MAX_STATEMENT_TIME has no effect in a procedure after a previous successful statement

Do not reset timer inside stored procedures and functions.
parent 34e01f80
......@@ -147,3 +147,33 @@ SELECT RELEASE_LOCK('lock');
RELEASE_LOCK('lock')
1
DROP TABLE t1;
#
# MDEV-7011:MAX_STATEMENT_TIME has no effect in a procedure after
# a previous successful statement
#
create table t1 (i int);
insert into t1 values (1),(2),(3),(4);
insert into t1 select a.* from t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g;
create procedure pr()
begin
select 1;
select sql_no_cache * from t1 where i > 5;
select sql_no_cache * from t1 where i > 5;
end |
set max_statement_time = 0.001;
call pr();
1
1
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
drop procedure pr;
create procedure pr()
begin
select sql_no_cache * from t1 where i > 5;
select sql_no_cache * from t1 where i > 5;
end |
set max_statement_time = 0.001;
call pr();
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
set max_statement_time = 0;
drop procedure pr;
drop table t1;
......@@ -187,3 +187,36 @@ disconnect con1;
connection default;
SELECT RELEASE_LOCK('lock');
DROP TABLE t1;
--echo #
--echo # MDEV-7011:MAX_STATEMENT_TIME has no effect in a procedure after
--echo # a previous successful statement
--echo #
create table t1 (i int);
insert into t1 values (1),(2),(3),(4);
insert into t1 select a.* from t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g;
delimiter |;
create procedure pr()
begin
select 1;
select sql_no_cache * from t1 where i > 5;
select sql_no_cache * from t1 where i > 5;
end |
delimiter ;|
set max_statement_time = 0.001;
--error ER_STATEMENT_TIMEOUT
call pr();
drop procedure pr;
delimiter |;
create procedure pr()
begin
select sql_no_cache * from t1 where i > 5;
select sql_no_cache * from t1 where i > 5;
end |
delimiter ;|
set max_statement_time = 0.001;
--error ER_STATEMENT_TIMEOUT
call pr();
set max_statement_time = 0;
drop procedure pr;
drop table t1;
......@@ -3966,6 +3966,8 @@ public:
void reset_query_timer()
{
#ifndef EMBEDDED_LIBRARY
if (spcont || in_sub_stmt || slave_thread)
return;
if (!query_timer.expired)
thr_timer_end(&query_timer);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment