MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:April 14 2010 7:31am
Subject:bzr commit into mysql-trunk-runtime branch (jon.hauglid:2999) Bug#52367
View as plain text  
#At file:///export/home/z/mysql-trunk-runtime-bug52367/ based on revid:davi.arnaut@stripped

 2999 Jon Olav Hauglid	2010-04-14
      Bug #52367 Deadlock involving SET GLOBAL EVENT_SCHEDULER = OFF
                 during rqg_mdl_deadlock test
      
      The problem was that if two connection threads simultaneously tries
      to execute "SET GLOBAL EVENT_SCHEDULER = OFF", one of them could
      hang waiting for the scheduler to stop.
      
      The first connection thread would kill the event scheduler thread
      and then start waiting for it to exit. The second connection thread
      would then find the event scheduler thread in the process of exiting
      and also wait for it to exit. However, since the event scheduler 
      thread used signal to wake only one waiting thread, the other connection
      thread would be left waiting.
      
      This bug was a regression introduced by the fix for Bug#51160.
      Before #51160 it was not possible for two connection threads to 
      try to stop the event scheduler thread simultaneously.
      
      This patch fixes the problem my making sure the event scheduler
      thread uses broadcast to notify all waiters that it is exiting.
      
      No test case added as this would require adding debug sync points
      to parts of the code where sync points are currently not used.
      The patch has been tested with the non-deterministic test case
      from the bug description as well as using the RQG.

    modified:
      sql/event_scheduler.cc
=== modified file 'sql/event_scheduler.cc'
--- a/sql/event_scheduler.cc	2010-02-24 17:04:00 +0000
+++ b/sql/event_scheduler.cc	2010-04-14 07:30:57 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (C) 2004, 2010 Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 #include "mysql_priv.h"
 #include "events.h"
@@ -497,8 +497,8 @@ Event_scheduler::run(THD *thd)
   deinit_event_thread(thd);
   scheduler_thd= NULL;
   state= INITIALIZED;
-  DBUG_PRINT("info", ("Signalling back to the stopper COND_state"));
-  mysql_cond_signal(&COND_state);
+  DBUG_PRINT("info", ("Broadcasting COND_state back to the stoppers"));
+  mysql_cond_broadcast(&COND_state);
   UNLOCK_DATA();
 
   DBUG_RETURN(res);


Attachment: [text/bzr-bundle] bzr/jon.hauglid@sun.com-20100414073057-q23lthb9i3jamit4.bundle
Thread
bzr commit into mysql-trunk-runtime branch (jon.hauglid:2999) Bug#52367Jon Olav Hauglid14 Apr