diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-06-21 23:54:55 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-06-21 23:54:55 -0400 |
commit | 46024098be1d7887134a3a3d8d289dd7711c56dc (patch) | |
tree | c175b6b9f5913b2c2424ca4fa799b1c545e3d9a5 /sql/slave.cc | |
parent | 41d40029875bfd7f4cd6a5255e05a3c93103220f (diff) | |
parent | a6087e7dc1ef3561d8189c8db15e9591d0f9b520 (diff) | |
download | mariadb-git-46024098be1d7887134a3a3d8d289dd7711c56dc.tar.gz |
Merge tag 'mariadb-10.0.20' into 10.0-galera
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index c9dc55f2bf7..f8754e9d4cb 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -647,11 +647,10 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock) DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS); mysql_mutex_unlock(log_lock); - - if (opt_slave_parallel_threads > 0 && - !master_info_index->any_slave_sql_running()) - rpl_parallel_inactivate_pool(&global_rpl_thread_pool); } + if (opt_slave_parallel_threads > 0 && + !master_info_index->any_slave_sql_running()) + rpl_parallel_inactivate_pool(&global_rpl_thread_pool); if (thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL)) { DBUG_PRINT("info",("Terminating IO thread")); @@ -4849,10 +4848,8 @@ err_during_init: THD_CHECK_SENTRY(thd); rli->sql_driver_thd= 0; mysql_mutex_lock(&LOCK_thread_count); - THD_CHECK_SENTRY(thd); thd->rgi_fake= thd->rgi_slave= NULL; delete serial_rgi; - delete thd; mysql_mutex_unlock(&LOCK_thread_count); #ifdef WITH_WSREP /* if slave stopped due to node going non primary, we set global flag to @@ -4884,6 +4881,22 @@ err_during_init: DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5);); mysql_mutex_unlock(&rli->run_lock); // tell the world we are done + /* + Deactivate the parallel replication thread pool, if there are now no more + SQL threads running. Do this here, when we have released all locks, but + while our THD (and current_thd) is still valid. + */ + mysql_mutex_lock(&LOCK_active_mi); + if (opt_slave_parallel_threads > 0 && + !master_info_index->any_slave_sql_running()) + rpl_parallel_inactivate_pool(&global_rpl_thread_pool); + mysql_mutex_unlock(&LOCK_active_mi); + + mysql_mutex_lock(&LOCK_thread_count); + THD_CHECK_SENTRY(thd); + delete thd; + mysql_mutex_unlock(&LOCK_thread_count); + DBUG_LEAVE; // Must match DBUG_ENTER() my_thread_end(); #ifdef HAVE_OPENSSL |