summaryrefslogtreecommitdiff
path: root/mysql-test/t/merge.test
diff options
context:
space:
mode:
authorKristofer Pettersson <kristofer.pettersson@sun.com>2009-07-16 01:23:57 +0200
committerKristofer Pettersson <kristofer.pettersson@sun.com>2009-07-16 01:23:57 +0200
commitfae95a4933899edfd560735a3977a947e5551410 (patch)
tree08f32c85b9864081ad0e8a70215a655e64422eaf /mysql-test/t/merge.test
parented3b0a69cfbc5778f000df4d2e46baa1f1173c57 (diff)
downloadmariadb-git-fae95a4933899edfd560735a3977a947e5551410.tar.gz
Bug#45781 infinite hang/crash in "opening tables" after handler tries to open merge
table The MERGE table storage engine does not support the HA_CAN_SQL_HANDLE feature and any attempt to open the merge table will fail with ER_ILLEGAL_HA. After an error occurred the tables that was opened must be closed again or they will be left in an inconsistent state. However, the assumption made in the code for closing and register handler tables was that only one table will be opened, and this is not true for MERGE tables which will cause multiple tables to open. The next time a SELECT operation was issued on the merge table it caused the system to freeze. This patch fixes this issue by making sure that all tables which are opened also are closed in the event of an error. mysql-test/r/merge.result: Added test case for bug 45781 mysql-test/t/merge.test: Added test case for bug 45781 sql/sql_handler.cc: * mysql_ha_open() was never ment to open more than one table. If we encounter more tables, we should close all tables related to the current substatement and raise an exception.
Diffstat (limited to 'mysql-test/t/merge.test')
-rw-r--r--mysql-test/t/merge.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 8760876b7ee..0d90468fc8d 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -1555,4 +1555,28 @@ SELECT * FROM m1;
DROP TABLE m1;
DROP TABLE t1;
+--echo #
+--echo # Bug45781 infinite hang/crash in "opening tables" after handler tries to
+--echo # open merge table
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS m1,t1;
+--enable_warnings
+
+CREATE TABLE t1(a int)engine=myisam;
+CREATE TABLE t2(a int)engine=myisam;
+CREATE TABLE t3(a int)engine=myisam;
+CREATE TABLE t4(a int)engine=myisam;
+CREATE TABLE t5(a int)engine=myisam;
+CREATE TABLE t6(a int)engine=myisam;
+CREATE TABLE t7(a int)engine=myisam;
+CREATE TABLE m1(a int)engine=merge union=(t1,t2,t3,t4,t5,t6,t7);
+SELECT 1 FROM m1;
+--error ER_ILLEGAL_HA
+HANDLER m1 OPEN;
+DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7;
+--error ER_NO_SUCH_TABLE
+SELECT 1 FROM m1; # Should not hang!
+
--echo End of 5.1 tests