List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:March 5 2009 9:21am
Subject:bzr commit into mysql-6.0-rpl branch (alfranio.correia:2820) Bug#43075
View as plain text  
#At file:///home/acorreia/workspace.sun/repository.mysql/bzrwork/bug-43075/mysql-6.0-rpl/ based on revid:zhenxing.he@stripped

 2820 Alfranio Correia	2009-03-05
      BUG#43075 rpl.rpl_sync fails sporadically on pushbuild
      
      The slave was crashing while failing to execute the init_slave() function.
      The issue stem from two different reasons:
      
      1 - A failure before allocating the master info structure
      thus generating a segfault while accessing a NULL structure.
      
      2 - A failure after allocating the master info structure structure
      thus generating a segfault due to a non-initialized relay log file.
      
      The patch tests if the master info structure and relay log file are allocated
      before accessing them.
modified:
  sql/rpl_mi.cc
  sql/rpl_rli.cc
  sql/slave.cc

per-file messages:
  sql/rpl_mi.cc
    Verifies if the relay log file was created before accessing it.
  sql/rpl_rli.cc
    Makes sure that the relay log file is set to NULL before starting up the slave.
  sql/slave.cc
    Verifies if the master info structure was allocated before accessing it.
=== modified file 'sql/rpl_mi.cc'
--- a/sql/rpl_mi.cc	2009-02-19 08:54:07 +0000
+++ b/sql/rpl_mi.cc	2009-03-05 09:21:47 +0000
@@ -175,11 +175,15 @@ int init_master_info(Master_info* mi, co
       position is at the beginning of the file, and will read the
       "signature" and then fast-forward to the last position read.
     */
+    error= 0;
     if (thread_mask & SLAVE_SQL)
     {
-      my_b_seek(mi->rli.cur_log, (my_off_t) 0);
+      if (mi->rli.cur_log) 
+        my_b_seek(mi->rli.cur_log, (my_off_t) 0);
+      else
+        error= 1;
     }
-    DBUG_RETURN(0);
+    DBUG_RETURN(error);
   }
 
   mi->mysql=0;

=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc	2009-02-27 13:20:11 +0000
+++ b/sql/rpl_rli.cc	2009-03-05 09:21:47 +0000
@@ -34,7 +34,7 @@ Relay_log_info::Relay_log_info(bool is_s
   :Slave_reporting_capability("SQL"),
    no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id),
    info_fd(-1), cur_log_fd(-1), 
-   relay_log(&sync_relaylog_period), sync_counter(0),
+   relay_log(&sync_relaylog_period), cur_log(NULL), sync_counter(0),
    is_relay_log_recovery(is_slave_recovery),
    save_temporary_tables(0),
    cur_log_old_open_count(0), group_relay_log_pos(0), event_relay_log_pos(0),
@@ -101,6 +101,7 @@ int init_relay_log_info(Relay_log_info* 
   pthread_mutex_lock(&rli->data_lock);
   info_fd = rli->info_fd;
   rli->cur_log_fd = -1;
+  rli->cur_log = NULL;
   rli->slave_skip_counter=0;
   rli->abort_pos_wait=0;
   rli->log_space_limit= relay_log_space_limit;

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2009-02-27 13:20:11 +0000
+++ b/sql/slave.cc	2009-03-05 09:21:47 +0000
@@ -285,7 +285,8 @@ int init_slave()
   }
 
 err:
-  active_mi->rli.is_relay_log_recovery= FALSE;
+  if (active_mi)
+    active_mi->rli.is_relay_log_recovery= FALSE;
   pthread_mutex_unlock(&LOCK_active_mi);
   DBUG_RETURN(error);
 }

Thread
bzr commit into mysql-6.0-rpl branch (alfranio.correia:2820) Bug#43075Alfranio Correia5 Mar