diff options
author | monty@mysql.com/narttu.mysql.fi <> | 2007-04-16 17:08:29 +0300 |
---|---|---|
committer | monty@mysql.com/narttu.mysql.fi <> | 2007-04-16 17:08:29 +0300 |
commit | 72d135bec59d7556736800bf3f9d268897e2832d (patch) | |
tree | 66913f618e8d3460513451fab5622e144183cd15 /sql | |
parent | 455b325b53aa23fa112ad6fe3751d508f017dcb7 (diff) | |
download | mariadb-git-72d135bec59d7556736800bf3f9d268897e2832d.tar.gz |
Clear field_alloc when it's moved to result set (allows us to always call free_root on field_alloc)
Change to use remove_file instead of 'system rm' in a lot of tests. (Should fix some windows test problems)
Removed memory leak in mysql_test if sync_with_master fails.
Do not terminate ndb_cluster_binary_log before the util thread has finnished. This should fix a shutdown bug where a thread is accessing injector_mutex after it's freed.
Patch may fix Bug#27622 "mysqld shutdown, util thread continues, while binlog thread exits"
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_ndbcluster.cc | 2 | ||||
-rw-r--r-- | sql/ha_ndbcluster.h | 4 | ||||
-rw-r--r-- | sql/ha_ndbcluster_binlog.cc | 22 |
3 files changed, 25 insertions, 3 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 9721b877e01..8a3675483ef 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -133,7 +133,7 @@ static uint ndbcluster_alter_table_flags(uint flags) } static int ndbcluster_inited= 0; -static int ndbcluster_terminating= 0; +int ndbcluster_terminating= 0; static Ndb* g_ndb= NULL; Ndb_cluster_connection* g_ndb_cluster_connection= NULL; diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index fe79135a47d..72e03fc2edd 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -1004,4 +1004,6 @@ void ndbcluster_print_error(int error, const NdbOperation *error_op); static const char ndbcluster_hton_name[]= "ndbcluster"; static const int ndbcluster_hton_name_length=sizeof(ndbcluster_hton_name)-1; - +extern int ndbcluster_terminating; +extern int ndb_util_thread_running; +extern pthread_cond_t COND_ndb_util_ready; diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 1c5db73ef6e..95b72cba64a 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -582,10 +582,30 @@ static int ndbcluster_binlog_end(THD *thd) ndbcluster_binlog_inited= 0; #ifdef HAVE_NDB_BINLOG + if (ndb_util_thread_running > 0) + { + /* + Wait for util thread to die (as this uses the injector mutex) + There is a very small change that ndb_util_thread dies and the + following mutex is freed before it's accessed. This shouldn't + however be a likely case as the ndbcluster_binlog_end is supposed to + be called before ndb_cluster_end(). + */ + pthread_mutex_lock(&LOCK_ndb_util_thread); + /* Ensure mutex are not freed if ndb_cluster_end is running at same time */ + ndb_util_thread_running++; + ndbcluster_terminating= 1; + pthread_cond_signal(&COND_ndb_util_thread); + while (ndb_util_thread_running > 1) + pthread_cond_wait(&COND_ndb_util_ready, &LOCK_ndb_util_thread); + ndb_util_thread_running--; + pthread_mutex_unlock(&LOCK_ndb_util_thread); + } + /* wait for injector thread to finish */ ndbcluster_binlog_terminating= 1; - pthread_cond_signal(&injector_cond); pthread_mutex_lock(&injector_mutex); + pthread_cond_signal(&injector_cond); while (ndb_binlog_thread_running > 0) pthread_cond_wait(&injector_cond, &injector_mutex); pthread_mutex_unlock(&injector_mutex); |