Bug #44209 Align --master-retry-count with other --master-* options
Submitted: 10 Apr 2009 16:40 Modified: 22 Nov 2010 20:57
Reporter: Matthew Montgomery Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Luis Soares CPU Architecture:Any
Triage: Triaged: D5 (Feature request)

[10 Apr 2009 16:40] Matthew Montgomery
Description:
Ease of use/consistency of interface bug...

CHANGE MASTER TO... MASTER_CONNECT_RETRY and the --master-retry-count= values are logically related to one another but are configured in different places at different times.

Currently master-retry-count= can only be set at mysqld startup while MASTER_CONNECT_RETRY dynamic.

How to repeat:
.

Suggested fix:
--master-retry-count= should be deprecated with the other --master-* options and replaced by CHANGE MASTER TO... MASTER_RETRY_COUNT.
[8 Apr 2010 15:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/105231

3183 Luis Soares	2010-04-08
      BUG#44209: MASTER_CONNECT_RETRY and --master-retry-count disconnected 
      from each other
        
      MASTER_CONNECT_RETRY and --master-retry-count are logically
      related. The former sets the value for the time the slave thread
      waits until reconnecting, while the latter sets the value for 
      the number of reconnection attempts until it gives up. 
        
      The problem here was that --master-retry-count is not dynamic
      and can only be set on slave startup, while MASTER_CONNECT_RETRY
      is dynamic and can be set using CHANGE MASTER. As such, the user
      should also be allowed to change the value of master_retry_count
      using CHANGE MASTER command.
        
      In this patch we extend the syntax of CHANGE MASTER to allow 
      MASTER_RETRY_COUNT symbol that can be used to set the variable
      that holds the value for master_retry_count. The option 
      --master-retry-count can now be deprecated (this patch takes no
      action regarding deprecating this option).
     @ mysql-test/suite/rpl/t/rpl_change_master.test
        Added test case for new change master option.
     @ sql/lex.h
        Added MASTER_RETRY_COUNT symbol.
     @ sql/rpl_mi.cc
        Added new retry_count Master_info member initialization.
     @ sql/rpl_mi.h
        Added retry_count Master_info member.
     @ sql/slave.cc
        Replaced occurrences of master_retry_count with mi->retry_count.
        Added output for mi->retry_count in SHOW SLAVE STATUS. This is
        actually BUG 44486 proposed patch with mi->retry_count instead
        of master_retry_count.
     @ sql/sql_lex.h
        Added retry_count member to lex_mi.
     @ sql/sql_repl.cc
        Added assignement to mi->retry_count to lex_mi->retry_count.
     @ sql/sql_yacc.yy
        Extended the grammar of CHANGE MASTER to cope with the new 
        MASTER_RETRY_COUNT command.
[19 Apr 2010 21:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/106058

3183 Luis Soares	2010-04-19
      BUG#44209: MASTER_CONNECT_RETRY and --master-retry-count disconnected 
      from each other
        
      MASTER_CONNECT_RETRY and --master-retry-count are logically
      related. The former sets the value for the time the slave thread
      waits until reconnecting, while the latter sets the value for 
      the number of reconnection attempts until it gives up. 
        
      The problem here was that --master-retry-count is not dynamic
      and can only be set on slave startup, while MASTER_CONNECT_RETRY
      is dynamic and can be set using CHANGE MASTER. As such, the user
      should also be allowed to change the value of master_retry_count
      using CHANGE MASTER command.
        
      In this patch we extend the syntax of CHANGE MASTER to allow 
      MASTER_RETRY_COUNT symbol that can be used to set the variable
      that holds the value for master_retry_count. The option 
      --master-retry-count can now be deprecated (this patch takes no
      action regarding deprecating this option).
     @ mysql-test/suite/rpl/t/rpl_change_master.test
        Added test case for new change master option.
     @ sql/lex.h
        Added MASTER_RETRY_COUNT symbol.
     @ sql/rpl_mi.cc
        Added new retry_count Master_info member initialization.
        Retry_count is also persisted/loaded back in/from master.info.
     @ sql/rpl_mi.h
        Added retry_count Master_info member.
     @ sql/slave.cc
        Replaced occurrences of master_retry_count with mi->retry_count.
        Added output for mi->retry_count in SHOW SLAVE STATUS. This is
        actually BUG 44486 proposed patch with mi->retry_count instead
        of master_retry_count.
        Added init_longvar_from_file used while initing the new 
        retry_count mi member variable.
     @ sql/sql_lex.h
        Added retry_count member to lex_mi.
     @ sql/sql_repl.cc
        Added assignement to mi->retry_count to lex_mi->retry_count.
     @ sql/sql_yacc.yy
        Extended the grammar of CHANGE MASTER to cope with the new 
        MASTER_RETRY_COUNT command.
[6 May 2010 16:29] Luis Soares
Queued in mysql-5.1-rep+3:
http://pb2.norway.sun.com/web.py?template=push_details&push=1227938
[7 May 2010 9:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/107716

3140 Luis Soares	2010-05-07
      BUG#44209: MASTER_CONNECT_RETRY and --master-retry-count disconnected
                 from each other
      
      Post-push fix! One of the test cases is not robust enough because
      it depends on a time variable. This can cause it to fail because
      it is a source of non-determinism (especially on slow environments).
      
      The specific test case is about waiting for slave to stop after
      retrying the N expected times and then checking that no more than
      a number of expected seconds has ellapsed. This assertion is not
      deterministic.
      
      We fix the assertion by checking the number of retries reported by
      the server, instead of checking how much seconds have ellapsed.
[26 May 2010 2:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/109224

3141 Luis Soares	2010-05-26
      BUG#44209: MASTER_CONNECT_RETRY and --master-retry-count disconnected 
      from each other
      
      Post-push fix.
      
      The mi->retry_count was set to an uninitilized value when master.info
      did not contain a correspondent line for the retry_count value. We fix
      this by setting the default before actually loading the value from
      master.info. If there is no value to read, mi->retry_count remains the
      default (or the value set in the command line). The retry_count in 
      master.info value takes precedence over the one from the command line
      (which I believe is more inline with the proposal for deprecation of 
      master-retry-count).
[29 Jul 2010 1:21] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/114576

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.
[29 Jul 2010 1:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/114577

3170 Luis Soares	2010-07-29
      BUG#44209: MASTER_CONNECT_RETRY and --master-retry-count disconnected 
      from each other
      
      Improvements on the tests:
      
        1. Changed assertion when CHANGE MASTER TO master_rety_count=0;
        2. Added assertion to check that when issuing a CHANGE MASTER TO
           without specifying a value for master_retry_count, the current
           value is preserved;
        3. Added assertion checking that when feeding a negative value for
           master_retry_count, an error is raised;
     @ mysql-test/suite/rpl/t/rpl_change_master_dbug.test
        Test that asserts that slave retries N times, according to the value
        of master_retry_count, before giving up. Requires DBUG, so that's the
        reason to be placed on its own .test file.
     @ sql/rpl_slave.cc
        Deployed some conditional code so that the server always reports
        the error when it cannot connect. While reporting it includes the
        current number of attempts in the retries field, instead of the 
        mi->retry_count.
[16 Aug 2010 6:34] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100816062819-bluwgdq8q4xysmlg) (version source revid:alik@sun.com-20100816062612-enatdwnv809iw3s9) (pib:20)
[13 Nov 2010 16:11] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (merge vers: 5.6.99-m4) (pib:21)
[13 Nov 2010 16:33] Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:jimmy.yang@oracle.com-20100804103744-vbpeghipkz6pyc9z) (pib:21)
[22 Nov 2010 20:23] Jon Stephens
Updated Synopsis to remove confusing reference to MASTER_CONNECT_RETRY.
[22 Nov 2010 20:57] Jon Stephens
Documented as follows in the 5.6.1 changelog:

        Added the MASTER_RETRY_COUNT option to the CHANGE MASTER TO
        statement, and a corresponding Master_Retry_Count column to the
        output of SHOW SLAVE STATUS. The option sets the value shown in
        this column. MASTER_RETRY_COUNT is intended to replace the older
        --master-retry-count server option, and is now the preferred
        method for setting the maxmimum number of times that the slave
        may attempt to reconnect after losing its connection to the
        master.

Also updated CHANGE MASTER TO and SHOW SLAVE STATUS descriptions in the 5.6 Manual.

Closed.

See also BUG#44486.