summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorunknown <elliot@mysql.com>2006-06-25 09:59:34 -0400
committerunknown <elliot@mysql.com>2006-06-25 09:59:34 -0400
commitc2575322c696eedbb120737c5c35ed8b972eca96 (patch)
tree58d0df03a85c17a3a29ebd9cc7455d8cc34e2322 /sql/slave.cc
parentd98a7999e2e13dd9aac38995cf55a570752c7647 (diff)
parent41b9884db0db0b3e16562161a86e94a998bcce2d (diff)
downloadmariadb-git-c2575322c696eedbb120737c5c35ed8b972eca96.tar.gz
Merge mysql.com:/home/emurphy/src/bk-clean/tmp_merge
into mysql.com:/home/emurphy/src/bk-clean/mysql-5.1 mysql-test/mysql-test-run.sh: Auto merged mysql-test/valgrind.supp: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/r/insert_select.result: Auto merged mysql-test/r/myisam.result: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/myisam.test: Auto merged mysql-test/t/select.test: Auto merged mysys/Makefile.am: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_strfunc.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_sum.cc: Auto merged sql/slave.cc: Auto merged sql/sql_select.cc: Auto merged storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: Auto merged storage/ndb/src/ndbapi/ndberror.c: Auto merged include/Makefile.am: manual merge mysql-test/r/func_time.result: manual merge mysql-test/r/select.result: manual merge
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;
}