List:Commits« Previous MessageNext Message »
From:Christoffer Hall Date:June 22 2009 9:57am
Subject:bzr commit into mysql-5.1-bugteam branch (hall:2968) Bug#43587
View as plain text  
#At file:///home/hall/Bazaar/mysql-5.1-bugteam-43587-failure/ based on revid:matthias.leich@stripped

 2968 Christoffer Hall	2009-06-22
      BUG#43587  Putting event_scheduler=1 in init SQL file crashes mysqld
                  
      Second patch to fix the problem. Trying to dynamically init events doesn't work as early as when init_file= is run. So issuing a warining that events cannot be set so early is issued and default values (or values set in my.cnf) will be loaded later. 

    modified:
      mysql-test/std_data/init_file.dat
      sql/events.cc
      sql/events.h
=== modified file 'mysql-test/std_data/init_file.dat'
--- a/mysql-test/std_data/init_file.dat	2007-02-19 13:57:54 +0000
+++ b/mysql-test/std_data/init_file.dat	2009-06-22 09:57:09 +0000
@@ -35,4 +35,12 @@ CREATE DATABASE IF NOT EXISTS init_file;
 CREATE TABLE IF NOT EXISTS init_file.startup ( startdate DATETIME );
 INSERT INTO init_file.startup VALUES ( NOW() );
 
+#
+# Bug#43587: Putting event_scheduler=1 in init SQL file crashes mysqld
+#
+
+SET GLOBAL event_scheduler = 'ON';
+CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
+DROP EVENT ev1;
+SET GLOBAL event_scheduler = 'OFF';
 

=== modified file 'sql/events.cc'
--- a/sql/events.cc	2009-04-09 06:22:06 +0000
+++ b/sql/events.cc	2009-06-22 09:57:09 +0000
@@ -992,6 +992,27 @@ Events::deinit()
   DBUG_VOID_RETURN;
 }
 
+/**
+  Check is event scheduler is initialized
+
+  SYNOPSIS
+    Events::is_initialized()
+      Checks if events are initialized
+
+  RETURN VALUE
+    TRUE   Inited
+    FALSE  Not inited
+*/
+
+bool
+Events::is_initialized()
+{
+  if (scheduler != NULL && event_queue != NULL)
+    return TRUE;
+  return FALSE;
+}
+
+
 
 /**
   Inits Events mutexes
@@ -1079,6 +1100,12 @@ Events::switch_event_scheduler_state(enu
   if (check_if_system_tables_error())
     DBUG_RETURN(TRUE);
 
+  if (!is_initialized())
+  {
+    sql_print_warning("Events not initialized yet, cannot switch state");
+    DBUG_RETURN(TRUE);
+  }
+
   pthread_mutex_lock(&LOCK_event_metadata);
 
   if (opt_event_scheduler == EVENTS_DISABLED)

=== modified file 'sql/events.h'
--- a/sql/events.h	2007-08-15 15:08:44 +0000
+++ b/sql/events.h	2009-06-22 09:57:09 +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-20090622095709-069s99ml2smxmpvr.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (hall:2968) Bug#43587Christoffer Hall22 Jun
  • Re: bzr commit into mysql-5.1-bugteam branch (hall:2968) Bug#43587Davi Arnaut23 Jun