summaryrefslogtreecommitdiff
path: root/sql/repl_failsafe.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-03-11 16:23:35 +0100
committerunknown <guilhem@mysql.com>2004-03-11 16:23:35 +0100
commit92fe7556e3d05b14d18e253d5cf96ada7e3dea67 (patch)
tree90f46c5c76afb57731f6600678fb72189c05d38a /sql/repl_failsafe.cc
parentfc192448fc8bb79e6e43f3b50975f27f393c37ed (diff)
downloadmariadb-git-92fe7556e3d05b14d18e253d5cf96ada7e3dea67.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. sql/item_func.cc: We don't need LOCK_active_mi just to MASTER_POS_WAIT(). sql/repl_failsafe.cc: no need for macro sql/set_var.cc: no need for macro sql/slave.cc: 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. Removing unused variables. sql/slave.h: Re-using LOCK_active_mi to serialize administrative replication commands. Macros unneeded. Removing unneeded variables. sql/sql_parse.cc: found unused variable. Replacing macros. sql/sql_show.cc: replacing macros
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()