summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorelliot@mysql.com <>2006-06-25 09:59:34 -0400
committerelliot@mysql.com <>2006-06-25 09:59:34 -0400
commitbc2b96fee376a51e24ca9a9ee4ddda2f5515c417 (patch)
tree58d0df03a85c17a3a29ebd9cc7455d8cc34e2322 /sql/slave.cc
parentb6e89c2b1e25a661445d165650d348b06db639ff (diff)
parentfa98891ee74531b05d0e9f7c5e3a2cce9a751288 (diff)
downloadmariadb-git-bc2b96fee376a51e24ca9a9ee4ddda2f5515c417.tar.gz
Merge mysql.com:/home/emurphy/src/bk-clean/tmp_merge
into mysql.com:/home/emurphy/src/bk-clean/mysql-5.1
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index f143faf427c..d9895323b92 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1419,6 +1419,15 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
if (connect_to_master(thd, mysql, mi))
{
my_error(ER_CONNECT_TO_MASTER, MYF(0), mysql_error(mysql));
+ /*
+ We need to clear the active VIO since, theoretically, somebody
+ might issue an awake() on this thread. If we are then in the
+ middle of closing and destroying the VIO inside the
+ mysql_close(), we will have a problem.
+ */
+#ifdef SIGNAL_WITH_VIO_CLOSE
+ thd->clear_active_vio();
+#endif
mysql_close(mysql);
DBUG_RETURN(1);
}
@@ -3507,6 +3516,17 @@ err:
VOID(pthread_mutex_unlock(&LOCK_thread_count));
if (mysql)
{
+ /*
+ 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_vio()
+ can be called in the middle of closing the VIO associated with
+ the 'mysql' object, causing a crash.
+ */
+#ifdef SIGNAL_WITH_VIO_CLOSE
+ thd->clear_active_vio();
+#endif
mysql_close(mysql);
mi->mysql=0;
}