diff options
author | Michael Widenius <monty@askmonty.org> | 2011-02-28 19:39:30 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-02-28 19:39:30 +0200 |
commit | 3358cdd5048671ee6cbbf50c291f7e0d0fda8e1e (patch) | |
tree | da0e622896425203d23ecdfd1bc77b57e3502edf /mysql-test/suite/rpl/r | |
parent | 869f5d0e81d5cbecaec3605f292fbb363b9ccbf6 (diff) | |
parent | f83e594218a6d19da2fa1ea2a01d860c30fe2913 (diff) | |
download | mariadb-git-3358cdd5048671ee6cbbf50c291f7e0d0fda8e1e.tar.gz |
Merge with 5.1 to get in changes from MySQL 5.1.55
Diffstat (limited to 'mysql-test/suite/rpl/r')
251 files changed, 2036 insertions, 2778 deletions
diff --git a/mysql-test/suite/rpl/r/rpl000011.result b/mysql-test/suite/rpl/r/rpl000011.result deleted file mode 100644 index dd0fa2fbe74..00000000000 --- a/mysql-test/suite/rpl/r/rpl000011.result +++ /dev/null @@ -1,16 +0,0 @@ -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; -create table t1 (n int); -insert into t1 values(1); -stop slave; -start slave; -insert into t1 values(2); -select * from t1; -n -1 -2 -drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl000010.result b/mysql-test/suite/rpl/r/rpl_000010.result index 65191ea411f..4bb87a765cd 100644 --- a/mysql-test/suite/rpl/r/rpl000010.result +++ b/mysql-test/suite/rpl/r/rpl_000010.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (n int not null auto_increment primary key); insert into t1 values(NULL); insert into t1 values(2); @@ -12,3 +8,4 @@ n 1 2 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_000011.result b/mysql-test/suite/rpl/r/rpl_000011.result new file mode 100644 index 00000000000..9160d1952c2 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_000011.result @@ -0,0 +1,13 @@ +include/master-slave.inc +[connection master] +create table t1 (n int); +insert into t1 values(1); +stop slave; +start slave; +insert into t1 values(2); +select * from t1; +n +1 +2 +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl000013.result b/mysql-test/suite/rpl/r/rpl_000013.result index 37838bb88e0..e94a469e970 100644 --- a/mysql-test/suite/rpl/r/rpl000013.result +++ b/mysql-test/suite/rpl/r/rpl_000013.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t2(n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); @@ -26,3 +22,4 @@ Slave_open_temp_tables 0 drop table if exists t1,t2; Warnings: Note 1051 Unknown table 't1' +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl000017.result b/mysql-test/suite/rpl/r/rpl_000017.result index 1c611357e64..1b4f9f1e8a3 100644 --- a/mysql-test/suite/rpl/r/rpl000017.result +++ b/mysql-test/suite/rpl/r/rpl_000017.result @@ -1,14 +1,8 @@ -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; -stop slave; +include/master-slave.inc +[connection master] grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab'; -start slave; -drop table if exists t1; +include/start_slave.inc create table t1(n int); insert into t1 values(24); select * from t1; @@ -16,3 +10,4 @@ n 24 drop table t1; delete from mysql.user where user="replicate"; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_EE_err.result b/mysql-test/suite/rpl/r/rpl_EE_err.result index 16fa931e303..3795deedee3 100644 --- a/mysql-test/suite/rpl/r/rpl_EE_err.result +++ b/mysql-test/suite/rpl/r/rpl_EE_err.result @@ -1,11 +1,8 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int) engine=myisam; flush tables; drop table if exists t1; Warnings: Error 2 Can't find file: 't1' (errno: 2) +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_LD_INFILE.result b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result index b092dd9e088..3280d4bbaf7 100644 --- a/mysql-test/suite/rpl/r/rpl_LD_INFILE.result +++ b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a)); LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; @@ -115,3 +111,4 @@ abasement abased abase DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_alter.result b/mysql-test/suite/rpl/r/rpl_alter.result index cedb6854239..d60f1b68082 100644 --- a/mysql-test/suite/rpl/r/rpl_alter.result +++ b/mysql-test/suite/rpl/r/rpl_alter.result @@ -1,10 +1,5 @@ -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; -drop database if exists mysqltest; +include/master-slave.inc +[connection master] create database mysqltest; create table mysqltest.t1 ( n int); alter table mysqltest.t1 add m int; @@ -35,7 +30,8 @@ ALTER TABLE t1 CHANGE b c INT; ALTER TABLE t2 CHANGE b c VARCHAR(255); INSERT INTO t1 (a) VALUES(2); -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_alter_db.result b/mysql-test/suite/rpl/r/rpl_alter_db.result index 60c07d0dede..55adbfeda79 100644 --- a/mysql-test/suite/rpl/r/rpl_alter_db.result +++ b/mysql-test/suite/rpl/r/rpl_alter_db.result @@ -1,12 +1,9 @@ -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; +include/master-slave.inc +[connection master] ==== Verify that alter database does not stop replication ==== create database temp_db; use temp_db; alter database collate latin1_bin; ==== Clean up ==== drop database temp_db; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment.result b/mysql-test/suite/rpl/r/rpl_auto_increment.result index 9fcd9bbd54c..ba73487cf16 100644 --- a/mysql-test/suite/rpl/r/rpl_auto_increment.result +++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3; insert into t1 values (NULL,1),(NULL,2),(NULL,3); select * from t1; @@ -244,12 +240,7 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 drop table t1; -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; +include/rpl_reset.inc DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb; @@ -303,12 +294,12 @@ id INSERT INTO t1 VALUES(4); INSERT INTO t2 VALUES(4); FLUSH LOGS; -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1; DROP TABLE t2; -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1; DROP TABLE t2; SET SQL_MODE=''; @@ -341,3 +332,21 @@ DROP TABLE slave_only; DROP TABLE t1; DROP TABLE t_ignored1; DROP TABLE t_ignored2; +CREATE TABLE t1 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, data INT) ENGINE=innodb; +BEGIN; +# Set sql_mode with NO_AUTO_VALUE_ON_ZERO for allowing +# zero to fill the auto_increment field. +SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; +INSERT INTO t1(id,data) VALUES(0,2); +# Resetting sql_mode without NO_AUTO_VALUE_ON_ZERO to +# affect the execution of the transaction on slave. +SET SQL_MODE=0; +COMMIT; +SELECT * FROM t1; +id data +0 2 +SELECT * FROM t1; +id data +0 2 +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result b/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result index 25eda6ee454..62ff28e7159 100644 --- a/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result +++ b/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists test1; create database test1; use test1; @@ -44,4 +40,4 @@ id fname 1 testtest 1 2 test drop database test1; -drop database test1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result b/mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result new file mode 100644 index 00000000000..71c6ff57f80 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result @@ -0,0 +1,45 @@ +include/master-slave.inc +[connection master] +==== Initialize ==== +SET @old_relay_log_purge= @@global.relay_log_purge; +include/setup_fake_relay_log.inc +Setting up fake replication from MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 +==== Test ==== +start slave sql_thread; +include/wait_for_slave_param.inc [Exec_Master_Log_Pos] +# Result on slave +SELECT * FROM t1; +id +5 +6 +7 +8 +9 +10 +11 +SELECT * FROM t2; +id +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +==== Clean up ==== +stop slave sql_thread; +include/cleanup_fake_relay_log.inc +DROP TABLE t1, t2; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP FUNCTION f1; +SET @@global.relay_log_purge= @old_relay_log_purge; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result b/mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result index b2cc92491c3..af84978dc80 100644 --- a/mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result +++ b/mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] # Test case1: INVOKES A TRIGGER with after insert action create table t1(a int, b int) engine=innodb; create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb; @@ -110,9 +106,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with after insert action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -226,9 +222,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with before insert action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -342,9 +338,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with after update action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -458,9 +454,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with before update action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -574,9 +570,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with after delete action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -690,9 +686,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'INVOKES A TRIGGER with before delete action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t4 and slave:test.t4 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t4, slave:t4] +include/diff_tables.inc [master:t6, slave:t6] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -761,8 +757,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'CALLS A FUNCTION which INVOKES A TRIGGER with after insert action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t3 and slave:test.t3 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t3, slave:t3] drop table t1; drop table t2; drop table t3; @@ -828,8 +824,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ commit; #Test if the results are consistent on master and slave #for 'CALLS A FUNCTION which INVOKES A TRIGGER with before insert action' -Comparing tables master:test.t2 and slave:test.t2 -Comparing tables master:test.t3 and slave:test.t3 +include/diff_tables.inc [master:t2, slave:t2] +include/diff_tables.inc [master:t3, slave:t3] drop table t1; drop table t2; drop table t3; @@ -853,7 +849,7 @@ INSERT INTO v16(c1) VALUES (25), (26); commit; #Test if the results are consistent on master and slave #for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS' -Comparing tables master:test.t3 and slave:test.t3 +include/diff_tables.inc [master:t3, slave:t3] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -877,7 +873,7 @@ INSERT INTO v16(c1) VALUES (25), (26); commit; #Test if the results are consistent on master and slave #for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS' -Comparing tables master:test.t3 and slave:test.t3 +include/diff_tables.inc [master:t3, slave:t3] DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; @@ -980,8 +976,8 @@ master-bin.000001 # Query # # use `test`; insert into t2(a,b) values(3,3) master-bin.000001 # Xid # # COMMIT /* XID */ #Test if the results are consistent on master and slave #for 'UPDATE MORE THAN ONE TABLES ON TOP-STATEMENT' -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] drop table t1; drop table t2; # Test case14: INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES @@ -1034,8 +1030,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO v15(c2) VALUES (25), (26) master-bin.000001 # Xid # # COMMIT /* XID */ #Test if the results are consistent on master and slave #for 'INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES' -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] drop table t1; drop table t2; drop view v15; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result index f826136e81e..1fdbb5a7786 100644 --- a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result +++ b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS db1; DROP DATABASE IF EXISTS db2; CREATE DATABASE db1; @@ -49,6 +45,7 @@ before call db1.p1() after call db1.p1() [on slave] start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_POS; +include/wait_for_slave_sql_to_stop.inc # # If we got non-zero here, then we're suffering BUG#43263 # @@ -87,6 +84,7 @@ executed db1.p2() after call db1.p2() [on slave] start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_POS; +include/wait_for_slave_sql_to_stop.inc # # If we got non-zero here, then we're suffering BUG#43263 # @@ -105,6 +103,7 @@ s before call db1.p1() executed db1.p2() START SLAVE; +include/wait_for_slave_sql_to_start.inc # # SAVEPOINT and ROLLBACK TO have the same problem in BUG#43263 # This was reported by BUG#50407 @@ -167,3 +166,4 @@ a # DROP DATABASE db1; DROP DATABASE db2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_corruption.result b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result index f94d2833603..4f1eca42e1a 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_corruption.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result @@ -1,8 +1,15 @@ +include/master-slave.inc +[connection master] call mtr.add_suppression('Found invalid event in binary log'); ==== Initialize ==== +include/stop_slave.inc +RESET SLAVE; +include/setup_fake_relay_log.inc Setting up fake replication from MYSQL_TEST_DIR/std_data/bug40482-bin.000001 ==== Test ==== START SLAVE SQL_THREAD; +include/wait_for_slave_sql_error.inc [errno=1594] Last_SQL_Error = Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave. ==== Clean up ==== -Cleaning up after setup_fake_relay_log.inc +include/cleanup_fake_relay_log.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_errors.result b/mysql-test/suite/rpl/r/rpl_binlog_errors.result new file mode 100644 index 00000000000..be1b3b150bc --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_binlog_errors.result @@ -0,0 +1,278 @@ +include/master-slave.inc +[connection master] +####################################################################### +####################### PART 1: MASTER TESTS ########################## +####################################################################### +include/stop_slave.inc +call mtr.add_suppression("Can't generate a unique log-filename"); +call mtr.add_suppression("Writing one row to the row-based binary log failed.*"); +call mtr.add_suppression("Error writing file .*"); +SET @old_debug= @@global.debug; +SELECT repeat('x',8192) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data'; +SELECT repeat('x',10) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data'; +RESET MASTER; +###################### TEST #1 +FLUSH LOGS; +# assert: must show two binlogs +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +###################### TEST #2 +RESET MASTER; +SET GLOBAL debug="+d,error_unique_log_filename"; +FLUSH LOGS; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show one binlog +show binary logs; +Log_name File_size +master-bin.000001 # +SET GLOBAL debug=""; +RESET MASTER; +###################### TEST #3 +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB; +CREATE TABLE t4 (a VARCHAR(16384)); +INSERT INTO t1 VALUES (1); +RESET MASTER; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +# assert: must show two binlog +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; +###################### TEST #4 +SET GLOBAL debug="+d,error_unique_log_filename"; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show one entry +SELECT count(*) FROM t2; +count(*) +1 +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; +###################### TEST #5 +SET GLOBAL debug="+d,error_unique_log_filename"; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data' INTO TABLE t2; +# assert: must show one entry +SELECT count(*) FROM t2; +count(*) +1 +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; +###################### TEST #6 +SET GLOBAL debug="+d,error_unique_log_filename"; +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES ('muse'); +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +INSERT INTO t2 VALUES ('muse'); +COMMIT; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show three entries +SELECT count(*) FROM t2; +count(*) +3 +SET AUTOCOMMIT= 1; +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; +###################### TEST #7 +SET GLOBAL debug="+d,error_unique_log_filename"; +SELECT count(*) FROM t4; +count(*) +0 +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# assert: must show 1 entry +SELECT count(*) FROM t4; +count(*) +1 +### check that the incident event is written to the current log +SET GLOBAL debug="-d,error_unique_log_filename"; +FLUSH LOGS; +SHOW BINLOG EVENTS IN 'BINLOG_FILE' FROM <binlog_start> LIMIT 1; +Log_name Pos Event_type Server_id End_log_pos Info +BINLOG_FILE # Incident # # #1 (LOST_EVENTS) +DELETE FROM t4; +RESET MASTER; +###################### TEST #8 +SET GLOBAL debug="+d,error_unique_log_filename"; +# must show 0 entries +SELECT count(*) FROM t4; +count(*) +0 +SELECT count(*) FROM t2; +count(*) +0 +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# INFO: Count(*) Before Offending DELETEs +# assert: must show 1 entry +SELECT count(*) FROM t4; +count(*) +1 +# assert: must show 4 entries +SELECT count(*) FROM t2; +count(*) +4 +DELETE FROM t4; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +DELETE FROM t2; +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) + +# INFO: Count(*) After Offending DELETEs +# assert: must show zero entries +SELECT count(*) FROM t4; +count(*) +0 +SELECT count(*) FROM t2; +count(*) +0 +SET GLOBAL debug="-d,error_unique_log_filename"; +###################### TEST #9 +SET GLOBAL debug="+d,error_unique_log_filename"; +SET SQL_LOG_BIN=0; +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); +INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); +# assert: must show four entries +SELECT count(*) FROM t2; +count(*) +4 +SELECT count(*) FROM t4; +count(*) +4 +DELETE FROM t2; +DELETE FROM t4; +# assert: must show zero entries +SELECT count(*) FROM t2; +count(*) +0 +SELECT count(*) FROM t4; +count(*) +0 +SET SQL_LOG_BIN=1; +SET GLOBAL debug="-d,error_unique_log_filename"; +###################### TEST #10 +call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Could not open .*"); +RESET MASTER; +SHOW WARNINGS; +Level Code Message +SET GLOBAL debug="+d,fault_injection_registering_index"; +FLUSH LOGS; +ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1) +SET GLOBAL debug="-d,fault_injection_registering_index"; +SHOW BINARY LOGS; +ERROR HY000: You are not using binary logging +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +###################### TEST #11 +include/rpl_restart_server.inc [server_number=1] +SET GLOBAL debug="+d,fault_injection_openning_index"; +FLUSH LOGS; +ERROR HY000: Can't open file: 'master-bin.index' (errno: 1) +SET GLOBAL debug="-d,fault_injection_openning_index"; +RESET MASTER; +ERROR HY000: Binlog closed, cannot RESET MASTER +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +include/rpl_restart_server.inc [server_number=1] +###################### TEST #12 +SET GLOBAL debug="+d,fault_injection_new_file_rotate_event"; +FLUSH LOGS; +ERROR HY000: Can't open file: 'master-bin' (errno: 2) +SET GLOBAL debug="-d,fault_injection_new_file_rotate_event"; +RESET MASTER; +ERROR HY000: Binlog closed, cannot RESET MASTER +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; +include/rpl_restart_server.inc [server_number=1] +SET GLOBAL debug= @old_debug; +DROP TABLE t1, t2, t4; +RESET MASTER; +include/start_slave.inc +####################################################################### +####################### PART 2: SLAVE TESTS ########################### +####################################################################### +include/rpl_reset.inc +call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*"); +call mtr.add_suppression("Error writing file .*"); +call mtr.add_suppression("Could not open .*"); +call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Can't generate a unique log-filename .*"); +###################### TEST #13 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug="+d,error_unique_log_filename"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug="-d,error_unique_log_filename"; +SET GLOBAL debug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +###################### TEST #14 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug="+d,fault_injection_new_file_rotate_event"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug="-d,fault_injection_new_file_rotate_event"; +SET GLOBAL debug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +###################### TEST #15 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug="+d,fault_injection_registering_index"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug="-d,fault_injection_registering_index"; +SET GLOBAL debug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +###################### TEST #16 +SET @old_debug=@@global.debug; +include/stop_slave.inc +SET GLOBAL debug="+d,fault_injection_openning_index"; +START SLAVE io_thread; +include/wait_for_slave_io_error.inc [errno=1595] +Last_IO_Error = 'Relay log write failure: could not queue event from master' +SET GLOBAL debug="-d,fault_injection_openning_index"; +SET GLOBAL debug=@old_debug; +include/rpl_restart_server.inc [server_number=2] +include/stop_slave_sql.inc +Warnings: +Note 1255 Slave already has been stopped +SET GLOBAL debug=@old_debug; +RESET SLAVE; +RESET MASTER; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_grant.result b/mysql-test/suite/rpl/r/rpl_binlog_grant.result index 7a2e3183d5b..93138fa5b43 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_grant.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_grant.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists d1; create database d1; use d1; @@ -30,3 +26,4 @@ Grants for x@y GRANT USAGE ON *.* TO 'x'@'y' drop user x@y; drop database d1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_binlog_max_cache_size.result index f9e492db6bc..a7e8b86ac79 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_max_cache_size.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_max_cache_size.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET GLOBAL max_binlog_cache_size = 4096; SET GLOBAL binlog_cache_size = 4096; CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; @@ -17,14 +13,11 @@ Got one of the listed errors *** Single statement on non-transactional table *** *** After WL#2687 the difference between STATEMENT/MIXED and ROW will not exist. *** Got one of the listed errors ---source include/wait_for_slave_sql_error_and_skip.inc -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] *** Single statement on both transactional and non-transactional tables. *** *** After WL#2687 we will be able to change the order of the tables. *** Got one of the listed errors ---source include/wait_for_slave_sql_error_and_skip.inc -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] TRUNCATE TABLE t1; TRUNCATE TABLE t2; TRUNCATE TABLE t3; @@ -39,7 +32,7 @@ Got one of the listed errors BEGIN; Got one of the listed errors Got one of the listed errors -source include/diff_master_slave.inc; +include/diff_tables.inc [master:t1,slave:t1] ######################################################################################## # 3 - BEGIN - COMMIT ######################################################################################## @@ -51,7 +44,7 @@ Got one of the listed errors Got one of the listed errors Got one of the listed errors COMMIT; -source include/diff_master_slave.inc; +include/diff_tables.inc [master:t1,slave:t1] ######################################################################################## # 4 - BEGIN - ROLLBACK ######################################################################################## @@ -65,7 +58,7 @@ Got one of the listed errors ROLLBACK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -source include/diff_master_slave.inc; +include/diff_tables.inc [master:t1,slave:t1] ######################################################################################## # 5 - PROCEDURE ######################################################################################## @@ -89,7 +82,7 @@ TRUNCATE TABLE t1; BEGIN; Got one of the listed errors ROLLBACK; -source include/diff_master_slave.inc; +include/diff_tables.inc [master:t1,slave:t1] ######################################################################################## # 6 - XID ######################################################################################## @@ -104,7 +97,7 @@ ROLLBACK TO sv; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back COMMIT; -source include/diff_master_slave.inc; +include/diff_tables.inc [master:t1,slave:t1] ######################################################################################## # 7 - NON-TRANS TABLE ######################################################################################## @@ -121,9 +114,7 @@ COMMIT; BEGIN; Got one of the listed errors COMMIT; ---source include/wait_for_slave_sql_error_and_skip.inc -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1590] ######################################################################## # 8 - Bug#55375(Regression Bug) Transaction bigger than # max_binlog_cache_size crashes slave @@ -140,6 +131,7 @@ SET GLOBAL binlog_cache_size= ORIGINAL_VALUE; BEGIN; Repeat statement 'INSERT INTO t1 VALUES($n, repeat("a", 32))' 128 times COMMIT; +include/wait_for_slave_sql_error.inc [errno=1197] SELECT count(*) FROM t1; count(*) 0 @@ -159,6 +151,6 @@ DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; DROP TABLE IF EXISTS t4; -DROP TABLE IF EXISTS t5; -DROP TABLE IF EXISTS t6; +DROP TABLE t5; DROP PROCEDURE p1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_query_filter_rules.result b/mysql-test/suite/rpl/r/rpl_binlog_query_filter_rules.result deleted file mode 100644 index 520d500ed7c..00000000000 --- a/mysql-test/suite/rpl/r/rpl_binlog_query_filter_rules.result +++ /dev/null @@ -1,11 +0,0 @@ -drop table if exists t1; -reset master; -create table t1 (a int); -insert into t1 values (1); -flush logs; -drop table t1; -*** must be 1 *** -select * from t1; -a -1 -drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_bit.result b/mysql-test/suite/rpl/r/rpl_bit.result index 924de8a65f8..fa935cd9e56 100644 --- a/mysql-test/suite/rpl/r/rpl_bit.result +++ b/mysql-test/suite/rpl/r/rpl_bit.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 ( dummyKey INTEGER NOT NULL, @@ -136,3 +132,4 @@ hex(bit3) 24 35 DROP TABLE IF EXISTS test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bit_npk.result b/mysql-test/suite/rpl/r/rpl_bit_npk.result index 9599660f18f..13c9985614e 100644 --- a/mysql-test/suite/rpl/r/rpl_bit_npk.result +++ b/mysql-test/suite/rpl/r/rpl_bit_npk.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 ( dummyKey INTEGER NOT NULL, @@ -167,3 +163,4 @@ a b DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_blackhole.result b/mysql-test/suite/rpl/r/rpl_blackhole.result index b48a782b570..566fb828fc7 100644 --- a/mysql-test/suite/rpl/r/rpl_blackhole.result +++ b/mysql-test/suite/rpl/r/rpl_blackhole.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT, b INT, c INT); CREATE TABLE t2 (a INT, b INT, c INT); ALTER TABLE t1 ENGINE=BLACKHOLE; @@ -98,4 +94,5 @@ SELECT COUNT(*) FROM t1; COUNT(*) 0 >>> Something was written to binary log <<< -drop table t1,t2; +DROP TABLE t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bug26395.result b/mysql-test/suite/rpl/r/rpl_bug26395.result index c6dd2d01ed3..a3725f34a55 100644 --- a/mysql-test/suite/rpl/r/rpl_bug26395.result +++ b/mysql-test/suite/rpl/r/rpl_bug26395.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialize ==== [on master] CREATE TABLE tinnodb (a INT) ENGINE = INNODB; @@ -20,6 +16,7 @@ SELECT * FROM tinnodb ORDER BY a; a 1 [on slave] +include/sync_slave_io_with_master.inc ==== Verify results on slave ==== include/stop_slave.inc SELECT "" AS Slave_IO_State; @@ -39,3 +36,4 @@ DROP TABLE tinnodb; set @@debug= @old_debug; [on slave] DROP TABLE tinnodb; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bug31076.result b/mysql-test/suite/rpl/r/rpl_bug31076.result index fd66ca85d57..09330b35fbd 100644 --- a/mysql-test/suite/rpl/r/rpl_bug31076.result +++ b/mysql-test/suite/rpl/r/rpl_bug31076.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE DATABASE track; USE track; CREATE TABLE `visits` ( @@ -67,3 +63,4 @@ event_id visit_id timestamp src data visits_events_id 20000 21231038 2007-09-18 03:59:02 Downloads/MySQL-4.1/mysql-4.1.12a-win32.zip 33712207 DROP DATABASE track; End of 5.1 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result index 292922a1afd..d27308db1d5 100644 --- a/mysql-test/suite/rpl/r/rpl_bug33931.result +++ b/mysql-test/suite/rpl/r/rpl_bug33931.result @@ -1,8 +1,12 @@ -reset master; +include/master-slave.inc +[connection master] call mtr.add_suppression("Failed during slave I/O thread initialization"); -stop slave; +include/stop_slave.inc reset slave; SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; -Last_SQL_Error = Failed during slave thread initialization +include/wait_for_slave_sql_error.inc [errno=1593] +Last_SQL_Error = 'Failed during slave thread initialization' SET GLOBAL debug=""; +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bug38694.result b/mysql-test/suite/rpl/r/rpl_bug38694.result index 711c4a91c03..84180af0870 100644 --- a/mysql-test/suite/rpl/r/rpl_bug38694.result +++ b/mysql-test/suite/rpl/r/rpl_bug38694.result @@ -1,6 +1,4 @@ -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; +include/master-slave.inc +[connection master] +call mtr.add_suppression("Aborted connection"); +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result index 883feb42b3f..6674ab168ef 100644 --- a/mysql-test/suite/rpl/r/rpl_change_master.result +++ b/mysql-test/suite/rpl/r/rpl_change_master.result @@ -1,15 +1,12 @@ -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; +include/master-slave.inc +[connection master] create table t1(n int); select * from t1; n stop slave sql_thread; insert into t1 values(1); insert into t1 values(2); +include/wait_for_slave_param.inc [Read_Master_Log_Pos] include/stop_slave.inc change master to master_user='root'; start slave; @@ -18,3 +15,4 @@ n 1 2 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_charset.result b/mysql-test/suite/rpl/r/rpl_charset.result index ae5cf3b0fd1..fff11542f6b 100644 --- a/mysql-test/suite/rpl/r/rpl_charset.result +++ b/mysql-test/suite/rpl/r/rpl_charset.result @@ -1,12 +1,6 @@ -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; +include/master-slave.inc +[connection master] set timestamp=1000000000; -drop database if exists mysqltest2; -drop database if exists mysqltest3; create database mysqltest2 character set latin2; set @@character_set_server=latin5; create database mysqltest3; @@ -142,3 +136,4 @@ primary key (`pk`) set @p=_latin1 'test'; update t1 set pk='test' where pk=@p; drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_charset_sjis.result b/mysql-test/suite/rpl/r/rpl_charset_sjis.result index 770ad0588d1..b31bad28a59 100644 --- a/mysql-test/suite/rpl/r/rpl_charset_sjis.result +++ b/mysql-test/suite/rpl/r/rpl_charset_sjis.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1; drop procedure if exists p1; create table t1 (a varchar(255) character set sjis); @@ -24,3 +20,4 @@ hex(a) 965C drop table t1; drop procedure p1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result index c3ccc76d1bc..fb1d3f8258e 100644 --- a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result +++ b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result @@ -1,60 +1,10 @@ -*** Set up circular ring by schema A->B->C->D->A *** -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; -STOP SLAVE; -RESET SLAVE; -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -SET auto_increment_increment = 4; -SET auto_increment_offset = 1; -RESET MASTER; -RESET SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_A_PORT,master_user='root',MASTER_LOG_FILE='MASTER_A_LOG_FILE'; -SET auto_increment_increment = 4; -SET auto_increment_offset = 2; -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',MASTER_LOG_FILE='MASTER_B_LOG_FILE'; -SET auto_increment_increment = 4; -SET auto_increment_offset = 3; -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_C_PORT,master_user='root',MASTER_LOG_FILE='MASTER_C_LOG_FILE'; -SET auto_increment_increment = 4; -SET auto_increment_offset = 4; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_D_PORT,master_user='root',MASTER_LOG_FILE='MASTER_D_LOG_FILE'; -SHOW VARIABLES LIKE 'auto_increment_%'; -Variable_name Value -auto_increment_increment 4 -auto_increment_offset 1 -SHOW VARIABLES LIKE 'auto_increment_%'; -Variable_name Value -auto_increment_increment 4 -auto_increment_offset 2 -SHOW VARIABLES LIKE 'auto_increment_%'; -Variable_name Value -auto_increment_increment 4 -auto_increment_offset 3 -SHOW VARIABLES LIKE 'auto_increment_%'; -Variable_name Value -auto_increment_increment 4 -auto_increment_offset 4 -1 -START SLAVE; -START SLAVE; -START SLAVE; -START SLAVE; +*** Set up circular replication on four servers *** +include/rpl_init.inc [topology=1->2->3->4->1] *** Preparing data *** CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM; CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB; +include/rpl_sync.inc *** Testing schema A->B->C->D->A *** @@ -62,6 +12,7 @@ INSERT INTO t1(b,c) VALUES('A',1); INSERT INTO t1(b,c) VALUES('B',1); INSERT INTO t1(b,c) VALUES('C',1); INSERT INTO t1(b,c) VALUES('D',1); +include/rpl_sync.inc SELECT 'Master A',a,b FROM t1 WHERE c = 1 ORDER BY a,b; Master A a b Master A 1 A @@ -95,6 +46,7 @@ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; include/start_slave.inc INSERT INTO t1 VALUES(6,'C',2); INSERT INTO t1(b,c) VALUES('B',2); +include/wait_for_slave_sql_error.inc [errno=1062] INSERT INTO t1(b,c) VALUES('A',2); INSERT INTO t1(b,c) VALUES('D',2); @@ -116,9 +68,9 @@ Master D a b Master D 8 D * Reconfigure replication to schema A->B->D->A * -STOP SLAVE; -STOP SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',master_log_file='LOG_FILE',master_log_pos=LOG_POS; +include/stop_slave_io.inc +include/stop_slave.inc +include/rpl_change_topology.inc [new topology=1->2->4->1,2->3] include/start_slave.inc * Check data inserted before failure * @@ -145,6 +97,7 @@ Master D 8 D INSERT INTO t1(b,c) VALUES('A',3); INSERT INTO t1(b,c) VALUES('B',3); INSERT INTO t1(b,c) VALUES('D',3); +include/rpl_sync.inc SELECT 'Master A',a,b FROM t1 WHERE c = 3 ORDER BY a,b; Master A a b Master A 9 A @@ -171,8 +124,9 @@ DELETE FROM t1 WHERE a = 6; START SLAVE; RESET MASTER; RESET SLAVE; -CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_C_PORT,master_user='root',master_log_file='LOG_FILE',master_log_pos=LOG_POS; +include/rpl_change_topology.inc [new topology=1->2->3->4->1] START SLAVE; +include/rpl_sync.inc * Check data inserted before restoring schema A->B->C->D->A * SELECT 'Master A',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; @@ -213,6 +167,7 @@ INSERT INTO t1(b,c) VALUES('A',4); INSERT INTO t1(b,c) VALUES('B',4); INSERT INTO t1(b,c) VALUES('C',4); INSERT INTO t1(b,c) VALUES('D',4); +include/rpl_sync.inc SELECT 'Master A',a,b FROM t1 WHERE c = 4 ORDER BY a,b; Master A a b Master A 13 A @@ -241,6 +196,7 @@ Master D 16 D * Transactions with commits * BEGIN; BEGIN; +include/rpl_sync.inc SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; Master A b COUNT(*) Master A A 100 @@ -269,6 +225,7 @@ Master D D 100 * Transactions with rollbacks * BEGIN; BEGIN; +include/rpl_sync.inc SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; Master A b COUNT(*) Master A B 100 @@ -288,11 +245,4 @@ Master D D 100 *** Clean up *** DROP TABLE t1,t2; -STOP SLAVE; -RESET SLAVE; -STOP SLAVE; -RESET SLAVE; -STOP SLAVE; -RESET SLAVE; -STOP SLAVE; -RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_colSize.result b/mysql-test/suite/rpl/r/rpl_colSize.result index 91456742833..8147ab2db37 100644 --- a/mysql-test/suite/rpl/r/rpl_colSize.result +++ b/mysql-test/suite/rpl/r/rpl_colSize.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1; **** Testing WL#3228 changes. **** *** Create "wider" table on slave *** @@ -177,3 +173,4 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 *** Cleanup *** DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_commit_after_flush.result b/mysql-test/suite/rpl/r/rpl_commit_after_flush.result index eaddda63b6a..b91b273e64e 100644 --- a/mysql-test/suite/rpl/r/rpl_commit_after_flush.result +++ b/mysql-test/suite/rpl/r/rpl_commit_after_flush.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT) ENGINE=innodb; begin; insert into t1 values(1); @@ -11,3 +7,4 @@ flush tables with read lock; commit; unlock tables; drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_concurrency_error.result b/mysql-test/suite/rpl/r/rpl_concurrency_error.result index 83e5f66a9c4..c6bd8dc6062 100644 --- a/mysql-test/suite/rpl/r/rpl_concurrency_error.result +++ b/mysql-test/suite/rpl/r/rpl_concurrency_error.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ######################################################################## # Environment ######################################################################## @@ -101,11 +97,12 @@ master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'dark blue 1' WHERE f master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (6 + (1 * 10),"brown") master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown") master-bin.000001 # Xid # # COMMIT /* XID */ -source include/diff_master_slave.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc +include/rpl_diff.inc ######################################################################## # Cleanup ######################################################################## DROP TRIGGER tr; DROP TABLE t; DROP TABLE n; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_conditional_comments.result b/mysql-test/suite/rpl/r/rpl_conditional_comments.result index 105d3bc59f3..f520ac04bb4 100644 --- a/mysql-test/suite/rpl/r/rpl_conditional_comments.result +++ b/mysql-test/suite/rpl/r/rpl_conditional_comments.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1(c1 INT); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info @@ -17,7 +13,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; /* 99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /* 99999 ,(11)*/ -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Case 2: # ----------------------------------------------------------------- @@ -28,7 +24,7 @@ EXECUTE stmt; DROP TABLE t1; CREATE TABLE t1(c1 INT); EXECUTE stmt; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] SET @value=62; PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/'; @@ -46,7 +42,7 @@ master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALU master-bin.000001 # Query # # use `test`; DROP TABLE t1 master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/ -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Case 3: # ----------------------------------------------------------------- @@ -55,3 +51,4 @@ Comparing tables master:test.t1 and slave:test.t1 SELECT c1 FROM /*!99999 t1 WHEREN; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!99999 t1 WHEREN' at line 1 DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_create_database.result b/mysql-test/suite/rpl/r/rpl_create_database.result index 9780b65f334..6bb950483ed 100644 --- a/mysql-test/suite/rpl/r/rpl_create_database.result +++ b/mysql-test/suite/rpl/r/rpl_create_database.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS mysqltest_prometheus; DROP DATABASE IF EXISTS mysqltest_sisyfos; DROP DATABASE IF EXISTS mysqltest_bob; @@ -60,3 +56,4 @@ t2 DROP DATABASE IF EXISTS mysqltest_prometheus; DROP DATABASE IF EXISTS mysqltest_sisyfos; DROP DATABASE IF EXISTS mysqltest_bob; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result index e3cddf4c606..dbb48f734b8 100644 --- a/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result +++ b/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS mysqltest; CREATE DATABASE IF NOT EXISTS mysqltest; USE mysqltest; @@ -74,3 +70,4 @@ CREATE TABLE IF NOT EXISTS t1 AS SELECT SLEEP(3); KILL QUERY master1; DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result index de44a1e5d2a..b31a6d399e2 100644 --- a/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result +++ b/mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS mysqltest; CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int); CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int); @@ -25,3 +21,4 @@ master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS ` ) master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`tmp2` (`c1`) SELECT * FROM tmp master-bin.000001 # Query # # COMMIT +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_cross_version.result b/mysql-test/suite/rpl/r/rpl_cross_version.result index de5dd134516..ddb97ffa8c5 100644 --- a/mysql-test/suite/rpl/r/rpl_cross_version.result +++ b/mysql-test/suite/rpl/r/rpl_cross_version.result @@ -1,12 +1,19 @@ +include/master-slave.inc +[connection master] ==== Initialize ==== +include/stop_slave.inc +RESET SLAVE; +include/setup_fake_relay_log.inc Setting up fake replication from MYSQL_TEST_DIR/suite/binlog/std_data/binlog_old_version_4_1.000001 ==== Test ==== start slave sql_thread; +include/wait_for_slave_param.inc [Exec_Master_Log_Pos] ==== a prove that the fake has been processed successfully ==== SELECT COUNT(*) - 17920 as zero FROM t3; zero 0 ==== Clean up ==== -stop slave sql_thread; -Cleaning up after setup_fake_relay_log.inc +include/stop_slave_sql.inc +include/cleanup_fake_relay_log.inc drop table t1, t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_current_user.result b/mysql-test/suite/rpl/r/rpl_current_user.result index 85490c2571c..7d8fc4e492e 100644 --- a/mysql-test/suite/rpl/r/rpl_current_user.result +++ b/mysql-test/suite/rpl/r/rpl_current_user.result @@ -1,25 +1,6 @@ -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 slave2 -# Connect slave2 to slave -CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_MYPORT;, -MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; -START SLAVE; - -# [On master] -DROP VIEW IF EXISTS v_user; -DROP VIEW IF EXISTS v_tables_priv; -DROP VIEW IF EXISTS v_procs_priv; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS my_grant; -DROP PROCEDURE IF EXISTS my_revoke; -DROP FUNCTION IF EXISTS my_user; -DROP EVENT IF EXISTS e1; +include/rpl_init.inc [topology=1->2->3] +include/rpl_connect.inc [creating master] +include/rpl_connect.inc [creating slave] CREATE TABLE t1(c1 char(100)); CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; @@ -41,76 +22,76 @@ ERROR HY000: String '01234567890123456789012345678901234567890123456789012345678 # [On conn1] # Verify 'REVOKE ALL' statement REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user] # Verify 'GRANT ... ON TABLE ...' statement GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv] # Verify 'GRANT ... ON PROCEDURE...' statement GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); -Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv -Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv] # Verify 'GRANT ... ON *.* ...' statement GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; -Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv -Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv] # Verify 'REVOKE ... ON TABLE ...' statement REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv] # Verify 'REVOKE ... ON PROCEDURE...' statement REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); -Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv -Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv] # Verify 'REVOKE ... ON *.* ...' statement REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user] # Verify 'GRANT ...' statement in the procedure CREATE PROCEDURE my_grant() GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); call my_grant; -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv] # Verify 'REVOKE ... ON TABLE ...' statement in the procedure CREATE PROCEDURE my_revoke() REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); call my_revoke; -Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv -Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv] # Verify 'RENAME USER ...' statement RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user] # Verify 'DROP USER ...' statement GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; DROP USER CURRENT_USER(); -Comparing tables master:test.v_user and slave:test.v_user -Comparing tables master:test.v_user and slave2:test.v_user +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user] # Verify 'ALTER EVENT...' statement CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; # Explicitly assign CURRENT_USER() to definer ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; -Comparing tables master:test.v_event and slave:test.v_event -Comparing tables master:test.v_event and slave2:test.v_event +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_event, server_2:v_event, server_3:v_event] # Session user will be set as definer, if the statement does not assign # a definer ALTER EVENT e1 ENABLE; -Comparing tables master:test.v_event and slave:test.v_event -Comparing tables master:test.v_event and slave2:test.v_event +include/rpl_sync.inc +include/diff_tables.inc [server_1:v_event, server_2:v_event, server_3:v_event] # Verify that this patch does not affect the calling of CURRENT_USER() # in the other statements @@ -127,7 +108,7 @@ SELECT * FROM t1; c1 @ 1234 -# [On slave2] +# [On server_3] SELECT * FROM t1; c1 @ @@ -145,7 +126,7 @@ SELECT * FROM t1; c1 @ @ -# [On slave2] +# [On server_3] SELECT * FROM t1; c1 @ @@ -159,7 +140,7 @@ c1 # [On slave] SELECT * FROM t1; c1 -# [On slave2] +# [On server_3] SELECT * FROM t1; c1 # [On master] @@ -187,7 +168,7 @@ c1 SELECT * FROM t2; c1 @ -# [On slave2] +# [On server_3] SELECT * FROM t1; c1 @ @@ -203,3 +184,4 @@ DROP PROCEDURE my_grant; DROP PROCEDURE my_revoke; DROP FUNCTION my_user; DROP EVENT e1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ddl.result b/mysql-test/suite/rpl/r/rpl_ddl.result index af6b33966e9..e4f769a4c78 100644 --- a/mysql-test/suite/rpl/r/rpl_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_ddl.result @@ -1,15 +1,8 @@ -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; +include/master-slave.inc +[connection master] -------- switch to master ------- SET AUTOCOMMIT = 1; -DROP DATABASE IF EXISTS mysqltest1; -DROP DATABASE IF EXISTS mysqltest2; -DROP DATABASE IF EXISTS mysqltest3; CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest2; CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=InnoDB; @@ -1626,3 +1619,4 @@ use test; -------- switch to master ------- DROP DATABASE mysqltest1; DROP DATABASE mysqltest3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result index 1485389204b..c399b408d5c 100644 --- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] *** Prepare tables and data *** CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=innodb; CREATE TABLE t2 (a INT) ENGINE=innodb; @@ -50,7 +46,7 @@ a SELECT * FROM t3; a 3 -Checking that both slave threads are running. +include/check_slave_is_running.inc *** Test lock wait timeout *** include/stop_slave.inc @@ -61,6 +57,7 @@ SELECT * FROM t1 FOR UPDATE; a 1 START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1205] SELECT COUNT(*) FROM t2; COUNT(*) 0 @@ -74,7 +71,7 @@ SELECT * FROM t3; a 3 3 -Checking that both slave threads are running. +include/check_slave_is_running.inc *** Test lock wait timeout and purged relay logs *** SET @my_max_relay_log_size= @@global.max_relay_log_size; @@ -88,6 +85,7 @@ a 1 1 START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1205] SELECT COUNT(*) FROM t2; COUNT(*) 0 @@ -103,9 +101,10 @@ a 3 3 3 -Checking that both slave threads are running. +include/check_slave_is_running.inc *** Clean up *** DROP TABLE t1,t2,t3; SET global max_relay_log_size= @my_max_relay_log_size; End of 5.1 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_delete_no_where.result b/mysql-test/suite/rpl/r/rpl_delete_no_where.result index 78edf4bf3fa..923cd428aec 100644 --- a/mysql-test/suite/rpl/r/rpl_delete_no_where.result +++ b/mysql-test/suite/rpl/r/rpl_delete_no_where.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int, b int) engine=myisam; insert into t1 values(1,1); select * from t1; @@ -13,3 +9,4 @@ delete from t1; select * from t1; a b drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result index 74f61125735..52bcb90f357 100644 --- a/mysql-test/suite/rpl/r/rpl_do_grant.result +++ b/mysql-test/suite/rpl/r/rpl_do_grant.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] delete from mysql.user where user=_binary'rpl_do_grant'; delete from mysql.db where user=_binary'rpl_do_grant'; flush privileges; @@ -167,21 +163,13 @@ DROP FUNCTION bug42217_db.upgrade_del_func; DROP FUNCTION bug42217_db.upgrade_alter_func; DROP DATABASE bug42217_db; stop slave; +SET SQL_LOG_BIN= 0; DROP USER 'create_rout_db'@'localhost'; -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; +SET SQL_LOG_BIN= 1; +include/rpl_reset.inc +USE test; ######## BUG#49119 ####### ### i) test case from the 'how to repeat section' -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; CREATE TABLE t1(c1 INT); CREATE PROCEDURE p1() SELECT * FROM t1 | REVOKE EXECUTE ON PROCEDURE p1 FROM 'root'@'localhost'; @@ -189,12 +177,7 @@ ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' DROP TABLE t1; DROP PROCEDURE p1; ### ii) Test case in which REVOKE partially succeeds -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; +include/rpl_reset.inc CREATE TABLE t1(c1 INT); CREATE PROCEDURE p1() SELECT * FROM t1 | CREATE USER 'user49119'@'localhost'; @@ -247,12 +230,7 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION DROP TABLE t1; DROP PROCEDURE p1; DROP USER 'user49119'@'localhost'; -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; +include/rpl_reset.inc grant all on *.* to foo@"1.2.3.4"; revoke all privileges, grant option from "foo"; ERROR HY000: Can't revoke all privileges for one or more of the requested users @@ -260,15 +238,11 @@ show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; grant all on *.* to foo@"1.2.3.4" master-bin.000001 # Query # # use `test`; revoke all privileges, grant option from "foo" +include/check_slave_no_error.inc DROP USER foo@"1.2.3.4"; # Bug#27606 GRANT statement should be replicated with DEFINER information -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; +include/rpl_reset.inc GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost; SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; Grantor @@ -285,3 +259,4 @@ Grantor root@localhost DROP USER user_bug27606@localhost; "End of test" +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_drop.result b/mysql-test/suite/rpl/r/rpl_drop.result index 5ebbc4f9ce7..a32d3fd5fc7 100644 --- a/mysql-test/suite/rpl/r/rpl_drop.result +++ b/mysql-test/suite/rpl/r/rpl_drop.result @@ -1,10 +1,5 @@ -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; -drop table if exists t1, t2; +include/master-slave.inc +[connection master] create table t1 (a int); drop table t1, t2; ERROR 42S02: Unknown table 't2' @@ -32,3 +27,4 @@ DROP FUNCTION f1; DROP TABLE t2, t3; SET @@global.binlog_format= @old_binlog_format; SET @@global.binlog_format= @old_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_drop_db.result b/mysql-test/suite/rpl/r/rpl_drop_db.result index 8825797f80d..8a88f01a444 100644 --- a/mysql-test/suite/rpl/r/rpl_drop_db.result +++ b/mysql-test/suite/rpl/r/rpl_drop_db.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1; create table mysqltest1.t1 (n int); @@ -34,4 +30,4 @@ n use test; drop table t1; drop database mysqltest1; -include/stop_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_drop_if_exists.result b/mysql-test/suite/rpl/r/rpl_drop_if_exists.result deleted file mode 100644 index e2d4c727c98..00000000000 --- a/mysql-test/suite/rpl/r/rpl_drop_if_exists.result +++ /dev/null @@ -1,98 +0,0 @@ -RESET MASTER; -DROP PROCEDURE IF EXISTS db_bug_13684.p; -DROP FUNCTION IF EXISTS db_bug_13684.f; -DROP TRIGGER IF EXISTS db_bug_13684.tr; -DROP VIEW IF EXISTS db_bug_13684.v; -DROP EVENT IF EXISTS db_bug_13684.e; -DROP TABLE IF EXISTS db_bug_13684.t; -DROP DATABASE IF EXISTS db_bug_13684; -show binlog events from <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p -master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f -master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr -master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v -master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t -master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684 -CREATE DATABASE db_bug_13684; -CREATE TABLE db_bug_13684.t (a int); -CREATE EVENT db_bug_13684.e -ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR -DO -UPDATE db_bug_13684.t SET a = a + 1; -CREATE VIEW db_bug_13684.v -AS SELECT * FROM db_bug_13684.t; -CREATE TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t -FOR EACH ROW BEGIN -END; -CREATE PROCEDURE db_bug_13684.p (OUT p1 INT) -BEGIN -END; -CREATE FUNCTION db_bug_13684.f (s CHAR(20)) -RETURNS CHAR(50) DETERMINISTIC -RETURN s; -show binlog events from <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p -master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f -master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr -master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v -master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t -master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684 -master-bin.000001 # Query # # CREATE DATABASE db_bug_13684 -master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int) -master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e -ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR -DO -UPDATE db_bug_13684.t SET a = a + 1 -master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db_bug_13684`.`v` AS SELECT * FROM db_bug_13684.t -master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t -FOR EACH ROW BEGIN -END -master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `db_bug_13684`.`p`(OUT p1 INT) -BEGIN -END -master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db_bug_13684`.`f`(s CHAR(20)) RETURNS char(50) CHARSET latin1 - DETERMINISTIC -RETURN s -DROP PROCEDURE IF EXISTS db_bug_13684.p; -DROP FUNCTION IF EXISTS db_bug_13684.f; -DROP TRIGGER IF EXISTS db_bug_13684.tr; -DROP VIEW IF EXISTS db_bug_13684.v; -DROP EVENT IF EXISTS db_bug_13684.e; -DROP TABLE IF EXISTS db_bug_13684.t; -DROP DATABASE IF EXISTS db_bug_13684; -show binlog events from <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p -master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f -master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr -master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v -master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t -master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684 -master-bin.000001 # Query # # CREATE DATABASE db_bug_13684 -master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int) -master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e -ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR -DO -UPDATE db_bug_13684.t SET a = a + 1 -master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db_bug_13684`.`v` AS SELECT * FROM db_bug_13684.t -master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t -FOR EACH ROW BEGIN -END -master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `db_bug_13684`.`p`(OUT p1 INT) -BEGIN -END -master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db_bug_13684`.`f`(s CHAR(20)) RETURNS char(50) CHARSET latin1 - DETERMINISTIC -RETURN s -master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p -master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f -master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr -master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v -master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS db_bug_13684.t -master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684 diff --git a/mysql-test/suite/rpl/r/rpl_drop_temp.result b/mysql-test/suite/rpl/r/rpl_drop_temp.result index 03fbaa2256f..4aa0ba0bc0d 100644 --- a/mysql-test/suite/rpl/r/rpl_drop_temp.result +++ b/mysql-test/suite/rpl/r/rpl_drop_temp.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create database if not exists mysqltest; use mysqltest; create temporary table mysqltest.t1 (n int)ENGINE=MyISAM; @@ -26,3 +22,4 @@ CREATE TEMPORARY TABLE tmp3 (a int); DROP TEMPORARY TABLE tmp3; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_drop_view.result b/mysql-test/suite/rpl/r/rpl_drop_view.result index c359011612a..0688ce42bc2 100644 --- a/mysql-test/suite/rpl/r/rpl_drop_view.result +++ b/mysql-test/suite/rpl/r/rpl_drop_view.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1, t2; drop view if exists v1, v2, v3, not_exist_view; create table t1 (a int); @@ -27,3 +23,4 @@ select * from v3; ERROR 42S02: Table 'test.v3' doesn't exist ==== clean up ==== drop table t1, t2, t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result index aa1a573d052..3a3bed1a6fd 100644 --- a/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result +++ b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result @@ -1,12 +1,4 @@ -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; -reset master; -change master to master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root"; -include/start_slave.inc +include/rpl_init.inc [topology=1->2->1] create table t1 (n int); include/stop_slave.inc create table t2 (n int); @@ -25,6 +17,7 @@ insert into t3 values(4); start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS; Warnings: Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart +include/wait_for_slave_sql_to_stop.inc show tables; Tables_in_test t1 @@ -32,12 +25,14 @@ t2 start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS; Warnings: Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart +include/wait_for_slave_sql_to_stop.inc select * from t3; n 1 start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS; Warnings: Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart +include/wait_for_slave_sql_to_stop.inc select * from t3; n 1 @@ -55,6 +50,5 @@ t3 t4 t5 t6 -include/stop_slave.inc -reset slave; -drop table t1,t2,t3,t4,t5,t6; +drop table t1, t2, t3, t4, t5, t6; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_empty_master_crash.result b/mysql-test/suite/rpl/r/rpl_empty_master_crash.result index f71411c68dd..34281bc33d7 100644 --- a/mysql-test/suite/rpl/r/rpl_empty_master_crash.result +++ b/mysql-test/suite/rpl/r/rpl_empty_master_crash.result @@ -1,10 +1,7 @@ -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; +include/master-slave.inc +[connection master] load table t1 from master; ERROR 08S01: Error connecting to master: Master is not configured load table t1 from master; ERROR HY000: Error from master: 'Table 'test.t1' doesn't exist' +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_err_ignoredtable.result b/mysql-test/suite/rpl/r/rpl_err_ignoredtable.result index 75fefdad2a2..6d00774ef87 100644 --- a/mysql-test/suite/rpl/r/rpl_err_ignoredtable.result +++ b/mysql-test/suite/rpl/r/rpl_err_ignoredtable.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression("Statement may not be safe to log in statement format."); create table t1 (a int primary key); create table t4 (a int primary key); @@ -41,3 +37,4 @@ a 3 4 DROP TABLE test.t4; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_events.result b/mysql-test/suite/rpl/r/rpl_events.result index b724d284bfa..30ba1bb3828 100644 --- a/mysql-test/suite/rpl/r/rpl_events.result +++ b/mysql-test/suite/rpl/r/rpl_events.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET @old_event_scheduler = @@global.event_scheduler; set global event_scheduler=1; set binlog_format=row; @@ -257,3 +253,4 @@ DROP EVENT event44331_1; DROP EVENT event44331_2; DROP EVENT event44331_3; DROP EVENT event44331_4; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result b/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result index e8535a0bc5e..affb179d50e 100644 --- a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set binlog_format=row; *********************************************************** @@ -91,7 +87,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -428,7 +424,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -464,10 +460,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t10 *** DROP TABLE t10; @@ -502,10 +496,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t11 *** DROP TABLE t11; @@ -616,7 +608,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -664,7 +657,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -712,7 +706,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -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)' +include/wait_for_slave_sql_error.inc [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)'' STOP SLAVE; RESET SLAVE; @@ -876,7 +871,6 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - set binlog_format=statement; *********************************************************** @@ -964,7 +958,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -1301,7 +1295,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -1337,10 +1331,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t10 *** DROP TABLE t10; @@ -1375,10 +1367,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t11 *** DROP TABLE t11; @@ -1489,7 +1479,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -1537,7 +1528,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -1585,7 +1577,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -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)' +include/wait_for_slave_sql_error.inc [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)'' STOP SLAVE; RESET SLAVE; @@ -1749,7 +1742,6 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - set binlog_format=mixed; *********************************************************** @@ -1837,7 +1829,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -2174,7 +2166,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -2210,10 +2202,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t10 *** DROP TABLE t10; @@ -2248,10 +2238,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t11 *** DROP TABLE t11; @@ -2362,7 +2350,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -2410,7 +2399,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -2458,7 +2448,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -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)' +include/wait_for_slave_sql_error.inc [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)'' STOP SLAVE; RESET SLAVE; @@ -2622,4 +2613,4 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result b/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result index f360a8847eb..8aeb5bdc1c9 100644 --- a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set binlog_format=row; *********************************************************** @@ -91,7 +87,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -428,7 +424,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -464,10 +460,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t10 *** DROP TABLE t10; @@ -502,10 +496,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t11 *** DROP TABLE t11; @@ -616,7 +608,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -664,7 +657,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -712,7 +706,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -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)' +include/wait_for_slave_sql_error.inc [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)'' STOP SLAVE; RESET SLAVE; @@ -876,7 +871,6 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - set binlog_format=statement; *********************************************************** @@ -964,7 +958,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -1301,7 +1295,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -1337,10 +1331,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t10 *** DROP TABLE t10; @@ -1375,10 +1367,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t11 *** DROP TABLE t11; @@ -1489,7 +1479,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -1537,7 +1528,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -1585,7 +1577,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -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)' +include/wait_for_slave_sql_error.inc [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)'' STOP SLAVE; RESET SLAVE; @@ -1749,7 +1742,6 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - set binlog_format=mixed; *********************************************************** @@ -1837,7 +1829,7 @@ f1 f2 f3 f4 27 27 27 next 29 29 29 second 30 30 30 next -Checking that both slave threads are running. +include/check_slave_is_running.inc ***** Testing Altering table def scenario ***** @@ -2174,7 +2166,7 @@ f1 f2 f3 f4 ** Check slave status ** -Checking that both slave threads are running. +include/check_slave_is_running.inc **************************************** * columns in master at middle of table * @@ -2210,10 +2202,8 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t10 *** DROP TABLE t10; @@ -2248,10 +2238,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t11 *** DROP TABLE t11; @@ -2362,7 +2350,8 @@ c1 c3 hex(c4) c5 c6 ************ * Bug30415 * ************ -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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -2410,7 +2399,8 @@ c1 hex(c4) c5 c6 c7 c2 *** Expect slave to fail with Error 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' +include/wait_for_slave_sql_error.inc [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'' STOP SLAVE; RESET SLAVE; @@ -2458,7 +2448,8 @@ c1 hex(c4) c5 c6 c7 *** BUG 30434 *** ***************** -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)' +include/wait_for_slave_sql_error.inc [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)'' STOP SLAVE; RESET SLAVE; @@ -2622,4 +2613,4 @@ c1 hex(c4) c5 2 6231623162316231 JOE 3 6231623162316231 QA DROP TABLE t5; - +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result index 48fd0366c26..9ea319379c0 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); **** Diff Table Def Start **** *** On Slave *** @@ -54,7 +50,8 @@ a b c 3 4 QA TESTING *** Start Slave *** START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' STOP SLAVE; RESET SLAVE; SELECT * FROM t2 ORDER BY a; @@ -83,10 +80,8 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t3 *** DROP TABLE t3; *** Create t4 on slave *** @@ -108,10 +103,8 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t4 *** DROP TABLE t4; *** Create t5 on slave *** @@ -133,10 +126,8 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t5 *** DROP TABLE t5; *** Create t6 on slave *** @@ -157,7 +148,8 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1), ******************************************** *** Expect slave to fail with Error 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 +include/wait_for_slave_sql_error.inc [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' SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; *** Drop t6 *** DROP TABLE t6; @@ -237,6 +229,7 @@ a b c d e f g h i 1 b1b1b1b1b1b1b1b1 Kyle 0000-00-00 00:00:00 0 NULL NULL 2 b1b1b1b1b1b1b1b1 JOE 0000-00-00 00:00:00 0 NULL NULL 3 b1b1b1b1b1b1b1b1 QA 0000-00-00 00:00:00 0 NULL NULL +DROP TABLE t9; *** Create t10 on slave *** STOP SLAVE; RESET SLAVE; @@ -255,10 +248,8 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t10 *** DROP TABLE t10; *** Create t11 on slave *** @@ -279,10 +270,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t11 *** DROP TABLE t11; *** Create t12 on slave *** @@ -439,6 +428,7 @@ c1 c4 c5 c6 c7 4 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP 5 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP 6 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP +DROP TABLE t14a; *** connect to master and drop columns *** ALTER TABLE t14 DROP COLUMN c2; ALTER TABLE t14 DROP COLUMN c4; @@ -492,10 +482,8 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5; ******************************************** *** Expect slave to fail with Error 1060 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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'' *** Try to insert in master **** INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2); SELECT * FROM t15 ORDER BY c1; @@ -595,9 +583,8 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' ** DROP table t17 *** DROP TABLE t17; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result index 80b18ee4bd7..716a35b3464 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); **** Diff Table Def Start **** *** On Slave *** @@ -54,7 +50,8 @@ a b c 3 4 QA TESTING *** Start Slave *** START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' STOP SLAVE; RESET SLAVE; SELECT * FROM t2 ORDER BY a; @@ -83,10 +80,8 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t3 *** DROP TABLE t3; *** Create t4 on slave *** @@ -108,10 +103,8 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t4 *** DROP TABLE t4; *** Create t5 on slave *** @@ -133,10 +126,8 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098), ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t5 *** DROP TABLE t5; *** Create t6 on slave *** @@ -157,7 +148,8 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1), ******************************************** *** Expect slave to fail with Error 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 +include/wait_for_slave_sql_error.inc [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' SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; *** Drop t6 *** DROP TABLE t6; @@ -237,6 +229,7 @@ a b c d e f g h i 1 b1b1b1b1b1b1b1b1 Kyle 0000-00-00 00:00:00 0 NULL NULL 2 b1b1b1b1b1b1b1b1 JOE 0000-00-00 00:00:00 0 NULL NULL 3 b1b1b1b1b1b1b1b1 QA 0000-00-00 00:00:00 0 NULL NULL +DROP TABLE t9; *** Create t10 on slave *** STOP SLAVE; RESET SLAVE; @@ -255,10 +248,8 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t10 *** DROP TABLE t10; *** Create t11 on slave *** @@ -279,10 +270,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' *** Drop t11 *** DROP TABLE t11; *** Create t12 on slave *** @@ -439,6 +428,7 @@ c1 c4 c5 c6 c7 4 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP 5 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP 6 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP +DROP TABLE t14a; *** connect to master and drop columns *** ALTER TABLE t14 DROP COLUMN c2; ALTER TABLE t14 DROP COLUMN c4; @@ -492,10 +482,8 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5; ******************************************** *** Expect slave to fail with Error 1060 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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'' *** Try to insert in master **** INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2); SELECT * FROM t15 ORDER BY c1; @@ -595,9 +583,8 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX'); ******************************************** *** Expect slave to fail with Error 1535 *** ******************************************** ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [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' ** DROP table t17 *** DROP TABLE t17; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_failed_optimize.result b/mysql-test/suite/rpl/r/rpl_failed_optimize.result index 7210898d521..b0c331fa557 100644 --- a/mysql-test/suite/rpl/r/rpl_failed_optimize.result +++ b/mysql-test/suite/rpl/r/rpl_failed_optimize.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 ( a int ) ENGINE=InnoDB; BEGIN; INSERT INTO t1 VALUES (1); @@ -23,3 +19,4 @@ a 1 commit; drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result index 5f1f72a9a3a..4eaf61e5f9e 100644 --- a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result +++ b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (id int, a int); CREATE TABLE t2 (id int, b int); CREATE TABLE t3 (id int, c int); @@ -47,85 +43,53 @@ UPDATE t4 LEFT JOIN (t1, t6, t7) ON (t4.id=t1.id and t4.id=t6.id and t4.id=t7.id UPDATE t7 LEFT JOIN (t4, t1, t2) ON (t7.id=t4.id and t7.id=t1.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1; UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id) SET a=0, d=0, g=0, h=0 where t7.id=1; UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1'' UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1'' UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1'' UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1'' UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1'' UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1'' UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1'' UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1'' UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1'' UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1'' UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1' -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1146] +Last_SQL_Error = 'Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1'' [on slave] show tables like 't%'; Tables_in_test (t%) @@ -149,3 +113,4 @@ id c 3 3 [on master] drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result index 3bb96b669d7..26b7640ccbc 100644 --- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result +++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result @@ -1,27 +1,15 @@ -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; +include/rpl_init.inc [topology=1->2->1] show variables like 'relay_log%'; Variable_name Value -relay_log MYSQLD_DATADIR/relay-log +relay_log master-relay-bin relay_log_index relay_log_info_file relay-log.info relay_log_purge ON relay_log_space_limit 0 -stop slave; -change master to master_host='127.0.0.1',master_user='root', -master_password='',master_port=MASTER_PORT; -start slave; -stop slave; -change master to master_host='127.0.0.1',master_user='root', -master_password='',master_port=SLAVE_PORT; -include/start_slave.inc CREATE TABLE t1 (a INT KEY) ENGINE= MyISAM; INSERT INTO t1 VALUE(1); FLUSH LOGS; INSERT INTO t1 VALUE(2); -Checking that both slave threads are running. -Relay_Log_File relay-log.000003 +include/check_slave_is_running.inc +Relay_Log_File = 'master-relay-bin.000003' +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result b/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result index e7a912b75fa..038a29c12e2 100644 --- a/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT AUTO_INCREMENT KEY) ENGINE=INNODB; CREATE TABLE t2 (b INT AUTO_INCREMENT KEY, c INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=INNODB; SET FOREIGN_KEY_CHECKS=0; @@ -53,3 +49,4 @@ select count(*) from t1 /* must be zero */; count(*) 0 drop table t2,t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_found_rows.result b/mysql-test/suite/rpl/r/rpl_found_rows.result index 45a931872cf..f1f8cc6d32d 100644 --- a/mysql-test/suite/rpl/r/rpl_found_rows.result +++ b/mysql-test/suite/rpl/r/rpl_found_rows.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== 0. Setting it all up ==== SET BINLOG_FORMAT=STATEMENT; **** On Master **** @@ -102,11 +98,7 @@ DELETE FROM logtbl; DROP PROCEDURE just_log; DROP PROCEDURE calc_and_log; DROP FUNCTION log_rows; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc #### 2. Using mixed mode #### ==== 2.1. Checking a procedure ==== **** On Master **** @@ -231,3 +223,4 @@ DROP PROCEDURE just_log; DROP PROCEDURE log_me; DROP PROCEDURE log_me_inner; DROP FUNCTION log_rows; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_free_items.result b/mysql-test/suite/rpl/r/rpl_free_items.result index 91c1e2aa6e5..416f597aebc 100644 --- a/mysql-test/suite/rpl/r/rpl_free_items.result +++ b/mysql-test/suite/rpl/r/rpl_free_items.result @@ -1,10 +1,7 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int); create table t2 (a int); drop table t1; drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_geometry.result b/mysql-test/suite/rpl/r/rpl_geometry.result index 9b48dba4f22..7ec119c9ae8 100644 --- a/mysql-test/suite/rpl/r/rpl_geometry.result +++ b/mysql-test/suite/rpl/r/rpl_geometry.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a varchar(100), b multipoint not null, c varchar(256)); @@ -16,3 +12,4 @@ b geometrycollection default null, c decimal(10,0)); insert into t2(c) values (null); drop table t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_get_lock.result b/mysql-test/suite/rpl/r/rpl_get_lock.result index cbad759b17f..8250ca348e6 100644 --- a/mysql-test/suite/rpl/r/rpl_get_lock.result +++ b/mysql-test/suite/rpl/r/rpl_get_lock.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression("Statement may not be safe to log in statement format."); create table t1(n int); insert into t1 values(get_lock("lock",2)); @@ -34,3 +30,4 @@ select is_free_lock(NULL); is_free_lock(NULL) NULL drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result index 432bcfcc94d..32d24e5867a 100644 --- a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result +++ b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result @@ -1,33 +1,32 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*"); call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*"); call mtr.add_suppression("Slave I/O thread .* register on master"); -stop slave; +include/stop_slave.inc SET @@global.debug= "+d,'debug_lock.before_get_UNIX_TIMESTAMP'"; -start slave; +include/start_slave.inc slave is going to hang in get_master_version_and_clock +include/rpl_stop_server.inc [server_number=1] slave is unblocked SET DEBUG_SYNC='now SIGNAL signal.get_unix_timestamp'; Check network error happened here +include/wait_for_slave_io_error.inc [errno=1040, 1053, 2002, 2003, 2006, 2013] set @@global.debug = "-d,'debug_lock.before_get_UNIX_TIMESTAMP'"; -stop slave; +include/rpl_start_server.inc [server_number=1] +include/wait_for_slave_param.inc [Slave_IO_Running] +include/stop_slave.inc SET @@global.debug= "+d,'debug_lock.before_get_SERVER_ID'"; -start slave; +include/start_slave.inc slave is going to hang in get_master_version_and_clock +include/rpl_stop_server.inc [server_number=1] slave is unblocked SET DEBUG_SYNC='now SIGNAL signal.get_server_id'; Check network error happened here +include/wait_for_slave_io_error.inc [errno=1040, 1053, 2002, 2003, 2006, 2013] set @@global.debug = "-d,'debug_lock.before_get_SERVER_ID'"; +include/rpl_start_server.inc [server_number=1] +include/wait_for_slave_param.inc [Slave_IO_Running] set global debug= ''; -reset master; -include/stop_slave.inc -change master to master_port=SLAVE_PORT; -start slave; -*** must be having the replicate-same-server-id IO thread error *** -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). SET DEBUG_SYNC= 'RESET'; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_grant.result b/mysql-test/suite/rpl/r/rpl_grant.result index 285d52b7678..4ec8c51a5dc 100644 --- a/mysql-test/suite/rpl/r/rpl_grant.result +++ b/mysql-test/suite/rpl/r/rpl_grant.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] **** On Master **** CREATE USER dummy@localhost; CREATE USER dummy1@localhost, dummy2@localhost; @@ -41,3 +37,4 @@ user host SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%'; COUNT(*) 0 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result index bfdcbc6fa23..e25d5f81c91 100644 --- a/mysql-test/suite/rpl/r/rpl_idempotency.result +++ b/mysql-test/suite/rpl/r/rpl_idempotency.result @@ -1,10 +1,7 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave: Can't find record in 't.' Error_code: 1032"); +call mtr.add_suppression("Can't find record in 't.'"); call mtr.add_suppression("Slave: Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451"); call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); SET @old_slave_exec_mode= @@global.slave_exec_mode; @@ -32,8 +29,7 @@ SELECT * FROM t2 ORDER BY a; a -3 -1 -Last_SQL_Error -0 +include/check_slave_no_error.inc INSERT IGNORE INTO t1 VALUES (-2); INSERT IGNORE INTO t1 VALUES (-2); SELECT * FROM t1 ORDER BY a; @@ -46,8 +42,7 @@ a -3 -2 -1 -Last_SQL_Error -0 +include/check_slave_no_error.inc UPDATE t1 SET a = 1 WHERE a = -1; UPDATE t2 SET a = 1 WHERE a = -1; UPDATE t1 SET a = 1 WHERE a = -1; @@ -70,8 +65,7 @@ SELECT * FROM t2 ORDER BY a; a -3 1 -Last_SQL_Error -0 +include/check_slave_no_error.inc DROP TABLE t1, t2; select @@global.slave_exec_mode /* must be IDEMPOTENT */; @@global.slave_exec_mode @@ -143,8 +137,7 @@ b 2 3 *** slave must stop (Trying to delete a referenced foreing key) -Last_SQL_Error -1451 +include/wait_for_slave_sql_error.inc [errno=1451] select * from ti1 order by b /* must be (1),(2),(3) - not deleted */; b 1 @@ -161,8 +154,7 @@ set global slave_exec_mode='STRICT'; delete from ti1 where b=3; insert into ti2 set a=3, b=3 /* offending write event */; *** slave must stop (Trying to insert an invalid foreign key) -Last_SQL_Error -1452 +include/wait_for_slave_sql_error.inc [errno=1452] select * from ti2 order by b /* must be (2,2) */; a b 2 2 @@ -181,8 +173,7 @@ a b insert into ti1 set b=1; insert into ti1 set b=1 /* offending write event */; *** slave must stop (Trying to insert a dupliacte key) -Last_SQL_Error -1062 +include/wait_for_slave_sql_error.inc [errno=1062] set foreign_key_checks= 0; delete from ti1 where b=1; set foreign_key_checks= 1; @@ -197,15 +188,13 @@ DELETE FROM t1 WHERE a = -2; DELETE FROM t2 WHERE a = -2; DELETE FROM t1 WHERE a = -2; *** slave must stop (Key was not found) -Last_SQL_Error -1032 +include/wait_for_slave_sql_error.inc [errno=1032] set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; set global slave_exec_mode='STRICT'; DELETE FROM t2 WHERE a = -2; *** slave must stop (Key was not found) -Last_SQL_Error -1032 +include/wait_for_slave_sql_error.inc [errno=1032] set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; set global slave_exec_mode='STRICT'; @@ -213,18 +202,17 @@ UPDATE t1 SET a = 1 WHERE a = -1; UPDATE t2 SET a = 1 WHERE a = -1; UPDATE t1 SET a = 1 WHERE a = -1; *** slave must stop (Key was not found) -Last_SQL_Error -1032 +include/wait_for_slave_sql_error.inc [errno=1032] set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; set global slave_exec_mode='STRICT'; UPDATE t2 SET a = 1 WHERE a = -1; *** slave must stop (Key was not found) -Last_SQL_Error -1032 +include/wait_for_slave_sql_error.inc [errno=1032] set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; SET @@global.slave_exec_mode= @old_slave_exec_mode; set @@session.binlog_format= @save_binlog_format; drop table t1,t2,ti2,ti1; +include/rpl_end.inc *** end of tests diff --git a/mysql-test/suite/rpl/r/rpl_ignore_grant.result b/mysql-test/suite/rpl/r/rpl_ignore_grant.result index 5169cc8e888..ae6d6ddfc8d 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_grant.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_grant.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; @@ -35,3 +31,4 @@ flush privileges; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ignore_revoke.result b/mysql-test/suite/rpl/r/rpl_ignore_revoke.result index b1ccd2f0442..84e1a3b40c7 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_revoke.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_revoke.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] grant select on *.* to 'user_foo'@'%' identified by 'user_foopass'; revoke select on *.* from 'user_foo'@'%'; select select_priv from mysql.user where user='user_foo' /* master:must be N */; @@ -28,3 +24,4 @@ Y revoke select on *.* FROM 'user_foo'; delete from mysql.user where user="user_foo"; delete from mysql.user where user="user_foo"; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result index d06dda66267..374053f322a 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_table.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result @@ -1,9 +1,8 @@ -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; +include/master-slave.inc +[connection master] +call mtr.add_suppression("Can't find record in 't.'"); +call mtr.add_suppression("Can't find record in 'user'"); +call mtr.add_suppression("Can't find record in 'tables_priv'"); **** Test case for BUG#16487 **** **** Master **** CREATE TABLE test.t4 (a int); @@ -142,3 +141,4 @@ HEX(word) SELECT * FROM tmptbl504451f4258$1; ERROR 42S02: Table 'test.tmptbl504451f4258$1' doesn't exist DROP TABLE t5; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table_update.result b/mysql-test/suite/rpl/r/rpl_ignore_table_update.result index a88a3c690ed..c3882d0b98f 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_table_update.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_table_update.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] use test; drop table if exists mysqltest_foo; drop table if exists mysqltest_bar; @@ -21,3 +17,4 @@ n m k 4 15 55 drop table mysqltest_foo,mysqltest_bar,t1; drop table mysqltest_foo,mysqltest_bar,t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result index 6c226aaf2f7..b54d7d400f7 100644 --- a/mysql-test/suite/rpl/r/rpl_incident.result +++ b/mysql-test/suite/rpl/r/rpl_incident.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] **** On Master **** CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3); @@ -19,7 +15,8 @@ a 2 3 4 -Last_SQL_Error = The incident LOST_EVENTS occured on the master. Message: <none> +include/wait_for_slave_sql_error.inc [errno=1590] +Last_SQL_Error = 'The incident LOST_EVENTS occured on the master. Message: <none>' **** On Slave **** SELECT * FROM t1; a @@ -34,5 +31,6 @@ a 2 3 4 -Checking that both slave threads are running. +include/check_slave_is_running.inc DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_init_slave.result b/mysql-test/suite/rpl/r/rpl_init_slave.result index 908abf56c1f..fcf7114879c 100644 --- a/mysql-test/suite/rpl/r/rpl_init_slave.result +++ b/mysql-test/suite/rpl/r/rpl_init_slave.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set global max_connections=151; include/stop_slave.inc include/start_slave.inc @@ -25,6 +21,6 @@ set global init_connect="set @c=1"; show variables like 'init_connect'; Variable_name Value init_connect set @c=1 -include/stop_slave.inc set global init_connect= @my_global_init_connect; set global max_connections= default; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result index c6ee82b13f3..46bc66cbb65 100644 --- a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result +++ b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result @@ -1,19 +1,19 @@ -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; +include/master-slave.inc +[connection master] stop slave; reset slave; SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; -Reporting the following error: Failed during slave thread initialization +include/wait_for_slave_sql_error.inc [errno=1593] +Last_SQL_Error = 'Failed during slave thread initialization' call mtr.add_suppression("Failed during slave I/O thread initialization"); SET GLOBAL debug= ""; -stop slave; reset slave; SET GLOBAL init_slave= "garbage"; start slave; -Reporting the following error: Slave SQL thread aborted. Can't execute init_slave query +include/wait_for_slave_sql_error.inc [errno=1064] +Last_SQL_Error = 'Slave SQL thread aborted. Can't execute init_slave query' SET GLOBAL init_slave= ""; +include/stop_slave_io.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_innodb.result b/mysql-test/suite/rpl/r/rpl_innodb.result index bf6c3cb8c86..fe3feba10e1 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t4 ( id INT(5) unsigned NOT NULL auto_increment, name varchar(15) NOT NULL default '', @@ -81,4 +77,5 @@ FLUSH LOGS; -------- switch to master -------- FLUSH LOGS; DROP DATABASE mysqltest1; +include/rpl_end.inc End of 5.1 tests diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result index 6ad22c368b4..f8734b48295 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] use test; CREATE TABLE test.regular_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT, dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, @@ -140,3 +136,4 @@ DROP PROCEDURE test.proc_byrange; DROP TABLE test.regular_tbl; DROP TABLE test.bykey_tbl; DROP TABLE test.byrange_tbl; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result b/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result index abff02b4b07..d06e6681e81 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] use test; CREATE TABLE test.regular_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT, dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, @@ -33,3 +29,4 @@ END| CALL test.proc_norm(); DROP PROCEDURE test.proc_norm; DROP TABLE test.regular_tbl; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result index 549842198e8..36294a4333b 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==========MASTER========== show global variables like 'binlog_format%'; Variable_name Value @@ -157,3 +153,4 @@ master-bin.000001 # Query # # use `test_rpl`; CREATE INDEX index2 on t2 (d) master-bin.000001 # Query # # use `test_rpl`; CREATE INDEX index3 on t2 (a, d) master-bin.000001 # Query # # use `test_rpl`; ALTER TABLE t2 DROP COLUMN d drop database test_rpl; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index d076a24e1f0..acecb7a88be 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==========MASTER========== show global variables like 'binlog_format%'; Variable_name Value @@ -1104,3 +1100,4 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2 master-bin.000001 # Xid # # COMMIT /* XID */ drop database test_rpl; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_insert.result b/mysql-test/suite/rpl/r/rpl_insert.result index 6080d18c5aa..b8e5bfad5d5 100644 --- a/mysql-test/suite/rpl/r/rpl_insert.result +++ b/mysql-test/suite/rpl/r/rpl_insert.result @@ -1,12 +1,8 @@ # # Bug#20821: INSERT DELAYED fails to write some rows to binlog # -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; +include/master-slave.inc +[connection master] CREATE SCHEMA IF NOT EXISTS mysqlslap; USE mysqlslap; CREATE TABLE t1 (id INT, name VARCHAR(64)) ENGINE=MyISAM; @@ -21,3 +17,4 @@ COUNT(*) # USE test; DROP SCHEMA mysqlslap; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_insert_id.result b/mysql-test/suite/rpl/r/rpl_insert_id.result index e171e247b6c..7ac951576ce 100644 --- a/mysql-test/suite/rpl/r/rpl_insert_id.result +++ b/mysql-test/suite/rpl/r/rpl_insert_id.result @@ -2,19 +2,14 @@ # Setup # use test; -drop table if exists t1, t2, t3; # # See if queries that use both auto_increment and LAST_INSERT_ID() # are replicated well # # We also check how the foreign_key_check variable is replicated # -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; +include/master-slave.inc +[connection master] SET @old_concurrent_insert= @@global.concurrent_insert; SET @@global.concurrent_insert= 0; create table t1(a int auto_increment, key(a)) engine=myisam; @@ -531,3 +526,4 @@ id last_id drop table t1, t2; drop procedure foo; SET @@global.concurrent_insert= @old_concurrent_insert; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_insert_id_pk.result b/mysql-test/suite/rpl/r/rpl_insert_id_pk.result index 79815355332..c2d6d2c9b0c 100644 --- a/mysql-test/suite/rpl/r/rpl_insert_id_pk.result +++ b/mysql-test/suite/rpl/r/rpl_insert_id_pk.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int auto_increment, primary key(a)); create table t2(b int auto_increment, c int, primary key(b)); insert into t1 values (1),(2),(3); @@ -74,3 +70,4 @@ SET FOREIGN_KEY_CHECKS=0; INSERT INTO t1 VALUES (1),(1); Got one of the listed errors drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_insert_ignore.result b/mysql-test/suite/rpl/r/rpl_insert_ignore.result index da24c86627c..6937c3d0987 100644 --- a/mysql-test/suite/rpl/r/rpl_insert_ignore.result +++ b/mysql-test/suite/rpl/r/rpl_insert_ignore.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned, @@ -68,3 +64,4 @@ a b 5 5 6 6 drop table t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_insert_select.result b/mysql-test/suite/rpl/r/rpl_insert_select.result index 1aff39e0026..d98ae2538fa 100644 --- a/mysql-test/suite/rpl/r/rpl_insert_select.result +++ b/mysql-test/suite/rpl/r/rpl_insert_select.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (n int not null primary key); insert into t1 values (1); create table t2 (n int); @@ -15,3 +11,4 @@ n 1 2 drop table t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_invoked_features.result b/mysql-test/suite/rpl/r/rpl_invoked_features.result index be9169c785b..514483e7995 100644 --- a/mysql-test/suite/rpl/r/rpl_invoked_features.result +++ b/mysql-test/suite/rpl/r/rpl_invoked_features.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] USE test; DROP VIEW IF EXISTS v1,v11; DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13; @@ -447,3 +443,4 @@ DROP FUNCTION IF EXISTS f1; DROP FUNCTION IF EXISTS f2; DROP EVENT IF EXISTS e1; DROP EVENT IF EXISTS e11; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_killed_ddl.result b/mysql-test/suite/rpl/r/rpl_killed_ddl.result index c3cde16b9d2..a02c9b599bf 100644 --- a/mysql-test/suite/rpl/r/rpl_killed_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_killed_ddl.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS d1; DROP DATABASE IF EXISTS d2; DROP DATABASE IF EXISTS d3; @@ -59,62 +55,62 @@ CREATE VIEW v1 AS SELECT a FROM t1 WHERE a < 100; [on master1] CREATE DATABASE d2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP DATABASE d1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP DATABASE IF EXISTS d2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE EVENT e2 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY DO INSERT INTO test.t1 VALUES (2); source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP EVENT e1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP EVENT IF EXISTS e2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE FUNCTION f2 () RETURNS INT DETERMINISTIC RETURN 1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc ALTER FUNCTION f1 SQL SECURITY INVOKER; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP FUNCTION f1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE PROCEDURE p2 (OUT rows INT) BEGIN SELECT COUNT(*) INTO rows FROM t2; END; // source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows of table t1'; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP PROCEDURE p1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE TABLE t2 (b int); source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc ALTER TABLE t1 ADD (d int); source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc RENAME TABLE t3 TO t4; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE INDEX i2 on t1 (a); source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP INDEX i1 on t1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE TABLE IF NOT EXISTS t4 (a int); CREATE TRIGGER tr2 BEFORE INSERT ON t4 FOR EACH ROW BEGIN @@ -122,28 +118,28 @@ DELETE FROM t1 WHERE a=NEW.a; END; // source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP TRIGGER tr1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP TRIGGER IF EXISTS tr2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc CREATE VIEW v2 AS SELECT a FROM t1 WHERE a > 100; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP VIEW v1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP VIEW IF EXISTS v2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP TABLE t1; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP TABLE IF EXISTS t2; source include/kill_query.inc; -source include/diff_master_slave.inc; +include/rpl_diff.inc DROP DATABASE IF EXISTS d1; DROP DATABASE IF EXISTS d2; DROP DATABASE IF EXISTS d3; @@ -168,3 +164,4 @@ DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p2; DROP PROCEDURE IF EXISTS p3; DROP PROCEDURE IF EXISTS p4; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result index daefee9c669..52980e81523 100644 --- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result +++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT, UNIQUE(b)); INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10; @@ -11,7 +7,8 @@ SELECT * FROM t1; a b 1 10 2 2 -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' +include/wait_for_slave_sql_error.inc [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'' SELECT * FROM t1; a b stop slave; @@ -56,12 +53,16 @@ id field_1 field_2 field_3 4 4 d 4d 5 5 e 5e 6 6 f 6f -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 (field_1, field_2, field_3) +include/wait_for_slave_sql_error.inc [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 (field_1, field_2, field_3) SELECT t2.field_a, t2.field_b, t2.field_c FROM t2 ON DUPLICATE KEY UPDATE -t1.field_3 = t2.field_c' +t1.field_3 = t2.field_c'' SELECT * FROM t1; id field_1 field_2 field_3 drop table t1, t2; drop table t1, t2; +include/stop_slave_io.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_load_from_master.result b/mysql-test/suite/rpl/r/rpl_load_from_master.result index e1c2ecb35be..8ff9514d023 100644 --- a/mysql-test/suite/rpl/r/rpl_load_from_master.result +++ b/mysql-test/suite/rpl/r/rpl_load_from_master.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest; drop database if exists mysqltest2; drop database if exists mysqltest3; @@ -131,3 +127,4 @@ drop database mysqltest; drop database mysqltest2; drop database mysqltest2; drop database mysqltest3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result index 9d9a1d7d6cb..50bd11873f1 100644 --- a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result +++ b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] "******************** Test Requirment 1 *************" SET SQL_LOG_BIN=0,timestamp=200006; CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM; @@ -49,3 +45,4 @@ set SQL_LOG_BIN=1; drop table if exists t1,t2,t3; create table t1(n int); drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata.result b/mysql-test/suite/rpl/r/rpl_loaddata.result index 32ec2e624e2..bd8bc5093aa 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata.result @@ -1,10 +1,5 @@ -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; -reset master; +include/master-slave.inc +[connection master] select last_insert_id(); last_insert_id() 0 @@ -32,32 +27,27 @@ drop table t3; create table t1(a int, b int, unique(b)); insert into t1 values(1,10); load data infile '../../std_data/rpl_loaddata.dat' into table t1; -set global sql_slave_skip_counter=1; -start slave; -Last_SQL_Errno=0 -Last_SQL_Error - +include/wait_for_slave_sql_error_and_skip.inc [errno=1062] +include/check_slave_no_error.inc set sql_log_bin=0; delete from t1; set sql_log_bin=1; load data infile '../../std_data/rpl_loaddata.dat' into table t1; -stop slave; +include/wait_for_slave_sql_error.inc [errno=1062] +include/stop_slave_io.inc change master to master_user='test'; change master to master_user='root'; -Last_SQL_Errno=0 -Last_SQL_Error - +include/check_slave_no_error.inc set global sql_slave_skip_counter=1; start slave; set sql_log_bin=0; delete from t1; set sql_log_bin=1; load data infile '../../std_data/rpl_loaddata.dat' into table t1; +include/wait_for_slave_sql_error.inc [errno=1062] stop slave; reset slave; -Last_SQL_Errno=0 -Last_SQL_Error - +include/check_slave_no_error.inc reset master; create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), unique(day)) engine=MyISAM; @@ -80,18 +70,15 @@ load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; ERROR 23000: Duplicate entry '2003-03-22' for key 'day' +include/wait_for_slave_sql_to_stop.inc drop table t1, t2; +include/stop_slave_io.inc drop table t1, t2; CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1; ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY' DROP TABLE IF EXISTS t1; -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; +include/rpl_reset.inc drop database if exists b48297_db1; drop database if exists b42897_db2; create database b48297_db1; @@ -112,15 +99,10 @@ LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1; ### disconnect and switch back to master connection use b48297_db1; -Comparing tables master:b48297_db1.t1 and slave:b48297_db1.t1 +include/diff_tables.inc [master:b48297_db1.t1, slave:b48297_db1.t1] DROP DATABASE b48297_db1; DROP DATABASE b42897_db2; -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; +include/rpl_reset.inc use test; CREATE TABLE t1 (`key` TEXT, `text` TEXT); LOAD DATA INFILE '../../std_data/loaddata2.dat' REPLACE INTO TABLE `t1` FIELDS TERMINATED BY ','; @@ -132,3 +114,4 @@ Field 3 'Field 4' 'Field 5' 'Field 6' Field 6 'Field 7' DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_charset.result b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result index e0971b84e3d..6b60bffa365 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_charset.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a varchar(10) character set utf8); load data infile '../../std_data/loaddata6.dat' into table t1; set @@character_set_database=koi8r; @@ -76,3 +72,4 @@ E4B880E4BA8CE4B889 E59B9BE4BA94E585AD E4B883E585ABE4B99D DROP DATABASE mysqltest; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_concurrent.result b/mysql-test/suite/rpl/r/rpl_loaddata_concurrent.result index 126cc07f45f..bc40f32842d 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_concurrent.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_concurrent.result @@ -9,13 +9,8 @@ master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../s master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA CONCURRENT INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`c1`) ;file_id=# DROP TABLE t1; -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; -reset master; +include/master-slave.inc +[connection master] select last_insert_id(); last_insert_id() 0 @@ -43,32 +38,27 @@ drop table t3; create table t1(a int, b int, unique(b)); insert into t1 values(1,10); load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1; -set global sql_slave_skip_counter=1; -start slave; -Last_SQL_Errno=0 -Last_SQL_Error - +include/wait_for_slave_sql_error_and_skip.inc [errno=1062] +include/check_slave_no_error.inc set sql_log_bin=0; delete from t1; set sql_log_bin=1; load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1; -stop slave; +include/wait_for_slave_sql_error.inc [errno=1062] +include/stop_slave_io.inc change master to master_user='test'; change master to master_user='root'; -Last_SQL_Errno=0 -Last_SQL_Error - +include/check_slave_no_error.inc set global sql_slave_skip_counter=1; start slave; set sql_log_bin=0; delete from t1; set sql_log_bin=1; load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1; +include/wait_for_slave_sql_error.inc [errno=1062] stop slave; reset slave; -Last_SQL_Errno=0 -Last_SQL_Error - +include/check_slave_no_error.inc reset master; create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), unique(day)) engine=MyISAM; @@ -91,18 +81,15 @@ load data CONCURRENT infile '../../std_data/rpl_loaddata2.dat' into table t2 fie terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; ERROR 23000: Duplicate entry '2003-03-22' for key 'day' +include/wait_for_slave_sql_to_stop.inc drop table t1, t2; +include/stop_slave_io.inc drop table t1, t2; CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; LOAD DATA CONCURRENT INFILE "../../std_data/words.dat" INTO TABLE t1; ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY' DROP TABLE IF EXISTS t1; -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; +include/rpl_reset.inc drop database if exists b48297_db1; drop database if exists b42897_db2; create database b48297_db1; @@ -123,15 +110,10 @@ LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO LOAD DATA CONCURRENT LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1; ### disconnect and switch back to master connection use b48297_db1; -Comparing tables master:b48297_db1.t1 and slave:b48297_db1.t1 +include/diff_tables.inc [master:b48297_db1.t1, slave:b48297_db1.t1] DROP DATABASE b48297_db1; DROP DATABASE b42897_db2; -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; +include/rpl_reset.inc use test; CREATE TABLE t1 (`key` TEXT, `text` TEXT); LOAD DATA INFILE '../../std_data/loaddata2.dat' REPLACE INTO TABLE `t1` FIELDS TERMINATED BY ','; @@ -143,3 +125,4 @@ Field 3 'Field 4' 'Field 5' 'Field 6' Field 6 'Field 7' DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result index 9acc1ad93ac..a81813de19f 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result @@ -1,14 +1,9 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT, b INT); INSERT INTO t1 VALUES (1,10); LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1; ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Fatal error: Not enough memory -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1593] +Last_SQL_Error = 'Fatal error: Not enough memory' DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_loaddata_m.result index a1294d515fa..ad9fb6e0896 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_m.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_m.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest; USE test; CREATE TABLE t1(a INT, b INT, UNIQUE(b)); @@ -37,3 +33,4 @@ COUNT(*) 2 DROP DATABASE mysqltest; DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_map.result b/mysql-test/suite/rpl/r/rpl_loaddata_map.result index 91624b15ef8..ca6271012dc 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_map.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_map.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Create a big file ==== ==== Load our big file into a table ==== create table t2 (id int not null primary key auto_increment); @@ -29,3 +25,4 @@ count(*) ==== Clean up ==== [on master] drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_s.result b/mysql-test/suite/rpl/r/rpl_loaddata_s.result index 779a3af9631..351c5b584c5 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_s.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_s.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] reset master; create table test.t1(a int, b int, unique(b)); load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; @@ -13,3 +9,4 @@ count(*) show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info drop table test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_simple.result b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result index 5e3923616ed..24a1a35470d 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_simple.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (word CHAR(20) NOT NULL); LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; SELECT * FROM t1 ORDER BY word; @@ -151,3 +147,4 @@ Abernathy aberrant aberration drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_symlink.result b/mysql-test/suite/rpl/r/rpl_loaddata_symlink.result index c7806f5ecce..c3b3c2232a6 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_symlink.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_symlink.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int not null auto_increment, b int, primary key(a) ); load data infile '../../std_data/rpl_loaddata.dat' into table t1; select * from t1; @@ -15,3 +11,4 @@ a b 1 10 2 15 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result index 6dccaa3d74c..37936871993 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result +++ b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int); select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; truncate table t1; @@ -82,3 +78,4 @@ LOAD DATA LOCAL INFILE 'MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; DROP TABLE t1; SET SESSION sql_mode=@old_mode; [slave] +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_loadfile.result b/mysql-test/suite/rpl/r/rpl_loadfile.result index 22f65c0b5e5..640d1f72bf5 100644 --- a/mysql-test/suite/rpl/r/rpl_loadfile.result +++ b/mysql-test/suite/rpl/r/rpl_loadfile.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); @@ -225,11 +221,7 @@ aberration DROP PROCEDURE IF EXISTS test.p1; DROP TABLE test.t1; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc SELECT repeat('x',20) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_39701.data'; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (t text); @@ -240,6 +232,7 @@ END| include/stop_slave.inc CALL p('MYSQLTEST_VARDIR/tmp/bug_39701.data'); include/start_slave.inc -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; DROP PROCEDURE p; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_locale.result b/mysql-test/suite/rpl/r/rpl_locale.result index b7396084663..1f6bd40cd16 100644 --- a/mysql-test/suite/rpl/r/rpl_locale.result +++ b/mysql-test/suite/rpl/r/rpl_locale.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (s1 char(10)); set lc_time_names= 'de_DE'; insert into t1 values (date_format('2001-01-01','%W')); @@ -18,3 +14,4 @@ s1 Montag Monday drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result index 3a52029fa4e..58d0e202110 100644 --- a/mysql-test/suite/rpl/r/rpl_log_pos.result +++ b/mysql-test/suite/rpl/r/rpl_log_pos.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table if not exists t1 (n int); drop table t1; call mtr.add_suppression ("Slave I/O: Got fatal error 1236 from master when reading data from binary"); @@ -14,8 +10,9 @@ master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB> include/stop_slave.inc change master to master_log_pos=MASTER_LOG_POS; start slave; -Last_IO_Error = Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master' -include/stop_slave.inc +include/wait_for_slave_io_error.inc [errno=1236] +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'' +include/stop_slave_sql.inc show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB> @@ -32,3 +29,4 @@ n 3 drop table t1; End of 5.0 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result b/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result index 9061abca477..23238d9c97b 100644 --- a/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result +++ b/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result @@ -1,21 +1,18 @@ -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; +include/master-slave.inc +[connection master] FLUSH LOGS; CREATE TABLE t1(c1 INT); FLUSH LOGS; call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log'); -Last_IO_Error -Got fatal error 1236 from master when reading data from binary log: 'could not find next log' +include/wait_for_slave_io_error.inc [errno=1236] +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log'' CREATE TABLE t2(c1 INT); FLUSH LOGS; CREATE TABLE t3(c1 INT); FLUSH LOGS; CREATE TABLE t4(c1 INT); START SLAVE IO_THREAD; +include/wait_for_slave_io_to_start.inc SHOW TABLES; Tables_in_test t1 @@ -23,3 +20,4 @@ t2 t3 t4 DROP TABLE t1, t2, t3, t4; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_many_optimize.result b/mysql-test/suite/rpl/r/rpl_many_optimize.result index b2148892591..53be9b48c7b 100644 --- a/mysql-test/suite/rpl/r/rpl_many_optimize.result +++ b/mysql-test/suite/rpl/r/rpl_many_optimize.result @@ -1,9 +1,6 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int not null auto_increment primary key, b int, key(b)); INSERT INTO t1 (a) VALUES (1),(2); drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result index edcae6e7506..bf4347757f7 100644 --- a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result +++ b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] select master_pos_wait('master-bin.999999',0,2); master_pos_wait('master-bin.999999',0,2) -1 @@ -22,3 +18,4 @@ show slave status; select master_pos_wait('foo', 98); master_pos_wait('foo', 98) NULL +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_misc_functions.result b/mysql-test/suite/rpl/r/rpl_misc_functions.result index 6d69235927e..c8f294a7558 100644 --- a/mysql-test/suite/rpl/r/rpl_misc_functions.result +++ b/mysql-test/suite/rpl/r/rpl_misc_functions.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression('Statement may not be safe to log in statement format.'); create table t1(id int, i int, r1 int, r2 int, p varchar(100)); insert into t1 values(1, connection_id(), 0, 0, ""); @@ -54,3 +50,4 @@ DROP TABLE t1, t1_slave; DROP PROCEDURE test_replication_sp1; DROP PROCEDURE test_replication_sp2; DROP FUNCTION test_replication_sf; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mixed_bit_pk.result b/mysql-test/suite/rpl/r/rpl_mixed_bit_pk.result index f1b0b2ae5cb..2b5b31201cb 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_bit_pk.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_bit_pk.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8; CREATE TABLE t1 (`bit_key` bit, `bit` bit, key (`bit_key` )) ENGINE=MyISAM; CREATE TABLE t2 (`bit_key` bit(4), `bit` bit, key (`bit_key` )) ENGINE=MyISAM; @@ -30,3 +26,4 @@ DELETE FROM `t7` WHERE `bit` < 2 LIMIT 4; INSERT INTO `t8` ( `bit` ) VALUES ( 0 ); DELETE FROM `t8` WHERE `bit` < 2 LIMIT 4; DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result index 308e6a05151..3ebcd64436b 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (n int auto_increment primary key); set insert_id = 2000; insert into t1 values (NULL),(NULL),(NULL); @@ -45,3 +41,4 @@ t5 CREATE TABLE `t5` ( `created` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t2,t3,t5; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_delete.result b/mysql-test/suite/rpl/r/rpl_multi_delete.result index 4831502eb88..ea1d87a3960 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_delete.result +++ b/mysql-test/suite/rpl/r/rpl_multi_delete.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int primary key); create table t2 (a int); insert into t1 values (1); @@ -20,3 +16,4 @@ select * from t2; a 1 drop table t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_delete2.result b/mysql-test/suite/rpl/r/rpl_multi_delete2.result index 87abe60b268..51112345a1d 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_delete2.result +++ b/mysql-test/suite/rpl/r/rpl_multi_delete2.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set sql_log_bin=0; create database mysqltest_from; set sql_log_bin=1; @@ -42,3 +38,4 @@ set sql_log_bin=0; drop database mysqltest_from; set sql_log_bin=1; drop database mysqltest_to; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_engine.result b/mysql-test/suite/rpl/r/rpl_multi_engine.result index e26777c15ce..7815fa88c93 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_engine.result +++ b/mysql-test/suite/rpl/r/rpl_multi_engine.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1; CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT @@ -360,3 +356,4 @@ id hex(b1) vc bc d f total y t select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; id hex(b1) vc bc d f total y t DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_update.result b/mysql-test/suite/rpl/r/rpl_multi_update.result index 524278be042..8634e86afed 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_update.result +++ b/mysql-test/suite/rpl/r/rpl_multi_update.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned @@ -25,3 +21,4 @@ a b 2 1 UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a; drop table t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_update2.result b/mysql-test/suite/rpl/r/rpl_multi_update2.result index 5bb262764fa..a3cab693322 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_update2.result +++ b/mysql-test/suite/rpl/r/rpl_multi_update2.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1,t2; CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, @@ -53,3 +49,4 @@ select * from t1; a 3 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_update3.result b/mysql-test/suite/rpl/r/rpl_multi_update3.result index dba7f770ba2..6b9ec5c3947 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_update3.result +++ b/mysql-test/suite/rpl/r/rpl_multi_update3.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] -------- Test for BUG#9361 -------- CREATE TABLE t1 ( @@ -195,3 +191,4 @@ idpro price nbprice 2 1.0000 2 3 2.0000 1 DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_multi_update4.result b/mysql-test/suite/rpl/r/rpl_multi_update4.result index f6dde65a35d..0c4857bed60 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_update4.result +++ b/mysql-test/suite/rpl/r/rpl_multi_update4.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists d1; drop database if exists d2; drop database if exists d2; @@ -23,3 +19,4 @@ id 0 drop database d1; drop database d2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result b/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result index 09a9121d22c..5187cb0344d 100644 --- a/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result +++ b/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result @@ -1,13 +1,11 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS `#mysql50#mysqltest-1`; CREATE DATABASE `#mysql50#mysqltest-1`; Master position is not changed STOP SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_stop.inc Master position has been changed DROP DATABASE `mysqltest-1`; DROP DATABASE `#mysql50#mysqltest-1`; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_name_const.result b/mysql-test/suite/rpl/r/rpl_name_const.result index acb2684d2c8..89a48bad09b 100644 --- a/mysql-test/suite/rpl/r/rpl_name_const.result +++ b/mysql-test/suite/rpl/r/rpl_name_const.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialize ==== [on master] create table t1 (id int); @@ -26,3 +22,4 @@ id [on master] drop table t1; drop procedure test_procedure; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result b/mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result index 3b9b741e040..0b5673a383c 100644 --- a/mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result +++ b/mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression('Statement may not be safe to log in statement format.'); CREATE TABLE t1 (a VARCHAR(1000)); INSERT INTO t1 VALUES (CONNECTION_ID()); @@ -23,5 +19,6 @@ INSERT INTO t1 VALUES (UTC_TIMESTAMP()); INSERT INTO t1 VALUES (RAND()); INSERT INTO t1 VALUES (LAST_INSERT_ID()); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_not_null_innodb.result b/mysql-test/suite/rpl/r/rpl_not_null_innodb.result index b09fbab905a..1eaeaba05bb 100644 --- a/mysql-test/suite/rpl/r/rpl_not_null_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_not_null_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET SQL_LOG_BIN= 0; CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL, `c` INT DEFAULT NULL, @@ -45,8 +41,8 @@ INSERT INTO t4(a,c) VALUES (4, 4); INSERT INTO t4(a) VALUES (5); ************* SHOWING THE RESULT SETS WITH INSERTS ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] TABLES t2 and t3 must be different. SELECT * FROM t3 ORDER BY a; a b @@ -80,7 +76,7 @@ UPDATE t1 set b= NULL, c= 300 where a= 1; REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300); ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ************* CLEANING ************* DROP TABLE t1; DROP TABLE t2; @@ -122,7 +118,7 @@ UPDATE t1 set b= NULL, c= b'00' where a= 1; REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00'); ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ################################################################################ # NULL ---> NOT NULL (STRICT MODE) @@ -200,3 +196,4 @@ a b c DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_not_null_myisam.result b/mysql-test/suite/rpl/r/rpl_not_null_myisam.result index 09611dc6480..ec17e3bfafa 100644 --- a/mysql-test/suite/rpl/r/rpl_not_null_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_not_null_myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET SQL_LOG_BIN= 0; CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL, `c` INT DEFAULT NULL, @@ -45,8 +41,8 @@ INSERT INTO t4(a,c) VALUES (4, 4); INSERT INTO t4(a) VALUES (5); ************* SHOWING THE RESULT SETS WITH INSERTS ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] TABLES t2 and t3 must be different. SELECT * FROM t3 ORDER BY a; a b @@ -80,7 +76,7 @@ UPDATE t1 set b= NULL, c= 300 where a= 1; REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300); ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ************* CLEANING ************* DROP TABLE t1; DROP TABLE t2; @@ -122,7 +118,7 @@ UPDATE t1 set b= NULL, c= b'00' where a= 1; REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00'); ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* TABLES t1 and t2 must be equal otherwise an error will be thrown. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ################################################################################ # NULL ---> NOT NULL (STRICT MODE) @@ -200,3 +196,4 @@ a b c DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_optimize.result b/mysql-test/suite/rpl/r/rpl_optimize.result index 8c4bcf48a65..d3398556f59 100644 --- a/mysql-test/suite/rpl/r/rpl_optimize.result +++ b/mysql-test/suite/rpl/r/rpl_optimize.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop tables if exists t1; CALL mtr.add_suppression('Statement may not be safe to log in statement format.'); create table t1 (a int not null auto_increment primary key, b int, key(b)); @@ -27,3 +23,4 @@ optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_packet.result b/mysql-test/suite/rpl/r/rpl_packet.result index 1ec9259a1fb..9239a718504 100644 --- a/mysql-test/suite/rpl/r/rpl_packet.result +++ b/mysql-test/suite/rpl/r/rpl_packet.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153"); call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:"); drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; @@ -33,22 +29,15 @@ include/stop_slave.inc include/start_slave.inc CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM; INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); -Slave_IO_Running = No (expect No) -SELECT "Got a packet bigger than 'max_allowed_packet' bytes" AS Last_IO_Error; -Last_IO_Error -Got a packet bigger than 'max_allowed_packet' bytes -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; +include/wait_for_slave_io_error.inc [errno=1153] +Last_IO_Error = 'Got a packet bigger than 'max_allowed_packet' bytes' +include/stop_slave_sql.inc +include/rpl_reset.inc +DROP TABLE t1; CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM; INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet)); -Slave_IO_Running = No (expect No) -SELECT "Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'" AS Last_IO_Error; -Last_IO_Error -Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master' +include/wait_for_slave_io_error.inc [errno=1236] +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'' STOP SLAVE; RESET SLAVE; RESET MASTER; @@ -62,3 +51,5 @@ DROP TABLE t1; SET @@global.max_allowed_packet= 1024; SET @@global.net_buffer_length= 1024; DROP TABLE t1; +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_plugin_load.result b/mysql-test/suite/rpl/r/rpl_plugin_load.result index 43e171a97c9..b33e29ef668 100644 --- a/mysql-test/suite/rpl/r/rpl_plugin_load.result +++ b/mysql-test/suite/rpl/r/rpl_plugin_load.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] Verify that example engine is not installed. SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE'; ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS @@ -33,4 +29,5 @@ Delta Verify that example engine is not installed. SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE'; ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +include/rpl_end.inc End of test diff --git a/mysql-test/suite/rpl/r/rpl_ps.result b/mysql-test/suite/rpl/r/rpl_ps.result index 89e822b3eb6..6e110227782 100644 --- a/mysql-test/suite/rpl/r/rpl_ps.result +++ b/mysql-test/suite/rpl/r/rpl_ps.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1; create table t1(n char(30)); prepare stmt1 from 'insert into t1 values (?)'; @@ -33,49 +29,22 @@ stop slave; # statement breaks binlog. # ######################################################################## - # Connection: slave - - START SLAVE; - # Connection: master - - CREATE DATABASE mysqltest1; CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32)); - PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)'; - EXECUTE stmt_d_1; - use mysqltest1; - EXECUTE stmt_d_1; - - # Connection: slave - - SELECT * FROM t1; db_name db_col_name test latin1_swedish_ci test latin1_swedish_ci - # Connection: master - - DROP DATABASE mysqltest1; - use test; DROP TABLE t1; - - -# Connection: slave - - -STOP SLAVE; - -######################################################################## -reset master; -reset slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result index 6bb9b139057..e5d722a841f 100644 --- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result +++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET @old_binlog_format= @@global.binlog_format; SET BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; @@ -33,3 +29,4 @@ slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000001 # Query # # COMMIT DROP TABLE IF EXISTS t1; SET @@global.binlog_format= @old_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_read_only.result b/mysql-test/suite/rpl/r/rpl_read_only.result index 6b1404b4f68..37bdc09a8c0 100644 --- a/mysql-test/suite/rpl/r/rpl_read_only.result +++ b/mysql-test/suite/rpl/r/rpl_read_only.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create user test; create table t1(a int) engine=InnoDB; create table t2(a int) engine=MyISAM; @@ -114,3 +110,4 @@ drop user test; drop table t1; drop table t2; set global read_only=0; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_relay_space_innodb.result b/mysql-test/suite/rpl/r/rpl_relay_space_innodb.result index 54aac2eca35..4f10ac50f9a 100644 --- a/mysql-test/suite/rpl/r/rpl_relay_space_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_relay_space_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SHOW VARIABLES LIKE 'relay_log_space_limit'; Variable_name Value relay_log_space_limit 0 @@ -23,3 +19,4 @@ Andy 31 00000001 Jacob 2 00000002 Caleb 1 00000003 DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_relay_space_myisam.result b/mysql-test/suite/rpl/r/rpl_relay_space_myisam.result index e8d2d63e46e..4c1a50b2f33 100644 --- a/mysql-test/suite/rpl/r/rpl_relay_space_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_relay_space_myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SHOW VARIABLES LIKE 'relay_log_space_limit'; Variable_name Value relay_log_space_limit 0 @@ -23,3 +19,4 @@ Andy 31 00000001 Jacob 2 00000002 Caleb 1 00000003 DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_relayrotate.result b/mysql-test/suite/rpl/r/rpl_relayrotate.result index 20f19973d83..ea00aee0085 100644 --- a/mysql-test/suite/rpl/r/rpl_relayrotate.result +++ b/mysql-test/suite/rpl/r/rpl_relayrotate.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] stop slave; create table t1 (a int) engine=innodb; reset slave; @@ -14,3 +10,4 @@ select max(a) from t1; max(a) 8000 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_relayspace.result b/mysql-test/suite/rpl/r/rpl_relayspace.result index bb4e672e7e5..ff217af6431 100644 --- a/mysql-test/suite/rpl/r/rpl_relayspace.result +++ b/mysql-test/suite/rpl/r/rpl_relayspace.result @@ -1,19 +1,19 @@ +include/master-slave.inc +[connection master] 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; -stop slave; +include/wait_for_slave_to_stop.inc create table t1 (a int); drop table t1; create table t1 (a int); drop table t1; reset slave; start slave io_thread; +include/wait_for_slave_param.inc [Slave_IO_State] stop slave io_thread; +include/wait_for_slave_io_to_stop.inc reset slave; start slave; select master_pos_wait('MASTER_LOG_FILE',200,30)=-1; master_pos_wait('MASTER_LOG_FILE',200,30)=-1 0 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_replicate_do.result b/mysql-test/suite/rpl/r/rpl_replicate_do.result index 637047a883b..6f85fc15b1e 100644 --- a/mysql-test/suite/rpl/r/rpl_replicate_do.result +++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t11; drop table if exists t11; create table t2 (n int); @@ -26,7 +22,7 @@ n select * from t11; ERROR 42S02: Table 'test.t11' doesn't exist drop table if exists t1,t2,t11; -Replicate_Do_Table test.t1 +Replicate_Do_Table = 'test.t1' create table t1 (ts timestamp); set one_shot time_zone='met'; insert into t1 values('2005-08-12 00:00:00'); @@ -73,3 +69,4 @@ Trigger Event Table Statement Timing Created sql_mode Definer character_set_clie *** master *** drop table t1; drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result b/mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result index 0135804c02d..f0c46b0b966 100644 --- a/mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result +++ b/mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; drop database if exists mysqltest2; create database mysqltest1; @@ -21,3 +17,4 @@ a 1 drop database mysqltest1; drop database mysqltest2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_report.result b/mysql-test/suite/rpl/r/rpl_report.result index e129d7c8f22..b979d1faf5d 100644 --- a/mysql-test/suite/rpl/r/rpl_report.result +++ b/mysql-test/suite/rpl/r/rpl_report.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] select * from Information_schema.GLOBAL_VARIABLES where variable_name like 'report_host'; VARIABLE_NAME VARIABLE_VALUE REPORT_HOST 127.0.0.1 @@ -31,3 +27,4 @@ Value my_password set @@global.report_host='my.new.address.net'; ERROR HY000: Variable 'report_host' is a read only variable end of tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result index dae72d83b51..12071faecfd 100644 --- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result +++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1; use mysqltest1; @@ -219,3 +215,4 @@ DROP DATABASE database_slave_temp_01; DROP DATABASE database_slave_temp_02; DROP DATABASE database_slave_temp_03; SET sql_log_bin= 1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result index b50c7cebcab..e41f56c0a71 100644 --- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result +++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result @@ -1,5 +1,3 @@ -drop table if exists t1, t2, t3, t4; -drop table if exists t1, t2, t3, t4; start slave; Got one of the listed errors start slave; @@ -14,9 +12,9 @@ create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables"); create table t1 (s text); insert into t1 values('Could not break slave'),('Tried hard'); -Master_Log_File master-bin.000001 -Relay_Master_Log_File master-bin.000001 -Checking that both slave threads are running. +Master_Log_File = 'master-bin.000001' +Relay_Master_Log_File = 'master-bin.000001' +include/check_slave_is_running.inc select * from t1; s Could not break slave @@ -38,8 +36,7 @@ drop table temp_table, t3; insert into t2 values(1234); set insert_id=1234; insert into t2 values(NULL); -set global sql_slave_skip_counter=1; -start slave; +include/wait_for_slave_sql_error_and_skip.inc [errno=1062] purge master logs to 'master-bin.000002'; show master logs; Log_name master-bin.000002 @@ -57,9 +54,9 @@ show binary logs; Log_name File_size master-bin.000003 # insert into t2 values (65); -Master_Log_File master-bin.000003 -Relay_Master_Log_File master-bin.000003 -Checking that both slave threads are running. +Master_Log_File = 'master-bin.000003' +Relay_Master_Log_File = 'master-bin.000003' +include/check_slave_is_running.inc select * from t2; m 34 @@ -85,9 +82,9 @@ master-bin.000005 # <Binlog_Do_DB> <Binlog_Ignore_DB> select * from t4; a testing temporary tables part 2 -Master_Log_File master-bin.000005 -Relay_Master_Log_File master-bin.000005 -Checking that both slave threads are running. +Master_Log_File = 'master-bin.000005' +Relay_Master_Log_File = 'master-bin.000005' +include/check_slave_is_running.inc lock tables t3 read; select count(*) from t3 where n >= 4; count(*) @@ -102,3 +99,5 @@ show binlog events in ''; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log purge master logs before now(); End of 5.0 tests +include/stop_slave.inc +CHANGE MASTER TO MASTER_HOST = ''; diff --git a/mysql-test/suite/rpl/r/rpl_row_001.result b/mysql-test/suite/rpl/r/rpl_row_001.result index 0d682eb82e1..b5f6aea9698 100644 --- a/mysql-test/suite/rpl/r/rpl_row_001.result +++ b/mysql-test/suite/rpl/r/rpl_row_001.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (word CHAR(20) NOT NULL); LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; @@ -53,3 +49,4 @@ SELECT n FROM t1; n 3456 DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_4_bytes.result b/mysql-test/suite/rpl/r/rpl_row_4_bytes.result index e2431364ed3..ef9602204a1 100644 --- a/mysql-test/suite/rpl/r/rpl_row_4_bytes.result +++ b/mysql-test/suite/rpl/r/rpl_row_4_bytes.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1; use mysqltest1; @@ -25,3 +21,4 @@ ABE ANG LIL DROP DATABASE mysqltest1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_NOW.result b/mysql-test/suite/rpl/r/rpl_row_NOW.result index 23f95878608..eb6271d6e93 100644 --- a/mysql-test/suite/rpl/r/rpl_row_NOW.result +++ b/mysql-test/suite/rpl/r/rpl_row_NOW.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create database if not exists mysqltest1; DROP TABLE IF EXISTS mysqltest1.t1; CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, @@ -27,3 +23,4 @@ INSERT INTO mysqltest1.t1 SET n = NULL, a = now(); DROP TABLE IF EXISTS mysqltest1.t1; DROP FUNCTION mysqltest1.f1; DROP DATABASE mysqltest1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_USER.result b/mysql-test/suite/rpl/r/rpl_row_USER.result index 98755fb4653..5298395da20 100644 --- a/mysql-test/suite/rpl/r/rpl_row_USER.result +++ b/mysql-test/suite/rpl/r/rpl_row_USER.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS mysqltest1; CREATE DATABASE mysqltest1; CREATE USER tester IDENTIFIED BY 'test'; @@ -36,3 +32,4 @@ REVOKE ALL ON mysqltest1.* FROM 'tester'@'%'; REVOKE ALL ON mysqltest1.* FROM ''@'localhost%'; DROP USER tester@'%'; DROP USER ''@'localhost%'; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_UUID.result b/mysql-test/suite/rpl/r/rpl_row_UUID.result index 02174a7ecae..b7d3f8914e0 100644 --- a/mysql-test/suite/rpl/r/rpl_row_UUID.result +++ b/mysql-test/suite/rpl/r/rpl_row_UUID.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=myisam; @@ -38,3 +34,4 @@ DROP PROCEDURE test.p1; DROP FUNCTION test.fn1; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result index 458ae53e79c..d13d6722dc7 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result @@ -1,9 +1,6 @@ -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; +include/master-slave.inc +[connection master] +call mtr.add_suppression("Can't find record in 't.'"); CREATE DATABASE test_ignore; **** On Master **** SHOW DATABASES; @@ -27,6 +24,10 @@ t2 INSERT INTO t2 VALUES (3,3), (4,4); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (mtr.test_suppressions) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT) master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) @@ -46,11 +47,10 @@ t1 USE test_ignore; ERROR 42000: Unknown database 'test_ignore' DROP DATABASE test_ignore; -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; +USE test; +DROP TABLE t1; +USE test; +include/rpl_reset.inc CREATE TABLE t1 (a INT); DELETE FROM t1; INSERT INTO t1 VALUES (1),(2); @@ -65,11 +65,7 @@ master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT DROP TABLE t1; ================ Test for BUG#17620 ================ -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; +include/rpl_reset.inc **** On Slave **** SET GLOBAL QUERY_CACHE_SIZE=0; **** On Master **** @@ -103,12 +99,9 @@ a 8 9 SET GLOBAL QUERY_CACHE_SIZE=0; +DROP TABLE t1; ================ Test for BUG#22550 ================ -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; +include/rpl_reset.inc CREATE TABLE t1 (a BIT(1), b INT) ENGINE=MYISAM; INSERT INTO t1 VALUES(1,2); SELECT HEX(a),b FROM t1; @@ -126,11 +119,7 @@ HEX(a) b 0 2 DROP TABLE IF EXISTS t1; ================ Test for BUG#22583 ================ -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; +include/rpl_reset.inc **** On Master **** CREATE TABLE t1_myisam (k INT, a BIT(1), b BIT(9)) ENGINE=MYISAM; CREATE TABLE t1_innodb (k INT, a BIT(1), b BIT(9)) ENGINE=INNODB; @@ -247,13 +236,8 @@ a b 3 1 4 4 drop table t1,t2; -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; +include/rpl_reset.inc **** On Master **** -SET SESSION BINLOG_FORMAT=ROW; CREATE TABLE t1 (a INT PRIMARY KEY, b SET('master','slave')); INSERT INTO t1 VALUES (1,'master,slave'), (2,'master,slave'); **** On Slave **** @@ -277,6 +261,6 @@ SELECT * FROM t1 ORDER BY a; a b 2 master,slave 5 slave -DROP TABLE t1; **** On Master **** DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result index a247c3a6039..7afc70bfa5c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'MYISAM' ; SELECT * FROM t1; C1 C2 @@ -422,11 +418,7 @@ a b c **** Test for BUG#31552 **** **** On Master **** DELETE FROM t1; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc **** On Master **** INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); **** On Master **** @@ -436,7 +428,7 @@ DELETE FROM t1; SELECT COUNT(*) FROM t1 ORDER BY c1,c2; COUNT(*) 0 set @@global.slave_exec_mode= default; -Checking that both slave threads are running. +include/check_slave_is_running.inc SELECT COUNT(*) FROM t1 ORDER BY c1,c2; COUNT(*) 0 **** Test for BUG#37076 **** @@ -478,50 +470,44 @@ j INT NOT NULL) ENGINE = 'MYISAM' ; [expecting slave to replicate correctly] INSERT INTO t1 VALUES (1, "", 1); INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] [expecting slave to replicate correctly] INSERT INTO t2 VALUES (1, "", 1); INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2); -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] [expecting slave to stop] INSERT INTO t3 VALUES (1, "", 1); INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to replicate correctly] INSERT INTO t4 VALUES (1, "", 1); INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2); -Comparing tables master:test.t4 and slave:test.t4 +include/diff_tables.inc [master:t4, slave:t4] [expecting slave to stop] INSERT INTO t5 VALUES (1, "", 1); INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to stop] INSERT INTO t6 VALUES (1, "", 1); INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to replicate correctly] INSERT INTO t7 VALUES (1, "", 1); INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2); -Comparing tables master:test.t7 and slave:test.t7 +include/diff_tables.inc [master:t7, slave:t7] drop table t1, t2, t3, t4, t5, t6, t7; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE='MYISAM' ; INSERT INTO t1 VALUES (1), (2), (3); UPDATE t1 SET a = 10; ERROR 23000: Duplicate entry '10' for key 'PRIMARY' INSERT INTO t1 VALUES (4); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( @@ -575,7 +561,7 @@ ERROR 23000: Duplicate entry '6' for key 'PRIMARY' DELETE FROM t2 WHERE `pk` < 7 LIMIT 1; UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6; *** results: t2 must be consistent **** -Comparing tables master:test.t2 and master:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1, t2; EOF OF TESTS CREATE TABLE t1 (a int) ENGINE='MYISAM' ; @@ -591,7 +577,7 @@ UPDATE t1 SET a = 9 WHERE a < 3; INSERT INTO t1 ( a ) VALUES ( 3 ); UPDATE t1 SET a = 0 WHERE a < 4; UPDATE t1 SET a = 8 WHERE a < 5; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; CREATE TABLE t1 (a bit) ENGINE='MYISAM' ; INSERT IGNORE INTO t1 VALUES (NULL); @@ -633,5 +619,6 @@ DELETE FROM t1 WHERE a < 3 LIMIT 0; UPDATE t1 SET a = 8 WHERE a = 5 LIMIT 2; INSERT INTO t1 ( a ) VALUES ( 1 ); UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result index fefe8e969dc..b8620894bd1 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'INNODB' ; SELECT * FROM t1; C1 C2 @@ -422,11 +418,7 @@ a b c **** Test for BUG#31552 **** **** On Master **** DELETE FROM t1; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc **** On Master **** INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); **** On Master **** @@ -436,7 +428,7 @@ DELETE FROM t1; SELECT COUNT(*) FROM t1 ORDER BY c1,c2; COUNT(*) 0 set @@global.slave_exec_mode= default; -Checking that both slave threads are running. +include/check_slave_is_running.inc SELECT COUNT(*) FROM t1 ORDER BY c1,c2; COUNT(*) 0 **** Test for BUG#37076 **** @@ -478,50 +470,44 @@ j INT NOT NULL) ENGINE = 'INNODB' ; [expecting slave to replicate correctly] INSERT INTO t1 VALUES (1, "", 1); INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] [expecting slave to replicate correctly] INSERT INTO t2 VALUES (1, "", 1); INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2); -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] [expecting slave to stop] INSERT INTO t3 VALUES (1, "", 1); INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to replicate correctly] INSERT INTO t4 VALUES (1, "", 1); INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2); -Comparing tables master:test.t4 and slave:test.t4 +include/diff_tables.inc [master:t4, slave:t4] [expecting slave to stop] INSERT INTO t5 VALUES (1, "", 1); INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to stop] INSERT INTO t6 VALUES (1, "", 1); INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2); -Last_SQL_Error = Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size. -RESET MASTER; -STOP SLAVE; -RESET SLAVE; -START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.' +include/rpl_reset.inc [expecting slave to replicate correctly] INSERT INTO t7 VALUES (1, "", 1); INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2); -Comparing tables master:test.t7 and slave:test.t7 +include/diff_tables.inc [master:t7, slave:t7] drop table t1, t2, t3, t4, t5, t6, t7; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE='INNODB' ; INSERT INTO t1 VALUES (1), (2), (3); UPDATE t1 SET a = 10; ERROR 23000: Duplicate entry '10' for key 'PRIMARY' INSERT INTO t1 VALUES (4); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( @@ -575,7 +561,7 @@ ERROR 23000: Duplicate entry '6' for key 'PRIMARY' DELETE FROM t2 WHERE `pk` < 7 LIMIT 1; UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6; *** results: t2 must be consistent **** -Comparing tables master:test.t2 and master:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1, t2; EOF OF TESTS CREATE TABLE t1 (a int) ENGINE='INNODB' ; @@ -591,7 +577,7 @@ UPDATE t1 SET a = 9 WHERE a < 3; INSERT INTO t1 ( a ) VALUES ( 3 ); UPDATE t1 SET a = 0 WHERE a < 4; UPDATE t1 SET a = 8 WHERE a < 5; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; CREATE TABLE t1 (a bit) ENGINE='INNODB' ; INSERT IGNORE INTO t1 VALUES (NULL); @@ -633,5 +619,6 @@ DELETE FROM t1 WHERE a < 3 LIMIT 0; UPDATE t1 SET a = 8 WHERE a = 5 LIMIT 2; INSERT INTO t1 ( a ) VALUES ( 1 ); UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result index 3443e704031..c7241c52353 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1; SET @@BINLOG_FORMAT = ROW; SELECT @@BINLOG_FORMAT; @@ -717,3 +713,4 @@ COUNT(*) 4 DELETE FROM t1; DROP TABLE IF EXISTS t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_blob_innodb.result b/mysql-test/suite/rpl/r/rpl_row_blob_innodb.result index 055efffbd6a..4fb33dc4b6b 100644 --- a/mysql-test/suite/rpl/r/rpl_row_blob_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_blob_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; ***** Table Create Section **** @@ -154,3 +150,4 @@ c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_blob_myisam.result b/mysql-test/suite/rpl/r/rpl_row_blob_myisam.result index 055efffbd6a..4fb33dc4b6b 100644 --- a/mysql-test/suite/rpl/r/rpl_row_blob_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_blob_myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; ***** Table Create Section **** @@ -154,3 +150,4 @@ c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_colSize.result b/mysql-test/suite/rpl/r/rpl_row_colSize.result index 417bc65641a..49753d2b25c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_colSize.result +++ b/mysql-test/suite/rpl/r/rpl_row_colSize.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1; **** Testing WL#3228 changes. **** *** Create "wider" table on slave *** @@ -18,7 +14,8 @@ CREATE TABLE t1 (a DECIMAL(20, 10)); RESET MASTER; INSERT INTO t1 VALUES (901251.90125); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -34,7 +31,8 @@ CREATE TABLE t1 (a DECIMAL(27, 18)); RESET MASTER; INSERT INTO t1 VALUES (901251.90125); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -50,7 +48,8 @@ CREATE TABLE t1 (a NUMERIC(20, 10)); RESET MASTER; INSERT INTO t1 VALUES (901251.90125); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -67,7 +66,8 @@ CREATE TABLE t1 (a FLOAT(47)); RESET MASTER; INSERT INTO t1 VALUES (901251.90125); START SLAVE; -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4 +include/wait_for_slave_sql_error.inc [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' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -84,7 +84,8 @@ CREATE TABLE t1 (a BIT(64)); RESET MASTER; INSERT INTO t1 VALUES (B'10101'); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -100,7 +101,8 @@ CREATE TABLE t1 (a BIT(12)); RESET MASTER; INSERT INTO t1 VALUES (B'10101'); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -117,7 +119,8 @@ CREATE TABLE t1 (a SET('1','2','3','4','5','6','7','8','9')); RESET MASTER; INSERT INTO t1 VALUES ('4'); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -134,7 +137,8 @@ CREATE TABLE t1 (a CHAR(20)); RESET MASTER; INSERT INTO t1 VALUES ('This is a test.'); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -182,7 +186,8 @@ CREATE TABLE t1 (a ENUM( RESET MASTER; INSERT INTO t1 VALUES ('44'); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -199,7 +204,8 @@ CREATE TABLE t1 (a VARCHAR(2000)); RESET MASTER; INSERT INTO t1 VALUES ('This is a test.'); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -215,7 +221,8 @@ CREATE TABLE t1 (a VARCHAR(200)); RESET MASTER; INSERT INTO t1 VALUES ('This is a test.'); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -231,7 +238,8 @@ CREATE TABLE t1 (a VARCHAR(2000)); RESET MASTER; INSERT INTO t1 VALUES ('This is a test.'); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -248,7 +256,8 @@ CREATE TABLE t1 (a LONGBLOB); RESET MASTER; INSERT INTO t1 VALUES ('This is a test.'); START SLAVE; -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. +include/wait_for_slave_sql_error.inc [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.' SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -258,3 +267,4 @@ RESET MASTER; START SLAVE; *** Cleanup *** DROP TABLE IF EXISTS t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_conflicts.result b/mysql-test/suite/rpl/r/rpl_row_conflicts.result index 0f15bfc7156..795fd7d080d 100644 --- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result +++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result @@ -1,10 +1,7 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: .*"); +call mtr.add_suppression("Can't find record in 't.'"); [on slave] SET @old_slave_exec_mode= @@global.slave_exec_mode; ######## Run with slave_exec_mode=STRICT ######## @@ -24,6 +21,7 @@ a 1 [on slave] ---- Wait until slave stops with an error ---- +include/wait_for_slave_sql_error.inc [errno=1062] Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 346 (expected "duplicate key" error) SELECT * FROM t1; a @@ -31,6 +29,7 @@ a ---- Resolve the conflict on the slave and restart SQL thread ---- DELETE FROM t1 WHERE a = 1; START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc ---- Sync slave and verify that there is no error ---- Last_SQL_Error = '' (expected no error) SELECT * FROM t1; @@ -50,12 +49,15 @@ SELECT * FROM t1; a [on slave] ---- Wait until slave stops with an error ---- -Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 982 (expected "can't find record" error) +include/wait_for_slave_sql_error.inc [errno=1032] +Last_SQL_Error (expected "duplicate key" error) +Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos END_LOG_POS SELECT * FROM t1; a ---- Resolve the conflict on the slave and restart SQL thread ---- INSERT INTO t1 VALUES (1); START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc ---- Sync slave and verify that there is no error ---- Last_SQL_Error = (expected no error) SELECT * FROM t1; @@ -64,6 +66,7 @@ a [on master] DROP TABLE t1; [on slave] +include/rpl_reset.inc ######## Run with slave_exec_mode=IDEMPOTENT ######## set @@global.slave_exec_mode= 'IDEMPOTENT'; ==== Initialize ==== @@ -107,3 +110,4 @@ a DROP TABLE t1; [on slave] SET @@global.slave_exec_mode= @old_slave_exec_mode; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result b/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result index 90b68428008..4575588b1ef 100644 --- a/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result +++ b/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int not null primary key) engine=myisam; insert delayed into t1 values (1); insert delayed into t1 values (2); @@ -20,3 +16,4 @@ a 2 3 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_drop.result b/mysql-test/suite/rpl/r/rpl_row_drop.result index 048e07271b3..963a001f70a 100644 --- a/mysql-test/suite/rpl/r/rpl_row_drop.result +++ b/mysql-test/suite/rpl/r/rpl_row_drop.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] **** On Master **** CREATE TABLE t1 (a int); CREATE TABLE t2 (a int); @@ -53,3 +49,4 @@ t2 SHOW TABLES; Tables_in_test t2 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_find_row.result b/mysql-test/suite/rpl/r/rpl_row_find_row.result index 69516b47b7d..fff1f1b0c35 100644 --- a/mysql-test/suite/rpl/r/rpl_row_find_row.result +++ b/mysql-test/suite/rpl/r/rpl_row_find_row.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET SQL_LOG_BIN=0; CREATE TABLE t (a int, b int, c int, key(b)); SET SQL_LOG_BIN=1; @@ -12,27 +8,18 @@ INSERT INTO t VALUES (1,2,4); INSERT INTO t VALUES (4,3,4); DELETE FROM t; DROP TABLE t; -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; +include/rpl_reset.inc CREATE TABLE t (a int, b int, c int, key(b)); ALTER TABLE t DISABLE KEYS; INSERT INTO t VALUES (1,2,4); INSERT INTO t VALUES (4,3,4); DELETE FROM t; DROP TABLE t; -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 INT NOT NULL, c2 INT NOT NULL, c3 INT, UNIQUE KEY(c1,c3), KEY(c2)); INSERT INTO t1(c1,c2) VALUES(1,1); INSERT INTO t1(c1,c2) VALUES(1,2); UPDATE t1 SET c1=1000 WHERE c2=2; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result index fe2fb1d9da2..96d2a337e7c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int) ENGINE=MyISAM; insert into t1 values (10); create table t2 (a int) ENGINE=MyISAM; @@ -21,10 +17,13 @@ flush tables; select * from t3; a stop slave; +include/wait_for_slave_to_stop.inc drop table t1; flush tables with read lock; start slave; +include/wait_for_slave_to_start.inc stop slave; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction unlock tables; drop table t3, t4, t5; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_func001.result b/mysql-test/suite/rpl/r/rpl_row_func001.result index b20f3f724d0..74a053abb26 100644 --- a/mysql-test/suite/rpl/r/rpl_row_func001.result +++ b/mysql-test/suite/rpl/r/rpl_row_func001.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP FUNCTION test.f1; DROP TABLE IF EXISTS test.t1; create table test.t1 (a int, PRIMARY KEY(a)); @@ -28,3 +24,4 @@ a 2 DROP FUNCTION test.f1; DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_func002.result b/mysql-test/suite/rpl/r/rpl_row_func002.result index 03f5b3115c3..69a732048b2 100644 --- a/mysql-test/suite/rpl/r/rpl_row_func002.result +++ b/mysql-test/suite/rpl/r/rpl_row_func002.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP FUNCTION test.f1; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; @@ -24,3 +20,4 @@ INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP); DROP FUNCTION test.f1; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_func003.result b/mysql-test/suite/rpl/r/rpl_row_func003.result index 94d01b50ce5..cdc5bf6afba 100644 --- a/mysql-test/suite/rpl/r/rpl_row_func003.result +++ b/mysql-test/suite/rpl/r/rpl_row_func003.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression('Statement may not be safe to log in statement format.'); DROP FUNCTION IF EXISTS test.f1; DROP TABLE IF EXISTS test.t1; @@ -28,3 +24,4 @@ ROLLBACK; SET AUTOCOMMIT=1; DROP FUNCTION test.f1; DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result index 562e3dc2862..148840cc8c5 100644 --- a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result +++ b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Setup table on master but not on slave ==== [on master] CREATE TABLE t1 (a INT); @@ -14,8 +10,10 @@ DROP TABLE t1; INSERT INTO t1 VALUES (1); ==== Verify error on slave ==== [on slave] -Last_SQL_Error = Error 'Table 'test.t1' doesn't exist' on opening tables +include/wait_for_slave_sql_error.inc [errno=1146] ==== Clean up ==== -include/stop_slave.inc +include/stop_slave_io.inc +RESET SLAVE; [on master] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result b/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result index fa6c8cf9982..4df9b34e37e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result +++ b/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set @old_global_binlog_format = @@global.binlog_format; set @@global.binlog_format = row; CREATE SCHEMA IF NOT EXISTS mysqlslap; @@ -60,3 +56,4 @@ a drop table t1; End of 5.0 tests set @@global.binlog_format = @old_global_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result index 0f648539c47..b88634e2802 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log.result +++ b/mysql-test/suite/rpl/r/rpl_row_log.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] include/stop_slave.inc reset master; reset slave; @@ -240,18 +236,13 @@ slave-bin.000002 # Query # # BEGIN slave-bin.000002 # Table_map # # table_id: # (test.t2) slave-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000002 # Query # # COMMIT -Checking that both slave threads are running. +include/check_slave_is_running.inc 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; DROP TABLE t2; DROP TABLE t3; -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; +include/rpl_reset.inc create table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); set insert_id=5; @@ -273,3 +264,4 @@ a b 5 1 6 1 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result index ff189e676cc..6e1eec2056a 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] include/stop_slave.inc reset master; reset slave; @@ -240,18 +236,13 @@ slave-bin.000002 # Query # # BEGIN slave-bin.000002 # Table_map # # table_id: # (test.t2) slave-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000002 # Xid # # COMMIT /* XID */ -Checking that both slave threads are running. +include/check_slave_is_running.inc 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; DROP TABLE t2; DROP TABLE t3; -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; +include/rpl_reset.inc create table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); set insert_id=5; @@ -273,3 +264,4 @@ a b 5 1 6 1 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result index db06cb6d3de..871d3218b70 100644 --- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result +++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] stop slave; # # Generate a big enough master's binlog to cause relay log rotations @@ -21,7 +17,7 @@ select @@global.max_relay_log_size; @@global.max_relay_log_size 4096 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 2 # @@ -31,7 +27,7 @@ set global max_relay_log_size=(5*4096); select @@global.max_relay_log_size; @@global.max_relay_log_size 20480 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 3: max_relay_log_size = 0 # @@ -41,7 +37,7 @@ set global max_relay_log_size=0; select @@global.max_relay_log_size; @@global.max_relay_log_size 0 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions # @@ -55,13 +51,13 @@ reset slave; start slave; flush logs; create table t1 (a int); -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated # flush logs; drop table t1; -Checking that both slave threads are running. +include/check_slave_is_running.inc flush logs; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB @@ -70,3 +66,4 @@ set global max_binlog_size= @my_max_binlog_size; # # End of 4.1 tests # +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result index 538764da738..5fee82f6017 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ---Setup Section -- set timestamp=1000000000; @@ -380,3 +376,4 @@ a b 1 1 FLUSH LOGS; DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result b/mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result index c461cafbd7c..d9ebb52493b 100644 --- a/mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result @@ -1,46 +1,28 @@ -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; +include/master-slave.inc +[connection master] ## case #1 - last_null_bit_pos==0 in record_compare without X bit -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 ); INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 ); UPDATE t1 SET c5 = 'a'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ## case #1.1 - last_null_bit_pos==0 in record_compare with X bit ## (1 column less and no varchar) -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 ); INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 ); UPDATE t1 SET c5 = 'a'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ## case #2 - X bit is wrongly set. -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=InnoDB DEFAULT CHARSET= latin1; INSERT INTO t1(c1) VALUES (10); INSERT INTO t1(c1) VALUES (NULL); UPDATE t1 SET c1= 0; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result b/mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result index 38fbe486d2e..e9ffcc927be 100644 --- a/mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result @@ -1,60 +1,37 @@ -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; +include/master-slave.inc +[connection master] ## case #1 - last_null_bit_pos==0 in record_compare without X bit -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 ); INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 ); UPDATE t1 SET c5 = 'a'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ## case #1.1 - last_null_bit_pos==0 in record_compare with X bit ## (1 column less and no varchar) -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 ); INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 ); UPDATE t1 SET c5 = 'a'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ## case #2 - X bit is wrongly set. -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=MyISAM DEFAULT CHARSET= latin1; INSERT INTO t1(c1) VALUES (10); INSERT INTO t1(c1) VALUES (NULL); UPDATE t1 SET c1= 0; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; ## coverage purposes - Field_bits ## 1 X bit + 2 Null bits + 5 bits => last_null_bit_pos==0 -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bit(5)) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO t1(c1,c2) VALUES (10, b'1'); INSERT INTO t1(c1,c2) VALUES (NULL, b'1'); UPDATE t1 SET c1= 0; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result index 7bf09df31ca..be4bc630e3f 100644 --- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result +++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result @@ -1,21 +1,17 @@ -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; -Master_User root -Master_Host 127.0.0.1 +include/master-slave.inc +[connection master] +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc change master to master_user='test'; -Master_User test -Master_Host 127.0.0.1 +Master_User = 'test' +Master_Host = '127.0.0.1' reset slave; -Master_User root -Master_Host 127.0.0.1 +Master_User = 'root' +Master_Host = '127.0.0.1' include/start_slave.inc -Master_User root -Master_Host 127.0.0.1 +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc reset slave; include/start_slave.inc @@ -28,13 +24,19 @@ Variable_name Value Slave_open_temp_tables 0 include/stop_slave.inc reset slave; +include/check_slave_no_error.inc change master to master_user='impossible_user_name'; start slave; -include/stop_slave.inc +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc change master to master_user='root'; include/start_slave.inc +include/check_slave_no_error.inc include/stop_slave.inc change master to master_user='impossible_user_name'; start slave; -include/stop_slave.inc +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc reset slave; +include/check_slave_no_error.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp001.result b/mysql-test/suite/rpl/r/rpl_row_sp001.result index 8c26c061376..17117ce2fac 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp001.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp001.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] <Begin test section 1 (non deterministic SP)> --------------------------------------------- @@ -83,3 +79,4 @@ DROP PROCEDURE test.p1; DROP PROCEDURE test.p2; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result b/mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result index a42c9af988c..f368cf6e356 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result @@ -1,15 +1,5 @@ -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; -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP PROCEDURE IF EXISTS test.p3; -DROP TABLE IF EXISTS test.t3; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; +include/master-slave.inc +[connection master] CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=INNODB; CREATE TABLE test.t2 (a INT AUTO_INCREMENT KEY, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON DELETE CASCADE) ENGINE=INNODB; create procedure test.p1(IN i CHAR(6)) @@ -231,9 +221,10 @@ a t 98 NONE SET AUTOCOMMIT=1; SET FOREIGN_KEY_CHECKS=0; -DROP PROCEDURE IF EXISTS test.p3; -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t3; +DROP PROCEDURE test.p3; +DROP PROCEDURE test.p1; +DROP PROCEDURE test.p2; +DROP TABLE test.t1; +DROP TABLE test.t2; +DROP TABLE test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp003.result b/mysql-test/suite/rpl/r/rpl_row_sp003.result index df3e2a7ceed..5650af7a916 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp003.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp003.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; @@ -47,3 +43,4 @@ a DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp005.result b/mysql-test/suite/rpl/r/rpl_row_sp005.result index 01e1970e0df..df877233e94 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp005.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp005.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t2; @@ -98,3 +94,4 @@ DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result index 6792a701577..da196bb3615 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; DROP PROCEDURE IF EXISTS p1; @@ -42,3 +38,4 @@ DROP TABLE t1; DROP TABLE t2; DROP PROCEDURE p1; DROP PROCEDURE p2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result b/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result index 9a2822835f8..fc49f968b4a 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result @@ -1,11 +1,5 @@ -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; -DROP PROCEDURE IF EXISTS test.p1; -DROP TABLE IF EXISTS test.t1; +include/master-slave.inc +[connection master] CREATE PROCEDURE test.p1(IN i INT) BEGIN DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END; @@ -46,5 +40,6 @@ num SELECT * FROM test.t1; num 13 -DROP PROCEDURE IF EXISTS test.p1; -DROP TABLE IF EXISTS test.t1; +DROP PROCEDURE test.p1; +DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp008.result b/mysql-test/suite/rpl/r/rpl_row_sp008.result index 23197964a24..f817e9c5f1b 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp008.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp008.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t2; CREATE TABLE test.t1 (a INT,PRIMARY KEY(a)); @@ -32,3 +28,4 @@ a DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp009.result b/mysql-test/suite/rpl/r/rpl_row_sp009.result index 35ce0d7b420..8e9a2cbb8e9 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp009.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp009.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; @@ -75,3 +71,4 @@ a DROP PROCEDURE test.p1; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp010.result b/mysql-test/suite/rpl/r/rpl_row_sp010.result index 02567465428..d31f37d8411 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp010.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp010.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p3; @@ -54,3 +50,4 @@ DROP PROCEDURE IF EXISTS test.p3; DROP PROCEDURE IF EXISTS test.p4; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp011.result b/mysql-test/suite/rpl/r/rpl_row_sp011.result index e35c9f21adb..8588d739dff 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp011.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp011.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p3; @@ -67,3 +63,4 @@ DROP PROCEDURE IF EXISTS test.p6; DROP PROCEDURE IF EXISTS test.p7; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_sp012.result b/mysql-test/suite/rpl/r/rpl_row_sp012.result index b9c818bad9a..57d92386638 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp012.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp012.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p3; @@ -57,3 +53,4 @@ DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP USER user1@localhost; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result index 1934b01505c..09a3e4b73de 100644 --- a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result +++ b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result @@ -1,17 +1,14 @@ -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; +include/master-slave.inc +[connection master] create table t1 (words varchar(20)) engine=myisam; load data infile '../../std_data/words.dat' into table t1 (words); select count(*) from t1; count(*) 70 +include/wait_for_slave_sql_to_stop.inc select count(*) from t1; count(*) 70 drop table t1; -include/stop_slave.inc drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result index 2b83bffd85f..5a29acfda1d 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] STOP SLAVE; SET @my_sql_mode= @@global.sql_mode; SET GLOBAL SQL_MODE='STRICT_ALL_TABLES'; @@ -118,27 +114,21 @@ a b SELECT * FROM t2; a 2 -Checking that both slave threads are running. +include/check_slave_is_running.inc INSERT INTO t9 VALUES (4); INSERT INTO t4 VALUES (4); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4' INSERT INTO t9 VALUES (5); INSERT INTO t5 VALUES (5,10,25); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4' INSERT INTO t9 VALUES (6); INSERT INTO t6 VALUES (6,12,36); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4' INSERT INTO t9 VALUES (6); -Checking that both slave threads are running. +include/check_slave_is_running.inc INSERT INTO t7 VALUES (1),(2),(3); INSERT INTO t8 VALUES (1),(2),(3); SELECT * FROM t7 ORDER BY a; @@ -194,3 +184,4 @@ a b x y z DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef; DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9; SET @@global.sql_mode= @my_sql_mode; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result index a42530c354d..f6620ecf05f 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] STOP SLAVE; SET @my_sql_mode= @@global.sql_mode; SET GLOBAL SQL_MODE='STRICT_ALL_TABLES'; @@ -118,27 +114,21 @@ a b SELECT * FROM t2; a 2 -Checking that both slave threads are running. +include/check_slave_is_running.inc INSERT INTO t9 VALUES (4); INSERT INTO t4 VALUES (4); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4' INSERT INTO t9 VALUES (5); INSERT INTO t5 VALUES (5,10,25); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4' INSERT INTO t9 VALUES (6); INSERT INTO t6 VALUES (6,12,36); ---source include/wait_for_slave_sql_error_and_skip.inc -Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2; -include/start_slave.inc +include/wait_for_slave_sql_error_and_skip.inc [errno=1535] +Last_SQL_Error = 'Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4' INSERT INTO t9 VALUES (6); -Checking that both slave threads are running. +include/check_slave_is_running.inc INSERT INTO t7 VALUES (1),(2),(3); INSERT INTO t8 VALUES (1),(2),(3); SELECT * FROM t7 ORDER BY a; @@ -194,3 +184,4 @@ a b x y z DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef; DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9; SET @@global.sql_mode= @my_sql_mode; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_tbl_metadata.result b/mysql-test/suite/rpl/r/rpl_row_tbl_metadata.result index 711d0d063aa..eaee105a2d9 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tbl_metadata.result +++ b/mysql-test/suite/rpl/r/rpl_row_tbl_metadata.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS `t1`; ### TABLE with field_metadata_size == 290 CREATE TABLE `t1` ( @@ -159,15 +155,10 @@ LOCK TABLES `t1` WRITE; INSERT INTO `t1`(c2) VALUES ('1'); FLUSH LOGS; ### assertion: the slave replicated event successfully and tables match -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE `t1`; === Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail. -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; +include/rpl_reset.inc ### action: generating several tables with different metadata ### sizes (resorting to perl) ### testing table with 249 field metadata size. @@ -182,25 +173,26 @@ start slave; ### testing table with 258 field metadata size. FLUSH LOGS; ### assertion: the slave replicated event successfully and tables match for t10 -Comparing tables master:test.t10 and slave:test.t10 +include/diff_tables.inc [master:t10, slave:t10] ### assertion: the slave replicated event successfully and tables match for t9 -Comparing tables master:test.t9 and slave:test.t9 +include/diff_tables.inc [master:t9, slave:t9] ### assertion: the slave replicated event successfully and tables match for t8 -Comparing tables master:test.t8 and slave:test.t8 +include/diff_tables.inc [master:t8, slave:t8] ### assertion: the slave replicated event successfully and tables match for t7 -Comparing tables master:test.t7 and slave:test.t7 +include/diff_tables.inc [master:t7, slave:t7] ### assertion: the slave replicated event successfully and tables match for t6 -Comparing tables master:test.t6 and slave:test.t6 +include/diff_tables.inc [master:t6, slave:t6] ### assertion: the slave replicated event successfully and tables match for t5 -Comparing tables master:test.t5 and slave:test.t5 +include/diff_tables.inc [master:t5, slave:t5] ### assertion: the slave replicated event successfully and tables match for t4 -Comparing tables master:test.t4 and slave:test.t4 +include/diff_tables.inc [master:t4, slave:t4] ### assertion: the slave replicated event successfully and tables match for t3 -Comparing tables master:test.t3 and slave:test.t3 +include/diff_tables.inc [master:t3, slave:t3] ### assertion: the slave replicated event successfully and tables match for t2 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] ### assertion: the slave replicated event successfully and tables match for t1 -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ### assertion: check that binlog is not corrupt. Using mysqlbinlog to ### detect failure. Before the patch mysqlbinlog would find ### a corrupted event, thence would fail. +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_trig001.result b/mysql-test/suite/rpl/r/rpl_row_trig001.result index ea0ef27fccd..d00da976d30 100644 --- a/mysql-test/suite/rpl/r/rpl_row_trig001.result +++ b/mysql-test/suite/rpl/r/rpl_row_trig001.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n)); CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n)); CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n)); @@ -29,3 +25,4 @@ DROP TRIGGER test.t3_bi_t2; DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_trig002.result b/mysql-test/suite/rpl/r/rpl_row_trig002.result index 794104db750..b0be0316bf2 100644 --- a/mysql-test/suite/rpl/r/rpl_row_trig002.result +++ b/mysql-test/suite/rpl/r/rpl_row_trig002.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TRIGGER test.t2_ai; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; @@ -67,3 +63,4 @@ DROP TRIGGER test.t2_ai; DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_trig003.result b/mysql-test/suite/rpl/r/rpl_row_trig003.result index 43c2ecde2b4..68552ede1c0 100644 --- a/mysql-test/suite/rpl/r/rpl_row_trig003.result +++ b/mysql-test/suite/rpl/r/rpl_row_trig003.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TRIGGER test.t1_bi; DROP TRIGGER test.t2_ai; DROP TRIGGER test.t1_bu; @@ -81,3 +77,4 @@ DROP TRIGGER test.t2_ad; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_trig004.result b/mysql-test/suite/rpl/r/rpl_row_trig004.result index d0d0657f875..50317b55e2e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_trig004.result +++ b/mysql-test/suite/rpl/r/rpl_row_trig004.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TRIGGER test.t1_bi_t2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; @@ -28,3 +24,4 @@ n f DROP TRIGGER test.t1_bi_t2; DROP TABLE test.t1; DROP TABLE test.t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_trunc_temp.result b/mysql-test/suite/rpl/r/rpl_row_trunc_temp.result index f9181be9bc0..d3b892326ac 100644 --- a/mysql-test/suite/rpl/r/rpl_row_trunc_temp.result +++ b/mysql-test/suite/rpl/r/rpl_row_trunc_temp.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TEMPORARY TABLE t1(c1 INTEGER); CREATE TABLE t2(c1 INTEGER); CREATE TABLE t1(c1 INTEGER); @@ -27,3 +23,4 @@ SELECT * FROM t2; c1 DROP TABLE t1; DROP TABLE t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result b/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result index 800670b78ae..b9ae1893629 100644 --- a/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result +++ b/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (a INT); CREATE TABLE t2 (a INT, b INT); INSERT INTO t1 SELECT 1; @@ -20,3 +16,4 @@ b 1 3 DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result index 81aeb0d645b..5629f5c8cdd 100644 --- a/mysql-test/suite/rpl/r/rpl_row_until.result +++ b/mysql-test/suite/rpl/r/rpl_row_until.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); INSERT INTO t1 VALUES (1),(2),(3),(4); DROP TABLE t1; @@ -14,27 +10,37 @@ DROP TABLE t2; include/stop_slave.inc RESET SLAVE; START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1 +include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; n 1 2 3 4 +include/check_slave_param.inc [Exec_Master_Log_Pos] START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; +include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; n 1 2 3 4 +include/check_slave_param.inc [Exec_Master_Log_Pos] START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2 +include/wait_for_slave_sql_to_stop.inc SELECT * FROM t2; n 1 2 +include/check_slave_param.inc [Exec_Master_Log_Pos] START SLAVE; +include/wait_for_slave_to_start.inc include/stop_slave.inc START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2 +include/wait_for_slave_param.inc [Until_Log_Pos] +include/wait_for_slave_sql_to_stop.inc +include/check_slave_param.inc [Exec_Master_Log_Pos] START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=MASTER_LOG_POS; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS, RELAY_LOG_POS=RELAY_LOG_POS; @@ -49,3 +55,6 @@ START SLAVE; START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; Warnings: Note 1254 Slave is already running +include/stop_slave.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_view01.result b/mysql-test/suite/rpl/r/rpl_row_view01.result index 4dfe5826f32..471de20ea6d 100644 --- a/mysql-test/suite/rpl/r/rpl_row_view01.result +++ b/mysql-test/suite/rpl/r/rpl_row_view01.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create database if not exists mysqltest1; DROP VIEW IF EXISTS mysqltest1.v1; DROP VIEW IF EXISTS mysqltest1.v2; @@ -102,3 +98,4 @@ DROP TABLE IF EXISTS mysqltest1.t2; DROP TABLE IF EXISTS mysqltest1.t4; DROP TABLE IF EXISTS mysqltest1.t10; DROP DATABASE mysqltest1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_wide_table.result b/mysql-test/suite/rpl/r/rpl_row_wide_table.result index da96e84d1d5..f469a13837c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_wide_table.result +++ b/mysql-test/suite/rpl/r/rpl_row_wide_table.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t300; create table t300 ( f1 int, @@ -316,3 +312,4 @@ one 1 *** Cleanup *** DROP TABLE t300; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_server_id.result b/mysql-test/suite/rpl/r/rpl_server_id.result deleted file mode 100644 index 1e74394c122..00000000000 --- a/mysql-test/suite/rpl/r/rpl_server_id.result +++ /dev/null @@ -1,34 +0,0 @@ -set global server_id=1; -reset master; -drop table if exists t1,t2,t3; -create table t1 (a int); -select @@server_id; -@@server_id -1 -show binlog events from <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; drop table if exists t1,t2,t3 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) -set global server_id=2; -create table t2 (b int); -select @@server_id; -@@server_id -2 -show binlog events from <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; drop table if exists t1,t2,t3 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) -master-bin.000001 # Query 2 # use `test`; create table t2 (b int) -set global server_id=3; -create table t3 (c int); -select @@server_id; -@@server_id -3 -show binlog events from <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; drop table if exists t1,t2,t3 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) -master-bin.000001 # Query 2 # use `test`; create table t2 (b int) -master-bin.000001 # Query 3 # use `test`; create table t3 (c int) -set global server_id=1; -drop table t1,t2,t3; diff --git a/mysql-test/suite/rpl/r/rpl_server_id1.result b/mysql-test/suite/rpl/r/rpl_server_id1.result index 76f187e3b01..80e5bbae146 100644 --- a/mysql-test/suite/rpl/r/rpl_server_id1.result +++ b/mysql-test/suite/rpl/r/rpl_server_id1.result @@ -1,13 +1,7 @@ -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; -reset master; -include/stop_slave.inc -change master to master_port=SLAVE_PORT; -start slave; -*** must be having the replicate-same-server-id IO thread error *** -Slave_IO_Errno= 1593 -Slave_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). +include/rpl_init.inc [topology=2->2] +START SLAVE; +include/wait_for_slave_io_error.inc [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).' +include/stop_slave_sql.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_server_id2.result b/mysql-test/suite/rpl/r/rpl_server_id2.result index bb5a175fbfe..dacb69bc7cb 100644 --- a/mysql-test/suite/rpl/r/rpl_server_id2.result +++ b/mysql-test/suite/rpl/r/rpl_server_id2.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (n int); reset master; stop slave; @@ -21,6 +17,8 @@ create table t1(n int); create table t2(n int); change master to master_port=MASTER_PORT; start slave until master_log_file='master-bin.000001', master_log_pos=UNTIL_POS; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_stop.inc *** checking until postion execution: must be only t1 in the list *** show tables; Tables_in_test @@ -28,3 +26,4 @@ t1 start slave sql_thread; drop table t1; drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_session_var.result b/mysql-test/suite/rpl/r/rpl_session_var.result index 297a18a5931..030ae161b22 100644 --- a/mysql-test/suite/rpl/r/rpl_session_var.result +++ b/mysql-test/suite/rpl/r/rpl_session_var.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1; Warnings: Note 1051 Unknown table 't1' @@ -51,3 +47,4 @@ SELECT length(data) < 100 FROM t1; length(data) < 100 1 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_set_charset.result b/mysql-test/suite/rpl/r/rpl_set_charset.result index 480d926fbba..fa30a361d13 100644 --- a/mysql-test/suite/rpl/r/rpl_set_charset.result +++ b/mysql-test/suite/rpl/r/rpl_set_charset.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1 /*!40100 character set latin2 */; use mysqltest1; @@ -46,3 +42,4 @@ D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF D0 E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF E0 F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF F0 drop database mysqltest1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_set_null_innodb.result b/mysql-test/suite/rpl/r/rpl_set_null_innodb.result index 41600a5fe1b..f099b2b7691 100644 --- a/mysql-test/suite/rpl/r/rpl_set_null_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_set_null_innodb.result @@ -1,35 +1,22 @@ -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; -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; +include/master-slave.inc +[connection master] +include/rpl_reset.inc CREATE TABLE t1 (c1 BIT, c2 INT) Engine=InnoDB; INSERT INTO `t1` VALUES ( 1, 1 ); UPDATE t1 SET c1=NULL where c2=1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DELETE FROM t1 WHERE c2=1 LIMIT 1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 CHAR) Engine=InnoDB; INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ; SELECT * FROM t1; c1 w UPDATE t1 SET c1=NULL WHERE c1='w'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DELETE FROM t1 LIMIT 2; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_set_null_myisam.result b/mysql-test/suite/rpl/r/rpl_set_null_myisam.result index cbd7010664a..5698be4ff0c 100644 --- a/mysql-test/suite/rpl/r/rpl_set_null_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_set_null_myisam.result @@ -1,35 +1,22 @@ -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; -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; +include/master-slave.inc +[connection master] +include/rpl_reset.inc CREATE TABLE t1 (c1 BIT, c2 INT) Engine=MyISAM; INSERT INTO `t1` VALUES ( 1, 1 ); UPDATE t1 SET c1=NULL where c2=1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DELETE FROM t1 WHERE c2=1 LIMIT 1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; -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; +include/rpl_reset.inc CREATE TABLE t1 (c1 CHAR) Engine=MyISAM; INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ; SELECT * FROM t1; c1 w UPDATE t1 SET c1=NULL WHERE c1='w'; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DELETE FROM t1 LIMIT 2; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_sf.result b/mysql-test/suite/rpl/r/rpl_sf.result deleted file mode 100644 index 085ba1ebb8a..00000000000 --- a/mysql-test/suite/rpl/r/rpl_sf.result +++ /dev/null @@ -1,68 +0,0 @@ -set global log_bin_trust_function_creators=0; -set binlog_format=STATEMENT; -create function fn16456() -returns int -begin -return unix_timestamp(); -end| -ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) -set global log_bin_trust_function_creators=1; -create function fn16456() -returns int -begin -return unix_timestamp(); -end| -set global log_bin_trust_function_creators=0; -set binlog_format=ROW; -select fn16456(); -fn16456() -timestamp -set binlog_format=STATEMENT; -select fn16456(); -ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) -drop function fn16456; -set global log_bin_trust_function_creators=0; -create function fn16456() -returns int deterministic -begin -return unix_timestamp(); -end| -set binlog_format=ROW; -select fn16456(); -fn16456() -timestamp -set binlog_format=STATEMENT; -select fn16456(); -fn16456() -timestamp -drop function fn16456; -set global log_bin_trust_function_creators=0; -create function fn16456() -returns int no sql -begin -return unix_timestamp(); -end| -set binlog_format=ROW; -select fn16456(); -fn16456() -timestamp -set binlog_format=STATEMENT; -select fn16456(); -fn16456() -timestamp -drop function fn16456; -set global log_bin_trust_function_creators=0; -create function fn16456() -returns int reads sql data -begin -return unix_timestamp(); -end| -set binlog_format=ROW; -select fn16456(); -fn16456() -timestamp -set binlog_format=STATEMENT; -select fn16456(); -fn16456() -timestamp -drop function fn16456; diff --git a/mysql-test/suite/rpl/r/rpl_show_slave_running.result b/mysql-test/suite/rpl/r/rpl_show_slave_running.result index 598762d5188..66958c67428 100644 --- a/mysql-test/suite/rpl/r/rpl_show_slave_running.result +++ b/mysql-test/suite/rpl/r/rpl_show_slave_running.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET DEBUG_SYNC= 'RESET'; include/stop_slave.inc set global debug= 'd,dbug.before_get_running_status_yes'; @@ -21,6 +17,7 @@ Slave_running OFF Slave_IO_Running= No Slave_SQL_Running= No SET DEBUG_SYNC='now SIGNAL signal.io_thread_let_running'; +include/wait_for_slave_param.inc [Slave_IO_Running] Slave_running, Slave_IO_Running, Slave_SQL_Running must be OFF YES NO in three following queries SHOW STATUS LIKE 'Slave_running'; Variable_name Value @@ -28,6 +25,7 @@ Slave_running OFF Slave_IO_Running= Yes Slave_SQL_Running= No start slave sql_thread; +include/wait_for_slave_sql_to_start.inc Slave_running, Slave_IO_Running, Slave_SQL_Running must be ON, YES, YES in three following queries SHOW STATUS LIKE 'Slave_running'; Variable_name Value @@ -37,3 +35,4 @@ Slave_SQL_Running= Yes set global debug= ''; SET DEBUG_SYNC= 'RESET'; End of tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_skip_error.result b/mysql-test/suite/rpl/r/rpl_skip_error.result index 0aa8069a38c..d46338fd5b0 100644 --- a/mysql-test/suite/rpl/r/rpl_skip_error.result +++ b/mysql-test/suite/rpl/r/rpl_skip_error.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Test Without sql_mode=strict_trans_tables ==== [on master] create table t1 (n int not null primary key); @@ -31,7 +27,7 @@ n 3 7 8 -Checking that both slave threads are running. +include/check_slave_is_running.inc ==== Clean Up ==== drop table t1; create table t1(a int primary key); @@ -46,7 +42,7 @@ select * from t1; a 1 2 -Checking that both slave threads are running. +include/check_slave_is_running.inc ==== Clean Up ==== drop table t1; ==== Using Innodb ==== @@ -112,3 +108,4 @@ UPDATE t2 SET id= id + 3, data = 2; ==== Clean Up ==== DROP TABLE t1; DROP TABLE t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result b/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result index eb3c4ef5978..25deb65fa0f 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result +++ b/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] *** Preparing data *** CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(10)) ENGINE=MyISAM; @@ -33,6 +29,7 @@ a b SELECT * FROM t3 ORDER BY a; a b 1 ZZ +include/wait_for_slave_sql_error.inc [errno=1146] SHOW TABLES LIKE 't%'; Tables_in_test (t%) t1 @@ -44,7 +41,7 @@ a b SELECT * FROM t2 ORDER BY a; a b 1 AA_for_row_or_YY_for_stmt_mixed -include/stop_slave.inc +include/stop_slave_io.inc RENAME TABLE t3_bak TO t3; include/start_slave.inc TRUNCATE t1; @@ -60,6 +57,7 @@ INSERT INTO t3 VALUES(2, 'B'); INSERT INTO t2 VALUES(2, 'B'); INSERT INTO t1 VALUES(2, 'B'); UPDATE t1 SET b = 'X' WHERE a = 2; +include/wait_for_slave_sql_error.inc [errno=1146] SELECT * FROM t1 ORDER BY a; a b 2 X @@ -78,7 +76,7 @@ SELECT * FROM t1 ORDER BY a; a b SELECT * FROM t2 ORDER BY a; a b -include/stop_slave.inc +include/stop_slave_io.inc RENAME TABLE t3_bak TO t3; include/start_slave.inc TRUNCATE t1; @@ -95,6 +93,7 @@ INSERT INTO t1 VALUES (3, 'C'), (4, 'D'); INSERT INTO t2 VALUES (3, 'C'), (4, 'D'); INSERT INTO t3 VALUES (3, 'C'), (4, 'D'); COMMIT; +include/wait_for_slave_sql_error.inc [errno=1146] SELECT * FROM t1 ORDER BY a; a b 3 C @@ -116,8 +115,9 @@ SELECT * FROM t1 ORDER BY a; a b SELECT * FROM t2 ORDER BY a; a b -include/stop_slave.inc +include/stop_slave_io.inc RENAME TABLE t3_bak TO t3; include/start_slave.inc *** Clean up *** DROP TABLE t1,t2,t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_in.result b/mysql-test/suite/rpl/r/rpl_slave_load_in.result index 2cc83fd0a19..504f6f60d9e 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_in.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_in.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int not null auto_increment, b int, primary key(a)); create table t2(a int not null auto_increment, b int, primary key(a)) engine=innodb; load data infile '../../std_data/rpl_loaddata.dat' into table t1; @@ -13,7 +9,8 @@ insert into t2(b) values (2); load data infile '../../std_data/rpl_loaddata.dat' into table t2; load data infile '../../std_data/rpl_loaddata.dat' into table t2; commit; -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] drop table t1; drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result index c3c4f7c015a..213ab06f0c1 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -1,15 +1,16 @@ -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; +include/master-slave.inc +[connection master] create table t1(a int not null auto_increment, b int, primary key(a)) engine=innodb; start transaction; insert into t1(b) values (1); insert into t1(b) values (2); load data infile '../../std_data/rpl_loaddata.dat' into table t1; commit; +include/wait_for_slave_sql_error.inc [errno=9] drop table t1; +include/sync_slave_io_with_master.inc +include/stop_slave_io.inc +RESET SLAVE; drop table t1; call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3"); +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result b/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result index 3ed14a9cb6b..8cd6218dcdc 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result @@ -1,6 +1,7 @@ -CHANGE MASTER TO MASTER_USER='root', -MASTER_CONNECT_RETRY=1, -MASTER_HOST='127.0.0.1', -MASTER_PORT=MASTER_MYPORT; +include/master-slave.inc +[connection master] START SLAVE; -12 +include/wait_for_slave_sql_error.inc [errno=12] +include/stop_slave_io.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_skip.result b/mysql-test/suite/rpl/r/rpl_slave_skip.result index a4067fb7983..e5fe33aed19 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_skip.result +++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] **** On Slave **** STOP SLAVE; **** On Master **** @@ -43,6 +39,9 @@ c d 3 18 **** On Slave **** START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; +include/wait_for_slave_sql_to_stop.inc +include/check_slave_param.inc [Exec_Master_Log_Pos] +include/check_slave_no_error.inc SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; SELECT * FROM t1; @@ -66,6 +65,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # User var # # @`foo`=12 master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(@foo, 2*@foo) START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; +include/wait_for_slave_sql_to_stop.inc SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; **** On Master **** @@ -279,3 +279,4 @@ include/start_slave.inc SELECT * FROM t10 ORDER BY a; a b DROP TABLE t10; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_status.result b/mysql-test/suite/rpl/r/rpl_slave_status.result index a98a81dc74f..cbd71002c04 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_status.result +++ b/mysql-test/suite/rpl/r/rpl_slave_status.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Create new replication user ==== [on master] GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl'; @@ -27,9 +23,11 @@ FLUSH PRIVILEGES; ==== Restart slave without privileges ===== include/stop_slave.inc START SLAVE; -==== Verify that Slave_IO_Running = No ==== -Slave_IO_Running = No (should be No) +include/wait_for_slave_sql_to_start.inc +==== Verify that Slave IO thread stopped with error ==== +include/wait_for_slave_io_error.inc [errno=1045] ==== Cleanup (Note that slave IO thread is not running) ==== -DROP TABLE t1; +include/rpl_reset.inc [on master] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slow_query_log.result b/mysql-test/suite/rpl/r/rpl_slow_query_log.result index a4479f0c544..46da59a583d 100644 --- a/mysql-test/suite/rpl/r/rpl_slow_query_log.result +++ b/mysql-test/suite/rpl/r/rpl_slow_query_log.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); include/stop_slave.inc SET @old_log_output= @@log_output; @@ -46,12 +42,7 @@ include/stop_slave.inc SET GLOBAL long_query_time= @old_long_query_time; SET GLOBAL log_output= @old_log_output; include/start_slave.inc -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; +include/rpl_reset.inc SET @old_log_output= @@log_output; SET GLOBAL log_output= 'TABLE'; SET GLOBAL long_query_time= 2; @@ -89,3 +80,4 @@ SET @@global.long_query_time= @old_long_query_time; DROP TABLE t1; SET @@global.log_output= @old_log_output; SET @@global.long_query_time= @old_long_query_time; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 8f06653f8ab..fc9c05ebc81 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1; use mysqltest1; @@ -989,3 +985,4 @@ drop procedure ` mysqltestbug36570_p2`; drop function mysqltestbug36570_f1; End of 5.0 tests End of 5.1 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_sp004.result b/mysql-test/suite/rpl/r/rpl_sp004.result index 1c0ed3cc50a..5b67d225490 100644 --- a/mysql-test/suite/rpl/r/rpl_sp004.result +++ b/mysql-test/suite/rpl/r/rpl_sp004.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t2; @@ -91,3 +87,4 @@ DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_sp_effects.result b/mysql-test/suite/rpl/r/rpl_sp_effects.result index d9cdfd81167..a6e3ae03963 100644 --- a/mysql-test/suite/rpl/r/rpl_sp_effects.result +++ b/mysql-test/suite/rpl/r/rpl_sp_effects.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; drop procedure if exists p1; drop procedure if exists p2; @@ -278,3 +274,4 @@ drop procedure sp_bug26199; drop function sf_bug26199; SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; end of the tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_sporadic_master.result b/mysql-test/suite/rpl/r/rpl_sporadic_master.result index 14fb673a081..e8278bf3744 100644 --- a/mysql-test/suite/rpl/r/rpl_sporadic_master.result +++ b/mysql-test/suite/rpl/r/rpl_sporadic_master.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t2(n int); create table t1(n int not null auto_increment primary key); insert into t1 values (NULL),(NULL); @@ -24,3 +20,4 @@ n 14 15 drop table t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ssl.result b/mysql-test/suite/rpl/r/rpl_ssl.result index 1af4c5e227c..35aaabc8c56 100644 --- a/mysql-test/suite/rpl/r/rpl_ssl.result +++ b/mysql-test/suite/rpl/r/rpl_ssl.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] grant replication slave on *.* to replssl@localhost require ssl; create table t1 (t int auto_increment, KEY(t)); stop slave; @@ -19,23 +15,32 @@ insert into t1 values(1); select * from t1; t 1 -Master_SSL_Allowed Yes -Master_SSL_CA_Path -Master_SSL_CA_File 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 -Checking that both slave threads are running. +Master_SSL_Allowed = 'Yes' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = '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' +include/check_slave_is_running.inc STOP SLAVE; select * from t1; t 1 insert into t1 values (NULL); -Master_SSL_Allowed Yes -Master_SSL_CA_Path -Master_SSL_CA_File 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 -Checking that both slave threads are running. +include/wait_for_slave_to_start.inc +Master_SSL_Allowed = 'Yes' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = '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' +include/check_slave_is_running.inc drop user replssl@localhost; drop table t1; +include/stop_slave.inc +CHANGE MASTER TO +master_user = 'root', +master_ssl = 0, +master_ssl_ca = '', +master_ssl_cert = '', +master_ssl_key = ''; End of 5.0 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_ssl1.result b/mysql-test/suite/rpl/r/rpl_ssl1.result index 5b4aa126c77..5e1614f5aac 100644 --- a/mysql-test/suite/rpl/r/rpl_ssl1.result +++ b/mysql-test/suite/rpl/r/rpl_ssl1.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] grant replication slave on *.* to replssl@localhost require ssl; create table t1 (t int); stop slave; @@ -18,23 +14,23 @@ start slave; select * from t1; t 1 -Master_SSL_Allowed Yes -Master_SSL_CA_Path -Master_SSL_CA_File 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 -Checking that both slave threads are running. +Master_SSL_Allowed = 'Yes' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = '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' +include/check_slave_is_running.inc stop slave; change master to master_user='root',master_password='', master_ssl=0; start slave; drop user replssl@localhost; drop table t1; -Master_SSL_Allowed No -Master_SSL_CA_Path -Master_SSL_CA_File 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 -Checking that both slave threads are running. +Master_SSL_Allowed = 'No' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = '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' +include/check_slave_is_running.inc stop slave; change master to master_host="localhost", @@ -50,10 +46,19 @@ on slave select * from t1; t 1 -Master_SSL_Allowed Yes -Master_SSL_CA_Path -Master_SSL_CA_File 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 -Checking that both slave threads are running. +Master_SSL_Allowed = 'Yes' +Master_SSL_CA_Path = '' +Master_SSL_CA_File = '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' +include/check_slave_is_running.inc drop table t1; +include/stop_slave.inc +CHANGE MASTER TO +master_host="127.0.0.1", +master_ssl_ca ='', +master_ssl_cert='', +master_ssl_key='', +master_ssl_verify_server_cert=0, +master_ssl=0; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_start_stop_slave.result b/mysql-test/suite/rpl/r/rpl_start_stop_slave.result index e2b1935c268..ee667771ef0 100644 --- a/mysql-test/suite/rpl/r/rpl_start_stop_slave.result +++ b/mysql-test/suite/rpl/r/rpl_start_stop_slave.result @@ -1,14 +1,11 @@ -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; +include/master-slave.inc +[connection master] create table t1(n int); stop slave; start slave; stop slave io_thread; start slave io_thread; +include/wait_for_slave_to_start.inc drop table t1; create table t1i(n int primary key) engine=innodb; create table t2m(n int primary key) engine=myisam; @@ -28,6 +25,7 @@ zero 0 stop slave; rollback; +include/wait_for_slave_to_stop.inc *** sql thread is *not* running: No *** *** the prove: the stopped slave has finished the current transaction *** five @@ -38,3 +36,4 @@ one 1 include/start_slave.inc drop table t1i, t2m; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_000001.result b/mysql-test/suite/rpl/r/rpl_stm_000001.result index 2a5e4bdc99f..3a67772d11a 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_000001.result +++ b/mysql-test/suite/rpl/r/rpl_stm_000001.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression("Statement may not be safe to log in statement format."); create table t1 (word char(20) not null); load data infile '../../std_data/words.dat' into table t1; @@ -52,8 +48,7 @@ select (@id := id) - id from t2; kill @id; drop table t2; Got one of the listed errors -set global sql_slave_skip_counter=1; -start slave; +include/wait_for_slave_sql_error_and_skip.inc [errno=1053] select count(*) from t1; count(*) 5000 @@ -82,3 +77,4 @@ select_priv user Y blafasel2 drop table t1; delete from mysql.user where user="blafasel2"; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result index e69952787fb..0e83f1dfb67 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result +++ b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int, unique(a)) engine=myisam; set sql_log_bin=0; insert into t1 values(2); @@ -11,6 +7,10 @@ set sql_log_bin=1; insert into t1 values(1),(2); ERROR 23000: Duplicate entry '2' for key 'a' drop table t1; -Error: "Query caused different errors on master and slave. Error on master: 'Duplicate entry '%-.192s' for key %d' (1062), Error on slave: 'no error' (0). Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave) +include/wait_for_slave_sql_to_stop.inc +Error: "Query caused different errors on master and slave. Error on master: message (format)='Duplicate entry '%-.192s' for key %d' error code=1062 ; Error on slave: actual message='no error', error code=0. Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave) Errno: "0" (expected 0) drop table t1; +include/stop_slave.inc +RESET SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result b/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result index 2f6e98d5eec..2b974d0d98c 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result +++ b/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP TABLE IF EXISTS t1, t2; DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p2; @@ -167,3 +163,4 @@ DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p2; DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_binlog_direct.result b/mysql-test/suite/rpl/r/rpl_stm_binlog_direct.result index 818e383e2f1..8fdac1a5c97 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_binlog_direct.result +++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_direct.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set @@session.binlog_direct_non_transactional_updates= TRUE; ######################################################################### # CONFIGURATION @@ -1358,3 +1354,4 @@ master-bin.000001 # Query # # ROLLBACK ################################################################################### # CLEAN ################################################################################### +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result index b0df9516b7c..b56297a5487 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result +++ b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialize ==== [on master] CREATE TABLE t1(a INT PRIMARY KEY); @@ -19,6 +15,7 @@ a 1 [on slave] ---- Wait until slave stops with an error ---- +include/wait_for_slave_sql_error.inc [errno=1062] Last_SQL_Error = Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (1)' (expected "duplicate key" error) SELECT * FROM t1; a @@ -26,6 +23,7 @@ a ---- Resolve the conflict on the slave and restart SQL thread ---- DELETE FROM t1 WHERE a = 1; START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc ---- Sync slave and verify that there is no error ---- Last_SQL_Error = '' (expected no error) SELECT * FROM t1; @@ -52,3 +50,4 @@ a [on master] DROP TABLE t1; [on slave] +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_create_if_not_exists.result b/mysql-test/suite/rpl/r/rpl_stm_create_if_not_exists.result index 9ae1ef315b6..d833852e193 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_create_if_not_exists.result +++ b/mysql-test/suite/rpl/r/rpl_stm_create_if_not_exists.result @@ -1,12 +1,8 @@ # WL#5370 Keep forward-compatibility when changing 'CREATE TABLE IF NOT # EXISTS ... SELECT' behaviour # -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; +include/master-slave.inc +[connection master] CREATE TABLE t2(c1 INT, c2 char(10)); @@ -21,7 +17,7 @@ show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS t1 (c1 INT , c2 INT, c3 char(10), c4 INT KEY) SELECT 'abc' AS c3, 1 AS c4 -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # The statement should be binlogged as two events. one is # 'CREATE TABLE IF NOT EXISTS ..', another one is @@ -44,7 +40,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`t1` (`c3`,`c4`) SELECT 'abc', 2 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Verify if it can be binlogged with right database name when the table # is not in the default database @@ -68,7 +64,7 @@ master-bin.000001 # Query # # use `db1`; CREATE TABLE IF NOT EXISTS `test`.`t1` ) master-bin.000001 # Query # # use `db1`; INSERT INTO `test`.`t1` (`c3`,`c4`) SELECT 'abc', 20 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:test.t1,slave:test.t1] USE test; DROP DATABASE db1; @@ -91,7 +87,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; REPLACE INTO `test`.`t1` (`c3`,`c4`) SELECT '123', 2 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # It should be binlogged as 'INSERT IGNORE... SELECT' # if the original statement has option IGNORE @@ -112,7 +108,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT IGNORE INTO `test`.`t1` (`c3`,`c4`) SELECT '123', 2 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Nothing should be binlogged if error happens and no any row is inserted @@ -121,7 +117,7 @@ SELECT '123', 2; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Verify it can binlog well when there are some braces('(') @@ -169,7 +165,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT IGNORE INTO `test`.`t1` (`c3`,`c4`) (SELECT '123', 3) UNION (SELECT '123', 4) master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # Throw a warning that table already exists and don't insert anything @@ -215,7 +211,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`t1` (`c3`,`c4`) SELECT '123', NAME_CONST('a',600) master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] DROP PROCEDURE p1; # The statement can be binlogged correctly when it is in a prepared statement @@ -251,7 +247,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`t1` (`c3`,`c4`) SELECT '123', 800 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] # The statement can be binlogged correctly when it is in a conditional comment @@ -362,7 +358,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t1` ( ) master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`t1` (`c3`,`c4`) SELECT 'abc', 905 master-bin.000001 # Query # # COMMIT -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1,slave:t1] DROP TABLE t2; DROP TABLE t1; @@ -702,3 +698,4 @@ master-bin.000001 # Query # # use `test`; INSERT INTO `test`.`t1` (`c3`,`c4`) SE master-bin.000001 # Query # # COMMIT DROP TABLE t2; DROP TEMPORARY TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result index fe2fb1d9da2..96d2a337e7c 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t1 (a int) ENGINE=MyISAM; insert into t1 values (10); create table t2 (a int) ENGINE=MyISAM; @@ -21,10 +17,13 @@ flush tables; select * from t3; a stop slave; +include/wait_for_slave_to_stop.inc drop table t1; flush tables with read lock; start slave; +include/wait_for_slave_to_start.inc stop slave; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction unlock tables; drop table t3, t4, t5; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result index 1c24b2ca15b..11767db5804 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result +++ b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set @old_global_binlog_format = @@global.binlog_format; set @@global.binlog_format = statement; CREATE SCHEMA IF NOT EXISTS mysqlslap; @@ -128,3 +124,4 @@ FLUSH LOGS; FLUSH LOGS; End of 5.0 tests set @@global.binlog_format = @old_global_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_loadfile.result b/mysql-test/suite/rpl/r/rpl_stm_loadfile.result index ca76695f4d4..b49f44273ff 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_loadfile.result +++ b/mysql-test/suite/rpl/r/rpl_stm_loadfile.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); @@ -229,3 +225,4 @@ aberration DROP PROCEDURE IF EXISTS test.p1; DROP TABLE test.t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result index d73a689969f..4eeec6584fd 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_log.result +++ b/mysql-test/suite/rpl/r/rpl_stm_log.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] include/stop_slave.inc reset master; reset slave; @@ -222,18 +218,13 @@ show binlog events in 'slave-bin.000002' from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM slave-bin.000002 # Query # # use `test`; insert into t2 values (1) -Checking that both slave threads are running. +include/check_slave_is_running.inc 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; DROP TABLE t2; DROP TABLE t3; -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; +include/rpl_reset.inc create table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); set insert_id=5; @@ -252,3 +243,4 @@ a b 5 1 6 1 drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_maria.result b/mysql-test/suite/rpl/r/rpl_stm_maria.result index 1fe1fd87349..8c6ce997f2d 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_maria.result +++ b/mysql-test/suite/rpl/r/rpl_stm_maria.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression('Statement may not be safe to log in statement format.'); DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; @@ -50,3 +46,4 @@ a name old_a old_b truncate(rand_value,4) 106 t2 5 0 0.6699 107 t2 500 0 0.3593 drop table t1,t2,t3; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result index db06cb6d3de..871d3218b70 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result +++ b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] stop slave; # # Generate a big enough master's binlog to cause relay log rotations @@ -21,7 +17,7 @@ select @@global.max_relay_log_size; @@global.max_relay_log_size 4096 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 2 # @@ -31,7 +27,7 @@ set global max_relay_log_size=(5*4096); select @@global.max_relay_log_size; @@global.max_relay_log_size 20480 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 3: max_relay_log_size = 0 # @@ -41,7 +37,7 @@ set global max_relay_log_size=0; select @@global.max_relay_log_size; @@global.max_relay_log_size 0 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions # @@ -55,13 +51,13 @@ reset slave; start slave; flush logs; create table t1 (a int); -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated # flush logs; drop table t1; -Checking that both slave threads are running. +include/check_slave_is_running.inc flush logs; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB @@ -70,3 +66,4 @@ set global max_binlog_size= @my_max_binlog_size; # # End of 4.1 tests # +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result index 2ecaf2c90ae..ee4c710ecd2 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ################################################################################### # CONFIGURATION ################################################################################### @@ -868,12 +864,7 @@ DROP TABLE nt_4; DROP PROCEDURE pc_i_tt_3; DROP FUNCTION f1; DROP FUNCTION f2; -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; +include/rpl_reset.inc CREATE TABLE `t1` ( `c1` int(10) unsigned NOT NULL AUTO_INCREMENT, `c2` tinyint(1) unsigned DEFAULT NULL, @@ -887,5 +878,6 @@ INSERT INTO t1 (c1,c2,c3,c4,c5) VALUES (1, 1, 'X', 1, NULL); COMMIT; ROLLBACK; SET AUTOCOMMIT=1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE `t1`; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_multi_query.result b/mysql-test/suite/rpl/r/rpl_stm_multi_query.result index 625c686f383..0b4d179f385 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_multi_query.result +++ b/mysql-test/suite/rpl/r/rpl_stm_multi_query.result @@ -1,10 +1,5 @@ -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; -drop database if exists mysqltest; +include/master-slave.inc +[connection master] create database mysqltest; create table mysqltest.t1 ( n int); insert into mysqltest.t1 values(1)/ @@ -21,7 +16,6 @@ n 5 show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # drop database if exists mysqltest master-bin.000001 # Query # # create database mysqltest master-bin.000001 # Query # # use `test`; create table mysqltest.t1 ( n int) master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(1) @@ -30,3 +24,4 @@ master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(3) master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(4) master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(5) drop database mysqltest; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_no_op.result b/mysql-test/suite/rpl/r/rpl_stm_no_op.result index 5a253d61fcb..cf5b03cdfa6 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_no_op.result +++ b/mysql-test/suite/rpl/r/rpl_stm_no_op.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create database mysqltest; drop database if exists mysqltest; Warnings: @@ -50,3 +46,4 @@ a b select * from t2; a b drop table t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result index 1fc189975ef..c263e27a11f 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result +++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result @@ -1,21 +1,17 @@ -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; -Master_User root -Master_Host 127.0.0.1 +include/master-slave.inc +[connection master] +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc change master to master_user='test'; -Master_User test -Master_Host 127.0.0.1 +Master_User = 'test' +Master_Host = '127.0.0.1' reset slave; -Master_User root -Master_Host 127.0.0.1 +Master_User = 'root' +Master_Host = '127.0.0.1' include/start_slave.inc -Master_User root -Master_Host 127.0.0.1 +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc reset slave; include/start_slave.inc @@ -28,13 +24,19 @@ Variable_name Value Slave_open_temp_tables 1 include/stop_slave.inc reset slave; +include/check_slave_no_error.inc change master to master_user='impossible_user_name'; start slave; -include/stop_slave.inc +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc change master to master_user='root'; include/start_slave.inc +include/check_slave_no_error.inc include/stop_slave.inc change master to master_user='impossible_user_name'; start slave; -include/stop_slave.inc +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc reset slave; +include/check_slave_no_error.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_sql_mode.result b/mysql-test/suite/rpl/r/rpl_stm_sql_mode.result index fd143fc8a50..fa5ac2a0c85 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_sql_mode.result +++ b/mysql-test/suite/rpl/r/rpl_stm_sql_mode.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TABLE t1 (pk integer auto_increment , primary key (pk)); SET SESSION SQL_MODE='traditional'; # **** [MASTER] ***** @@ -16,3 +12,4 @@ DROP TABLE t1; # assertion: sync slave with master makes slave not to stop with # duplicate key error (because it has received event # with expected error code). +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result index 0094c143e38..72495831f6e 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_until.result +++ b/mysql-test/suite/rpl/r/rpl_stm_until.result @@ -1,9 +1,6 @@ -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; +include/master-slave.inc +[connection master] +include/rpl_reset.inc [on slave] include/stop_slave.inc ==== Create some events on master ==== @@ -18,29 +15,41 @@ drop table t2; ==== Replicate one event at a time on slave ==== [on slave] start slave until master_log_file='MASTER_LOG_FILE', master_log_pos=MASTER_LOG_POS; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_stop.inc select * from t1; n 1 2 3 4 +include/check_slave_param.inc [Exec_Master_Log_Pos] start slave until master_log_file='master-no-such-bin.000001', master_log_pos=MASTER_LOG_POS; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_stop.inc select * from t1; n 1 2 3 4 +include/check_slave_param.inc [Exec_Master_Log_Pos] start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=RELAY_LOG_POS; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_stop.inc select * from t2; n 1 2 +include/check_slave_param.inc [Exec_Master_Log_Pos] start slave; [on master] [on slave] include/stop_slave.inc start slave until master_log_file='MASTER_LOG_FILE', master_log_pos=MASTER_LOG_POS; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_stop.inc +include/check_slave_param.inc [Exec_Master_Log_Pos] ==== Test various error conditions ==== start slave until master_log_file='master-bin', master_log_pos=MASTER_LOG_POS; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL @@ -75,6 +84,7 @@ select count(*) as two from t1; two 2 start slave until master_log_file='MASTER_LOG_FILE', master_log_pos= UNTIL_POS;; +include/wait_for_slave_sql_to_stop.inc slave stopped at the prescribed position select 0 as zero; zero @@ -84,24 +94,17 @@ one 1 drop table t1; start slave; -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; +include/rpl_reset.inc drop table if exists t1; -Warnings: -Note 1051 Unknown table 't1' stop slave; flush logs; flush logs; reset slave; start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */; +include/wait_for_slave_sql_to_stop.inc show tables /* t1 must exist */; Tables_in_test t1 drop table t1; stop slave; -reset slave; -reset master; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stop_slave.result index 4e16e8264f6..38b85f0d30d 100644 --- a/mysql-test/suite/rpl/r/rpl_stop_slave.result +++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] # BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends # @@ -42,10 +38,12 @@ SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; [ On Slave ] +include/wait_for_slave_sql_to_stop.inc # Slave should stop after the transaction has committed. # So t1 on master is same to t1 on slave. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc # CREATE TEMPORARY TABLE with MyISAM engine # ----------------------------------------- @@ -68,10 +66,12 @@ SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; [ On Slave ] +include/wait_for_slave_sql_to_stop.inc # Slave should stop after the transaction has committed. # So t1 on master is same to t1 on slave. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc # CREATE TEMPORARY TABLE ... SELECT with InnoDB engine # ---------------------------------------------------- @@ -95,10 +95,12 @@ SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; [ On Slave ] +include/wait_for_slave_sql_to_stop.inc # Slave should stop after the transaction has committed. # So t1 on master is same to t1 on slave. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc # CREATE TEMPORARY TABLE ... SELECT with MyISAM engine # ---------------------------------------------------- @@ -122,10 +124,13 @@ SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; SET DEBUG_SYNC= 'RESET'; [ On Slave ] +include/wait_for_slave_sql_to_stop.inc # Slave should stop after the transaction has committed. # So t1 on master is same to t1 on slave. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc # Test end SET GLOBAL debug= '$debug_save'; DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result index 1f9f940df01..bd3d170c9f0 100644 --- a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; create database mysqltest1; use mysqltest1; @@ -427,3 +423,4 @@ INSERT INTO t13 VALUES (CURRENT_USER()); INSERT INTO t13 VALUES (my_current_user()); drop database mysqltest1; set global binlog_format =@my_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_table_options.result b/mysql-test/suite/rpl/r/rpl_table_options.result index 9b0511f6494..423a2b65583 100644 --- a/mysql-test/suite/rpl/r/rpl_table_options.result +++ b/mysql-test/suite/rpl/r/rpl_table_options.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] install plugin example soname 'ha_example.so'; set storage_engine=example; create table t1 (a int not null) ull=12340; @@ -23,3 +19,4 @@ select 1; 1 1 uninstall plugin example; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_temp_table.result b/mysql-test/suite/rpl/r/rpl_temp_table.result index e4ca31d8908..e7df070874a 100644 --- a/mysql-test/suite/rpl/r/rpl_temp_table.result +++ b/mysql-test/suite/rpl/r/rpl_temp_table.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create table t2 (n int, PRIMARY KEY(n)); create temporary table t1 (n int); create temporary table t3 (n int not null); @@ -46,3 +42,4 @@ Slave_open_temp_tables 0 drop table if exists t1,t2; Warnings: Note 1051 Unknown table 't1' +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result index 32c6748f5cb..9cd7a50273a 100644 --- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result +++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialize ==== [on master] CREATE TABLE t1 (a CHAR(48)); @@ -15,6 +11,7 @@ SHOW STATUS LIKE "Slave_open_temp_tables"; Variable_name Value Slave_open_temp_tables 1 [on master] +[on master1] [on slave] ==== Verify results on slave ==== SHOW STATUS LIKE "Slave_open_temp_tables"; @@ -22,14 +19,10 @@ Variable_name Value Slave_open_temp_tables 0 ==== Clean up ==== [on master] +include/rpl_connect.inc [creating master] DROP TABLE t1; [on slave] -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; +include/rpl_reset.inc CREATE TABLE t1 (a int); CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ); CREATE TABLE t3 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) ); @@ -110,6 +103,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT # Compare the base table. -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_temporary.result b/mysql-test/suite/rpl/r/rpl_temporary.result index 6319f92c925..d27ea93a824 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary.result +++ b/mysql-test/suite/rpl/r/rpl_temporary.result @@ -1,11 +1,7 @@ -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; SET sql_log_bin = 0; SET sql_log_bin = 1; +include/master-slave.inc +[connection master] reset master; DROP TABLE IF EXISTS t1; CREATE TEMPORARY TABLE t1 (a char(1)); @@ -130,8 +126,8 @@ select * from t1; a 1 drop table t1; -SET sql_log_bin = 0; -SET sql_log_bin = 1; +include/stop_slave.inc +include/rpl_reset.inc -- Bug#43748 -- make a user on the slave that can list but not kill system threads. FLUSH PRIVILEGES; @@ -143,5 +139,5 @@ KILL @id; Got one of the listed errors -- throw out test-user on slave. DROP USER user43748@127.0.0.1; --- done. back to master. End of 5.1 tests +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_temporary_errors.result b/mysql-test/suite/rpl/r/rpl_temporary_errors.result index 023f9a850ab..b7bbed328dd 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result +++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result @@ -1,10 +1,7 @@ -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; +include/master-slave.inc +[connection master] call mtr.add_suppression("Deadlock found"); +call mtr.add_suppression("Can't find record in 't.'"); **** On Master **** SET SESSION BINLOG_FORMAT=ROW; CREATE TABLE t1 (a INT PRIMARY KEY, b INT); @@ -40,12 +37,9 @@ a b 2 2 3 3 4 4 -Checking that both slave threads are running. -DROP TABLE t1; +include/check_slave_is_running.inc **** On Master **** -SET SQL_LOG_BIN= 0; DROP TABLE t1; -SET SQL_LOG_BIN= 1; SET SESSION BINLOG_FORMAT=MIXED; CREATE TABLE t_myisam (id INT, PRIMARY KEY (id)) engine= MyIsam; INSERT INTO t_myisam (id) VALUES(1); @@ -101,4 +95,4 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb(id) VALUES(1) master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb(id) VALUES(1) master-bin.000001 # Query # # ROLLBACK DROP TABLE t_myisam, t_innodb; -STOP SLAVE; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_test_framework.result b/mysql-test/suite/rpl/r/rpl_test_framework.result new file mode 100644 index 00000000000..e45c12ba0ec --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_test_framework.result @@ -0,0 +1,170 @@ +==== Create t1 on all servers. ==== +include/rpl_init.inc [topology=1->2->3->4->5->6->7->8->9] +CREATE TABLE t1 (a INT); +include/rpl_end.inc +==== Test 3-server topologies ==== +include/rpl_init.inc [topology=1 -> 2] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 12' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (1); +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (1); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=2 -> 3] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 23' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (2); +[connection server_2] +DELETE FROM t1; +INSERT INTO t1 VALUES (2); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=none] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= '' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (3); +[connection server_2] +DELETE FROM t1; +INSERT INTO t1 VALUES (3); +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (3); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->2, 2->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 212' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (4); +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (4); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->2->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 212' +[connection server_2] +DELETE FROM t1; +INSERT INTO t1 VALUES (5); +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (5); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=2->1->2] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 212' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (6); +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (6); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->2->3] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 123' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (7); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=2->3->2->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 323 21' +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (8); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->2,2->3,3->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 23123' +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (9); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->3->2->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 13213' +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (10); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1] +include/rpl_end.inc +==== Test 6-server topologies ==== +include/rpl_init.inc [topology=1->2->3->4->1->5->6] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 341234156' +[connection server_1] +DELETE FROM t1; +INSERT INTO t1 VALUES (11); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1,server_4:t1,server_5:t1,server_6:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=3->4->5->6->3->1->2] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 4563456 312' +[connection server_4] +DELETE FROM t1; +INSERT INTO t1 VALUES (12); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1,server_4:t1,server_5:t1,server_6:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=6->5->4->3->2->1] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 65 54 43 32 21' +[connection server_6] +DELETE FROM t1; +INSERT INTO t1 VALUES (13); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1,server_4:t1,server_5:t1,server_6:t1] +include/rpl_end.inc +include/rpl_init.inc [topology=1->2->3->1,4->5->6] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 456 23123' +[connection server_3] +DELETE FROM t1; +INSERT INTO t1 VALUES (14); +[connection server_4] +DELETE FROM t1; +INSERT INTO t1 VALUES (14); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1,server_4:t1,server_5:t1,server_6:t1] +include/rpl_end.inc +==== Test 9-server topology ==== +include/rpl_init.inc [topology=1->2, 2->3, 3->4, 4->5, 5->1, 1->6, 6->7, 6->8, 8->9] +include/rpl_generate_sync_chain.inc +rpl_sync_chain= ' 345123451689 67' +[connection server_2] +DELETE FROM t1; +INSERT INTO t1 VALUES (15); +include/rpl_sync.inc +include/diff_tables.inc [server_1:t1,server_2:t1,server_3:t1,server_4:t1,server_5:t1,server_6:t1,server_7:t1,server_8:t1,server_9:t1] +include/rpl_end.inc +==== Clean up ==== +include/rpl_init.inc [topology=1->2->3->4->5->6->7->8->9] +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_timezone.result b/mysql-test/suite/rpl/r/rpl_timezone.result index 0b5c03b5300..ce93c3030c0 100644 --- a/mysql-test/suite/rpl/r/rpl_timezone.result +++ b/mysql-test/suite/rpl/r/rpl_timezone.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set @my_time_zone= @@global.time_zone; set timestamp=100000000; create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n)); @@ -122,6 +118,7 @@ a b SET @@session.time_zone = default; DROP TABLE t1; SET @@session.time_zone = default; +include/stop_slave.inc reset master; CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL); SET @@session.time_zone='+01:00'; @@ -141,4 +138,5 @@ date a 2008-12-23 19:39:39 2 DROP TABLE t1; SET @@session.time_zone = default; +include/rpl_end.inc End of 5.0 tests diff --git a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result index 5729faa9659..682aa71d64c 100644 --- a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result +++ b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CREATE TEMPORARY TABLE t1 (a INT); CREATE TABLE t2 (a INT, b INT) ENGINE= MyISAM; INSERT INTO t1 VALUES (1); @@ -94,3 +90,4 @@ INSERT INTO t1 VALUES (1); DROP TABLE t2; INSERT INTO t1 VALUES (1); DROP TEMPORARY TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_trigger.result b/mysql-test/suite/rpl/r/rpl_trigger.result index 86534fa8f7d..24795378177 100644 --- a/mysql-test/suite/rpl/r/rpl_trigger.result +++ b/mysql-test/suite/rpl/r/rpl_trigger.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] CALL mtr.add_suppression("Statement may not be safe to log in statement format."); DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; @@ -863,8 +859,8 @@ drop table t21,t31; drop table t11; STOP SLAVE; FLUSH LOGS; ---> Stop master server ---> Start master server +include/rpl_stop_server.inc [server_number=1] +include/rpl_start_server.inc [server_number=1] --> Master binlog: Server ver: 5.0.16-debug-log, Binlog ver: 4 RESET SLAVE; START SLAVE; @@ -979,12 +975,7 @@ a b 2 b 3 c drop table t1; -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; +include/rpl_reset.inc create table t1 ( f int ) engine = innodb; create table log ( r int ) engine = myisam; create trigger tr @@ -995,6 +986,7 @@ insert into t1 values ( 1 ); rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -Comparing tables master:test.t1 and slave:test.t1 -Comparing tables master:test.log and slave:test.log +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:log, slave:log] drop table t1, log; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_trunc_temp.result b/mysql-test/suite/rpl/r/rpl_trunc_temp.result index 44624a38875..ae2c9973c9f 100644 --- a/mysql-test/suite/rpl/r/rpl_trunc_temp.result +++ b/mysql-test/suite/rpl/r/rpl_trunc_temp.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] create temporary table t1 (n int); insert into t1 values(1); show status like 'Slave_open_temp_tables'; @@ -20,3 +16,4 @@ Slave_open_temp_tables 1 show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result index 38fb9e27764..da8db64cef4 100644 --- a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result @@ -1,20 +1,12 @@ -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; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/master-slave.inc +[connection master] +include/rpl_reset.inc **** On Master **** CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,1), (2,2); **** On Master **** TRUNCATE TABLE t1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ==== Test using a table with delete triggers ==== **** On Master **** SET @count := 1; @@ -22,19 +14,15 @@ CREATE TABLE t2 (a INT, b LONG) ENGINE=MyISAM; CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1; **** On Master **** TRUNCATE TABLE t1; -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1,t2; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc **** On Master **** CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,1), (2,2); **** On Master **** DELETE FROM t1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ==== Test using a table with delete triggers ==== **** On Master **** SET @count := 1; @@ -42,5 +30,6 @@ CREATE TABLE t2 (a INT, b LONG) ENGINE=MyISAM; CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1; **** On Master **** DELETE FROM t1; -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result index b5e5936834d..d8a4443022d 100644 --- a/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result @@ -1,20 +1,12 @@ -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; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/master-slave.inc +[connection master] +include/rpl_reset.inc **** On Master **** CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,1), (2,2); **** On Master **** TRUNCATE TABLE t1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ==== Test using a table with delete triggers ==== **** On Master **** SET @count := 1; @@ -22,19 +14,15 @@ CREATE TABLE t2 (a INT, b LONG) ENGINE=InnoDB; CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1; **** On Master **** TRUNCATE TABLE t1; -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1,t2; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc **** On Master **** CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,1), (2,2); **** On Master **** DELETE FROM t1; -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] ==== Test using a table with delete triggers ==== **** On Master **** SET @count := 1; @@ -42,5 +30,6 @@ CREATE TABLE t2 (a INT, b LONG) ENGINE=InnoDB; CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1; **** On Master **** DELETE FROM t1; -Comparing tables master:test.t2 and slave:test.t2 +include/diff_tables.inc [master:t2, slave:t2] DROP TABLE t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_typeconv_innodb.result b/mysql-test/suite/rpl/r/rpl_typeconv_innodb.result index e3b8d6de12e..a5c55e43617 100644 --- a/mysql-test/suite/rpl/r/rpl_typeconv_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_typeconv_innodb.result @@ -1,15 +1,7 @@ -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; -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/master-slave.inc +[connection master] CREATE TABLE t1(b1 BIT(1), b2 BIT(2), b3 BIT(3)) ENGINE=InnoDB; INSERT INTO t1 VALUES (b'0', b'01', b'101'); -Comparing tables master:test.t1 and slave:test.t1 +include/diff_tables.inc [master:t1, slave:t1] DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_udf.result b/mysql-test/suite/rpl/r/rpl_udf.result index ccf16271d01..9f4c2b199ca 100644 --- a/mysql-test/suite/rpl/r/rpl_udf.result +++ b/mysql-test/suite/rpl/r/rpl_udf.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set binlog_format=row; drop table if exists t1; "*** Test 1) Test UDFs via loadable libraries *** @@ -316,3 +312,4 @@ affected rows: 0 "Running on the master" DROP TABLE t1; affected rows: 0 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_user.result b/mysql-test/suite/rpl/r/rpl_user.result index a98e7e9ca55..4ad87eb1ae7 100644 --- a/mysql-test/suite/rpl/r/rpl_user.result +++ b/mysql-test/suite/rpl/r/rpl_user.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] set session sql_log_bin=0; delete from mysql.user where Host='fakehost'; set session sql_log_bin=1; @@ -43,3 +39,4 @@ master-bin.000001 # Query # # use `test`; rename user 'foo'@'fakehost' to 'foofo master-bin.000001 # Query # # use `test`; rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'bar'@'fakehost' to 'barbar'@'fakehost' master-bin.000001 # Query # # use `test`; drop user 'foofoo'@'fakehost' master-bin.000001 # Query # # use `test`; drop user 'not_exist_user1'@'fakehost', 'barbar'@'fakehost' +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_user_variables.result b/mysql-test/suite/rpl/r/rpl_user_variables.result index 1f76eae3fce..e302ec0aceb 100644 --- a/mysql-test/suite/rpl/r/rpl_user_variables.result +++ b/mysql-test/suite/rpl/r/rpl_user_variables.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] reset master; create table t1(n char(30)); set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1; @@ -279,4 +275,4 @@ i DROP FUNCTION f1; DROP FUNCTION f2; DROP TABLE t1; -stop slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_variables.result b/mysql-test/suite/rpl/r/rpl_variables.result index b3108c75a6e..3724ff571b2 100644 --- a/mysql-test/suite/rpl/r/rpl_variables.result +++ b/mysql-test/suite/rpl/r/rpl_variables.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialization ==== [on master] SET @m_default_week_format= @@global.default_week_format; @@ -38,12 +34,7 @@ SET @@global.sql_mode = 'ALLOW_INVALID_DATES'; SET @@local.sql_mode = 'ANSI_QUOTES,ERROR_FOR_DIVISION_BY_ZERO,HIGH_NOT_PRECEDENCE'; SET @user_num = 10; SET @user_text = 'Alunda'; -[on master] -**** Resetting master and slave **** -include/stop_slave.inc -RESET SLAVE; -RESET MASTER; -include/start_slave.inc +include/rpl_reset.inc [on slave] SET @@global.init_slave = 'SELECT 1'; [on master] @@ -550,15 +541,7 @@ id truth num text 30 NULL 30 NULL 31 NULL NULL Bergsbrunna 32 NULL NULL Centrum -Comparing tables master:test.tstmt and master:test.tproc -Comparing tables master:test.tstmt and master:test.tfunc -Comparing tables master:test.tstmt and master:test.ttrig -Comparing tables master:test.tstmt and master:test.tprep -Comparing tables master:test.tstmt and slave:test.tstmt -Comparing tables master:test.tstmt and slave:test.tproc -Comparing tables master:test.tstmt and slave:test.tfunc -Comparing tables master:test.tstmt and slave:test.ttrig -Comparing tables master:test.tstmt and slave:test.tprep +include/diff_tables.inc [master:tstmt,tproc,tfunc,ttrig,tprep, slave:tstmt,tproc,tfunc,ttrig,tprep] ==== Clean up ==== [on master] DROP PROCEDURE proc; @@ -582,3 +565,4 @@ SET @@global.relay_log_purge= @s_relay_log_purge; SET @@global.slave_exec_mode= @s_slave_exec_mode; SET @@global.sql_mode= @s_sql_mode; SET @@global.sync_binlog= @s_sync_binlog; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_variables_stm.result b/mysql-test/suite/rpl/r/rpl_variables_stm.result index 51484187215..553a1710d77 100644 --- a/mysql-test/suite/rpl/r/rpl_variables_stm.result +++ b/mysql-test/suite/rpl/r/rpl_variables_stm.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] ==== Initialization ==== [on master] SET @m_pseudo_thread_id= @@global.pseudo_thread_id; @@ -490,15 +486,7 @@ id num text 56 NULL 47124712 57 NULL 1616 58 NULL 1717 -Comparing tables master:test.tstmt and master:test.tproc -Comparing tables master:test.tstmt and master:test.tfunc -Comparing tables master:test.tstmt and master:test.ttrig -Comparing tables master:test.tstmt and master:test.tprep -Comparing tables master:test.tstmt and slave:test.tstmt -Comparing tables master:test.tstmt and slave:test.tproc -Comparing tables master:test.tstmt and slave:test.tfunc -Comparing tables master:test.tstmt and slave:test.ttrig -Comparing tables master:test.tstmt and slave:test.tprep +include/diff_tables.inc [master:tstmt,tproc,tfunc,ttrig,tprep, slave:tstmt,tproc,tfunc,ttrig,tprep] ==== Clean up ==== [on master] DROP PROCEDURE proc; @@ -524,3 +512,4 @@ SET @@global.collation_server= @s_collation_server; SET @@global.time_zone= @s_time_zone; SET @@global.lc_time_names= @s_lc_time_names; SET @@global.collation_database= @s_collation_database; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_view.result b/mysql-test/suite/rpl/r/rpl_view.result index b129223b6d2..307b88ff6f9 100644 --- a/mysql-test/suite/rpl/r/rpl_view.result +++ b/mysql-test/suite/rpl/r/rpl_view.result @@ -1,9 +1,5 @@ -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; +include/master-slave.inc +[connection master] drop table if exists t1,v1; drop view if exists t1,v1; reset master; @@ -116,3 +112,4 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI DROP VIEW v1; DROP TABLE t1; End of 5.0 tests +include/rpl_end.inc |