List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:February 18 2010 2:23pm
Subject:bzr commit into mysql-5.5-next-mr-bugfixing branch
(alfranio.correia:2968) Bug#43406
View as plain text  
#At file:///home/acorreia/workspace.sun/repository.mysql/bzrwork/bug-43406/mysql-next-mr-bugfixing/ based on revid:magne.mahre@stripped

 2968 Alfranio Correia	2010-02-18
      BUG#43406 CHANGE MASTER TO should log previous state in error log
      
      When issuing a 'CHANGE MASTER TO' statement, key elements of the previous
      state, namely the host, the master_log_file and the master_log_pos are
      dumped into the error log.

    modified:
      sql/sql_repl.cc
=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc	2010-02-05 15:11:16 +0000
+++ b/sql/sql_repl.cc	2010-02-18 14:23:02 +0000
@@ -1343,6 +1343,9 @@ bool change_master(THD* thd, Master_info
   int thread_mask;
   const char* errmsg= 0;
   bool need_relay_log_purge= 1;
+  char saved_log_name[FN_REFLEN];
+  char saved_host[HOSTNAME_LENGTH + 1];
+  my_off_t saved_log_pos;
   bool ret= FALSE;
   DBUG_ENTER("change_master");
 
@@ -1386,6 +1389,16 @@ bool change_master(THD* thd, Master_info
   */
 
   /*
+    Before processing the command, save the previous state.
+  */
+  char *pos;
+  pos= strmake(saved_host, mi->host, HOSTNAME_LENGTH);
+  pos= '\0';
+  pos= strmake(saved_log_name, mi->master_log_name, FN_REFLEN - 1);
+  pos= '\0';
+  saved_log_pos= mi->master_log_pos;
+
+  /*
     If the user specified host or port without binlog or position,
     reset binlog's name to FIRST and position to 4.
   */
@@ -1583,6 +1596,14 @@ bool change_master(THD* thd, Master_info
   /* Clear the errors, for a clean start */
   mi->rli.clear_error();
   mi->rli.clear_until_condition();
+
+  sql_print_information("'CHANGE MASTER TO executed'. "
+    "Previous state master_host='%s', master_log_file='%s', "
+    "master_log_pos='%ld'. "
+    "New state master_host='%s', master_log_file='%s', "
+    "master_log_pos='%ld'.", saved_host, saved_log_name, (ulong) saved_log_pos,
+    mi->host, mi->master_log_name, (ulong) mi->master_log_pos);
+
   /*
     If we don't write new coordinates to disk now, then old will remain in
     relay-log.info until START SLAVE is issued; but if mysqld is shutdown


Attachment: [text/bzr-bundle]
Thread
bzr commit into mysql-5.5-next-mr-bugfixing branch(alfranio.correia:2968) Bug#43406Alfranio Correia18 Feb
  • Re: bzr commit into mysql-5.5-next-mr-bugfixing branch(alfranio.correia:2968) Bug#43406Luís Soares19 Feb
    • Re: bzr commit into mysql-5.5-next-mr-bugfixing branch(alfranio.correia:2968) Bug#43406Alfranio Correia19 Feb
      • Re: bzr commit into mysql-5.5-next-mr-bugfixing branch(alfranio.correia:2968) Bug#43406Luís Soares25 Feb