summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-07-31 22:33:20 +0200
committerunknown <guilhem@mysql.com>2004-07-31 22:33:20 +0200
commit00e7ec42795c08da55a22cc76d1e988c2a114098 (patch)
tree0f8a3d06ad26a2e3d61d38def3d87f5c2097ccaa /sql/log.cc
parent42ed0103c8cac51d84c9fdf339058a85667cd19a (diff)
downloadmariadb-git-00e7ec42795c08da55a22cc76d1e988c2a114098.tar.gz
Fix for:
Bug #4810 "deadlock with KILL when the victim was in a wait state" (I included mutex unlock into exit_cond() for future safety) and BUG#4827 "KILL while START SLAVE may lead to replication slave crash" sql/lock.cc: we did exit_cond() before unlock(LOCK_open), which led to deadlocks with THD::awake(). Fixing this. sql/log.cc: mutex unlock is now included in exit_cond() sql/repl_failsafe.cc: we did exit_cond() before unlock(LOCK_rpl_status), which led to deadlocks with THD::awake(). Fixing this. sql/slave.cc: we did exit_cond() before unlock(cond_lock), which led to deadlocks with THD::awake(). Fixing this. Fixing also that if killed while waiting for slave thread to start, we don't release the mutex (that caused a double release of the mutex => crash). sql/sql_class.h: comments about exit_cond()/enter_cond(). Mutex unlock is now included in exit_cond() so that it's always done in the good order. sql/sql_table.cc: unlock is now included in exit_cond().
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc9
1 files changed, 2 insertions, 7 deletions
diff --git a/sql/log.cc b/sql/log.cc
index a0e2196cc59..e031656cc6e 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1533,12 +1533,8 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
NOTES
One must have a lock on LOCK_log before calling this function.
- This lock will be freed before return!
-
- The reason for the above is that for enter_cond() / exit_cond() to
- work the mutex must be got before enter_cond() but releases before
- exit_cond().
- If you don't do it this way, you will get a deadlock in THD::awake()
+ This lock will be freed before return! That's required by
+ THD::enter_cond() (see NOTES in sql_class.h).
*/
@@ -1551,7 +1547,6 @@ the I/O slave thread to update it" :
"Has sent all binlog to slave; \
waiting for binlog to be updated");
pthread_cond_wait(&update_cond, &LOCK_log);
- pthread_mutex_unlock(&LOCK_log); // See NOTES
thd->exit_cond(old_msg);
}