MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:August 19 2009 2:40pm
Subject:bzr push into mysql-5.4 branch (kostja:2868 to 2869) Bug#46452
View as plain text  
 2869 Konstantin Osipov	2009-08-19
      Bug#46452 "Crash in MDL, HANDLER OPEN + TRUNCATE TABLE".
      Flush open HANDLER tables before TRUNCATE, which is a DDL.
     @ mysql-test/r/truncate.result
        Update results (Bug#46452)
     @ mysql-test/t/truncate.test
        Add a test case for Bug#46452

    modified:
      mysql-test/r/truncate.result
      mysql-test/t/truncate.test
 2868 Dmitry Lenev	2009-08-19
      Fix for bug #46747 "Crash in MDL_ticket::upgrade_shared_lock_to_exclusive
                          on TRIGGER + TEMP table".
      
      Server crashed when one tried to drop trigger which had its subject 
      table shadowed by a temporary table with the same name.
      
      This problem occured because in such situation DROP TRIGGER has opened
      temporary table instead of base table on which trigger was defined.
      Attempt to upgrade metadata lock on this temporary table led to crash
      (we don't acquire metadata locks for temporary tables).
      
      This fix ensures that DROP TRIGGER ignores temporary tables when
      trying to open table on which trigger to be dropped is defined.
     @ mysql-test/r/trigger.result
        Added test case for bug #46747 "Crash in
        MDL_ticket::upgrade_shared_lock_to_exclusive
        on TRIGGER + TEMP table".
     @ mysql-test/t/trigger.test
        Added test case for bug #46747 "Crash in
        MDL_ticket::upgrade_shared_lock_to_exclusive
        on TRIGGER + TEMP table".
     @ sql/sql_trigger.cc
        Prevent DROP TRIGGER from opening temporary table which might
        shadow base table on which trigger to be dropped is defined.

    modified:
      mysql-test/r/trigger.result
      mysql-test/t/trigger.test
      sql/sql_trigger.cc
=== modified file 'mysql-test/r/truncate.result'
--- a/mysql-test/r/truncate.result	2009-07-21 16:53:40 +0000
+++ b/mysql-test/r/truncate.result	2009-08-19 14:39:31 +0000
@@ -145,4 +145,17 @@ Procedure	sql_mode	Create Procedure	char
 p1		CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
 SET @a = 5	latin1	latin1_swedish_ci	latin1_swedish_ci
 DROP PROCEDURE p1;
+#
+# Bug#46452 Crash in MDL, HANDLER OPEN + TRUNCATE TABLE
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 AS SELECT 1 AS f1;
+HANDLER t1 OPEN;
+# Here comes the crash.
+TRUNCATE t1;
+# Currently TRUNCATE, just like other DDL, implicitly closes
+# open HANDLER table.
+HANDLER t1 READ FIRST;
+ERROR 42S02: Unknown table 't1' in HANDLER
+DROP TABLE t1;
 # End of 6.0 tests

=== modified file 'mysql-test/t/truncate.test'
--- a/mysql-test/t/truncate.test	2009-07-21 16:53:40 +0000
+++ b/mysql-test/t/truncate.test	2009-08-19 14:39:31 +0000
@@ -140,5 +140,26 @@ TRUNCATE p1;
 SHOW CREATE PROCEDURE p1;
 DROP PROCEDURE p1;
 
+--echo #
+--echo # Bug#46452 Crash in MDL, HANDLER OPEN + TRUNCATE TABLE
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 AS SELECT 1 AS f1;
+
+HANDLER t1 OPEN;
+--echo # Here comes the crash.
+TRUNCATE t1;
+
+--echo # Currently TRUNCATE, just like other DDL, implicitly closes
+--echo # open HANDLER table.
+--error ER_UNKNOWN_TABLE
+HANDLER t1 READ FIRST;
+
+# Cleanup
+DROP TABLE t1;
+
 --echo # End of 6.0 tests
 


Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20090819143931-2isw4q6hnt8vcn4j.bundle
Thread
bzr push into mysql-5.4 branch (kostja:2868 to 2869) Bug#46452Konstantin Osipov19 Aug