Commit 7d1467e9 authored by Monty's avatar Monty Committed by Sergei Golubchik

MDEV-34054 Memory leak in Window_func_runner::exec after encountering...

MDEV-34054 Memory leak in Window_func_runner::exec after encountering "temporary space limit reached" error
parent 178ab560
......@@ -192,4 +192,11 @@ DROP TABLE t1;
connection default;
disconnect c1;
set @@global.max_tmp_total_space_usage=@save_max_tmp_total_space_usage;
#
# MDEV-34054
# Memory leak in Window_func_runner::exec after encountering
# "temporary space limit reached" error
SET max_tmp_session_space_usage= 64*1024;
SELECT MIN(VARIABLE_VALUE) OVER (), NTILE(1) OVER (), MAX(VARIABLE_NAME) OVER () FROM information_schema.SESSION_STATUS;
ERROR HY000: Local temporary space limit reached
# End of 11.5 tests
......@@ -250,4 +250,13 @@ connection default;
disconnect c1;
set @@global.max_tmp_total_space_usage=@save_max_tmp_total_space_usage;
--echo #
--echo # MDEV-34054
--echo # Memory leak in Window_func_runner::exec after encountering
--echo # "temporary space limit reached" error
SET max_tmp_session_space_usage= 64*1024;
--error 200
SELECT MIN(VARIABLE_VALUE) OVER (), NTILE(1) OVER (), MAX(VARIABLE_NAME) OVER () FROM information_schema.SESSION_STATUS;
--echo # End of 11.5 tests
......@@ -2859,6 +2859,7 @@ bool compute_window_func(THD *thd,
{
List_iterator_fast<Item_window_func> iter_win_funcs(window_functions);
List_iterator_fast<Cursor_manager> iter_cursor_managers(cursor_managers);
bool ret= false;
uint err;
READ_RECORD info;
......@@ -2921,19 +2922,27 @@ bool compute_window_func(THD *thd,
/* Check if we found any error in the window function while adding values
through cursors. */
if (unlikely(thd->is_error() || thd->is_killed()))
{
ret= true;
break;
}
/* Return to current row after notifying cursors for each window
function. */
if (tbl->file->ha_rnd_pos(tbl->record[0], rowid_buf))
return true;
{
ret= true;
break;
}
}
/* We now have computed values for each window function. They can now
be saved in the current row. */
if (save_window_function_values(window_functions, tbl, rowid_buf))
return true;
{
ret= true;
break;
}
rownum++;
}
......@@ -2941,7 +2950,7 @@ bool compute_window_func(THD *thd,
partition_trackers.delete_elements();
end_read_record(&info);
return false;
return ret;
}
/* Make a list that is a concation of two lists of ORDER elements */
......
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