MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:April 15 2010 12:14pm
Subject:bzr commit into mysql-trunk-runtime branch (jon.hauglid:3002) Bug#51391
View as plain text  
#At file:///export/home/z/mysql-trunk-runtime-bug51391/ based on revid:jon.hauglid@stripped

 3002 Jon Olav Hauglid	2010-04-15
      Bug #51391 Deadlock involving events during rqg_info_schema test
      
      This was a deadlock between CREATE/ALTER/DROP EVENT and a query
      accessing both the mysql.event table and I_S.GLOBAL_VARIABLES.
      
      The root of the problem was that the LOCK_event_metadata mutex was
      used to both protect the "event_scheduler" global system variable
      and the internal event data structures used by CREATE/ALTER/DROP EVENT.
      
      The deadlock would occur if CREATE/ALTER/DROP EVENT held
      LOCK_event_metadata while trying to open the mysql.event table,
      at the same time as the query had mysql.event open, trying to
      lock LOCK_event_metadata to access "event_scheduler".
      
      This bug was fixed in the scope of Bug#51160 by using only
      LOCK_global_system_variables to protect "event_scheduler".
      This makes it so that the query above won't lock LOCK_event_metadata,
      thereby preventing this deadlock from occuring.
      
      This patch contains no code changes.
      Test case added to lock_sync.test.

    modified:
      mysql-test/r/lock_sync.result
      mysql-test/t/lock_sync.test
=== modified file 'mysql-test/r/lock_sync.result'
--- a/mysql-test/r/lock_sync.result	2010-02-11 16:10:34 +0000
+++ b/mysql-test/r/lock_sync.result	2010-04-15 12:14:28 +0000
@@ -92,3 +92,23 @@ COMMIT;
 # Connection default
 # Reaping ALTER TABLE t1 ADD COLUMN j INT
 DROP TABLE t1, t2;
+#
+# Bug#51391 Deadlock involving events during rqg_info_schema test
+#
+CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
+CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2;
+# Connection con1
+SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
+# Sending:
+DROP EVENT e1;;
+# Connection default
+SET DEBUG_SYNC="now WAIT_FOR drop";
+SELECT name FROM mysql.event, INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE definer = VARIABLE_VALUE;
+name
+SET DEBUG_SYNC="now SIGNAL query";
+# Connection con1
+# Reaping: DROP EVENT t1
+# Connection default
+DROP EVENT e2;
+SET DEBUG_SYNC="RESET";

=== modified file 'mysql-test/t/lock_sync.test'
--- a/mysql-test/t/lock_sync.test	2010-02-11 16:10:34 +0000
+++ b/mysql-test/t/lock_sync.test	2010-04-15 12:14:28 +0000
@@ -178,6 +178,39 @@ DROP TABLE t1, t2;
 disconnect con2;
 
 
+--echo #
+--echo # Bug#51391 Deadlock involving events during rqg_info_schema test
+--echo #
+
+CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
+CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2;
+
+--echo # Connection con1
+connect(con1, localhost, root);
+SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
+--echo # Sending:
+--send DROP EVENT e1;
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC="now WAIT_FOR drop";
+SELECT name FROM mysql.event, INFORMATION_SCHEMA.GLOBAL_VARIABLES
+  WHERE definer = VARIABLE_VALUE;
+SET DEBUG_SYNC="now SIGNAL query";
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: DROP EVENT t1
+--reap
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection default
+connection default;
+DROP EVENT e2;
+SET DEBUG_SYNC="RESET";
+
+
 # Check that all connections opened by test cases in this file are really
 # gone so execution of other tests won't be affected by their presence.
 --source include/wait_until_count_sessions.inc


Attachment: [text/bzr-bundle] bzr/jon.hauglid@sun.com-20100415121428-dg3vi58qufrhttou.bundle
Thread
bzr commit into mysql-trunk-runtime branch (jon.hauglid:3002) Bug#51391Jon Olav Hauglid15 Apr