List:Commits« Previous MessageNext Message »
From:Sven Sandberg Date:April 3 2008 11:08am
Subject:bk commit into 5.1 tree (sven:1.2553) BUG#28760
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of sven.  When sven does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 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.

  mysql-test/extra/rpl_tests/rpl_loaddata.test@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +3 -3
    Using query_vertical for show slave status for readability. (result file
    had to be updated anyway)

  mysql-test/include/save_master_pos.inc@stripped, 2008-04-03 16:08:33+07:00, sven@riska.(none)
+16 -0
    Auxiliary file to save master's binlog position in test language
    variables. This is needed for wait_for_slave_io_to_sync.inc

  mysql-test/include/save_master_pos.inc@stripped, 2008-04-03 16:08:33+07:00, sven@riska.(none)
+0 -0

  mysql-test/include/show_slave_status3.inc@stripped, 2008-04-03 16:08:33+07:00,
sven@riska.(none) +8 -0
    Auxiliary file to mask out binlog positions from SHOW SLAVE STATUS, but
    not mask out Slave_IO_State.

  mysql-test/include/show_slave_status3.inc@stripped, 2008-04-03 16:08:33+07:00,
sven@riska.(none) +0 -0

  mysql-test/include/wait_for_slave_io_to_sync.inc@stripped, 2008-04-03 16:08:33+07:00,
sven@riska.(none) +41 -0
    Auxiliary file to wait until the IO slave is in sync with the master
    position saved by save_master_pos.inc.

  mysql-test/include/wait_for_slave_io_to_sync.inc@stripped, 2008-04-03 16:08:33+07:00,
sven@riska.(none) +0 -0

  mysql-test/suite/rpl/r/rpl_000015.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +3 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_bug33931.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_change_master.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +2 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_deadlock_innodb.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +3 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_delayed_slave.result@stripped, 2008-04-03 16:08:33+07:00,
sven@riska.(none) +559 -0
    Result file for new test case.

  mysql-test/suite/rpl/r/rpl_delayed_slave.result@stripped, 2008-04-03 16:08:33+07:00,
sven@riska.(none) +0 -0

  mysql-test/suite/rpl/r/rpl_extraCol_innodb.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +10 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_extraCol_myisam.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +10 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1989 -1985
    Updated result file.

  mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1989 -1985
    Updated result file.

  mysql-test/suite/rpl/r/rpl_flushlog_loop.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_grant.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_incident.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +2 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_known_bugs_detection.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +2 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_loaddata.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +117 -6
    Updated result file.

  mysql-test/suite/rpl/r/rpl_loaddata_fatal.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +2 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_packet.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_replicate_do.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_rotate_logs.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +3 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_row_colSize.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +13 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_row_log.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_row_log_innodb.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_row_max_relay_size.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +6 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_row_reset_slave.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +4 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +6 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +6 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_row_until.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +4 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_server_id1.result@stripped, 2008-04-03 16:08:31+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_server_id2.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_skip_error.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +2 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_slave_skip.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +2 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_slave_status.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_ssl.result@stripped, 2008-04-03 16:08:32+07:00, sven@riska.(none)
+2 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_ssl1.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +3 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_stm_log.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +6 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_stm_reset_slave.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +4 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_stm_until.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +4 -0
    Updated result file.

  mysql-test/suite/rpl/r/rpl_temporary_errors.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl/t/rpl_delayed_slave.test@stripped, 2008-04-03 16:08:33+07:00,
sven@riska.(none) +247 -0
    New test case for time-delayed replication slaves.

  mysql-test/suite/rpl/t/rpl_delayed_slave.test@stripped, 2008-04-03 16:08:33+07:00,
sven@riska.(none) +0 -0

  mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +10 -0
    Updated result file.

  mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +117 -6
    Updated result file.

  mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +1 -0
    Updated result file.

  mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test@stripped, 2008-04-03 16:08:32+07:00,
sven@riska.(none) +3 -6
    Using show_slave_status2.inc instead of manually filtering (it filtered
    the wrong columns).

  sql/lex.h@stripped, 2008-04-03 16:08:32+07:00, sven@riska.(none) +1 -0
    Added MASTER_DELAY parser symbol.

  sql/rpl_mi.cc@stripped, 2008-04-03 16:08:32+07:00, sven@riska.(none) +5 -3
    Added initialization of mi->delay

  sql/rpl_mi.h@stripped, 2008-04-03 16:08:32+07:00, sven@riska.(none) +5 -0
    Added delay parameter to class Master_info

  sql/rpl_rli.cc@stripped, 2008-04-03 16:08:32+07:00, sven@riska.(none) +1 -4
    Made is_fake available for all builds. We now need is_fake in
    apply_event_and_update_pos() [slave.cc]

  sql/rpl_rli.h@stripped, 2008-04-03 16:08:32+07:00, sven@riska.(none) +7 -3
    Made is_fake available for all builds, and documented it.

  sql/slave.cc@stripped, 2008-04-03 16:08:32+07:00, sven@riska.(none) +87 -18
     - Added delay to SHOW SLAVE STATUS.
     - Updated apply_event_and_update_pos so that it takes sleeping into
    account. The signature of apply_event_and_update_pos has been changed: the
    "skip" parameter has been removed. Instead, the rli->is_fake flag is used
    to determine if skipping and/or sleeping should be done.
     - 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.

  sql/slave.h@stripped, 2008-04-03 16:08:33+07:00, sven@riska.(none) +1 -2
    Changed signature of apply_event_and_update_pos

  sql/sql_binlog.cc@stripped, 2008-04-03 16:08:33+07:00, sven@riska.(none) +2 -4
     - 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().
     - Updated call to apply_event_and_update_pos() since it has changed
    signature.

  sql/sql_lex.h@stripped, 2008-04-03 16:08:33+07:00, sven@riska.(none) +1 -0
    Added delay to st_lex_master_info.

  sql/sql_repl.cc@stripped, 2008-04-03 16:08:33+07:00, sven@riska.(none) +5 -0
    - Initialize Master_info.delay from Lex_master_info.delay.
    - Document show_binlog_info.

  sql/sql_yacc.yy@stripped, 2008-04-03 16:08:33+07:00, sven@riska.(none) +6 -0
    Added code to parse "CHANGE MASTER TO MASTER_DELAY = X"

diff -Nrup a/mysql-test/extra/rpl_tests/rpl_loaddata.test
b/mysql-test/extra/rpl_tests/rpl_loaddata.test
--- a/mysql-test/extra/rpl_tests/rpl_loaddata.test	2008-03-14 23:52:51 +07:00
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test	2008-04-03 16:08:31 +07:00
@@ -72,7 +72,7 @@ start slave;
 sync_with_master;
 --replace_result $MASTER_MYPORT MASTER_PORT
 --replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
+query_vertical show slave status;
 
 # Trigger error again to test CHANGE MASTER
 
@@ -94,7 +94,7 @@ change master to master_user='test';
 change master to master_user='root';
 --replace_result $MASTER_MYPORT MASTER_PORT
 --replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
+query_vertical show slave status;
 
 # Trigger error again to test RESET SLAVE
 
@@ -116,7 +116,7 @@ stop slave;
 reset slave;
 --replace_result $MASTER_MYPORT MASTER_PORT
 --replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
+query_vertical show slave status;
 
 # Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
 
