#At file:///Users/kaa/src/bzr/bugteam/bug46075/my50-bug46075/ based on revid:joro@stripped
2804 Alexey Kopytov 2009-07-24
Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416
In create_myisam_from_heap() mark all errors as fatal except
HA_ERR_RECORD_FILE_FULL for a HEAP table.
Not doing so could lead to problems, e.g. in a case when a
temporary MyISAM table gets overrun due to its MAX_ROWS limit
while executing INSERT/REPLACE IGNORE ... SELECT.
The SELECT execution was aborted, but the error was
converted to a warning due to IGNORE clause, so neither 'ok'
nor 'error' packet could be sent back to the client. This
condition led to hanging client when using 5.0 server, or
assertion failure in 5.1.
modified:
mysql-test/r/insert_select.result
mysql-test/t/insert_select.test
sql/sql_select.cc
per-file messages:
mysql-test/r/insert_select.result
Added a test case for bug #46075.
mysql-test/t/insert_select.test
Added a test case for bug #46075.
sql/sql_select.cc
In create_myisam_from_heap() mark all errors as fatal except
HA_ERR_RECORD_FILE_FULL for a HEAP table.
=== modified file 'mysql-test/r/insert_select.result'
--- a/mysql-test/r/insert_select.result 2007-09-21 08:09:00 +0000
+++ b/mysql-test/r/insert_select.result 2009-07-24 11:50:45 +0000
@@ -842,3 +842,16 @@ Table Op Msg_type Msg_text
test.t2 check status OK
drop table t1,t2;
##################################################################
+#
+# Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416
+#
+CREATE TABLE t1(a INT);
+SET max_heap_table_size = 16384;
+SET @old_myisam_data_pointer_size = @@myisam_data_pointer_size;
+SET GLOBAL myisam_data_pointer_size = 2;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
+ERROR HY000: The table '' is full
+SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
+DROP TABLE t1;
+End of 5.0 tests
=== modified file 'mysql-test/t/insert_select.test'
--- a/mysql-test/t/insert_select.test 2007-09-21 08:09:00 +0000
+++ b/mysql-test/t/insert_select.test 2009-07-24 11:50:45 +0000
@@ -397,3 +397,24 @@ check table t2 extended;
drop table t1,t2;
--echo ##################################################################
+--echo #
+--echo # Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416
+--echo #
+
+CREATE TABLE t1(a INT);
+# To force MyISAM temp. table in the following INSERT ... SELECT.
+SET max_heap_table_size = 16384;
+# To overflow the temp. table.
+SET @old_myisam_data_pointer_size = @@myisam_data_pointer_size;
+SET GLOBAL myisam_data_pointer_size = 2;
+
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+
+--error ER_RECORD_FILE_FULL
+INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
+
+# Cleanup
+SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
+DROP TABLE t1;
+
+--echo End of 5.0 tests
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-06-17 13:54:01 +0000
+++ b/sql/sql_select.cc 2009-07-24 11:50:45 +0000
@@ -10276,6 +10276,11 @@ bool create_myisam_from_heap(THD *thd, T
if (table->s->db_type != DB_TYPE_HEAP || error != HA_ERR_RECORD_FILE_FULL)
{
+ /*
+ We don't want this error to be converted to a warning, e.g. in case of
+ INSERT IGNORE ... SELECT.
+ */
+ thd->is_fatal_error= 1;
table->file->print_error(error,MYF(0));
DBUG_RETURN(1);
}