List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:August 10 2010 10:50am
Subject:bzr commit into mysql-5.5-bugfixing branch (jon.hauglid:3098) Bug#54360
View as plain text  
#At file:///export/home/x/mysql-5.5-runtime-bug54360/ based on revid:kostja@stripped

 3098 Jon Olav Hauglid	2010-08-10
      Followup for Bug #54360 Deadlock DROP/ALTER/CREATE DATABASE
                              with open HANDLER
      
      This patch changes the code for table renames to not drop metadata
      locks. Since table renames are done as a part of ALTER DATABASE ...
      UPGRADE, dropping metadata locks in the middle of execution can
      result in wrong binlog order since it means that no locks are held
      when the binlog is written to.
      
      The RENAME TABLE statement is unafffected since it auto commits and
      therefore already drops metadata locks at the end of execution.
      
      This patch also reverts the regression test for Bug#48940 back to
      its original version. The test was temporarily changed due to the
      issue mentioned above.

    modified:
      mysql-test/r/schema.result
      mysql-test/t/mdl_sync.test
      mysql-test/t/schema.test
      sql/sql_rename.cc
=== modified file 'mysql-test/r/schema.result'
--- a/mysql-test/r/schema.result	2010-07-19 08:27:53 +0000
+++ b/mysql-test/r/schema.result	2010-08-10 10:50:16 +0000
@@ -16,21 +16,19 @@ drop schema foo;
 # Bug #48940 MDL deadlocks against mysql_rm_db
 #
 DROP SCHEMA IF EXISTS schema1;
-DROP SCHEMA IF EXISTS schema2;
 # Connection default
 CREATE SCHEMA schema1;
-CREATE SCHEMA schema2;
 CREATE TABLE schema1.t1 (a INT);
 SET autocommit= FALSE;
 INSERT INTO schema1.t1 VALUES (1);
 # Connection 2
 DROP SCHEMA schema1;
 # Connection default
-ALTER SCHEMA schema2 DEFAULT CHARACTER SET utf8;
+ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
+Got one of the listed errors
 SET autocommit= TRUE;
 # Connection 2
 # Connection default
-DROP SCHEMA schema2;
 #
 # Bug #49988 MDL deadlocks with mysql_create_db, reload_acl_and_cache
 #

=== modified file 'mysql-test/t/mdl_sync.test'
--- a/mysql-test/t/mdl_sync.test	2010-08-06 11:29:37 +0000
+++ b/mysql-test/t/mdl_sync.test	2010-08-10 10:50:16 +0000
@@ -4041,7 +4041,8 @@ connection default;
 --echo # Connection con2
 connection con2;
 --echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
---error 1,1 # Wrong error pending followup patch for bug#54360
+# Listing the error twice to prevent result diffences based on filename
+--error 1,1
 --reap
 
 
@@ -4153,7 +4154,8 @@ connection default;
 --echo # Connection con2
 connection con2;
 --echo # Reaping: RENAME TABLE test.t2 TO db1.t2
---error 7, 7 # Wrong error pending followup patch for bug#54360
+# Listing the error twice to prevent result diffences based on filename
+--error 7, 7
 --reap
 DROP TABLE test.t2;
 

=== modified file 'mysql-test/t/schema.test'
--- a/mysql-test/t/schema.test	2010-08-06 11:29:37 +0000
+++ b/mysql-test/t/schema.test	2010-08-10 10:50:16 +0000
@@ -23,7 +23,6 @@ drop schema foo;
 
 --disable_warnings
 DROP SCHEMA IF EXISTS schema1;
-DROP SCHEMA IF EXISTS schema2;
 --enable_warnings
 
 connect(con2, localhost, root);
@@ -32,7 +31,6 @@ connect(con2, localhost, root);
 connection default;
 
 CREATE SCHEMA schema1;
-CREATE SCHEMA schema2;
 CREATE TABLE schema1.t1 (a INT);
 
 SET autocommit= FALSE;
@@ -48,7 +46,9 @@ let $wait_condition= SELECT COUNT(*)= 1 
                      WHERE state= 'Waiting for table metadata lock' 
                      AND info='DROP SCHEMA schema1';
 --source include/wait_condition.inc
-ALTER SCHEMA schema2 DEFAULT CHARACTER SET utf8;
+# Listing the error twice to prevent result diffences based on filename
+--error 1,1
+ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
 SET autocommit= TRUE;
 
 --echo # Connection 2
@@ -57,7 +57,6 @@ connection con2;
 
 --echo # Connection default
 connection default;
-DROP SCHEMA schema2;
 disconnect con2;
 
 

=== modified file 'sql/sql_rename.cc'
--- a/sql/sql_rename.cc	2010-08-09 18:33:47 +0000
+++ b/sql/sql_rename.cc	2010-08-10 10:50:16 +0000
@@ -188,8 +188,6 @@ bool mysql_rename_tables(THD *thd, TABLE
   if (!error)
     query_cache_invalidate3(thd, table_list, 0);
 
-  thd->mdl_context.release_transactional_locks();
-
 err:
   thd->global_read_lock.start_waiting_global_read_lock(thd);
   DBUG_RETURN(error || binlog_error);


Attachment: [text/bzr-bundle] bzr/jon.hauglid@oracle.com-20100810105016-ggkruamkj9tqba4d.bundle
Thread
bzr commit into mysql-5.5-bugfixing branch (jon.hauglid:3098) Bug#54360Jon Olav Hauglid10 Aug