diff -Nrup a/mysql-test/include/save_master_pos.inc
b/mysql-test/include/save_master_pos.inc
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/include/save_master_pos.inc	2008-04-03 16:08:33 +07:00
@@ -0,0 +1,16 @@
+# ==== Purpose ====
+#
+# Saves the master position in the variables
+# $saved_master_file and $saved_master_position.
+#
+# ==== Usage ====
+#
+# source include/save_master_pos.inc;
+#
+# Must be executed on a master.
+#
+# Usually followed by source include/wait_for_slave_io_to_sync.inc; or
+# some other script that uses the saved position.
+
+let $saved_master_file= query_get_value("SHOW MASTER STATUS", File, 1);
+let $saved_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1);
diff -Nrup a/mysql-test/include/show_slave_status3.inc
b/mysql-test/include/show_slave_status3.inc
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/include/show_slave_status3.inc	2008-04-03 16:08:33 +07:00
@@ -0,0 +1,8 @@
+# Include file to show the slave status, masking out some information
+# that varies depending on where the test is executed, as well as
+# binlog positions.  However, the Slave_IO_State is kept, not masked
+# out.
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
+query_vertical SHOW SLAVE STATUS;
diff -Nrup a/mysql-test/include/wait_for_slave_io_to_sync.inc
b/mysql-test/include/wait_for_slave_io_to_sync.inc
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/include/wait_for_slave_io_to_sync.inc	2008-04-03 16:08:33 +07:00
@@ -0,0 +1,41 @@
+# ==== Purpose ====
+#
+# Waits until the slave IO thread has been synced, i.e., all events
+# have been copied over to slave.  Does not care if the SQL thread is
+# in sync.
+#
+#
+# ==== Usage ====
+#
+# Syncs the slave to the position saved in the last call to
+# include/save_master_pos.inc.
+#
+# Must be called on the slave.
+
+let $error= `SELECT '$saved_master_pos' = '' OR '$saved_master_file' = ''`;
+if ($error) {
+  --echo ERROR IN TEST SCRIPT: you must source include/save_master_pos.inc before
include/wait_for_slave_io_to_sync.inc
+  exit;
+}
+
+let $_counter= 300;
+
+let $_file= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1);
+let $_pos= query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
+let $not_done= `SELECT '$_file' != '$saved_master_file' OR '$_pos' !=
'$saved_master_pos'`;
+
+while ($not_done)
+{
+  dec $_counter;
+  if (!$_counter)
+  {
+    --echo ERROR: failed while waiting for slave io to sync. _file=$_file _pos=$_pos
saved_master_file=$saved_master_file saved_master_pos=$saved_master_pos
+    query_vertical show slave status;
+    exit;
+  }
+  sleep 0.1;
+
+  let $_file= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1);
+  let $_pos= query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
+  let $not_done= `SELECT '$_file' != '$saved_master_file' OR '$_pos' !=
'$saved_master_pos'`;
+}
diff -Nrup a/mysql-test/suite/rpl/r/rpl_000015.result
b/mysql-test/suite/rpl/r/rpl_000015.result
--- a/mysql-test/suite/rpl/r/rpl_000015.result	2008-01-30 18:33:50 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_000015.result	2008-04-03 16:08:31 +07:00
@@ -44,6 +44,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 change master to master_host='127.0.0.1',master_user='root',
 master_password='',master_port=MASTER_PORT;
 SHOW SLAVE STATUS;
@@ -85,6 +86,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave;
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -125,6 +127,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 drop table if exists t1;
 create table t1 (n int, PRIMARY KEY(n));
 insert into t1 values (10),(45),(90);
diff -Nrup a/mysql-test/suite/rpl/r/rpl_bug33931.result
b/mysql-test/suite/rpl/r/rpl_bug33931.result
--- a/mysql-test/suite/rpl/r/rpl_bug33931.result	2008-02-20 01:55:21 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_bug33931.result	2008-04-03 16:08:31 +07:00
@@ -41,3 +41,4 @@ Last_IO_Errno	0
 Last_IO_Error	
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
diff -Nrup a/mysql-test/suite/rpl/r/rpl_change_master.result
b/mysql-test/suite/rpl/r/rpl_change_master.result
--- a/mysql-test/suite/rpl/r/rpl_change_master.result	2008-01-14 14:37:55 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result	2008-04-03 16:08:31 +07:00
@@ -50,6 +50,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 change master to master_user='root';
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -90,6 +91,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave;
 select * from t1;
 n
diff -Nrup a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
--- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result	2007-06-27 19:28:28 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result	2008-04-03 16:08:31 +07:00
@@ -83,6 +83,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 stop slave;
 delete from t3;
 change master to master_log_pos=548;
@@ -142,6 +143,7 @@ Last_IO_Errno	0
 Last_IO_Error	
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 set @my_max_relay_log_size= @@global.max_relay_log_size;
 set global max_relay_log_size=0;
 stop slave;
@@ -206,6 +208,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 drop table t1,t2,t3,t4;
 set global max_relay_log_size= @my_max_relay_log_size;
 End of 5.1 tests
diff -Nrup a/mysql-test/suite/rpl/r/rpl_delayed_slave.result
b/mysql-test/suite/rpl/r/rpl_delayed_slave.result
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/suite/rpl/r/rpl_delayed_slave.result	2008-04-03 16:08:33 +07:00
@@ -0,0 +1,559 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+[on master]
+create table t1 (a varchar(100));
+==== Test Normal Setup Delayed 10 Seconds ====
+[on slave]
+STOP SLAVE;
+CHANGE MASTER TO MASTER_DELAY = 10;
+START SLAVE;
+[on master]
+INSERT INTO t1 VALUES ('normal setup');
+[on slave]
+SELECT * FROM t1;
+a
+SHOW SLAVE STATUS;
+Slave_IO_State	Waiting for master to send event
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	10
+SELECT * FROM t1;
+a
+SHOW SLAVE STATUS;
+Slave_IO_State	Waiting for master to send event
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	10
+==== Test with Different Timestamps, Slave Ahead ====
+[on master]
+SET TIMESTAMP = 100;
+[on slave]
+STOP SLAVE;
+SET TIMESTAMP = 10100;
+START SLAVE;
+[on master]
+INSERT INTO t1 VALUES ('slave clock ahead of master');
+[on slave]
+SELECT * FROM t1;
+a
+normal setup
+SHOW SLAVE STATUS;
+Slave_IO_State	Waiting for master to send event
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	10
+SELECT * FROM t1;
+a
+normal setup
+SHOW SLAVE STATUS;
+Slave_IO_State	Waiting for master to send event
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	10
+==== Test with Different Timestamps, Slave Behind ====
+[on master]
+SET TIMESTAMP = 10100;
+[on slave]
+STOP SLAVE;
+SET TIMESTAMP = 100;
+START SLAVE;
+[on master]
+INSERT INTO t1 VALUES ('slave clock behind master');
+[on slave]
+SELECT * FROM t1;
+a
+normal setup
+slave clock ahead of master
+SHOW SLAVE STATUS;
+Slave_IO_State	Waiting for master to send event
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	10
+SELECT * FROM t1;
+a
+normal setup
+slave clock ahead of master
+SHOW SLAVE STATUS;
+Slave_IO_State	Waiting for master to send event
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	10
+SET TIMESTAMP= 0;
+[on master]
+SET TIMESTAMP= 0;
+==== Test when Slave Lags "Naturally" After Master ====
+INSERT INTO t1 SELECT SLEEP(15);
+INSERT INTO t1 VALUES ('slave naturally lagging');
+[on slave]
+SELECT * FROM t1;
+a
+normal setup
+slave clock ahead of master
+slave clock behind master
+0
+slave naturally lagging
+SHOW SLAVE STATUS;
+Slave_IO_State	Waiting for master to send event
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	10
+==== Test STOP SLAVE and START SLAVE ====
+STOP SLAVE;
+CHANGE MASTER TO MASTER_DELAY = 15;
+START SLAVE;
+[on master]
+INSERT INTO t1 VALUES ('stop slave');
+[on slave]
+STOP SLAVE;
+SELECT * FROM t1;
+a
+normal setup
+slave clock ahead of master
+slave clock behind master
+0
+slave naturally lagging
+SHOW SLAVE STATUS;
+Slave_IO_State	
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	No
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	15
+START SLAVE;
+STOP SLAVE;
+SELECT * FROM t1;
+a
+normal setup
+slave clock ahead of master
+slave clock behind master
+0
+slave naturally lagging
+SHOW SLAVE STATUS;
+Slave_IO_State	
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	No
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	15
+SELECT * FROM t1;
+a
+normal setup
+slave clock ahead of master
+slave clock behind master
+0
+slave naturally lagging
+SHOW SLAVE STATUS;
+Slave_IO_State	
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	No
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	15
+==== Test Changing Back to No Delay ====
+[on master]
+SET TIMESTAMP = 0;
+[on slave]
+SET TIMESTAMP = 0;
+STOP SLAVE;
+Warnings:
+Note	1255	Slave already has been stopped
+CHANGE MASTER TO MASTER_DELAY = 0;
+START SLAVE;
+[on master]
+INSERT INTO t1 VALUES ('change back to no delay works');
+[on slave]
+SELECT * FROM t1;
+a
+normal setup
+slave clock ahead of master
+slave clock behind master
+0
+slave naturally lagging
+SHOW SLAVE STATUS;
+Slave_IO_State	Waiting for master to send event
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	15
diff -Nrup a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
--- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result	2008-03-07 01:32:45 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result	2008-04-03 16:08:31 +07:00
@@ -92,6 +92,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 size
mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should
be <= the slave's column size.
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 SELECT * FROM t2 ORDER BY a;
@@ -159,6 +160,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 type
mismatch - received type 252, test.t3 has type 3
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t3  ***
@@ -221,6 +223,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 type
mismatch - received type 246, test.t4 has type 3
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t4  ***
@@ -283,6 +286,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 5 type
mismatch - received type 4, test.t5 has type 246
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t5  ***
@@ -344,6 +348,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 3 type
mismatch - received type 16, test.t6 has type 3
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
 *** Drop t6  ***
 DROP TABLE t6;
