List:Commits« Previous MessageNext Message »
From:Christoffer Hall Date:June 11 2009 8:10am
Subject:bzr commit into mysql-5.1-bugteam branch (hall:2936) Bug#43587
View as plain text  
#At file:///home/hall/Bazaar/mysql-5.1-bugteam-bug43587-four/ based on revid:davi.arnaut@stripped

 2936 Christoffer Hall	2009-06-11
      Bug#43587: Putting event_scheduler=1 in init SQL file crashes mysqld
      
      If the event scheduler is enabled in an init sql file mysqld crashes.
      
      When the init sql file containing "SET GLOBAL event_scheduler = 1" gets
      executed before events are configured in my.cnf mysqld crashes because
      switching scheduler state assumes events are initialized.
      
      The solution is to initialize the event system on demand, unless events are
      disabled on the commandline.

    modified:
      sql/events.cc
      sql/events.h
=== modified file 'sql/events.cc'
--- a/sql/events.cc	2009-04-09 06:22:06 +0000
+++ b/sql/events.cc	2009-06-11 08:09:24 +0000
@@ -1051,6 +1051,20 @@ Events::dump_internal_status()
 
   pthread_mutex_unlock(&LOCK_event_metadata);
   DBUG_VOID_RETURN;
+} 
+
+/**
+  Checks if events are initialized
+  @retval TRUE success
+  @retval FALSE  error
+  +*/
+
+  bool
+Events::is_initialized()
+{
+  if (scheduler == NULL || event_queue == NULL)
+    return FALSE;
+  return TRUE;
 }
 
 
@@ -1081,6 +1095,15 @@ Events::switch_event_scheduler_state(enu
 
   pthread_mutex_lock(&LOCK_event_metadata);
 
+  /*
+     Check if the event scheduler is initialized do it now. 
+     Later inits my change behaviour, but that is ok.
+     */
+  if (opt_event_scheduler != EVENTS_DISABLED && !is_initialized())
+    Events::init(FALSE); 
+  
+
+
   if (opt_event_scheduler == EVENTS_DISABLED)
   {
     my_error(ER_OPTION_PREVENTS_STATEMENT,

=== modified file 'sql/events.h'
--- a/sql/events.h	2007-08-15 15:08:44 +0000
+++ b/sql/events.h	2009-06-11 08:09:24 +0000
@@ -135,6 +135,7 @@ public:
 
 private:
   static bool check_if_system_tables_error();
+  static bool is_initialized();
 
   static bool
   load_events_from_db(THD *thd);


Attachment: [text/bzr-bundle] bzr/hall@mysql.com-20090611080924-9ypothyl1rt34vzr.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (hall:2936) Bug#43587Christoffer Hall11 Jun
  • Re: bzr commit into mysql-5.1-bugteam branch (hall:2936) Bug#43587Davi Arnaut16 Jun