Commit d8eab976 authored by unknown's avatar unknown

Bug#31590: Wrong error message on sort buffer being too small.

The out of memory error was thrown when the sort buffer size were too small.
This led to a user confusion.

Now filesort throws the error message about sort buffer being too small.


mysql-test/t/order_by.test:
  Added a test case for the bug#31590: Wrong error message on sort buffer being too small.
mysql-test/r/order_by.result:
  Added a test case for the bug#31590: Wrong error message on sort buffer being too small.
sql/filesort.cc:
  Bug#31590: Wrong error message on sort buffer being too small.
  Now filesort throws the error message about sort buffer being too small
  instead of out of memory error.
parent 1919d238
...@@ -1064,3 +1064,15 @@ a b ...@@ -1064,3 +1064,15 @@ a b
10 00:00:10 10 00:00:10
0 00:00:00 0 00:00:00
DROP TABLE t1; DROP TABLE t1;
#
# Bug#31590: Wrong error message on sort buffer being too small.
#
create table t1(a int, b tinytext);
insert into t1 values (1,2),(3,2);
set session sort_buffer_size= 30000;
Warnings:
Warning 1292 Truncated incorrect sort_buffer_size value: '30000'
set session max_sort_length= 2180;
select * from t1 order by b;
ERROR HY001: Out of sort memory; increase server sort buffer size
drop table t1;
...@@ -726,3 +726,15 @@ SELECT a, b FROM t1 ORDER BY b DESC; ...@@ -726,3 +726,15 @@ SELECT a, b FROM t1 ORDER BY b DESC;
SELECT a, b FROM t1 ORDER BY SEC_TO_TIME(a) DESC; SELECT a, b FROM t1 ORDER BY SEC_TO_TIME(a) DESC;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug#31590: Wrong error message on sort buffer being too small.
--echo #
create table t1(a int, b tinytext);
insert into t1 values (1,2),(3,2);
set session sort_buffer_size= 30000;
set session max_sort_length= 2180;
--error 1038
select * from t1 order by b;
drop table t1;
...@@ -215,8 +215,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, ...@@ -215,8 +215,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
sort_keys= table_sort.sort_keys; sort_keys= table_sort.sort_keys;
if (memavl < min_sort_memory) if (memavl < min_sort_memory)
{ {
my_error(ER_OUTOFMEMORY,MYF(ME_ERROR+ME_WAITTANG), my_error(ER_OUT_OF_SORTMEMORY,MYF(ME_ERROR+ME_WAITTANG));
thd->variables.sortbuff_size);
goto err; goto err;
} }
if (open_cached_file(&buffpek_pointers,mysql_tmpdir,TEMP_PREFIX, if (open_cached_file(&buffpek_pointers,mysql_tmpdir,TEMP_PREFIX,
......
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