@@ -453,6 +458,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1364
 Last_SQL_Error	Could not execute Write_rows event on table test.t9; Field 'e' doesn't
have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the
event's master log master-bin.000001, end_log_pos 330
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Create t10 on slave  ***
@@ -512,6 +518,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 254, test.t10 has type 5
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t10  ***
@@ -573,6 +580,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 15, test.t11 has type 252
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t11  ***
@@ -823,6 +831,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1060
 Last_SQL_Error	Error 'Duplicate column name 'c6'' on query. Default database: 'test'.
Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 *** Try to insert in master ****
@@ -959,6 +968,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 type
mismatch - received type 8, test.t17 has type 2
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 ** DROP table t17 ***
diff -Nrup a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
--- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result	2008-03-07 01:32:45 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result	2008-04-03 16:08:31 +07:00
@@ -92,6 +92,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 size
mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should
be <= the slave's column size.
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 SELECT * FROM t2 ORDER BY a;
@@ -159,6 +160,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 type
mismatch - received type 252, test.t3 has type 3
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t3  ***
@@ -221,6 +223,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 type
mismatch - received type 246, test.t4 has type 3
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t4  ***
@@ -283,6 +286,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 5 type
mismatch - received type 4, test.t5 has type 246
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t5  ***
@@ -344,6 +348,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 3 type
mismatch - received type 16, test.t6 has type 3
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
 *** Drop t6  ***
 DROP TABLE t6;
@@ -453,6 +458,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1364
 Last_SQL_Error	Could not execute Write_rows event on table test.t9; Field 'e' doesn't
have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the
event's master log master-bin.000001, end_log_pos 262
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Create t10 on slave  ***
@@ -512,6 +518,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 254, test.t10 has type 5
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t10  ***
@@ -573,6 +580,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 15, test.t11 has type 252
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t11  ***
@@ -823,6 +831,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1060
 Last_SQL_Error	Error 'Duplicate column name 'c6'' on query. Default database: 'test'.
Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 *** Try to insert in master ****
@@ -959,6 +968,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 type
mismatch - received type 8, test.t17 has type 2
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 ** DROP table t17 ***
diff -Nrup a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result	2008-01-12 00:39:44 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result	2008-04-03 16:08:31 +07:00
@@ -133,6 +133,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 
 ***** Testing Altering table def scenario *****
@@ -507,6 +508,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 ****************************************
 * columns in master at middle of table *
@@ -581,6 +583,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 5, test.t10 has type 254
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -656,6 +659,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 252, test.t11 has type 15
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -807,6 +811,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1091
 Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default
database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -893,6 +898,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1054
 Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'.
Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -979,6 +985,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1072
 Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database:
'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -1272,6 +1279,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 
 ***** Testing Altering table def scenario *****
@@ -1646,6 +1654,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 ****************************************
 * columns in master at middle of table *
@@ -1720,6 +1729,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 5, test.t10 has type 254
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -1795,6 +1805,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 252, test.t11 has type 15
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -1946,6 +1957,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1091
 Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default
database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -2032,6 +2044,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1054
 Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'.
Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -2118,6 +2131,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1072
 Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database:
'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -2411,6 +2425,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 
 ***** Testing Altering table def scenario *****
@@ -2785,6 +2800,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 ****************************************
 * columns in master at middle of table *
@@ -2859,6 +2875,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 5, test.t10 has type 254
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -2934,6 +2951,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 252, test.t11 has type 15
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -3085,6 +3103,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1091
 Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default
database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -3171,6 +3190,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1054
 Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'.
Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -3257,6 +3277,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1072
 Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database:
'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
diff -Nrup a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result	2008-01-12 00:39:44 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result	2008-04-03 16:08:31 +07:00
@@ -133,6 +133,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 
 ***** Testing Altering table def scenario *****
@@ -507,6 +508,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 ****************************************
 * columns in master at middle of table *
@@ -581,6 +583,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 5, test.t10 has type 254
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -656,6 +659,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 252, test.t11 has type 15
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -807,6 +811,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1091
 Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default
database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -893,6 +898,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1054
 Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'.
Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -979,6 +985,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1072
 Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database:
'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -1272,6 +1279,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 
 ***** Testing Altering table def scenario *****
@@ -1646,6 +1654,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 ****************************************
 * columns in master at middle of table *
@@ -1720,6 +1729,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 5, test.t10 has type 254
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -1795,6 +1805,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 252, test.t11 has type 15
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -1946,6 +1957,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1091
 Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default
database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -2032,6 +2044,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1054
 Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'.
Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -2118,6 +2131,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1072
 Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database:
'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -2411,6 +2425,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 
 ***** Testing Altering table def scenario *****
@@ -2785,6 +2800,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 
 ****************************************
 * columns in master at middle of table *
@@ -2859,6 +2875,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 5, test.t10 has type 254
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -2934,6 +2951,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 252, test.t11 has type 15
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -3085,6 +3103,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1091
 Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default
database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -3171,6 +3190,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1054
 Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'.
Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
@@ -3257,6 +3277,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1072
 Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database:
'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 
diff -Nrup a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
--- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result	2008-02-28 18:36:05 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result	2008-04-03 16:08:31 +07:00
@@ -63,3 +63,4 @@ Last_IO_Errno	#
 Last_IO_Error	
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
diff -Nrup a/mysql-test/suite/rpl/r/rpl_grant.result
b/mysql-test/suite/rpl/r/rpl_grant.result
--- a/mysql-test/suite/rpl/r/rpl_grant.result	2008-01-30 18:14:01 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_grant.result	2008-04-03 16:08:31 +07:00
@@ -80,3 +80,4 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
diff -Nrup a/mysql-test/suite/rpl/r/rpl_incident.result
b/mysql-test/suite/rpl/r/rpl_incident.result
--- a/mysql-test/suite/rpl/r/rpl_incident.result	2007-10-27 07:09:44 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_incident.result	2008-04-03 16:08:31 +07:00
@@ -64,6 +64,7 @@ Last_IO_Errno	0
 Last_IO_Error	
 Last_SQL_Errno	1590
 Last_SQL_Error	The incident LOST_EVENTS occured on the master. Message: <none>
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 SELECT * FROM t1;
@@ -111,4 +112,5 @@ Last_IO_Errno	0
 Last_IO_Error	
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 DROP TABLE t1;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
--- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result	2007-06-27 19:28:28 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result	2008-04-03 16:08:31 +07:00
@@ -50,6 +50,7 @@ Last_IO_Errno	0
 Last_IO_Error	
 Last_SQL_Errno	1105
 Last_SQL_Error	Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so
slave stops; check error log on slave for more info' on query. Default database: 'test'.
Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10'
+Delay	0
 SELECT * FROM t1;
 a	b
 stop slave;
@@ -141,6 +142,7 @@ SELECT t2.field_a, t2.field_b, t2.field_
 FROM t2
 ON DUPLICATE KEY UPDATE
 t1.field_3 = t2.field_c'
+Delay	0
 SELECT * FROM t1;
 id	field_1	field_2	field_3
 drop table t1, t2;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_loaddata.result
b/mysql-test/suite/rpl/r/rpl_loaddata.result
--- a/mysql-test/suite/rpl/r/rpl_loaddata.result	2008-03-14 23:52:51 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_loaddata.result	2008-04-03 16:08:31 +07:00
@@ -35,8 +35,45 @@ load data infile '../std_data_ln/rpl_loa
 set global sql_slave_skip_counter=1;
 start slave;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1797	#	#	master-bin.000001	Yes	Yes				#			0		0	1797	#	None		0	No						#	No	0		0	
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	1797
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	1797
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	0
 set sql_log_bin=0;
 delete from t1;
 set sql_log_bin=1;
