summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSerge Kozlov <Serge.Kozlov@sun.com>2009-11-28 02:34:47 +0300
committerSerge Kozlov <Serge.Kozlov@sun.com>2009-11-28 02:34:47 +0300
commit11faf99c29fdec3ed8907c9316841bcd53e3857f (patch)
treeea2c814fd4277d6a98300c2cba805ed58128d0f8 /mysql-test
parent9e3b092c92d71cd94b57608f08945939168ad8d8 (diff)
downloadmariadb-git-11faf99c29fdec3ed8907c9316841bcd53e3857f.tar.gz
Backport for WL#3894
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/rpl/t/rpl000010.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl000011.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl000013.test8
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/rpl/t/rpl000017-slave.sh0
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_alter.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment_11932.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_bit.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_bit_npk.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug33931.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_change_master.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_colSize.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_do_grant.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_view.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_dual_pos_advance.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_err_ignoredtable.test16
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh0
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_known_bugs_detection.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_charset.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_fatal.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_m.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_s.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddatalocal.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_master_pos_wait.test4
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh0
-rw-r--r--mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_delete.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_delete2.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_optimize.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_ps.test24
-rw-r--r--mysql-test/suite/rpl/t/rpl_relayspace.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_replicate_do.test8
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh0
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_create_table.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test28
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp001.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp005.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp008.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp009.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp010.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig002.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig003.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id2.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var.test21
-rw-r--r--mysql-test/suite/rpl/t/rpl_set_charset.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_skip.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp004.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_sporadic_master.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl1.test19
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_stop_slave.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_until.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_temp_table.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporary.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_user_variables.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_view.test12
62 files changed, 149 insertions, 270 deletions
diff --git a/mysql-test/suite/rpl/t/rpl000010.test b/mysql-test/suite/rpl/t/rpl000010.test
index 261b9148774..a95cded6496 100644
--- a/mysql-test/suite/rpl/t/rpl000010.test
+++ b/mysql-test/suite/rpl/t/rpl000010.test
@@ -6,14 +6,10 @@ source include/master-slave.inc;
create table t1 (n int not null auto_increment primary key);
insert into t1 values(NULL);
insert into t1 values(2);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select n from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl000011.test b/mysql-test/suite/rpl/t/rpl000011.test
index 32f6227f7c5..baff7c1a1b5 100644
--- a/mysql-test/suite/rpl/t/rpl000011.test
+++ b/mysql-test/suite/rpl/t/rpl000011.test
@@ -4,7 +4,9 @@ create table t1 (n int);
insert into t1 values(1);
sync_slave_with_master;
stop slave;
+--source include/wait_for_slave_to_stop.inc
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
insert into t1 values(2);
#let slave catch up
diff --git a/mysql-test/suite/rpl/t/rpl000013.test b/mysql-test/suite/rpl/t/rpl000013.test
index 69a102e84ce..c5a3285733a 100644
--- a/mysql-test/suite/rpl/t/rpl000013.test
+++ b/mysql-test/suite/rpl/t/rpl000013.test
@@ -9,9 +9,7 @@
--source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
connection master;
create table t2(n int);
@@ -46,8 +44,6 @@ connection master2;
# exist in this connection.
drop table if exists t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.sh b/mysql-test/suite/rpl/t/rpl000017-slave.sh
index 1d95798260a..1d95798260a 100755..100644
--- a/mysql-test/suite/rpl/t/rpl000017-slave.sh
+++ b/mysql-test/suite/rpl/t/rpl000017-slave.sh
diff --git a/mysql-test/suite/rpl/t/rpl_000015.test b/mysql-test/suite/rpl/t/rpl_000015.test
index 5b55be9a098..446c2f06ae5 100644
--- a/mysql-test/suite/rpl/t/rpl_000015.test
+++ b/mysql-test/suite/rpl/t/rpl_000015.test
@@ -20,6 +20,7 @@ eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT, MASTER_CONNECT_RETRY=7;
source include/show_slave_status2.inc;
start slave;
+--source include/wait_for_slave_to_start.inc
sync_with_master;
source include/show_slave_status2.inc;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_alter.test b/mysql-test/suite/rpl/t/rpl_alter.test
index 576376a0264..6a6da9c9f24 100644
--- a/mysql-test/suite/rpl/t/rpl_alter.test
+++ b/mysql-test/suite/rpl/t/rpl_alter.test
@@ -10,15 +10,11 @@ insert into mysqltest.t1 values (1,2);
create table mysqltest.t2 (n int);
insert into mysqltest.t2 values (45);
rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from mysqltest.t2;
select * from mysqltest.t3;
connection master;
drop database mysqltest;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test
index d4b7872fb2b..8c95e158847 100644
--- a/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test
+++ b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test
@@ -51,9 +51,7 @@ CALL simpleproc3();
select * from t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
use test1;
select * from t1;
diff --git a/mysql-test/suite/rpl/t/rpl_bit.test b/mysql-test/suite/rpl/t/rpl_bit.test
index 07b0778296c..c648159ff3a 100644
--- a/mysql-test/suite/rpl/t/rpl_bit.test
+++ b/mysql-test/suite/rpl/t/rpl_bit.test
@@ -78,10 +78,8 @@ SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
SELECT hex(bit2) from test.t1 ORDER BY bit2;
SELECT hex(bit3) from test.t1 ORDER BY bit3;
-save_master_pos;
+sync_slave_with_master;
-connection slave;
-sync_with_master;
SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
SELECT hex(bit2) from test.t1 ORDER BY bit2;
diff --git a/mysql-test/suite/rpl/t/rpl_bit_npk.test b/mysql-test/suite/rpl/t/rpl_bit_npk.test
index 12b587919f9..1df7341eafc 100644
--- a/mysql-test/suite/rpl/t/rpl_bit_npk.test
+++ b/mysql-test/suite/rpl/t/rpl_bit_npk.test
@@ -76,10 +76,8 @@ SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
SELECT hex(bit1) from test.t1 ORDER BY bit1;
SELECT hex(bit2) from test.t1 ORDER BY bit2;
SELECT hex(bit3) from test.t1 ORDER BY bit3;
-save_master_pos;
+sync_slave_with_master;
-connection slave;
-sync_with_master;
SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
FROM test.t1
ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
@@ -100,10 +98,8 @@ UPDATE test.t3 SET a = 2 WHERE b = 0;
SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
SELECT * FROM test.t3 ORDER BY a,b;
-save_master_pos;
+sync_slave_with_master;
-connection slave;
-sync_with_master;
SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
SELECT * FROM test.t3 ORDER BY a,b;
diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test
index fab5a23e957..42d86a7fc1e 100644
--- a/mysql-test/suite/rpl/t/rpl_bug33931.test
+++ b/mysql-test/suite/rpl/t/rpl_bug33931.test
@@ -17,10 +17,6 @@ reset slave;
# Add suppression for expected warnings in slaves error log
call mtr.add_suppression("Failed during slave I/O thread initialization");
---disable_warnings
-stop slave;
---enable_warnings
-
# Set debug flags on slave to force errors to occur
SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test
index c1ef417ea78..997cca42e82 100644
--- a/mysql-test/suite/rpl/t/rpl_change_master.test
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test
@@ -28,9 +28,7 @@ sync_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
index a49253f90c1..37420b13805 100644
--- a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
+++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
@@ -7,6 +7,9 @@
#############################################################
--source include/have_innodb.inc
+# Use wait_for_slave_to_(start|stop) for current connections
+let $keep_connection= 1;
+
# Set up circular ring and new names for servers
--echo *** Set up circular ring by schema A->B->C->D->A ***
--source include/circular_rpl_for_4_hosts_init.inc
diff --git a/mysql-test/suite/rpl/t/rpl_colSize.test b/mysql-test/suite/rpl/t/rpl_colSize.test
index c20f2c3fd35..07fd8041b18 100644
--- a/mysql-test/suite/rpl/t/rpl_colSize.test
+++ b/mysql-test/suite/rpl/t/rpl_colSize.test
@@ -16,6 +16,7 @@ DROP TABLE IF EXISTS t1;
--echo *** Create "wider" table on slave ***
sync_slave_with_master;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
RESET SLAVE;
eval CREATE TABLE t1 (
@@ -69,6 +70,7 @@ RESET MASTER;
--echo *** Start replication ***
connection slave;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
--echo *** Insert data on master and display it. ***
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test
index a13adf28b95..1cd36d35931 100644
--- a/mysql-test/suite/rpl/t/rpl_do_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test
@@ -8,9 +8,7 @@ connection master;
delete from mysql.user where user=_binary'rpl_do_grant';
delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# if these DELETE did nothing on the master, we need to do them manually on the
# slave.
delete from mysql.user where user=_binary'rpl_ignore_grant';
@@ -21,17 +19,13 @@ flush privileges;
connection master;
grant select on *.* to rpl_do_grant@localhost;
grant drop on test.* to rpl_do_grant@localhost;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
show grants for rpl_do_grant@localhost;
# test replication of SET PASSWORD
connection master;
set password for rpl_do_grant@localhost=password("does it work?");
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
#
@@ -44,9 +38,7 @@ select password<>'' from mysql.user where user='rpl_do_grant';
set sql_mode='ANSI_QUOTES';
set password for rpl_do_grant@localhost=password('does it work?');
set sql_mode='';
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select password<>'' from mysql.user where user='rpl_do_grant';
diff --git a/mysql-test/suite/rpl/t/rpl_drop.test b/mysql-test/suite/rpl/t/rpl_drop.test
index b38007a755f..6f586d90de3 100644
--- a/mysql-test/suite/rpl/t/rpl_drop.test
+++ b/mysql-test/suite/rpl/t/rpl_drop.test
@@ -7,10 +7,6 @@ drop table if exists t1, t2;
create table t1 (a int);
--error 1051
drop table t1, t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
-
-
diff --git a/mysql-test/suite/rpl/t/rpl_drop_view.test b/mysql-test/suite/rpl/t/rpl_drop_view.test
index 11633a0a7e8..05bf112b8b8 100644
--- a/mysql-test/suite/rpl/t/rpl_drop_view.test
+++ b/mysql-test/suite/rpl/t/rpl_drop_view.test
@@ -20,9 +20,7 @@ drop view v1, not_exist_view;
--error 1146
select * from v1;
drop view v2, v3;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
--error 1146
select * from v1;
--error 1146
diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
index 9efb3d16d2b..b2530e83b89 100644
--- a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
+++ b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
@@ -22,6 +22,7 @@ connection master;
eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root";
start slave;
+--source include/wait_for_slave_to_start.inc
# now we test it
@@ -38,12 +39,11 @@ sync_with_master;
# log-slave-updates and circul repl
#
stop slave;
+--source include/wait_for_slave_to_stop.inc
create table t2 (n int); # create one ignored event
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
connection slave;
@@ -85,6 +85,7 @@ start slave until master_log_file="slave-bin.000001",master_log_pos=663;
select * from t3;
start slave;
+--source include/wait_for_slave_to_start.inc
# BUG#13023 is that Exec_master_log_pos may stay too low "forever":
@@ -94,9 +95,7 @@ create table t4 (n int); # create 3 ignored events
create table t5 (n int);
create table t6 (n int);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
connection slave;
@@ -114,11 +113,10 @@ show tables;
# cleanup
stop slave;
+--source include/wait_for_slave_to_stop.inc
reset slave;
drop table t1,t2,t3,t4,t5,t6;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
index b9ab66165cc..4a6741a2db6 100644
--- a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
+++ b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
@@ -14,19 +14,15 @@ create table t4 (a int primary key);
--error 1022, ER_DUP_ENTRY
insert into t1 values (1),(1);
insert into t4 values (1),(2);
-save_master_pos;
-connection slave;
# as the t1 table is ignored on the slave, the slave should be able to sync
-sync_with_master;
+sync_slave_with_master;
# check that the table has been ignored, because otherwise the test is nonsense
show tables like 't1';
show tables like 't4';
SELECT * FROM test.t4 ORDER BY a;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# Now test that even critical errors (connection killed)
# are ignored if rules allow it.
@@ -53,15 +49,11 @@ connection master;
--error 0,1053,2013
reap;
connection master1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t4 ORDER BY a;
connection master1;
DROP TABLE test.t4;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
# Adding comment for force manual merge 5.0 -> wl1012. delete me if needed
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh
index a321dd690cd..a321dd690cd 100755..100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh
index e46ea6d400b..e46ea6d400b 100755..100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
index a8befe612c2..a873c1fa3a9 100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
@@ -1,6 +1,8 @@
# Testing if "flush logs" command bouncing resulting in logs created in a loop
# in case of bi-directional replication
-- source include/master-slave.inc
+# Use wait_for_slave_to_(start|stop) for current connections
+let $keep_connection= 1;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/
@@ -9,18 +11,20 @@ show variables like 'relay_log%';
connection slave;
--disable_warnings
stop slave;
+--source include/wait_for_slave_to_stop.inc
--enable_warnings
--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
start slave;
-
+--source include/wait_for_slave_to_start.inc
#
# Start replication slave -> master
#
connection master;
--disable_warnings
stop slave;
+--source include/wait_for_slave_to_stop.inc
--enable_warnings
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
diff --git a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
index b300603f454..60bccaad0d3 100644
--- a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
+++ b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
@@ -34,12 +34,14 @@ SELECT * FROM t1;
# restart replication for the next testcase
stop slave;
+--source include/wait_for_slave_to_stop.inc
reset slave;
connection master;
reset master;
drop table t1;
connection slave;
start slave;
+--source include/wait_for_slave_to_start.inc
# testcase with INSERT SELECT
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
index 031a0f6c351..3e1bc917a41 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
@@ -23,9 +23,7 @@ load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8
select hex(a) from t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select hex(a) from t1;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
index b7d9995c834..979f09f64e6 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
@@ -16,7 +16,7 @@ connection master;
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
connection slave;
-wait_for_slave_to_stop;
+--source include/wait_for_slave_sql_to_stop.inc
source include/show_slave_status.inc;
connection slave;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_m.test b/mysql-test/suite/rpl/t/rpl_loaddata_m.test
index 42c3ad99f33..48451c4aee1 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_m.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_m.test
@@ -28,9 +28,7 @@ LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
# Now lets check the slave to see what we have :-)
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SHOW DATABASES;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_s.test b/mysql-test/suite/rpl/t/rpl_loaddata_s.test
index 2dd2218eb5c..91ebcf058a6 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_s.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_s.test
@@ -16,9 +16,7 @@ load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
# Test logging on slave;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select count(*) from test.t1; # check that LOAD was replicated
source include/show_binlog_events.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
index a93a82d6d9f..ed556f3aedf 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
@@ -27,15 +27,11 @@ truncate table t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select a,count(*) from t1 group by a;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
index 2f7b18ae04b..ea107a28954 100644
--- a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
+++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
@@ -1,9 +1,7 @@
# See if master_pos_wait(,,timeout)
# Terminates with "timeout expired" (-1)
source include/master-slave.inc;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# Ask for a master log that has certainly not been reached yet
# timeout= 2 seconds
select master_pos_wait('master-bin.999999',0,2);
diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh b/mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh
index 8ce79797822..8ce79797822 100755..100644
--- a/mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh
+++ b/mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh
diff --git a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test
index 6a1f81abed3..85335d47c3a 100644
--- a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test
+++ b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test
@@ -18,6 +18,7 @@ show slave hosts;
drop table t1;
sync_slave_with_master;
stop slave;
+--source include/wait_for_slave_to_stop.inc
connection master;
# Test replication of timestamp
@@ -35,6 +36,7 @@ create table t5 select * from t4;
save_master_pos;
connection slave;
start slave;
+--source include/wait_for_slave_to_start.inc
sync_with_master;
select * from t2;
show create table t3;
diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete.test b/mysql-test/suite/rpl/t/rpl_multi_delete.test
index a251cbf8833..568a8a578a9 100644
--- a/mysql-test/suite/rpl/t/rpl_multi_delete.test
+++ b/mysql-test/suite/rpl/t/rpl_multi_delete.test
@@ -19,8 +19,6 @@ select * from t2;
connection master;
drop table t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete2.test b/mysql-test/suite/rpl/t/rpl_multi_delete2.test
index 81379d4056b..4062b08ceba 100644
--- a/mysql-test/suite/rpl/t/rpl_multi_delete2.test
+++ b/mysql-test/suite/rpl/t/rpl_multi_delete2.test
@@ -27,11 +27,9 @@ SELECT * FROM a;
insert into a values(2),(3);
delete a alias FROM a alias where alias.i=2;
select * from a;
-save_master_pos;
-connection slave;
+sync_slave_with_master;
use mysqltest_to;
-sync_with_master;
select * from a;
# BUG#3461
diff --git a/mysql-test/suite/rpl/t/rpl_optimize.test b/mysql-test/suite/rpl/t/rpl_optimize.test
index f4582ba1167..3c677a95463 100644
--- a/mysql-test/suite/rpl/t/rpl_optimize.test
+++ b/mysql-test/suite/rpl/t/rpl_optimize.test
@@ -47,8 +47,7 @@ sync_with_master; # won't work if slave SQL thread stopped
connection master; # cleanup
drop table t1;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# If the machine is so fast that slave syncs before OPTIMIZE
# starts, this test wil demonstrate nothing but will pass.
diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test
index bfc144c759b..61a1ad9d987 100644
--- a/mysql-test/suite/rpl/t/rpl_packet.test
+++ b/mysql-test/suite/rpl/t/rpl_packet.test
@@ -38,20 +38,15 @@ select @@net_buffer_length, @@max_allowed_packet;
create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023');
-save_master_pos;
+sync_slave_with_master;
-connection slave;
-sync_with_master;
eval select count(*) from `$db`.`t1` /* must be 1 */;
SHOW STATUS LIKE 'Slave_running';
select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING';
connection master;
eval drop database $db;
-save_master_pos;
-
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#
# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits
diff --git a/mysql-test/suite/rpl/t/rpl_ps.test b/mysql-test/suite/rpl/t/rpl_ps.test
index b00dec6b80c..143f75e5477 100644
--- a/mysql-test/suite/rpl/t/rpl_ps.test
+++ b/mysql-test/suite/rpl/t/rpl_ps.test
@@ -6,9 +6,7 @@
###########################################################
source include/master-slave.inc;
-#save_master_pos;
-#connection slave;
-#sync_with_master;
+#sync_slave_with_master;
#reset master;
#connection master;
@@ -30,20 +28,16 @@ prepare stmt2 from @var2;
set @var1='from-master-3';
execute stmt2 using @var1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM t1 ORDER BY n;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
stop slave;
-
+source include/wait_for_slave_to_stop.inc;
# End of 4.1 tests
#
@@ -102,13 +96,12 @@ use mysqltest1;
EXECUTE stmt_d_1;
--echo
---save_master_pos
+--sync_slave_with_master
+
--echo
--echo # Connection: slave
--echo
---connection slave
---sync_with_master
--echo
SELECT * FROM t1;
@@ -125,13 +118,12 @@ DROP DATABASE mysqltest1;
use test;
DROP TABLE t1;
--echo
---save_master_pos
+--sync_slave_with_master
+
--echo
--echo # Connection: slave
--echo
---connection slave
---sync_with_master
--echo
STOP SLAVE;
diff --git a/mysql-test/suite/rpl/t/rpl_relayspace.test b/mysql-test/suite/rpl/t/rpl_relayspace.test
index 0fc564cdb46..45b46674c05 100644
--- a/mysql-test/suite/rpl/t/rpl_relayspace.test
+++ b/mysql-test/suite/rpl/t/rpl_relayspace.test
@@ -4,6 +4,7 @@
source include/master-slave.inc;
connection slave;
stop slave;
+--source include/wait_for_slave_to_stop.inc
connection master;
# This will generate a master's binlog > 10 bytes
create table t1 (a int);
diff --git a/mysql-test/suite/rpl/t/rpl_replicate_do.test b/mysql-test/suite/rpl/t/rpl_replicate_do.test
index fea168ee9f1..3e22984aef8 100644
--- a/mysql-test/suite/rpl/t/rpl_replicate_do.test
+++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test
@@ -18,18 +18,14 @@ insert into t1 values(15),(16),(17);
update t1 set m=20 where m=16;
delete from t1 where m=17;
create table t11 select * from t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1 ORDER BY m;
select * from t2;
--error 1146
select * from t11;
connection master;
drop table if exists t1,t2,t11;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# show slave status, just to see of it prints replicate-do-table
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh
index 81490a54b4b..81490a54b4b 100755..100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
index e06099fd707..2490471018b 100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
@@ -56,6 +56,7 @@ connection master;
reset master;
connection slave;
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
#
@@ -100,6 +101,7 @@ connection slave;
#restart slave skipping one event
set global sql_slave_skip_counter=1;
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
@@ -161,9 +163,7 @@ select count(*) from t3 where n >= 4;
create table t4 select * from temp_table;
source include/show_binary_logs.inc;
source include/show_master_status.inc;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t4;
source include/show_slave_status2.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test
index 0d91d855a57..33457d759b8 100644
--- a/mysql-test/suite/rpl/t/rpl_row_create_table.test
+++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test
@@ -25,8 +25,10 @@ sync_slave_with_master;
--disable_query_log
set @storage_engine = @@global.storage_engine;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
SET GLOBAL storage_engine=memory;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
--enable_query_log
--source include/reset_master_and_slave.inc
@@ -129,8 +131,10 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
sync_slave_with_master;
# Here we reset the value of the default storage engine
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
SET GLOBAL storage_engine=@storage_engine;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
--enable_ps_protocol
# BUG#22864 (Rollback following CREATE ... SELECT discards 'CREATE
@@ -138,11 +142,13 @@ START SLAVE;
--echo ================ BUG#22864 ================
connection slave;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
RESET SLAVE;
connection master;
RESET MASTER;
connection slave;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
connection master;
SET AUTOCOMMIT=0;
CREATE TABLE t1 (a INT);
@@ -190,6 +196,7 @@ sync_slave_with_master;
# Some tests with temporary tables
connection slave;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
RESET SLAVE;
connection master;
@@ -197,6 +204,7 @@ RESET MASTER;
connection slave;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
connection master;
CREATE TABLE t1 (a INT);
diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
index a7967f6643a..9a645baead0 100644
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
@@ -116,16 +116,14 @@ sync_slave_with_master;
#(the server was started with skip-slave-start)
--disable_warnings
stop slave;
+--source include/wait_for_slave_to_stop.inc
--enable_warnings
---require r/slave-stopped.result
-show status like 'Slave_running';
connection master;
reset master;
connection slave;
reset slave;
start slave;
---require r/slave-running.result
-show status like 'Slave_running';
+--source include/wait_for_slave_to_start.inc
connection master;
# We should be clean at this point, now we will run in the file from above.
@@ -164,7 +162,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
# this test for position option
-# By setting this position to 417, we should only get the create of t3
+# By setting this position to 416, we should only get the create of t3
--disable_query_log
select "--- Test 2 position test --" as "";
--enable_query_log
@@ -181,9 +179,7 @@ select "--- Test 3 First Remote test --" as "";
# This is broken now
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=570 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
-
-# This part is disabled due to bug #17654
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=569 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- Test 4 Second Remote test --" as "";
@@ -206,16 +202,14 @@ sync_slave_with_master;
--disable_warnings
stop slave;
+--source include/wait_for_slave_to_stop.inc
--enable_warnings
---require r/slave-stopped.result
-show status like 'Slave_running';
connection master;
reset master;
connection slave;
reset slave;
start slave;
---require r/slave-running.result
-show status like 'Slave_running';
+--source include/wait_for_slave_to_start.inc
connection master;
# We should be clean at this point, now we will run in the file from above.
@@ -272,8 +266,8 @@ let $MYSQLD_DATADIR= `select @@datadir;`;
select "--- Test 7 reading stdin w/position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --position=417 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
-
+--exec $MYSQL_BINLOG --short-form --position=417 --stop-position=570 - < $MYSQLD_DATADIR/master-bin.000001
+
# Bug#16217 (mysql client did not know how not switch its internal charset)
--disable_query_log
select "--- Test 8 switch internal charset --" as "";
@@ -285,16 +279,14 @@ sync_slave_with_master;
--disable_warnings
stop slave;
+--source include/wait_for_slave_to_stop.inc
--enable_warnings
---require r/slave-stopped.result
-show status like 'Slave_running';
connection master;
reset master;
connection slave;
reset slave;
start slave;
---require r/slave-running.result
-show status like 'Slave_running';
+--source include/wait_for_slave_to_start.inc
connection master;
create table t4 (f text character set utf8);
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp001.test b/mysql-test/suite/rpl/t/rpl_row_sp001.test
index 1595c4a21d5..34d42d985f9 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp001.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp001.test
@@ -90,9 +90,7 @@ delimiter ;//
INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW');
SELECT * FROM t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
connection master;
@@ -105,17 +103,13 @@ SELECT * FROM t2 ORDER BY a;
connection master;
call test.p2(2);
SELECT * FROM t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
connection master;
call test.p2(3);
SELECT * FROM t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
##Used for debugging
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp005.test b/mysql-test/suite/rpl/t/rpl_row_sp005.test
index f5a74325b7c..abc7fb4f490 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp005.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp005.test
@@ -74,9 +74,7 @@ SELECT * FROM test.t2 ORDER BY id2;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1 ORDER BY id;
SELECT * FROM test.t2 ORDER BY id2;
@@ -92,8 +90,7 @@ SELECT * FROM test.t3 ORDER BY id3;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t3 ORDER BY id3;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp008.test b/mysql-test/suite/rpl/t/rpl_row_sp008.test
index b1295820c99..80603c28d27 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp008.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp008.test
@@ -41,9 +41,7 @@ SELECT * FROM test.t2;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t2;
# Cleanup
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp009.test b/mysql-test/suite/rpl/t/rpl_row_sp009.test
index 92d47c6f50f..77860621961 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp009.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp009.test
@@ -71,9 +71,7 @@ delimiter ;|
CALL test.p1('a');
SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t2 ORDER BY a;
connection master;
truncate test.t2;
@@ -81,17 +79,13 @@ truncate test.t2;
# this next call fails, but should not
call test.p1('b');
select * from test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t2 ORDER BY a;
connection master;
truncate test.t2;
SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t2 ORDER BY a;
# Cleanup
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp010.test b/mysql-test/suite/rpl/t/rpl_row_sp010.test
index 28b82217517..7fa0077f117 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp010.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp010.test
@@ -39,9 +39,7 @@ delimiter ;|
CALL test.p2();
SELECT * FROM test.t1 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
show tables;
connection master;
@@ -61,9 +59,7 @@ delimiter ;|
CALL test.p4();
SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t2 ORDER BY a;
# Cleanup
diff --git a/mysql-test/suite/rpl/t/rpl_row_trig002.test b/mysql-test/suite/rpl/t/rpl_row_trig002.test
index 7ca8a68f060..1ea245498d5 100644
--- a/mysql-test/suite/rpl/t/rpl_row_trig002.test
+++ b/mysql-test/suite/rpl/t/rpl_row_trig002.test
@@ -39,9 +39,7 @@ INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherw
SELECT * FROM test.t1 ORDER BY id;
#show binlog events;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1 ORDER BY id;
connection master;
@@ -51,9 +49,7 @@ INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
select * from test.t2;
select * from test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from test.t2;
select * from test.t3;
connection master;
@@ -63,9 +59,7 @@ DELETE FROM test.t1 WHERE id = 1;
SELECT * FROM test.t1 ORDER BY id;
connection master;
SELECT * FROM test.t1 ORDER BY id;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1 ORDER BY id;
# Cleanup
diff --git a/mysql-test/suite/rpl/t/rpl_row_trig003.test b/mysql-test/suite/rpl/t/rpl_row_trig003.test
index 5d667e29d69..781862161c1 100644
--- a/mysql-test/suite/rpl/t/rpl_row_trig003.test
+++ b/mysql-test/suite/rpl/t/rpl_row_trig003.test
@@ -120,9 +120,7 @@ DELETE FROM test.t1 WHERE id = 1;
DELETE FROM test.t2 WHERE id = 1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
connection master;
# time to dump the databases and so we can see if they match
diff --git a/mysql-test/suite/rpl/t/rpl_server_id2.test b/mysql-test/suite/rpl/t/rpl_server_id2.test
index 488a3aa6ab6..5c51a7fc08e 100644
--- a/mysql-test/suite/rpl/t/rpl_server_id2.test
+++ b/mysql-test/suite/rpl/t/rpl_server_id2.test
@@ -7,9 +7,11 @@ create table t1 (n int);
reset master;
# replicate ourselves
stop slave;
+--source include/wait_for_slave_to_stop.inc
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
start slave;
+--source include/wait_for_slave_to_start.inc
insert into t1 values (1);
save_master_pos;
sync_with_master;
@@ -18,6 +20,7 @@ select * from t1; # check that indeed 2 were inserted
# 'drop table t1' executed twice, so an error in the slave.err
# (not critical).
stop slave;
+--source include/wait_for_slave_to_stop.inc
drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_session_var.test b/mysql-test/suite/rpl/t/rpl_session_var.test
index 50efc8930a1..ee9f7e0585a 100644
--- a/mysql-test/suite/rpl/t/rpl_session_var.test
+++ b/mysql-test/suite/rpl/t/rpl_session_var.test
@@ -9,9 +9,7 @@ insert into t1 values('My'||'SQL', 1);
set @@session.sql_mode=default;
insert into t1 values('1'||'2', 2);
select * from t1 where b<3 order by a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1 where b<3 order by a;
connection master;
# if the slave does the next sync_with_master fine, then it means it accepts the
@@ -31,15 +29,11 @@ set @@session.sql_auto_is_null=0;
insert into t1 values(null);
insert into t2 select 2,a from t1 where a is null;
select * from t2 order by b;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t2 order by b;
connection master;
drop table t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#
# Bug #29878 Garbage data generation when executing SESSION_USER() on a slave.
@@ -54,12 +48,9 @@ CREATE TABLE t1 (
--disable_warnings
INSERT INTO t1(data) VALUES(SESSION_USER());
--enable_warnings
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT length(data) < 100 FROM t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
+
diff --git a/mysql-test/suite/rpl/t/rpl_set_charset.test b/mysql-test/suite/rpl/t/rpl_set_charset.test
index c70eb2681f5..241c1c5738b 100644
--- a/mysql-test/suite/rpl/t/rpl_set_charset.test
+++ b/mysql-test/suite/rpl/t/rpl_set_charset.test
@@ -20,16 +20,12 @@ INSERT INTO t1 VALUES ('����������������','E0');
INSERT INTO t1 VALUES ('����������������','F0');
select "--- on master ---";
select hex(a),b from t1 order by b;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
use mysqltest1;
select "--- on slave ---";
select hex(a),b from t1 order by b;
connection master;
drop database mysqltest1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test
index 6336e775af1..5ef58892ef6 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_skip.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test
@@ -5,6 +5,7 @@ source include/have_innodb.inc;
connection slave;
source include/have_innodb.inc;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
--echo **** On Master ****
connection master;
@@ -27,7 +28,7 @@ connection slave;
# Stop when reaching the the first table map event.
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
--- source include/wait_for_slave_sql_to_stop.inc
+--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
query_vertical SHOW SLAVE STATUS;
@@ -37,6 +38,7 @@ query_vertical SHOW SLAVE STATUS;
# changed.
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
sync_with_master;
# These values should be what was inserted, not what was
@@ -47,6 +49,7 @@ SELECT * FROM t1;
SELECT * FROM t2;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
RESET SLAVE;
connection master;
RESET MASTER;
@@ -59,9 +62,10 @@ source include/show_binlog_events.inc;
connection slave;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=106;
--- source include/wait_for_slave_sql_to_stop.inc
+--source include/wait_for_slave_sql_to_stop.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test
index aeb0bce7330..96a41d9a9ad 100644
--- a/mysql-test/suite/rpl/t/rpl_sp.test
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -456,9 +456,7 @@ DROP FUNCTION IF EXISTS f1;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--echo
--echo ---> connection: master
@@ -482,9 +480,7 @@ SHOW CREATE FUNCTION f1;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--echo ---> connection: master
@@ -506,9 +502,7 @@ SHOW CREATE FUNCTION f1;
DROP PROCEDURE p1;
DROP FUNCTION f1;
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--connection master
diff --git a/mysql-test/suite/rpl/t/rpl_sp004.test b/mysql-test/suite/rpl/t/rpl_sp004.test
index 967e7007c15..2f9b329eb66 100644
--- a/mysql-test/suite/rpl/t/rpl_sp004.test
+++ b/mysql-test/suite/rpl/t/rpl_sp004.test
@@ -46,9 +46,7 @@ delimiter ;|
CALL test.p1();
SELECT * FROM test.t1 ORDER BY a;
SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1 ORDER BY a;
SELECT * FROM test.t2 ORDER BY a;
@@ -57,9 +55,7 @@ CALL test.p2();
USE test;
SHOW TABLES;
#SELECT * FROM test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
USE test;
SHOW TABLES;
#SELECT * FROM test.t3;
@@ -69,9 +65,7 @@ CALL test.p1();
SELECT * FROM test.t1 ORDER BY a;
SELECT * FROM test.t2 ORDER BY a;
#SELECT * FROM test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1 ORDER BY a;
SELECT * FROM test.t2 ORDER BY a;
#SELECT * FROM test.t3;
diff --git a/mysql-test/suite/rpl/t/rpl_sporadic_master.test b/mysql-test/suite/rpl/t/rpl_sporadic_master.test
index 824f7abc9f5..6640544b0ed 100644
--- a/mysql-test/suite/rpl/t/rpl_sporadic_master.test
+++ b/mysql-test/suite/rpl/t/rpl_sporadic_master.test
@@ -14,7 +14,9 @@ truncate table t1;
insert into t1 values (4),(NULL);
sync_slave_with_master;
stop slave;
+--source include/wait_for_slave_to_stop.inc
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
insert into t1 values (NULL),(NULL);
flush logs;
diff --git a/mysql-test/suite/rpl/t/rpl_ssl1.test b/mysql-test/suite/rpl/t/rpl_ssl1.test
index b5355d737d5..85f073d9c09 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl1.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl1.test
@@ -9,14 +9,13 @@ source include/master-slave.inc;
connection master;
grant replication slave on *.* to replssl@localhost require ssl;
create table t1 (t int);
-save_master_pos;
#syncing with master
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#trying to use this user without ssl
stop slave;
+--source include/wait_for_slave_to_stop.inc
change master to master_user='replssl',master_password='';
start slave;
@@ -31,15 +30,15 @@ select * from t1;
#showing that replication could work with ssl params
stop slave;
+--source include/wait_for_slave_to_stop.inc
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval change master to master_ssl=1 , master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem';
start slave;
+--source include/wait_for_slave_to_start.inc
#avoiding unneeded sleeps
connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#checking that replication is ok
select * from t1;
@@ -51,14 +50,14 @@ query_vertical show slave status;
#checking if replication works without ssl also performing clean up
stop slave;
+--source include/wait_for_slave_to_stop.inc
change master to master_user='root',master_password='', master_ssl=0;
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
drop user replssl@localhost;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
query_vertical show slave status;
@@ -68,6 +67,7 @@ query_vertical show slave status;
# Start replication with ssl_verify_server_cert turned on
connection slave;
stop slave;
+--source include/wait_for_slave_to_stop.inc
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval change master to
master_host="localhost",
@@ -77,6 +77,7 @@ eval change master to
master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem',
master_ssl_verify_server_cert=1;
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
create table t1 (t int);
diff --git a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
index d9b87427321..d599e88c840 100644
--- a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
@@ -9,6 +9,7 @@ connection master;
create table t1(n int);
sync_slave_with_master;
stop slave;
+--source include/wait_for_slave_to_stop.inc
connection master;
let $1=5000;
disable_query_log;
@@ -31,10 +32,7 @@ sync_with_master;
connection master;
drop table t1;
-save_master_pos;
-
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#
diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test
index 07a3b27763d..6b731780163 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_until.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_until.test
@@ -22,6 +22,9 @@
# Test is dependent on binlog positions
+# prepare version for substitutions
+let $VERSION=`select version()`;
+
# Stop slave before it starts replication. Also sync with master
# to avoid nondeterministic behaviour.
--echo [on slave]
diff --git a/mysql-test/suite/rpl/t/rpl_temp_table.test b/mysql-test/suite/rpl/t/rpl_temp_table.test
index 9b73961aeea..dc24f2fc87b 100644
--- a/mysql-test/suite/rpl/t/rpl_temp_table.test
+++ b/mysql-test/suite/rpl/t/rpl_temp_table.test
@@ -54,6 +54,4 @@ show status like 'Slave_open_temp_tables';
connect (master2,localhost,root,,);
connection master2;
drop table if exists t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test
index a59e4f2fd21..3f9f5c19a25 100644
--- a/mysql-test/suite/rpl/t/rpl_temporary.test
+++ b/mysql-test/suite/rpl/t/rpl_temporary.test
@@ -1,6 +1,5 @@
# Test need anonymous user when connection are made as "zedjzlcsjhd"
source include/add_anonymous_users.inc;
-
-- source include/master-slave.inc
# Clean up old slave's binlogs.
diff --git a/mysql-test/suite/rpl/t/rpl_user_variables.test b/mysql-test/suite/rpl/t/rpl_user_variables.test
index 8d570f28f64..0eae78fcb9f 100644
--- a/mysql-test/suite/rpl/t/rpl_user_variables.test
+++ b/mysql-test/suite/rpl/t/rpl_user_variables.test
@@ -20,9 +20,7 @@
# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
# We wait for the slave to have written all he wants to the binlog
# (otherwise RESET MASTER may come too early).
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
reset master;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_view.test b/mysql-test/suite/rpl/t/rpl_view.test
index 1053514bfec..01b4dc5ef55 100644
--- a/mysql-test/suite/rpl/t/rpl_view.test
+++ b/mysql-test/suite/rpl/t/rpl_view.test
@@ -74,9 +74,7 @@ DROP VIEW IF EXISTS v1;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--echo
--echo ---> connection: master
@@ -104,9 +102,7 @@ SELECT * FROM t1;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--echo ---> connection: master
@@ -127,9 +123,7 @@ SELECT * FROM t1;
DROP VIEW v1;
DROP TABLE t1;
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--connection master
#