Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-09-01 15:06:16+02:00, jonas@stripped +3 -0
bug#21965 - replication
fix deadlock between "show master logs" and switching of logfile
sql/log.cc@stripped, 2006-09-01 15:06:14+02:00, jonas@stripped +8 -3
1) Add method for getting current log w/ mutex already locked
2) Correct mutex unlock order in MYSQL_LOG::new_file
sql/sql_class.h@stripped, 2006-09-01 15:06:14+02:00, jonas@stripped +1 -0
Add method for getting current log w/ mutex already locked
sql/sql_repl.cc@stripped, 2006-09-01 15:06:14+02:00, jonas@stripped +5 -1
Move taking of "log_log" out of get_current_log
So that you dont lock "log_lock" and "index_lock" in correct order
to prevent deadlock
NOTE: I then unlock log_lock wo/ unlocking index_lock.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jonas
# Host: perch.ndb.mysql.com
# Root: /home/jonas/src/mysql-5.1-wl2325-5.0
--- 1.178/sql/log.cc 2006-09-01 15:06:19 +02:00
+++ 1.179/sql/log.cc 2006-09-01 15:06:19 +02:00
@@ -716,13 +716,18 @@
int MYSQL_LOG::get_current_log(LOG_INFO* linfo)
{
pthread_mutex_lock(&LOCK_log);
+ int ret = raw_get_current_log(linfo);
+ pthread_mutex_unlock(&LOCK_log);
+ return ret;
+}
+
+int MYSQL_LOG::raw_get_current_log(LOG_INFO* linfo)
+{
strmake(linfo->log_file_name, log_file_name, sizeof(linfo->log_file_name)-1);
linfo->pos = my_b_tell(&log_file);
- pthread_mutex_unlock(&LOCK_log);
return 0;
}
-
/*
Move all data up in a file in an filename index file
@@ -1406,9 +1411,9 @@
my_free(old_name,MYF(0));
end:
+ pthread_mutex_unlock(&LOCK_index);
if (need_lock)
pthread_mutex_unlock(&LOCK_log);
- pthread_mutex_unlock(&LOCK_index);
DBUG_VOID_RETURN;
}
--- 1.268/sql/sql_class.h 2006-09-01 15:06:19 +02:00
+++ 1.269/sql/sql_class.h 2006-09-01 15:06:19 +02:00
@@ -357,6 +357,7 @@
bool need_mutex);
int find_next_log(LOG_INFO* linfo, bool need_mutex);
int get_current_log(LOG_INFO* linfo);
+ int raw_get_current_log(LOG_INFO* linfo);
uint next_file_id();
inline bool is_open() { return log_type != LOG_CLOSED; }
inline char* get_index_fname() { return index_file_name;}
--- 1.144/sql/sql_repl.cc 2006-09-01 15:06:19 +02:00
+++ 1.145/sql/sql_repl.cc 2006-09-01 15:06:19 +02:00
@@ -1515,10 +1515,14 @@
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
+
+ pthread_mutex_lock(mysql_bin_log.get_log_lock());
mysql_bin_log.lock_index();
index_file=mysql_bin_log.get_index_file();
- mysql_bin_log.get_current_log(&cur);
+ mysql_bin_log.raw_get_current_log(&cur);
+ pthread_mutex_unlock(mysql_bin_log.get_log_lock()); // lockdep, OK
+
cur_dir_len= dirname_length(cur.log_file_name);
reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0);
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.2042) BUG#21965 | jonas | 1 Sep |