File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -192,4 +192,11 @@ DROP TABLE t1;
192
192
connection default;
193
193
disconnect c1;
194
194
set @@global.max_tmp_total_space_usage=@save_max_tmp_total_space_usage;
195
+ #
196
+ # MDEV-34054
197
+ # Memory leak in Window_func_runner::exec after encountering
198
+ # "temporary space limit reached" error
199
+ SET max_tmp_session_space_usage= 64*1024;
200
+ SELECT MIN(VARIABLE_VALUE) OVER (), NTILE(1) OVER (), MAX(VARIABLE_NAME) OVER () FROM information_schema.SESSION_STATUS;
201
+ ERROR HY000: Local temporary space limit reached
195
202
# End of 11.5 tests
Original file line number Diff line number Diff line change @@ -250,4 +250,13 @@ connection default;
250
250
disconnect c1;
251
251
set @@global.max_tmp_total_space_usage=@save_max_tmp_total_space_usage;
252
252
253
+ --echo #
254
+ --echo # MDEV-34054
255
+ --echo # Memory leak in Window_func_runner::exec after encountering
256
+ --echo # "temporary space limit reached" error
257
+
258
+ SET max_tmp_session_space_usage= 64*1024;
259
+ --error 200
260
+ SELECT MIN(VARIABLE_VALUE) OVER (), NTILE(1) OVER (), MAX(VARIABLE_NAME) OVER () FROM information_schema.SESSION_STATUS;
261
+
253
262
--echo # End of 11.5 tests
Original file line number Diff line number Diff line change @@ -2859,6 +2859,7 @@ bool compute_window_func(THD *thd,
2859
2859
{
2860
2860
List_iterator_fast<Item_window_func> iter_win_funcs (window_functions);
2861
2861
List_iterator_fast<Cursor_manager> iter_cursor_managers (cursor_managers);
2862
+ bool ret= false ;
2862
2863
uint err;
2863
2864
2864
2865
READ_RECORD info;
@@ -2921,27 +2922,35 @@ bool compute_window_func(THD *thd,
2921
2922
/* Check if we found any error in the window function while adding values
2922
2923
through cursors. */
2923
2924
if (unlikely (thd->is_error () || thd->is_killed ()))
2925
+ {
2926
+ ret= true ;
2924
2927
break ;
2928
+ }
2925
2929
2926
2930
/* Return to current row after notifying cursors for each window
2927
2931
function. */
2928
2932
if (tbl->file ->ha_rnd_pos (tbl->record [0 ], rowid_buf))
2929
- return true ;
2933
+ {
2934
+ ret= true ;
2935
+ break ;
2936
+ }
2930
2937
}
2931
2938
2932
2939
/* We now have computed values for each window function. They can now
2933
2940
be saved in the current row. */
2934
2941
if (save_window_function_values (window_functions, tbl, rowid_buf))
2935
- return true ;
2936
-
2942
+ {
2943
+ ret= true ;
2944
+ break ;
2945
+ }
2937
2946
rownum++;
2938
2947
}
2939
2948
2940
2949
my_free (rowid_buf);
2941
2950
partition_trackers.delete_elements ();
2942
2951
end_read_record (&info);
2943
2952
2944
- return false ;
2953
+ return ret ;
2945
2954
}
2946
2955
2947
2956
/* Make a list that is a concation of two lists of ORDER elements */
You can’t perform that action at this time.
0 commit comments