summaryrefslogtreecommitdiff
path: root/mysql-test/t/merge.test
diff options
context:
space:
mode:
authorunknown <lars-erik.bjork@sun.com>2009-12-09 14:41:56 +0100
committerunknown <lars-erik.bjork@sun.com>2009-12-09 14:41:56 +0100
commit832ad46641822b64fbf0e7f0e70b62ef7af504ac (patch)
tree2b72d9b7cd78b582ca256ff503ffc91e69354f8e /mysql-test/t/merge.test
parent527813b41344c3e7a3c67f195393d1de3e0f6ed2 (diff)
downloadmariadb-git-832ad46641822b64fbf0e7f0e70b62ef7af504ac.tar.gz
Backport of revno: 2617.68.36
--------------------------------------------- This is a patch for bug#47098 assert in MDL_context::destroy on HANDLER <damaged merge table> OPEN. The assert occurs in MDL_context::destroy when the connection is terminated, because all mdl_tickets have not been released. MERGE tables do not support being opened using the HANDLER ... OPEN command, and trying to do so will result in an error. In the event of an error, all tables that are opened, should be closed again. The fix for bug#45781 made sure that this also works for MERGE tables, which causes multiple tables to be opened. This fix extends the fix for bug#45781, by ensuring that also all locks are released, when MERGE tables are involved. mysql-test/r/merge.result: The result of the test. mysql-test/t/merge.test: Added a test based on the bug report, as well as a test of the more general scenario. sql/sql_handler.cc: Added code to release all the locks.
Diffstat (limited to 'mysql-test/t/merge.test')
-rw-r--r--mysql-test/t/merge.test39
1 files changed, 38 insertions, 1 deletions
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index f7ce6ba700b..2738f79247f 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -1985,6 +1985,43 @@ DROP TRIGGER t2_au;
DROP FUNCTION f1;
DROP TABLE tm1, t1, t2, t3, t4, t5;
-
+--echo #
+--echo # Bug47098 assert in MDL_context::destroy on HANDLER
+--echo # <damaged merge table> OPEN
+--echo #
+--echo # Test that merge tables are closed correctly when opened using
+--echo # HANDLER ... OPEN.
+--echo # The general case.
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3;
+--enable_warnings
+--echo # Connection con1.
+connect (con1,localhost,root,,);
+CREATE TABLE t1 (c1 int);
+CREATE TABLE t2 (c1 int);
+CREATE TABLE t3 (c1 int) ENGINE = MERGE UNION (t1,t2);
+START TRANSACTION;
+--error ER_ILLEGAL_HA
+HANDLER t3 OPEN;
+DROP TABLE t1, t2, t3;
+--echo # Connection default.
+connection default;
+--echo # Disconnecting con1, all mdl_tickets must have been released.
+disconnect con1;
+--echo # The bug-specific case.
+--echo # Connection con1.
+connect (con1,localhost,root,,);
+CREATE TABLE t1 (c1 int);
+CREATE TABLE t2 (c1 int);
+CREATE TABLE t3 (c1 int) ENGINE = MERGE UNION (t1,t2);
+DROP TABLE t2;
+START TRANSACTION;
+--error ER_WRONG_MRG_TABLE
+HANDLER t3 OPEN;
+DROP TABLE t1, t3;
+--echo # Connection default.
+connection default;
+--echo # Disconnecting con1, all mdl_tickets must have been released.
+disconnect con1;
--echo End of 6.0 tests