MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:jani Date:August 8 2007 1:50pm
Subject:bk commit into 5.1 tree (jani:1.2561) BUG#30274
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jani. When jani does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-08-08 16:50:43+03:00, jani@stripped +1 -0
  BUG#30274 (Debug server crashes because mutex isn't initialized):
  
  Completion patch, since it is possible that Log_event::write_header()
  is called with no current thread.
  
  When starting the server, there is no thread available, but
  MYSQL_BIN_LOG::open() is called to initialize the binary log. The
  function writes a format description log event to the binary log,
  which means that Log_event::write_header() can be called with no
  current thread object available.

  sql/log_event.cc@stripped, 2007-08-08 16:50:38+03:00, jani@stripped +12 -2
    Since Log_event::write_header() can be called from inside
    init_server_components(), it is possible that thd is NULL. In this
    case, we set the time of the event to the current time instead
    of the start time of the query.

diff -Nrup a/sql/log_event.cc b/sql/log_event.cc
--- a/sql/log_event.cc	2007-08-07 23:20:15 +03:00
+++ b/sql/log_event.cc	2007-08-08 16:50:38 +03:00
@@ -691,9 +691,19 @@ bool Log_event::write_header(IO_CACHE* f
     log_pos= my_b_safe_tell(file)+data_written;
   }
 
-  /* Set time of we this isn't a query */
+  /*
+    Set time of when to when the query started. Since this function is
+    called from init_server_components() as well, it might be that the
+    current thread is not defined. In that case, we take the current
+    time instead.  It is safe to call my_time() here since the first
+    time this line is reached is through the init_server_components()
+    call, which is after the my_init() call in the main() function (or
+    it's replacement, for some platforms).
+  */
+  THD *thd= current_thd;
   if (!when)
-    when= current_thd->start_time;
+    when= thd ? thd->start_time : my_time(0);
+
   /*
     Header will be of size LOG_EVENT_HEADER_LEN for all events, except for
     FORMAT_DESCRIPTION_EVENT and ROTATE_EVENT, where it will be
Thread
bk commit into 5.1 tree (jani:1.2561) BUG#30274jani8 Aug