@@ -45,8 +82,45 @@ stop slave;
 change master to master_user='test';
 change master to master_user='root';
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1832	#	#	master-bin.000001	No	No				#			0		0	1832	#	None		0	No						#	No	0		0	
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	1832
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	No
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	1832
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	0
 set global sql_slave_skip_counter=1;
 start slave;
 set sql_log_bin=0;
@@ -56,8 +130,45 @@ load data infile '../std_data_ln/rpl_loa
 stop slave;
 reset slave;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
-#	127.0.0.1	root	MASTER_PORT	1		4	#	#		No	No				#			0		0	0	#	None		0	No						#	No	0		0	
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	
+Read_Master_Log_Pos	4
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	
+Slave_IO_Running	No
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	0
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	0
 reset master;
 create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
 unique(day)) engine=MyISAM;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
--- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result	2007-10-27 07:10:36 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result	2008-04-03 16:08:31 +07:00
@@ -45,6 +45,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE t1;
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -85,6 +86,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1593
 Last_SQL_Error	Fatal error: Not enough memory
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 DROP TABLE t1;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_packet.result
b/mysql-test/suite/rpl/r/rpl_packet.result
--- a/mysql-test/suite/rpl/r/rpl_packet.result	2007-09-16 17:06:56 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_packet.result	2008-04-03 16:08:31 +07:00
@@ -66,3 +66,4 @@ Last_IO_Errno	0
 Last_IO_Error	
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
diff -Nrup a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
--- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2007-08-21 19:32:26 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2008-04-03 16:08:31 +07:00
@@ -60,6 +60,7 @@ Last_IO_Errno	#
 Last_IO_Error	
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 SHOW BINLOG EVENTS;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
diff -Nrup a/mysql-test/suite/rpl/r/rpl_replicate_do.result
b/mysql-test/suite/rpl/r/rpl_replicate_do.result
--- a/mysql-test/suite/rpl/r/rpl_replicate_do.result	2007-07-05 03:06:25 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result	2008-04-03 16:08:31 +07:00
@@ -65,6 +65,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 create table t1 (ts timestamp);
 set one_shot time_zone='met';
 insert into t1 values('2005-08-12 00:00:00');
diff -Nrup a/mysql-test/suite/rpl/r/rpl_rotate_logs.result
b/mysql-test/suite/rpl/r/rpl_rotate_logs.result
--- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result	2008-01-14 14:37:56 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result	2008-04-03 16:08:31 +07:00
@@ -53,6 +53,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 select * from t1;
 s
 Could not break slave
@@ -134,6 +135,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 select * from t2;
 m
 34
@@ -198,6 +200,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 lock tables t3 read;
 select count(*) from t3 where n >= 4;
 count(*)
diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_colSize.result
b/mysql-test/suite/rpl/r/rpl_row_colSize.result
--- a/mysql-test/suite/rpl/r/rpl_row_colSize.result	2007-10-28 05:08:51 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_row_colSize.result	2008-04-03 16:08:31 +07:00
@@ -57,6 +57,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should
be <= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -111,6 +112,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 12, test.t1 on slave has size 12. Master's column size should
be <= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -165,6 +167,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should
be <= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -220,6 +223,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 type
mismatch - received type 5, test.t1 has type 4
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -275,6 +279,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 8, test.t1 on slave has size 1. Master's column size should be
<= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -329,6 +334,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 2, test.t1 on slave has size 2. Master's column size should be
<= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -384,6 +390,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be
<= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -439,6 +446,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 20, test.t1 on slave has size 11. Master's column size should
be <= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -525,6 +533,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be
<= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -580,6 +589,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 2000, test.t1 on slave has size 100. Master's column size
should be <= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -634,6 +644,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 200, test.t1 on slave has size 10. Master's column size should
be <= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -688,6 +699,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 2000, test.t1 on slave has size 1000. Master's column size
should be <= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -743,6 +755,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 size
mismatch - master has size 4, test.t1 on slave has size 1. Master's column size should be
<= the slave's column size.
+Delay	0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
--- a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result	2007-08-21 19:32:26 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result	2008-04-03 16:08:31 +07:00
@@ -56,4 +56,5 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1146
 Last_SQL_Error	Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
+Delay	0
 drop table t1, t2;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_log.result
b/mysql-test/suite/rpl/r/rpl_row_log.result
--- a/mysql-test/suite/rpl/r/rpl_row_log.result	2007-08-21 19:32:52 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result	2008-04-03 16:08:31 +07:00
@@ -272,6 +272,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2007-12-14 20:40:43 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2008-04-03 16:08:31 +07:00
@@ -288,6 +288,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
--- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result	2008-01-14 14:37:56 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result	2008-04-03 16:08:31 +07:00
@@ -62,6 +62,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 #
 # Test 2
 #
@@ -110,6 +111,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 #
 # Test 3: max_relay_log_size = 0
 #
@@ -158,6 +160,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 #
 # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
 #
@@ -203,6 +206,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 #
 # Test 5
 #
@@ -249,6 +253,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 #
 # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
 #
@@ -293,6 +298,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 flush logs;
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
--- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result	2008-01-14 14:37:56 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result	2008-04-03 16:08:31 +07:00
@@ -43,6 +43,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 stop slave;
 change master to master_user='test';
 SHOW SLAVE STATUS;
@@ -84,6 +85,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 reset slave;
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -124,6 +126,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave;
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -164,6 +167,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 stop slave;
 reset slave;
 start slave;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result	2008-02-05 20:42:01 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result	2008-04-03 16:08:31 +07:00
@@ -144,6 +144,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	1364
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (2);
@@ -195,6 +196,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	0
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 INSERT INTO t9 VALUES (4);
 INSERT INTO t4 VALUES (4);
 SHOW SLAVE STATUS;
@@ -236,6 +238,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	1535
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (5);
@@ -279,6 +282,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	1535
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -322,6 +326,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	1535
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -364,6 +369,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	0
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 INSERT INTO t7 VALUES (1),(2),(3);
 INSERT INTO t8 VALUES (1),(2),(3);
 SELECT * FROM t7 ORDER BY a;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result	2008-02-05 20:42:06 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result	2008-04-03 16:08:31 +07:00
@@ -144,6 +144,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	1364
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (2);
@@ -195,6 +196,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	0
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 INSERT INTO t9 VALUES (4);
 INSERT INTO t4 VALUES (4);
 SHOW SLAVE STATUS;
@@ -236,6 +238,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	1535
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (5);
@@ -279,6 +282,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	1535
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -322,6 +326,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	1535
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -364,6 +369,7 @@ Last_IO_Errno	0
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	0
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 INSERT INTO t7 VALUES (1),(2),(3);
 INSERT INTO t8 VALUES (1),(2),(3);
 SELECT * FROM t7 ORDER BY a;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_until.result
b/mysql-test/suite/rpl/r/rpl_row_until.result
--- a/mysql-test/suite/rpl/r/rpl_row_until.result	2007-08-21 19:33:00 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result	2008-04-03 16:08:31 +07:00
@@ -58,6 +58,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
 select * from t1;
 n
@@ -104,6 +105,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
 select * from t2;
 n
@@ -148,6 +150,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave;
 stop slave;
 start slave until master_log_file='master-bin.000001', master_log_pos=740;
@@ -190,6 +193,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave until master_log_file='master-bin', master_log_pos=561;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave until master_log_file='master-bin.000001', master_log_pos=561,
relay_log_pos=12;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_server_id1.result
b/mysql-test/suite/rpl/r/rpl_server_id1.result
--- a/mysql-test/suite/rpl/r/rpl_server_id1.result	2008-02-21 04:17:59 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_server_id1.result	2008-04-03 16:08:31 +07:00
@@ -48,3 +48,4 @@ Last_IO_Errno	1593
 Last_IO_Error	Fatal error: The slave I/O thread stops because master and slave have equal
MySQL server ids; these ids must be different for replication to work (or the
--replicate-same-server-id option must be used on slave but this does not always make
sense; please check the manual before using it).
 Last_SQL_Errno	#
 Last_SQL_Error	#
