MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Dmitry Lenev Date:February 3 2010 5:32am
Subject:bzr commit into mysql-5.5-next-mr branch (dlenev:3063) Bug#50784
View as plain text  
#At file:///home/dlenev/src/bzr/mysql-next-4284-bg50784/ based on revid:kostja@stripped

 3063 Dmitry Lenev	2010-02-03
      Fix for bug #50784 "MDL: Assertion `m_tickets.is_empty() ||
      m_tickets.front() == m_trans_sentinel'".
      
      Debug build of server crashed due to assert failure in MDL
      subsystem when one tried to execute multi-table REPAIR or
      OPTIMIZE in autocommit=0 mode.
      
      The assert failure occured when multi-table REPAIR or OPTIMIZE
      started processing of second table from its table list and
      tried to acquire upgradable metadata lock on this table.
      The cause of the assert failure were MDL locks left over from
      processing of previous table. It turned out that in autocommit=0
      mode close_thread_tables() which happens at the end of table
      processing doesn't release metadata locks.
      
      This fix solves problem by releasing locks explicitly using
      MDL_context::release_trans_locks() call.
     @ mysql-test/r/repair.result
        Added test for bug #50784 "MDL: Assertion `m_tickets.is_empty() ||
        m_tickets.front() == m_trans_sentinel'".
     @ mysql-test/t/repair.test
        Added test for bug #50784 "MDL: Assertion `m_tickets.is_empty() ||
        m_tickets.front() == m_trans_sentinel'".
     @ sql/sql_table.cc
        Ensure that metadata locks are released after multi-table REPAIR/
        OPTIMIZE/... processes each table. close_thread_tables() which is
        called after processing each table doesn't release metadata locks
        if we are in autocommit=0 mode. So this have to be done
        explicitly by calling MDL_context::release_trans_locks().

    modified:
      mysql-test/r/repair.result
      mysql-test/t/repair.test
      sql/sql_table.cc
=== modified file 'mysql-test/r/repair.result'
--- a/mysql-test/r/repair.result	2009-12-09 13:03:37 +0000
+++ b/mysql-test/r/repair.result	2010-02-03 05:32:38 +0000
@@ -169,3 +169,17 @@ test.t1	repair	Error	Table 't1' was lock
 test.t1	repair	status	Operation failed
 UNLOCK TABLES;
 DROP TABLE t1;
+#
+# Test for bug #50784 "MDL: Assertion `m_tickets.is_empty() ||
+#                      m_tickets.front() == m_trans_sentinel'"
+#
+drop tables if exists t1, t2;
+create table t1 (i int);
+create table t2 (j int);
+set @@autocommit= 0;
+repair table t1, t2;
+Table	Op	Msg_type	Msg_text
+test.t1	repair	status	OK
+test.t2	repair	status	OK
+set @@autocommit= default;
+drop tables t1, t2;

=== modified file 'mysql-test/t/repair.test'
--- a/mysql-test/t/repair.test	2009-12-09 13:03:37 +0000
+++ b/mysql-test/t/repair.test	2010-02-03 05:32:38 +0000
@@ -173,3 +173,18 @@ REPAIR TABLE t1;
 
 UNLOCK TABLES;
 DROP TABLE t1;
+
+
+--echo #
+--echo # Test for bug #50784 "MDL: Assertion `m_tickets.is_empty() ||
+--echo #                      m_tickets.front() == m_trans_sentinel'"
+--echo #
+--disable_warnings
+drop tables if exists t1, t2;
+--enable_warnings
+create table t1 (i int);
+create table t2 (j int);
+set @@autocommit= 0;
+repair table t1, t2;
+set @@autocommit= default;
+drop tables t1, t2;

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2010-02-01 23:22:16 +0000
+++ b/sql/sql_table.cc	2010-02-03 05:32:38 +0000
@@ -5030,6 +5030,7 @@ send_result_message:
     trans_commit_stmt(thd);
     trans_commit_implicit(thd);
     close_thread_tables(thd);
+    thd->mdl_context.release_transactional_locks();
     table->table=0;				// For query cache
 
     /*
@@ -5059,6 +5060,7 @@ err:
   trans_rollback_stmt(thd);
   trans_rollback(thd);
   close_thread_tables(thd);			// Shouldn't be needed
+  thd->mdl_context.release_transactional_locks();
   if (table)
     table->table=0;
   DBUG_RETURN(TRUE);


Attachment: [text/bzr-bundle] bzr/dlenev@mysql.com-20100203053238-1ganri3g1zpc8c20.bundle
Thread
bzr commit into mysql-5.5-next-mr branch (dlenev:3063) Bug#50784Dmitry Lenev3 Feb