MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:October 17 2007 10:17am
Subject:bk commit into 5.1 tree (aelkin:1.2608) BUG#20435
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of elkin. When elkin 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, 2007-10-17 13:16:57+03:00, aelkin@stripped +2 -0
  bug#20435 wl#342 heartbeat
  
  expanding possible error message from attempt to set up the period
  on the master;
  costemitic change in setting the default value for heartbeat;

  sql/rpl_mi.cc@stripped, 2007-10-17 13:16:53+03:00, aelkin@stripped +4 -2
    Enforcing the max for heartbeat stays. A flaw (of cosmetic character) was in that the default
    slave_net_timeout/2 might be bigger than SLAVE_MAX_HEARTBEAT_PERIOD.

  sql/slave.cc@stripped, 2007-10-17 13:16:53+03:00, aelkin@stripped +29 -19
    had to refactor error message generation in the function.
    Heartbeat branch is elaborated on with reporting the exact query and its error.

diff -Nrup a/sql/rpl_mi.cc b/sql/rpl_mi.cc
--- a/sql/rpl_mi.cc	2007-10-15 16:03:44 +03:00
+++ b/sql/rpl_mi.cc	2007-10-17 13:16:53 +03:00
@@ -78,8 +78,10 @@ void init_master_info_with_options(MASTE
     if CHANGE MASTER did not specify it.  (no data loss in conversion
     as hb period has a max)
   */
-  mi->heartbeat_period= (float) (slave_net_timeout/2.0);
-
+  mi->heartbeat_period= (float) min(SLAVE_MAX_HEARTBEAT_PERIOD,
+                                    (slave_net_timeout/2.0));
+  DBUG_ASSERT(mi->heartbeat_period > (float) 0.001
+              || mi->heartbeat_period == 0);
   mi->ssl= master_ssl;
   if (master_ssl_ca)
     strmake(mi->ssl_ca, master_ssl_ca, sizeof(mi->ssl_ca)-1);
diff -Nrup a/sql/slave.cc b/sql/slave.cc
--- a/sql/slave.cc	2007-10-13 23:41:05 +03:00
+++ b/sql/slave.cc	2007-10-17 13:16:53 +03:00
@@ -759,7 +759,9 @@ int init_floatvar_from_file(float* var, 
 
 static int get_master_version_and_clock(MYSQL* mysql, MASTER_INFO* mi)
 {
-  const char* errmsg= 0;
+  char error_buf[512];
+  String err_msg(error_buf, sizeof(error_buf), &my_charset_bin);
+  err_msg.length(0);
   DBUG_ENTER("get_master_version_and_clock");
 
   /*
@@ -770,7 +772,7 @@ static int get_master_version_and_clock(
   mi->rli.relay_log.description_event_for_queue= 0;
 
   if (!my_isdigit(&my_charset_bin,*mysql->server_version))
-    errmsg = "Master reported unrecognized MySQL version";
+    err_msg.append("Master reported unrecognized MySQL version");
   else
   {
     /*
@@ -781,7 +783,7 @@ static int get_master_version_and_clock(
     case '0':
     case '1':
     case '2':
-      errmsg = "Master reported unrecognized MySQL version";
+      err_msg.append("Master reported unrecognized MySQL version");
       break;
     case '3':
       mi->rli.relay_log.description_event_for_queue= new
@@ -813,9 +815,9 @@ static int get_master_version_and_clock(
      events sent by the master, and there will be error messages.
   */
 
-  if (errmsg)
+  if (err_msg.length() != 0)
   {
-    sql_print_error(errmsg);
+    sql_print_error(err_msg.ptr());
     DBUG_RETURN(1);
   }
 
@@ -870,10 +872,10 @@ static int get_master_version_and_clock(
     if ((master_row= mysql_fetch_row(master_res)) &&
         (::server_id == strtoul(master_row[1], 0, 10)) &&
         !mi->rli.replicate_same_server_id)
-      errmsg= "The slave I/O thread stops because master and slave have equal \
-MySQL server ids; these ids must be different for replication to work (or \
-the --replicate-same-server-id option must be used on slave but this does \
-not always make sense; please check the manual before using it).";
+      err_msg.append("The slave I/O thread stops because master and slave have equal"
+                     " MySQL server ids; these ids must be different for replication to work (or"
+                     " the --replicate-same-server-id option must be used on slave but this does"
+                     " not always make sense; please check the manual before using it).");
     mysql_free_result(master_res);
   }
 
@@ -905,9 +907,9 @@ not always make sense; please check the 
   {
     if ((master_row= mysql_fetch_row(master_res)) &&
         strcmp(master_row[0], global_system_variables.collation_server->name))
-      errmsg= "The slave I/O thread stops because master and slave have \
-different values for the COLLATION_SERVER global variable. The values must \
-be equal for replication to work";
+      err_msg.append("The slave I/O thread stops because master and slave have"
+                     " different values for the COLLATION_SERVER global variable."
+                     " The values must be equal for replication to work");
     mysql_free_result(master_res);
   }
 
@@ -933,11 +935,10 @@ be equal for replication to work";
     if ((master_row= mysql_fetch_row(master_res)) &&
         strcmp(master_row[0],
                global_system_variables.time_zone->get_name()->ptr()))
-      errmsg= "The slave I/O thread stops because master and slave have \
-different values for the TIME_ZONE global variable. The values must \
-be equal for replication to work";
+      err_msg.append("The slave I/O thread stops because master and slave have"
+                     " different values for the TIME_ZONE global variable."
+                     " The values must be equal for replication to work");
     mysql_free_result(master_res);
-    goto err;
   }
 
   if (mi->heartbeat_period != 0.0)
@@ -953,15 +954,24 @@ be equal for replication to work";
 
     if (mysql_real_query(mysql, query, strlen(query)))
     {
-      errmsg= "The slave I/O thread stops because querying the master failed";
+      err_msg.append("The slave I/O thread stops because querying master with '");
+      err_msg.append(query);
+      err_msg.append("' failed;");
+      err_msg.append(" error: ");
+      err_msg.qs_append(mysql_errno(mysql));
+      err_msg.append("  '");
+      err_msg.append(mysql_error(mysql));
+      err_msg.append("'");
+      mysql_free_result(mysql_store_result(mysql));
       goto err;
     }
+    mysql_free_result(mysql_store_result(mysql));
   }
   
 err:
-  if (errmsg)
+  if (err_msg.length() != 0)
   {
-    sql_print_error(errmsg);
+    sql_print_error(err_msg.ptr());
     DBUG_RETURN(1);
   }
 
Thread
bk commit into 5.1 tree (aelkin:1.2608) BUG#20435Andrei Elkin17 Oct