summaryrefslogtreecommitdiff
path: root/sql/repl_failsafe.cc
diff options
context:
space:
mode:
authorguilhem@mysql.com <>2004-03-11 16:23:35 +0100
committerguilhem@mysql.com <>2004-03-11 16:23:35 +0100
commitcf287341cc4e418b5310f8882970ad32a00c728a (patch)
tree90f46c5c76afb57731f6600678fb72189c05d38a /sql/repl_failsafe.cc
parent1c0d5ad25c1f530093586e7624ae3603ff719061 (diff)
downloadmariadb-git-cf287341cc4e418b5310f8882970ad32a00c728a.tar.gz
Fix for BUG#2921 "Replication problem on mutex lock in mySQL-4.0.18":
re-using unused LOCK_active_mi to serialize all administrative commands related to replication: START SLAVE, STOP SLAVE, RESET SLAVE, CHANGE MASTER, init_slave() (replication autostart at server startup), end_slave() (replication autostop at server shutdown), LOAD DATA FROM MASTER. This protects us against a handful of deadlocks (like BUG#2921 when two START SLAVE, but when two STOP SLAVE too). Removing unused variables.
Diffstat (limited to 'sql/repl_failsafe.cc')
-rw-r--r--sql/repl_failsafe.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 56789a01bf4..e687b227946 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -750,7 +750,7 @@ int load_master_data(THD* thd)
We do not want anyone messing with the slave at all for the entire
duration of the data load.
*/
- LOCK_ACTIVE_MI;
+ pthread_mutex_lock(&LOCK_active_mi);
lock_slave_threads(active_mi);
init_thread_mask(&restart_thread_mask,active_mi,0 /*not inverse*/);
if (restart_thread_mask &&
@@ -759,7 +759,7 @@ int load_master_data(THD* thd)
{
send_error(&thd->net,error);
unlock_slave_threads(active_mi);
- UNLOCK_ACTIVE_MI;
+ pthread_mutex_unlock(&LOCK_active_mi);
return 1;
}
@@ -913,7 +913,7 @@ int load_master_data(THD* thd)
{
send_error(&thd->net, 0, "Failed purging old relay logs");
unlock_slave_threads(active_mi);
- UNLOCK_ACTIVE_MI;
+ pthread_mutex_unlock(&LOCK_active_mi);
return 1;
}
pthread_mutex_lock(&active_mi->rli.data_lock);
@@ -934,7 +934,7 @@ int load_master_data(THD* thd)
err:
unlock_slave_threads(active_mi);
- UNLOCK_ACTIVE_MI;
+ pthread_mutex_unlock(&LOCK_active_mi);
thd->proc_info = 0;
mc_mysql_close(&mysql); // safe to call since we always do mc_mysql_init()