Commit 4a0612ed authored by Sergei Golubchik's avatar Sergei Golubchik

stop binlog background thread together with others

that fixes many rpl tests failures
parent 562c1df7
...@@ -3171,17 +3171,9 @@ MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period) ...@@ -3171,17 +3171,9 @@ MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period)
bzero((char*) &purge_index_file, sizeof(purge_index_file)); bzero((char*) &purge_index_file, sizeof(purge_index_file));
} }
/* this is called only once */ void MYSQL_BIN_LOG::stop_background_thread()
void MYSQL_BIN_LOG::cleanup()
{ {
DBUG_ENTER("cleanup"); if (binlog_background_thread_started)
if (inited)
{
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); mysql_mutex_lock(&LOCK_binlog_background_thread);
binlog_background_thread_stop= true; binlog_background_thread_stop= true;
...@@ -3192,6 +3184,20 @@ void MYSQL_BIN_LOG::cleanup() ...@@ -3192,6 +3184,20 @@ void MYSQL_BIN_LOG::cleanup()
mysql_mutex_unlock(&LOCK_binlog_background_thread); mysql_mutex_unlock(&LOCK_binlog_background_thread);
binlog_background_thread_started= false; binlog_background_thread_started= false;
} }
}
/* this is called only once */
void MYSQL_BIN_LOG::cleanup()
{
DBUG_ENTER("cleanup");
if (inited)
{
xid_count_per_binlog *b;
/* Wait for the binlog background thread to stop. */
if (!is_relay_log)
stop_background_thread();
inited= 0; inited= 0;
close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT); close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT);
......
...@@ -589,6 +589,8 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG ...@@ -589,6 +589,8 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
mysql_cond_t COND_binlog_background_thread; mysql_cond_t COND_binlog_background_thread;
mysql_cond_t COND_binlog_background_thread_end; mysql_cond_t COND_binlog_background_thread_end;
void stop_background_thread();
using MYSQL_LOG::generate_name; using MYSQL_LOG::generate_name;
using MYSQL_LOG::is_open; using MYSQL_LOG::is_open;
......
...@@ -1717,6 +1717,7 @@ static void close_connections(void) ...@@ -1717,6 +1717,7 @@ static void close_connections(void)
Events::deinit(); Events::deinit();
end_slave(); end_slave();
mysql_bin_log.stop_background_thread();
/* /*
Give threads time to die. Give threads time to die.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment