summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/log.cc b/sql/log.cc
index ee6c0425192..e369097283c 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -3531,6 +3531,7 @@ void MYSQL_BIN_LOG::stop_background_thread()
&LOCK_binlog_background_thread);
mysql_mutex_unlock(&LOCK_binlog_background_thread);
binlog_background_thread_started= false;
+ binlog_background_thread_stop= true; // mark it's not going to restart
}
}
@@ -3729,7 +3730,8 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
DBUG_RETURN(1);
}
- if (!binlog_background_thread_started &&
+ if ((!binlog_background_thread_started &&
+ !binlog_background_thread_stop) &&
start_binlog_background_thread())
DBUG_RETURN(1);
}
@@ -10668,6 +10670,7 @@ binlog_background_thread(void *arg __attribute__((unused)))
thd->store_globals();
thd->security_ctx->skip_grants();
thd->set_command(COM_DAEMON);
+ THD_count::count--;
/*
Load the slave replication GTID state from the mysql.gtid_slave_pos
@@ -10757,6 +10760,7 @@ binlog_background_thread(void *arg __attribute__((unused)))
THD_STAGE_INFO(thd, stage_binlog_stopping_background_thread);
/* No need to use mutex as thd is not linked into other threads */
+ THD_count::count++;
delete thd;
my_thread_end();