summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-05-11 19:28:58 +0200
committerSergei Golubchik <serg@mariadb.org>2016-06-04 09:06:00 +0200
commit4a0612ed2ab95305668a56b1d300526c7b595a29 (patch)
treef18ae409adea7dfe72028a643f48beb0551fef8a
parent562c1df7d97cb23145e09b3482fd18d49476752d (diff)
downloadmariadb-git-4a0612ed2ab95305668a56b1d300526c7b595a29.tar.gz
stop binlog background thread together with othersbb-fast-connect
that fixes many rpl tests failures
-rw-r--r--sql/log.cc28
-rw-r--r--sql/log.h2
-rw-r--r--sql/mysqld.cc1
3 files changed, 20 insertions, 11 deletions
diff --git a/sql/log.cc b/sql/log.cc
index aed30e2bb39..c81869a57e7 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -3171,6 +3171,21 @@ MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period)
bzero((char*) &purge_index_file, sizeof(purge_index_file));
}
+void MYSQL_BIN_LOG::stop_background_thread()
+{
+ if (binlog_background_thread_started)
+ {
+ mysql_mutex_lock(&LOCK_binlog_background_thread);
+ binlog_background_thread_stop= true;
+ mysql_cond_signal(&COND_binlog_background_thread);
+ while (binlog_background_thread_stop)
+ mysql_cond_wait(&COND_binlog_background_thread_end,
+ &LOCK_binlog_background_thread);
+ mysql_mutex_unlock(&LOCK_binlog_background_thread);
+ binlog_background_thread_started= false;
+ }
+}
+
/* this is called only once */
void MYSQL_BIN_LOG::cleanup()
@@ -3181,17 +3196,8 @@ void MYSQL_BIN_LOG::cleanup()
xid_count_per_binlog *b;
/* Wait for the binlog background thread to stop. */
- if (!is_relay_log && binlog_background_thread_started)
- {
- mysql_mutex_lock(&LOCK_binlog_background_thread);
- binlog_background_thread_stop= true;
- mysql_cond_signal(&COND_binlog_background_thread);
- while (binlog_background_thread_stop)
- mysql_cond_wait(&COND_binlog_background_thread_end,
- &LOCK_binlog_background_thread);
- mysql_mutex_unlock(&LOCK_binlog_background_thread);
- binlog_background_thread_started= false;
- }
+ if (!is_relay_log)
+ stop_background_thread();
inited= 0;
close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT);
diff --git a/sql/log.h b/sql/log.h
index e556ef91399..40e9e4fdc58 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -589,6 +589,8 @@ public:
mysql_cond_t COND_binlog_background_thread;
mysql_cond_t COND_binlog_background_thread_end;
+ void stop_background_thread();
+
using MYSQL_LOG::generate_name;
using MYSQL_LOG::is_open;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 270d75976cb..c9945044e66 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1717,6 +1717,7 @@ static void close_connections(void)
Events::deinit();
end_slave();
+ mysql_bin_log.stop_background_thread();
/*
Give threads time to die.