List:Internals« Previous MessageNext Message »
From:Stewart Smith Date:May 26 2005 2:37am
Subject:bk commit into 5.1 tree (stewart:1.1879)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of stewart. When stewart 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.1879 05/05/26 12:36:49 stewart@stripped +2 -0
  WL#2325 NDB Injector thread: fix crash on mysqld shutdown
  
  there was a race condition that would cause mysqld to segfault on shutdown.

  sql/handler.cc
    1.169 05/05/26 12:36:40 stewart@stripped +4 -4
    in ha_panic, call ndbcluster_end before mi_panic.
    
    This is because the ndb injector thread (for cluster-wide replication) uses a MyISAM
    table to store data. This means we must shut down ha_ndbcluster *before* we call
    mi_panic (which closes *all* MyISAM tables, even if we're using them).

  sql/ha_ndbcluster.cc
    1.255 05/05/26 12:36:40 stewart@stripped +7 -1
    On ha_ndbcluster shutdown, wait for the injector thread to finish
    
    Enable close_thread_tables cleanup call on injector thread exit

# 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:	stewart
# Host:	kennedy.(none)
# Root:	/home/stewart/Documents/MySQL/5.1/wl2325

--- 1.168/sql/handler.cc	2005-05-24 18:06:45 +10:00
+++ 1.169/sql/handler.cc	2005-05-26 12:36:40 +10:00
@@ -452,6 +452,10 @@
 int ha_panic(enum ha_panic_function flag)
 {
   int error=0;
+#ifdef HAVE_NDBCLUSTER_DB
+  if (have_ndbcluster == SHOW_OPTION_YES)
+    error|=ndbcluster_end();
+#endif
 #ifndef NO_HASH
   error|=h_panic(flag);			/* fix hash */
 #endif
@@ -469,10 +473,6 @@
 #ifdef HAVE_INNOBASE_DB
   if (have_innodb == SHOW_OPTION_YES)
     error|=innobase_end();
-#endif
-#ifdef HAVE_NDBCLUSTER_DB
-  if (have_ndbcluster == SHOW_OPTION_YES)
-    error|=ndbcluster_end();
 #endif
 #ifdef HAVE_FEDERATED_DB
   if (have_federated_db == SHOW_OPTION_YES)

--- 1.254/sql/ha_ndbcluster.cc	2005-05-25 01:23:56 +10:00
+++ 1.255/sql/ha_ndbcluster.cc	2005-05-26 12:36:40 +10:00
@@ -5479,6 +5479,12 @@
   (void) pthread_mutex_unlock(&LOCK_ndb_util_thread);
 
 #ifdef HAVE_REPLICATION
+  // wait for injector thread to finish
+  pthread_mutex_lock(&injector_mutex);
+  while(ndb_injector_thread_running>0)
+    pthread_cond_wait(&injector_cond,&injector_mutex);
+  pthread_mutex_unlock(&injector_mutex);
+
   /* remove all shares */
   {
     pthread_mutex_lock(&ndbcluster_mutex);
@@ -9438,7 +9444,7 @@
   } // for(;;)
   }
 err:
-  //close_thread_tables(thd);
+  close_thread_tables(thd);
   pthread_mutex_lock(&injector_mutex);
   /* don't mess with the injector_ndb anymore from other threads */
   injector_ndb= 0;
Thread
bk commit into 5.1 tree (stewart:1.1879)Stewart Smith26 May