MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:jonas Date:September 4 2006 11:43am
Subject:bk commit into 4.1 tree (jonas:1.2544) BUG#21965
View as plain text  
Below is the list of changes that have just been committed into a local
4.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-04 13:43:34+02:00, jonas@stripped +3 -0
  bug#21965 - replication
    fix deadlock if master switches log file in parallell with "show master logs"
    

  sql/log.cc@stripped, 2006-09-04 13:43:32+02:00, jonas@stripped +7 -2
    add raw_get_current_log which dont take log mutex

  sql/sql_class.h@stripped, 2006-09-04 13:43:32+02:00, jonas@stripped +1 -0
    add raw_get_current_log which dont take log mutex

  sql/sql_repl.cc@stripped, 2006-09-04 13:43:32+02:00, jonas@stripped +6 -2
    Fix lock order i.e first log_lock then 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/41-work

--- 1.164/sql/log.cc	2006-09-04 13:43:36 +02:00
+++ 1.165/sql/log.cc	2006-09-04 13:43:36 +02:00
@@ -409,12 +409,17 @@
 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

--- 1.287/sql/sql_class.h	2006-09-04 13:43:36 +02:00
+++ 1.288/sql/sql_class.h	2006-09-04 13:43:36 +02:00
@@ -177,6 +177,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.137/sql/sql_repl.cc	2006-09-04 13:43:36 +02:00
+++ 1.138/sql/sql_repl.cc	2006-09-04 13:43:36 +02:00
@@ -1359,10 +1359,14 @@
                                            MYSQL_TYPE_LONGLONG));
   if (protocol->send_fields(&field_list, 1))
     DBUG_RETURN(1);
+  
+  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); // dont take mutex
+  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 4.1 tree (jonas:1.2544) BUG#21965jonas4 Sep