List:Commits« Previous MessageNext Message »
From:Luis Soares Date:July 29 2010 1:21am
Subject:bzr commit into mysql-next-mr branch (luis.soares:3169) Bug#44209
View as plain text  
#At file:///home/lsoares/Workspace/bzr/work/MC/merge.to.next-mr/mysql-next-mr-push/ based on revid:luis.soares@stripped

 3169 Luis Soares	2010-07-29
      BUG#44209: MASTER_CONNECT_RETRY and --master-retry-count disconnected 
      from each other
      
      Post-push fix.
      
      CHANGE MASTER TO master_retry_count=0 was not working properly, because
      before assiging the value got from the lex, we would check if it was
      different than zero. This is wrong.
      
      To fix this we, deploy a flag that states when the value was indeed set
      by a CHANGE MASTER TO command - which could even be 0 - and only then we
      assign the new value.
     @ sql/rpl_slave.cc
        Checking the LEX_MI_UNCHANGED flag before doing the assignment instead
        of checking the value of lex_mi->retry_count.
     @ sql/sql_lex.h
        Added retry_count_opt.
     @ sql/sql_yacc.yy
        Setting the ENABLE flag when the master_retry_count was explicitly
        set in a CHANGE MASTER TO command.

    modified:
      sql/rpl_slave.cc
      sql/sql_lex.h
      sql/sql_yacc.yy
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2010-07-27 14:04:13 +0000
+++ b/sql/rpl_slave.cc	2010-07-29 01:21:15 +0000
@@ -4475,7 +4475,7 @@ static int connect_to_master(THD* thd, M
 {
   int slave_was_killed;
   int last_errno= -2;                           // impossible error
-  ulong err_count=0;
+  ulong err_count= 0;
   char llbuff[22];
   DBUG_ENTER("connect_to_master");
 
@@ -4515,6 +4515,16 @@ static int connect_to_master(THD* thd, M
     /* Don't repeat last error */
     if ((int)mysql_errno(mysql) != last_errno)
     {
+      /*
+        TODO: would be great that when issuing SHOW SLAVE STATUS
+              the number of retries would actually show err_count
+              instead of mi->retry_count.
+
+              We can achieve that if we remove the 'if' above and 
+              replace mi->retry_count with err_count. However, we
+              would be adding an entry in the error log for each 
+              connection attempt (ie, for each retry).
+       */
       last_errno=mysql_errno(mysql);
       suppress_warnings= 0;
       mi->report(ERROR_LEVEL, last_errno,
@@ -5680,7 +5690,7 @@ bool change_master(THD* thd, Master_info
     mi->port = lex_mi->port;
   if (lex_mi->connect_retry)
     mi->connect_retry = lex_mi->connect_retry;
-  if (lex_mi->retry_count)
+  if (lex_mi->retry_count_opt != LEX_MASTER_INFO::LEX_MI_UNCHANGED)
     mi->retry_count = lex_mi->retry_count;
   if (lex_mi->heartbeat_opt != LEX_MASTER_INFO::LEX_MI_UNCHANGED)
     mi->heartbeat_period = lex_mi->heartbeat_period;

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2010-07-27 14:04:13 +0000
+++ b/sql/sql_lex.h	2010-07-29 01:21:15 +0000
@@ -243,7 +243,8 @@ typedef struct st_lex_master_info
     changed variable or if it should be left at old value
    */
   enum {LEX_MI_UNCHANGED= 0, LEX_MI_DISABLE, LEX_MI_ENABLE}
-    ssl, ssl_verify_server_cert, heartbeat_opt, repl_ignore_server_ids_opt;
+    ssl, ssl_verify_server_cert, heartbeat_opt, repl_ignore_server_ids_opt, 
+    retry_count_opt;
   char *ssl_key, *ssl_cert, *ssl_ca, *ssl_capath, *ssl_cipher;
   char *relay_log_name;
   ulong relay_log_pos;

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2010-07-27 14:04:13 +0000
+++ b/sql/sql_yacc.yy	2010-07-29 01:21:15 +0000
@@ -1905,7 +1905,8 @@ master_def:
           }
         | MASTER_RETRY_COUNT_SYM EQ ulong_num
           {
-            Lex->mi.retry_count = $3;
+            Lex->mi.retry_count= $3;
+            Lex->mi.retry_count_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
           }
         | MASTER_DELAY_SYM EQ ulong_num
           {


Attachment: [text/bzr-bundle] bzr/luis.soares@sun.com-20100729012115-73q6aovb4w53ztw0.bundle
Thread
bzr commit into mysql-next-mr branch (luis.soares:3169) Bug#44209Luis Soares29 Jul