diff options
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 78f3ec90ff6..81597212c62 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3853,7 +3853,9 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi, { mi->slave_running= MYSQL_SLAVE_RUN_NOT_CONNECT; thd->proc_info= messages[SLAVE_RECON_MSG_WAIT]; - thd->clear_active_mysql(); +#ifdef SIGNAL_WITH_VIO_CLOSE + thd->clear_active_vio(); +#endif end_server(mysql); if ((*retry_count)++) { @@ -4265,14 +4267,16 @@ err: if (mysql) { /* - Here we need to clear the active mysql before closing the + Here we need to clear the active VIO before closing the connection with the master. The reason is that THD::awake() might be called from terminate_slave_thread() because somebody - issued a STOP SLAVE. If that happends, the close_active_mysql() + issued a STOP SLAVE. If that happends, the close_active_vio() can be called in the middle of closing the VIO associated with the 'mysql' object, causing a crash. */ - thd->clear_active_mysql(); +#ifdef SIGNAL_WITH_VIO_CLOSE + thd->clear_active_vio(); +#endif mysql_close(mysql); mi->mysql=0; } @@ -6148,9 +6152,11 @@ void end_relay_log_info(Relay_log_info* rli) extern "C" void slave_io_thread_detach_vio() { +#ifdef SIGNAL_WITH_VIO_CLOSE THD *thd= current_thd; if (thd && thd->slave_thread) - thd->clear_active_mysql(); + thd->clear_active_vio(); +#endif } @@ -6309,7 +6315,9 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, general_log_print(thd, COM_CONNECT_OUT, "%s@%s:%d", mi->user, mi->host, mi->port); } - thd->set_active_mysql(mysql); +#ifdef SIGNAL_WITH_VIO_CLOSE + thd->set_active_vio(mysql->net.vio); +#endif } mysql->reconnect= 1; DBUG_PRINT("exit",("slave_was_killed: %d", slave_was_killed)); |