+Delay	0
diff -Nrup a/mysql-test/suite/rpl/r/rpl_server_id2.result
b/mysql-test/suite/rpl/r/rpl_server_id2.result
--- a/mysql-test/suite/rpl/r/rpl_server_id2.result	2007-06-27 19:28:29 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_server_id2.result	2008-04-03 16:08:32 +07:00
@@ -47,6 +47,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave;
 insert into t1 values (1);
 select * from t1;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_skip_error.result
b/mysql-test/suite/rpl/r/rpl_skip_error.result
--- a/mysql-test/suite/rpl/r/rpl_skip_error.result	2008-03-14 23:52:51 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_skip_error.result	2008-04-03 16:08:32 +07:00
@@ -70,6 +70,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 ==== Clean Up ====
 drop table t1;
 create table t1(a int primary key);
@@ -126,5 +127,6 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 ==== Clean Up ====
 drop table t1;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_slave_skip.result
b/mysql-test/suite/rpl/r/rpl_slave_skip.result
--- a/mysql-test/suite/rpl/r/rpl_slave_skip.result	2007-10-19 19:18:30 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result	2008-04-03 16:08:32 +07:00
@@ -76,6 +76,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 SELECT * FROM t1;
@@ -140,6 +141,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 **** On Master ****
 DROP TABLE t1, t2;
 SET SESSION BINLOG_FORMAT=ROW;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_slave_status.result
b/mysql-test/suite/rpl/r/rpl_slave_status.result
--- a/mysql-test/suite/rpl/r/rpl_slave_status.result	2008-03-10 22:07:13 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_slave_status.result	2008-04-03 16:08:32 +07:00
@@ -57,6 +57,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 drop table t1;
 delete from mysql.user where user='rpl';
 drop table t1;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_ssl.result b/mysql-test/suite/rpl/r/rpl_ssl.result
--- a/mysql-test/suite/rpl/r/rpl_ssl.result	2007-06-27 19:28:29 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_ssl.result	2008-04-03 16:08:32 +07:00
@@ -58,6 +58,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 STOP SLAVE;
 select * from t1;
 t
@@ -102,6 +103,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 drop user replssl@localhost;
 drop table t1;
 End of 5.0 tests
diff -Nrup a/mysql-test/suite/rpl/r/rpl_ssl1.result
b/mysql-test/suite/rpl/r/rpl_ssl1.result
--- a/mysql-test/suite/rpl/r/rpl_ssl1.result	2007-06-27 19:28:29 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_ssl1.result	2008-04-03 16:08:32 +07:00
@@ -57,6 +57,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 stop slave;
 change master to master_user='root',master_password='', master_ssl=0;
 start slave;
@@ -101,6 +102,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 stop slave;
 change master to
 master_host="localhost",
@@ -155,4 +157,5 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 drop table t1;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_stm_log.result
b/mysql-test/suite/rpl/r/rpl_stm_log.result
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result	2008-01-29 20:43:25 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result	2008-04-03 16:08:32 +07:00
@@ -270,6 +270,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
--- a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result	2008-01-14 14:37:56 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result	2008-04-03 16:08:32 +07:00
@@ -60,6 +60,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 #
 # Test 2
 #
@@ -108,6 +109,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 #
 # Test 3: max_relay_log_size = 0
 #
@@ -156,6 +158,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 #
 # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
 #
@@ -201,6 +204,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 #
 # Test 5
 #
@@ -247,6 +251,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 #
 # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
 #
@@ -291,6 +296,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 flush logs;
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
diff -Nrup a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
--- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result	2008-01-14 14:37:56 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result	2008-04-03 16:08:32 +07:00
@@ -43,6 +43,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 stop slave;
 change master to master_user='test';
 SHOW SLAVE STATUS;
@@ -84,6 +85,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 reset slave;
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -124,6 +126,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave;
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -164,6 +167,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 stop slave;
 reset slave;
 start slave;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_stm_until.result
b/mysql-test/suite/rpl/r/rpl_stm_until.result
--- a/mysql-test/suite/rpl/r/rpl_stm_until.result	2008-01-14 14:37:56 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_stm_until.result	2008-04-03 16:08:32 +07:00
@@ -58,6 +58,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
 select * from t1;
 n
@@ -104,6 +105,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
 select * from t2;
 n
@@ -148,6 +150,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave;
 stop slave;
 start slave until master_log_file='master-bin.000001', master_log_pos=776;
@@ -190,6 +193,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 start slave until master_log_file='master-bin', master_log_pos=561;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave until master_log_file='master-bin.000001', master_log_pos=561,
relay_log_pos=12;
diff -Nrup a/mysql-test/suite/rpl/r/rpl_temporary_errors.result
b/mysql-test/suite/rpl/r/rpl_temporary_errors.result
--- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result	2008-01-14 14:37:56 +07:00
+++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result	2008-04-03 16:08:32 +07:00
@@ -78,6 +78,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 DROP TABLE t1;
 **** On Master ****
 DROP TABLE t1;
diff -Nrup a/mysql-test/suite/rpl/t/rpl_delayed_slave.test
b/mysql-test/suite/rpl/t/rpl_delayed_slave.test
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/suite/rpl/t/rpl_delayed_slave.test	2008-04-03 16:08:33 +07:00
@@ -0,0 +1,247 @@
+# ==== Purpose ====
+#
+# Test the time-delayed replication feature, i.e.,
+# CHANGE MASTER TO MASTER_DELAY=X:
+#
+#  - Verify that slave really has not executed the events before the
+#    delay timeout, and that it has executed events after the timout.
+#
+#  - Verify that it works when master and slave have different
+#    timestamps.
+#
+#  - Verify that it works when slave is lagging behind master for
+#    "natural" reasons (i.e., slow queries).
+#
+#  - Verify that STOP SLAVE works instantly even during a delay, and
+#    that it does not cause events to be executed too early on slave.
+#
+#  - Verify that changing back to no delay works.
+#
+# ==== Method ====
+#
+# We run the slave with 10 seconds lag.
+#
+# In general, to test that a query has not been executed by the slave
+# before this time, we wait until the slave IO thread has received the
+# event, and then 5 seconds more, and check that the table has not
+# been updated.  To test taht a query has been executed after this
+# time, we wait 10 seconds more.
+#
+# To simulate that the slave lags "naturally", we do "select
+# sleep(15)".
+#
+# ==== Related Bugs and Worklogs ====
+#
+# WL#344: Time-delayed replication
+# BUG#28760: Simulating a replication lag
+# [duplicate] BUG#22072: configurable delayed replication
+# [duplicate] BUG#21639: Add Replication Delay parameter
+#
+# ==== Issues with this Test Case ====
+#
+# Relies on all its queries to be executed within 5 seconds.
+#
+# Takes a long time; it sleeps for 90 seconds.
+
+source include/master-slave.inc;
+source include/have_binlog_format_mixed_or_statement.inc;
+
+--echo [on master]
+create table t1 (a varchar(100));
+
+
+--echo ==== Test Normal Setup Delayed 10 Seconds ====
+
+--echo [on slave]
+sync_slave_with_master;
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+CHANGE MASTER TO MASTER_DELAY = 10;
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+
+--echo [on master]
+connection master;
+INSERT INTO t1 VALUES ('normal setup');
+source include/save_master_pos.inc;
+
+--echo [on slave]
+connection slave;
+source include/wait_for_slave_io_to_sync.inc;
+sleep 5;
+
+# Query should not have been executed.
+SELECT * FROM t1;
+source include/show_slave_status3.inc;
+
+sleep 10;
+
+# Query should have been executed.
+SELECT * FROM t1;
+source include/show_slave_status3.inc;
+
+
+--echo ==== Test with Different Timestamps, Slave Ahead ====
+
+--echo [on master]
+connection master;
+SET TIMESTAMP = 100;
+
+--echo [on slave]
+connection slave;
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+SET TIMESTAMP = 10100;
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+
+--echo [on master]
+connection master;
+INSERT INTO t1 VALUES ('slave clock ahead of master');
+source include/save_master_pos.inc;
+
+--echo [on slave]
+connection slave;
+source include/wait_for_slave_io_to_sync.inc;
+sleep 5;
+
+# Query should not have been executed.
+SELECT * FROM t1;
+source include/show_slave_status3.inc;
+
+sleep 10;
+
+# Query should have been executed.
+SELECT * FROM t1;
+source include/show_slave_status3.inc;
+
+
+--echo ==== Test with Different Timestamps, Slave Behind ====
+
+--echo [on master]
+connection master;
+SET TIMESTAMP = 10100;
+
+--echo [on slave]
+connection slave;
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+SET TIMESTAMP = 100;
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+
+--echo [on master]
+connection master;
+INSERT INTO t1 VALUES ('slave clock behind master');
+source include/save_master_pos.inc;
+
+--echo [on slave]
+connection slave;
+source include/wait_for_slave_io_to_sync.inc;
+sleep 5;
+
+# Query should not have been executed.
+SELECT * FROM t1;
+source include/show_slave_status3.inc;
+
+sleep 10;
+
+# Query should have been executed.
+SELECT * FROM t1;
+source include/show_slave_status3.inc;
+
+SET TIMESTAMP= 0;
+--echo [on master]
+connection master;
+SET TIMESTAMP= 0;
+
+
+--echo ==== Test when Slave Lags "Naturally" After Master ====
+
+# To make slave lag, we do a SELECT SLEEP(15) on master
+INSERT INTO t1 SELECT SLEEP(15);
+save_master_pos;
+INSERT INTO t1 VALUES ('slave naturally lagging');
+source include/save_master_pos.inc;
+
+--echo [on slave]
+connection slave;
+sync_with_master;
+source include/wait_for_slave_io_to_sync.inc;
+sleep 5;
+
+# Query should have been executed.
+SELECT * FROM t1;
+source include/show_slave_status3.inc;
+
+
+--echo ==== Test STOP SLAVE and START SLAVE ====
+
+# Set up a longer delay.
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+CHANGE MASTER TO MASTER_DELAY = 15;
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+
+--echo [on master]
+connection master;
+INSERT INTO t1 VALUES ('stop slave');
+
+--echo [on slave]
+connection slave;
+sleep 5;
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+
+# Query should not have been executed.
+SELECT * FROM t1;
+source include/show_slave_status3.inc;
+
+# Start and stop again, to ensure that even after restarting the
+# slave, we do not execute the event too early.
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+sleep 5;
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+
+# Query should not have been executed.
+SELECT * FROM t1;
+source include/show_slave_status3.inc;
+
+sleep 10;
+
+# Query should have been executed.
+SELECT * FROM t1;
+source include/show_slave_status3.inc;
+
+
+--echo ==== Test Changing Back to No Delay ====
+
+--echo [on master]
+connection master;
+SET TIMESTAMP = 0;
+
+--echo [on slave]
+connection slave;
+SET TIMESTAMP = 0;
+STOP SLAVE;
+source include/wait_for_slave_to_stop.inc;
+CHANGE MASTER TO MASTER_DELAY = 0;
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+
+--echo [on master]
+connection master;
+INSERT INTO t1 VALUES ('change back to no delay works');
+source include/save_master_pos.inc;
+
+--echo [on slave]
+connection slave;
+source include/wait_for_slave_io_to_sync.inc;
+sleep 5;
+
+# Query should have been executed.
+SELECT * FROM t1;
+source include/show_slave_status3.inc;
diff -Nrup a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result	2007-06-27 19:28:30 +07:00
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result	2008-04-03 16:08:32 +07:00
@@ -179,6 +179,7 @@ Last_IO_Errno	<Last_IO_Errno>
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	<Last_SQL_Errno>
 Last_SQL_Error	<Last_SQL_Error>
