diff options
author | unknown <mats@romeo.(none)> | 2007-04-20 10:46:58 +0200 |
---|---|---|
committer | unknown <mats@romeo.(none)> | 2007-04-20 10:46:58 +0200 |
commit | dadde7fb866f0d25599e471907d2d7c0256af8ec (patch) | |
tree | 44a10d56daf367ccca2ba562acd1642e610f9e8f /sql/ha_ndbcluster_binlog.cc | |
parent | 4b7b0bf9d391aee492af1277d01eab6fca7ed74d (diff) | |
parent | 9340cb193e40516d051f02cdd074dd30b99816a4 (diff) | |
download | mariadb-git-dadde7fb866f0d25599e471907d2d7c0256af8ec.tar.gz |
Merge romeo.(none):/home/bkroot/mysql-5.1-rpl
into romeo.(none):/home/bk/merge-mysql-5.1
BitKeeper/etc/ignore:
auto-union
client/mysql.cc:
Auto merged
client/mysqlbinlog.cc:
Auto merged
configure.in:
Auto merged
client/mysqltest.c:
Auto merged
mysql-test/r/rpl_ndb_basic.result:
Auto merged
mysql-test/t/disabled.def:
Auto merged
sql/CMakeLists.txt:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/ha_ndbcluster.h:
Auto merged
sql/ha_ndbcluster_binlog.cc:
Auto merged
sql/log.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_repl.cc:
Auto merged
Diffstat (limited to 'sql/ha_ndbcluster_binlog.cc')
-rw-r--r-- | sql/ha_ndbcluster_binlog.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 55c31d04e0e..c65c81c088c 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); |