Bug #28760 Simulating a replication lag
Submitted: 30 May 2007 1:31 Modified: 6 Aug 2010 9:22
Reporter: Kay Röpke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version:4.1.22, 5.0.41, 5.1.18-beta OS:Any
Assigned to: Sven Sandberg CPU Architecture:Any
Tags: Contribution, Delay, replication

[30 May 2007 1:31] Kay Röpke
Description:
While tracking down a bug in our software that was only happening when a slave lagged behind the master in replication, I was looking for a way to delay replication.

The most reliable way was to add support for specifying a replication delay time in the server.

This has proven very useful as a debugging aid.

How to repeat:
Not applicable.

Suggested fix:
It's in the form of a new global variable 'slave_replication_delay' that's settable via SET GLOBAL on a slave.
When 'slave_replication_delay' is non-zero it would case the SQL thread to suspend executing relay log events until at least the amount of seconds specified by 'slave_replication_delay' have elapsed.

I have written and tested a patch for 4.1.22 and also made a patch for 5.0.41 (though that's not tested yet). Support for 5.1.18-beta, or for that matter any MySQL version that supports replication, shouldn't be a problem either because the patch is rather small and confined.

The basis of the delay is the 'when' field of the event and it takes into consideration any externally imposed replication delay, so that the SQL thread effectively treats the seconds specified by 'slave_replication_delay' as a lower limit of replication lag.
[30 May 2007 8:46] Lenz Grimmer
See our public Worklog for more implementation suggestions http://forge.mysql.com/worklog/task.php?id=344
[30 May 2007 10:11] Valeriy Kravchuk
Thank you for a reasonable feature request.
[30 May 2007 13:15] Kay Röpke
I'll go ahead and change my patch to support the CHANGE MASTER enhancement outlined in the worklog entry mentioned by Lenz.
[5 Jun 2007 11:32] Lenz Grimmer
This bug report may actually be a duplicate of BUG#21639 and BUG#22072 (it seems to be a very popular request)
[6 Jun 2007 19:19] Lenz Grimmer
Patch was proposed on the internals mailing list: http://lists.mysql.com/internals/34705
[10 Sep 2007 22:31] 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/34023

ChangeSet@1.2563, 2007-09-10 18:29:14-04:00, cmiller@zippy.cornsilk.net +9 -0
  Bug#28760 / WL#344: Delayed replication
  
  Contributed by Kay Roepke, CLA#50.
[15 Sep 2007 8:59] Andrei Elkin
Couple of notes regarding to the recent patch.
1. i think having a line in SHOW SLAVE STATUS' report about
   the value of the delayed option is necessary as
   there is no other way to get this info except to read it
[15 Sep 2007 9:06] Andrei Elkin
Note regarding to the recent patch (reviewers are
welcome to evaluate my opinion as well):

1. i think having a line in SHOW SLAVE STATUS' report about
   the value of the delayed option is necessary as
   there is no other way to get this info except to read it
   from master.info.
2. It'd be nice to report some warning in slave's error log
   in case (now - ev->when) < 0.
[23 Sep 2007 16:09] Kay Röpke
I will address Andrei's last comments as well as the checking of the return status of safe_sleep() (as discussed in Heidelberg) to the next patch.
[26 Feb 2008 19:10] Lasitha Alawatta
We notice that it’s because of MySQL table locking.
[26 Feb 2008 20:01] Kay Roepke
Lasitha,

this patch is meant to introduce an intentional delay into replication, not to discover the reason for a specific delay.
[3 Apr 2008 9:09] 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/44830

ChangeSet@1.2553, 2008-04-03 16:08:37+07:00, sven@riska.(none) +62 -0
  WL#344: Time-delayed replication
  BUG#28760: Simulating a replication lag
  Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
  the replication slave to be X seconds behind the master.
[24 Oct 2008 19:13] Marc Byrd
I _really_ want to use the MASTER_DELAY feature to find some lag race condition bugs.  (And I'm thinking of using it for intentional 1h delay to rescue us from ourselves in case of a haywire update horkage).  I'm not particular about how I do that - even willing to move to other debian repos (dev, test, experimental, etc.)  Would be awesome to simply find a binary that contains this - and I vote for it to be in the default releases - extraordinarily useful!  But I'm coming to terms with acceptance that I have to build it from source...

I have successfully built mysql-5.0.32 from source on debian (etch).  I would now like to patch the source with the MASTER_DELAY patch referenced here.  In my source tree I have debian/patches/ with many security patches in the "dpatch" format - I'm fairly confident that if I could find this patch in that format I could cause it to be rolled into the buildeb.  

Has anyone successfully applied this patch on debian and if so, what steps did you take?  RTFM links welcomed.
[26 Nov 2008 12:29] Arjen Lentz
Marc, we're looking at this in OurDelta (http://ourdelta.org)
On initial review, Sven's 5.1 patch looked doable and not too intrusive, so even a 5.0 backport seems viable but we haven't tried it yet.

It's being tracked at https://bugs.launchpad.net/ourdelta/+bug/288898 please feel free to add our interest there (launchpad allows you to click on a bug to say "affects me too") and participate/comment in other ways.
[23 Jan 2009 23:29] Clint Goudie-Nice
I would really like to see a 5.0 backport of this patch. This provides some great value as an offsite (or onsite) backup strategy of a mysql database.
[25 Mar 2010 15:13] 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/104342

3379 Sven Sandberg	2010-03-25
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
       - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
       - The SQL thread sleeps as needed.
       - SHOW SLAVE STATUS outputs information about the delay.
       - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
       - RESET SLAVE resets the delay.
       - The option is saved to the relay_log.info file.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
        Auxiliary file used by rpl_delayed_slave.
     @ mysql-test/include/show_delayed_slave_state.inc
        Auxiliary test file that displays the state of the delayed slave in a
        deterministic manner.
     @ mysql-test/suite/rpl/r/rpl_delayed_slave.result
        new result file
     @ mysql-test/suite/rpl/t/rpl_delayed_slave.test
        New test case for time-delayed replication slaves.
     @ sql/lex.h
        Added MASTER_DELAY parser symbol.
     @ sql/log.cc
        Clarified comments and added assertion.
     @ sql/log_event.cc
        Clarified comments.
     @ sql/rpl_mi.cc
        Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/rpl_rli.cc
         - Added delay parameter to relay_log.info file. The file format is now
           changed: first line is the number of lines in the file, then follows
           the actual lines. The code now understands both the new and the old
           format.
         - Made is_fake available for all builds. We now need is_fake in
           apply_event_and_update_pos() [slave.cc]
         - Moved forward declarations of functions defined in slave.cc to slave.h
         - Added Relay_log_info::state_delaying_string.
         - Moved the body of init_relay_log_info into the new member function
           Relay_log_info::init and made init_relay_log_info a wrapper around the
           new member function.
         - Added debug printouts.
     @ sql/rpl_rli.h
         - Made is_fake available for all builds, and documented it.
         - Added private delay variables, and public functions to get and set them.
         - Replaced flush_relay_log_info and init_relay_log_info by the new member
           function Relay_log_info::flush and Relay_log_info::init.
         - Added comments clarifying how to use group_[relay|master]_log_[pos|name].
     @ sql/share/errmsg.txt
        Added new error codes.
     @ sql/slave.cc
         - Added delay to SHOW SLAVE STATUS.
         - Updated apply_event_and_update_pos so that it takes sleeping into
           account. It now calls the new function sql_delay_event, which
           handles the delay.
         - Cleaned up some debug printout code in apply_event_and_update_pos
           (since it is related to having rli->is_fake under all builds)
         - Improved documentation.
         - Made the IO thread take appropriate lock while setting
           mi->clock_diff_with_master and while setting mi->slave_running.
         - Replaced flush_relay_log_info by the new member function
           Relay_log_info::flush, and made flush_relay_log_info a wrapper
           around Relay_log_info::flush.
         - Made Relay_log_info::flush write the new delay parameter. The
           format has changed: see commit message and source comments in
           rpl_rli.cc.
     @ sql/slave.h
         - Added MASTER_DELAY_MAX.
         - Clarified comments.
         - Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/sql_binlog.cc
         - Removed preprocessor conditional guarding initialization of
           rli->is_fake, so is_fake is now unconditionally a part of the rli
           structure.
         - Removed initialization of ev->thd from mysql_client_binlog_statement(),
           since ev->thd is initialized by apply_event_and_update_pos().
         - Added code to check that BINLOG statements only contain row events and FD
           events, to avoid deadlock.
     @ sql/sql_lex.cc
        Added implementation of new function
        st_lex_master_info::set_unspecified()
     @ sql/sql_lex.h
         - Added delay to st_lex_master_info.
         - Added set_unspecified()
         - Added explicit initialization of enumeration value SSL_UNCHANGED to 0,
           to make more clear that the value is not allowed to change (it is written
           to relay_log.info).
     @ sql/sql_repl.cc
         - Made RESET SLAVE reset the delay.
         - Initialize Relay_log_info::delay from Lex_master_info::delay.
     @ sql/sql_yacc.yy
         - Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"
         - Use new function st_lex_master_info::set_unspecified to clear
           st_lex_master_info structure, instead of bzero.
[25 Mar 2010 15:29] 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/104343

3422 Sven Sandberg	2010-03-25
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
       - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
       - The SQL thread sleeps as needed.
       - SHOW SLAVE STATUS outputs information about the delay.
       - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
       - RESET SLAVE resets the delay.
       - The option is saved to the relay_log.info file.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
        Auxiliary file used by rpl_delayed_slave.
     @ mysql-test/include/show_delayed_slave_state.inc
        Auxiliary test file that displays the state of the delayed slave in a
        deterministic manner.
     @ mysql-test/suite/rpl/r/rpl_delayed_slave.result
        new result file
     @ mysql-test/suite/rpl/t/rpl_delayed_slave.test
        New test case for time-delayed replication slaves.
     @ sql/lex.h
        Added MASTER_DELAY parser symbol.
     @ sql/log.cc
        Clarified comments and added assertion.
     @ sql/log_event.cc
        Clarified comments.
     @ sql/rpl_mi.cc
        Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/rpl_rli.cc
         - Added delay parameter to relay_log.info file. The file format is now
           changed: first line is the number of lines in the file, then follows
           the actual lines. The code now understands both the new and the old
           format.
         - Made is_fake available for all builds. We now need is_fake in
           apply_event_and_update_pos() [slave.cc]
         - Moved forward declarations of functions defined in slave.cc to slave.h
         - Added Relay_log_info::state_delaying_string.
         - Moved the body of init_relay_log_info into the new member function
           Relay_log_info::init and made init_relay_log_info a wrapper around the
           new member function.
         - Added debug printouts.
     @ sql/rpl_rli.h
         - Made is_fake available for all builds, and documented it.
         - Added private delay variables, and public functions to get and set them.
         - Replaced flush_relay_log_info and init_relay_log_info by the new member
           function Relay_log_info::flush and Relay_log_info::init.
         - Added comments clarifying how to use group_[relay|master]_log_[pos|name].
     @ sql/share/errmsg.txt
        Added new error codes.
     @ sql/slave.cc
         - Added delay to SHOW SLAVE STATUS.
         - Updated apply_event_and_update_pos so that it takes sleeping into
           account. It now calls the new function sql_delay_event, which
           handles the delay.
         - Cleaned up some debug printout code in apply_event_and_update_pos
           (since it is related to having rli->is_fake under all builds)
         - Improved documentation.
         - Made the IO thread take appropriate lock while setting
           mi->clock_diff_with_master and while setting mi->slave_running.
         - Replaced flush_relay_log_info by the new member function
           Relay_log_info::flush, and made flush_relay_log_info a wrapper
           around Relay_log_info::flush.
         - Made Relay_log_info::flush write the new delay parameter. The
           format has changed: see commit message and source comments in
           rpl_rli.cc.
     @ sql/slave.h
         - Added MASTER_DELAY_MAX.
         - Clarified comments.
         - Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/sql_binlog.cc
         - Removed preprocessor conditional guarding initialization of
           rli->is_fake, so is_fake is now unconditionally a part of the rli
           structure.
         - Removed initialization of ev->thd from mysql_client_binlog_statement(),
           since ev->thd is initialized by apply_event_and_update_pos().
         - Added code to check that BINLOG statements only contain row events and FD
           events, to avoid deadlock.
     @ sql/sql_lex.cc
        Added implementation of new function
        st_lex_master_info::set_unspecified()
     @ sql/sql_lex.h
         - Added delay to st_lex_master_info.
         - Added set_unspecified()
         - Added explicit initialization of enumeration value SSL_UNCHANGED to 0,
           to make more clear that the value is not allowed to change (it is written
           to relay_log.info).
     @ sql/sql_repl.cc
         - Made RESET SLAVE reset the delay.
         - Initialize Relay_log_info::delay from Lex_master_info::delay.
     @ sql/sql_yacc.yy
         - Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"
         - Use new function st_lex_master_info::set_unspecified to clear
           st_lex_master_info structure, instead of bzero.
[25 Mar 2010 16:16] 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/104361

3368 Sven Sandberg	2010-03-25
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
      - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
      - The SQL thread sleeps as needed.
      - SHOW SLAVE STATUS outputs information about the delay.
      - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
      - RESET SLAVE resets the delay.
      - The option is saved to the relay_log.info file.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
        Auxiliary file used by rpl_delayed_slave.
     @ mysql-test/include/show_delayed_slave_state.inc
        Auxiliary test file that displays the state of the delayed slave in a
        deterministic manner.
     @ mysql-test/suite/rpl/r/rpl_delayed_slave.result
        new result file
     @ mysql-test/suite/rpl/t/rpl_delayed_slave.test
        New test case for time-delayed replication slaves.
     @ sql/lex.h
        Added MASTER_DELAY parser symbol.
     @ sql/log.cc
        Clarified comments and added assertion.
     @ sql/log_event.cc
        Clarified comments.
     @ sql/rpl_mi.cc
        Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/rpl_rli.cc
         - Added delay parameter to relay_log.info file. The file format is now
           changed: first line is the number of lines in the file, then follows
           the actual lines. The code now understands both the new and the old
           format.
         - Made is_fake available for all builds. We now need is_fake in
           apply_event_and_update_pos() [slave.cc]
         - Moved forward declarations of functions defined in slave.cc to slave.h
         - Added Relay_log_info::state_delaying_string.
         - Moved the body of init_relay_log_info into the new member function
           Relay_log_info::init and made init_relay_log_info a wrapper around the
           new member function.
         - Added debug printouts.
     @ sql/rpl_rli.h
         - Made is_fake available for all builds, and documented it.
         - Added private delay variables, and public functions to get and set them.
         - Replaced flush_relay_log_info and init_relay_log_info by the new member
           function Relay_log_info::flush and Relay_log_info::init.
         - Added comments clarifying how to use group_[relay|master]_log_[pos|name].
     @ sql/share/errmsg.txt
        Added new error codes.
     @ sql/slave.cc
         - Added delay to SHOW SLAVE STATUS.
         - Updated apply_event_and_update_pos so that it takes sleeping into
           account. It now calls the new function sql_delay_event, which
           handles the delay.
         - Cleaned up some debug printout code in apply_event_and_update_pos
           (since it is related to having rli->is_fake under all builds)
         - Improved documentation.
         - Made the IO thread take appropriate lock while setting
           mi->clock_diff_with_master and while setting mi->slave_running.
         - Replaced flush_relay_log_info by the new member function
           Relay_log_info::flush, and made flush_relay_log_info a wrapper
           around Relay_log_info::flush.
         - Made Relay_log_info::flush write the new delay parameter. The
           format has changed: see commit message and source comments in
           rpl_rli.cc.
     @ sql/slave.h
         - Added MASTER_DELAY_MAX.
         - Clarified comments.
         - Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/sql_binlog.cc
         - Removed preprocessor conditional guarding initialization of
           rli->is_fake, so is_fake is now unconditionally a part of the rli
           structure.
         - Removed initialization of ev->thd from mysql_client_binlog_statement(),
           since ev->thd is initialized by apply_event_and_update_pos().
         - Added code to check that BINLOG statements only contain row events and FD
           events, to avoid deadlock.
     @ sql/sql_lex.cc
        Added implementation of new function
        st_lex_master_info::set_unspecified()
     @ sql/sql_lex.h
         - Added delay to st_lex_master_info.
         - Added set_unspecified()
         - Added explicit initialization of enumeration value SSL_UNCHANGED to 0,
           to make more clear that the value is not allowed to change (it is written
           to relay_log.info).
     @ sql/sql_repl.cc
         - Made RESET SLAVE reset the delay.
         - Initialize Relay_log_info::delay from Lex_master_info::delay.
     @ sql/sql_yacc.yy
         - Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"
         - Use new function st_lex_master_info::set_unspecified to clear
           st_lex_master_info structure, instead of bzero.
[6 Apr 2010 12:58] 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/105076

3128 Sven Sandberg	2010-04-06 [merge]
      Merged BUG#28760 from 5.1 to next-mr
      Conflicts resolved manually:
      Text conflict in sql/log.cc
      Text conflict in sql/rpl_mi.cc
      Text conflict in sql/rpl_rli.cc
      Contents conflict in sql/share/errmsg.txt
      Text conflict in sql/slave.cc
      Text conflict in sql/sql_binlog.cc
      Text conflict in sql/sql_lex.h
      Text conflict in sql/sql_repl.cc
      Text conflict in sql/sql_yacc.yy
[6 Apr 2010 13:05] 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/105078

3128 Sven Sandberg	2010-04-06 [merge]
      Merged WL#344/BUG#28760 from 5.1 to next-mr
      Conflicts resolved manually:
      Text conflict in sql/log.cc
      Text conflict in sql/rpl_mi.cc
      Text conflict in sql/rpl_rli.cc
      Contents conflict in sql/share/errmsg.txt
      Text conflict in sql/slave.cc
      Text conflict in sql/sql_binlog.cc
      Text conflict in sql/sql_lex.h
      Text conflict in sql/sql_repl.cc
      Text conflict in sql/sql_yacc.yy
[6 Apr 2010 13:10] 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/105079

3128 Sven Sandberg	2010-04-06 [merge]
      Merged WL#344/BUG#28760 from 5.1 to next-mr
      Conflicts resolved manually:
      Text conflict in sql/log.cc
      Text conflict in sql/rpl_mi.cc
      Text conflict in sql/rpl_rli.cc
      Contents conflict in sql/share/errmsg.txt
       (file renamed to errmsg-utf8.txt from 5.1 to next-mr)
      Text conflict in sql/slave.cc
      Text conflict in sql/sql_binlog.cc
      Text conflict in sql/sql_lex.h
      Text conflict in sql/sql_repl.cc
      Text conflict in sql/sql_yacc.yy
[6 Apr 2010 13:20] 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/105080

3128 Sven Sandberg	2010-04-06 [merge]
      Merged WL#344/BUG#28760 from 5.1 to next-mr
      Conflicts resolved manually:
      Text conflict in sql/log.cc
      Text conflict in sql/rpl_mi.cc
      Text conflict in sql/rpl_rli.cc
      Contents conflict in sql/share/errmsg.txt
       (file renamed to errmsg-utf8.txt from 5.1 to next-mr)
      Text conflict in sql/slave.cc
      Text conflict in sql/sql_binlog.cc
      Text conflict in sql/sql_lex.h
      Text conflict in sql/sql_repl.cc
      Text conflict in sql/sql_yacc.yy
[6 Apr 2010 13:32] 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/105083

3128 Sven Sandberg	2010-04-06 [merge]
      Merged WL#344/BUG#28760 from 5.1 to next-mr
      Conflicts resolved manually:
      Text conflict in sql/log.cc
      Text conflict in sql/rpl_mi.cc
      Text conflict in sql/rpl_rli.cc
      Contents conflict in sql/share/errmsg.txt
       (file renamed to errmsg-utf8.txt from 5.1 to next-mr)
      Text conflict in sql/slave.cc
      Text conflict in sql/sql_binlog.cc
      Text conflict in sql/sql_lex.h
      Text conflict in sql/sql_repl.cc
      Text conflict in sql/sql_yacc.yy
[26 Apr 2010 17:17] 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/106552

3447 Sven Sandberg	2010-04-26
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
      - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
      - The SQL thread sleeps as needed.
      - SHOW SLAVE STATUS has three new fields with information about the
        delay and the SQL thread status.
      - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
      - RESET SLAVE resets the delay.
      - The option is saved to the relay_log.info file.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
        Auxiliary file used by rpl_delayed_slave.
     @ mysql-test/extra/rpl_tests/rpl_deadlock.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running
        in some places and to check the error message in some places,
        so we replace show slave status by
        source include/check_slave_is_running.inc and wait_for_slave_sql_error.inc,
        respectively.
     @ mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check the error message,
        so we replace show slave status by wait_for_slave_sql_error.inc.
     @ mysql-test/extra/rpl_tests/rpl_log.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/extra/rpl_tests/rpl_max_relay_size.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
        In one place, show slave status didn't do anything useful at all, so was removed.
     @ mysql-test/extra/rpl_tests/rpl_reset_slave.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check the Master_User
        and Master_Host columns, so we replace show slave status
        by printouts of these.
     @ mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running
        in some places and to check the error message in some places,
        so we replace show slave status by
        source include/check_slave_is_running.inc and wait_for_slave_sql_error.inc,
        respectively.
     @ mysql-test/include/check_slave_is_running.inc
        Added file that asserts that both slave threads are running.
     @ mysql-test/include/save_master_pos.inc
        Added source file equivalent to save_master_pos. This can now be used
        together with sync_slave_io_with_master.inc and sync_with_master.inc.
        It has the advantage over the built-in command that it supports all
        the features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/include/show_binlog_events.inc
        Added filter to remove version from output from SHOW BINLOG EVENTS.
        This can occur if Format_description_log_events are listed.
     @ mysql-test/include/show_delayed_slave_state.inc
        Auxiliary test file that displays the state of the delayed slave in a
        deterministic manner.
     @ mysql-test/include/show_rpl_debug_info.inc
        Added printouts of NOW(). This is sometimes useful in debugging,
        particularly to compare current time with event time, and when
        testing time parameters like delayed slave and Seconds_Behind_Master.
     @ mysql-test/include/show_slave_ssl_status.inc
        Added file to show ssl-related fields of SHOW SLAVE STATUS.
     @ mysql-test/include/show_slave_status.inc
        Added check to prevent over-use of this file again.
        Filter out new columns from show slave status.
     @ mysql-test/include/show_slave_status2.inc
        Added check to prevent over-use of this file again.
        Filter out new columns from show slave status.
     @ mysql-test/include/sync_slave_io_with_master.inc
        Renamed internal variables to avoid clobbering namespace too much.
     @ mysql-test/include/sync_with_master.inc
        Added source file corresponding to the build-in command
        sync_with_master. This has the advantage that it supports all the
        features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/include/test_fieldsize.inc
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check the error message,
        so we replace show slave status by wait_for_slave_sql_error.inc.
     @ mysql-test/include/wait_for_binlog_event.inc
        Added more debug info on failure.
     @ mysql-test/include/wait_for_slave_param.inc
        Use die to fail, not exit.
     @ mysql-test/include/wait_for_slave_sql_error.inc
        Use die to fail, not exit.
        Moved $show_slave_sql_error from wait_for_slave_sql_error_and_skip.inc
        into wait_for_slave_sql_error.inc. Since the former sources the latter,
        both files now support $show_slave_sql_error.
     @ mysql-test/include/wait_for_slave_sql_error_and_skip.inc
        Allow custom value for slave_skip_counter.
        Moved $show_sql_error check to wait_for_slave_sql_error.inc.
     @ mysql-test/include/wait_for_status_var.inc
        Use die to fail, not exit.
     @ mysql-test/include/wait_until_count_sessions.inc
        Use die to fail, not exit.
     @ mysql-test/std_data/old-format_relay-log.info
        A relay-log.info file using the old (pre-WL#344) format.
     @ mysql-test/suite/rpl/r/rpl_000015.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_bug33931.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_change_master.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_delayed_slave.result
        new result file
     @ mysql-test/suite/rpl/r/rpl_empty_master_crash.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_flushlog_loop.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_grant.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_incident.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_log_pos.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
        new result file
     @ mysql-test/suite/rpl/r/rpl_replicate_do.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_rotate_logs.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_colSize.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_log.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_log_innodb.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_reset_slave.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_until.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_skip_error.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_slave_skip.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_ssl.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_ssl1.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_stm_log.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_stm_until.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_temporary_errors.result
        updated result file
     @ mysql-test/suite/rpl/t/rpl_000015-slave.opt
        This test didn't do anything useful. Removed.
     @ mysql-test/suite/rpl/t/rpl_000015.cnf
        This test didn't do anything useful. Removed.
     @ mysql-test/suite/rpl/t/rpl_000015.test
        This test didn't do anything useful. Removed.
     @ mysql-test/suite/rpl/t/rpl_bug33931.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check the error message,
        so we replace show slave status by wait_for_slave_sql_error.inc.
     @ mysql-test/suite/rpl/t/rpl_change_master.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave stopped
        after a call to stop slave. Use include/stop_slave.inc instead.
     @ mysql-test/suite/rpl/t/rpl_delayed_slave.test
        New test case for time-delayed replication slaves.
     @ mysql-test/suite/rpl/t/rpl_do_grant.test
        Remove race from test (causing sporadic warnings from check-testcase).
     @ mysql-test/suite/rpl/t/rpl_empty_master_crash.test
        Replaced show slave status by more specific checks.
        In this test, show slave status didn't do anything useful at all, so was removed.
     @ mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
        $show_sql_error has been renamed to $show_slave_sql_error.
     @ mysql-test/suite/rpl/t/rpl_flushlog_loop.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
        Also, use sync_slave_with_master instead of equivalent ad-hoc code.
        Also, the test used disable_query_log for apparently no reason, so we turn on the query log.
     @ mysql-test/suite/rpl/t/rpl_grant.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/suite/rpl/t/rpl_incident.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
        In one place, show slave status was not needed at all, so was removed.
        Also, added $show_slave_sql_error=1 so that wait_for_slave_sql_error prints the error message.
     @ mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show Slave_SQL_Error, so we source
        include/wait_for_slave_sql_error.inc instead.
     @ mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show Slave_SQL_Error respectively
        check that the slaves is running, so we source
        include/wait_for_slave_sql_error.inc respectively
        include/check_slave_is_running.inc instead.
     @ mysql-test/suite/rpl/t/rpl_log_pos.test
        Replaced show slave status by more specific checks.
        In this test, show slave status was not needed at all, so was removed.
        (In one place, the purpose was to verify that the slave has stopped
        after stop slave. However, that is already guaranteed by the file
        include/stop_slave.inc, so show slave status was superfluous).
     @ mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
        Also replaced ad-hoc call to SHOW BINLOG EVENTS by source
        include/show_binlog_events.inc
     @ mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
        Test case that ensures that the pre-WL#344 format of relay-log.info
        can still be parsed.
     @ mysql-test/suite/rpl/t/rpl_replicate_do.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to display the Replicate_Do_Table column,
        so this was printed instead of the full output.
     @ mysql-test/suite/rpl/t/rpl_rotate_logs.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to display the Master_Log_File column and
        to ensure that the slave is still running. Hence, we source
        include/check_slave_is_running.inc and print only Master_Log_File.
     @ mysql-test/suite/rpl/t/rpl_row_until.test
        Replaced show slave status by more specific checks.
        In this test, show slave status was not needed at all, so was removed.
        (The purpose was to check that the event executed by the master has been
        copied to slave, but that is ensured by the SELECT statement so
        show slave status was superfluous.)
     @ mysql-test/suite/rpl/t/rpl_skip_error.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show Slave_SQL_Error, so we source
        include/wait_for_slave_sql_error.inc instead.
     @ mysql-test/suite/rpl/t/rpl_slave_skip.test
        Replaced show slave status by more specific checks.
        In the first place in this test, the purpose was to check that the slave
        has stopped. That is already checked by wait_for_slave_sql_to_stop.inc, so
        the call was superfluous and has been removed.
        In the second place, the purpose was to show that the slave is running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/suite/rpl/t/rpl_ssl.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show that the slave is still running
        so we source include/check_slave_is_running.inc instead.
        Also added debug printouts and 'die' in a case where the test fails.
     @ mysql-test/suite/rpl/t/rpl_ssl1.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show that the slave is still running
        and to show the values of the various SSL-related columns. Hence, we
        source include/check_slave_is_running.inc and
        include/show_slave_ssl_status.inc instead.
     @ mysql-test/suite/rpl/t/rpl_stm_until.test
        Replaced show slave status by more specific checks.
        In this test, show slave status was not needed at all, so was removed.
        (The purpose was to show that the slave SQL thread has stopped.
        However, that is already guaranteed by wait_for_slave_sql_to_stop.inc,
        so the test was superfluous.)
     @ mysql-test/suite/rpl/t/rpl_temporary_errors.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show that the slave is still running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
        updated result file
     @ mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
        updated result file
     @ mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
        updated result file
     @ mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
        updated result file
     @ mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
        updated result file
     @ mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
        updated result file
     @ sql/lex.h
        Added MASTER_DELAY parser symbol.
     @ sql/log.cc
        Clarified comments and added assertion.
     @ sql/log_event.cc
        Clarified comments and added assertion.
     @ sql/rpl_mi.cc
        Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/rpl_rli.cc
         - Added delay parameter to relay_log.info file. The file format is now
           changed: first line is the number of lines in the file, then follows
           the actual lines. The code now understands both the new and the old
           format.
         - Made is_fake available for all builds. We now need is_fake in
           apply_event_and_update_pos() [slave.cc]
         - Moved forward declarations of functions defined in slave.cc to slave.h
         - Added Relay_log_info::state_delaying_string.
         - Moved the body of init_relay_log_info into the new member function
           Relay_log_info::init and made init_relay_log_info a wrapper around the
           new member function.
         - Added debug printouts.
     @ sql/rpl_rli.h
         - Made is_fake available for all builds, and documented it.
         - Added private delay variables, and public functions to get and set them.
         - Replaced flush_relay_log_info and init_relay_log_info by the new member
           function Relay_log_info::flush and Relay_log_info::init.
         - Added comments clarifying how to use group_[relay|master]_log_[pos|name].
     @ sql/share/errmsg.txt
        Added new error codes.
     @ sql/slave.cc
         - Added three new fields to SHOW SLAVE STATUS: Slave_SQL_Delay (as
           specified by CHANGE MASTER), Slave_SQL_Running_State (this just
           exposes thd_proc_info; it is to the SQL thread what Slave_IO_State
           is to the IO thread), and Slave_SQL_Remaining_Delay (NULL when the
           SQL thread is not sleeping; the remaining time in seconds when
           the SQL thread is sleeping).
         - Updated apply_event_and_update_pos so that it takes sleeping into
           account. It now calls the new function sql_delay_event, which
           handles the delay.
         - Cleaned up some debug printout code in apply_event_and_update_pos
           (since it is related to rli->is_fake, which has been replaced by
           rli->belongs_to_client_thread, which is available on all builds)
         - Improved documentation.
         - Made the IO thread take appropriate lock while setting
           mi->clock_diff_with_master and while setting mi->slave_running.
         - Replaced flush_relay_log_info by the new member function
           Relay_log_info::flush, and made flush_relay_log_info a wrapper
           around Relay_log_info::flush.
         - Made Relay_log_info::flush write the new delay parameter. The
           format has changed: see commit message and source comments in
           rpl_rli.cc.
     @ sql/slave.h
         - Added MASTER_DELAY_MAX.
         - Clarified comments.
         - Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/sql_binlog.cc
         - Added check that BINLOG statements only contain row events and
           Format_description_log_events. This avoids possible strange side
           effects and deadlocks that might happen if users feed strange
           events like rotate event to the BINLOG command.
         - With the new check, the code becomes more readable if refactored
           so that the event type is checked in a separate function. This
           means that the handling of Format_description_log_events has been
           refactored too.
         - Replaced the two member fields rli->is_fake and rli->no_storage by
           one single field, rli->belongs_to_client.
     @ sql/sql_lex.cc
        Added implementation of new function
        st_lex_master_info::set_unspecified()
     @ sql/sql_lex.h
         - Added delay to st_lex_master_info.
         - Added set_unspecified()
         - Added explicit initialization of enumeration value SSL_UNCHANGED to 0,
           to make more clear that the value is not allowed to change (it is written
           to relay_log.info).
     @ sql/sql_repl.cc
         - Made RESET SLAVE reset the delay.
         - Initialize Relay_log_info::delay from Lex_master_info::delay.
     @ sql/sql_yacc.yy
         - Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"
         - Use new function st_lex_master_info::set_unspecified to clear
           st_lex_master_info structure, instead of bzero.
[26 Apr 2010 17:25] 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/106554

3447 Sven Sandberg	2010-04-26
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
      - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
      - The SQL thread sleeps as needed.
      - SHOW SLAVE STATUS has three new fields with information about the
        delay and the SQL thread status.
      - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
      - RESET SLAVE resets the delay.
      - The option is saved to the relay_log.info file.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ mysql-test/extra/rpl_tests/rpl_deadlock.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running
        in some places and to check the error message in some places,
        so we replace show slave status by
        source include/check_slave_is_running.inc and wait_for_slave_sql_error.inc,
        respectively.
     @ mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check the error message,
        so we replace show slave status by wait_for_slave_sql_error.inc.
     @ mysql-test/extra/rpl_tests/rpl_log.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/extra/rpl_tests/rpl_max_relay_size.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
        In one place, show slave status didn't do anything useful at all, so was removed.
     @ mysql-test/extra/rpl_tests/rpl_reset_slave.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check the Master_User
        and Master_Host columns, so we replace show slave status
        by printouts of these.
     @ mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running
        in some places and to check the error message in some places,
        so we replace show slave status by
        source include/check_slave_is_running.inc and wait_for_slave_sql_error.inc,
        respectively.
     @ mysql-test/include/check_slave_is_running.inc
        Added file that asserts that both slave threads are running.
     @ mysql-test/include/show_binlog_events.inc
        Added filter to remove version from output of SHOW BINLOG EVENTS.
        This can occur if Format_description_log_events are listed.
     @ mysql-test/include/show_rpl_debug_info.inc
        Added printouts of NOW(). This is sometimes useful in debugging,
        particularly to compare current time with event time, and when
        testing time parameters like delayed slave and Seconds_Behind_Master.
     @ mysql-test/include/show_slave_ssl_status.inc
        Added file to show ssl-related fields of SHOW SLAVE STATUS.
     @ mysql-test/include/show_slave_status.inc
        Added check to prevent over-use of this file again.
        Filter out new columns from show slave status.
     @ mysql-test/include/show_slave_status2.inc
        Added check to prevent over-use of this file again.
        Filter out new columns from show slave status.
     @ mysql-test/include/test_fieldsize.inc
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check the error message,
        so we replace show slave status by wait_for_slave_sql_error.inc.
     @ mysql-test/include/wait_for_binlog_event.inc
        Added more debug info on failure.
     @ mysql-test/include/wait_for_slave_param.inc
        Use die to fail, not exit.
     @ mysql-test/include/wait_for_slave_sql_error.inc
        Use die to fail, not exit.
        Moved $show_slave_sql_error from wait_for_slave_sql_error_and_skip.inc
        into wait_for_slave_sql_error.inc. Since the former sources the latter,
        both files now support $show_slave_sql_error.
     @ mysql-test/include/wait_for_slave_sql_error_and_skip.inc
        Allow custom value for slave_skip_counter.
        Moved $show_sql_error check to wait_for_slave_sql_error.inc.
     @ mysql-test/include/wait_for_status_var.inc
        Use die to fail, not exit.
     @ mysql-test/include/wait_until_count_sessions.inc
        Use die to fail, not exit.
     @ mysql-test/suite/rpl/r/rpl_000015.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_bug33931.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_change_master.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_empty_master_crash.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_flushlog_loop.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_grant.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_incident.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_log_pos.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_replicate_do.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_rotate_logs.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_colSize.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_log.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_log_innodb.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_reset_slave.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_row_until.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_skip_error.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_slave_skip.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_ssl.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_ssl1.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_stm_log.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_stm_until.result
        updated result file
     @ mysql-test/suite/rpl/r/rpl_temporary_errors.result
        updated result file
     @ mysql-test/suite/rpl/t/rpl_000015-slave.opt
        This test didn't do anything useful. Removed.
     @ mysql-test/suite/rpl/t/rpl_000015.cnf
        This test didn't do anything useful. Removed.
     @ mysql-test/suite/rpl/t/rpl_000015.test
        This test didn't do anything useful. Removed.
     @ mysql-test/suite/rpl/t/rpl_bug33931.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check the error message,
        so we replace show slave status by wait_for_slave_sql_error.inc.
     @ mysql-test/suite/rpl/t/rpl_change_master.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave stopped
        after a call to stop slave. Use include/stop_slave.inc instead.
     @ mysql-test/suite/rpl/t/rpl_do_grant.test
        Remove race from test (causing sporadic warnings from check-testcase).
     @ mysql-test/suite/rpl/t/rpl_empty_master_crash.test
        Replaced show slave status by more specific checks.
        In this test, show slave status didn't do anything useful at all, so was removed.
     @ mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
        $show_sql_error has been renamed to $show_slave_sql_error.
     @ mysql-test/suite/rpl/t/rpl_flushlog_loop.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
        Also, use sync_slave_with_master instead of equivalent ad-hoc code.
        Also, the test used disable_query_log for apparently no reason, so we turn on the query log.
     @ mysql-test/suite/rpl/t/rpl_grant.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/suite/rpl/t/rpl_incident.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
        In one place, show slave status was not needed at all, so was removed.
        Also, added $show_slave_sql_error=1 so that wait_for_slave_sql_error prints the error message.
     @ mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show Slave_SQL_Error, so we source
        include/wait_for_slave_sql_error.inc instead.
     @ mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show Slave_SQL_Error respectively
        check that the slaves is running, so we source
        include/wait_for_slave_sql_error.inc respectively
        include/check_slave_is_running.inc instead.
     @ mysql-test/suite/rpl/t/rpl_log_pos.test
        Replaced show slave status by more specific checks.
        In this test, show slave status was not needed at all, so was removed.
        (In one place, the purpose was to verify that the slave has stopped
        after stop slave. However, that is already guaranteed by the file
        include/stop_slave.inc, so show slave status was superfluous).
     @ mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
        Also replaced ad-hoc call to SHOW BINLOG EVENTS by source
        include/show_binlog_events.inc
     @ mysql-test/suite/rpl/t/rpl_replicate_do.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to display the Replicate_Do_Table column,
        so this was printed instead of the full output.
     @ mysql-test/suite/rpl/t/rpl_rotate_logs.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to display the Master_Log_File column and
        to ensure that the slave is still running. Hence, we source
        include/check_slave_is_running.inc and print only Master_Log_File.
     @ mysql-test/suite/rpl/t/rpl_row_until.test
        Replaced show slave status by more specific checks.
        In this test, show slave status was not needed at all, so was removed.
        (The purpose was to check that the event executed by the master has been
        copied to slave, but that is ensured by the SELECT statement so
        show slave status was superfluous.)
     @ mysql-test/suite/rpl/t/rpl_skip_error.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to check that the slave is running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show Slave_SQL_Error, so we source
        include/wait_for_slave_sql_error.inc instead.
     @ mysql-test/suite/rpl/t/rpl_slave_skip.test
        Replaced show slave status by more specific checks.
        In the first place in this test, the purpose was to check that the slave
        has stopped. That is already checked by wait_for_slave_sql_to_stop.inc, so
        the call was superfluous and has been removed.
        In the second place, the purpose was to show that the slave is running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/suite/rpl/t/rpl_ssl.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show that the slave is still running
        so we source include/check_slave_is_running.inc instead.
        Also added debug printouts and 'die' in a case where the test fails.
     @ mysql-test/suite/rpl/t/rpl_ssl1.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show that the slave is still running
        and to show the values of the various SSL-related columns. Hence, we
        source include/check_slave_is_running.inc and
        include/show_slave_ssl_status.inc instead.
     @ mysql-test/suite/rpl/t/rpl_stm_until.test
        Replaced show slave status by more specific checks.
        In this test, show slave status was not needed at all, so was removed.
        (The purpose was to show that the slave SQL thread has stopped.
        However, that is already guaranteed by wait_for_slave_sql_to_stop.inc,
        so the test was superfluous.)
     @ mysql-test/suite/rpl/t/rpl_temporary_errors.test
        Replaced show slave status by more specific checks.
        In this test, the purpose was to show that the slave is still running,
        so we source include/check_slave_is_running.inc instead.
     @ mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
        updated result file
     @ mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
        updated result file
     @ mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
        updated result file
     @ mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
        updated result file
     @ mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
        updated result file
     @ mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
        updated result file
[27 Apr 2010 12:44] 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/106661

3448 Sven Sandberg	2010-04-27
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
      - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
      - The SQL thread sleeps as needed.
      - SHOW SLAVE STATUS has three new fields with information about the
        delay and the SQL thread status.
      - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
      - RESET SLAVE resets the delay.
      - The option is saved to the relay_log.info file.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
        Auxiliary file used by rpl_delayed_slave.
     @ mysql-test/include/save_master_pos.inc
        Added source file equivalent to save_master_pos. This can now be used
        together with sync_slave_io_with_master.inc and sync_with_master.inc.
        It has the advantage over the built-in command that it supports all
        the features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/include/show_delayed_slave_state.inc
        Auxiliary test file that displays the state of the delayed slave in a
        deterministic manner.
     @ mysql-test/include/sync_slave_io_with_master.inc
        Renamed internal variables to avoid clobbering namespace too much.
     @ mysql-test/include/sync_with_master.inc
        Added source file corresponding to the build-in command
        sync_with_master. This has the advantage that it supports all the
        features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/std_data/old-format_relay-log.info
        A relay-log.info file using the old (pre-WL#344) format.
     @ mysql-test/suite/rpl/r/rpl_delayed_slave.result
        new result file
     @ mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
        new result file
     @ mysql-test/suite/rpl/t/rpl_delayed_slave.test
        New test case for time-delayed replication slaves.
     @ mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
        Test case that ensures that the pre-WL#344 format of relay-log.info
        can still be parsed.
     @ sql/lex.h
        Added MASTER_DELAY parser symbol.
     @ sql/log.cc
        Clarified comments and added assertion.
     @ sql/log_event.cc
        Clarified comments and added assertion.
     @ sql/rpl_mi.cc
        Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/rpl_rli.cc
         - Added delay parameter to relay_log.info file. The file format is now
           changed: first line is the number of lines in the file, then follows
           the actual lines. The code now understands both the new and the old
           format.
         - Made is_fake available for all builds. We now need is_fake in
           apply_event_and_update_pos() [slave.cc]
         - Moved forward declarations of functions defined in slave.cc to slave.h
         - Added Relay_log_info::state_delaying_string.
         - Moved the body of init_relay_log_info into the new member function
           Relay_log_info::init and made init_relay_log_info a wrapper around the
           new member function.
         - Added debug printouts.
     @ sql/rpl_rli.h
         - Made is_fake available for all builds, and documented it.
         - Added private delay variables, and public functions to get and set them.
         - Replaced flush_relay_log_info and init_relay_log_info by the new member
           function Relay_log_info::flush and Relay_log_info::init.
         - Added comments clarifying how to use group_[relay|master]_log_[pos|name].
     @ sql/share/errmsg.txt
        Added new error codes.
     @ sql/slave.cc
         - Added three new fields to SHOW SLAVE STATUS: Slave_SQL_Delay (as
           specified by CHANGE MASTER), Slave_SQL_Running_State (this just
           exposes thd_proc_info; it is to the SQL thread what Slave_IO_State
           is to the IO thread), and Slave_SQL_Remaining_Delay (NULL when the
           SQL thread is not sleeping; the remaining time in seconds when
           the SQL thread is sleeping).
         - Updated apply_event_and_update_pos so that it takes sleeping into
           account. It now calls the new function sql_delay_event, which
           handles the delay.
         - Cleaned up some debug printout code in apply_event_and_update_pos
           (since it is related to rli->is_fake, which has been replaced by
           rli->belongs_to_client_thread, which is available on all builds)
         - Improved documentation.
         - Made the IO thread take appropriate lock while setting
           mi->clock_diff_with_master and while setting mi->slave_running.
         - Replaced flush_relay_log_info by the new member function
           Relay_log_info::flush, and made flush_relay_log_info a wrapper
           around Relay_log_info::flush.
         - Made Relay_log_info::flush write the new delay parameter. The
           format has changed: see commit message and source comments in
           rpl_rli.cc.
     @ sql/slave.h
         - Added MASTER_DELAY_MAX.
         - Clarified comments.
         - Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/sql_binlog.cc
         - Added check that BINLOG statements only contain row events and
           Format_description_log_events. This avoids possible strange side
           effects and deadlocks that might happen if users feed strange
           events like rotate event to the BINLOG command.
         - With the new check, the code becomes more readable if refactored
           so that the event type is checked in a separate function. This
           means that the handling of Format_description_log_events has been
           refactored too.
         - Replaced the two member fields rli->is_fake and rli->no_storage by
           one single field, rli->belongs_to_client.
     @ sql/sql_lex.cc
        Added implementation of new function
        st_lex_master_info::set_unspecified()
     @ sql/sql_lex.h
         - Added delay to st_lex_master_info.
         - Added set_unspecified()
         - Added explicit initialization of enumeration value SSL_UNCHANGED to 0,
           to make more clear that the value is not allowed to change (it is written
           to relay_log.info).
     @ sql/sql_repl.cc
         - Made RESET SLAVE reset the delay.
         - Initialize Relay_log_info::delay from Lex_master_info::delay.
     @ sql/sql_yacc.yy
         - Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"
         - Use new function st_lex_master_info::set_unspecified to clear
           st_lex_master_info structure, instead of bzero.
[28 Apr 2010 13:38] 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/106825

3448 Sven Sandberg	2010-04-28
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
      - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
      - The SQL thread sleeps as needed.
      - SHOW SLAVE STATUS has three new fields with information about the
        delay and the SQL thread status.
      - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
      - RESET SLAVE resets the delay.
      - The option is saved to the relay_log.info file.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
        Auxiliary file used by rpl_delayed_slave.
     @ mysql-test/include/save_master_pos.inc
        Added source file equivalent to save_master_pos. This can now be used
        together with sync_slave_io_with_master.inc and sync_with_master.inc.
        It has the advantage over the built-in command that it supports all
        the features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/include/show_delayed_slave_state.inc
        Auxiliary test file that displays the state of the delayed slave in a
        deterministic manner.
     @ mysql-test/include/sync_slave_io_with_master.inc
        Renamed internal variables to avoid clobbering namespace too much.
     @ mysql-test/include/sync_with_master.inc
        Added source file corresponding to the build-in command
        sync_with_master. This has the advantage that it supports all the
        features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/std_data/old-format_relay-log.info
        A relay-log.info file using the old (pre-WL#344) format.
     @ mysql-test/suite/rpl/r/rpl_delayed_slave.result
        new result file
     @ mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
        new result file
     @ mysql-test/suite/rpl/t/rpl_delayed_slave.test
        New test case for time-delayed replication slaves.
     @ mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
        Test case that ensures that the pre-WL#344 format of relay-log.info
        can still be parsed.
     @ sql/lex.h
        Added MASTER_DELAY parser symbol.
     @ sql/log.cc
        Clarified comments and added assertion.
     @ sql/log_event.cc
        Clarified comments and added assertion.
     @ sql/rpl_mi.cc
        Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/rpl_rli.cc
         - Added delay parameter to relay_log.info file. The file format is now
           changed: first line is the number of lines in the file, then follows
           the actual lines. The code now understands both the new and the old
           format.
         - Made is_fake available for all builds. We now need is_fake in
           apply_event_and_update_pos() [slave.cc]
         - Moved forward declarations of functions defined in slave.cc to slave.h
         - Added Relay_log_info::state_delaying_string.
         - Moved the body of init_relay_log_info into the new member function
           Relay_log_info::init and made init_relay_log_info a wrapper around the
           new member function.
         - Added debug printouts.
     @ sql/rpl_rli.h
         - Made is_fake available for all builds, and documented it.
         - Added private delay variables, and public functions to get and set them.
         - Replaced flush_relay_log_info and init_relay_log_info by the new member
           function Relay_log_info::flush and Relay_log_info::init.
         - Added comments clarifying how to use group_[relay|master]_log_[pos|name].
     @ sql/share/errmsg.txt
        Added new error codes.
     @ sql/slave.cc
         - Added three new fields to SHOW SLAVE STATUS: Slave_SQL_Delay (as
           specified by CHANGE MASTER), Slave_SQL_Running_State (this just
           exposes thd_proc_info; it is to the SQL thread what Slave_IO_State
           is to the IO thread), and Slave_SQL_Remaining_Delay (NULL when the
           SQL thread is not sleeping; the remaining time in seconds when
           the SQL thread is sleeping).
         - Updated apply_event_and_update_pos so that it takes sleeping into
           account. It now calls the new function sql_delay_event, which
           handles the delay.
         - Cleaned up some debug printout code in apply_event_and_update_pos
           (since it is related to rli->is_fake, which has been replaced by
           rli->belongs_to_client_thread, which is available on all builds)
         - Improved documentation.
         - Made the IO thread take appropriate lock while setting
           mi->clock_diff_with_master and while setting mi->slave_running.
         - Replaced flush_relay_log_info by the new member function
           Relay_log_info::flush, and made flush_relay_log_info a wrapper
           around Relay_log_info::flush.
         - Made Relay_log_info::flush write the new delay parameter. The
           format has changed: see commit message and source comments in
           rpl_rli.cc.
     @ sql/slave.h
         - Added MASTER_DELAY_MAX.
         - Clarified comments.
         - Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/sql_binlog.cc
         - Added check that BINLOG statements only contain row events and
           Format_description_log_events. This avoids possible strange side
           effects and deadlocks that might happen if users feed strange
           events like rotate event to the BINLOG command.
         - With the new check, the code becomes more readable if refactored
           so that the event type is checked in a separate function. This
           means that the handling of Format_description_log_events has been
           refactored too.
         - Replaced the two member fields rli->is_fake and rli->no_storage by
           one single field, rli->belongs_to_client.
     @ sql/sql_lex.cc
        Added implementation of new function
        st_lex_master_info::set_unspecified()
     @ sql/sql_lex.h
         - Added delay to st_lex_master_info.
         - Added set_unspecified()
         - Added explicit initialization of enumeration value SSL_UNCHANGED to 0,
           to make more clear that the value is not allowed to change (it is written
           to relay_log.info).
     @ sql/sql_repl.cc
         - Made RESET SLAVE reset the delay.
         - Initialize Relay_log_info::delay from Lex_master_info::delay.
     @ sql/sql_yacc.yy
         - Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"
         - Use new function st_lex_master_info::set_unspecified to clear
           st_lex_master_info structure, instead of bzero.
[18 May 2010 12:44] 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/108508

3448 Sven Sandberg	2010-05-18
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
      - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
      - The SQL thread sleeps as needed.
      - SHOW SLAVE STATUS has three new fields with information about the
        delay and the SQL thread status.
      - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
      - RESET SLAVE resets the delay.
      - The option is saved to the relay_log.info file.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
        Auxiliary file used by rpl_delayed_slave.
     @ mysql-test/include/save_master_pos.inc
        Added source file equivalent to save_master_pos. This can now be used
        together with sync_slave_io_with_master.inc and sync_with_master.inc.
        It has the advantage over the built-in command that it supports all
        the features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/include/show_delayed_slave_state.inc
        Auxiliary test file that displays the state of the delayed slave in a
        deterministic manner.
     @ mysql-test/include/sync_slave_io_with_master.inc
        Renamed internal variables to avoid clobbering namespace too much.
     @ mysql-test/include/sync_with_master.inc
        Added source file corresponding to the build-in command
        sync_with_master. This has the advantage that it supports all the
        features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/std_data/old-format_relay-log.info
        A relay-log.info file using the old (pre-WL#344) format.
     @ mysql-test/suite/rpl/r/rpl_delayed_slave.result
        new result file
     @ mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
        new result file
     @ mysql-test/suite/rpl/t/rpl_delayed_slave.test
        New test case for time-delayed replication slaves.
     @ mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
        Test case that ensures that the pre-WL#344 format of relay-log.info
        can still be parsed.
     @ sql/lex.h
        Added MASTER_DELAY parser symbol.
     @ sql/log.cc
        Clarified comments and added assertion.
     @ sql/log_event.cc
        Clarified comments and added assertion.
     @ sql/rpl_mi.cc
        Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/rpl_rli.cc
         - Added delay parameter to relay_log.info file. The file format is now
           changed: first line is the number of lines in the file, then follows
           the actual lines. The code now understands both the new and the old
           format.
         - Removed is_fake and no_storage (they meant the same thing) and replaced
           them by the inline function belongs_to_client(). We now need
           belongs_to_client() in apply_event_and_update_pos() [slave.cc]
         - Moved forward declarations of functions defined in slave.cc to slave.h
         - Added Relay_log_info::state_delaying_string.
         - Moved the body of init_relay_log_info into the new member function
           Relay_log_info::init and made init_relay_log_info a wrapper around the
           new member function.
         - Added debug printouts.
     @ sql/rpl_rli.h
         - Removed is_fake and no_storage (they meant the same thing) and replaced
           them with the inline member function belongs_to_client().
         - Added private delay variables, and public functions to get and set them.
         - Replaced flush_relay_log_info and init_relay_log_info by the new member
           function Relay_log_info::flush and Relay_log_info::init.
         - Added comments clarifying how to use group_[relay|master]_log_[pos|name].
     @ sql/share/errmsg.txt
        Added new error codes.
     @ sql/slave.cc
         - Added three new fields to SHOW SLAVE STATUS: Slave_SQL_Delay (as
           specified by CHANGE MASTER), Slave_SQL_Running_State (this just
           exposes thd_proc_info; it is to the SQL thread what Slave_IO_State
           is to the IO thread), and Slave_SQL_Remaining_Delay (NULL when the
           SQL thread is not sleeping; the remaining time in seconds when
           the SQL thread is sleeping).
         - Updated apply_event_and_update_pos so that it takes sleeping into
           account. It now calls the new function sql_delay_event, which
           handles the delay.
         - Cleaned up some debug printout code in apply_event_and_update_pos
           (since it is related to rli->is_fake, which has been replaced by
           rli->belongs_to_client_thread(), which is available on all builds)
         - Improved documentation.
         - Made the IO thread take appropriate lock while setting
           mi->clock_diff_with_master and while setting mi->slave_running.
         - Replaced flush_relay_log_info by the new member function
           Relay_log_info::flush, and made flush_relay_log_info a wrapper
           around Relay_log_info::flush.
         - Made Relay_log_info::flush write the new delay parameter. The
           format has changed: see commit message and source comments in
           rpl_rli.cc.
     @ sql/slave.h
         - Added MASTER_DELAY_MAX.
         - Clarified comments.
         - Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/sql_binlog.cc
         - Added check that BINLOG statements only contain row events and
           Format_description_log_events. This avoids possible strange side
           effects and deadlocks that might happen if users feed strange
           events like rotate event to the BINLOG command.
         - With the new check, the code becomes more readable if refactored
           so that the event type is checked in a separate function. This
           means that the handling of Format_description_log_events has been
           refactored too.
         - Replaced the two member fields rli->is_fake and rli->no_storage by
           one single member function, rli->belongs_to_client().
     @ sql/sql_lex.cc
        Added implementation of new function
        st_lex_master_info::set_unspecified()
     @ sql/sql_lex.h
         - Added delay to st_lex_master_info.
         - Added set_unspecified()
         - Added explicit initialization of enumeration value SSL_UNCHANGED to 0,
           to make more clear that the value is not allowed to change (it is written
           to relay_log.info).
     @ sql/sql_repl.cc
         - Made RESET SLAVE reset the delay.
         - Initialize Relay_log_info::delay from Lex_master_info::delay.
     @ sql/sql_yacc.yy
         - Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"
         - Use new function st_lex_master_info::set_unspecified to clear
           st_lex_master_info structure, instead of bzero.
[18 May 2010 12: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/108509

3448 Sven Sandberg	2010-05-18
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
      - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
      - The SQL thread sleeps as needed.
      - SHOW SLAVE STATUS has three new fields with information about the
        delay and the SQL thread status.
      - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
      - RESET SLAVE resets the delay.
      - The option is saved to the relay_log.info file.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
        Auxiliary file used by rpl_delayed_slave.
     @ mysql-test/include/save_master_pos.inc
        Added source file equivalent to save_master_pos. This can now be used
        together with sync_slave_io_with_master.inc and sync_with_master.inc.
        It has the advantage over the built-in command that it supports all
        the features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/include/show_delayed_slave_state.inc
        Auxiliary test file that displays the state of the delayed slave in a
        deterministic manner.
     @ mysql-test/include/sync_slave_io_with_master.inc
        Renamed internal variables to avoid clobbering namespace too much.
     @ mysql-test/include/sync_with_master.inc
        Added source file corresponding to the build-in command
        sync_with_master. This has the advantage that it supports all the
        features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/std_data/old-format_relay-log.info
        A relay-log.info file using the old (pre-WL#344) format.
     @ mysql-test/suite/rpl/r/rpl_delayed_slave.result
        new result file
     @ mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
        new result file
     @ mysql-test/suite/rpl/t/rpl_delayed_slave.test
        New test case for time-delayed replication slaves.
     @ mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
        Test case that ensures that the pre-WL#344 format of relay-log.info
        can still be parsed.
     @ sql/lex.h
        Added MASTER_DELAY parser symbol.
     @ sql/log.cc
        Clarified comments and added assertion.
     @ sql/log_event.cc
        Clarified comments and added assertion.
     @ sql/rpl_mi.cc
        Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/rpl_rli.cc
         - Added delay parameter to relay_log.info file. The file format is now
           changed: first line is the number of lines in the file, then follows
           the actual lines. The code now understands both the new and the old
           format.
         - Removed is_fake and no_storage (they meant the same thing) and replaced
           them by the inline function belongs_to_client(). We now need
           belongs_to_client() in apply_event_and_update_pos() [slave.cc]
         - Moved forward declarations of functions defined in slave.cc to slave.h
         - Added Relay_log_info::state_delaying_string.
         - Moved the body of init_relay_log_info into the new member function
           Relay_log_info::init and made init_relay_log_info a wrapper around the
           new member function.
         - Added debug printouts.
     @ sql/rpl_rli.h
         - Removed is_fake and no_storage (they meant the same thing) and replaced
           them with the inline member function belongs_to_client().
         - Added private delay variables, and public functions to get and set them.
         - Replaced flush_relay_log_info and init_relay_log_info by the new member
           function Relay_log_info::flush and Relay_log_info::init.
         - Added comments clarifying how to use group_[relay|master]_log_[pos|name].
     @ sql/share/errmsg.txt
        Added new error codes.
     @ sql/slave.cc
         - Added three new fields to SHOW SLAVE STATUS: Slave_SQL_Delay (as
           specified by CHANGE MASTER), Slave_SQL_Running_State (this just
           exposes thd_proc_info; it is to the SQL thread what Slave_IO_State
           is to the IO thread), and Slave_SQL_Remaining_Delay (NULL when the
           SQL thread is not sleeping; the remaining time in seconds when
           the SQL thread is sleeping).
         - Updated apply_event_and_update_pos so that it takes sleeping into
           account. It now calls the new function sql_delay_event, which
           handles the delay.
         - Cleaned up some debug printout code in apply_event_and_update_pos
           (since it is related to rli->is_fake, which has been replaced by
           rli->belongs_to_client_thread(), which is available on all builds)
         - Improved documentation.
         - Made the IO thread take appropriate lock while setting
           mi->clock_diff_with_master and while setting mi->slave_running.
         - Replaced flush_relay_log_info by the new member function
           Relay_log_info::flush, and made flush_relay_log_info a wrapper
           around Relay_log_info::flush.
         - Made Relay_log_info::flush write the new delay parameter. The
           format has changed: see commit message and source comments in
           rpl_rli.cc.
     @ sql/slave.h
         - Added MASTER_DELAY_MAX.
         - Clarified comments.
         - Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/sql_binlog.cc
         - Added check that BINLOG statements only contain row events and
           Format_description_log_events. This avoids possible strange side
           effects and deadlocks that might happen if users feed strange
           events like rotate event to the BINLOG command.
         - With the new check, the code becomes more readable if refactored
           so that the event type is checked in a separate function. This
           means that the handling of Format_description_log_events has been
           refactored too.
         - Replaced the two member fields rli->is_fake and rli->no_storage by
           one single member function, rli->belongs_to_client().
     @ sql/sql_lex.cc
        Added implementation of new function
        st_lex_master_info::set_unspecified()
     @ sql/sql_lex.h
         - Added delay to st_lex_master_info.
         - Added set_unspecified()
         - Added explicit initialization of enumeration value SSL_UNCHANGED to 0,
           to make more clear that the value is not allowed to change (it is written
           to relay_log.info).
     @ sql/sql_repl.cc
         - Made RESET SLAVE reset the delay.
         - Initialize Relay_log_info::delay from Lex_master_info::delay.
     @ sql/sql_yacc.yy
         - Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"
         - Use new function st_lex_master_info::set_unspecified to clear
           st_lex_master_info structure, instead of bzero.
[18 May 2010 13:09] 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/108511

3448 Sven Sandberg	2010-05-18
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
      - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
      - The SQL thread sleeps as needed.
      - SHOW SLAVE STATUS has three new fields with information about the
        delay and the SQL thread status.
      - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
      - RESET SLAVE resets the delay.
      - The option is saved to the relay_log.info file.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
        Auxiliary file used by rpl_delayed_slave.
     @ mysql-test/include/save_master_pos.inc
        Added source file equivalent to save_master_pos. This can now be used
        together with sync_slave_io_with_master.inc and sync_with_master.inc.
        It has the advantage over the built-in command that it supports all
        the features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/include/show_delayed_slave_state.inc
        Auxiliary test file that displays the state of the delayed slave in a
        deterministic manner.
     @ mysql-test/include/sync_slave_io_with_master.inc
        Renamed internal variables to avoid clobbering namespace too much.
     @ mysql-test/include/sync_with_master.inc
        Added source file corresponding to the build-in command
        sync_with_master. This has the advantage that it supports all the
        features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/std_data/old-format_relay-log.info
        A relay-log.info file using the old (pre-WL#344) format.
     @ mysql-test/suite/rpl/r/rpl_delayed_slave.result
        new result file
     @ mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
        new result file
     @ mysql-test/suite/rpl/t/rpl_delayed_slave.test
        New test case for time-delayed replication slaves.
     @ mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
        Test case that ensures that the pre-WL#344 format of relay-log.info
        can still be parsed.
     @ sql/lex.h
        Added MASTER_DELAY parser symbol.
     @ sql/log.cc
        Clarified comments and added assertion.
     @ sql/log_event.cc
        Clarified comments and added assertion.
     @ sql/rpl_mi.cc
        Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/rpl_rli.cc
         - Added delay parameter to relay_log.info file. The file format is now
           changed: first line is the number of lines in the file, then follows
           the actual lines. The code now understands both the new and the old
           format.
         - Removed is_fake and no_storage (they meant the same thing) and replaced
           them by the inline function belongs_to_client(). We now need
           belongs_to_client() in apply_event_and_update_pos() [slave.cc]
         - Moved forward declarations of functions defined in slave.cc to slave.h
         - Added Relay_log_info::state_delaying_string.
         - Moved the body of init_relay_log_info into the new member function
           Relay_log_info::init and made init_relay_log_info a wrapper around the
           new member function.
         - Added debug printouts.
     @ sql/rpl_rli.h
         - Removed is_fake and no_storage (they meant the same thing) and replaced
           them with the inline member function belongs_to_client().
         - Added private delay variables, and public functions to get and set them.
         - Replaced flush_relay_log_info and init_relay_log_info by the new member
           function Relay_log_info::flush and Relay_log_info::init.
         - Added comments clarifying how to use group_[relay|master]_log_[pos|name].
     @ sql/share/errmsg.txt
        Added new error codes.
     @ sql/slave.cc
         - Added three new fields to SHOW SLAVE STATUS: Slave_SQL_Delay (as
           specified by CHANGE MASTER), Slave_SQL_Running_State (this just
           exposes thd_proc_info; it is to the SQL thread what Slave_IO_State
           is to the IO thread), and Slave_SQL_Remaining_Delay (NULL when the
           SQL thread is not sleeping; the remaining time in seconds when
           the SQL thread is sleeping).
         - Updated apply_event_and_update_pos so that it takes sleeping into
           account. It now calls the new function sql_delay_event, which
           handles the delay.
         - Cleaned up some debug printout code in apply_event_and_update_pos
           (since it is related to rli->is_fake, which has been replaced by
           rli->belongs_to_client_thread(), which is available on all builds)
         - Improved documentation.
         - Made the IO thread take appropriate lock while setting
           mi->clock_diff_with_master and while setting mi->slave_running.
         - Replaced flush_relay_log_info by the new member function
           Relay_log_info::flush, and made flush_relay_log_info a wrapper
           around Relay_log_info::flush.
         - Made Relay_log_info::flush write the new delay parameter. The
           format has changed: see commit message and source comments in
           rpl_rli.cc.
     @ sql/slave.h
         - Added MASTER_DELAY_MAX.
         - Clarified comments.
         - Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/sql_binlog.cc
         - Added check that BINLOG statements only contain row events and
           Format_description_log_events. This avoids possible strange side
           effects and deadlocks that might happen if users feed strange
           events like rotate event to the BINLOG command.
         - With the new check, the code becomes more readable if refactored
           so that the event type is checked in a separate function. This
           means that the handling of Format_description_log_events has been
           refactored too.
         - Replaced the two member fields rli->is_fake and rli->no_storage by
           one single member function, rli->belongs_to_client().
     @ sql/sql_lex.cc
        Added implementation of new function
        st_lex_master_info::set_unspecified()
     @ sql/sql_lex.h
         - Added delay to st_lex_master_info.
         - Added set_unspecified()
         - Added explicit initialization of enumeration value SSL_UNCHANGED to 0,
           to make more clear that the value is not allowed to change (it is written
           to relay_log.info).
     @ sql/sql_repl.cc
         - Made RESET SLAVE reset the delay.
         - Initialize Relay_log_info::delay from Lex_master_info::delay.
     @ sql/sql_yacc.yy
         - Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"
         - Use new function st_lex_master_info::set_unspecified to clear
           st_lex_master_info structure, instead of bzero.
[20 May 2010 10:14] 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/108755

3448 Sven Sandberg	2010-05-20
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
      - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
      - The SQL thread sleeps as needed.
      - SHOW SLAVE STATUS has three new fields with information about the
        delay and the SQL thread status.
      - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
      - RESET SLAVE resets the delay.
      - The option is saved to the relay_log.info file.
      - The BINLOG statement no longer accepts event types other than
        Format_description_log_event or row events.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
        Auxiliary file used by rpl_delayed_slave.
     @ mysql-test/include/save_master_pos.inc
        Added source file equivalent to save_master_pos. This can now be used
        together with sync_slave_io_with_master.inc and sync_with_master.inc.
        It has the advantage over the built-in command that it supports all
        the features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/include/show_delayed_slave_state.inc
        Auxiliary test file that displays the state of the delayed slave in a
        deterministic manner.
     @ mysql-test/include/sync_slave_io_with_master.inc
        Renamed internal variables to avoid clobbering namespace too much.
     @ mysql-test/include/sync_with_master.inc
        Added source file corresponding to the build-in command
        sync_with_master. This has the advantage that it supports all the
        features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/std_data/old-format-relay-log-win.info
        A relay-log.info file using the old (pre-WL#344) format.
        This file uses windows path separator (backward slash, \)
     @ mysql-test/std_data/old-format-relay-log.info
        A relay-log.info file using the old (pre-WL#344) format.
        This file uses unix path separator (forward slash, /)
     @ mysql-test/suite/rpl/r/rpl_delayed_slave.result
        new result file
     @ mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
        new result file
     @ mysql-test/suite/rpl/t/rpl_delayed_slave.test
        New test case for time-delayed replication slaves.
     @ mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
        Test case that ensures that the pre-WL#344 format of relay-log.info
        can still be parsed.
     @ sql/lex.h
        Added MASTER_DELAY parser symbol.
     @ sql/log.cc
        Clarified comments and added assertion.
     @ sql/log_event.cc
        Clarified comments and added assertion.
     @ sql/rpl_mi.cc
        Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/rpl_rli.cc
         - Added delay parameter to relay_log.info file. The file format is now
           changed: first line is the number of lines in the file, then follows
           the actual lines. The code now understands both the new and the old
           format.
         - Removed is_fake and no_storage (they meant the same thing) and replaced
           them by the inline function belongs_to_client(). We now need
           belongs_to_client() in apply_event_and_update_pos() [slave.cc]
         - Moved forward declarations of functions defined in slave.cc to slave.h
         - Added Relay_log_info::state_delaying_string.
         - Moved the body of init_relay_log_info into the new member function
           Relay_log_info::init and made init_relay_log_info a wrapper around the
           new member function.
         - Added debug printouts.
     @ sql/rpl_rli.h
         - Removed is_fake and no_storage (they meant the same thing) and replaced
           them with the inline member function belongs_to_client().
         - Added private delay variables, and public functions to get and set them.
         - Replaced flush_relay_log_info and init_relay_log_info by the new member
           function Relay_log_info::flush and Relay_log_info::init.
         - Added comments clarifying how to use group_[relay|master]_log_[pos|name].
     @ sql/share/errmsg.txt
        Added new error codes.
     @ sql/slave.cc
         - Added three new fields to SHOW SLAVE STATUS: Slave_SQL_Delay (as
           specified by CHANGE MASTER), Slave_SQL_Running_State (this just
           exposes thd_proc_info; it is to the SQL thread what Slave_IO_State
           is to the IO thread), and Slave_SQL_Remaining_Delay (NULL when the
           SQL thread is not sleeping; the remaining time in seconds when
           the SQL thread is sleeping).
         - Updated apply_event_and_update_pos so that it takes sleeping into
           account. It now calls the new function sql_delay_event, which
           handles the delay.
         - Cleaned up some debug printout code in apply_event_and_update_pos
           (since it is related to rli->is_fake, which has been replaced by
           rli->belongs_to_client_thread(), which is available on all builds)
         - Improved documentation.
         - Made the IO thread take appropriate lock while setting
           mi->clock_diff_with_master and while setting mi->slave_running.
         - Replaced flush_relay_log_info by the new member function
           Relay_log_info::flush, and made flush_relay_log_info a wrapper
           around Relay_log_info::flush.
         - Made Relay_log_info::flush write the new delay parameter. The
           format has changed: see commit message and source comments in
           rpl_rli.cc.
     @ sql/slave.h
         - Added MASTER_DELAY_MAX.
         - Clarified comments.
         - Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/sql_binlog.cc
         - Added check that BINLOG statements only contain row events and
           Format_description_log_events. This avoids possible strange side
           effects and deadlocks that might happen if users feed strange
           events like rotate event to the BINLOG command.
           After this change, BINLOG statements are not allowed to contain
           other event types than Format_description_log_event or row events.
         - With the new check, the code becomes more readable if refactored
           so that the event type is checked in a separate function. This
           means that the handling of Format_description_log_events has been
           refactored too.
         - Replaced the two member fields rli->is_fake and rli->no_storage by
           one single member function, rli->belongs_to_client().
     @ sql/sql_lex.cc
        Added implementation of new function
        st_lex_master_info::set_unspecified()
     @ sql/sql_lex.h
         - Added delay to st_lex_master_info.
         - Added set_unspecified()
         - Added explicit initialization of enumeration value SSL_UNCHANGED to 0,
           to make more clear that the value is not allowed to change (it is written
           to relay_log.info).
     @ sql/sql_repl.cc
         - Made RESET SLAVE reset the delay.
         - Initialize Relay_log_info::delay from Lex_master_info::delay.
     @ sql/sql_yacc.yy
         - Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"
         - Use new function st_lex_master_info::set_unspecified to clear
           st_lex_master_info structure, instead of bzero.
[20 May 2010 10:19] 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/108757

3448 Sven Sandberg	2010-05-20
      WL#344: Time-delayed replication
      BUG#28760: Simulating a replication lag
      Implemented a new "CHANGE MASTER TO MASTER_DELAY = X" option, which causes
      the replication slave to be X seconds behind the master.
      
      This entails the following changes:
      - New syntax: CHANGE MASTER TO MASTER_DELAY = <int>
      - The SQL thread sleeps as needed.
      - SHOW SLAVE STATUS has three new fields with information about the
        delay and the SQL thread status.
      - When the slave SQL thread is sleeping, SHOW PROCESSLIST indicates this.
      - RESET SLAVE resets the delay.
      - The option is saved to the relay_log.info file.
      - The BINLOG statement no longer accepts event types other than
        Format_description_log_event or row events.
      
      In addition, some small refactorings and bug fixes were needed to make
      this work. See file-specific commit messages for details.
     @ client/mysqltest.cc
        Added variable SYSTEM_PATH_SEPARATOR that exposes FN_LIBCHAR (which is
        / for unix systems and \ for windows systems) to tests.
        This was needed for rpl_read_old_relay_log_info.test
     @ mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
        Auxiliary file used by rpl_delayed_slave.
     @ mysql-test/include/save_master_pos.inc
        Added source file equivalent to save_master_pos. This can now be used
        together with sync_slave_io_with_master.inc and sync_with_master.inc.
        It has the advantage over the built-in command that it supports all
        the features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/include/show_delayed_slave_state.inc
        Auxiliary test file that displays the state of the delayed slave in a
        deterministic manner.
     @ mysql-test/include/sync_slave_io_with_master.inc
        Renamed internal variables to avoid clobbering namespace too much.
     @ mysql-test/include/sync_with_master.inc
        Added source file corresponding to the build-in command
        sync_with_master. This has the advantage that it supports all the
        features and flexibility of wait_for_slave_param.inc.
     @ mysql-test/std_data/old-format-relay-log-win.info
        A relay-log.info file using the old (pre-WL#344) format.
        This file uses windows path separator (backward slash, \)
     @ mysql-test/std_data/old-format-relay-log.info
        A relay-log.info file using the old (pre-WL#344) format.
        This file uses unix path separator (forward slash, /)
     @ mysql-test/suite/rpl/r/rpl_delayed_slave.result
        new result file
     @ mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
        new result file
     @ mysql-test/suite/rpl/t/rpl_delayed_slave.test
        New test case for time-delayed replication slaves.
     @ mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
        Test case that ensures that the pre-WL#344 format of relay-log.info
        can still be parsed.
     @ sql/lex.h
        Added MASTER_DELAY parser symbol.
     @ sql/log.cc
        Clarified comments and added assertion.
     @ sql/log_event.cc
        Clarified comments and added assertion.
     @ sql/rpl_mi.cc
        Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/rpl_rli.cc
         - Added delay parameter to relay_log.info file. The file format is now
           changed: first line is the number of lines in the file, then follows
           the actual lines. The code now understands both the new and the old
           format.
         - Removed is_fake and no_storage (they meant the same thing) and replaced
           them by the inline function belongs_to_client(). We now need
           belongs_to_client() in apply_event_and_update_pos() [slave.cc]
         - Moved forward declarations of functions defined in slave.cc to slave.h
         - Added Relay_log_info::state_delaying_string.
         - Moved the body of init_relay_log_info into the new member function
           Relay_log_info::init and made init_relay_log_info a wrapper around the
           new member function.
         - Added debug printouts.
     @ sql/rpl_rli.h
         - Removed is_fake and no_storage (they meant the same thing) and replaced
           them with the inline member function belongs_to_client().
         - Added private delay variables, and public functions to get and set them.
         - Replaced flush_relay_log_info and init_relay_log_info by the new member
           function Relay_log_info::flush and Relay_log_info::init.
         - Added comments clarifying how to use group_[relay|master]_log_[pos|name].
     @ sql/share/errmsg.txt
        Added new error codes.
     @ sql/slave.cc
         - Added three new fields to SHOW SLAVE STATUS: Slave_SQL_Delay (as
           specified by CHANGE MASTER), Slave_SQL_Running_State (this just
           exposes thd_proc_info; it is to the SQL thread what Slave_IO_State
           is to the IO thread), and Slave_SQL_Remaining_Delay (NULL when the
           SQL thread is not sleeping; the remaining time in seconds when
           the SQL thread is sleeping).
         - Updated apply_event_and_update_pos so that it takes sleeping into
           account. It now calls the new function sql_delay_event, which
           handles the delay.
         - Cleaned up some debug printout code in apply_event_and_update_pos
           (since it is related to rli->is_fake, which has been replaced by
           rli->belongs_to_client_thread(), which is available on all builds)
         - Improved documentation.
         - Made the IO thread take appropriate lock while setting
           mi->clock_diff_with_master and while setting mi->slave_running.
         - Replaced flush_relay_log_info by the new member function
           Relay_log_info::flush, and made flush_relay_log_info a wrapper
           around Relay_log_info::flush.
         - Made Relay_log_info::flush write the new delay parameter. The
           format has changed: see commit message and source comments in
           rpl_rli.cc.
     @ sql/slave.h
         - Added MASTER_DELAY_MAX.
         - Clarified comments.
         - Moved forward declarations of functions defined in slave.cc to slave.h
     @ sql/sql_binlog.cc
         - Added check that BINLOG statements only contain row events and
           Format_description_log_events. This avoids possible strange side
           effects and deadlocks that might happen if users feed strange
           events like rotate event to the BINLOG command.
           After this change, BINLOG statements are not allowed to contain
           other event types than Format_description_log_event or row events.
         - With the new check, the code becomes more readable if refactored
           so that the event type is checked in a separate function. This
           means that the handling of Format_description_log_events has been
           refactored too.
         - Replaced the two member fields rli->is_fake and rli->no_storage by
           one single member function, rli->belongs_to_client().
     @ sql/sql_lex.cc
        Added implementation of new function
        st_lex_master_info::set_unspecified()
     @ sql/sql_lex.h
         - Added delay to st_lex_master_info.
         - Added set_unspecified()
         - Added explicit initialization of enumeration value SSL_UNCHANGED to 0,
           to make more clear that the value is not allowed to change (it is written
           to relay_log.info).
     @ sql/sql_repl.cc
         - Made RESET SLAVE reset the delay.
         - Initialize Relay_log_info::delay from Lex_master_info::delay.
     @ sql/sql_yacc.yy
         - Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"
         - Use new function st_lex_master_info::set_unspecified to clear
           st_lex_master_info structure, instead of bzero.
[26 Jun 2010 7:41] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100626073921-t0e6q2c9nkhuemnj) (version source revid:alik@sun.com-20100626073921-t0e6q2c9nkhuemnj) (pib:16)
[4 Aug 2010 8:03] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:alik@sun.com-20100626073921-t0e6q2c9nkhuemnj) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 8:19] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:alik@sun.com-20100626073921-t0e6q2c9nkhuemnj) (merge vers: 5.6.99-m4) (pib:18)
[6 Aug 2010 9:16] Jon Stephens
To be documented in conjunction with WL#344.