List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:April 9 2009 6:22am
Subject:bzr commit into mysql-5.1-bugteam branch (zhenxing.he:2857) Bug#37145
View as plain text  
#At file:///media/sdb2/hezx/work/mysql/bzrwork/b37145/5.1-bugteam/ based on revid:zhenxing.he@stripped

 2857 He Zhenxing	2009-04-09
      Post fix of BUG#37145
      
      Binlog the CREATE EVENT unless the created event been successfully dropped
      
      Modified Query_log_event constructor to make sure that error_code
      is not set to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED errors
      when NOT_KILLED
     @ sql/events.cc
        binlog the create event unless it's been successfully dropped
     @ sql/log_event.cc
        Modified Query_log_event constructor to make sure that error_code
        is not set to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED errors
        when NOT_KILLED

    M  sql/events.cc
    M  sql/log_event.cc
=== modified file 'sql/events.cc'
--- a/sql/events.cc	2009-02-13 16:41:47 +0000
+++ b/sql/events.cc	2009-04-09 06:22:06 +0000
@@ -412,6 +412,7 @@ Events::create_event(THD *thd, Event_par
   if (!(ret= db_repository->create_event(thd, parse_data, if_not_exists)))
   {
     Event_queue_element *new_element;
+    bool dropped= 0;
 
     if (!(new_element= new Event_queue_element()))
       ret= TRUE;                                // OOM
@@ -419,8 +420,9 @@ Events::create_event(THD *thd, Event_par
                                                    parse_data->name,
                                                    new_element)))
     {
-      db_repository->drop_event(thd, parse_data->dbname, parse_data->name,
-                                TRUE);
+      if (!db_repository->drop_event(thd, parse_data->dbname, parse_data->name,
+                                     TRUE))
+        dropped= 1;
       delete new_element;
     }
     else
@@ -429,6 +431,12 @@ Events::create_event(THD *thd, Event_par
       bool created;
       if (event_queue)
         event_queue->create_event(thd, new_element, &created);
+    }
+    /*
+      binlog the create event unless it's been successfully dropped
+    */
+    if (!dropped)
+    {
       /* Binlog the create event. */
       DBUG_ASSERT(thd->query && thd->query_length);
       write_bin_log(thd, TRUE, thd->query, thd->query_length);

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2009-04-08 23:42:51 +0000
+++ b/sql/log_event.cc	2009-04-09 06:22:06 +0000
@@ -2292,7 +2292,16 @@ Query_log_event::Query_log_event(THD* th
     (thd_arg->is_error() ? thd_arg->main_da.sql_errno() : 0) :
     ((thd_arg->system_thread & SYSTEM_THREAD_DELAYED_INSERT) ? 0 :
      thd_arg->killed_errno());
-  
+
+  /* thd_arg->main_da.sql_errno() might be ER_SERVER_SHUTDOWN or
+     ER_QUERY_INTERRUPTED, So here we need to make sure that
+     error_code is not set to these errors when specified NOT_KILLED
+     by the caller
+  */
+  if ((killed_status_arg == THD::NOT_KILLED) &&
+      (error_code == ER_SERVER_SHUTDOWN || error_code == ER_QUERY_INTERRUPTED))
+    error_code= 0;
+
   time(&end_time);
   exec_time = (ulong) (end_time  - thd_arg->start_time);
   /**


Attachment: [text/bzr-bundle] bzr/zhenxing.he@sun.com-20090409062206-4rk4v9bhhjgo5ad2.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (zhenxing.he:2857) Bug#37145He Zhenxing9 Apr