3751 Tor Didriksen 2012-03-14
Bug#13832772 ASSERTION `THD->IS_ERROR() || KILL_ERRNO'
We are trying to sort a lot of text/blob fields,
so the buffer is indeed too small.
Memory available = thd->variables.sortbuff_size = 262144
min_sort_memory = param.sort_length*MERGEBUFF2 = 292245
So the decision to abort the query is correct.
filesort() calls my_error(), the error is reported.
But, since we have DELETE IGNORE ... the error is converted to a warning by
THD::raise_condition
filesort currently expects an error to be recorded in the THD diagnostics
area.
If we lift this restriction (remove the assert) we end up in the familiar
void Protocol::end_statement()
default:
DBUG_ASSERT(0);
The solution seems to be to call my_error(ME_FATALERROR) in filesort,
so that the error is propagated as an error rather than a warning.
@ mysql-test/r/filesort_debug.result
New test case.
@ mysql-test/t/filesort_debug.test
New test case.
modified:
mysql-test/r/filesort_debug.result
mysql-test/t/filesort_debug.test
sql/filesort.cc
3750 sayantan.dutta@stripped 2012-03-14
BUG #13619394: "MAKE TEST" FAILS ON "MY_VSNPRINTF"
modified:
unittest/mysys/my_vsnprintf-t.c
=== modified file 'mysql-test/r/filesort_debug.result'
--- a/mysql-test/r/filesort_debug.result 2011-02-24 07:00:12 +0000
+++ b/mysql-test/r/filesort_debug.result 2012-03-14 11:28:41 +0000
@@ -31,3 +31,47 @@ SET DEBUG_SYNC='now SIGNAL filesort_kill
# connection default
SET DEBUG_SYNC= "RESET";
DROP TABLE t1;
+#
+# Bug#13832772 ASSERTION `THD->IS_ERROR() || KILL_ERRNO'
+# FAILED IN FILESORT/MYSQL_DELETE
+#
+CREATE TABLE t1 (
+c1 BLOB,
+c2 TEXT,
+c3 TEXT,
+c4 TEXT,
+c5 TEXT,
+c6 TEXT,
+c7 TEXT,
+c8 BLOB,
+c9 TEXT,
+c19 TEXT,
+pk INT,
+c20 TEXT,
+c21 BLOB,
+c22 TEXT,
+c23 TEXT,
+c24 TEXT,
+c25 TEXT,
+c26 BLOB,
+c27 TEXT,
+c28 TEXT,
+primary key (pk)
+) ENGINE=InnoDB
+;
+CALL mtr.add_suppression("Out of sort memory");
+DELETE IGNORE FROM t1 ORDER BY c26,c7,c23,c4,c25,c5,c20,
+c19,c21,c8,c1,c27,c28,c3,c9,c22,c24,c6,c2,pk LIMIT 2;
+ERROR HY001: Out of sort memory, consider increasing server sort buffer size
+SHOW WARNINGS;
+Level Code Message
+Error 1038 Out of sort memory, consider increasing server sort buffer size
+Error 1028 Sort aborted: Out of sort memory, consider increasing server sort buffer size
+DELETE FROM t1 ORDER BY c26,c7,c23,c4,c25,c5,c20,
+c19,c21,c8,c1,c27,c28,c3,c9,c22,c24,c6,c2,pk LIMIT 2;
+ERROR HY001: Out of sort memory, consider increasing server sort buffer size
+SHOW WARNINGS;
+Level Code Message
+Error 1038 Out of sort memory, consider increasing server sort buffer size
+Error 1028 Sort aborted: Out of sort memory, consider increasing server sort buffer size
+DROP TABLE t1;
=== modified file 'mysql-test/t/filesort_debug.test'
--- a/mysql-test/t/filesort_debug.test 2011-02-24 07:00:12 +0000
+++ b/mysql-test/t/filesort_debug.test 2012-03-14 11:28:41 +0000
@@ -57,3 +57,47 @@ disconnect con2;
--source include/wait_until_count_sessions.inc
SET DEBUG_SYNC= "RESET";
DROP TABLE t1;
+
+--echo #
+--echo # Bug#13832772 ASSERTION `THD->IS_ERROR() || KILL_ERRNO'
+--echo # FAILED IN FILESORT/MYSQL_DELETE
+--echo #
+
+CREATE TABLE t1 (
+ c1 BLOB,
+ c2 TEXT,
+ c3 TEXT,
+ c4 TEXT,
+ c5 TEXT,
+ c6 TEXT,
+ c7 TEXT,
+ c8 BLOB,
+ c9 TEXT,
+ c19 TEXT,
+ pk INT,
+ c20 TEXT,
+ c21 BLOB,
+ c22 TEXT,
+ c23 TEXT,
+ c24 TEXT,
+ c25 TEXT,
+ c26 BLOB,
+ c27 TEXT,
+ c28 TEXT,
+ primary key (pk)
+) ENGINE=InnoDB
+;
+
+CALL mtr.add_suppression("Out of sort memory");
+
+--error ER_OUT_OF_SORTMEMORY
+DELETE IGNORE FROM t1 ORDER BY c26,c7,c23,c4,c25,c5,c20,
+c19,c21,c8,c1,c27,c28,c3,c9,c22,c24,c6,c2,pk LIMIT 2;
+SHOW WARNINGS;
+
+--error ER_OUT_OF_SORTMEMORY
+DELETE FROM t1 ORDER BY c26,c7,c23,c4,c25,c5,c20,
+c19,c21,c8,c1,c27,c28,c3,c9,c22,c24,c6,c2,pk LIMIT 2;
+SHOW WARNINGS;
+
+DROP TABLE t1;
=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc 2012-02-16 09:48:16 +0000
+++ b/sql/filesort.cc 2012-03-14 11:28:41 +0000
@@ -235,7 +235,7 @@ ha_rows filesort(THD *thd, TABLE *table,
sort_keys= table_sort.sort_keys;
if (memavl < min_sort_memory)
{
- my_error(ER_OUT_OF_SORTMEMORY,MYF(ME_ERROR+ME_WAITTANG));
+ my_error(ER_OUT_OF_SORTMEMORY,MYF(ME_ERROR + ME_FATALERROR));
goto err;
}
if (open_cached_file(&buffpek_pointers,mysql_tmpdir,TEMP_PREFIX,
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5 branch (tor.didriksen:3750 to 3751) Bug#13832772 | Tor Didriksen | 15 Mar |