+Delay	0
 set GLOBAL slave_transaction_retries=10;
 START SLAVE;
 select * from t1 order by nid;
diff -Nrup a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result	2008-03-07 01:32:45 +07:00
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result	2008-04-03 16:08:32 +07:00
@@ -92,6 +92,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 size
mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should
be <= the slave's column size.
+Delay	0
 STOP SLAVE;
 RESET SLAVE;
 SELECT * FROM t2 ORDER BY a;
@@ -159,6 +160,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 type
mismatch - received type 252, test.t3 has type 3
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t3  ***
@@ -221,6 +223,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 type
mismatch - received type 246, test.t4 has type 3
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t4  ***
@@ -283,6 +286,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 5 type
mismatch - received type 4, test.t5 has type 246
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t5  ***
@@ -344,6 +348,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 3 type
mismatch - received type 16, test.t6 has type 3
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
 *** Drop t6  ***
 DROP TABLE t6;
@@ -453,6 +458,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1364
 Last_SQL_Error	Could not execute Write_rows event on table test.t9; Field 'e' doesn't
have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the
event's master log master-bin.000001, end_log_pos 447
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Create t10 on slave  ***
@@ -512,6 +518,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 254, test.t10 has type 5
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t10  ***
@@ -573,6 +580,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 2 type
mismatch - received type 15, test.t11 has type 252
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Drop t11  ***
@@ -823,6 +831,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1060
 Last_SQL_Error	Error 'Duplicate column name 'c6'' on query. Default database: 'test'.
Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 *** Try to insert in master ****
@@ -959,6 +968,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1535
 Last_SQL_Error	Table definition on master and slave does not match: Column 0 type
mismatch - received type 8, test.t17 has type 2
+Delay	0
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 ** DROP table t17 ***
diff -Nrup a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result	2007-06-27 19:28:30 +07:00
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result	2008-04-03 16:08:32 +07:00
@@ -33,15 +33,89 @@ c1	c2	c3
 row3	C	3
 row4	D	4
 SHOW SLAVE STATUS;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
-<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	Yes	Yes				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>	No	<Last_IO_Errno>	<Last_IO_Error>	0	
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	0
 STOP SLAVE;
 CHANGE MASTER TO
 master_log_file = 'master-bin.000001',
 master_log_pos = <the_pos> ;
 SHOW SLAVE STATUS;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
-<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	No	No				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>	No	<Last_IO_Errno>	<Last_IO_Error>	0	
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	No
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	0
 START SLAVE;
 SELECT * FROM t1 ORDER BY c3;
 c1	c2	c3
@@ -68,6 +142,43 @@ SELECT * FROM t1;
 c1	c2	c3
 row2	new on slave	2
 SHOW SLAVE STATUS;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
-<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	Yes	Yes				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>	<Last_IO_Errno>	<Last_IO_Error>		0	
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+Delay	0
 DROP TABLE IF EXISTS t1;
diff -Nrup a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result	2007-08-21 19:33:04 +07:00
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result	2008-04-03 16:08:32 +07:00
@@ -304,6 +304,7 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;
diff -Nrup a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result	2007-06-27 19:28:30 +07:00
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result	2008-04-03 16:08:32 +07:00
@@ -110,6 +110,7 @@ Last_IO_Errno	<Last_IO_Errno>
 Last_IO_Error	<Last_IO_Error>
 Last_SQL_Errno	0
 Last_SQL_Error	
+Delay	0
 SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
 hex(c1)	hex(c2)	c3
 1	1	row1
diff -Nrup a/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test
b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test	2007-07-25 20:29:29 +07:00
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test	2008-04-03 16:08:32 +07:00
@@ -43,8 +43,7 @@ SELECT * FROM t1 ORDER BY c3;
 SELECT * FROM t1 ORDER BY c3;
 
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8
<Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22
<Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
35 <Last_IO_Errno> 36 <Last_IO_Error>
-SHOW SLAVE STATUS;
+--source include/show_slave_status2.inc
 
 # stop slave and reset position to before the last changes
 STOP SLAVE;
@@ -54,8 +53,7 @@ eval CHANGE MASTER TO
   master_log_pos = $the_pos ;
 
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8
<Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22
<Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
35 <Last_IO_Errno> 36 <Last_IO_Error>
-SHOW SLAVE STATUS;
+--source include/show_slave_status2.inc
 
 # start the slave again
 # -> same events should have been applied again
@@ -107,8 +105,7 @@ COMMIT;
 --connection slave
 SELECT * FROM t1;
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8
<Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22
<Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
34 <Last_IO_Errno> 35 <Last_IO_Error>
-SHOW SLAVE STATUS;
+--source include/show_slave_status2.inc
 
 connection master;
 DROP TABLE IF EXISTS t1;
