MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:February 6 2010 9:44am
Subject:bzr commit into mysql-5.5-next-mr branch (jon.hauglid:3084) Bug#50912
View as plain text  
#At file:///export/home/z/mysql-next-4284-bug50912/ based on revid:kostja@stripped

 3084 Jon Olav Hauglid	2010-02-06
      Bug #50912 Assertion `ticket->m_type >= mdl_request->type'
                 failed on HANDLER + I_S
      
      This assert was triggered when an I_S query tried to acquire a
      metadata lock on a table which was already locked by a HANDLER
      statement in the same connection.
      
      First the HANDLER took a MDL_SHARED lock. Afterwards, the I_S query
      requested a MDL_SHARED_HIGH_PRIO lock. The existing MDL_SHARED ticket
      is found in find_ticket() since it satisfies 
      ticket->has_stronger_or_equal_type(mdl_request->type) as MDL_SHARED
      and MDL_SHARED_HIGH_PRIO have equal strengths, just different priority.
      
      However, two asserts later check lock type strengths using relational
      operators (>= and <=) rather than MDL_ticket::has_stronger_or_equal_type().
      These asserts are triggered since MDL_SHARED >= MDL_SHARED_HIGH_PRIORITY
      is false (mapped to 1 and 2 respectively).
      
      This patch updates the asserts to use MDL_ticket::has_stronger_or_equal_type()
      rather than relational operators to check lock type strength.
      
      Test case added to include/handler.inc.

    modified:
      mysql-test/include/handler.inc
      mysql-test/r/handler_innodb.result
      mysql-test/r/handler_myisam.result
      sql/mdl.cc
=== modified file 'mysql-test/include/handler.inc'
--- a/mysql-test/include/handler.inc	2010-02-05 14:52:17 +0000
+++ b/mysql-test/include/handler.inc	2010-02-06 09:44:03 +0000
@@ -1522,3 +1522,23 @@ HANDLER t2 READ FIRST;
 
 HANDLER t2 CLOSE;
 DROP TABLE t1, t2;
+
+
+--echo #
+--echo # Bug#50912 Assertion `ticket->m_type >= mdl_request->type'
+--echo #           failed on HANDLER + I_S
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (id INT);
+HANDLER t1 OPEN;
+
+# This used to trigger the assert.
+SELECT table_name, table_comment FROM information_schema.tables
+  WHERE table_schema= 'test' AND table_name= 't1';
+
+HANDLER t1 CLOSE;
+DROP TABLE t1;

=== modified file 'mysql-test/r/handler_innodb.result'
--- a/mysql-test/r/handler_innodb.result	2010-02-05 14:52:17 +0000
+++ b/mysql-test/r/handler_innodb.result	2010-02-06 09:44:03 +0000
@@ -1476,3 +1476,16 @@ HANDLER t2 READ FIRST;
 i
 HANDLER t2 CLOSE;
 DROP TABLE t1, t2;
+#
+# Bug#50912 Assertion `ticket->m_type >= mdl_request->type'
+#           failed on HANDLER + I_S
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (id INT);
+HANDLER t1 OPEN;
+SELECT table_name, table_comment FROM information_schema.tables
+WHERE table_schema= 'test' AND table_name= 't1';
+table_name	table_comment
+t1	
+HANDLER t1 CLOSE;
+DROP TABLE t1;

=== modified file 'mysql-test/r/handler_myisam.result'
--- a/mysql-test/r/handler_myisam.result	2010-02-05 14:52:17 +0000
+++ b/mysql-test/r/handler_myisam.result	2010-02-06 09:44:03 +0000
@@ -1474,6 +1474,19 @@ i
 HANDLER t2 CLOSE;
 DROP TABLE t1, t2;
 #
+# Bug#50912 Assertion `ticket->m_type >= mdl_request->type'
+#           failed on HANDLER + I_S
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (id INT);
+HANDLER t1 OPEN;
+SELECT table_name, table_comment FROM information_schema.tables
+WHERE table_schema= 'test' AND table_name= 't1';
+table_name	table_comment
+t1	
+HANDLER t1 CLOSE;
+DROP TABLE t1;
+#
 # BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash 
 #
 CREATE TABLE t1 AS SELECT 1 AS f1;

=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc	2010-02-04 22:37:44 +0000
+++ b/sql/mdl.cc	2010-02-06 09:44:03 +0000
@@ -1261,7 +1261,7 @@ MDL_context::try_acquire_lock(MDL_reques
   if ((ticket= find_ticket(mdl_request, &is_transactional)))
   {
     DBUG_ASSERT(ticket->m_lock);
-    DBUG_ASSERT(ticket->m_type >= mdl_request->type);
+    DBUG_ASSERT(ticket->has_stronger_or_equal_type(mdl_request->type));
     /*
       If the request is for a transactional lock, and we found
       a transactional lock, just reuse the found ticket.
@@ -1349,7 +1349,7 @@ MDL_context::clone_ticket(MDL_request *m
     return TRUE;
 
   /* clone() is not supposed to be used to get a stronger lock. */
-  DBUG_ASSERT(ticket->m_type <= mdl_request->ticket->m_type);
+  DBUG_ASSERT(mdl_request->ticket->has_stronger_or_equal_type(ticket->m_type));
 
   ticket->m_lock= mdl_request->ticket->m_lock;
   mdl_request->ticket= ticket;


Attachment: [text/bzr-bundle] bzr/jon.hauglid@sun.com-20100206094403-h1liugk8832pj56a.bundle
Thread
bzr commit into mysql-5.5-next-mr branch (jon.hauglid:3084) Bug#50912Jon Olav Hauglid6 Feb