List:Commits« Previous MessageNext Message »
From:Petr Chardin Date:April 18 2006 4:43am
Subject:bk commit into 5.1 tree (petr:1.2366) BUG#18848
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of cps. When cps 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
  1.2366 06/04/18 08:43:13 petr@stripped +1 -0
  fix for Bug#18848  "SIGHUP crashes the server" (v2)

  sql/log.cc
    1.205 06/04/18 08:43:01 petr@stripped +27 -11
    check whether log tables were initialized, before trying to
    flush them during sighup processing. Then use logger THD
    for flush.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	petr
# Host:	owlet.
# Root:	/home/cps/mysql/trees/mysql-5.1-virgin

--- 1.204/sql/log.cc	2006-04-16 05:17:25 +04:00
+++ 1.205/sql/log.cc	2006-04-18 08:43:01 +04:00
@@ -676,20 +676,36 @@
   /* reopen log files */
   file_log_handler->flush();
 
-  /*
-    this will lock and wait for all but the logger thread to release the
-    tables. Then we could reopen log tables. Then release the name locks.
-  */
-  lock_and_wait_for_table_name(thd, &close_slow_log);
-  lock_and_wait_for_table_name(thd, &close_general_log);
+  /* flush tables, in the case they are enabled */
+  if (logger.is_log_tables_initialized)
+  {
+    /*
+      This will lock and wait for all but the logger thread to release the
+      tables. Then we could reopen log tables. Then release the name locks.
 
-  /* deny others from logging to general and slow log, while reopening tables */
-  logger.lock();
+      NOTE: in fact, the first parameter used in lock_and_wait_for_table_name()
+      and table_log_handler->flush() could be any non-NULL THD, as the
+      underlying code makes certain assumptions about this.
+      Here we use one of the logger handler THD's. Simply because it
+      seems appropriate.
+    */
+    lock_and_wait_for_table_name(table_log_handler->general_log_thd,
+                                 &close_slow_log);
+    lock_and_wait_for_table_name(table_log_handler->general_log_thd,
+                                 &close_general_log);
 
-  table_log_handler->flush(thd, &close_slow_log, &close_general_log);
+    /*
+      Deny others from logging to general and slow log,
+      while reopening tables.
+    */
+    logger.lock();
 
-  /* end of log tables flush */
-  logger.unlock();
+    table_log_handler->flush(table_log_handler->general_log_thd,
+                             &close_slow_log, &close_general_log);
+
+    /* end of log tables flush */
+    logger.unlock();
+  }
   return FALSE;
 }
 
Thread
bk commit into 5.1 tree (petr:1.2366) BUG#18848Petr Chardin18 Apr