diff -Nrup a/sql/lex.h b/sql/lex.h
--- a/sql/lex.h	2007-11-01 03:43:45 +07:00
+++ b/sql/lex.h	2008-04-03 16:08:32 +07:00
@@ -306,6 +306,7 @@ static SYMBOL symbols[] = {
   { "LOW_PRIORITY",	SYM(LOW_PRIORITY)},
   { "MASTER",           SYM(MASTER_SYM)},
   { "MASTER_CONNECT_RETRY",           SYM(MASTER_CONNECT_RETRY_SYM)},
+  { "MASTER_DELAY",     SYM(MASTER_DELAY_SYM)},
   { "MASTER_HOST",           SYM(MASTER_HOST_SYM)},
   { "MASTER_LOG_FILE",           SYM(MASTER_LOG_FILE_SYM)},
   { "MASTER_LOG_POS",           SYM(MASTER_LOG_POS_SYM)},
diff -Nrup a/sql/rpl_mi.cc b/sql/rpl_mi.cc
--- a/sql/rpl_mi.cc	2007-08-16 13:52:43 +07:00
+++ b/sql/rpl_mi.cc	2008-04-03 16:08:32 +07:00
@@ -31,7 +31,8 @@ Master_info::Master_info()
   :Slave_reporting_capability("I/O"),
    ssl(0), fd(-1),  io_thd(0), inited(0),
    abort_slave(0),slave_running(0),
-   ssl_verify_server_cert(0), slave_run_id(0)
+   ssl_verify_server_cert(0), slave_run_id(0),
+   delay(0)
 {
   host[0] = 0; user[0] = 0; password[0] = 0;
   ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0;
@@ -68,8 +69,9 @@ void init_master_info_with_options(Maste
     strmake(mi->user, master_user, sizeof(mi->user) - 1);
   if (master_password)
     strmake(mi->password, master_password, MAX_PASSWORD_LENGTH);
-  mi->port = master_port;
-  mi->connect_retry = master_connect_retry;
+  mi->port= master_port;
+  mi->connect_retry= master_connect_retry;
+  mi->delay= 0;
 
   mi->ssl= master_ssl;
   if (master_ssl_ca)
diff -Nrup a/sql/rpl_mi.h b/sql/rpl_mi.h
--- a/sql/rpl_mi.h	2007-08-16 13:52:43 +07:00
+++ b/sql/rpl_mi.h	2008-04-03 16:08:32 +07:00
@@ -100,6 +100,11 @@ class Master_info : public Slave_reporti
 
   */
   long clock_diff_with_master;
+  /**
+    Delay replication slave by this amount, compared to master (in
+    seconds).
+  */
+  long delay;
 };
 
 void init_master_info_with_options(Master_info* mi);
diff -Nrup a/sql/rpl_rli.cc b/sql/rpl_rli.cc
--- a/sql/rpl_rli.cc	2008-03-14 23:52:51 +07:00
+++ b/sql/rpl_rli.cc	2008-04-03 16:08:32 +07:00
@@ -33,10 +33,7 @@ Relay_log_info::Relay_log_info()
   :Slave_reporting_capability("SQL"),
    no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id),
    info_fd(-1), cur_log_fd(-1), save_temporary_tables(0),
-   group_relay_log_pos(0), event_relay_log_pos(0),
-#if HAVE_purify
-   is_fake(FALSE),
-#endif
+   group_relay_log_pos(0), event_relay_log_pos(0), is_fake(FALSE),
    cur_log_old_open_count(0), group_master_log_pos(0), log_space_total(0),
    ignore_log_space_limit(0), last_master_timestamp(0), slave_skip_counter(0),
    abort_pos_wait(0), slave_run_id(0), sql_thd(0),
diff -Nrup a/sql/rpl_rli.h b/sql/rpl_rli.h
--- a/sql/rpl_rli.h	2008-02-11 23:56:45 +07:00
+++ b/sql/rpl_rli.h	2008-04-03 16:08:32 +07:00
@@ -154,9 +154,13 @@ public:
   ulonglong event_relay_log_pos;
   ulonglong future_event_relay_log_pos;
 
-#ifdef HAVE_purify
-  bool is_fake; /* Mark that this is a fake relay log info structure */
-#endif
+  /*
+    False for the Relay_log_info object that belongs to the io thread
+    and sql thread; true for the Relay_log_info that belongs to a
+    client.  In other words, non-fake rli's are used for replication,
+    whereas fake ones are used to execute BINLOG statements.
+  */
+  bool is_fake;
 
   /* 
      Original log name and position of the group we're currently executing
diff -Nrup a/sql/slave.cc b/sql/slave.cc
--- a/sql/slave.cc	2008-03-26 20:40:38 +07:00
+++ b/sql/slave.cc	2008-04-03 16:08:32 +07:00
@@ -1283,6 +1283,9 @@ int register_slave_on_master(MYSQL* mysq
 }
 
 
+/**
+  Called to execute SHOW SLAVE STATUS.
+*/
 bool show_master_info(THD* thd, Master_info* mi)
 {
   // TODO: fix this for multi-master
@@ -1350,6 +1353,8 @@ bool show_master_info(THD* thd, Master_i
   field_list.push_back(new Item_empty_string("Last_IO_Error", 20));
   field_list.push_back(new Item_return_int("Last_SQL_Errno", 4, MYSQL_TYPE_LONG));
   field_list.push_back(new Item_empty_string("Last_SQL_Error", 20));
+  field_list.push_back(new Item_return_int("Delay", 10,
+                                           MYSQL_TYPE_LONG));
 
   if (protocol->send_fields(&field_list,
                             Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -1469,6 +1474,8 @@ bool show_master_info(THD* thd, Master_i
     protocol->store(mi->rli.last_error().number);
     // Last_SQL_Error
     protocol->store(mi->rli.last_error().message, &my_charset_bin);
+    // Delay
+    protocol->store((uint32) mi->delay);
 
     pthread_mutex_unlock(&mi->rli.data_lock);
     pthread_mutex_unlock(&mi->data_lock);
@@ -1823,21 +1830,36 @@ static int has_temporary_error(THD *thd)
 /**
   Applies the given event and advances the relay log position.
 
-  In essence, this function does:
+  Conceptually, this function does:
 
   @code
     ev->apply_event(rli);
     ev->update_pos(rli);
   @endcode
 
-  But it also does some maintainance, such as skipping events if
-  needed and reporting errors.
+  It also does the following maintainance:
+
+   - Initializes the thread's server_id and time; and the event's
+     thread.
+
+   - If rli is not fake (i.e., if it belongs to the slave threads
+     instead of being used for executing BINLOG statements), it does
+     three things: (1) skips events if it is needed according to the
+     server id or slave_skip_counter; (2) sleeps appropriately if this
+     is a time-delayed slave (specified by CHANGE MASTER TO
+     MASTER_DELAY=X); (3) unlocks rli->data_lock.
 
-  If the @c skip flag is set, then it is tested whether the event
-  should be skipped, by looking at the slave_skip_counter and the
-  server id.  The skip flag should be set when calling this from a
-  replication thread but not set when executing an explicit BINLOG
-  statement.
+   - Reports errors as needed.
+
+  @param ev The event to apply.
+
+  @param thd The client thread that executes the event (i.e., the
+  slave sql thread if called from a replication slave, or the client
+  thread if called to execute a BINLOG statement).
+
+  @param rli The relay log info (i.e., the slave's rli if called from
+  a replication slave, or the client's thd->rli_fake if called to
+  execute a BINLOG statement).
 
   @retval 0 OK.
 
@@ -1846,8 +1868,7 @@ static int has_temporary_error(THD *thd)
   @retval 2 No error calling ev->apply_event(), but error calling
   ev->update_pos().
 */
-int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,
-                               bool skip)
+int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli)
 {
   int exec_res= 0;
 
@@ -1892,14 +1913,58 @@ int apply_event_and_update_pos(Log_event
     ev->when= my_time(0);
   ev->thd = thd; // because up to this point, ev->thd == 0
 
-  if (skip)
+  /*
+    There is one non-"fake" rli object for the slave threads, and one
+    "fake" rli object for executing explicit BINLOG statements.
+    Below, the slave does three things that should not be done by
+    BINLOG statements:
+
+    (1) checks if the event shall be skipped,
+
+    (2) unlocks rli->data_lock.
+
+    (3) honors the delay specified by CHANGE MASTER TO MASTER_DELAY=X,
+  */
+  if (!rli->is_fake)
   {
+    // (1) Check if we need to skip the event.
     int reason= ev->shall_skip(rli);
     if (reason == Log_event::EVENT_SKIP_COUNT)
       --rli->slave_skip_counter;
+
+    // (2) unlock rli->data_lock
     pthread_mutex_unlock(&rli->data_lock);
+
+    // (2) If event should be executed, check if slave needs to delay.
     if (reason == Log_event::EVENT_SKIP_NOT)
+    {
+      Master_info *mi= rli->mi;
+      long delay= mi->delay;
+      if (delay)
+      {
+        time_t now= my_time(0);
+        /*
+          X=when+clock_diff is the event time converted to the slave's clock.
+          Y=now-X is the time we are already delayed.
+          nap_time=delay-Y is the remaining time to delay
+        */
+        long nap_time= delay - (now - (ev->when + mi->clock_diff_with_master));
+        DBUG_PRINT("info", ("ev->when= %lu  mi->clock_diff_with_master= %lu  "
+                            "now= %lu  delay= %lu  nap_time= %lu",
+                            (long)ev->when, mi->clock_diff_with_master,
+                            (long)now, delay, nap_time));
+
+        if (nap_time > 0)
+        {
+          DBUG_PRINT("info", ("delaying replication event %lu secs",
+                              nap_time));
+          safe_sleep(thd, nap_time, (CHECK_KILLED_FUNC)sql_slave_killed,
+                     (void*)rli);
+        }
+      }
       exec_res= ev->apply_event(rli);
+    }
+
 #ifndef DBUG_OFF
     /*
       This only prints information to the debug trace.
@@ -1928,14 +1993,11 @@ int apply_event_and_update_pos(Log_event
   if (exec_res == 0)
   {
     int error= ev->update_pos(rli);
-#ifdef HAVE_purify
+#ifndef DBUG_OFF
+    DBUG_PRINT("info", ("update_pos error = %d", error));
     if (!rli->is_fake)
-#endif
     {
-#ifndef DBUG_OFF
       char buf[22];
-#endif
-      DBUG_PRINT("info", ("update_pos error = %d", error));
       DBUG_PRINT("info", ("group %s %s",
                           llstr(rli->group_relay_log_pos, buf),
                           rli->group_relay_log_name));
@@ -1943,6 +2005,7 @@ int apply_event_and_update_pos(Log_event
                           llstr(rli->event_relay_log_pos, buf),
                           rli->event_relay_log_name));
     }
+#endif
     /*
       The update should not fail, so print an error message and
       return an error code.
@@ -1988,7 +2051,7 @@ int apply_event_and_update_pos(Log_event
      fewer times, 0 is returned.
 
    - init_master_info or init_relay_log_pos failed. (These are called
-     if a failure occurs when applying the event.)</li>
+     if a failure occurs when applying the event.)
 
    - An error occurred when updating the binlog position.
 
@@ -2041,7 +2104,7 @@ static int exec_relay_log_event(THD* thd
   }
   if (ev)
   {
-    int exec_res= apply_event_and_update_pos(ev, thd, rli, TRUE);
+    int exec_res= apply_event_and_update_pos(ev, thd, rli);
 
     /*
       Format_description_log_event should not be deleted because it will be
@@ -3619,6 +3682,12 @@ static IO_CACHE *reopen_relay_log(Relay_
 }
 
 
+/**
+  Reads next event from the relay log.  Should be called from the
+  slave IO thread.
+
+  @return The event read, or NULL on error.
+*/
 static Log_event* next_event(Relay_log_info* rli)
 {
   Log_event* ev;
diff -Nrup a/sql/slave.h b/sql/slave.h
--- a/sql/slave.h	2008-03-26 20:40:39 +07:00
+++ b/sql/slave.h	2008-04-03 16:08:33 +07:00
@@ -188,8 +188,7 @@ int purge_relay_logs(Relay_log_info* rli
 void set_slave_thread_options(THD* thd);
 void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli);
 void rotate_relay_log(Master_info* mi);
-int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,
-                               bool skip);
+int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli);
 
 pthread_handler_t handle_slave_io(void *arg);
 pthread_handler_t handle_slave_sql(void *arg);
diff -Nrup a/sql/sql_binlog.cc b/sql/sql_binlog.cc
--- a/sql/sql_binlog.cc	2008-02-19 19:45:16 +07:00
+++ b/sql/sql_binlog.cc	2008-04-03 16:08:33 +07:00
@@ -56,9 +56,7 @@ void mysql_client_binlog_statement(THD* 
   if (!thd->rli_fake)
   {
     thd->rli_fake= new Relay_log_info;
-#ifdef HAVE_purify
     thd->rli_fake->is_fake= TRUE;
-#endif
     have_fd_event= FALSE;
   }
   if (thd->rli_fake &&
!thd->rli_fake->relay_log.description_event_for_exec)
@@ -196,7 +194,7 @@ void mysql_client_binlog_statement(THD* 
                           bytes_decoded, (long) bufptr,
                           (ulong) uint4korr(bufptr+EVENT_LEN_OFFSET)));
 #endif
-      ev->thd= thd;
+
       /*
         We go directly to the application phase, since we don't need
         to check if the event shall be skipped or not.
@@ -206,7 +204,7 @@ void mysql_client_binlog_statement(THD* 
         reporting.
       */
 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-      if (apply_event_and_update_pos(ev, thd, thd->rli_fake, FALSE))
+      if (apply_event_and_update_pos(ev, thd, thd->rli_fake))
       {
         /*
           TODO: Maybe a better error message since the BINLOG statement
diff -Nrup a/sql/sql_lex.h b/sql/sql_lex.h
--- a/sql/sql_lex.h	2008-02-22 17:30:30 +07:00
+++ b/sql/sql_lex.h	2008-04-03 16:08:33 +07:00
@@ -194,6 +194,7 @@ typedef struct st_lex_master_info
 {
   char *host, *user, *password, *log_file_name;
   uint port, connect_retry;
+  long delay;
   ulonglong pos;
   ulong server_id;
   /*
diff -Nrup a/sql/sql_repl.cc b/sql/sql_repl.cc
--- a/sql/sql_repl.cc	2008-02-19 19:58:00 +07:00
+++ b/sql/sql_repl.cc	2008-04-03 16:08:33 +07:00
@@ -1133,6 +1133,8 @@ bool change_master(THD* thd, Master_info
     mi->port = lex_mi->port;
   if (lex_mi->connect_retry)
     mi->connect_retry = lex_mi->connect_retry;
+  if (lex_mi->delay)
+    mi->delay= lex_mi->delay;
 
   if (lex_mi->ssl != LEX_MASTER_INFO::SSL_UNCHANGED)
     mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::SSL_ENABLE);
@@ -1462,6 +1464,9 @@ err:
 }
 
 
+/**
+  Called to execute SHOW MASTER STATUS queries.
+*/
 bool show_binlog_info(THD* thd)
 {
   Protocol *protocol= thd->protocol;
diff -Nrup a/sql/sql_yacc.yy b/sql/sql_yacc.yy
--- a/sql/sql_yacc.yy	2008-03-07 19:59:34 +07:00
+++ b/sql/sql_yacc.yy	2008-04-03 16:08:33 +07:00
@@ -792,6 +792,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
 %token  LOW_PRIORITY
 %token  LT                            /* OPERATOR */
 %token  MASTER_CONNECT_RETRY_SYM
+%token  MASTER_DELAY_SYM
 %token  MASTER_HOST_SYM
 %token  MASTER_LOG_FILE_SYM
 %token  MASTER_LOG_POS_SYM
@@ -1547,6 +1548,10 @@ master_def:
           {
             Lex->mi.connect_retry = $3;
           }
+        | MASTER_DELAY_SYM EQ ulong_num
+          {
+            Lex->mi.delay = $3;
+          }
         | MASTER_SSL_SYM EQ ulong_num
           {
             Lex->mi.ssl= $3 ? 
@@ -10557,6 +10562,7 @@ keyword_sp:
         | MASTER_PASSWORD_SYM      {}
         | MASTER_SERVER_ID_SYM     {}
         | MASTER_CONNECT_RETRY_SYM {}
+        | MASTER_DELAY_SYM         {}
         | MASTER_SSL_SYM           {}
         | MASTER_SSL_CA_SYM        {}
         | MASTER_SSL_CAPATH_SYM    {}
Thread
bk commit into 5.1 tree (sven:1.2553) BUG#28760Sven Sandberg3 Apr