MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:June 7 2010 1:14pm
Subject:bzr commit into mysql-trunk-runtime branch (jon.hauglid:3041) Bug#54282
View as plain text  
#At file:///export/home/x/mysql-trunk-runtime-bug54282/ based on revid:dlenev@stripped

 3041 Jon Olav Hauglid	2010-06-07
      Bug #54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive
      
      This crash happened if a table was listed twice in a DROP TABLE statement,
      and the statement was executed while in LOCK TABLES mode. Since the two
      tables were identical, they were assigned the same MDL lock ticket. When the
      ticket of the first table was set to NULL, the server crashed when trying
      to read the ticket of the second table.
      
      Listing the same table twice should give an an ER_NONUNIQ_TABLE error.
      However, this did not happen as the check for unique table names was 
      skipped due to the tables being set up to be locked using TL_IGNORE. 
      Previously the tables were locked using TL_UNLOCK which caused the
      unique check to be performed.
      
      This bug was a regression introduced by a pre-requisite patch for
      Bug#51263 "Deadlock between transactional SELECT and ALTER TABLE ...
      REBUILD PARTITION". The regression only existed in an internal team
      tree and never in any released code.
      
      This patch reverts DROP TABLE (and DROP VIEW) to the old behavior of
      taking TL_UNLOCK locks. Test case added to drop.test.

    modified:
      mysql-test/r/drop.result
      mysql-test/t/drop.test
      sql/sql_yacc.yy
=== modified file 'mysql-test/r/drop.result'
--- a/mysql-test/r/drop.result	2010-02-04 17:34:15 +0000
+++ b/mysql-test/r/drop.result	2010-06-07 13:14:51 +0000
@@ -157,3 +157,13 @@ Error	1051	Unknown table 't1'
 # --
 # -- End of Bug#37431.
 # --
+#
+# Bug#54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT);
+LOCK TABLE t1 WRITE;
+DROP TABLE t1, t1;
+ERROR 42000: Not unique table/alias: 't1'
+UNLOCK TABLES;
+DROP TABLE t1;

=== modified file 'mysql-test/t/drop.test'
--- a/mysql-test/t/drop.test	2010-01-12 15:15:21 +0000
+++ b/mysql-test/t/drop.test	2010-06-07 13:14:51 +0000
@@ -256,3 +256,20 @@ SHOW WARNINGS;
 --echo # --
 --echo # -- End of Bug#37431.
 --echo # --
+
+
+--echo #
+--echo # Bug#54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT);
+LOCK TABLE t1 WRITE;
+--error ER_NONUNIQ_TABLE
+DROP TABLE t1, t1;
+
+UNLOCK TABLES;
+DROP TABLE t1;

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2010-06-06 11:19:29 +0000
+++ b/sql/sql_yacc.yy	2010-06-07 13:14:51 +0000
@@ -10151,7 +10151,7 @@ drop:
             lex->sql_command = SQLCOM_DROP_TABLE;
             lex->drop_temporary= $2;
             lex->drop_if_exists= $4;
-            YYPS->m_lock_type= TL_IGNORE;
+            YYPS->m_lock_type= TL_UNLOCK;
             YYPS->m_mdl_type= MDL_EXCLUSIVE;
           }
           table_list opt_restrict
@@ -10244,7 +10244,7 @@ drop:
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_DROP_VIEW;
             lex->drop_if_exists= $3;
-            YYPS->m_lock_type= TL_IGNORE;
+            YYPS->m_lock_type= TL_UNLOCK;
             YYPS->m_mdl_type= MDL_EXCLUSIVE;
           }
           table_list opt_restrict


Attachment: [text/bzr-bundle] bzr/jon.hauglid@sun.com-20100607131451-368wtqdfws0ua04t.bundle
Thread
bzr commit into mysql-trunk-runtime branch (jon.hauglid:3041) Bug#54282Jon Olav Hauglid7 Jun