Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions mysql-test/main/set_statement_notembedded.result
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ Max_statement_time_exceeded 1
SELECT @@MAX_STATEMENT_TIME;
@@MAX_STATEMENT_TIME
0.000000
#
# MDEV-31209 Queries with window functions do not obey KILL / max_statement_time
#
create table t (i int);
insert into t values(1),(2),(3);
set statement max_statement_time=0.03 for select max(sleep(0.1)) over( ) from t;
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
drop table t;
# End of 10.11 tests
10 changes: 10 additions & 0 deletions mysql-test/main/set_statement_notembedded.test
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,14 @@ SET STATEMENT MAX_STATEMENT_TIME=1 FOR SELECT SLEEP(10);
SHOW STATUS LIKE "max_statement_time_exceeded";
SELECT @@MAX_STATEMENT_TIME;

--echo #
--echo # MDEV-31209 Queries with window functions do not obey KILL / max_statement_time
--echo #

create table t (i int);
insert into t values(1),(2),(3);
--error ER_STATEMENT_TIMEOUT
set statement max_statement_time=0.03 for select max(sleep(0.1)) over( ) from t;
drop table t;

--echo # End of 10.11 tests
4 changes: 3 additions & 1 deletion sql/sql_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2255,6 +2255,7 @@ class Frame_scan_cursor : public Frame_cursor
between them, top bound row and bottom bound row inclusive. */
void compute_values_for_current_row()
{
THD *thd= current_thd;
if (top_bound.is_outside_computation_bounds() ||
bottom_bound.is_outside_computation_bounds())
return;
Expand All @@ -2265,7 +2266,8 @@ class Frame_scan_cursor : public Frame_cursor

cursor.move_to(start_rownum);

for (ha_rows idx= start_rownum; idx <= bottom_rownum; idx++)
for (ha_rows idx= start_rownum; idx <= bottom_rownum
&& !thd->check_killed(true); idx++)
{
if (cursor.fetch()) //EOF
break;
Expand Down