diff options
Diffstat (limited to 'mysql-test/suite/rpl/t')
325 files changed, 2366 insertions, 1743 deletions
diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index d962394d91b..a45fdb47ae6 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -10,8 +10,8 @@ # ############################################################################## -rpl_failed_optimize : WL#4284: Can't optimize table used by a pending transaction (there is metadata lock on the table). -rpl_read_only : WL#4284: Setting Read only won't succeed until all metadata locks are released. -rpl_row_create_table : Bug#51574 2010-02-27 andrei failed different way than earlier with bug#45576 -rpl_spec_variables : BUG#47661 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux -rpl_log_pos : BUG#55675 Sep 10 2010 27 2010 alfranio rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle +rpl_row_create_table : Bug#11759274 2010-02-27 andrei failed different way than earlier with bug#45576 +rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux +rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock +rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out +rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.sh b/mysql-test/suite/rpl/t/rpl000017-slave.sh deleted file mode 100644 index 1d95798260a..00000000000 --- a/mysql-test/suite/rpl/t/rpl000017-slave.sh +++ /dev/null @@ -1,12 +0,0 @@ -rm -f $MYSQLTEST_VARDIR/log/*relay* -rm -f $MYSQLTEST_VARDIR/mysqld.2/data/relay-log.info -cat > $MYSQLTEST_VARDIR/mysqld.2/data/master.info <<EOF -master-bin.000001 -4 -127.0.0.1 -replicate -aaaaaaaaaaaaaaab -$MASTER_MYPORT -1 -0 -EOF diff --git a/mysql-test/suite/rpl/t/rpl000017.test b/mysql-test/suite/rpl/t/rpl000017.test deleted file mode 100644 index a65189657cc..00000000000 --- a/mysql-test/suite/rpl/t/rpl000017.test +++ /dev/null @@ -1,34 +0,0 @@ -# The test manually replaces the relay-log.info file with connection -# information which the slave then should pick up. However, to avoid -# overwriting the file, no CHANGE MASTER TO nor RESET SLAVE statements -# should be executed. -# -# Starting replication before granting a replication user privileges -# to replicate will cause the start slave to fail, so we shouldn't do -# that. - -let $no_change_master = 1; -let $skip_slave_start = 1; -source 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'; -connection slave; -start slave; -source include/wait_for_slave_to_start.inc; - -connection master; ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1(n int); -insert into t1 values(24); -sync_slave_with_master; -select * from t1; -connection master; -drop table t1; -delete from mysql.user where user="replicate"; -sync_slave_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl000010-slave.opt b/mysql-test/suite/rpl/t/rpl_000010-slave.opt index 0dbfb311e33..0dbfb311e33 100644 --- a/mysql-test/suite/rpl/t/rpl000010-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_000010-slave.opt diff --git a/mysql-test/suite/rpl/t/rpl000010.test b/mysql-test/suite/rpl/t/rpl_000010.test index a95cded6496..de6337dd723 100644 --- a/mysql-test/suite/rpl/t/rpl000010.test +++ b/mysql-test/suite/rpl/t/rpl_000010.test @@ -13,3 +13,4 @@ drop table t1; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl000011.test b/mysql-test/suite/rpl/t/rpl_000011.test index baff7c1a1b5..625b0c22c62 100644 --- a/mysql-test/suite/rpl/t/rpl000011.test +++ b/mysql-test/suite/rpl/t/rpl_000011.test @@ -17,3 +17,4 @@ drop table t1; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl000013.test b/mysql-test/suite/rpl/t/rpl_000013.test index 7f80252a9fc..9f1b06665dd 100644 --- a/mysql-test/suite/rpl/t/rpl000013.test +++ b/mysql-test/suite/rpl/t/rpl_000013.test @@ -9,8 +9,6 @@ --source include/have_binlog_format_mixed_or_statement.inc source include/master-slave.inc; -sync_slave_with_master; -connection master; --disable_query_log CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); @@ -52,6 +50,6 @@ connection master2; # exist in this connection. drop table if exists t1,t2; -sync_slave_with_master; +--source include/rpl_end.inc # End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_000017.test b/mysql-test/suite/rpl/t/rpl_000017.test new file mode 100644 index 00000000000..a34419c37c8 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_000017.test @@ -0,0 +1,48 @@ +# ==== Purpose ==== +# +# Unknown. +# +# ==== Notes ==== +# +# This test uses the -slave.opt file to start the slave with +# --skip-slave-start. + +--source include/not_windows.inc + +--let $rpl_skip_start_slave= 1 +--source include/master-slave.inc + +--connection slave +--let $slave_datadir= `SELECT @@datadir` + +--remove_file $slave_datadir/master.info +--write_file $slave_datadir/master.info +master-bin.000001 +4 +127.0.0.1 +replicate +aaaaaaaaaaaaaaab +$MASTER_MYPORT +1 +0 +EOF + +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'; +connection slave; +--source include/start_slave.inc + +connection master; +create table t1(n int); +insert into t1 values(24); +sync_slave_with_master; +select * from t1; +connection master; +drop table t1; +delete from mysql.user where user="replicate"; + +# End of 4.1 tests +--source include/rpl_end.inc + +--source include/force_restart.inc diff --git a/mysql-test/suite/rpl/t/rpl_EE_err.test b/mysql-test/suite/rpl/t/rpl_EE_err.test index 6d064ae3197..5272b11f342 100644 --- a/mysql-test/suite/rpl/t/rpl_EE_err.test +++ b/mysql-test/suite/rpl/t/rpl_EE_err.test @@ -1,7 +1,3 @@ -######################################################## -# By JBM 2006-02-14 Wrapped to share test code between # -# engines. Added to skip test when NDB is default # -######################################################## -- source include/not_ndb_default.inc let $engine_type=myisam; -- source extra/rpl_tests/rpl_EE_err.test diff --git a/mysql-test/suite/rpl/t/rpl_LD_INFILE.test b/mysql-test/suite/rpl/t/rpl_LD_INFILE.test index ae647ed6648..0f02bdccb60 100644 --- a/mysql-test/suite/rpl/t/rpl_LD_INFILE.test +++ b/mysql-test/suite/rpl/t/rpl_LD_INFILE.test @@ -36,3 +36,4 @@ sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_alter.test b/mysql-test/suite/rpl/t/rpl_alter.test index 6a6da9c9f24..630197f8637 100644 --- a/mysql-test/suite/rpl/t/rpl_alter.test +++ b/mysql-test/suite/rpl/t/rpl_alter.test @@ -1,7 +1,4 @@ source include/master-slave.inc; ---disable_warnings -drop database if exists mysqltest; ---enable_warnings create database mysqltest; create table mysqltest.t1 ( n int); @@ -18,3 +15,4 @@ drop database mysqltest; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_alter_db.test b/mysql-test/suite/rpl/t/rpl_alter_db.test index 341496350d7..f6f0782580f 100644 --- a/mysql-test/suite/rpl/t/rpl_alter_db.test +++ b/mysql-test/suite/rpl/t/rpl_alter_db.test @@ -12,3 +12,4 @@ sync_slave_with_master; connection master; drop database temp_db; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment.test b/mysql-test/suite/rpl/t/rpl_auto_increment.test index 19770ffbdc0..8869e3745db 100644 --- a/mysql-test/suite/rpl/t/rpl_auto_increment.test +++ b/mysql-test/suite/rpl/t/rpl_auto_increment.test @@ -1,10 +1,6 @@ ##################################### # Wrapper for rpl_auto_increment.test# ##################################### -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=innodb; diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test index 8c95e158847..d1da69533ec 100644 --- a/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test +++ b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test @@ -56,6 +56,6 @@ sync_slave_with_master; use test1; select * from t1; -drop database test1; connection master; drop database test1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment_bug33029.test b/mysql-test/suite/rpl/t/rpl_auto_increment_bug33029.test new file mode 100644 index 00000000000..6f7e0d80b5c --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_auto_increment_bug33029.test @@ -0,0 +1,60 @@ +# BUG#33029 5.0 to 5.1 replication fails on dup key when inserting +# using a trig in SP + +# For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive, +# if one statement in a SP generated AUTO_INCREMENT value by the top +# statement, all statements after it would be considered generated +# AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID +# value might be associated with these statement, which could cause +# duplicate entry error and stop the slave. + +# Test if the slave can replicate from such a buggy master + +# The bug33029-slave-relay-bin.000001 file is the +# slave-replay-bin.000003 file generated by run the +# rpl_auto_increment_bug33029.test with clean up statements at the end +# of the test case removed on a buggy 5.0 server + +--let $rpl_skip_start_slave= 1 +--source include/master-slave.inc + +--echo ==== Initialize ==== +--connection slave + +# The binlog we read does funny things with triggers and causes this warning. +--disable_query_log +CALL mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT'); +--enable_query_log + +# Need to restore this at the end; CHANGE MASTER modifies it (see the +# manual for CHANGE MASTER). +SET @old_relay_log_purge= @@global.relay_log_purge; + +# the relay log contains create t1, t2 tables and load data infile +--let $fake_relay_log = $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 +--source include/setup_fake_relay_log.inc + +--echo ==== Test ==== +start slave sql_thread; +--let $slave_param= Exec_Master_Log_Pos +--let $slave_param_value= 3776 +--source include/wait_for_slave_param.inc + + +echo # Result on slave; +SELECT * FROM t1; +SELECT * FROM t2; + +--echo ==== Clean up ==== + +stop slave sql_thread; +--source 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; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test b/mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test index f38d2151ab3..b5eb3c5408a 100644 --- a/mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test +++ b/mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test @@ -159,11 +159,9 @@ source include/show_binlog_events.inc; sync_slave_with_master; --echo #Test if the results are consistent on master and slave --echo #for 'UPDATE MORE THAN ONE TABLES ON TOP-STATEMENT' -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; -let $diff_table_1=master:test.t2; -let $diff_table_2=slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; connection master; @@ -199,11 +197,9 @@ source include/show_binlog_events.inc; sync_slave_with_master; --echo #Test if the results are consistent on master and slave --echo #for 'INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES' -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; -let $diff_table_1=master:test.t2; -let $diff_table_2=slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; connection master; @@ -212,3 +208,4 @@ drop table t2; drop view v15; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test b/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test index acb98a0ad88..b4798691ca3 100644 --- a/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test +++ b/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test @@ -177,4 +177,4 @@ SELECT * FROM db1.t1 WHERE a IN (30, 40); connection master; DROP DATABASE db1; DROP DATABASE db2; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029-master.opt b/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029-master.opt deleted file mode 100644 index 74e71a8e558..00000000000 --- a/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029-master.opt +++ /dev/null @@ -1 +0,0 @@ ---replicate-same-server-id --relay-log=slave-relay-bin --skip-slave-start diff --git a/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029.test b/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029.test deleted file mode 100644 index dbdd96347a2..00000000000 --- a/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029.test +++ /dev/null @@ -1,42 +0,0 @@ -# BUG#33029 5.0 to 5.1 replication fails on dup key when inserting -# using a trig in SP - -# For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive, -# if one statement in a SP generated AUTO_INCREMENT value by the top -# statement, all statements after it would be considered generated -# AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID -# value might be associated with these statement, which could cause -# duplicate entry error and stop the slave. - -# Test if the slave can replicate from such a buggy master - -# The bug33029-slave-relay-bin.000001 file is the -# slave-replay-bin.000003 file generated by run the -# rpl_auto_increment_bug33029.test with clean up statements at the end -# of the test case removed on a buggy 5.0 server - -source include/have_log_bin.inc; - -let $fake_relay_log= $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001; -source include/setup_fake_relay_log.inc; - -start slave sql_thread; -disable_result_log; -select MASTER_POS_WAIT('master-bin.000001', 3776); -enable_result_log; - -echo # Result on slave; -SELECT * FROM t1; -SELECT * FROM t2; - -# clean up -disable_warnings; -DROP TABLE IF EXISTS t1, t2; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP FUNCTION IF EXISTS f1; -DROP TRIGGER IF EXISTS tr1; -enable_warnings; - -stop slave sql_thread; -source include/cleanup_fake_relay_log.inc; diff --git a/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt b/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt deleted file mode 100644 index 815a8f81d32..00000000000 --- a/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt +++ /dev/null @@ -1 +0,0 @@ ---replicate-same-server-id --relay-log=slave-relay-bin diff --git a/mysql-test/suite/rpl/t/rpl_binlog_corruption.test b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test index 401597b5c64..6717bda0fa7 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_corruption.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test @@ -15,15 +15,14 @@ # BUG#31793: log event corruption causes crash # BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event -# Temporarily disabled on Windows due to bug #47639 ---source include/not_windows.inc +--source include/master-slave.inc -source include/have_log_bin.inc; # BUG#40482 only manifested itself in debug-compiled binaries. source include/have_debug.inc; +--connection slave call mtr.add_suppression('Found invalid event in binary log'); - +call mtr.add_suppression('Slave SQL.*Relay log read failure: Could not parse relay log event entry.* 1594'); # # BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event @@ -32,6 +31,9 @@ call mtr.add_suppression('Found invalid event in binary log'); # incident number. --echo ==== Initialize ==== +--source include/stop_slave.inc +RESET SLAVE; + let $fake_relay_log= $MYSQL_TEST_DIR/std_data/bug40482-bin.000001; source include/setup_fake_relay_log.inc; @@ -44,3 +46,5 @@ let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); --echo ==== Clean up ==== source include/cleanup_fake_relay_log.inc; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt b/mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt new file mode 100644 index 00000000000..f8e46a44854 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt @@ -0,0 +1 @@ +--max_binlog_size=4096 diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors.test b/mysql-test/suite/rpl/t/rpl_binlog_errors.test new file mode 100644 index 00000000000..7c09dab704e --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_errors.test @@ -0,0 +1,413 @@ +# BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error +# when generating new name. +# +# WHY +# === +# +# We want to check whether error is reported or not when +# new_file_impl fails (this may happen when rotation is not +# possible because there is some problem finding an +# unique filename). +# +# HOW +# === +# +# Test cases are documented inline. + +-- source include/have_innodb.inc +-- source include/have_debug.inc +-- source include/master-slave.inc + +-- echo ####################################################################### +-- echo ####################### PART 1: MASTER TESTS ########################## +-- echo ####################################################################### + + +### ACTION: stopping slave as it is not needed for the first part of +### the test + +-- connection slave +-- source include/stop_slave.inc +-- connection master + +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; + +### ACTION: create a large file (> 4096 bytes) that will be later used +### in LOAD DATA INFILE to check binlog errors in its vacinity +-- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data +-- let $MYSQLD_DATADIR= `select @@datadir` +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file' + +### ACTION: create a small file (< 4096 bytes) that will be later used +### in LOAD DATA INFILE to check for absence of binlog errors +### when file loading this file does not force flushing and +### rotating the binary log +-- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data +-- let $MYSQLD_DATADIR= `select @@datadir` +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2' + +RESET MASTER; + +-- echo ###################### TEST #1 + +### ASSERTION: no problem flushing logs (should show two binlogs) +FLUSH LOGS; +-- echo # assert: must show two binlogs +-- source include/show_binary_logs.inc + +-- echo ###################### TEST #2 + +### ASSERTION: check that FLUSH LOGS actually fails and reports +### failure back to the user if find_uniq_filename fails +### (should show just one binlog) + +RESET MASTER; +SET GLOBAL debug="+d,error_unique_log_filename"; +-- error ER_NO_UNIQUE_LOGFILE +FLUSH LOGS; +-- echo # assert: must show one binlog +-- source include/show_binary_logs.inc + +### ACTION: clean up and move to next test +SET GLOBAL debug=""; +RESET MASTER; + +-- echo ###################### TEST #3 + +### ACTION: create some tables (t1, t2, t4) and insert some values in +### table t1 +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; + +### ASSERTION: we force rotation of the binary log because it exceeds +### the max_binlog_size option (should show two binary +### logs) + +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 + +# shows two binary logs +-- echo # assert: must show two binlog +-- source include/show_binary_logs.inc + +# clean up the table and the binlog to be used in next part of test +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #4 + +### ASSERTION: load the big file into a transactional table and check +### that it reports error. The table will contain the +### changes performed despite the fact that it reported an +### error. + +SET GLOBAL debug="+d,error_unique_log_filename"; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 + +# show table +-- echo # assert: must show one entry +SELECT count(*) FROM t2; + +# clean up the table and the binlog to be used in next part of test +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #5 + +### ASSERTION: load the small file into a transactional table and +### check that it succeeds + +SET GLOBAL debug="+d,error_unique_log_filename"; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2 + +# show table +-- echo # assert: must show one entry +SELECT count(*) FROM t2; + +# clean up the table and the binlog to be used in next part of test +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #6 + +### ASSERTION: check that even if one is using a transactional table +### and explicit transactions (no autocommit) if rotation +### fails we get the error. Transaction is not rolledback +### because rotation happens after the commit. + +SET GLOBAL debug="+d,error_unique_log_filename"; +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES ('muse'); +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 +INSERT INTO t2 VALUES ('muse'); +-- error ER_NO_UNIQUE_LOGFILE +COMMIT; + +### ACTION: Show the contents of the table after the test +-- echo # assert: must show three entries +SELECT count(*) FROM t2; + +### ACTION: clean up and move to the next test +SET AUTOCOMMIT= 1; +SET GLOBAL debug="-d,error_unique_log_filename"; +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #7 + +### ASSERTION: check that on a non-transactional table, if rotation +### fails then an error is reported and an incident event +### is written to the current binary log. + +SET GLOBAL debug="+d,error_unique_log_filename"; +SELECT count(*) FROM t4; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 + +-- echo # assert: must show 1 entry +SELECT count(*) FROM t4; + +-- echo ### check that the incident event is written to the current log +SET GLOBAL debug="-d,error_unique_log_filename"; +-- let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1) +-- let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) + +# 53 is the size of the incident event, so we start from 22 bytes before the +# current position +-- let $binlog_start = `SELECT $binlog_start - 53` +FLUSH LOGS; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start> $binlog_file BINLOG_FILE +-- replace_column 2 # 4 # 5 # +-- eval SHOW BINLOG EVENTS IN '$binlog_file' FROM $binlog_start LIMIT 1 + +# clean up and move to next test +DELETE FROM t4; +RESET MASTER; + +-- echo ###################### TEST #8 + +### ASSERTION: check that statements end up in error but they succeed +### on changing the data. + +SET GLOBAL debug="+d,error_unique_log_filename"; +-- echo # must show 0 entries +SELECT count(*) FROM t4; +SELECT count(*) FROM t2; + +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 +-- error ER_NO_UNIQUE_LOGFILE +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); + +-- echo # INFO: Count(*) Before Offending DELETEs +-- echo # assert: must show 1 entry +SELECT count(*) FROM t4; +-- echo # assert: must show 4 entries +SELECT count(*) FROM t2; + +-- error ER_NO_UNIQUE_LOGFILE +DELETE FROM t4; +-- error ER_NO_UNIQUE_LOGFILE +DELETE FROM t2; + +-- echo # INFO: Count(*) After Offending DELETEs +-- echo # assert: must show zero entries +SELECT count(*) FROM t4; +SELECT count(*) FROM t2; + +# remove fault injection +SET GLOBAL debug="-d,error_unique_log_filename"; + +-- echo ###################### TEST #9 + +### ASSERTION: check that if we disable binlogging, then statements +### succeed. +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'); +-- echo # assert: must show four entries +SELECT count(*) FROM t2; +SELECT count(*) FROM t4; +DELETE FROM t2; +DELETE FROM t4; +-- echo # assert: must show zero entries +SELECT count(*) FROM t2; +SELECT count(*) FROM t4; +SET SQL_LOG_BIN=1; +SET GLOBAL debug="-d,error_unique_log_filename"; + +-- echo ###################### TEST #10 + +### ASSERTION: check that error is reported if there is a failure +### while registering the index file and the binary log +### file or failure to write the rotate event. + +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; + +# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open +SET GLOBAL debug="+d,fault_injection_registering_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE +FLUSH LOGS; +SET GLOBAL debug="-d,fault_injection_registering_index"; + +-- error ER_NO_BINARY_LOGGING +SHOW BINARY LOGS; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +-- echo ###################### TEST #11 + +### ASSERTION: check that error is reported if there is a failure +### while opening the index file and the binary log file or +### failure to write the rotate event. + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file +SET GLOBAL debug="+d,fault_injection_openning_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE +FLUSH LOGS; +SET GLOBAL debug="-d,fault_injection_openning_index"; + +-- error ER_FLUSH_MASTER_BINLOG_CLOSED +RESET MASTER; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +-- echo ###################### TEST #12 + +### ASSERTION: check that error is reported if there is a failure +### while writing the rotate event when creating a new log +### file. + +# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl +SET GLOBAL debug="+d,fault_injection_new_file_rotate_event"; +-- error ER_ERROR_ON_WRITE +FLUSH LOGS; +SET GLOBAL debug="-d,fault_injection_new_file_rotate_event"; + +-- error ER_FLUSH_MASTER_BINLOG_CLOSED +RESET MASTER; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +## clean up +SET GLOBAL debug= @old_debug; +DROP TABLE t1, t2, t4; +RESET MASTER; + +# restart slave again +-- connection slave +-- source include/start_slave.inc +-- connection master + +-- echo ####################################################################### +-- echo ####################### PART 2: SLAVE TESTS ########################### +-- echo ####################################################################### + +### setup +--source include/rpl_reset.inc +-- connection slave + +# slave suppressions + +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 .*"); +-- echo ###################### TEST #13 + +#### ASSERTION: check against unique log filename error +-- let $io_thd_injection_fault_flag= error_unique_log_filename +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #14 + +#### ASSERTION: check against rotate failing +-- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #15 + +#### ASSERTION: check against relay log open failure +-- let $io_thd_injection_fault_flag= fault_injection_registering_index +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #16 + +#### ASSERTION: check against relay log index open failure +-- let $io_thd_injection_fault_flag= fault_injection_openning_index +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +### clean up +-- source include/stop_slave_sql.inc +SET GLOBAL debug=@old_debug; +RESET SLAVE; +RESET MASTER; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_grant.test b/mysql-test/suite/rpl/t/rpl_binlog_grant.test index 4c6402359fe..839399dea63 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_grant.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_grant.test @@ -10,9 +10,6 @@ let $VERSION=`select version()`; # Now GRANT/REVOKE do implicitly commit # transaction ---disable_warnings -drop database if exists d1; ---enable_warnings create database d1; use d1; create table t (s1 int) engine=innodb; @@ -40,4 +37,5 @@ select * from t; show grants for x@y; drop user x@y; drop database d1; ---sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules-master.opt b/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules-master.opt deleted file mode 100644 index 33632bf98e8..00000000000 --- a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules-master.opt +++ /dev/null @@ -1 +0,0 @@ ---replicate-do-db='impossible_database' diff --git a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test b/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test deleted file mode 100644 index d56a32ce2bd..00000000000 --- a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test +++ /dev/null @@ -1,32 +0,0 @@ -# regression test for -# Bug#36099 replicate-do-db affects replaying RBR events with mysqlbinlog -# The test verifies that the slave side filtering rule does not affect -# applying of row-events on master via mysqlbinlog - --- source include/have_log_bin.inc --- source include/not_embedded.inc --- source include/have_binlog_format_row.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -reset master; - -create table t1 (a int); -insert into t1 values (1); - -let $MYSQLD_DATADIR= `select @@datadir`; -flush logs; ---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/bug36099.sql - -drop table t1; ---exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/bug36099.sql" - ---echo *** must be 1 *** -select * from t1; - -# cleanup - -drop table t1; -remove_file $MYSQLTEST_VARDIR/tmp/bug36099.sql; diff --git a/mysql-test/suite/rpl/t/rpl_bit.test b/mysql-test/suite/rpl/t/rpl_bit.test index c648159ff3a..67606e5d509 100644 --- a/mysql-test/suite/rpl/t/rpl_bit.test +++ b/mysql-test/suite/rpl/t/rpl_bit.test @@ -90,3 +90,4 @@ DROP TABLE IF EXISTS test.t1; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bit_npk.test b/mysql-test/suite/rpl/t/rpl_bit_npk.test index 1df7341eafc..d65ef66ae41 100644 --- a/mysql-test/suite/rpl/t/rpl_bit_npk.test +++ b/mysql-test/suite/rpl/t/rpl_bit_npk.test @@ -110,3 +110,4 @@ DROP TABLE IF EXISTS test.t3; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_blackhole.test b/mysql-test/suite/rpl/t/rpl_blackhole.test index 647e65d89fd..5f9b955aaa4 100644 --- a/mysql-test/suite/rpl/t/rpl_blackhole.test +++ b/mysql-test/suite/rpl/t/rpl_blackhole.test @@ -96,4 +96,5 @@ let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 3; source extra/rpl_tests/rpl_blackhole.test; connection master; -drop table t1,t2; +DROP TABLE t1,t2; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug26395.test b/mysql-test/suite/rpl/t/rpl_bug26395.test index 97c152d52e9..aeb0da9511d 100644 --- a/mysql-test/suite/rpl/t/rpl_bug26395.test +++ b/mysql-test/suite/rpl/t/rpl_bug26395.test @@ -95,3 +95,5 @@ connection slave; DROP TABLE tinnodb; # Warning: do not add more tests here. The binlog is in a bad state. +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug31076.test b/mysql-test/suite/rpl/t/rpl_bug31076.test index 9461a91e933..028ca32636a 100644 --- a/mysql-test/suite/rpl/t/rpl_bug31076.test +++ b/mysql-test/suite/rpl/t/rpl_bug31076.test @@ -141,3 +141,4 @@ DROP DATABASE track; sync_slave_with_master; --echo End of 5.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug33931-master.opt b/mysql-test/suite/rpl/t/rpl_bug33931-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_bug33931-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test index 5dc06e6a605..5cc2da4a001 100644 --- a/mysql-test/suite/rpl/t/rpl_bug33931.test +++ b/mysql-test/suite/rpl/t/rpl_bug33931.test @@ -3,19 +3,16 @@ # Bug #33932 assertion at handle_slave_sql if init_slave_thread() fails source include/have_debug.inc; -source include/have_log_bin.inc; - -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); - -connection master; -reset master; +source include/master-slave.inc; connection slave; -reset slave; # Add suppression for expected warnings in slaves error log call mtr.add_suppression("Failed during slave I/O thread initialization"); +call mtr.add_suppression("Slave SQL.*Failed during slave thread initialization.* 1593"); + +--source include/stop_slave.inc +reset slave; # Set debug flags on slave to force errors to occur SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; @@ -29,18 +26,13 @@ eval CHANGE MASTER TO MASTER_USER='root', start slave; -connection master; -save_master_pos; -connection slave; - # # slave is going to stop because of emulated failures # but there won't be any crashes nor asserts hit. # -source include/wait_for_slave_to_stop.inc; # 1593 = ER_SLAVE_FATAL_ERROR ---let $slave_sql_errno= 1593 +--let $slave_sql_errno= 1593 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error.inc @@ -49,3 +41,8 @@ source include/wait_for_slave_to_stop.inc; # SET GLOBAL debug=""; +# Clear Last_SQL_Error +RESET SLAVE; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug37426.test b/mysql-test/suite/rpl/t/rpl_bug37426.test new file mode 100644 index 00000000000..d0a60524fef --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_bug37426.test @@ -0,0 +1,22 @@ +############################################################# +# Purpose: Test for BUG#37426 +# RBR breaks for CHAR() UTF8 fields > 85 chars +############################################################# + +source include/master-slave.inc; +source include/have_binlog_format_row.inc; + +connection master; +CREATE TABLE char128_utf8 (i1 INT NOT NULL, c CHAR(128) CHARACTER SET utf8 NOT NULL, i2 INT NOT NULL); +INSERT INTO char128_utf8 VALUES ( 1, "123", 1 ); + +SELECT * FROM char128_utf8; +sync_slave_with_master; + +SELECT * FROM char128_utf8; + +# Clean up +connection master; +DROP TABLE char128_utf8; +sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug38694.test b/mysql-test/suite/rpl/t/rpl_bug38694.test index 41b11d271b9..48f950ad6ef 100644 --- a/mysql-test/suite/rpl/t/rpl_bug38694.test +++ b/mysql-test/suite/rpl/t/rpl_bug38694.test @@ -8,3 +8,4 @@ source include/master-slave.inc; # End of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug41902.test b/mysql-test/suite/rpl/t/rpl_bug41902.test index d16fb986cea..12eeb903003 100644 --- a/mysql-test/suite/rpl/t/rpl_bug41902.test +++ b/mysql-test/suite/rpl/t/rpl_bug41902.test @@ -58,4 +58,7 @@ call mtr.add_suppression("Failed to locate old binlog or relay log files"); call mtr.add_suppression("MYSQL_BIN_LOG::purge_logs was called with file ./master-bin.000001 not listed in the index"); --enable_query_log ---echo End of the tests +--echo ==== clean up ==== +CHANGE MASTER TO MASTER_HOST = '127.0.0.1'; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test index 514d6cf8c0f..c31359a84d8 100644 --- a/mysql-test/suite/rpl/t/rpl_change_master.test +++ b/mysql-test/suite/rpl/t/rpl_change_master.test @@ -23,7 +23,7 @@ source include/stop_slave.inc; let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); -if (`SELECT $read_pos = $exec_pos`) +if ($read_pos == $exec_pos) { source include/show_rpl_debug_info.inc; echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos'; @@ -32,7 +32,7 @@ if (`SELECT $read_pos = $exec_pos`) change master to master_user='root'; let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); -if (`SELECT $read_pos <> $exec_pos`) +if ($read_pos != $exec_pos) { source include/show_rpl_debug_info.inc; echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos'; @@ -52,7 +52,8 @@ sync_slave_with_master; # BUG#12190 CHANGE MASTER has differ path requiremts on MASTER_LOG_FILE and RELAY_LOG_FILE # -source include/master-slave-reset.inc; +if ($bug_59037_is_fixed == 'true') { +--source include/rpl_reset.inc connection master; create table t1 (a int); @@ -65,8 +66,7 @@ insert into t1 values (2); sync_slave_with_master; # Check if the table t1 and t2 are identical on master and slave; -let $diff_table_1= master:test.t1 -let $diff_table_2= slave:test.t1 +let $diff_tables= master:t1,slave:t1 source include/diff_tables.inc; connection slave; @@ -88,8 +88,7 @@ source include/wait_for_slave_sql_to_start.inc; sync_with_master; # Check if the table t1 and t2 are identical on master and slave; -let $diff_table_1= master:test.t1 -let $diff_table_2= slave:test.t1 +let $diff_tables= master:t1,slave:t1 source include/diff_tables.inc; # clean up @@ -99,4 +98,6 @@ source include/wait_for_slave_io_to_start.inc; eval set global relay_log_purge=$relay_log_purge; connection master; drop table t1; -sync_slave_with_master; +} + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_charset.test b/mysql-test/suite/rpl/t/rpl_charset.test index ed0d835f22d..3ed9147508e 100644 --- a/mysql-test/suite/rpl/t/rpl_charset.test +++ b/mysql-test/suite/rpl/t/rpl_charset.test @@ -1,3 +1,2 @@ let $engine_type=myisam; source extra/rpl_tests/rpl_charset.test; - diff --git a/mysql-test/suite/rpl/t/rpl_charset_sjis.test b/mysql-test/suite/rpl/t/rpl_charset_sjis.test index 2469b0db8a2..a3a3de8c1d0 100644 --- a/mysql-test/suite/rpl/t/rpl_charset_sjis.test +++ b/mysql-test/suite/rpl/t/rpl_charset_sjis.test @@ -23,3 +23,4 @@ sync_slave_with_master; connection master; # End of 5.0 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf index 536551ec3dc..3ff94e458ce 100644 --- a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf +++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf @@ -17,11 +17,8 @@ log-slave-updates loose-innodb [ENV] -SLAVE_MYPORT1= @mysqld.3.port -SLAVE_MYSOCK1= @mysqld.3.socket - -SLAVE_MYPORT2= @mysqld.4.port -SLAVE_MYSOCK2= @mysqld.4.socket - - +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket +SERVER_MYPORT_4= @mysqld.4.port +SERVER_MYSOCK_4= @mysqld.4.socket diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test index 2f1b86c2c31..7d4b538c8a6 100644 --- a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test +++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test @@ -1,27 +1,36 @@ -############################################################# -# Author: Serge Kozlov <skozlov@mysql.com> -# Date: 03/12/2008 -# Purpose: Testing circular replication based on schema -# A->B->C->D->A with using AUTO_INCREMENT_INCREMENT, -# AUTO_INCREMENT_OFFSET variables and failover -############################################################# +# ==== Purpose ==== +# +# Setup: circular replication on four hosts, i.e., topology +# server_1 -> server_2 -> server_3 -> server_4 -> server_1 +# +# Tested properties: +# - Correctly configured autoinc works. +# - Manual failover works. +# +# ==== Related bugs and worklogs ==== +# +# WL#3754 +# BUG#49978 + --source include/have_innodb.inc # Use wait_for_slave_to_(start|stop) for current connections let $keep_connection= 1; # Set up circular ring and new names for servers ---echo *** Set up circular ring by schema A->B->C->D->A *** ---source include/circular_rpl_for_4_hosts_init.inc +--echo *** Set up circular replication on four servers *** +--let $rpl_topology= 1->2->3->4->1 +--source include/rpl_init.inc --echo # Preparing data. --echo *** Preparing data *** ---connection master_a +--connection server_1 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; ---source include/circular_rpl_for_4_hosts_sync.inc ---connection master_d +--source include/rpl_sync.inc +--connection server_4 +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); --echo # @@ -31,121 +40,135 @@ CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, --echo *** Testing schema A->B->C->D->A *** --echo # insert data via all hosts ---connection master_a +--connection server_1 INSERT INTO t1(b,c) VALUES('A',1); ---sync_slave_with_master master_b +--sync_slave_with_master server_2 INSERT INTO t1(b,c) VALUES('B',1); ---sync_slave_with_master master_c +--sync_slave_with_master server_3 INSERT INTO t1(b,c) VALUES('C',1); ---sync_slave_with_master master_d +--sync_slave_with_master server_4 INSERT INTO t1(b,c) VALUES('D',1); ---source include/circular_rpl_for_4_hosts_sync.inc +--source include/rpl_sync.inc ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c = 1 ORDER BY a,b; ---connection master_b +--connection server_2 SELECT 'Master B',a,b FROM t1 WHERE c = 1 ORDER BY a,b; ---connection master_c +--connection server_3 SELECT 'Master C',a,b FROM t1 WHERE c = 1 ORDER BY a,b; ---connection master_d +--connection server_4 SELECT 'Master D',a,b FROM t1 WHERE c = 1 ORDER BY a,b; --echo --echo *** Testing schema A->B->D->A if C has failure *** --echo --echo * Do failure for C and then make new connection B->D * + +# Note: server_N has auto_increment_offset=N. Below, we insert value 6 +# in the autoinc column on server_3 (and prevent it from replicating +# further using SQL_SLAVE_SKIP_COUNTER on server_4). Due to the +# auto_increment_offset setting, the autoinc value 6 is normally +# generated on server_2. When we later insert a row on server_2, we +# thus cause a duplicate key error on server_3. + # Do not replicate next event from C ---connection master_d -connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2); +--connection server_4 STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; source include/start_slave.inc; -disconnect slave; ---connection master_c +--connection server_3 INSERT INTO t1 VALUES(6,'C',2); ---save_master_pos ---connection master_b +--sync_slave_with_master server_4 + +--connection server_2 INSERT INTO t1(b,c) VALUES('B',2); # Wait while C will stop. ---connection master_c -source include/wait_for_slave_sql_to_stop.inc; ---connection master_a +--connection server_3 +# 1062 = ER_DUP_ENTRY +call mtr.add_suppression("Slave SQL.*Duplicate entry .6. for key .PRIMARY.* Error_code: 1062"); +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc +--connection server_1 INSERT INTO t1(b,c) VALUES('A',2); ---connection master_d +--connection server_4 INSERT INTO t1(b,c) VALUES('D',2); # Sync all servers except C ---connection master_b +--connection server_2 let $wait_condition= SELECT COUNT(*)=3 FROM t1 WHERE a > 4; +--let $server_connection= server_1 --source include/wait_condition.inc --echo --echo * Data on servers (C failed) * # Masters C,D shouldn't have correct data ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_b +--connection server_2 SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_c +--connection server_3 SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_d +--connection server_4 SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b; --echo --echo * Reconfigure replication to schema A->B->D->A * # Exclude Master C ---connection master_c -STOP SLAVE; +--connection server_3 +--source include/stop_slave_io.inc --let $pos_c= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) --let $file_c= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1) ---connection master_d -STOP SLAVE; ---replace_result $SLAVE_MYPORT MASTER_B_PORT $file_c LOG_FILE $pos_c LOG_POS ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',master_log_file='$file_c',master_log_pos=$pos_c -connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2); + +--connection server_4 +--source include/stop_slave.inc + +--let $rpl_topology= 1->2->4->1,2->3 +--let $rpl_master_log_file= 4:$file_c +--let $rpl_master_log_pos= 4:$pos_c +--source include/rpl_change_topology.inc + +#--replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 $file_c LOG_FILE $pos_c LOG_POS +#--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SERVER_MYPORT_2,master_user='root',master_log_file='$file_c',master_log_pos=$pos_c source include/start_slave.inc; -disconnect slave; ---connection master_b ---sync_slave_with_master master_d ---sync_slave_with_master master_a +--connection server_2 +--sync_slave_with_master server_4 +--sync_slave_with_master server_1 --echo --echo * Check data inserted before failure * ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_b +--connection server_2 SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_c +--connection server_3 SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b; ---connection master_d +--connection server_4 SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b; --echo --echo * Check data inserted after failure * ---connection master_a +--connection server_1 INSERT INTO t1(b,c) VALUES('A',3); ---connection master_b +--connection server_2 INSERT INTO t1(b,c) VALUES('B',3); ---connection master_d +--connection server_4 INSERT INTO t1(b,c) VALUES('D',3); -connection master_a; +connection server_1; ---sync_slave_with_master master_b ---sync_slave_with_master master_d ---sync_slave_with_master master_a ---sync_slave_with_master master_b +--let $rpl_only_running_threads= 1 +--source include/rpl_sync.inc ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c = 3 ORDER BY a,b; ---connection master_b +--connection server_2 SELECT 'Master B',a,b FROM t1 WHERE c = 3 ORDER BY a,b; ---connection master_c +--connection server_3 SELECT 'Master C',a,b FROM t1 WHERE c = 3 ORDER BY a,b; ---connection master_d +--connection server_4 SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b; ---connection master_a +--connection server_1 --echo --echo *** Testing restoring scheme A->B->C->D->A after failure *** @@ -153,158 +176,150 @@ SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b; # Master D will ignore a next event from C so that event will not be # distributed to other servers --echo * Remove wrong event from C and restore B->C->D * ---connection master_d +--connection server_4 source include/stop_slave.inc; ---connection master_c +--connection server_3 DELETE FROM t1 WHERE a = 6; -START SLAVE; ---connection master_b ---sync_slave_with_master master_c +--source include/start_slave.inc +--connection server_2 +--sync_slave_with_master server_3 RESET MASTER; --let $file_d= query_get_value(SHOW MASTER STATUS, File, 1) --let $pos_d= query_get_value(SHOW MASTER STATUS, Position, 1) ---connection master_d +--connection server_4 RESET SLAVE; ---replace_result $SLAVE_MYPORT1 MASTER_C_PORT $file_d LOG_FILE $pos_d LOG_POS ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root',master_log_file='$file_d',master_log_pos=$pos_d -START SLAVE; ---connection master_c ---sync_slave_with_master master_d ---source include/circular_rpl_for_4_hosts_sync.inc +--let $rpl_topology= 1->2->3->4->1 +--let $rpl_master_log_file= 4:$file_d +--let $rpl_master_log_pos= 4:$pos_d +--source include/rpl_change_topology.inc +#--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 $file_d LOG_FILE $pos_d LOG_POS +#--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SERVER_MYPORT_3,master_user='root',master_log_file='$file_d',master_log_pos=$pos_d +--source include/start_slave.inc +--connection server_3 +--sync_slave_with_master server_4 +--source include/rpl_sync.inc --echo --echo * Check data inserted before restoring schema A->B->C->D->A * ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; ---sync_slave_with_master master_b +--sync_slave_with_master server_2 SELECT 'Master B',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; ---sync_slave_with_master master_c +--sync_slave_with_master server_3 SELECT 'Master C',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; ---sync_slave_with_master master_d +--sync_slave_with_master server_4 SELECT 'Master D',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b; ---sync_slave_with_master master_a +--sync_slave_with_master server_1 --echo --echo * Check data inserted after restoring schema A->B->C->D->A * ---connection master_a +--connection server_1 INSERT INTO t1(b,c) VALUES('A',4); ---connection master_b +--connection server_2 INSERT INTO t1(b,c) VALUES('B',4); ---connection master_c +--connection server_3 INSERT INTO t1(b,c) VALUES('C',4); ---connection master_d +--connection server_4 INSERT INTO t1(b,c) VALUES('D',4); ---connection master_a +--connection server_1 ---source include/circular_rpl_for_4_hosts_sync.inc +--source include/rpl_sync.inc ---connection master_a +--connection server_1 SELECT 'Master A',a,b FROM t1 WHERE c = 4 ORDER BY a,b; ---connection master_b +--connection server_2 SELECT 'Master B',a,b FROM t1 WHERE c = 4 ORDER BY a,b; ---connection master_c +--connection server_3 SELECT 'Master C',a,b FROM t1 WHERE c = 4 ORDER BY a,b; ---connection master_d +--connection server_4 SELECT 'Master D',a,b FROM t1 WHERE c = 4 ORDER BY a,b; ---connection master_a +--connection server_1 --echo --echo * Transactions with commits * # Testing mixing of transactions and regular inserts ---connection master_a +--connection server_1 BEGIN; ---connection master_c +--connection server_3 BEGIN; let $counter= 100; ---connection master_a +--connection server_1 --disable_query_log while ($counter) { - --connection master_a + --connection server_1 INSERT INTO t2(b,c) VALUES('A',1); - --connection master_b + --connection server_2 INSERT INTO t2(b,c) VALUES('B',1); - --connection master_c + --connection server_3 INSERT INTO t2(b,c) VALUES('C',1); - --connection master_d + --connection server_4 INSERT INTO t2(b,c) VALUES('D',1); dec $counter; } ---connection master_a +--connection server_1 COMMIT; ---connection master_c +--connection server_3 COMMIT; ---connection master_a +--connection server_1 --enable_query_log ---source include/circular_rpl_for_4_hosts_sync.inc +--source include/rpl_sync.inc ---connection master_a +--connection server_1 SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; ---connection master_b +--connection server_2 SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; ---connection master_c +--connection server_3 SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; ---connection master_d +--connection server_4 SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b; ---connection master_a +--connection server_1 --echo --echo * Transactions with rollbacks * # Testing mixing of transactions with rollback and regular inserts ---connection master_a +--connection server_1 BEGIN; ---connection master_c +--connection server_3 BEGIN; let $counter= 100; ---connection master_a +--connection server_1 --disable_query_log while ($counter) { - --connection master_a + --connection server_1 INSERT INTO t2(b,c) VALUES('A',2); - --connection master_b + --connection server_2 INSERT INTO t2(b,c) VALUES('B',2); - --connection master_c + --connection server_3 INSERT INTO t2(b,c) VALUES('C',2); - --connection master_d + --connection server_4 INSERT INTO t2(b,c) VALUES('D',2); dec $counter; } ---connection master_a +--connection server_1 ROLLBACK; ---connection master_c +--connection server_3 ROLLBACK; ---connection master_a +--connection server_1 --enable_query_log ---source include/circular_rpl_for_4_hosts_sync.inc +--source include/rpl_sync.inc ---connection master_a +--connection server_1 SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; ---connection master_b +--connection server_2 SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; ---connection master_c +--connection server_3 SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; ---connection master_d +--connection server_4 SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b; ---connection master_a +--connection server_1 --echo # Clean up --echo *** Clean up *** ---connection master_a +--connection server_1 DROP TABLE t1,t2; ---source include/circular_rpl_for_4_hosts_sync.inc ---connection master_a -STOP SLAVE; -RESET SLAVE; ---connection master_b -STOP SLAVE; -RESET SLAVE; ---connection master_c -STOP SLAVE; -RESET SLAVE; ---connection master_d -STOP SLAVE; -RESET SLAVE; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_colSize.test b/mysql-test/suite/rpl/t/rpl_colSize.test index 4c808ef3dfd..d6f817af189 100644 --- a/mysql-test/suite/rpl/t/rpl_colSize.test +++ b/mysql-test/suite/rpl/t/rpl_colSize.test @@ -225,3 +225,4 @@ sync_slave_with_master; SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions; # END 5.1 Test Case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_commit_after_flush.test b/mysql-test/suite/rpl/t/rpl_commit_after_flush.test index 47df391d6be..5e070b14301 100644 --- a/mysql-test/suite/rpl/t/rpl_commit_after_flush.test +++ b/mysql-test/suite/rpl/t/rpl_commit_after_flush.test @@ -1,12 +1,6 @@ -##################################### -# Wrapper for rpl_commit_after_flush# -##################################### -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc -- source include/master-slave.inc let $engine_type=innodb; -- source extra/rpl_tests/rpl_commit_after_flush.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_concurrency_error.test b/mysql-test/suite/rpl/t/rpl_concurrency_error.test index 2e216d25211..15d5d5502a1 100644 --- a/mysql-test/suite/rpl/t/rpl_concurrency_error.test +++ b/mysql-test/suite/rpl/t/rpl_concurrency_error.test @@ -53,24 +53,24 @@ while ($type) { let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); connection conn1; - if (`select $type = 2`) + if ($type == 2) { SET AUTOCOMMIT = 1; BEGIN; } - if (`select $type = 1`) + if ($type == 1) { SET AUTOCOMMIT = 0; } eval UPDATE t SET f = 'yellow $type' WHERE i = 3; connection conn2; - if (`select $type = 2`) + if ($type == 2) { SET AUTOCOMMIT = 1; BEGIN; } - if (`select $type = 1`) + if ($type == 1) { SET AUTOCOMMIT = 0; } @@ -88,24 +88,24 @@ while ($type) let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); connection conn1; - if (`select $type = 2`) + if ($type == 2) { SET AUTOCOMMIT = 1; BEGIN; } - if (`select $type = 1`) + if ($type == 1) { SET AUTOCOMMIT = 0; } eval UPDATE t SET f = 'gray $type' WHERE i = 3; connection conn2; - if (`select $type = 2`) + if ($type == 2) { SET AUTOCOMMIT = 1; BEGIN; } - if (`select $type = 1`) + if ($type == 1) { SET AUTOCOMMIT = 0; } @@ -127,13 +127,11 @@ while ($type) connection master; sync_slave_with_master; -connection master; -let $diff_statement= SELECT * FROM t order by i; -source include/diff_master_slave.inc; +let $rpl_diff_statement= SELECT * FROM t order by i; +source include/rpl_diff.inc; -connection master; -let $diff_statement= SELECT * FROM n order by d, f; -source include/diff_master_slave.inc; +let $rpl_diff_statement= SELECT * FROM n order by d, f; +source include/rpl_diff.inc; --echo ######################################################################## --echo # Cleanup @@ -149,3 +147,4 @@ sync_slave_with_master; connection master; disconnect conn1; disconnect conn2; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_conditional_comments.test b/mysql-test/suite/rpl/t/rpl_conditional_comments.test index 14251d5eb37..88adf3a20f1 100644 --- a/mysql-test/suite/rpl/t/rpl_conditional_comments.test +++ b/mysql-test/suite/rpl/t/rpl_conditional_comments.test @@ -26,15 +26,15 @@ let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); source include/show_binlog_events.inc; let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; -source include/diff_tables.inc; +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc --echo --echo # Case 2: --echo # ----------------------------------------------------------------- --echo # Verify whether it can be binlogged correctly when executing prepared --echo # statement. +--connection master PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/'; EXECUTE stmt; DROP TABLE t1; @@ -42,10 +42,10 @@ CREATE TABLE t1(c1 INT); EXECUTE stmt; sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; -source include/diff_tables.inc; +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc +--connection master --echo SET @value=62; PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/'; @@ -58,17 +58,17 @@ source include/show_binlog_events.inc; let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; -source include/diff_tables.inc; +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc --echo --echo # Case 3: --echo # ----------------------------------------------------------------- --echo # Verify it can restore the '!', if the it is an uncomplete conditional --echo # comments +--connection master --error 1064 SELECT c1 FROM /*!99999 t1 WHEREN; DROP TABLE t1; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_create_database.test b/mysql-test/suite/rpl/t/rpl_create_database.test index e3e2e637594..5eac3de0d15 100644 --- a/mysql-test/suite/rpl/t/rpl_create_database.test +++ b/mysql-test/suite/rpl/t/rpl_create_database.test @@ -70,3 +70,4 @@ DROP DATABASE IF EXISTS mysqltest_bob; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test b/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test index 6b459bb9c76..4e24b9a8133 100644 --- a/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test +++ b/mysql-test/suite/rpl/t/rpl_create_if_not_exists.test @@ -125,7 +125,7 @@ DROP TABLE t3; --echo # After the worklog, it will insert nothing and the statement will not be --echo # binlogged if the table already exists. --echo # After the worklog, some bugs will disappear automotically. -source include/master-slave-reset.inc; +--source include/rpl_reset.inc --echo --echo # Case 1: BUG#47132 @@ -173,4 +173,4 @@ DROP VIEW v1; DROP TABLE t1, t2; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test b/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test index a06dfa54cb1..daf6b7e9ad8 100644 --- a/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test +++ b/mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test @@ -38,4 +38,4 @@ CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp; CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp; source include/show_binlog_events.inc; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_critical_errors.test b/mysql-test/suite/rpl/t/rpl_critical_errors.test index aa1f251b738..bc0d7096f80 100644 --- a/mysql-test/suite/rpl/t/rpl_critical_errors.test +++ b/mysql-test/suite/rpl/t/rpl_critical_errors.test @@ -35,7 +35,7 @@ connection master1; # This sleep is picked so that the query above has started to insert # some rows into t2. If it hasn't the slave will not stop below. let $wait_condition= SELECT COUNT(*) > 1000 FROM t1; -source include/wait_condition.inc +--source include/wait_condition.inc # SHOW PROCESSLIST; @@ -62,4 +62,5 @@ connection slave; # The following should be 0 SELECT COUNT(*) FROM t2; +--source include/rpl_end.inc enable_parsing; diff --git a/mysql-test/suite/rpl/t/rpl_cross_version-master.opt b/mysql-test/suite/rpl/t/rpl_cross_version-master.opt index 815a8f81d32..b0a1ce4a0be 100644 --- a/mysql-test/suite/rpl/t/rpl_cross_version-master.opt +++ b/mysql-test/suite/rpl/t/rpl_cross_version-master.opt @@ -1 +1,2 @@ --replicate-same-server-id --relay-log=slave-relay-bin +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_cross_version.test b/mysql-test/suite/rpl/t/rpl_cross_version.test index 8cd268a5fd9..94c9f0432ce 100644 --- a/mysql-test/suite/rpl/t/rpl_cross_version.test +++ b/mysql-test/suite/rpl/t/rpl_cross_version.test @@ -10,18 +10,23 @@ # The master's binlog is treated as a relay log that the SQL thread executes. # ---source include/have_log_bin.inc - -# The test is disabled for windows due to -# Bug #42879 CHANGE MASTER RELAY_LOG_FILE=path fails on windows -# Todo: release it from not_windows ---source include/not_windows.inc +--source include/master-slave.inc # # Bug#31240 load data infile replication between (4.0 or 4.1) and 5.1 fails # --echo ==== Initialize ==== +--connection slave + +--disable_query_log +# The binlog contains the function RAND which is unsafe. +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +--enable_query_log + +--source include/stop_slave.inc +RESET SLAVE; + # the relay log contains create t1, t3 tables and load data infile --let $fake_relay_log = $MYSQL_TEST_DIR/suite/binlog/std_data/binlog_old_version_4_1.000001 --source include/setup_fake_relay_log.inc @@ -36,6 +41,8 @@ start slave sql_thread; SELECT COUNT(*) - 17920 as zero FROM t3; --echo ==== Clean up ==== -stop slave sql_thread; +--source include/stop_slave_sql.inc --source include/cleanup_fake_relay_log.inc drop table t1, t3; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_current_user-master.opt b/mysql-test/suite/rpl/t/rpl_current_user-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_current_user-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_current_user.cnf b/mysql-test/suite/rpl/t/rpl_current_user.cnf index 999ee727a88..58b605ad928 100644 --- a/mysql-test/suite/rpl/t/rpl_current_user.cnf +++ b/mysql-test/suite/rpl/t/rpl_current_user.cnf @@ -1,9 +1,8 @@ !include ../my.cnf [mysqld.3] -server-id=3 -log-bin=slave-bin +log-slave-updates [ENV] -SLAVE_MYPORT1= @mysqld.3.port -SLAVE_MYSOCK1= @mysqld.3.socket +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket diff --git a/mysql-test/suite/rpl/t/rpl_current_user.test b/mysql-test/suite/rpl/t/rpl_current_user.test index 79816ef6c95..ac2af1af14e 100644 --- a/mysql-test/suite/rpl/t/rpl_current_user.test +++ b/mysql-test/suite/rpl/t/rpl_current_user.test @@ -10,35 +10,31 @@ # 'ALTER EVENT'. # ############################################################################## -source include/master-slave.inc; + source include/have_binlog_format_statement.inc; -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*"); ---echo ---echo # On slave2 -connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT1,); -connection slave2; +--let $rpl_topology= 1->2->3 +--source include/rpl_init.inc ---echo # Connect slave2 to slave ---replace_result $SLAVE_MYPORT SLAVE_MYPORT; -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, - MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; -START SLAVE; -source include/wait_for_slave_to_start.inc; +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave +--let $rpl_server_number= 2 +--source include/rpl_connect.inc + +--disable_query_log +--connection server_1 +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*"); +--connection server_2 +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*"); +--connection server_3 +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*"); +--enable_query_log + +--connection master ---echo ---echo # [On master] -connection master; ---disable_warnings -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; ---enable_warnings 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%'; @@ -64,75 +60,76 @@ connection conn1; --echo # [On conn1] --echo # Verify 'REVOKE ALL' statement REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); -let $diff_table= test.v_user; -let $diff_server_list= master, slave, slave2; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user; +source include/diff_tables.inc; --echo --echo # Verify 'GRANT ... ON TABLE ...' statement -connection conn1; GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv; +source include/diff_tables.inc; --echo --echo # Verify 'GRANT ... ON PROCEDURE...' statement -connection conn1; GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); -let $diff_table= test.v_procs_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv; +source include/diff_tables.inc; --echo --echo # Verify 'GRANT ... ON *.* ...' statement -connection conn1; GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv; +source include/diff_tables.inc; --echo --echo # Verify 'REVOKE ... ON TABLE ...' statement -connection conn1; REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv; +source include/diff_tables.inc; --echo --echo # Verify 'REVOKE ... ON PROCEDURE...' statement -connection conn1; REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); -let $diff_table= test.v_procs_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv; +source include/diff_tables.inc; --echo --echo # Verify 'REVOKE ... ON *.* ...' statement -connection conn1; REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); -let $diff_table= test.v_user; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user; +source include/diff_tables.inc; --echo --echo # Verify 'GRANT ...' statement in the procedure -connection conn1; CREATE PROCEDURE my_grant() GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); call my_grant; -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv; +source include/diff_tables.inc; --echo --echo # Verify 'REVOKE ... ON TABLE ...' statement in the procedure -connection conn1; CREATE PROCEDURE my_revoke() REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); call my_revoke; -let $diff_table= test.v_tables_priv; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv; +source include/diff_tables.inc; --echo --echo # Verify 'RENAME USER ...' statement -connection conn1; RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; -let $diff_table= test.v_user; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user; +source include/diff_tables.inc; disconnect conn1; @@ -143,7 +140,9 @@ GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; connect (conn1, 127.0.0.1, 'bug48321_2'@'localhost',,); connection conn1; DROP USER CURRENT_USER(); -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user; +source include/diff_tables.inc; --echo --echo # Verify 'ALTER EVENT...' statement @@ -152,16 +151,17 @@ CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; --echo # Explicitly assign CURRENT_USER() to definer ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; -let $diff_table= test.v_event; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_event, server_2:v_event, server_3:v_event; +source include/diff_tables.inc; -connection master; --echo --echo # Session user will be set as definer, if the statement does not assign --echo # a definer ALTER EVENT e1 ENABLE; -sync_slave_with_master; -source include/rpl_diff_tables.inc; +--source include/rpl_sync.inc +let $diff_tables= server_1:v_event, server_2:v_event, server_3:v_event; +source include/diff_tables.inc; --echo --echo # Verify that this patch does not affect the calling of CURRENT_USER() @@ -173,8 +173,8 @@ SELECT * FROM t1; sync_slave_with_master; --echo # [On slave] SELECT * FROM t1; ---echo # [On slave2] -sync_slave_with_master slave2; +--echo # [On server_3] +sync_slave_with_master server_3; SELECT * FROM t1; connection master; @@ -184,8 +184,8 @@ SELECT * FROM t1; sync_slave_with_master; --echo # [On slave] SELECT * FROM t1; -sync_slave_with_master slave2; ---echo # [On slave2] +sync_slave_with_master server_3; +--echo # [On server_3] SELECT * FROM t1; connection master; @@ -195,8 +195,8 @@ SELECT * FROM t1; sync_slave_with_master; --echo # [On slave] SELECT * FROM t1; -sync_slave_with_master slave2; ---echo # [On slave2] +sync_slave_with_master server_3; +--echo # [On server_3] SELECT * FROM t1; connection master; @@ -219,8 +219,8 @@ sync_slave_with_master; --echo # [On slave] SELECT * FROM t1; SELECT * FROM t2; -sync_slave_with_master slave2; ---echo # [On slave2] +sync_slave_with_master server_3; +--echo # [On server_3] SELECT * FROM t1; SELECT * FROM t2; @@ -234,6 +234,5 @@ DROP PROCEDURE my_grant; DROP PROCEDURE my_revoke; DROP FUNCTION my_user; DROP EVENT e1; -sync_slave_with_master; -sync_slave_with_master slave2; -source include/master-slave-end.inc; +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_ddl.test b/mysql-test/suite/rpl/t/rpl_ddl.test index 80df16a7a00..83a530131a6 100644 --- a/mysql-test/suite/rpl/t/rpl_ddl.test +++ b/mysql-test/suite/rpl/t/rpl_ddl.test @@ -30,3 +30,4 @@ let $temp_engine_type= MEMORY; let $show_binlog = 0; let $manipulate = 0; -- source extra/rpl_tests/rpl_ddl.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test b/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test index ee907f81b22..b2d4e42a973 100644 --- a/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test @@ -1,10 +1,3 @@ -################################ -# Wrapper for rpl_deadlock.test# -################################ -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=innodb; diff --git a/mysql-test/suite/rpl/t/rpl_delete_no_where.test b/mysql-test/suite/rpl/t/rpl_delete_no_where.test index 64a293b4058..4bfe6d07b5a 100644 --- a/mysql-test/suite/rpl/t/rpl_delete_no_where.test +++ b/mysql-test/suite/rpl/t/rpl_delete_no_where.test @@ -5,3 +5,4 @@ -- source include/master-slave.inc let $engine_type=myisam; -- source extra/rpl_tests/rpl_delete_no_where.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test index f04ac54ac50..94dd1c5d3f4 100644 --- a/mysql-test/suite/rpl/t/rpl_do_grant.test +++ b/mysql-test/suite/rpl/t/rpl_do_grant.test @@ -213,17 +213,19 @@ stop slave; connection master; # user was already dropped in the slave before -# so no need to wait for the slave to replicate -# this statement (if it did and we later synced -# the slave it would end up in an error anyway) +# so we should not replicate this statement. +SET SQL_LOG_BIN= 0; DROP USER 'create_rout_db'@'localhost'; +SET SQL_LOG_BIN= 1; --enable_warnings # finish entire clean up (remove binlogs) # so that we leave a pristine environment for the # following tests --- source include/master-slave-reset.inc +--let $rpl_only_running_threads= 1 +-- source include/rpl_reset.inc +USE test; # BUG#49119: Master crashes when executing 'REVOKE ... ON # {PROCEDURE|FUNCTION} FROM ...' @@ -248,7 +250,7 @@ DROP USER 'create_rout_db'@'localhost'; -- echo ######## BUG#49119 ####### -- echo ### i) test case from the 'how to repeat section' --- source include/master-slave-reset.inc + -- connection master CREATE TABLE t1(c1 INT); @@ -269,7 +271,7 @@ DROP PROCEDURE p1; -- echo ### ii) Test case in which REVOKE partially succeeds -- connection master --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master CREATE TABLE t1(c1 INT); @@ -329,8 +331,7 @@ DROP USER 'user49119'@'localhost'; # Bug #51987 revoke privileges logs wrong error code # --- connection master --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master grant all on *.* to foo@"1.2.3.4"; @@ -344,14 +345,29 @@ revoke all privileges, grant option from "foo"; ## assertion: slave replicates revoke and does not fail because master ## logged revoke with correct expected error code --- let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1) - if ($err) -{ - -- die UNEXPECTED ERROR AT SLAVE: $err -} +--source include/check_slave_no_error.inc -- connection master DROP USER foo@"1.2.3.4"; -- sync_slave_with_master ---echo "End of test" +--echo +--echo # Bug#27606 GRANT statement should be replicated with DEFINER information +--source include/rpl_reset.inc +--connection master +GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost; + +SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; +sync_slave_with_master; +SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; + +--connection master +REVOKE SELECT ON mysql.user FROM user_bug27606@localhost; +SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; +sync_slave_with_master; +SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; + +--connection master +DROP USER user_bug27606@localhost; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_drop.test b/mysql-test/suite/rpl/t/rpl_drop.test index 7af325240ee..7b8873345b9 100644 --- a/mysql-test/suite/rpl/t/rpl_drop.test +++ b/mysql-test/suite/rpl/t/rpl_drop.test @@ -1,13 +1,12 @@ # Testcase for BUG#4552 (DROP on two tables, one of which does not # exist, must be binlogged with a non-zero error code) source include/master-slave.inc; ---disable_warnings -drop table if exists t1, t2; ---enable_warnings + create table t1 (a int); --error 1051 drop table t1, t2; -sync_slave_with_master; +--sync_slave_with_master # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_drop_db.test b/mysql-test/suite/rpl/t/rpl_drop_db.test index 11e93e7307a..c3194f08f52 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_db.test +++ b/mysql-test/suite/rpl/t/rpl_drop_db.test @@ -58,4 +58,5 @@ drop table t1; drop database mysqltest1; sync_slave_with_master; -source include/stop_slave.inc; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_drop_if_exists.test b/mysql-test/suite/rpl/t/rpl_drop_if_exists.test deleted file mode 100644 index 6b2b37ae791..00000000000 --- a/mysql-test/suite/rpl/t/rpl_drop_if_exists.test +++ /dev/null @@ -1,115 +0,0 @@ -# BUG#13684: -# SP: DROP PROCEDURE|FUNCTION IF EXISTS not binlogged if routine -# does not exist -# -# There is an inconsistency with DROP DATABASE IF EXISTS, DROP -# TABLE IF EXISTS and DROP VIEW IF EXISTS: those are binlogged even -# if the DB or TABLE does not exist, whereas DROP PROCEDURE IF -# EXISTS does not. It would be nice or at least consistent if DROP -# PROCEDURE/STATEMENT worked the same too. -# -# Description: -# DROP PROCEDURE|FUNCTION IF EXISTS does not get binlogged whereas DROP -# DATABASE|TABLE|TRIGGER|... IF EXISTS do. -# -# Fixed DROP PROCEDURE|FUNCTION IF EXISTS by adding a call to -# write_bin_log in mysql_execute_command. Checked also if all -# documented "DROP (...) IF EXISTS" get binlogged. Left out DROP -# SERVER IF EXISTS because it seems that it only gets binlogged when -# using row event (see BUG#25705). -# -# TODO: add DROP SERVER IF EXISTS to the test case when its -# binlogging procedure gets fixed (BUG#25705). Furthermore, when -# logging in RBR format the events that get logged are effectively in -# RBR format and not in STATEMENT format meaning that one must needs -# to be extra careful when writing a test for it, or change the CREATE -# SERVER logging to always log as STATEMENT. You can quickly check this -# by enabling the flag below $fixed_bug_25705=1 and watch the diff on -# the STDOUT. More detail may be found on the generated reject file. -# -# Test is implemented as follows: -# -# i) test each "drop if exists" (DDL), found in MySQL 5.1 manual, -# on inexistent objects (except for DROP SERVER); -# ii) show binlog events; -# iii) create an object for each drop if exists statement; -# iv) issue "drop if exists" in existent objects. -# v) show binlog events; -# -# References: -# http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html -# ---source include/have_log_bin.inc -RESET MASTER; - -disable_warnings; - -# test all "drop if exists" in manual with inexistent objects -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; - -let $fixed_bug_25705 = 0; - -if($fixed_bug_25705) -{ - DROP SERVER IF EXISTS s_bug_13684; -} ---source include/show_binlog_events.inc - -# test drop with existing values - -# create -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; - -if($fixed_bug_25705) -{ - CREATE SERVER s_bug_13684 - FOREIGN DATA WRAPPER mysql - OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test'); -} - ---source include/show_binlog_events.inc - -# drop existing -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; -if($fixed_bug_25705) -{ - DROP SERVER IF EXISTS s_bug_13684; -} - ---source include/show_binlog_events.inc - -enable_warnings; diff --git a/mysql-test/suite/rpl/t/rpl_drop_temp.test b/mysql-test/suite/rpl/t/rpl_drop_temp.test index 7bc55c53447..641813070ca 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_temp.test +++ b/mysql-test/suite/rpl/t/rpl_drop_temp.test @@ -71,9 +71,8 @@ sync_slave_with_master; # BUG#54842: DROP TEMPORARY TABLE not binlogged after manual switching binlog format to ROW # --- connection master --- source include/master-slave-reset.inc --- connection master +--source include/rpl_reset.inc +--connection master CREATE TABLE t1 ( i INT ); --sync_slave_with_master @@ -95,3 +94,4 @@ SHOW STATUS LIKE 'Slave_open_temp_tables'; DROP TABLE t1; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_drop_view.test b/mysql-test/suite/rpl/t/rpl_drop_view.test index 05bf112b8b8..55a0ea104d8 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_view.test +++ b/mysql-test/suite/rpl/t/rpl_drop_view.test @@ -32,3 +32,4 @@ select * from v3; connection master; drop table t1, t2, t3; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test index ab1de6a2e9f..618576f5641 100644 --- a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test +++ b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test @@ -6,33 +6,21 @@ # of their server id). # It also will test BUG#13861. -source include/master-slave.inc; source include/have_innodb.inc; - -# set up "dual head" - -# Needed for debug info in wait_for_slave_sql_to_stop. -let $master_connection= slave; -connection slave; -reset master; - -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root"; - -source include/start_slave.inc; +--let $rpl_topology= 1->2->1 +--source include/rpl_init.inc # now we test it -connection slave; +connection server_2; create table t1 (n int); let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1); let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1); let $master_log_pos_1= `SELECT $master_log_pos_1 + 3`; -sync_slave_with_master master; +--sync_slave_with_master server_1 # # BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if @@ -42,7 +30,7 @@ source include/stop_slave.inc; create table t2 (n int); # create one ignored event -sync_slave_with_master; +--sync_slave_with_master server_2 show tables; @@ -59,7 +47,8 @@ insert into t3 values(3); commit; insert into t3 values(4); -connection master; + +connection server_1; # bug is that START SLAVE UNTIL may stop too late, we test that by # asking it to stop before creation of t3. @@ -89,26 +78,20 @@ source include/start_slave.inc; # BUG#13023 is that Exec_master_log_pos may stay too low "forever": -connection master; +connection server_1; create table t4 (n int); # create 3 ignored events create table t5 (n int); create table t6 (n int); -sync_slave_with_master; -sync_slave_with_master master; +--sync_slave_with_master server_2 # then BUG#13023 caused hang below ("master" looks behind, while it's # not in terms of updates done). +--sync_slave_with_master server_1 show tables; # cleanup - -source include/stop_slave.inc; -reset slave; -drop table t1,t2,t3,t4,t5,t6; - -sync_slave_with_master; - -# End of 4.1 tests +drop table t1, t2, t3, t4, t5, t6; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_empty_master_host.test b/mysql-test/suite/rpl/t/rpl_empty_master_host.test index 7d245b1d5d5..df0c85ad7ec 100644 --- a/mysql-test/suite/rpl/t/rpl_empty_master_host.test +++ b/mysql-test/suite/rpl/t/rpl_empty_master_host.test @@ -49,3 +49,4 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); # start slave must succeed. START SLAVE; --source include/wait_for_slave_to_start.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test index 05cccdbae1d..9ebed299956 100644 --- a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test +++ b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test @@ -64,3 +64,6 @@ DROP TABLE test.t4; sync_slave_with_master; # End of 4.1 tests # Adding comment for force manual merge 5.0 -> wl1012. delete me if needed + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_events.test b/mysql-test/suite/rpl/t/rpl_events.test index 45ef12862fc..1de5006f647 100644 --- a/mysql-test/suite/rpl/t/rpl_events.test +++ b/mysql-test/suite/rpl/t/rpl_events.test @@ -101,3 +101,4 @@ DROP EVENT event44331_2; DROP EVENT event44331_3; DROP EVENT event44331_4; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_extraCol_innodb.test b/mysql-test/suite/rpl/t/rpl_extraCol_innodb.test deleted file mode 100644 index e9685baf01b..00000000000 --- a/mysql-test/suite/rpl/t/rpl_extraCol_innodb.test +++ /dev/null @@ -1,13 +0,0 @@ -########################################### -# Author: Jeb -# Date: 2006-09-08 -# Purpose: Wapper for rpl_extraSlave_Col.test -# Using innodb -########################################### --- source include/have_binlog_format_row.inc --- source include/have_innodb.inc --- source include/master-slave.inc -let $engine_type = 'InnoDB'; --- source extra/rpl_tests/rpl_extraSlave_Col.test - - diff --git a/mysql-test/suite/rpl/t/rpl_extraCol_myisam.test b/mysql-test/suite/rpl/t/rpl_extraCol_myisam.test deleted file mode 100644 index d56df394ccf..00000000000 --- a/mysql-test/suite/rpl/t/rpl_extraCol_myisam.test +++ /dev/null @@ -1,12 +0,0 @@ -########################################### -# Author: Jeb -# Date: 2006-09-07 -# Purpose: Wapper for rpl_extraSlave_Col.test -# Using MyISAM -########################################### --- source include/have_binlog_format_row.inc --- source include/master-slave.inc -let $engine_type = 'MyISAM'; --- source extra/rpl_tests/rpl_extraSlave_Col.test - - diff --git a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test b/mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test index 29758366577..f48880b5dfa 100644 --- a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test @@ -6,4 +6,6 @@ -- source include/have_innodb.inc let $engine_type = 'InnoDB'; ---source extra/rpl_tests/rpl_extraMaster_Col.test +--source extra/rpl_tests/rpl_extra_col_master.test + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test b/mysql-test/suite/rpl/t/rpl_extra_col_master_myisam.test index 31529a19cfc..4f344cfaca9 100644 --- a/mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_extra_col_master_myisam.test @@ -5,4 +5,6 @@ -- source include/master-slave.inc let $engine_type = 'MyISAM'; ---source extra/rpl_tests/rpl_extraMaster_Col.test +--source extra/rpl_tests/rpl_extra_col_master.test + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_extra_col_slave_innodb.test b/mysql-test/suite/rpl/t/rpl_extra_col_slave_innodb.test new file mode 100644 index 00000000000..f4b04468273 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_extra_col_slave_innodb.test @@ -0,0 +1,7 @@ +-- source include/have_binlog_format_row.inc +-- source include/have_innodb.inc +-- source include/master-slave.inc + +let $engine_type = 'InnoDB'; +-- source extra/rpl_tests/rpl_extra_col_slave.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_extra_col_slave_myisam.test b/mysql-test/suite/rpl/t/rpl_extra_col_slave_myisam.test new file mode 100644 index 00000000000..d8d64aed566 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_extra_col_slave_myisam.test @@ -0,0 +1,6 @@ +-- source include/have_binlog_format_row.inc +-- source include/master-slave.inc + +let $engine_type = 'MyISAM'; +-- source extra/rpl_tests/rpl_extra_col_slave.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_failed_optimize-master.opt b/mysql-test/suite/rpl/t/rpl_failed_optimize-master.opt deleted file mode 100644 index 3f82baff598..00000000000 --- a/mysql-test/suite/rpl/t/rpl_failed_optimize-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb-lock-wait-timeout=1 diff --git a/mysql-test/suite/rpl/t/rpl_failed_optimize.test b/mysql-test/suite/rpl/t/rpl_failed_optimize.test index 81e8342b5c0..798b3ef8b41 100644 --- a/mysql-test/suite/rpl/t/rpl_failed_optimize.test +++ b/mysql-test/suite/rpl/t/rpl_failed_optimize.test @@ -1,10 +1,3 @@ -####################################### -# Wrapper for rpl_failed_optimize.test# -####################################### -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=InnoDB; diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test index aa2dee0fe57..13c66f9f64b 100644 --- a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test +++ b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test @@ -122,6 +122,8 @@ UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id # if any of the above statement are not ignored, it would cause error # and stop slave sql thread. sync_slave_with_master; +connection slave; +call mtr.add_suppression("Slave SQL.*Error .Table .test.t[47]. doesn.t exist. on query.* Error_code: 1146"); connection master; # Parameters for include/wait_for_slave_sql_error_and_skip.inc: @@ -204,4 +206,4 @@ SELECT * FROM t3; connection master; echo [on master]; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_flush_logs.test b/mysql-test/suite/rpl/t/rpl_flush_logs.test index 5159acaae14..6e9de634157 100644 --- a/mysql-test/suite/rpl/t/rpl_flush_logs.test +++ b/mysql-test/suite/rpl/t/rpl_flush_logs.test @@ -24,23 +24,16 @@ sync_slave_with_master; --echo # Make sure relay logs was not be flushed --echo # after execute 'flush error logs' statement. --error 1 -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000004; - - -# Test 'flush relay logs' statement. ---echo # Make sure the 'slave-relay-bin.000004' file does not ---echo # exist before execute 'flush relay logs' statement. ---error 1 -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000004; +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000003; connection master; --echo # Test if support 'flush relay logs' statement. flush relay logs; sync_slave_with_master; ---echo # Check the 'slave-relay-bin.000004' file is created +--echo # Check the 'slave-relay-bin.000003' file is created --echo # after executed 'flush relay logs' statement. -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000004; +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000003; connection master; --echo # Make sure binary logs was not be flushed @@ -96,10 +89,10 @@ file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001; # Test 'flush error logs, relay logs' statement sync_slave_with_master; ---echo # Make sure the 'slave-relay-bin.000007' file does not exist +--echo # Make sure the 'slave-relay-bin.000006' file does not exist --echo # exist before execute 'flush error logs, relay logs' statement. --error 1 -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007; +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000006; connection master; @@ -114,19 +107,19 @@ file_exists $MYSQLTEST_VARDIR/tmp/master_log.err; file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000003; sync_slave_with_master; ---echo # Check the 'slave-relay-bin.000007' file is created after +--echo # Check the 'slave-relay-bin.000006' file is created after --echo # execute 'flush error logs, relay logs' statement. -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007; +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000006; # Test 'flush logs' statement ---echo # Make sure the 'slave-relay-bin.000008' and 'slave-relay-bin.000009' ---echo # files do not exist before execute 'flush error logs, relay logs' +--echo # Make sure the 'slave-relay-bin.000007' and 'slave-relay-bin.000008' +--echo # files do not exist before execute 'flush error logs, relay logs' --echo # statement. --error 1 -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008; +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007; --error 1 -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000009; +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008; connection master; @@ -140,8 +133,9 @@ file_exists $MYSQLTEST_VARDIR/tmp/master_log.err; file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000003; sync_slave_with_master; ---echo # Check the 'slave-relay-bin.000008' and 'slave-relay-bin.000009' +--echo # Check the 'slave-relay-bin.000007' and 'slave-relay-bin.000008' --echo # files are created after execute 'flush logs' statement. +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007; file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008; -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000009; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt index ad7fd508afe..3b5d41d4261 100644 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt +++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt @@ -1 +1 @@ ---max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/mysqld.1/data/relay-log +--max_binlog_size=1M diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh deleted file mode 100644 index a321dd690cd..00000000000 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh +++ /dev/null @@ -1,5 +0,0 @@ -rm -f $MYSQLTEST_VARDIR/slave-data/*-bin.* -rm -f $MYSQLTEST_VARDIR/slave-data/master.info -rm -f $MYSQLTEST_VARDIR/slave-data/*.index - - diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt index c8d2f85bcb7..3b5d41d4261 100644 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt @@ -1 +1 @@ ---max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/mysqld.2/data/relay-log +--max_binlog_size=1M diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh deleted file mode 100644 index e46ea6d400b..00000000000 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh +++ /dev/null @@ -1,4 +0,0 @@ -rm -f $MYSQLTEST_VARDIR/master-data/master.info -rm -f $MYSQLTEST_VARDIR/master-data/*-bin.* -rm -f $MYSQLTEST_VARDIR/master-data/*.index - diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test index 76cd73ba9e0..d5d362bac0f 100644 --- a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test +++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test @@ -1,37 +1,12 @@ # Testing if "flush logs" command bouncing resulting in logs created in a loop # in case of bi-directional replication --- source include/master-slave.inc -# Use wait_for_slave_to_(start|stop) for current connections -let $keep_connection= 1; +--let $rpl_topology= 1->2->1 +--source include/rpl_init.inc let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/ show variables like 'relay_log%'; -connection slave; ---disable_warnings -stop slave; ---source include/wait_for_slave_to_stop.inc ---enable_warnings ---replace_result $MASTER_MYPORT MASTER_PORT -eval change master to master_host='127.0.0.1',master_user='root', - master_password='',master_port=$MASTER_MYPORT; -start slave; ---source include/wait_for_slave_to_start.inc -# -# Start replication slave -> master -# -connection master; ---disable_warnings -stop slave; ---source include/wait_for_slave_to_stop.inc ---enable_warnings ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval change master to master_host='127.0.0.1',master_user='root', - master_password='',master_port=$SLAVE_MYPORT; - -source include/start_slave.inc; - # # Flush logs of slave # @@ -43,16 +18,16 @@ source include/start_slave.inc; CREATE TABLE t1 (a INT KEY) ENGINE= MyISAM; let $wait_binlog_event= CREATE TABLE t1; --source include/wait_for_binlog_event.inc -sync_slave_with_master; +sync_slave_with_master server_2; -connection master; +connection server_1; INSERT INTO t1 VALUE(1); FLUSH LOGS; -sync_slave_with_master; +sync_slave_with_master server_2; INSERT INTO t1 VALUE(2); let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1); -sync_slave_with_master master; +sync_slave_with_master server_1; # # Check that the master server's slave threads are still running and show @@ -63,7 +38,9 @@ sync_slave_with_master master; --source include/show_slave_status.inc --disable_query_log -connection master; +connection server_1; DROP TABLE t1; -sync_slave_with_master; +sync_slave_with_master server_2; --enable_query_log + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test b/mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test index d085bff2012..ce28c0334ec 100644 --- a/mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test @@ -1,10 +1,3 @@ -################################### -# Wrapper for rpl_foreign_key.test# -################################### -# Change Author: JBM -# Change Date: 2006-01-17 -# Change: FK not supported, skip test when NDB is forced -#################################### -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=INNODB; diff --git a/mysql-test/suite/rpl/t/rpl_free_items.test b/mysql-test/suite/rpl/t/rpl_free_items.test index 043e84160b8..581409cfc10 100644 --- a/mysql-test/suite/rpl/t/rpl_free_items.test +++ b/mysql-test/suite/rpl/t/rpl_free_items.test @@ -20,3 +20,4 @@ drop table t2; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_geometry.test b/mysql-test/suite/rpl/t/rpl_geometry.test index eac98924b98..769c49c96b1 100644 --- a/mysql-test/suite/rpl/t/rpl_geometry.test +++ b/mysql-test/suite/rpl/t/rpl_geometry.test @@ -23,4 +23,4 @@ sync_slave_with_master; connection master; drop table t1, t2; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_get_lock.test b/mysql-test/suite/rpl/t/rpl_get_lock.test index b4ca57ce541..b5c08858055 100644 --- a/mysql-test/suite/rpl/t/rpl_get_lock.test +++ b/mysql-test/suite/rpl/t/rpl_get_lock.test @@ -22,9 +22,7 @@ while ($1) dec $1; } enable_query_log; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; select get_lock("lock",3); select * from t1; # There is no point in testing REPLICATIION of the IS_*_LOCK @@ -41,8 +39,9 @@ select is_free_lock("lock2"); select is_free_lock(NULL); connection master1; drop table t1; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; + + +--source include/rpl_end.inc # End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test index 60765581faf..01247fefd64 100644 --- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test +++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test @@ -7,12 +7,6 @@ # So they can't be verified by test case here. # Finish the following tests by calling its common test script: # extra/rpl_tests/rpl_get_master_version_and_clock.test. -# And meanwhile this test checks that the slave I/O thread refuses to start if slave -# and master have the same server id (because this is a useless setup, -# and otherwise SHOW SLAVE STATUS shows progress but all queries are -# ignored, which has caught our customers), unless -# --replicate-same-server-id. -# source include/master-slave.inc; source include/have_debug.inc; @@ -48,20 +42,6 @@ source extra/rpl_tests/rpl_get_master_version_and_clock.test; eval set global debug= '$debug_saved'; -#Test case 3: This test checks that the slave I/O thread refuses to start -#if slave and master have the same server id. -connection slave; -reset master; -# replicate ourselves -source include/stop_slave.inc; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval change master to master_port=$SLAVE_MYPORT; -start slave; - ---echo *** must be having the replicate-same-server-id IO thread error *** -let $slave_io_errno= 1593; -let $show_slave_io_error= 1; -source include/wait_for_slave_io_error.inc; # cleanup @@ -69,3 +49,4 @@ source include/wait_for_slave_io_error.inc; SET DEBUG_SYNC= 'RESET'; # End of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_grant.test b/mysql-test/suite/rpl/t/rpl_grant.test index 6fbdafc0f9c..1091e5aab0d 100644 --- a/mysql-test/suite/rpl/t/rpl_grant.test +++ b/mysql-test/suite/rpl/t/rpl_grant.test @@ -36,3 +36,5 @@ sync_slave_with_master; --echo **** On Slave **** SELECT user,host FROM mysql.user WHERE user like 'dummy%'; SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat-master.opt b/mysql-test/suite/rpl/t/rpl_heartbeat-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_heartbeat-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat.test b/mysql-test/suite/rpl/t/rpl_heartbeat.test index 59c3e10915e..92bf10eb741 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test @@ -142,7 +142,7 @@ source include/check_slave_param.inc; let $slave_wait_param_counter= 300; let $slave_value= query_get_value("SHOW STATUS like 'Slave_received_heartbeats'", Value, 1); # Checking the fact that at least one heartbeat is received -while (`select $slave_value = 0`) +while (!$slave_value) { dec $slave_wait_param_counter; if (!$slave_wait_param_counter) @@ -165,5 +165,6 @@ drop table t1; sync_slave_with_master; set @@global.slave_net_timeout= @restore_slave_net_timeout; +--source include/stop_slave.inc --echo End of tests diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf index a3ed77c8bd2..f24de9ab8b8 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf @@ -1,17 +1,12 @@ !include ../my.cnf [mysqld.1] -server_id=1 +log-slave-updates [mysqld.2] -server_id=2 +log-slave-updates [mysqld.3] -server_id=3 [ENV] -SLAVE_MYPORT1= @mysqld.3.port -SLAVE_MYSOCK1= @mysqld.3.socket - - - +SERVER_MYPORT_3= @mysqld.3.port diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test index 81737feea9e..6bdd2bbee63 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test @@ -4,98 +4,91 @@ # Purpose: Testing heartbeat for schema # 1 master and 2 slaves ############################################################# ---source include/master-slave.inc ---echo +--let $rpl_topology= 1->2,1->3 +--source include/rpl_init.inc ---echo *** Preparing *** ---connection master -let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); ---connection slave ---echo [on slave] +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave_1 +--let $rpl_server_number= 2 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave_2 +--let $rpl_server_number= 3 +--source include/rpl_connect.inc + +# +# Set different heartbeat periods for slaves +# +--connection slave_1 --source include/stop_slave.inc -RESET SLAVE; ---replace_result $MASTER_MYPORT MASTER_PORT $binlog_file MASTER_BINLOG -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='$binlog_file'; +CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD = 0.1; --source include/start_slave.inc ---disconnect slave1 ---connect(slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,) ---connection slave1 ---echo [on slave1] ---disable_warnings -STOP SLAVE; ---enable_warnings -RESET SLAVE; ---replace_result $MASTER_MYPORT MASTER_PORT $binlog_file MASTER_BINLOG -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$binlog_file'; +--connection slave_2 +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD = 1; --source include/start_slave.inc ---echo # -# Testing heartbeat +# Testing heartbeat for one master and two slaves # # Check that heartbeat events sent to both slaves with correct periods ---echo *** 2 slaves *** ---connection slave +--connection slave_1 let $status_var= slave_received_heartbeats; let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); let $status_var_comparsion= >; --source include/wait_for_status_var.inc --echo Slave has received heartbeat event ---connection slave1 +--connection slave_2 let $status_var= slave_received_heartbeats; let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); let $status_var_comparsion= >; --source include/wait_for_status_var.inc -let $slave1_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); ---echo Slave1 has received heartbeat event ---connection slave -let $slave_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); -let $result= query_get_value(SELECT ($slave_rcvd_heartbeats DIV $slave1_rcvd_heartbeats) > 1 AS Result, Result, 1); ---echo Slave has received more heartbeats than Slave1 (1 means 'yes'): $result +--let $assert_cond= [slave_1:SHOW STATUS LIKE "slave_received_heartbeats", Value, 1] > [slave_2:SHOW STATUS LIKE "slave_received_heartbeats", Value, 1] +--let $assert_text= slave_1 should have received more heartbeats than slave_2 +--source include/assert.inc --echo +# Create topology master->slave_2->slave_1 and check that slave_1 +# receives heartbeat while slave_2 gets data. + +# slave_2 was started w/o --log-slave-updates because slave_2 should +# not send data from master to slave_1 -# Create topology A->B->C and check that C receives heartbeat while B gets data -# Slave1 (B) started w/o --log-slave-updates because B should not send data from A to C ---echo *** Master->data->Slave1->heartbeat->Slave: *** ---connection slave1 ---echo [on slave1] -RESET MASTER; -let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); ---connection slave ---echo [on slave] +--source include/rpl_stop_slaves.inc +--let $rpl_topology= 1->3->2 +--source include/rpl_change_topology.inc +--source include/rpl_start_slaves.inc +--connection slave_1 --source include/stop_slave.inc -RESET SLAVE; ---replace_result $SLAVE_MYPORT1 SLAVE1_PORT $binlog_file SLAVE1_BINLOG -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT1, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.2, MASTER_LOG_FILE='$binlog_file'; +CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=0.1; --source include/start_slave.inc -# Check heartbeat for new replication channel slave1->slave + +# Check heartbeat for new replication channel slave_2->slave let $status_var= slave_received_heartbeats; let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); let $status_var_comparsion= >; --source include/wait_for_status_var.inc ---echo Slave has received heartbeat event +--echo slave_1 has received heartbeat event --connection master --echo [on master] CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT); INSERT INTO t1 VALUES (1, 'on master', ''); ---save_master_pos SHOW TABLES; ---connection slave1 ---sync_with_master 0 ---echo [on slave1] +--echo [on slave_2] +--sync_slave_with_master slave_2 SHOW TABLES; -let $slave_pos_before= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); ---save_master_pos ---connection slave ---sync_with_master 0 ---echo [on slave] +let $slave_2_pos_before= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); +--echo [on slave_1] +--sync_slave_with_master slave_1 SHOW TABLES; --connection master --echo [on master] ---echo creating updates on master and send to slave1 during 5 second -# Generate events on master and send to slave1 during 5 second +--echo creating updates on master and send to slave_2 during 5 second +# Generate events on master and send to slave_2 during 5 second let $i= 1; let $j= 1; let $k= 1; @@ -103,17 +96,15 @@ let $k= 1; while ($i) { eval SET @c_text=REPEAT('1234567890', $j); eval UPDATE t1 SET a=$j, c=@c_text; - --connection slave1 - let $slave_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); - if (`SELECT ($k*($slave_pos - $slave_pos_before)) > 0`) { - --connection slave - let $slave_rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); + --connection slave_2 + let $slave_2_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); + if (`SELECT ($k*($slave_2_pos - $slave_2_pos_before)) > 0`) { + --connection slave_1 + let $slave_1_rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); let $k= 0; let $time_before = `SELECT NOW()`; } if (`SELECT ((1-$k)*TIMESTAMPDIFF(SECOND,'$time_before',NOW())) > 5`) { - --connection slave - let $slave_rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); let $i= 0; } --connection master @@ -121,10 +112,11 @@ while ($i) { sleep 0.1; } --enable_query_log ---connection slave ---echo [on slave] -let $result= query_get_value(SELECT ($slave_rcvd_heartbeats_after - $slave_rcvd_heartbeats_before) > 0 AS Result, Result, 1); ---echo Slave has received heartbeats (1 means 'yes'): $result +--connection slave_1 +--echo [on slave_1] +--let $assert_cond= [SHOW STATUS LIKE "slave_received_heartbeats", Value, 1] > $slave_1_rcvd_heartbeats_before +--let $assert_text= slave_1 should have received heartbeats +--source include/assert.inc --echo # @@ -133,10 +125,5 @@ let $result= query_get_value(SELECT ($slave_rcvd_heartbeats_after - $slave_rcvd_ --echo *** Clean up *** --connection master DROP TABLE t1; ---save_master_pos ---connection slave1 ---sync_with_master 0 ---echo -# End of 6.0 test ---echo End of 6.0 test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test index 1f8ce4c1d78..b9a170c5bc1 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test @@ -18,6 +18,9 @@ --source include/have_binlog_format_mixed.inc --echo +# Set number of retries to connect to master +let $connect_retry= 20; + --echo *** Preparing *** --connection slave --source include/stop_slave.inc @@ -57,7 +60,7 @@ RESET SLAVE; SET @@global.slave_net_timeout=30; --enable_warnings --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=5; RESET SLAVE; SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; --echo @@ -68,7 +71,7 @@ SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; SET @@global.slave_net_timeout=50; --enable_warnings --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root'; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry; SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; SET @@global.slave_net_timeout=@restore_slave_net_timeout; RESET SLAVE; @@ -88,7 +91,7 @@ RESET SLAVE; let $slave_net_timeout= query_get_value(SHOW VARIABLES LIKE 'slave_net_timeout', Value, 1); inc $slave_net_timeout; --replace_result $MASTER_MYPORT MASTER_PORT $slave_net_timeout SLAVE_NET_TIMEOUT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=$slave_net_timeout; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=$slave_net_timeout; RESET SLAVE; --echo @@ -98,7 +101,7 @@ RESET SLAVE; SET @@global.slave_net_timeout=20; --enable_warnings --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=5; SHOW VARIABLES LIKE 'slave_net_timeout'; SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; SET @@global.slave_net_timeout=2*@@global.slave_net_timeout; @@ -118,9 +121,10 @@ SET @@global.slave_net_timeout=500; SET @@global.slave_net_timeout=200; RESET SLAVE; --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root'; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry; --source include/start_slave.inc ---sync_with_master +--connection master +--sync_slave_with_master SHOW VARIABLES LIKE 'slave_net_timeout'; SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; SET @@global.slave_net_timeout=@restore_slave_net_timeout; @@ -137,9 +141,10 @@ SET @@global.slave_net_timeout=@restore_slave_net_timeout; SET @@global.slave_net_timeout=100; --enable_warnings --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=20; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=20; --source include/start_slave.inc ---sync_with_master +--connection master +--sync_slave_with_master SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; --source include/stop_slave.inc SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; @@ -152,18 +157,9 @@ SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; SET @@global.slave_net_timeout=50; --enable_warnings --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=30; ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect -wait -EOF ---echo Reload slave ---shutdown_server 10 ---source include/wait_until_disconnected.inc ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect -restart -EOF ---enable_reconnect ---source include/wait_until_connected_again.inc +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=30; +--let $rpl_server_number= 2 +--source include/rpl_restart_server.inc SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; SET @restore_slave_net_timeout=@@global.slave_net_timeout; --echo @@ -171,11 +167,12 @@ SET @restore_slave_net_timeout=@@global.slave_net_timeout; # Disable heartbeat --echo *** Disable heartbeat *** --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0; SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; SHOW STATUS LIKE 'slave_received_heartbeats'; --source include/start_slave.inc ---sync_with_master +--connection master +--sync_slave_with_master --sleep 2 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; SHOW STATUS LIKE 'slave_received_heartbeats'; @@ -194,48 +191,48 @@ let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_hea --echo *** Min slave_heartbeat_timeout *** --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.001; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.001; SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; RESET SLAVE; --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.0009; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.0009; SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; RESET SLAVE; --echo --echo *** Max slave_heartbeat_timeout *** --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=4294967; SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; RESET SLAVE; --replace_result $MASTER_MYPORT MASTER_PORT --error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294968; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=4294968; RESET SLAVE; # Check double size of max allowed value for master_heartbeat_period --replace_result $MASTER_MYPORT MASTER_PORT --error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=8589935; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=8589935; RESET SLAVE; # Check 2^32 --replace_result $MASTER_MYPORT MASTER_PORT --error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967296; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=4294967296; RESET SLAVE; --echo --echo *** Misc incorrect values *** --replace_result $MASTER_MYPORT MASTER_PORT --error ER_PARSE_ERROR -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='-1'; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD='-1'; RESET SLAVE; --replace_result $MASTER_MYPORT MASTER_PORT --error ER_PARSE_ERROR -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='123abc'; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD='123abc'; RESET SLAVE; --replace_result $MASTER_MYPORT MASTER_PORT --error ER_PARSE_ERROR -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=''; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=''; RESET SLAVE; --echo @@ -246,9 +243,10 @@ RESET SLAVE; # Check received heartbeat events for running slave --echo *** Running slave *** --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1; --source include/start_slave.inc ---sync_with_master +--connection master +--sync_slave_with_master let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); let $status_var= slave_received_heartbeats; let $status_var_comparsion= >; @@ -276,8 +274,7 @@ let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbea # Check received heartbeat events for stopped IO thread --echo *** Stopped IO thread *** -STOP SLAVE IO_THREAD; ---source include/wait_for_slave_io_to_stop.inc +--source include/stop_slave_io.inc let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); sleep 2; let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); @@ -296,8 +293,7 @@ let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbea # Check received heartbeat events for stopped SQL thread --echo *** Stopped SQL thread *** -STOP SLAVE SQL_THREAD; ---source include/wait_for_slave_sql_to_stop.inc +--source include/stop_slave_sql.inc let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); sleep 2; let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); @@ -323,6 +319,8 @@ INSERT INTO t1 VALUES (1, 'on slave', NULL); --connection master INSERT INTO t1 VALUES (1, 'on master', NULL); --connection slave +call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.. on query.* Error_code: 1062"); +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); let $slave_errno= ER_DUP_ENTRY --source include/wait_for_slave_sql_error.inc let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); @@ -349,14 +347,13 @@ DELIMITER ;| --connection slave RESET SLAVE; --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=5; --source include/start_slave.inc --connection master # Enable scheduler SET @@global.event_scheduler=1; ---connection slave +--sync_slave_with_master let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); ---sync_with_master # Wait some updates for table t1 from master let $wait_condition= SELECT COUNT(*)=1 FROM t1 WHERE a > 5; --source include/wait_condition.inc @@ -382,7 +379,7 @@ DROP TABLE t1; RESET MASTER; --connection slave --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.5; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.5; let $slave_param_comparison= =; --source include/start_slave.inc let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); @@ -409,7 +406,7 @@ SET @@global.slave_compressed_protocol=1; RESET SLAVE; SET @@global.slave_compressed_protocol=1; --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1; --source include/start_slave.inc let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); let $status_var= slave_received_heartbeats; @@ -428,7 +425,7 @@ SET @@global.slave_compressed_protocol=0; STOP SLAVE; RESET SLAVE; --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1; --source include/start_slave.inc let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); --connection master @@ -447,7 +444,7 @@ let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_b STOP SLAVE; RESET SLAVE; --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1; --source include/start_slave.inc # Wait until slave_received_heartbeats will be incremented let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); @@ -455,21 +452,11 @@ let $status_var= slave_received_heartbeats; let $status_var_comparsion= >; --source include/wait_for_status_var.inc --echo Heartbeat event received ---connection master ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF ---echo Reload master ---shutdown_server 10 ---source include/wait_until_disconnected.inc ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart -EOF ---enable_reconnect ---source include/wait_until_connected_again.inc ---connection slave +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc # make sure IO thread has re-connected # due to slow valgrind env the following wait_for_status may time out +--let $rpl_allow_error= 1 --source include/wait_for_slave_io_to_start.inc # Wait until slave_received_heartbeats will be incremented let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); @@ -482,13 +469,17 @@ let $status_var_comparsion= >; # Circular replication: demonstrating bidirectional hearbeat flow --echo *** Circular replication *** # Configure circular replication ---source include/master-slave-reset.inc ---connection slave +--source include/rpl_reset.inc --source include/stop_slave.inc -let $slave_binlog= query_get_value(SHOW MASTER STATUS, File, 1); +--let $rpl_topology= 1->2->1 +--source include/rpl_change_topology.inc + +#--connection slave +#--source include/stop_slave.inc +#let $slave_binlog= query_get_value(SHOW MASTER STATUS, File, 1); --connection master ---replace_result $SLAVE_MYPORT SLAVE_PORT $slave_binlog SLAVE_BINLOG -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$slave_binlog'; +#--replace_result $SLAVE_MYPORT SLAVE_PORT $slave_binlog SLAVE_BINLOG +#eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$slave_binlog'; --source include/start_slave.inc # Insert data on master and on slave and make sure that it replicated for both directions @@ -501,9 +492,7 @@ CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=0.1; --source include/start_slave.inc --sync_with_master INSERT INTO t1 VALUES(2, 'on slave'); ---save_master_pos ---connection master ---sync_with_master +--sync_slave_with_master master SELECT * FROM t1 ORDER BY a; let $master_rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); --connection slave @@ -531,12 +520,10 @@ let $slave_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_hea # --echo *** Clean up *** --connection master ---source include/stop_slave.inc +#--source include/stop_slave.inc DROP TABLE t1; --sync_slave_with_master ---source include/stop_slave.inc SET @@global.slave_net_timeout=@restore_slave_net_timeout; ---echo -# End of tests ---echo End of tests +#--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test b/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test index 6460b157b52..810db4cc6f7 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test @@ -46,9 +46,11 @@ let $status_var_comparsion= >; # Clean up # --echo *** Clean up *** ---connection master ---sync_slave_with_master ---echo - -# End of 6.0 test ---echo End of 6.0 test +--source include/stop_slave.inc +CHANGE MASTER TO + MASTER_SSL=0, + MASTER_SSL_CA='', + MASTER_SSL_CERT='', + MASTER_SSL_KEY=''; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test index a1931ce9b60..c229711e005 100644 --- a/mysql-test/suite/rpl/t/rpl_idempotency.test +++ b/mysql-test/suite/rpl/t/rpl_idempotency.test @@ -4,9 +4,10 @@ source include/master-slave.inc; # Add suppression for expected warning(s) in slaves error log -call mtr.add_suppression("Slave: Can't find record in 't.' Error_code: 1032"); -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"); +call mtr.add_suppression("Slave SQL.*Can.t find record in .t[12].* Error_code: 1032"); +call mtr.add_suppression("Slave SQL.*Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451"); +call mtr.add_suppression("Slave SQL.*Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); +call mtr.add_suppression("Slave SQL.*Could not execute Write_rows event on table test.* Duplicate entry .1. for key .PRIMARY.* Error_code: 1062"); connection master; CREATE TABLE t1 (a INT PRIMARY KEY); @@ -34,10 +35,7 @@ SELECT * FROM t2 ORDER BY a; sync_slave_with_master; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +--source include/check_slave_no_error.inc # An insert of a row that already exists. Since we are replacing the # row if it already exists, the most apropriate representation is @@ -50,10 +48,7 @@ INSERT IGNORE INTO t1 VALUES (-2); SELECT * FROM t1 ORDER BY a; sync_slave_with_master; SELECT * FROM t1 ORDER BY a; -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +--source include/check_slave_no_error.inc # BUG#19958: RBR idempotency issue for UPDATE and DELETE @@ -78,13 +73,12 @@ SELECT * FROM t2 ORDER BY a; sync_slave_with_master; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +--source include/check_slave_no_error.inc connection master; DROP TABLE t1, t2; sync_slave_with_master; SET @@global.slave_exec_mode= @old_slave_exec_mode; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ignore_grant.test b/mysql-test/suite/rpl/t/rpl_ignore_grant.test index 2e6e2ce9a31..34074ba8ca9 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_grant.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_grant.test @@ -57,3 +57,4 @@ delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ignore_revoke.test b/mysql-test/suite/rpl/t/rpl_ignore_revoke.test index 00171605a92..db20e807afc 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_revoke.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_revoke.test @@ -49,3 +49,4 @@ sync_slave_with_master; # Since changes to mysql.* are ignored, the revoke need to # be done on slave as well delete from mysql.user where user="user_foo"; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test index 15c4b193669..233206c4135 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_table.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test @@ -127,6 +127,7 @@ show grants for mysqltest4@localhost; # where mysqltest1 does not exist on slave, # to succeed on slave the mode is temporarily changed set global slave_exec_mode='IDEMPOTENT'; +call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table mysql.* Error_code: 1032"); connection master; drop table t1, mysqltest2.t2; @@ -176,3 +177,6 @@ SELECT * FROM tmptbl504451f4258$1; connection master; DROP TABLE t5; sync_slave_with_master; + +--source include/rpl_end.inc +--source include/force_restart.inc diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table_update.test b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test index fe030f90411..840052e2f25 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_table_update.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test @@ -36,3 +36,4 @@ sync_with_master; drop table mysqltest_foo,mysqltest_bar,t1; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test index 08096d03c11..d6034009f4f 100644 --- a/mysql-test/suite/rpl/t/rpl_incident.test +++ b/mysql-test/suite/rpl/t/rpl_incident.test @@ -15,6 +15,7 @@ SELECT * FROM t1; connection slave; # Wait until SQL thread stops with error LOST_EVENT on master +call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occured on the master.* 1590"); let $slave_sql_errno= 1590; let $show_slave_sql_error= 1; source include/wait_for_slave_sql_error.inc; @@ -37,3 +38,4 @@ source include/check_slave_is_running.inc; connection master; DROP TABLE t1; --sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_init_slave.test b/mysql-test/suite/rpl/t/rpl_init_slave.test index 58d1f6bdc01..1803b146819 100644 --- a/mysql-test/suite/rpl/t/rpl_init_slave.test +++ b/mysql-test/suite/rpl/t/rpl_init_slave.test @@ -25,10 +25,10 @@ set global init_connect="set @c=1"; show variables like 'init_connect'; connection master; sync_slave_with_master; -source include/stop_slave.inc; # Restore changed global variable set global init_connect= @my_global_init_connect; set global max_connections= default; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test index 180821730ec..4dab13856d4 100644 --- a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test +++ b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test @@ -53,11 +53,12 @@ start slave; # slave is going to stop because of emulated failures # but there won't be any crashes nor asserts hit. # -source include/wait_for_slave_to_stop.inc; +# 1593 = ER_SLAVE_FATAL_ERROR +--let $slave_sql_errno= 1593 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc -let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1); -echo Reporting the following error: $error; -call mtr.add_suppression("Failed during slave I/O thread initialization"); +call mtr.add_suppression("Failed during slave.* thread initialization"); SET GLOBAL debug= ""; @@ -66,22 +67,23 @@ SET GLOBAL debug= ""; ###################################################################### connection slave; ---disable_warnings -stop slave; ---enable_warnings -source include/wait_for_slave_to_stop.inc; - reset slave; SET GLOBAL init_slave= "garbage"; start slave; -source include/wait_for_slave_sql_to_stop.inc; - -let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1); -echo Reporting the following error: $error; +# 1064 = ER_PARSE_ERROR +--let $slave_sql_errno= 1064 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc ###################################################################### # Clean up ###################################################################### SET GLOBAL init_slave= ""; + +# Clean up Last_SQL_Error +--source include/stop_slave_io.inc +RESET SLAVE; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test b/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test index a9cd6b15b6e..782c01ec04f 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test @@ -151,4 +151,4 @@ DROP TABLE test.regular_tbl; DROP TABLE test.bykey_tbl; DROP TABLE test.byrange_tbl; ---source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test b/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test index 4311328b064..9bfce61804b 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test @@ -62,5 +62,5 @@ connection master; DROP PROCEDURE test.proc_norm; DROP TABLE test.regular_tbl; ---source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_innodb_mixed_ddl.test b/mysql-test/suite/rpl/t/rpl_innodb_mixed_ddl.test index 6eb9c7075e4..5147e67c160 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_mixed_ddl.test +++ b/mysql-test/suite/rpl/t/rpl_innodb_mixed_ddl.test @@ -1,6 +1,4 @@ ######################################### -# Author: Serge Kozlov skozlov@mysql.com -# Date: 07/10/2006 # Purpose: testing the replication in mixed mode # Requirements: define binlog format for mysqld as in example below: # ./mysql-test-run.pl --mysqld=--binlog-format=mixed @@ -8,7 +6,4 @@ --source include/have_binlog_format_mixed.inc --source include/have_innodb.inc let $engine_type= innodb; - --source suite/rpl/include/rpl_mixed_ddl.inc - -# End 5.1 Test Case diff --git a/mysql-test/suite/rpl/t/rpl_innodb_mixed_dml.test b/mysql-test/suite/rpl/t/rpl_innodb_mixed_dml.test index d48e847a6c8..d04ced0f476 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_mixed_dml.test +++ b/mysql-test/suite/rpl/t/rpl_innodb_mixed_dml.test @@ -1,6 +1,4 @@ ######################################### -# Author: Serge Kozlov skozlov@mysql.com -# Date: 07/10/2006 # Purpose: testing the replication in mixed mode # Requirements: define binlog format for mysqld as in example below: # ./mysql-test-run.pl --mysqld=--binlog-format=mixed @@ -8,7 +6,4 @@ --source include/have_binlog_format_mixed.inc --source include/have_innodb.inc let $engine_type= innodb; - --source suite/rpl/include/rpl_mixed_dml.inc - -# End 5.1 Test Case diff --git a/mysql-test/suite/rpl/t/rpl_insert.test b/mysql-test/suite/rpl/t/rpl_insert.test index 6f916fb1f90..2a29139ac48 100644 --- a/mysql-test/suite/rpl/t/rpl_insert.test +++ b/mysql-test/suite/rpl/t/rpl_insert.test @@ -42,3 +42,4 @@ connection master; USE test; DROP SCHEMA mysqlslap; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_insert_duplicate.test b/mysql-test/suite/rpl/t/rpl_insert_duplicate.test new file mode 100644 index 00000000000..7dd38a696ae --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_insert_duplicate.test @@ -0,0 +1,14 @@ +######################################### +# Wrapper for rpl_insert_duplicate.test # +######################################### +-- source include/master-slave.inc +-- source include/have_innodb.inc +#-- source include/have_binlog_format_mixed_or_statement.inc + +let $engine_type=innodb; +-- source extra/rpl_tests/rpl_insert_duplicate.test + +let $engine_type=myisam; +-- source extra/rpl_tests/rpl_insert_duplicate.test + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_insert_id.test b/mysql-test/suite/rpl/t/rpl_insert_id.test index 6daecce5843..f2f62a207a0 100644 --- a/mysql-test/suite/rpl/t/rpl_insert_id.test +++ b/mysql-test/suite/rpl/t/rpl_insert_id.test @@ -1,12 +1,7 @@ ################################# # Wrapper for rpl_insert_id.test# ################################# -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=myisam; -- source extra/rpl_tests/rpl_insert_id.test -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/t/rpl_insert_id_pk.test b/mysql-test/suite/rpl/t/rpl_insert_id_pk.test index 01f30b78ac5..c0d68855f85 100644 --- a/mysql-test/suite/rpl/t/rpl_insert_id_pk.test +++ b/mysql-test/suite/rpl/t/rpl_insert_id_pk.test @@ -1,10 +1,6 @@ ################################# # Wrapper for rpl_insert_id.test# ################################# -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=innodb; diff --git a/mysql-test/suite/rpl/t/rpl_insert_ignore.test b/mysql-test/suite/rpl/t/rpl_insert_ignore.test index 69be49634d0..0346975fcee 100644 --- a/mysql-test/suite/rpl/t/rpl_insert_ignore.test +++ b/mysql-test/suite/rpl/t/rpl_insert_ignore.test @@ -7,6 +7,10 @@ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -let $engine_type=innodb; -let $engine_type2=myisam; +-- let $engine_type=innodb -- source extra/rpl_tests/rpl_insert_ignore.test + +-- let $engine_type=myisam +-- source extra/rpl_tests/rpl_insert_ignore.test + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_insert_select.test b/mysql-test/suite/rpl/t/rpl_insert_select.test index 677be526982..23bc7ecd167 100644 --- a/mysql-test/suite/rpl/t/rpl_insert_select.test +++ b/mysql-test/suite/rpl/t/rpl_insert_select.test @@ -17,3 +17,4 @@ select * from t1; connection master; drop table t1,t2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_invoked_features.test b/mysql-test/suite/rpl/t/rpl_invoked_features.test index 74ea8e12a98..7770c36c397 100644 --- a/mysql-test/suite/rpl/t/rpl_invoked_features.test +++ b/mysql-test/suite/rpl/t/rpl_invoked_features.test @@ -308,3 +308,4 @@ DROP EVENT IF EXISTS e11; --sync_slave_with_master slave # End 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix-master.opt b/mysql-test/suite/rpl/t/rpl_ip_mix-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_ip_mix-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix.test b/mysql-test/suite/rpl/t/rpl_ip_mix.test index 0852b3f4ff7..c86e1ba54b7 100644 --- a/mysql-test/suite/rpl/t/rpl_ip_mix.test +++ b/mysql-test/suite/rpl/t/rpl_ip_mix.test @@ -35,7 +35,6 @@ connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT); connection master; reset master; source include/show_master_status.inc; -save_master_pos; --echo connection slave; connection slave; reset slave; @@ -50,10 +49,6 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); eval change master to master_host='0:0:0:0:0:0:0:1'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host ---echo disconnect slave; -disconnect slave; ---echo disconnect master; -disconnect master; ---echo connection default; -connection default; +# clean up +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix2-master.opt b/mysql-test/suite/rpl/t/rpl_ip_mix2-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_ip_mix2-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix2.test b/mysql-test/suite/rpl/t/rpl_ip_mix2.test index 5d687006b76..3c928cffbc6 100644 --- a/mysql-test/suite/rpl/t/rpl_ip_mix2.test +++ b/mysql-test/suite/rpl/t/rpl_ip_mix2.test @@ -50,10 +50,6 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); eval change master to master_host='0:0:0:0:0:0:0:1'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host ---echo disconnect slave; -disconnect slave; ---echo disconnect master; -disconnect master; ---echo connection default; -connection default; +# clean up +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; diff --git a/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6.test b/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6.test index ecd5a754fdc..cacf5e187ef 100644 --- a/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6.test +++ b/mysql-test/suite/rpl/t/rpl_ipv4_as_ipv6.test @@ -66,10 +66,6 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); eval change master to master_host='0:0000:0000:0:0000:FFFF:127.0.0.1'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host ---echo disconnect slave; -disconnect slave; ---echo disconnect master; -disconnect master; ---echo connection default; -connection default; +# clean up +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; diff --git a/mysql-test/suite/rpl/t/rpl_ipv6.test b/mysql-test/suite/rpl/t/rpl_ipv6.test index 3eceedfd7a4..c42221445fb 100644 --- a/mysql-test/suite/rpl/t/rpl_ipv6.test +++ b/mysql-test/suite/rpl/t/rpl_ipv6.test @@ -52,10 +52,6 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); eval change master to master_host='0:0:0:0:0:0:0:1'; let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); --echo Master-Host: $master_host ---echo disconnect slave; -disconnect slave; ---echo disconnect master; -disconnect master; ---echo connection default; -connection default; +# clean up +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; diff --git a/mysql-test/suite/rpl/t/rpl_killed_ddl.test b/mysql-test/suite/rpl/t/rpl_killed_ddl.test index 6957289b2d5..eff0392d5de 100644 --- a/mysql-test/suite/rpl/t/rpl_killed_ddl.test +++ b/mysql-test/suite/rpl/t/rpl_killed_ddl.test @@ -122,7 +122,7 @@ echo [on master]; # This will block the execution of a statement at the DBUG_SYNC_POINT # with given lock name -if (`SELECT '$debug_lock' != ''`) +if ($debug_lock) { disable_query_log; disable_result_log; @@ -142,8 +142,8 @@ disable_warnings; ######## DATABASE ######## -let $diff_statement= SELECT schema_name FROM information_schema.schemata - WHERE schema_name LIKE 'd%' ORDER BY schema_name; +let $rpl_diff_statement= SELECT schema_name FROM information_schema.schemata + WHERE schema_name LIKE \'d%\' ORDER BY schema_name; send CREATE DATABASE d2; source include/kill_query_and_diff_master_slave.inc; @@ -162,9 +162,9 @@ source include/kill_query_and_diff_master_slave.inc; ######## EVENT ######## -let $diff_statement= SELECT event_name, event_body, execute_at - FROM information_schema.events where event_name like 'e%' - ORDER BY event_name; +let $rpl_diff_statement= SELECT event_name, event_body, execute_at + FROM information_schema.events where event_name like \'e%\' + ORDER BY event_name; send CREATE EVENT e2 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY @@ -185,7 +185,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## FUNCTION ######## -let $diff_statement= SHOW FUNCTION STATUS LIKE 'f%'; +--let $rpl_diff_statement= SHOW FUNCTION STATUS LIKE \'f%\' send CREATE FUNCTION f2 () RETURNS INT DETERMINISTIC RETURN 1; @@ -214,7 +214,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## PROCEDURE ######## -let $diff_statement= SHOW PROCEDURE STATUS LIKE 'p%'; +--let $rpl_diff_statement= SHOW PROCEDURE STATUS LIKE \'p%\' DELIMITER //; send CREATE PROCEDURE p2 (OUT rows INT) @@ -237,7 +237,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## TABLE ######## -let $diff_statement= SHOW TABLES LIKE 't%'; +--let $rpl_diff_statement= SHOW TABLES LIKE \'t%\' send CREATE TABLE t2 (b int); source include/kill_query_and_diff_master_slave.inc; @@ -250,7 +250,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## INDEX ######## -let $diff_statement= SHOW INDEX FROM t1; +--let $rpl_diff_statement= SHOW INDEX FROM t1 send CREATE INDEX i2 on t1 (a); source include/kill_query_and_diff_master_slave.inc; @@ -263,7 +263,7 @@ source include/kill_query_and_diff_master_slave.inc; # Tempoarily disabled, see bug#25705 -# let $diff_statement= SELECT * FROM mysql.server WHERE name like 's%'; +# --let $rpl_diff_statement= SELECT * FROM mysql.server WHERE name like \'s%\' # send CREATE SERVER s2 # FOREIGN DATA WRAPPER mysql @@ -287,7 +287,7 @@ connection master; CREATE TABLE IF NOT EXISTS t4 (a int); connection master1; -let $diff_statement= SHOW TRIGGERS LIKE 'v%'; +--let $rpl_diff_statement= SHOW TRIGGERS LIKE \'v%\' DELIMITER //; send CREATE TRIGGER tr2 BEFORE INSERT ON t4 @@ -306,7 +306,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## VIEW ######## -let $diff_statement= SHOW TABLES LIKE 'v%'; +--let $rpl_diff_statement= SHOW TABLES LIKE \'v%\' send CREATE VIEW v2 AS SELECT a FROM t1 WHERE a > 100; source include/kill_query_and_diff_master_slave.inc; @@ -319,7 +319,7 @@ source include/kill_query_and_diff_master_slave.inc; ######## DROP TABLE ######## -let $diff_statement= SHOW TABLES LIKE 't%'; +--let $rpl_diff_statement= SHOW TABLES LIKE \'t%\' send DROP TABLE t1; source include/kill_query_and_diff_master_slave.inc; @@ -360,3 +360,4 @@ DROP PROCEDURE IF EXISTS p2; DROP PROCEDURE IF EXISTS p3; DROP PROCEDURE IF EXISTS p4; enable_warnings; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test index b48698baa47..f4b854eff87 100644 --- a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test +++ b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test @@ -25,11 +25,12 @@ connection master; INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10; SELECT * FROM t1; connection slave; ---source include/wait_for_slave_sql_to_stop.inc + # show the error message #1105 = ER_UNKNOWN_ERROR --let $slave_sql_errno= 1105 --let $show_slave_sql_error= 1 +call mtr.add_suppression("Slave SQL.*suffer.*http:..bugs.mysql.com.bug.php.id=24432"); --source include/wait_for_slave_sql_error.inc # show that it was not replicated SELECT * FROM t1; @@ -83,17 +84,25 @@ ON DUPLICATE KEY UPDATE t1.field_3 = t2.field_c; SELECT * FROM t1; connection slave; ---source include/wait_for_slave_sql_to_stop.inc + # show the error message #1105 = ER_UNKNOWN_ERROR --let $slave_sql_errno= 1105 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error.inc + # show that it was not replicated SELECT * FROM t1; connection master; + +# clean up drop table t1, t2; connection slave; drop table t1, t2; +# clear error message in sql thread +--source include/stop_slave_io.inc +RESET SLAVE; # End of 5.0 tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_load_from_master-slave.opt b/mysql-test/suite/rpl/t/rpl_load_from_master-slave.opt deleted file mode 100644 index c015c02ba78..00000000000 --- a/mysql-test/suite/rpl/t/rpl_load_from_master-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---replicate-wild-do-table=mysqltest.% diff --git a/mysql-test/suite/rpl/t/rpl_loaddata.test b/mysql-test/suite/rpl/t/rpl_loaddata.test index d5e0388be46..9f4ca1aaf18 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata.test @@ -1,7 +1,3 @@ -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_binlog_format_statement.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test index 3e1bc917a41..bb87ee95913 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test @@ -46,3 +46,4 @@ source include/rpl_loaddata_charset.inc; # LOAD DATA LOCAL INFILE let $LOAD_LOCAL=0; source include/rpl_loaddata_charset.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test index b8975308a86..be099c1b6c4 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test @@ -15,6 +15,7 @@ connection master; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1; connection slave; +call mtr.add_suppression("Slave SQL.*Fatal error: Not enough memory, Error_code: 1593"); let $slave_sql_errno= 1593; let $show_slave_sql_error= 1; source include/wait_for_slave_sql_error_and_skip.inc; @@ -23,3 +24,4 @@ connection master; DROP TABLE t1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_m.test b/mysql-test/suite/rpl/t/rpl_loaddata_m.test index 48451c4aee1..1fe9283ef44 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_m.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_m.test @@ -48,3 +48,4 @@ DROP TABLE test.t1; sync_slave_with_master; # End of test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_map-master.opt b/mysql-test/suite/rpl/t/rpl_loaddata_map-master.opt index 831680eb5ef..5fdeb855110 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_map-master.opt +++ b/mysql-test/suite/rpl/t/rpl_loaddata_map-master.opt @@ -1 +1 @@ ---read_buffer_size=12K --max_allowed_packet=8K +--read_buffer_size=12K --max_allowed_packet=8K --net-buffer-length=8K diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_map-slave.opt b/mysql-test/suite/rpl/t/rpl_loaddata_map-slave.opt index 95f55bcf7d8..7d404fae240 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_map-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_loaddata_map-slave.opt @@ -1 +1 @@ ---max_allowed_packet=8K +--max_allowed_packet=8K --net-buffer-length=8K diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_map.test b/mysql-test/suite/rpl/t/rpl_loaddata_map.test index 1db7c4a893b..24c8221c20f 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_map.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_map.test @@ -71,3 +71,4 @@ connection master; drop table t2; sync_slave_with_master; remove_file $MYSQLTEST_VARDIR/tmp/bug30435_5k.txt; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_s.test b/mysql-test/suite/rpl/t/rpl_loaddata_s.test index 91ebcf058a6..2116796871a 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_s.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_s.test @@ -24,3 +24,4 @@ source include/show_binlog_events.inc; connection master; drop table test.t1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_simple.test b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test index 439c2b48ca5..a09d3feec42 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_simple.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test @@ -12,3 +12,4 @@ SELECT * FROM t1 ORDER BY word; connection master; drop table t1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh index 066f72926af..e5bb3e61d11 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh +++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh @@ -1 +1,2 @@ +rm -f $MYSQLTEST_VARDIR/std_data_master_link ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_master_link diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh index 218209a2542..7a0c0bb382a 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh +++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh @@ -1 +1,2 @@ +rm -f $MYSQLTEST_VARDIR/std_data_slave_link ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_slave_link diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test b/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test index 69b481bddd1..c73fa2897f3 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test @@ -19,3 +19,4 @@ connection master; drop table t1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test index ed556f3aedf..4ebe572741f 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test +++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test @@ -151,12 +151,34 @@ eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug43746.sql' INTO TABLE t1; --echo [slave] sync_slave_with_master; -# cleanup +--echo +--echo Bug #59267: +--echo "LOAD DATA LOCAL INFILE not executed on slave with SBR" +--echo ---remove_file $MYSQLD_DATADIR/bug43746.sql +--echo [master] +connection master; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug59267.sql' FROM t1; +TRUNCATE TABLE t1; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug59267.sql' INTO TABLE t1; + +SELECT 'Master', COUNT(*) FROM t1; + +--echo [slave] +--sync_slave_with_master +SELECT 'Slave', COUNT(*) FROM t1; + +# cleanup --echo [master] connection master; + +--remove_file $MYSQLD_DATADIR/bug43746.sql +--remove_file $MYSQLD_DATADIR/bug59267.sql + DROP TABLE t1; SET SESSION sql_mode=@old_mode; @@ -164,3 +186,55 @@ SET SESSION sql_mode=@old_mode; sync_slave_with_master; connection master; + +--echo +--echo Bug #60580/#11902767: +--echo "statement improperly replicated crashes slave sql thread" +--echo + +--echo [master] +connection master; +let $MYSQLD_DATADIR= `select @@datadir`; + +CREATE TABLE t1(f1 INT, f2 INT); +CREATE TABLE t2(f1 INT, f2 TIMESTAMP); + +INSERT INTO t2 VALUES(1, '2011-03-22 21:01:28'); +INSERT INTO t2 VALUES(2, '2011-03-21 21:01:28'); +INSERT INTO t2 VALUES(3, '2011-03-20 21:01:28'); + +CREATE TABLE t3 AS SELECT * FROM t2; + +CREATE VIEW v1 AS SELECT * FROM t2 + WHERE f1 IN (SELECT f1 FROM t3 WHERE (t3.f2 IS NULL)); + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval SELECT 1 INTO OUTFILE '$MYSQLD_DATADIR/bug60580.csv' FROM DUAL; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug60580.csv' INTO TABLE t1 (@f1) SET f2 = (SELECT f1 FROM v1 WHERE f1=@f1); + +SELECT * FROM t1; + +sleep 1; + +--echo [slave] +sync_slave_with_master; + +SELECT * FROM t1; + +--remove_file $MYSQLD_DATADIR/bug60580.csv + +--echo [master] +connection master; + +DROP VIEW v1; +DROP TABLE t1, t2, t3; + +--echo [slave] +sync_slave_with_master; + +connection master; +--source include/rpl_end.inc + +--echo # End of 5.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test index adb23d2c2bc..ced0054c52c 100644 --- a/mysql-test/suite/rpl/t/rpl_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_loadfile.test @@ -58,8 +58,7 @@ # vii) assert that the contents of master and slave # table are the same -connection master; -source include/reset_master_and_slave.inc; +--source include/rpl_reset.inc connection master; let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data; @@ -105,11 +104,12 @@ sync_slave_with_master; # if the file was removed before the slave started, # meaning that contents were indeed transfered # through binlog (in row format) -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; # CLEAN UP +--connection master DROP TABLE t1; DROP PROCEDURE p; -sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_locale.test b/mysql-test/suite/rpl/t/rpl_locale.test index 2f2d637e1b4..0d6692dd89c 100644 --- a/mysql-test/suite/rpl/t/rpl_locale.test +++ b/mysql-test/suite/rpl/t/rpl_locale.test @@ -22,3 +22,4 @@ sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test index daf4b9093fe..44837e45715 100644 --- a/mysql-test/suite/rpl/t/rpl_log_pos.test +++ b/mysql-test/suite/rpl/t/rpl_log_pos.test @@ -32,9 +32,7 @@ start slave; let $slave_io_errno= 1236; let $show_slave_io_error= 1; source include/wait_for_slave_io_error.inc; ---disable_warnings -source include/stop_slave.inc; ---enable_warnings +source include/stop_slave_sql.inc; connection master; source include/show_master_status.inc; @@ -54,3 +52,4 @@ drop table t1; sync_slave_with_master; --echo End of 5.0 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test index ecdf10ac2c2..b0d3b23b4e1 100644 --- a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test +++ b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test @@ -58,10 +58,10 @@ FLUSH LOGS; # error to slave. call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log'); connection slave; -source include/wait_for_slave_io_to_stop.inc; -let $last_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1); -echo Last_IO_Error; -echo $last_error; +# 1236 = ER_MASTER_FATAL_ERROR_READING_BINLOG +--let $slave_io_errno= 1236 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc connection master; @@ -103,4 +103,4 @@ SHOW TABLES; connection master; DROP TABLE t1, t2, t3, t4; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_many_optimize.test b/mysql-test/suite/rpl/t/rpl_many_optimize.test index 91fab0b27a8..d5e9f69b4bc 100644 --- a/mysql-test/suite/rpl/t/rpl_many_optimize.test +++ b/mysql-test/suite/rpl/t/rpl_many_optimize.test @@ -20,3 +20,4 @@ drop table t1; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test index ea107a28954..25e27f62d0a 100644 --- a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test +++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test @@ -25,3 +25,5 @@ echo "*** must be NULL ***"; select master_pos_wait('foo', 98); # End of 4.1 tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions.test b/mysql-test/suite/rpl/t/rpl_misc_functions.test index d7ecde5f53c..7189e5c44ba 100644 --- a/mysql-test/suite/rpl/t/rpl_misc_functions.test +++ b/mysql-test/suite/rpl/t/rpl_misc_functions.test @@ -124,3 +124,4 @@ DROP FUNCTION test_replication_sf; --sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mix_found_rows.test b/mysql-test/suite/rpl/t/rpl_mix_found_rows.test index 9b8346ef21b..ed932eb5cea 100644 --- a/mysql-test/suite/rpl/t/rpl_mix_found_rows.test +++ b/mysql-test/suite/rpl/t/rpl_mix_found_rows.test @@ -156,3 +156,4 @@ DROP PROCEDURE log_me_inner; DROP FUNCTION log_rows; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mix_insert_delayed.test b/mysql-test/suite/rpl/t/rpl_mix_insert_delayed.test index 2c44829a649..a310fa254f7 100644 --- a/mysql-test/suite/rpl/t/rpl_mix_insert_delayed.test +++ b/mysql-test/suite/rpl/t/rpl_mix_insert_delayed.test @@ -3,3 +3,4 @@ --source include/not_embedded.inc --source include/not_windows.inc --source extra/rpl_tests/rpl_insert_delayed.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt b/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt deleted file mode 100644 index 45631525481..00000000000 --- a/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt +++ /dev/null @@ -1 +0,0 @@ ---binlog_cache_size=4096 --max_binlog_cache_size=7680 diff --git a/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size.test b/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size.test index 1d407f87dfa..3850a84cbf1 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size.test @@ -5,3 +5,4 @@ --source include/have_binlog_format_mixed.inc --source extra/rpl_tests/rpl_binlog_max_cache_size.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test b/mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test index c9b65d170ad..226a82dee97 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test @@ -80,3 +80,4 @@ sync_slave_with_master; connection master; DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test index 333697e27e9..c5b821ca906 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test @@ -47,3 +47,4 @@ drop table t2,t3,t5; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test index 8c635202ad5..f37ce90e524 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test @@ -8,3 +8,4 @@ --source include/have_innodb.inc --source extra/rpl_tests/rpl_drop_create_temp_table.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test index 1a32c388921..161ab2f9dca 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test @@ -8,3 +8,4 @@ --let $engine=Innodb set session storage_engine=innodb; --source extra/rpl_tests/rpl_implicit_commit_binlog.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_mixed_mixing_engines.test index 8bb5b61210b..0893f7d0158 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_mixing_engines.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_mixing_engines.test @@ -8,3 +8,4 @@ let $engine_type=Innodb; --source extra/rpl_tests/rpl_mixing_engines.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete.test b/mysql-test/suite/rpl/t/rpl_multi_delete.test index 568a8a578a9..80acf9c80e4 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_delete.test +++ b/mysql-test/suite/rpl/t/rpl_multi_delete.test @@ -22,3 +22,4 @@ drop table t1,t2; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete2.test b/mysql-test/suite/rpl/t/rpl_multi_delete2.test index c3f939276e0..7dc7ca41405 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_delete2.test +++ b/mysql-test/suite/rpl/t/rpl_multi_delete2.test @@ -64,3 +64,4 @@ drop database mysqltest_to; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_engine.test b/mysql-test/suite/rpl/t/rpl_multi_engine.test index 31c4a2050d7..b1dbf99f114 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_engine.test +++ b/mysql-test/suite/rpl/t/rpl_multi_engine.test @@ -102,3 +102,4 @@ DROP TABLE t1; sync_slave_with_master; # End of 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_update.test b/mysql-test/suite/rpl/t/rpl_multi_update.test index a6111455d16..710337816da 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_update.test +++ b/mysql-test/suite/rpl/t/rpl_multi_update.test @@ -1,7 +1,3 @@ -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_multi_update.test diff --git a/mysql-test/suite/rpl/t/rpl_multi_update2.test b/mysql-test/suite/rpl/t/rpl_multi_update2.test index 812a486ad69..497568f2738 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_update2.test +++ b/mysql-test/suite/rpl/t/rpl_multi_update2.test @@ -8,3 +8,4 @@ --source include/master-slave.inc let $engine_type=MyISAM; --source extra/rpl_tests/rpl_multi_update2.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_update3.test b/mysql-test/suite/rpl/t/rpl_multi_update3.test index 5da91c26b04..f6e70f14b30 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_update3.test +++ b/mysql-test/suite/rpl/t/rpl_multi_update3.test @@ -8,3 +8,4 @@ --source include/master-slave.inc let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_multi_update3.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_multi_update4.test b/mysql-test/suite/rpl/t/rpl_multi_update4.test index 4991a385f6f..8f069b9c18f 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_update4.test +++ b/mysql-test/suite/rpl/t/rpl_multi_update4.test @@ -43,3 +43,4 @@ drop database d2; sync_slave_with_master; # End of test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test index 8797da4eccc..fedad86ea91 100644 --- a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test +++ b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test @@ -30,7 +30,7 @@ sync_slave_with_master; connection master; let $after_position= query_get_value(SHOW MASTER STATUS, Position, 1); -if (`SELECT '$before_position'='$after_position'`) +if ($before_position == $after_position) { echo Master position is not changed; } @@ -48,7 +48,7 @@ connection master; let $after_file= query_get_value(SHOW MASTER STATUS, File, 1); let $after_position= query_get_value(SHOW MASTER STATUS, Position, 1); -if (!`SELECT '$before_position'='$after_position'`) +if ($before_position != $after_position) { echo Master position has been changed; } @@ -56,3 +56,5 @@ if (!`SELECT '$before_position'='$after_position'`) DROP DATABASE `mysqltest-1`; connection slave; DROP DATABASE `#mysql50#mysqltest-1`; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_name_const.test b/mysql-test/suite/rpl/t/rpl_name_const.test index d3ef557ddc0..4cacafa0523 100644 --- a/mysql-test/suite/rpl/t/rpl_name_const.test +++ b/mysql-test/suite/rpl/t/rpl_name_const.test @@ -45,4 +45,4 @@ select * from t1 order by id; connection master; drop table t1; drop procedure test_procedure; ---sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test index 2f2db01f422..94dbc56d73b 100644 --- a/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test +++ b/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test @@ -11,3 +11,4 @@ SET SESSION binlog_direct_non_transactional_updates = OFF; --enable_query_log let $engine_type=Innodb; --source extra/rpl_tests/rpl_mixing_engines.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_non_direct_row_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_non_direct_row_mixing_engines.test index 614519331e0..53d8fec9434 100644 --- a/mysql-test/suite/rpl/t/rpl_non_direct_row_mixing_engines.test +++ b/mysql-test/suite/rpl/t/rpl_non_direct_row_mixing_engines.test @@ -13,3 +13,4 @@ let $engine_type=Innodb; --source extra/rpl_tests/rpl_mixing_engines.test --diff_files suite/rpl/r/rpl_non_direct_row_mixing_engines.result suite/rpl/r/rpl_row_mixing_engines.result +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_non_direct_stm_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_non_direct_stm_mixing_engines.test index 448719eb4f8..13d4c998fb4 100644 --- a/mysql-test/suite/rpl/t/rpl_non_direct_stm_mixing_engines.test +++ b/mysql-test/suite/rpl/t/rpl_non_direct_stm_mixing_engines.test @@ -11,3 +11,4 @@ SET SESSION binlog_direct_non_transactional_updates = OFF; --enable_query_log let $engine_type=Innodb; --source extra/rpl_tests/rpl_mixing_engines.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test b/mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test index f8e697d58ce..a174445f667 100644 --- a/mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test +++ b/mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test @@ -50,8 +50,9 @@ INSERT INTO t1 VALUES (RAND()); INSERT INTO t1 VALUES (LAST_INSERT_ID()); --sync_slave_with_master ---let $diff_table_1= master:test.t1 ---let $diff_table_2= slave:test.t1 +--let $diff_tables= master:t1, slave:t1 --source include/diff_tables.inc +--connection master DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_not_null_innodb.test b/mysql-test/suite/rpl/t/rpl_not_null_innodb.test index dca0ea6589c..1e67ba4eda1 100644 --- a/mysql-test/suite/rpl/t/rpl_not_null_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_not_null_innodb.test @@ -17,3 +17,4 @@ let $engine=Innodb; --source extra/rpl_tests/rpl_not_null.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_not_null_myisam.test b/mysql-test/suite/rpl/t/rpl_not_null_myisam.test index 0c036f5bfd7..dcfaf006dad 100644 --- a/mysql-test/suite/rpl/t/rpl_not_null_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_not_null_myisam.test @@ -16,3 +16,4 @@ let $engine=MyISAM; --source extra/rpl_tests/rpl_not_null.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_optimize.test b/mysql-test/suite/rpl/t/rpl_optimize.test index 77d045e70fe..b48ef579b6b 100644 --- a/mysql-test/suite/rpl/t/rpl_optimize.test +++ b/mysql-test/suite/rpl/t/rpl_optimize.test @@ -63,3 +63,4 @@ sync_slave_with_master; # starts, this test will demonstrate nothing but will pass. # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test index 38b868cb59d..7e9a35883a3 100644 --- a/mysql-test/suite/rpl/t/rpl_packet.test +++ b/mysql-test/suite/rpl/t/rpl_packet.test @@ -26,8 +26,8 @@ let $old_net_buffer_length= `SELECT @@global.net_buffer_length`; SET @@global.max_allowed_packet=1024; SET @@global.net_buffer_length=1024; +sync_slave_with_master; # Restart slave for setting to take effect -connection slave; source include/stop_slave.inc; source include/start_slave.inc; @@ -84,17 +84,21 @@ connection master; INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); -# The slave I/O thread must stop after trying to read the above event -connection slave; ---source include/wait_for_slave_io_to_stop.inc -let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1); ---echo Slave_IO_Running = $slave_io_running (expect No) + # # Bug#42914: The slave I/O thread must stop after trying to read the above # event, However there is no Last_IO_Error report. # -let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1); -eval SELECT "$last_io_error" AS Last_IO_Error; + +# The slave I/O thread must stop after trying to read the above event +connection slave; +# 1153 = ER_NET_PACKET_TOO_LARGE +--let $slave_io_errno= 1153 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc + +# TODO: this is needed because of BUG#55790. Remove once that is fixed. +--source include/stop_slave_sql.inc # # Bug#42914: On the master, if a binary log event is larger than @@ -102,7 +106,14 @@ eval SELECT "$last_io_error" AS Last_IO_Error; # is sent to a slave when it requests a dump from the master, thus leading the # I/O thread to stop. However, there is no Last_IO_Error reported. # -source include/master-slave-reset.inc; + +--let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc +--connection master +DROP TABLE t1; +--sync_slave_with_master + + connection master; CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM; sync_slave_with_master; @@ -112,12 +123,10 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), R connection slave; # The slave I/O thread must stop after receiving -# ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master. ---source include/wait_for_slave_io_to_stop.inc -let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1); ---echo Slave_IO_Running = $slave_io_running (expect No) -let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1); -eval SELECT "$last_io_error" AS Last_IO_Error; +# 1236=ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master. +--let $slave_io_errno= 1236 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc # Remove the bad binlog and clear error status on slave. STOP SLAVE; @@ -160,4 +169,8 @@ eval SET @@global.net_buffer_length= $old_net_buffer_length; connection slave; DROP TABLE t1; +# Clear Last_IO_Error +RESET SLAVE; + +--source include/rpl_end.inc # End of tests diff --git a/mysql-test/suite/rpl/t/rpl_plugin_load.test b/mysql-test/suite/rpl/t/rpl_plugin_load.test index 100683922ad..5f9725a8e66 100644 --- a/mysql-test/suite/rpl/t/rpl_plugin_load.test +++ b/mysql-test/suite/rpl/t/rpl_plugin_load.test @@ -56,5 +56,5 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='EXAMPLE'; sync_slave_with_master; # # Cleanup ---source include/master-slave-end.inc +--source include/rpl_end.inc --echo End of test diff --git a/mysql-test/suite/rpl/t/rpl_ps.test b/mysql-test/suite/rpl/t/rpl_ps.test index 143f75e5477..b3d07dd1400 100644 --- a/mysql-test/suite/rpl/t/rpl_ps.test +++ b/mysql-test/suite/rpl/t/rpl_ps.test @@ -66,73 +66,36 @@ source include/wait_for_slave_to_stop.inc; ############################################################################### ---echo --echo # Connection: slave ---echo --connection slave ---echo START SLAVE; ---echo --echo # Connection: master ---echo --connection master ---echo CREATE DATABASE mysqltest1; CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32)); ---echo PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)'; ---echo EXECUTE stmt_d_1; ---echo use mysqltest1; ---echo EXECUTE stmt_d_1; ---echo ---sync_slave_with_master - - ---echo --echo # Connection: slave ---echo +--sync_slave_with_master ---echo SELECT * FROM t1; ---echo --echo # Connection: master ---echo --connection master ---echo DROP DATABASE mysqltest1; ---echo use test; DROP TABLE t1; ---echo ---sync_slave_with_master - - ---echo ---echo # Connection: slave ---echo - ---echo -STOP SLAVE; - ---echo ---echo ######################################################################## - -############################################################################### -reset master; -reset slave; -disconnect master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test index 4dca3e0880c..30cc564917a 100644 --- a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test +++ b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test @@ -31,3 +31,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp --remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql --remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_read_only.test b/mysql-test/suite/rpl/t/rpl_read_only.test index 040ae71586b..fb92803847a 100644 --- a/mysql-test/suite/rpl/t/rpl_read_only.test +++ b/mysql-test/suite/rpl/t/rpl_read_only.test @@ -41,30 +41,39 @@ set global read_only=0; connection master1; BEGIN; + +connection master2; +BEGIN; + +connection master; +select @@read_only; +set global read_only=1; + +connection master1; +-- echo *** On SUPER USER connection *** insert into t1 values(1002); --disable_warnings insert into t2 values(2002); --enable_warnings connection master2; -BEGIN; +-- echo *** On regular USER connection *** +--error ER_OPTION_PREVENTS_STATEMENT insert into t1 values(1003); ---disable_warnings +--error ER_OPTION_PREVENTS_STATEMENT insert into t2 values(2003); ---enable_warnings - -connection master; -set global read_only=1; connection master1; ## works even with read_only=1, because master1 is root +-- echo *** SUPER USER COMMIT (must succeed) *** COMMIT; connection master2; ---error ER_OPTION_PREVENTS_STATEMENT +-- echo *** regular USER COMMIT (must succeed - nothing to commit) *** COMMIT; connection master; +select @@read_only; set global read_only=0; connection master1; @@ -117,3 +126,4 @@ sync_slave_with_master; set global read_only=0; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_relay_space_innodb.test b/mysql-test/suite/rpl/t/rpl_relay_space_innodb.test index 156d53ef856..ca16a583fe5 100644 --- a/mysql-test/suite/rpl/t/rpl_relay_space_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_relay_space_innodb.test @@ -1,22 +1,4 @@ -################################### -# Wrapper rpl_sv_relay_space.test # -# This test has to be wrapped as # -# It tests ndb, innodb and MyISAM.# -# By Wrapping we are saving some # -# space and making the test more # -# Maintainable by only having one # -# test file and reusing the code # -# In Addition, INNODB has to have # -# Option files during this test # -# to force innodb on the slave # -# else the test will fail # -################################### -#Change Author: JBM # -#Change Date: 2006-02-03 # -#Change: Added Comments # -################################### -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=InnoDB; -- source extra/rpl_tests/rpl_sv_relay_space.test - diff --git a/mysql-test/suite/rpl/t/rpl_relay_space_myisam.test b/mysql-test/suite/rpl/t/rpl_relay_space_myisam.test index 1d8563e7fd9..13719cbdc33 100644 --- a/mysql-test/suite/rpl/t/rpl_relay_space_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_relay_space_myisam.test @@ -1,21 +1,3 @@ -################################### -# Wrapper rpl_sv_relay_space.test # -# This test has to be wrapped as # -# It tests ndb, innodb and MyISAM.# -# By Wrapping we are saving some # -# space and making the test more # -# Maintainable by only having one # -# test file and reusing the code # -# In Addition, INNODB has to have # -# Option files during this test # -# to force innodb on the slave # -# else the test will fail # -################################### -#Change Author: JBM # -#Change Date: 2006-02-03 # -#Change: Added Comments # -################################### -- source include/not_ndb_default.inc let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_sv_relay_space.test - diff --git a/mysql-test/suite/rpl/t/rpl_relayrotate.test b/mysql-test/suite/rpl/t/rpl_relayrotate.test index 248389d793d..f187fbc033f 100644 --- a/mysql-test/suite/rpl/t/rpl_relayrotate.test +++ b/mysql-test/suite/rpl/t/rpl_relayrotate.test @@ -12,3 +12,4 @@ let $engine_type=innodb; -- source extra/rpl_tests/rpl_relayrotate.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_relayspace.test b/mysql-test/suite/rpl/t/rpl_relayspace.test index cd04c2ccc0b..fc33d6bc0ba 100644 --- a/mysql-test/suite/rpl/t/rpl_relayspace.test +++ b/mysql-test/suite/rpl/t/rpl_relayspace.test @@ -2,10 +2,9 @@ # to force the deadlock after one event. source include/master-slave.inc; -let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1); +--let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1) connection slave; -stop slave; -source include/wait_for_slave_to_stop.inc; +--source include/stop_slave.inc connection master; # This will generate a master's binlog > 10 bytes create table t1 (a int); @@ -21,22 +20,33 @@ let $slave_param_value= Waiting for the slave SQL thread to free enough relay lo source include/wait_for_slave_param.inc; # A bug caused the I/O thread to refuse stopping. -stop slave io_thread; -source include/wait_for_slave_io_to_stop.inc; +--source include/stop_slave_io.inc reset slave; -start slave; -# The I/O thread stops filling the relay log when -# it's >10b. And the SQL thread cannot purge this relay log -# as purge is done only when the SQL thread switches to another -# relay log, which does not exist here. -# So we should have a deadlock. -# if it is not resolved automatically we'll detect -# it with master_pos_wait that waits for farther than 1Ob; -# it will timeout; -# also the slave will probably not cooperate to shutdown -# (as 2 threads are locked) ---replace_result $master_log_file MASTER_LOG_FILE -eval select master_pos_wait('$master_log_file',200,30)=-1; +--source include/start_slave.inc +# The I/O thread stops filling the relay log when it's >10b. And the +# SQL thread cannot purge this relay log as purge is done only when +# the SQL thread switches to another relay log, which does not exist +# here. So we should have a deadlock. If it is not resolved +# automatically we'll detect it with master_pos_wait that waits for +# farther than 1Ob; it will timeout after 300 seconds (which is inline +# with the default used for sync_slave_with_master and will protect us +# against slow test envs); also the slave will probably not cooperate +# to shutdown (as 2 threads are locked) +--let $outcome= `SELECT MASTER_POS_WAIT('$master_log_file',200,300) AS mpw;` + +# master_pos_wait returns: +# +# * >= 0, the number of events the slave had to wait to advance to the +# position +# +# * -1, if there was a timeout +# +# * NULL, if an error occurred, or the SQL thread was not started, +# slave master info is not initialized, the arguments are incorrect +--let $assert_text= Assert that master_pos_wait does not timeout nor it returns NULL +--let $assert_cond= $outcome IS NOT NULL AND $outcome <> -1 +--source include/assert.inc # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_replicate_do.test b/mysql-test/suite/rpl/t/rpl_replicate_do.test index dd3ecc075cc..e9a7eef9676 100644 --- a/mysql-test/suite/rpl/t/rpl_replicate_do.test +++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test @@ -84,3 +84,4 @@ connection master; drop table t1; drop table t2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test b/mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test index bcfef919fad..f1907456ed5 100644 --- a/mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test +++ b/mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test @@ -28,3 +28,4 @@ connection master; drop database mysqltest1; drop database mysqltest2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_report.test b/mysql-test/suite/rpl/t/rpl_report.test index 8798905d372..a73442917fa 100644 --- a/mysql-test/suite/rpl/t/rpl_report.test +++ b/mysql-test/suite/rpl/t/rpl_report.test @@ -19,3 +19,4 @@ set @@global.report_host='my.new.address.net'; --echo end of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_rewrt_db.test b/mysql-test/suite/rpl/t/rpl_rewrt_db.test index 585b08be0b3..996ad0a10c7 100644 --- a/mysql-test/suite/rpl/t/rpl_rewrt_db.test +++ b/mysql-test/suite/rpl/t/rpl_rewrt_db.test @@ -237,3 +237,4 @@ connection master; sync_slave_with_master; # end of 5.0 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt deleted file mode 100644 index 80190bf6d29..00000000000 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---server-id=2 diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh deleted file mode 100644 index 81490a54b4b..00000000000 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh +++ /dev/null @@ -1,2 +0,0 @@ -rm -f $MYSQLTEST_VARDIR/slave-data/master.info -rm -f $MYSQLTEST_VARDIR/slave-data/*relay* diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test index ca83020bff0..6e2a7e22352 100644 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test +++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test @@ -18,19 +18,14 @@ -- source include/have_binlog_format_mixed_or_statement.inc connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); ---disable_warnings -drop table if exists t1, t2, t3, t4; ---enable_warnings connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK); + # Create empty file let $MYSQLD_SLAVE_DATADIR= `select @@datadir`; write_file $MYSQLD_SLAVE_DATADIR/master.info; EOF chmod 0000 $MYSQLD_SLAVE_DATADIR/master.info; connection slave; ---disable_warnings -drop table if exists t1, t2, t3, t4; ---enable_warnings # START SLAVE will fail because it can't read the file (mode 000) # (system error 13) @@ -98,12 +93,10 @@ connection master; set insert_id=1234; insert into t2 values(NULL); connection slave; ---source include/wait_for_slave_sql_to_stop.inc - -#restart slave skipping one event -set global sql_slave_skip_counter=1; -start slave; ---source include/wait_for_slave_to_start.inc +# 1062 = ER_DUP_ENTRY +call mtr.add_suppression("Slave SQL.*Error .Duplicate entry .1234. for key .PRIMARY.. on query.* Error_code: 1062"); +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error_and_skip.inc connection master; @@ -194,3 +187,4 @@ show binlog events in ''; purge master logs before now(); --echo End of 5.0 tests +--source include/stop_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_001.test b/mysql-test/suite/rpl/t/rpl_row_001.test index f949e0b2d5f..96521280afd 100644 --- a/mysql-test/suite/rpl/t/rpl_row_001.test +++ b/mysql-test/suite/rpl/t/rpl_row_001.test @@ -10,3 +10,4 @@ let $engine_type=MYISAM; -- source extra/rpl_tests/rpl_row_001.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_4_bytes.test b/mysql-test/suite/rpl/t/rpl_row_4_bytes.test index 73ef6dd2345..6130f74983e 100644 --- a/mysql-test/suite/rpl/t/rpl_row_4_bytes.test +++ b/mysql-test/suite/rpl/t/rpl_row_4_bytes.test @@ -31,3 +31,4 @@ select * from t2 order by a; connection master; DROP DATABASE mysqltest1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_NOW.test b/mysql-test/suite/rpl/t/rpl_row_NOW.test index c28b714277e..d732c6e6733 100644 --- a/mysql-test/suite/rpl/t/rpl_row_NOW.test +++ b/mysql-test/suite/rpl/t/rpl_row_NOW.test @@ -72,3 +72,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave. sync_slave_with_master; # End of 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_USER.test b/mysql-test/suite/rpl/t/rpl_row_USER.test index 7b13ebc50ee..010e0e6ea05 100644 --- a/mysql-test/suite/rpl/t/rpl_row_USER.test +++ b/mysql-test/suite/rpl/t/rpl_row_USER.test @@ -58,3 +58,4 @@ DROP USER ''@'localhost%'; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_UUID.test b/mysql-test/suite/rpl/t/rpl_row_UUID.test index b0ef96463d0..ce3a4ed40a9 100644 --- a/mysql-test/suite/rpl/t/rpl_row_UUID.test +++ b/mysql-test/suite/rpl/t/rpl_row_UUID.test @@ -7,3 +7,4 @@ -- source include/master-slave.inc let $engine_type=myisam; --source extra/rpl_tests/rpl_row_UUID.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test index f6c690aa590..8cd021e88fc 100644 --- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test +++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test @@ -35,13 +35,15 @@ USE test_ignore; connection master; DROP DATABASE test_ignore; +USE test; +DROP TABLE t1; sync_slave_with_master; +USE test; + # Bug#19995: Extreneous table maps generated for statements that does # not generate rows ---disable_query_log ---source include/master-slave-reset.inc ---enable_query_log +--source include/rpl_reset.inc connection master; CREATE TABLE t1 (a INT); @@ -57,13 +59,12 @@ DROP TABLE t1; # BUG#17620: Replicate (Row Based) Fails when Query Cache enabled on # slave --echo ================ Test for BUG#17620 ================ ---disable_query_log ---source include/master-slave-reset.inc ---enable_query_log +--source include/rpl_reset.inc --echo **** On Slave **** connection slave; SET GLOBAL QUERY_CACHE_SIZE=0; +call mtr.add_suppression("Slave SQL.*Could not execute Update_rows event on table test.t1.* Error_code: 1032"); --echo **** On Master **** connection master; @@ -91,12 +92,13 @@ sync_slave_with_master; SELECT * FROM t1; SET GLOBAL QUERY_CACHE_SIZE=0; +--connection master +DROP TABLE t1; + # Bug#22550: Replication of BIT columns failing --echo ================ Test for BUG#22550 ================ ---disable_query_log ---source include/master-slave-reset.inc ---enable_query_log +--source include/rpl_reset.inc connection master; CREATE TABLE t1 (a BIT(1), b INT) ENGINE=MYISAM; @@ -122,9 +124,7 @@ sync_slave_with_master; # field does not work --echo ================ Test for BUG#22583 ================ ---disable_query_log ---source include/master-slave-reset.inc ---enable_query_log +--source include/rpl_reset.inc # disabling warnings temporarily for ENGINE=INNODB to work without InnoDB --disable_warnings @@ -229,13 +229,10 @@ sync_slave_with_master; # row-based replication # -disable_query_log; -source include/master-slave-reset.inc; -enable_query_log; +--source include/rpl_reset.inc --echo **** On Master **** connection 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'); --echo **** On Slave **** @@ -243,7 +240,7 @@ sync_slave_with_master; UPDATE t1 SET a = 5, b = 'slave' WHERE a = 1; SELECT * FROM t1 ORDER BY a; # since bug#31552/31609 idempotency is not default any longer. In -# order the preceeding test UPDATE t1 to pass the mode is switched +# order for the preceeding test UPDATE t1 to pass, the mode is switched # temprorarily set @@global.slave_exec_mode= 'IDEMPOTENT'; --echo **** On Master **** @@ -257,9 +254,10 @@ let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); disable_query_log; eval SELECT "$last_error" AS Last_SQL_Error; enable_query_log; + SELECT * FROM t1 ORDER BY a; -DROP TABLE t1; --echo **** On Master **** connection master; DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test b/mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test index c5648fa1d77..f1f5c584543 100644 --- a/mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test +++ b/mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test @@ -4,3 +4,4 @@ let $type= 'MYISAM' ; let $extra_index= ; -- source extra/rpl_tests/rpl_row_basic.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test index 41cf1cc622a..55ea2f3c3c8 100644 --- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test @@ -8,3 +8,4 @@ let $type= 'INNODB' ; let $extra_index= ; -- source extra/rpl_tests/rpl_row_basic.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_8partition.test b/mysql-test/suite/rpl/t/rpl_row_basic_8partition.test index 687b3bc785d..3ec79ec8cd5 100644 --- a/mysql-test/suite/rpl/t/rpl_row_basic_8partition.test +++ b/mysql-test/suite/rpl/t/rpl_row_basic_8partition.test @@ -208,3 +208,4 @@ SHOW CREATE TABLE t1; DROP TABLE IF EXISTS t1; # End of 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt b/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt deleted file mode 100644 index eb56e5c0a09..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt +++ /dev/null @@ -1 +0,0 @@ ---binlog_cache_size=4096 --max_binlog_cache_size=7680 --default-storage-engine=MyISAM diff --git a/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size.test b/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size.test index 5133c8b1b5e..9c8489658f8 100644 --- a/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size.test +++ b/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size.test @@ -5,3 +5,4 @@ --source include/have_binlog_format_row.inc --source extra/rpl_tests/rpl_binlog_max_cache_size.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_blob_innodb.test b/mysql-test/suite/rpl/t/rpl_row_blob_innodb.test index 6aa6c2a31b9..eaf86688a29 100644 --- a/mysql-test/suite/rpl/t/rpl_row_blob_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_blob_innodb.test @@ -12,3 +12,4 @@ let $engine_type=InnoDB; -- source extra/rpl_tests/rpl_row_blob.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_blob_myisam.test b/mysql-test/suite/rpl/t/rpl_row_blob_myisam.test index 11f5336502a..482ccb7ecc0 100644 --- a/mysql-test/suite/rpl/t/rpl_row_blob_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_row_blob_myisam.test @@ -11,3 +11,4 @@ let $engine_type=myisam; -- source extra/rpl_tests/rpl_row_blob.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_colSize.test b/mysql-test/suite/rpl/t/rpl_row_colSize.test index 078e6886ec7..0701c44edd3 100644 --- a/mysql-test/suite/rpl/t/rpl_row_colSize.test +++ b/mysql-test/suite/rpl/t/rpl_row_colSize.test @@ -160,9 +160,14 @@ let $test_table_slave = CREATE TABLE t1 (a TINYBLOB); let $test_insert = INSERT INTO t1 VALUES ('This is a test.'); source include/test_fieldsize.inc; +connection slave; +call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 0 ...e mismatch.* Error_code: 1535"); +call mtr.add_suppression("Slave SQL.*Column 0 of table .test.t1. cannot be converted from type.* Error_code: 1677"); + --echo *** Cleanup *** connection master; DROP TABLE IF EXISTS t1; sync_slave_with_master; # END 5.1 Test Case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_conflicts.test b/mysql-test/suite/rpl/t/rpl_row_conflicts.test index 59757e2e802..ce5332966ef 100644 --- a/mysql-test/suite/rpl/t/rpl_row_conflicts.test +++ b/mysql-test/suite/rpl/t/rpl_row_conflicts.test @@ -20,6 +20,8 @@ SET @old_slave_exec_mode= @@global.slave_exec_mode; SET @@global.slave_exec_mode = 'STRICT'; source extra/rpl_tests/rpl_conflicts.test; +--source include/rpl_reset.inc + --echo ######## Run with slave_exec_mode=IDEMPOTENT ######## @@ -28,4 +30,4 @@ source extra/rpl_tests/rpl_conflicts.test; SET @@global.slave_exec_mode= @old_slave_exec_mode; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test index 6b051fb46e5..ef3c0758643 100644 --- a/mysql-test/suite/rpl/t/rpl_row_create_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test @@ -12,12 +12,6 @@ connection master; # we disable the ps-protocol for this statement. --disable_ps_protocol ---disable_query_log ---disable_warnings -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings ---enable_query_log - # Set the default storage engine to different values on master and # slave. We need to stop the slave for the server variable to take # effect, since the variable is only read on start-up. @@ -31,7 +25,7 @@ START SLAVE; --source include/wait_for_slave_to_start.inc --enable_query_log ---source include/reset_master_and_slave.inc +--source include/rpl_reset.inc connection master; CREATE TABLE t1 (a INT, b INT); @@ -67,7 +61,7 @@ SELECT * FROM t5 ORDER BY a,b,c; --query_vertical SHOW CREATE TABLE t6 SELECT * FROM t6 ORDER BY a,b,c; ---source include/reset_master_and_slave.inc +--source include/rpl_reset.inc connection master; # Test for erroneous constructions @@ -86,7 +80,7 @@ SELECT * FROM t7 ORDER BY a,b; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; ---source include/reset_master_and_slave.inc +--source include/rpl_reset.inc connection master; CREATE TEMPORARY TABLE tt4 (a INT, b INT); @@ -99,7 +93,7 @@ SELECT * FROM t7 ORDER BY a,b; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; ---source include/reset_master_and_slave.inc +--source include/rpl_reset.inc connection master; CREATE TABLE t8 LIKE t4; @@ -131,7 +125,7 @@ START SLAVE; # table' from log): --echo ================ BUG#22864 ================ ---source include/master-slave-reset.inc +--source include/rpl_reset.inc connection master; SET AUTOCOMMIT=0; @@ -168,17 +162,7 @@ SET AUTOCOMMIT=1; sync_slave_with_master; # Some tests with temporary tables -connection slave; -STOP SLAVE; ---source include/wait_for_slave_to_stop.inc -RESET SLAVE; - -connection master; -RESET MASTER; - -connection slave; -START SLAVE; ---source include/wait_for_slave_to_start.inc +--source include/rpl_reset.inc connection master; CREATE TABLE t1 (a INT); @@ -204,7 +188,7 @@ connection master; TRUNCATE TABLE t2; sync_slave_with_master; ---source include/reset_master_and_slave.inc +--source include/rpl_reset.inc connection master; BEGIN; @@ -253,7 +237,7 @@ sync_slave_with_master; # BUG#34707: Row based replication: slave creates table within wrong database # -source include/master-slave-reset.inc; +--source include/rpl_reset.inc connection master; --disable_warnings @@ -275,7 +259,7 @@ sync_slave_with_master; # <tmp_tbl> with RBL # -source include/master-slave-reset.inc; +--source include/rpl_reset.inc connection master; CREATE TEMPORARY TABLE t7(c1 INT); @@ -305,5 +289,7 @@ DROP VIEW IF EXISTS bug48506_t1, bug48506_t2, bug48506_t3; DROP TEMPORARY TABLES t7; DROP TABLES t4, t5; DROP TABLES IF EXISTS bug48506_t4; -source include/master-slave-end.inc; + +--source include/rpl_end.inc + --echo end of the tests diff --git a/mysql-test/suite/rpl/t/rpl_row_delayed_ins.test b/mysql-test/suite/rpl/t/rpl_row_delayed_ins.test index a0e74567349..db41ff09117 100644 --- a/mysql-test/suite/rpl/t/rpl_row_delayed_ins.test +++ b/mysql-test/suite/rpl/t/rpl_row_delayed_ins.test @@ -1,7 +1,3 @@ -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc let $engine_type=myisam; -- source extra/rpl_tests/rpl_row_delayed_ins.test diff --git a/mysql-test/suite/rpl/t/rpl_row_drop.test b/mysql-test/suite/rpl/t/rpl_row_drop.test index d18ebc2846b..eca2ae0f643 100644 --- a/mysql-test/suite/rpl/t/rpl_row_drop.test +++ b/mysql-test/suite/rpl/t/rpl_row_drop.test @@ -43,3 +43,4 @@ DROP TABLE IF EXISTS t2; sync_slave_with_master; --enable_warnings --enable_query_log +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test index fc46665ddb1..5896f6a48b0 100644 --- a/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test @@ -8,3 +8,4 @@ --source include/have_innodb.inc --source extra/rpl_tests/rpl_drop_create_temp_table.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_find_row.test b/mysql-test/suite/rpl/t/rpl_row_find_row.test index 9163ab54406..7f633c5aa97 100644 --- a/mysql-test/suite/rpl/t/rpl_row_find_row.test +++ b/mysql-test/suite/rpl/t/rpl_row_find_row.test @@ -50,7 +50,7 @@ DROP TABLE t; # but it gets disabled sometime. # Replication does not break anymore. # --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master CREATE TABLE t (a int, b int, c int, key(b)); @@ -84,8 +84,7 @@ DROP TABLE t; # As a consquence, the wrong row would be updated. # --- connection master --- source include/master-slave-reset.inc +-- source include/rpl_reset.inc -- connection master CREATE TABLE t1 (c1 INT NOT NULL, c2 INT NOT NULL, c3 INT, UNIQUE KEY(c1,c3), KEY(c2)); @@ -94,11 +93,11 @@ INSERT INTO t1(c1,c2) VALUES(1,2); UPDATE t1 SET c1=1000 WHERE c2=2; -- sync_slave_with_master --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master DROP TABLE t1; -- sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test index eebe8059d5c..1d33962ad48 100644 --- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test +++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test @@ -14,4 +14,3 @@ let $rename_event_pos= 926; --disable_ps_protocol -- source extra/rpl_tests/rpl_flsh_tbls.test --enable_ps_protocol - diff --git a/mysql-test/suite/rpl/t/rpl_row_func001.test b/mysql-test/suite/rpl/t/rpl_row_func001.test index 53fb55118e6..6ff97388b31 100644 --- a/mysql-test/suite/rpl/t/rpl_row_func001.test +++ b/mysql-test/suite/rpl/t/rpl_row_func001.test @@ -55,3 +55,4 @@ DROP TABLE test.t1; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_func002.test b/mysql-test/suite/rpl/t/rpl_row_func002.test index 44a704bfbc5..2f4e3fdd910 100644 --- a/mysql-test/suite/rpl/t/rpl_row_func002.test +++ b/mysql-test/suite/rpl/t/rpl_row_func002.test @@ -102,3 +102,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/func002_master.sql $MYSQLTEST_VARDIR/tmp/func00 # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_func003.test b/mysql-test/suite/rpl/t/rpl_row_func003.test index 30b24cf4174..a17d70e4b04 100644 --- a/mysql-test/suite/rpl/t/rpl_row_func003.test +++ b/mysql-test/suite/rpl/t/rpl_row_func003.test @@ -11,3 +11,4 @@ -- source include/master-slave.inc let $engine_type=INNODB; -- source extra/rpl_tests/rpl_row_func003.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_idempotency.test b/mysql-test/suite/rpl/t/rpl_row_idempotency.test index cd62280f1d4..7f48d6503c1 100644 --- a/mysql-test/suite/rpl/t/rpl_row_idempotency.test +++ b/mysql-test/suite/rpl/t/rpl_row_idempotency.test @@ -9,10 +9,10 @@ connection slave; source include/have_innodb.inc; # Add suppression for expected warning(s) in slaves error log -call mtr.add_suppression("Slave: Can't find record in 't.' Error_code: 1032"); -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"); - +call mtr.add_suppression("Can.t find record in .t[12].* Error_code: 1032"); +call mtr.add_suppression("Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451"); +call mtr.add_suppression("Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); +call mtr.add_suppression("Duplicate entry .1. for key .PRIMARY.* Error_code: 1062"); # bug#31609 Not all RBR slave errors reported as errors # bug#31552 Replication breaks when deleting rows from out-of-sync table @@ -326,6 +326,5 @@ drop table t1,t2,ti2,ti1; sync_slave_with_master; set @@global.slave_exec_mode= @old_slave_exec_mode; ---source include/master-slave-end.inc - --echo *** end of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test index 8b54878a203..cfad4fca433 100644 --- a/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test @@ -8,3 +8,4 @@ --let $engine=Innodb set session storage_engine=innodb; --source extra/rpl_tests/rpl_implicit_commit_binlog.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test index 0c038c41ebf..22fd65ecaf3 100644 --- a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test +++ b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test @@ -29,14 +29,17 @@ INSERT INTO t1 VALUES (1); --echo [on slave] connection slave; # slave should have stopped because can't find table t1 ---source include/wait_for_slave_sql_to_stop.inc -# see if we have a good error message: -let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); ---echo Last_SQL_Error = $err +# 1146 = ER_NO_SUCH_TABLE +call mtr.add_suppression("Slave SQL.*Error executing row event: .Table .test.t1. doesn.t exist., Error_code: 1146"); +--let $slave_sql_errno= 1146 +--source include/wait_for_slave_sql_error.inc --echo ==== Clean up ==== -source include/stop_slave.inc; +source include/stop_slave_io.inc; +RESET SLAVE; --echo [on master] connection master; DROP TABLE t1; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test b/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test index 436c0a9f517..a6c38117767 100644 --- a/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test +++ b/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test @@ -3,3 +3,4 @@ --source include/not_embedded.inc --source include/not_windows.inc --source extra/rpl_tests/rpl_insert_delayed.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_log.test b/mysql-test/suite/rpl/t/rpl_row_log.test index 197f83c85af..b156a4c8dd4 100644 --- a/mysql-test/suite/rpl/t/rpl_row_log.test +++ b/mysql-test/suite/rpl/t/rpl_row_log.test @@ -15,3 +15,4 @@ let $engine_type=MyISAM; -- source extra/rpl_tests/rpl_log.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_log_innodb.test b/mysql-test/suite/rpl/t/rpl_row_log_innodb.test index 16e775287b3..631fb29c7bc 100644 --- a/mysql-test/suite/rpl/t/rpl_row_log_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_log_innodb.test @@ -12,3 +12,4 @@ let $engine_type=InnoDB; -- source extra/rpl_tests/rpl_log.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_row_mixing_engines.test index 8af1ae51bb9..f2e26f36fdc 100644 --- a/mysql-test/suite/rpl/t/rpl_row_mixing_engines.test +++ b/mysql-test/suite/rpl/t/rpl_row_mixing_engines.test @@ -9,3 +9,4 @@ let $engine_type=Innodb; --source extra/rpl_tests/rpl_mixing_engines.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test index 3b829e7db7b..169d100fef4 100644 --- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test +++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test @@ -352,3 +352,4 @@ DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test b/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test index 67e4c4fb14d..57d67c5c71b 100644 --- a/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test @@ -8,3 +8,4 @@ -- let $engine= InnoDB -- source extra/rpl_tests/rpl_record_compare.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test b/mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test index 43fa99a51da..f96603f69ed 100644 --- a/mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test @@ -1,18 +1,17 @@ -- source include/have_binlog_format_row.inc -- source include/master-slave.inc +-- let $engine= MyISAM # # BUG#52868 Wrong handling of NULL value during update, replication out of sync # --- let $engine= MyISAM --- source extra/rpl_tests/rpl_record_compare.test -- echo ## coverage purposes - Field_bits -- echo ## 1 X bit + 2 Null bits + 5 bits => last_null_bit_pos==0 ## Added here because AFAIK it's only MyISAM and NDB that use Field_bits --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master -- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bit(5)) ENGINE=$engine DEFAULT CHARSET=latin1 @@ -22,10 +21,13 @@ INSERT INTO t1(c1,c2) VALUES (NULL, b'1'); UPDATE t1 SET c1= 0; -- sync_slave_with_master --- let $diff_table_1= master:test.t1 --- let $diff_table_2= slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master DROP TABLE t1; -- sync_slave_with_master + +-- source extra/rpl_tests/rpl_record_compare.test + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test b/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test index 6a426efc7ea..a78f7ad4271 100644 --- a/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test +++ b/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test @@ -16,3 +16,4 @@ -- source include/have_binlog_format_row.inc -- source extra/rpl_tests/rpl_show_relaylog_events.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp001.test b/mysql-test/suite/rpl/t/rpl_row_sp001.test index 34d42d985f9..99db5e7febe 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp001.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp001.test @@ -142,3 +142,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_sl --remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test index e272e34e715..aec421407c9 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test @@ -1,10 +1,3 @@ -################################# -# Wrapper for rpl_row_sp002.test# -################################# -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=INNODB; diff --git a/mysql-test/suite/rpl/t/rpl_row_sp003.test b/mysql-test/suite/rpl/t/rpl_row_sp003.test index ab49174ddfa..bd085610725 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp003.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp003.test @@ -14,3 +14,4 @@ let $engine_type=INNODB; -- source extra/rpl_tests/rpl_row_sp003.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp005.test b/mysql-test/suite/rpl/t/rpl_row_sp005.test index abc7fb4f490..bbe4ce47f9e 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp005.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp005.test @@ -109,3 +109,4 @@ DROP TABLE IF EXISTS test.t3; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test b/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test index e5be4e6dc28..df3952bead1 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test @@ -11,3 +11,4 @@ -- source include/master-slave.inc let $engine_type=InnoDB; -- source extra/rpl_tests/rpl_row_sp006.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test b/mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test index 41af5a5f997..fcac31df780 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test @@ -1,10 +1,3 @@ -################################# -# Wrapper for rpl_row_sp007.test# -################################# -######################################################## -# By JBM 2005-02-15 Wrapped to allow reuse of test code# -# Added to skip if ndb is default # -######################################################## -- source include/not_ndb_default.inc -- source include/have_innodb.inc let $engine_type=INNODB; diff --git a/mysql-test/suite/rpl/t/rpl_row_sp008.test b/mysql-test/suite/rpl/t/rpl_row_sp008.test index 80603c28d27..8af3c88ae11 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp008.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp008.test @@ -53,3 +53,4 @@ DROP TABLE IF EXISTS test.t2; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp009.test b/mysql-test/suite/rpl/t/rpl_row_sp009.test index 77860621961..6e7226593a1 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp009.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp009.test @@ -97,3 +97,4 @@ DROP TABLE test.t2; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp010.test b/mysql-test/suite/rpl/t/rpl_row_sp010.test index 7fa0077f117..aad7edcd3ea 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp010.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp010.test @@ -74,3 +74,4 @@ DROP TABLE IF EXISTS test.t2; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp011.test b/mysql-test/suite/rpl/t/rpl_row_sp011.test index 25c2fc9ad26..d2a323faad2 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp011.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp011.test @@ -109,3 +109,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_sl --remove_file $MYSQLTEST_VARDIR/tmp/sp011_slave.sql # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_sp012.test b/mysql-test/suite/rpl/t/rpl_row_sp012.test index 3a8d295121c..23bc92b51cf 100644 --- a/mysql-test/suite/rpl/t/rpl_row_sp012.test +++ b/mysql-test/suite/rpl/t/rpl_row_sp012.test @@ -73,3 +73,4 @@ sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test b/mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test index ab4914e15fa..030ec7d6541 100644 --- a/mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test +++ b/mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test @@ -6,3 +6,4 @@ let $engine_type = 'MyISAM'; -- source extra/rpl_tests/rpl_row_tabledefs.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test b/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test index 7824fbfb663..35eddfc3ed4 100644 --- a/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test @@ -7,3 +7,4 @@ let $engine_type = 'InnoDB'; -- source extra/rpl_tests/rpl_row_tabledefs.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test b/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test index d854aa64dc5..e8ac74f0125 100644 --- a/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test +++ b/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test @@ -193,8 +193,7 @@ FLUSH LOGS; -- connection master -- echo ### assertion: the slave replicated event successfully and tables match --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc DROP TABLE `t1`; @@ -229,7 +228,7 @@ DROP TABLE `t1`; # in both cases: when slave is replaying events and when # mysqlbinlog is used to read the binary log --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master # Create several tables with field_metadata_size ranging @@ -313,8 +312,7 @@ FLUSH LOGS; while($ntables) { -- echo ### assertion: the slave replicated event successfully and tables match for t$ntables - -- let $diff_table_1=master:test.t$ntables - -- let $diff_table_2=slave:test.t$ntables + -- let $diff_tables= master:t$ntables, slave:t$ntables -- source include/diff_tables.inc -- connection master @@ -337,4 +335,4 @@ while($ntables) ## For debugging purposes you might want not to remove these -- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog -- remove_file $generated_sql --- source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_trig001.test b/mysql-test/suite/rpl/t/rpl_row_trig001.test index 8669034713a..39f2662b569 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trig001.test +++ b/mysql-test/suite/rpl/t/rpl_row_trig001.test @@ -113,3 +113,4 @@ sync_slave_with_master; diff_files $MYSQLTEST_VARDIR/tmp/trig001_master.sql $MYSQLTEST_VARDIR/tmp/trig001_slave.sql; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_trig002.test b/mysql-test/suite/rpl/t/rpl_row_trig002.test index 1ea245498d5..46f9ad91a3d 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trig002.test +++ b/mysql-test/suite/rpl/t/rpl_row_trig002.test @@ -72,3 +72,4 @@ DROP TABLE test.t3; sync_slave_with_master; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_trig003.test b/mysql-test/suite/rpl/t/rpl_row_trig003.test index 1ec568bf243..e332fc9174e 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trig003.test +++ b/mysql-test/suite/rpl/t/rpl_row_trig003.test @@ -152,3 +152,4 @@ sync_slave_with_master; diff_files $MYSQLTEST_VARDIR/tmp/trg003_master.sql $MYSQLTEST_VARDIR/tmp/trg003_slave.sql; # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_trig004.test b/mysql-test/suite/rpl/t/rpl_row_trig004.test index a918c602d56..fa5f973c355 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trig004.test +++ b/mysql-test/suite/rpl/t/rpl_row_trig004.test @@ -16,3 +16,4 @@ let $engine_type=INNODB; -- source extra/rpl_tests/rpl_trig004.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test b/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test index 60e1cd73200..394bf949f72 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test +++ b/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test @@ -32,4 +32,4 @@ SELECT * FROM t2; DROP TABLE t1; connection master; DROP TABLE t2; ---source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test b/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test index 069700546ce..9e6485d6630 100644 --- a/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test +++ b/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test @@ -33,3 +33,4 @@ connection master; DROP TABLE t1, t2; sync_slave_with_master; connection master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test index bcd8ba8612b..b861bb8c8ec 100644 --- a/mysql-test/suite/rpl/t/rpl_row_until.test +++ b/mysql-test/suite/rpl/t/rpl_row_until.test @@ -4,39 +4,36 @@ # Note: The test is dependent on binlog positions -# prepare version for substitutions -let $VERSION=`select version()`; - # Create some events on master connection master; CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); INSERT INTO t1 VALUES (1),(2),(3),(4); -# Save master log postion for query DROP TABLE t1 +# Save master log position for query DROP TABLE t1 let $master_pos_drop_t1= query_get_value(SHOW MASTER STATUS, Position, 1); DROP TABLE t1; -# Save master log postion for query DROP TABLE t1 +# Save master log position for query DROP TABLE t1 save_master_pos; let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7); let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 7); -# Save master log postion for query CREATE TABLE t2 +# Save master log position for query CREATE TABLE t2 let $master_pos_create_t2= query_get_value(SHOW MASTER STATUS, Position, 1); CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); #show binlog events; INSERT INTO t2 VALUES (1),(2); -# Save master log postion for query INSERT INTO t2 VALUES (1),(2); +# Save master log position for query INSERT INTO t2 VALUES (1),(2); let $master_pos_insert1_t2= query_get_value(SHOW MASTER STATUS, Position, 1); sync_slave_with_master; #show binlog events; -# Save relay log postion for query INSERT INTO t2 VALUES (1),(2); +# Save relay log position for query INSERT INTO t2 VALUES (1),(2); let $relay_pos_insert1_t2= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1); connection master; INSERT INTO t2 VALUES (3),(4); DROP TABLE t2; -# Save master log postion for query DROP TABLE t2; +# Save master log position for query DROP TABLE t2; let $master_pos_drop_t2= query_get_value(SHOW MASTER STATUS, Position, 1); sync_slave_with_master; #show binlog events; @@ -125,3 +122,10 @@ START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561; START SLAVE; --replace_result 740 MASTER_LOG_POS START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740; + +--source include/stop_slave.inc +# Clear slave IO error. +RESET SLAVE; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_utf16.test b/mysql-test/suite/rpl/t/rpl_row_utf16.test index b8f7b724ea1..e3e7a51c002 100644 --- a/mysql-test/suite/rpl/t/rpl_row_utf16.test +++ b/mysql-test/suite/rpl/t/rpl_row_utf16.test @@ -19,8 +19,10 @@ INSERT INTO t1 VALUES (); # default value is inserted and encoded correctl --query_vertical SELECT c1, hex(c1) FROM t1 # assertion: tables don't differ --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables=master:t1,slave:t1 -- source include/diff_tables.inc +--connection master DROP TABLE t1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_utf32.test b/mysql-test/suite/rpl/t/rpl_row_utf32.test index 44ca4b345c0..936d62b09bd 100644 --- a/mysql-test/suite/rpl/t/rpl_row_utf32.test +++ b/mysql-test/suite/rpl/t/rpl_row_utf32.test @@ -42,3 +42,4 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS= @saved_slave_type_conversions; -- source include/stop_slave.inc -- source include/start_slave.inc -- connection master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_view01.test b/mysql-test/suite/rpl/t/rpl_row_view01.test index 77e4b98f780..cc60ab9912c 100644 --- a/mysql-test/suite/rpl/t/rpl_row_view01.test +++ b/mysql-test/suite/rpl/t/rpl_row_view01.test @@ -95,3 +95,4 @@ sync_slave_with_master; # End of 5.1 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_wide_table.test b/mysql-test/suite/rpl/t/rpl_row_wide_table.test index 7b17d7c4866..b1d16133096 100644 --- a/mysql-test/suite/rpl/t/rpl_row_wide_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_wide_table.test @@ -337,3 +337,4 @@ sync_slave_with_master; # END of Test Case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_savepoint.test b/mysql-test/suite/rpl/t/rpl_savepoint.test index 7fe8a0da651..2aacd1fa81e 100644 --- a/mysql-test/suite/rpl/t/rpl_savepoint.test +++ b/mysql-test/suite/rpl/t/rpl_savepoint.test @@ -44,4 +44,5 @@ FLUSH LOGS; --echo # Connection master connection master; DROP TABLE nt; ---source include/master-slave-end.inc + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index 17fa67e97e3..f697fedfad4 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -15,6 +15,7 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state connection slave; call mtr.add_suppression("Master server does not support semi-sync"); call mtr.add_suppression("Semi-sync slave .* reply"); +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); enable_query_log; connection master; @@ -58,7 +59,7 @@ echo [ on master ]; disable_query_log; let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1); -if (`select '$value' = 'No such row'`) +if ($value == No such row) { set sql_log_bin=0; eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO'; @@ -123,7 +124,7 @@ echo [ on slave ]; disable_query_log; let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1); -if (`select '$value' = 'No such row'`) +if ($value == No such row) { set sql_log_bin=0; eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO'; @@ -609,6 +610,7 @@ UNINSTALL PLUGIN rpl_semi_sync_master; enable_warnings; connection slave; +change master to master_user='root',master_password=''; source include/start_slave.inc; connection master; @@ -618,3 +620,4 @@ sync_slave_with_master; connection master; drop user rpl@127.0.0.1; flush privileges; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_event-master.opt b/mysql-test/suite/rpl/t/rpl_semi_sync_event-master.opt index 78be60a4852..4cfb5d53923 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_event-master.opt +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event-master.opt @@ -1 +1 @@ ---max-connections=23 +--max-connections=40 diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test index 3b68441141a..c84f597c1ee 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test @@ -15,12 +15,13 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state connection slave; call mtr.add_suppression("Master server does not support semi-sync"); call mtr.add_suppression("Semi-sync slave .* reply"); +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); enable_query_log; connection master; disable_query_log; let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1); -if (`select '$value' = 'No such row'`) +if ($value == No such row) { set sql_log_bin=0; eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO'; @@ -34,7 +35,7 @@ source include/stop_slave.inc; disable_query_log; let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1); -if (`select '$value' = 'No such row'`) +if ($value == No such row) { set sql_log_bin=0; eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO'; @@ -107,3 +108,4 @@ DROP EVENT ev1; DROP EVENT ev2; DROP TABLE t1; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_server_id.test b/mysql-test/suite/rpl/t/rpl_server_id.test deleted file mode 100644 index 6e98ec6ee6d..00000000000 --- a/mysql-test/suite/rpl/t/rpl_server_id.test +++ /dev/null @@ -1,29 +0,0 @@ -# Test for BUG#28908 Replication: set global server_id is not setting the session server_id - --- source include/have_log_bin.inc - -let $saved_server_id=`select @@server_id`; -set global server_id=1; -reset master; - --- disable_warnings -drop table if exists t1,t2,t3; --- enable_warnings - -create table t1 (a int); -select @@server_id; -source include/show_binlog_events2.inc; - -set global server_id=2; -create table t2 (b int); -select @@server_id; -source include/show_binlog_events2.inc; - -set global server_id=3; -create table t3 (c int); -select @@server_id; -source include/show_binlog_events2.inc; - -# cleanup -eval set global server_id=$saved_server_id; -drop table t1,t2,t3; diff --git a/mysql-test/suite/rpl/t/rpl_server_id1.test b/mysql-test/suite/rpl/t/rpl_server_id1.test index c97f7975278..90198a4ac5e 100644 --- a/mysql-test/suite/rpl/t/rpl_server_id1.test +++ b/mysql-test/suite/rpl/t/rpl_server_id1.test @@ -4,21 +4,19 @@ # ignored, which has caught our customers), unless # --replicate-same-server-id. -source include/master-slave.inc; -connection slave; -reset master; +--let $rpl_topology= 2->2 +--let $rpl_skip_start_slave= 1 +--source include/rpl_init.inc -# replicate ourselves -source include/stop_slave.inc; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval change master to master_port=$SLAVE_MYPORT; -start slave; +--connection server_2 +START SLAVE; +# 1593 = ER_SLAVE_FATAL_ERROR +--let $slave_io_errno= 1593 +--let $show_slave_io_error= 1 +--source include/wait_for_slave_io_error.inc -let $slave_param= Last_IO_Errno; -let $slave_param_value= 1593; -source include/wait_for_slave_param.inc; ---echo *** must be having the replicate-same-server-id IO thread error *** -let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1); -let $last_io_error= query_get_value("show slave status", Last_IO_Error, 1); -echo Slave_IO_Errno= $last_io_errno; -echo Slave_IO_Error= $last_io_error; +--source include/stop_slave_sql.inc +RESET SLAVE; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_server_id2.test b/mysql-test/suite/rpl/t/rpl_server_id2.test index 5c51a7fc08e..21e197866cf 100644 --- a/mysql-test/suite/rpl/t/rpl_server_id2.test +++ b/mysql-test/suite/rpl/t/rpl_server_id2.test @@ -50,7 +50,7 @@ eval start slave until master_log_file='master-bin.000001', master_log_pos=$unti --source include/wait_for_slave_io_to_start.inc --source include/wait_for_slave_sql_to_stop.inc ---echo *** checking until postion execution: must be only t1 in the list *** +--echo *** checking until position execution: must be only t1 in the list *** show tables; # cleanup @@ -64,3 +64,4 @@ drop table t2; sync_slave_with_master; # End of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_server_id_ignore.test b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test index 1b38bd34d3d..004f4daa19d 100644 --- a/mysql-test/suite/rpl/t/rpl_server_id_ignore.test +++ b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test @@ -112,3 +112,4 @@ sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_session_var.test b/mysql-test/suite/rpl/t/rpl_session_var.test index 55e58674c61..cf3faa6578c 100644 --- a/mysql-test/suite/rpl/t/rpl_session_var.test +++ b/mysql-test/suite/rpl/t/rpl_session_var.test @@ -57,5 +57,5 @@ sync_slave_with_master; SELECT length(data) < 100 FROM t1; connection master; drop table t1; -sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_set_charset.test b/mysql-test/suite/rpl/t/rpl_set_charset.test index 241c1c5738b..296e5dfb079 100644 --- a/mysql-test/suite/rpl/t/rpl_set_charset.test +++ b/mysql-test/suite/rpl/t/rpl_set_charset.test @@ -29,3 +29,4 @@ drop database mysqltest1; sync_slave_with_master; # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_set_null_innodb.test b/mysql-test/suite/rpl/t/rpl_set_null_innodb.test index dba79b78fa1..2d0c34e1d0a 100644 --- a/mysql-test/suite/rpl/t/rpl_set_null_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_set_null_innodb.test @@ -4,3 +4,4 @@ -- let $engine= InnoDB -- source extra/rpl_tests/rpl_set_null.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_set_null_myisam.test b/mysql-test/suite/rpl/t/rpl_set_null_myisam.test index 7b433071553..13cd7c3e4a8 100644 --- a/mysql-test/suite/rpl/t/rpl_set_null_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_set_null_myisam.test @@ -3,3 +3,4 @@ -- let $engine= MyISAM -- source extra/rpl_tests/rpl_set_null.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sf.test b/mysql-test/suite/rpl/t/rpl_sf.test deleted file mode 100644 index 4d12f3839a2..00000000000 --- a/mysql-test/suite/rpl/t/rpl_sf.test +++ /dev/null @@ -1,187 +0,0 @@ --- source include/have_log_bin.inc - -# Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR -# BUG#41166 stored function requires "deterministic" if binlog_format is "statement" - -# save status - -let $oblf=`select @@SESSION.BINLOG_FORMAT`; -let $otfc=`select @@log_bin_trust_function_creators`; - -set global log_bin_trust_function_creators=0; - - - -# fail *on definition* - -set binlog_format=STATEMENT; - -delimiter |; ---error ER_BINLOG_UNSAFE_ROUTINE -create function fn16456() - returns int -begin - return unix_timestamp(); -end| -delimiter ;| - - - -# force in definition, so we can see whether we fail on call - -set global log_bin_trust_function_creators=1; - -delimiter |; -create function fn16456() - returns int -begin - return unix_timestamp(); -end| -delimiter ;| - -set global log_bin_trust_function_creators=0; - - - -# allow funcall in RBR - -set binlog_format=ROW; - ---replace_column 1 timestamp -select fn16456(); - - - -# fail funcall in SBR - -set binlog_format=STATEMENT; - ---error ER_BINLOG_UNSAFE_ROUTINE -select fn16456(); - - - -# clean - -drop function fn16456; - - - -# success in definition with deterministic - -set global log_bin_trust_function_creators=0; - -delimiter |; -create function fn16456() - returns int deterministic -begin - return unix_timestamp(); -end| -delimiter ;| - - - -# allow funcall in RBR - -set binlog_format=ROW; - ---replace_column 1 timestamp -select fn16456(); - - - -# allow funcall in SBR - -set binlog_format=STATEMENT; - ---replace_column 1 timestamp -select fn16456(); - - - -# clean - -drop function fn16456; - - -# success in definition with NO SQL - -set global log_bin_trust_function_creators=0; - -delimiter |; -create function fn16456() - returns int no sql -begin - return unix_timestamp(); -end| -delimiter ;| - - - -# allow funcall in RBR - -set binlog_format=ROW; - ---replace_column 1 timestamp -select fn16456(); - - - -# allow funcall in SBR - -set binlog_format=STATEMENT; - ---replace_column 1 timestamp -select fn16456(); - - -# clean - -drop function fn16456; - - - -# success in definition with reads sql data - -set global log_bin_trust_function_creators=0; - -delimiter |; -create function fn16456() - returns int reads sql data -begin - return unix_timestamp(); -end| -delimiter ;| - - - -# allow funcall in RBR - -set binlog_format=ROW; - ---replace_column 1 timestamp -select fn16456(); - - - -# allow funcall in SBR - -set binlog_format=STATEMENT; - ---replace_column 1 timestamp -select fn16456(); - - - -# clean - -drop function fn16456; - - - -# restore status - ---disable_query_log -eval set binlog_format=$oblf; -eval set global log_bin_trust_function_creators=$otfc; ---enable_query_log diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test index 9f202487968..105f1873659 100644 --- a/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test +++ b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test @@ -23,14 +23,13 @@ connection master; let $show_statement= SHOW SLAVE HOSTS; let $field= Server_id; # 3 is server_id of slave2. -let $connection= ='3'; +let $condition= ='3'; source include/wait_show_condition.inc; --replace_result $SLAVE_MYPORT SLAVE_PORT $DEFAULT_MASTER_PORT DEFAULT_PORT SHOW SLAVE HOSTS; connection slave2; -STOP SLAVE IO_THREAD; -source include/wait_for_slave_io_to_stop.inc; +--source include/stop_slave_io.inc connection master; let $show_statement= SHOW SLAVE HOSTS; @@ -44,4 +43,4 @@ source include/wait_show_condition.inc; --replace_result $SLAVE_MYPORT SLAVE_PORT SHOW SLAVE HOSTS; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_running.test b/mysql-test/suite/rpl/t/rpl_show_slave_running.test index 8578f1e5275..d8c86a2aeb1 100644 --- a/mysql-test/suite/rpl/t/rpl_show_slave_running.test +++ b/mysql-test/suite/rpl/t/rpl_show_slave_running.test @@ -80,3 +80,4 @@ connection slave; eval set global debug= '$debug_saved'; SET DEBUG_SYNC= 'RESET'; --echo End of tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_skip_error.test b/mysql-test/suite/rpl/t/rpl_skip_error.test index 8d176ac0c3b..82d6e61a2cd 100644 --- a/mysql-test/suite/rpl/t/rpl_skip_error.test +++ b/mysql-test/suite/rpl/t/rpl_skip_error.test @@ -102,6 +102,8 @@ SET SQL_LOG_BIN=1; connection slave; +call mtr.add_suppression("Slave SQL.*Could not execute .*te_rows event on table test.t.; Duplicate entry.* Error_code: 1062"); + CREATE TABLE t1(id INT NOT NULL PRIMARY KEY, data INT) Engine=InnoDB; SHOW CREATE TABLE t1; @@ -167,3 +169,4 @@ DROP TABLE t1; DROP TABLE t2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test b/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test index 1a0ff8d52f0..4fdc1268b80 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test +++ b/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test @@ -62,7 +62,10 @@ SELECT * FROM t2 ORDER BY a; SELECT * FROM t3 ORDER BY a; --connection slave ---source include/wait_for_slave_sql_to_stop.inc +# 1146 = ER_NO_SUCH_TABLE +call mtr.add_suppression("Slave SQL.*Table .test.t3. doesn.t exist.* Error_code: 1146"); +--let $slave_sql_errno= 1146 +--source include/wait_for_slave_sql_error.inc SHOW TABLES LIKE 't%'; if (`SELECT @@BINLOG_FORMAT = 'ROW'`) { --replace_regex /AA/AA_for_row_or_XX_for_stmt_mixed/ @@ -77,7 +80,7 @@ if (!`SELECT @@BINLOG_FORMAT = 'ROW'`) { SELECT * FROM t2 ORDER BY a; } ---source include/stop_slave.inc +--source include/stop_slave_io.inc RENAME TABLE t3_bak TO t3; --source include/start_slave.inc @@ -107,7 +110,9 @@ INSERT INTO t1 VALUES(2, 'B'); UPDATE t1 SET b = 'X' WHERE a = 2; --connection slave ---source include/wait_for_slave_sql_to_stop.inc +# 1146 = ER_NO_SUCH_TABLE +--let $slave_sql_errno= 1146 +--source include/wait_for_slave_sql_error.inc --connection master SELECT * FROM t1 ORDER BY a; @@ -119,7 +124,7 @@ SHOW TABLES LIKE 't%'; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; ---source include/stop_slave.inc +--source include/stop_slave_io.inc RENAME TABLE t3_bak TO t3; --source include/start_slave.inc @@ -151,7 +156,9 @@ INSERT INTO t3 VALUES (3, 'C'), (4, 'D'); COMMIT; --connection slave ---source include/wait_for_slave_sql_to_stop.inc +# 1146 = ER_NO_SUCH_TABLE +--let $slave_sql_errno= 1146 +--source include/wait_for_slave_sql_error.inc --connection master SELECT * FROM t1 ORDER BY a; @@ -163,7 +170,7 @@ SHOW TABLES LIKE 't%'; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; -source include/stop_slave.inc; +source include/stop_slave_io.inc; RENAME TABLE t3_bak TO t3; source include/start_slave.inc; @@ -174,3 +181,4 @@ DROP TABLE t1,t2,t3; --sync_slave_with_master # End of 5.1 test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_in.test b/mysql-test/suite/rpl/t/rpl_slave_load_in.test index 54ebdffce69..80a27479ae2 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_in.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_in.test @@ -31,12 +31,10 @@ commit; ########################################################################## sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; -let $diff_table_1=master:test.t2; -let $diff_table_2=slave:test.t2; +let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; ########################################################################## @@ -48,3 +46,4 @@ drop table t1; drop table t2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile-slave.opt b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile-slave.opt deleted file mode 100644 index 51e410f911f..00000000000 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-debug=d,remove_slave_load_file_before_write diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test index 1cf88deb56f..36327e2354a 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -1,22 +1,37 @@ -########################################################################## +# ==== Purpose ==== +# # This test verifies if the slave fails gracefully when the temporary -# file used to load data is removed while it is about to be used it. +# file used to load data is removed while it is about to be used. # Similar errors are caught if the temporary directory is removed. # +# ==== Implementation ==== +# # Steps: +# 0 - Set debug variable remove_slave_load_file_before_write. This +# causes the slave to remove the file. # 1 - Creates a table and populates it through "LOAD DATA INFILE". # 2 - Catches error. -########################################################################## +# +# ==== References ==== +# +# BUG#42861: Assigning invalid directories to --slave-load-tmpdir crashes the slave +# BUG#11872422: rpl_slave_load_remove_tmpfile fails sporadically in pb2 --source include/have_binlog_format_statement.inc --source include/have_innodb.inc --source include/have_debug.inc --source include/master-slave.inc --source include/not_embedded.inc +--source include/not_var_link.inc ########################################################################## # Loading data ########################################################################## + +connection slave; +--let $old_debug= `SELECT @@GLOBAL.DEBUG` +SET @@GLOBAL.DEBUG = '+d,remove_slave_load_file_before_write'; + connection master; create table t1(a int not null auto_increment, b int, primary key(a)) engine=innodb; @@ -31,19 +46,14 @@ commit; # Catch Error ########################################################################## connection slave; -source include/wait_for_slave_sql_to_stop.inc; ---let $error= query_get_value(SHOW SLAVE STATUS, Last_Errno, 1) # windows and linux different error numbers here: # Windows: # - Last_Errno 29 (File not found) # Unix like OS: # - Last_Errno 13 (Can't stat file) ---let $assertion= `SELECT $error=29 OR $error=13` -if (!$assertion) -{ - --echo UNEXPECTED ERROR NUMBER: $error -} +--let $slave_sql_errno= 29, 13 +--source include/wait_for_slave_sql_error.inc ########################################################################## # Clean up @@ -52,9 +62,19 @@ connection master; drop table t1; -connection slave; +--source include/sync_slave_io_with_master.inc +--source include/stop_slave_io.inc +RESET SLAVE; drop table t1; call mtr.add_suppression("Slave: Can't get stat of .*"); +call mtr.add_suppression("Slave SQL: Error .Can.t get stat of.* Error_code: 13"); call mtr.add_suppression("Slave: File.* not found.*"); +call mtr.add_suppression("Slave SQL: Error .File.* not found.* Error_code: 29"); +--let $rpl_only_running_threads= 1 + +eval SET @@GLOBAL.DEBUG = '$old_debug'; + +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test index 68c41abf537..b99c71b1ca0 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test @@ -5,20 +5,18 @@ --source include/have_log_bin.inc --source include/not_embedded.inc -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); -connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); +--let $rpl_skip_start_slave= 1 +--source include/master-slave.inc -connection slave; - ---replace_result $MASTER_MYPORT MASTER_MYPORT -eval CHANGE MASTER TO MASTER_USER='root', - MASTER_CONNECT_RETRY=1, - MASTER_HOST='127.0.0.1', - MASTER_PORT=$MASTER_MYPORT; +--connection slave START SLAVE; +# Why 12??? +call mtr.add_suppression("Slave SQL.*Unable to use slave.s temporary directory.* Error_code: 12"); +--let $slave_sql_errno= 12 +source include/wait_for_slave_sql_error.inc; + +--source include/stop_slave_io.inc +RESET SLAVE; -source include/wait_for_slave_sql_to_stop.inc; -let $errno=query_get_value("show slave status", Last_SQL_Errno, 1); -echo $errno; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test index 66762d4dad0..f2129bd7f18 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_skip.test +++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test @@ -309,3 +309,4 @@ connection master; DROP TABLE t10; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test index 02fd555d13c..0645b4267d6 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_status.test +++ b/mysql-test/suite/rpl/t/rpl_slave_status.test @@ -56,15 +56,23 @@ START SLAVE; source include/wait_for_slave_sql_to_start.inc; source include/wait_for_slave_io_to_stop.inc; ---echo ==== Verify that Slave_IO_Running = No ==== -let $result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); ---echo Slave_IO_Running = $result (should be No) +--echo ==== Verify that Slave IO thread stopped with error ==== +# 1045 = ER_ACCESS_DENIED_ERROR +--let $slave_io_errno= 1045 +--source include/wait_for_slave_io_error.inc --echo ==== Cleanup (Note that slave IO thread is not running) ==== -DROP TABLE t1; -# cleanup: slave io thread has been stopped "irrecoverably" -# so we clean up mess manually + +# cleanup: slave io thread has is stopped so we reset replication +--source include/stop_slave_sql.inc +CHANGE MASTER TO MASTER_USER = 'root', MASTER_PASSWORD = ''; +# clear Slave_IO_Errno +--let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc --echo [on master] connection master; DROP TABLE t1; + +--source include/rpl_end.inc +--source include/force_restart.inc diff --git a/mysql-test/suite/rpl/t/rpl_slow_query_log.test b/mysql-test/suite/rpl/t/rpl_slow_query_log.test index 334c4393b83..faf037a9dff 100644 --- a/mysql-test/suite/rpl/t/rpl_slow_query_log.test +++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test @@ -29,7 +29,7 @@ source include/master-slave.inc; source include/have_binlog_format_statement.inc; CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); # Prepare slave for different long_query_time we need to stop the slave # and restart it as long_query_time variable is dynamic and, after @@ -196,7 +196,7 @@ disconnect extra2; # BUG#50620: Adding an index to a table prevents slave from logging into slow log # --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master SET @old_log_output= @@log_output; @@ -233,7 +233,7 @@ let $master_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text -- sync_slave_with_master let $slave_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`; -if (`SELECT $master_slow_query != $slave_slow_query`) +if ($master_slow_query != $slave_slow_query) { -- connection master -- echo *********************************************** @@ -250,7 +250,7 @@ if (`SELECT $master_slow_query != $slave_slow_query`) -- die "Assertion failed! Master and slave slow log contents differ. Bailing out!" } -if (`SELECT $master_slow_query = $slave_slow_query`) +if ($master_slow_query == $slave_slow_query) { -- echo ### Assertion is good. Both Master and Slave exhibit the -- echo ### same number of queries in slow log: $master_slow_query @@ -276,7 +276,7 @@ let $master_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text -- sync_slave_with_master let $slave_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`; -if (`SELECT $master_slow_query != $slave_slow_query`) +if ($master_slow_query != $slave_slow_query) { -- connection master -- echo *********************************************** @@ -293,7 +293,7 @@ if (`SELECT $master_slow_query != $slave_slow_query`) -- die "Assertion failed! Master and slave slow log contents differ. Bailing out!" } -if (`SELECT $master_slow_query = $slave_slow_query`) +if ($master_slow_query == $slave_slow_query) { -- echo ### Assertion is good. Both Master and Slave exhibit the -- echo ### same number of queries in slow log: $master_slow_query @@ -307,3 +307,4 @@ DROP TABLE t1; -- sync_slave_with_master SET @@global.log_output= @old_log_output; SET @@global.long_query_time= @old_long_query_time; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test index b2e7418ce14..00815ab9d7e 100644 --- a/mysql-test/suite/rpl/t/rpl_sp.test +++ b/mysql-test/suite/rpl/t/rpl_sp.test @@ -692,13 +692,8 @@ drop function f1; --echo # --echo # Bug #11918 Can't use a declared variable in LIMIT clause --echo # ---disable_warnings -drop table if exists t1; -drop procedure if exists p1; ---enable_warnings -connection master; --- source include/master-slave-reset.inc -connection default; +--source include/rpl_reset.inc + create table t1 (c1 int); insert into t1 (c1) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); @@ -723,7 +718,7 @@ select * from t1; sync_slave_with_master; connection slave; select * from t1; -connection default; +connection master; --disable_warnings call p1(-1); --enable_warnings @@ -731,7 +726,7 @@ select * from t1; sync_slave_with_master; connection slave; select * from t1; -connection default; +connection master; --echo # Cleanup set @@session.binlog_format=@save_binlog_format; @@ -743,3 +738,4 @@ drop procedure p1; # Cleanup sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sp004.test b/mysql-test/suite/rpl/t/rpl_sp004.test index 2f9b329eb66..31e4ce37df7 100644 --- a/mysql-test/suite/rpl/t/rpl_sp004.test +++ b/mysql-test/suite/rpl/t/rpl_sp004.test @@ -89,3 +89,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/sp004_master.sql $MYSQLTEST_VARDIR/tmp/sp004_sl # End of 5.0 test case +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sp_effects.test b/mysql-test/suite/rpl/t/rpl_sp_effects.test index 63ac3a8ad9c..df13ff253b1 100644 --- a/mysql-test/suite/rpl/t/rpl_sp_effects.test +++ b/mysql-test/suite/rpl/t/rpl_sp_effects.test @@ -261,3 +261,4 @@ SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creato sync_slave_with_master; --echo end of the tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_spec_variables.test b/mysql-test/suite/rpl/t/rpl_spec_variables.test index a60738316c8..2cb580fce83 100644 --- a/mysql-test/suite/rpl/t/rpl_spec_variables.test +++ b/mysql-test/suite/rpl/t/rpl_spec_variables.test @@ -304,3 +304,4 @@ SET @@global.storage_engine=@restore_slave_storage_engine; call mtr.add_suppression("The table 't[12]' is full"); # End of 5.1 test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sporadic_master.test b/mysql-test/suite/rpl/t/rpl_sporadic_master.test index 6640544b0ed..592d13e67b0 100644 --- a/mysql-test/suite/rpl/t/rpl_sporadic_master.test +++ b/mysql-test/suite/rpl/t/rpl_sporadic_master.test @@ -1,6 +1,3 @@ -############################################################# -# 2006-02-07 By JBM added order by -############################################################# # test to see if replication can continue when master sporadically fails on # COM_BINLOG_DUMP and additionally limits the number of events per dump @@ -13,10 +10,8 @@ truncate table t1; # We have to use 4 in the following to make this test work with all table types insert into t1 values (4),(NULL); sync_slave_with_master; -stop slave; ---source include/wait_for_slave_to_stop.inc -start slave; ---source include/wait_for_slave_to_start.inc +--source include/stop_slave.inc +--source include/start_slave.inc connection master; insert into t1 values (NULL),(NULL); flush logs; @@ -28,4 +23,4 @@ connection master; drop table t1,t2; sync_slave_with_master; -# End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ssl.test b/mysql-test/suite/rpl/t/rpl_ssl.test index 0f216983a32..43289428d45 100644 --- a/mysql-test/suite/rpl/t/rpl_ssl.test +++ b/mysql-test/suite/rpl/t/rpl_ssl.test @@ -75,7 +75,7 @@ source include/check_slave_is_running.inc; let $slave_count= `select count(*) from t1`; -if (`select $slave_count != $master_count`) +if ($slave_count != $master_count) { echo master and slave differed in number of rows; echo master: $master_count; @@ -97,4 +97,14 @@ drop user replssl@localhost; drop table t1; sync_slave_with_master; +--source include/stop_slave.inc +CHANGE MASTER TO + master_user = 'root', + master_ssl = 0, + master_ssl_ca = '', + master_ssl_cert = '', + master_ssl_key = ''; + --echo End of 5.0 tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ssl1.test b/mysql-test/suite/rpl/t/rpl_ssl1.test index 152f307fd31..f5f63a00033 100644 --- a/mysql-test/suite/rpl/t/rpl_ssl1.test +++ b/mysql-test/suite/rpl/t/rpl_ssl1.test @@ -10,7 +10,6 @@ connection master; grant replication slave on *.* to replssl@localhost require ssl; create table t1 (t int); -#syncing with master sync_slave_with_master; #trying to use this user without ssl @@ -57,6 +56,7 @@ start slave; connection master; drop user replssl@localhost; drop table t1; + sync_slave_with_master; source include/show_slave_status.inc; source include/check_slave_is_running.inc; @@ -91,6 +91,19 @@ select * from t1; source include/show_slave_status.inc; --source include/check_slave_is_running.inc +# ==== Clean up ==== + connection master; drop table t1; sync_slave_with_master; +--source 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; + +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_000001.test b/mysql-test/suite/rpl/t/rpl_stm_000001.test index aee067b2d4a..268a10ad1fa 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_000001.test +++ b/mysql-test/suite/rpl/t/rpl_stm_000001.test @@ -1,2 +1,128 @@ -let $engine_type=myisam; --- source extra/rpl_tests/rpl_stm_000001.test +# Requires binlog_format=statement format since query involving +# get_lock() is logged in row format if binlog_format=mixed or row. +-- source include/have_binlog_format_statement.inc +-- source include/master-slave.inc + +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +--let $engine_type= myisam + +# Load some data into t1 +create table t1 (word char(20) not null); +load data infile '../../std_data/words.dat' into table t1; +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1; +select * from t1 limit 10; + +# +# Test slave with wrong password +# +sync_slave_with_master; +stop slave; +connection master; +set password for root@"localhost" = password('foo'); +connection slave; +start slave; +connection master; +# +# Give slave time to do at last one failed connect retry +# This one must be short so that the slave will not stop retrying +real_sleep 2; +set password for root@"localhost" = password(''); +# Give slave time to connect (will retry every second) +sleep 2; + +create table t3(n int); +insert into t3 values(1),(2); +sync_slave_with_master; +select * from t3; +select sum(length(word)) from t1; +connection master; +drop table t1,t3; +sync_slave_with_master; + +# Test if the slave SQL thread can be more than 16K behind the slave +# I/O thread (> IO_SIZE) + +connection master; +# we'll use table-level locking to delay slave SQL thread +eval create table t1 (n int) engine=$engine_type; +sync_slave_with_master; +connection master; +reset master; +connection slave; +stop slave; +reset slave; + +connection master; +let $1=5000; +# Generate 16K of relay log +disable_query_log; +while ($1) +{ + eval insert into t1 values($1); + dec $1; +} +enable_query_log; + +# Try to cause a large relay log lag on the slave by locking t1 +connection slave; +lock tables t1 read; +start slave; +connection master; +--source include/sync_slave_io_with_master.inc +unlock tables; + +#test handling of aborted connection in the middle of update + +connection master; +create table t2(id int); +insert into t2 values(connection_id()); + +connection master1; +# Avoid generating result +create temporary table t3(n int); +--disable_warnings +insert into t3 select get_lock('crash_lock%20C', 1) from t2; +--enable_warnings + +connection master; +send update t1 set n = n + get_lock('crash_lock%20C', 2); +connection master1; +sleep 3; +select (@id := id) - id from t2; +kill @id; +# We don't drop t3 as this is a temporary table +drop table t2; +connection master; +# The get_lock function causes warning for unsafe statement. +--disable_warnings +--error 1317,2013 +reap; +--enable_warnings +connection slave; +# The SQL slave thread should now have stopped because the query was killed on +# the master (so it has a non-zero error code in the binlog). +# 1053 = ER_SERVER_SHUTDOWN +--let $slave_sql_errno= 1053 +--source include/wait_for_slave_sql_error_and_skip.inc + +select count(*) from t1; +connection master1; +drop table t1; +create table t1 (n int); +insert into t1 values(3456); +insert into mysql.user (Host, User, Password) + VALUES ("10.10.10.%", "blafasel2", password("blafasel2")); +select select_priv,user from mysql.user where user = _binary'blafasel2'; +update mysql.user set Select_priv = "Y" where User= _binary"blafasel2"; +select select_priv,user from mysql.user where user = _binary'blafasel2'; +sync_slave_with_master; +select n from t1; +select select_priv,user from mysql.user where user = _binary'blafasel2'; +connection master1; +drop table t1; +delete from mysql.user where user="blafasel2"; +sync_slave_with_master; + +# End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test b/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test index a996c6fac66..e8e20438d1d 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test +++ b/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test @@ -105,3 +105,4 @@ DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; enable_warnings; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size-master.opt b/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size-master.opt deleted file mode 100644 index 45631525481..00000000000 --- a/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size-master.opt +++ /dev/null @@ -1 +0,0 @@ ---binlog_cache_size=4096 --max_binlog_cache_size=7680 diff --git a/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size.test b/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size.test index 7e43b7a9e7d..352213304b6 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size.test +++ b/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size.test @@ -5,3 +5,4 @@ --source include/have_binlog_format_statement.inc --source extra/rpl_tests/rpl_binlog_max_cache_size.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_conflicts.test b/mysql-test/suite/rpl/t/rpl_stm_conflicts.test index 07b7a0bf8f7..cd9e71cbff9 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_conflicts.test +++ b/mysql-test/suite/rpl/t/rpl_stm_conflicts.test @@ -1,11 +1,6 @@ -# See the top of mysql-test/extra/rpl_tests/rpl_conflicts.test for an -# explanation of what this test does. -# -# This test file is for statement-logging mode. - source include/have_binlog_format_mixed_or_statement.inc; source include/master-slave.inc; source extra/rpl_tests/rpl_conflicts.test; -source include/master-slave-end.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test index b46da8a0150..6e3dabf6e32 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test +++ b/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test @@ -8,3 +8,4 @@ --source include/have_innodb.inc --source extra/rpl_tests/rpl_drop_create_temp_table.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test index e24eb718c47..d8a3ad23b66 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test +++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test @@ -3,6 +3,3 @@ let $rename_event_pos= 959; -- source extra/rpl_tests/rpl_flsh_tbls.test - -# End of 4.1 tests -# Adding comment for force manual merge 5.0 -> wl1012. Delete me if needed. diff --git a/mysql-test/suite/rpl/t/rpl_stm_found_rows.test b/mysql-test/suite/rpl/t/rpl_stm_found_rows.test index 2d8d480b910..1ec8f8a0424 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_found_rows.test +++ b/mysql-test/suite/rpl/t/rpl_stm_found_rows.test @@ -119,7 +119,5 @@ DROP TABLE t1, logtbl; DROP PROCEDURE just_log; DROP PROCEDURE calc_and_log; DROP FUNCTION log_rows; -sync_slave_with_master; - -source include/reset_master_and_slave.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test index f3a4b174ab3..ae59008c3ee 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test @@ -8,3 +8,4 @@ --let $engine=Innodb set session storage_engine=innodb; --source extra/rpl_tests/rpl_implicit_commit_binlog.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_innodb.test b/mysql-test/suite/rpl/t/rpl_stm_innodb.test index 5b3fef9c66b..cecf9ec7bcd 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_stm_innodb.test @@ -6,3 +6,4 @@ source include/have_innodb.inc; source include/have_binlog_format_mixed_or_statement.inc; source extra/rpl_tests/rpl_innodb.test; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test b/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test index 3db3f7d9fcd..92d57625283 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test +++ b/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test @@ -2,7 +2,9 @@ --source include/master-slave.inc --source include/not_embedded.inc --source include/not_windows.inc + disable_query_log; call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); enable_query_log; --source extra/rpl_tests/rpl_insert_delayed.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_loadfile.test b/mysql-test/suite/rpl/t/rpl_stm_loadfile.test index c27348ce987..5d2c85b2cb6 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_stm_loadfile.test @@ -22,3 +22,4 @@ enable_query_log; -- source extra/rpl_tests/rpl_loadfile.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_log.test b/mysql-test/suite/rpl/t/rpl_stm_log.test index 7bc17fbaada..7e7e1d4033f 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_log.test +++ b/mysql-test/suite/rpl/t/rpl_stm_log.test @@ -7,3 +7,4 @@ let $engine_type=MyISAM; # End of 4.1 tests # Adding comment for force manual merge 5.0 -> wl1012: Delete me +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test b/mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test index 950aa8b322a..1a7139c889a 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test +++ b/mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test @@ -6,6 +6,3 @@ # Requires statement logging -- source include/have_binlog_format_mixed_or_statement.inc -- source extra/rpl_tests/rpl_max_relay_size.test - -# End of 4.1 tests -# diff --git a/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test b/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test index 523e883d9fa..537d304687c 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test +++ b/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test @@ -16,3 +16,4 @@ -- source include/have_binlog_format_mixed_or_statement.inc -- source extra/rpl_tests/rpl_show_relaylog_events.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test index f32ab1f01f0..f13057a7d83 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test +++ b/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test @@ -13,7 +13,7 @@ let $engine_type=Innodb; # BUG#49522: Replication problem with mixed MyISAM/InnoDB # --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master CREATE TABLE `t1` ( @@ -37,12 +37,11 @@ SET AUTOCOMMIT=1; -- sync_slave_with_master --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master DROP TABLE `t1`; -- sync_slave_with_master --- source include/master-slave-end.inc +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_multi_query.test b/mysql-test/suite/rpl/t/rpl_stm_multi_query.test index c39d1fad015..e234f4b9622 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_multi_query.test +++ b/mysql-test/suite/rpl/t/rpl_stm_multi_query.test @@ -3,10 +3,5 @@ # CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not # one binlog event containing all queries) -# Requires statement logging -- source include/have_binlog_format_mixed_or_statement.inc -- source extra/rpl_tests/rpl_multi_query.test - - -# End of 4.1 tests -# diff --git a/mysql-test/suite/rpl/t/rpl_stm_no_op.test b/mysql-test/suite/rpl/t/rpl_stm_no_op.test index 66dc89bd712..1605b177ac4 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_no_op.test +++ b/mysql-test/suite/rpl/t/rpl_stm_no_op.test @@ -91,3 +91,4 @@ select * from t2; connection master; drop table t1, t2; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_sql_mode.test b/mysql-test/suite/rpl/t/rpl_stm_sql_mode.test index d5aac4a43e2..0eb41d1c6bd 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_sql_mode.test +++ b/mysql-test/suite/rpl/t/rpl_stm_sql_mode.test @@ -22,3 +22,4 @@ DROP TABLE t1; -- echo # duplicate key error (because it has received event -- echo # with expected error code). -- sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test index 7701cd7aa06..ada080e9071 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test @@ -5,5 +5,22 @@ --source include/have_binlog_format_statement.inc --source include/have_innodb.inc +# make innodb updates run fast +--connection slave +SET @old_innodb_flush_log_at_trx_commit= @@global.innodb_flush_log_at_trx_commit; +SET @@global.innodb_flush_log_at_trx_commit= 0; +--connection master +SET @old_innodb_flush_log_at_trx_commit= @@global.innodb_flush_log_at_trx_commit; +SET @@global.innodb_flush_log_at_trx_commit= 0; + SET @@session.binlog_direct_non_transactional_updates= FALSE; --source ./extra/rpl_tests/rpl_start_stop_slave.test + +# clean up +--connection slave +SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit; +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); +--connection master +SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_stop_middle_group.test b/mysql-test/suite/rpl/t/rpl_stm_stop_middle_group.test index dd3bf1a7f56..84d663298c4 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_stop_middle_group.test +++ b/mysql-test/suite/rpl/t/rpl_stm_stop_middle_group.test @@ -8,3 +8,4 @@ SET @@session.binlog_direct_non_transactional_updates= FALSE; -- source extra/rpl_tests/rpl_stop_middle_group.test +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test index 12782589b0d..4e9ccc2b0cf 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_until.test +++ b/mysql-test/suite/rpl/t/rpl_stm_until.test @@ -72,7 +72,7 @@ select * from t1; --let $slave_param_value= $master_log_pos_1 --source include/check_slave_param.inc -let $relay_log_file= slave-relay-bin.000004; +let $relay_log_file= slave-relay-bin.000003; let $master_log_pos= $master_log_pos_2; source include/get_relay_log_pos.inc; # try replicate all up to and not including the second insert to t2; @@ -195,24 +195,18 @@ sync_with_master; # to substitute the genuine one with a prepared on 4.1 server. # ---source include/master-slave-reset.inc +--source include/rpl_reset.inc connection master; -drop table if exists t1; # there is create table t1 in bug47142_master-bin.000001 -sync_slave_with_master; -connection slave; -stop slave; -connection master; - flush logs; let $MYSQLD_DATADIR= `select @@datadir`; --remove_file $MYSQLD_DATADIR/master-bin.000001 --copy_file $MYSQL_TEST_DIR/std_data/bug47142_master-bin.000001 $MYSQLD_DATADIR/master-bin.000001 # this a constant bound to the bug47142_master-bin.000001 binlog file --let $binlog_before_drop=294; -flush logs; connection slave; +stop slave; reset slave; --replace_regex /master_log_pos=[0-9]+/master_log_pos=MASTER_LOG_POS/ eval start slave until master_log_file='master-bin.000001', master_log_pos=$binlog_before_drop /* to stop right before DROP */; @@ -224,9 +218,7 @@ show tables /* t1 must exist */; drop table t1; # drop on slave only, master does not have t1. stop slave; -reset slave; - -connection master; -reset master; # End of tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_user_variables.test b/mysql-test/suite/rpl/t/rpl_stm_user_variables.test index 05adc597776..2045dd6ae57 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_user_variables.test +++ b/mysql-test/suite/rpl/t/rpl_stm_user_variables.test @@ -43,8 +43,7 @@ CREATE TABLE t1 (`tinyint` TINYINT, -- echo ######################################### -- connection master -- echo ## assertion: master and slave tables are in sync --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables=master:t1,slave:t1 -- source include/diff_tables.inc -- connection master TRUNCATE t1; @@ -74,8 +73,7 @@ INSERT INTO t1 VALUES (@positive, -- echo ######################################### -- connection master -- echo ## assertion: master and slave tables are in sync --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables=master:t1,slave:t1 -- source include/diff_tables.inc -- connection master TRUNCATE t1; @@ -94,8 +92,7 @@ TRUNCATE t1; -- echo ######################################### -- connection master -- echo ## assertion: master and slave tables are in sync --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables=master:t1,slave:t1 -- source include/diff_tables.inc -- connection master TRUNCATE t1; @@ -126,8 +123,7 @@ INSERT INTO t1 VALUES (@negative, -- connection master -- echo ## assertion: master and slave tables are in sync --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables=master:t1,slave:t1 -- source include/diff_tables.inc -- connection master TRUNCATE t1; @@ -145,7 +141,7 @@ DROP TABLE t1; # BUG#51426 # ##################################################################### --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master CREATE TABLE t1 ( c INT, PRIMARY KEY (c)) Engine=MyISAM; @@ -162,8 +158,7 @@ INSERT INTO t1 VALUES (@aux) , (@aux1); -- sync_slave_with_master -- echo ## assertion: master and slave tables are in sync --- let $diff_table_1=master:test.t1 --- let $diff_table_2=slave:test.t1 +-- let $diff_tables=master:t1,slave:t1 -- source include/diff_tables.inc --connection master @@ -172,3 +167,4 @@ DROP TABLE t1; -- sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test new file mode 100644 index 00000000000..296b002dbb7 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test @@ -0,0 +1,119 @@ +source include/master-slave.inc; +source include/have_innodb.inc; +source include/have_debug.inc; +source include/have_debug_sync.inc; +source include/have_binlog_format_mixed_or_statement.inc; + +--echo +--echo # BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends +--echo # +--echo # If a temporary table is created or dropped, the transaction should be +--echo # regarded similarly that a non-transactional table is modified. So +--echo # STOP SLAVE should wait until the transaction has finished. + +CREATE TABLE t1(c1 INT) ENGINE=InnoDB; +CREATE TABLE t2(c1 INT) ENGINE=InnoDB; + +sync_slave_with_master; +SET DEBUG_SYNC= 'RESET'; +source include/stop_slave.inc; + +--echo +--echo # Suspend the INSERT statement in current transaction on SQL thread. +--echo # It guarantees that SQL thread is applying the transaction when +--echo # STOP SLAVE command launchs. +let $debug_save= `SELECT @@GLOBAL.debug`; +SET GLOBAL debug= 'd,after_mysql_insert'; +source include/start_slave.inc; + +--echo +--echo # CREATE TEMPORARY TABLE with InnoDB engine +--echo # ----------------------------------------- +let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB; +source extra/rpl_tests/rpl_stop_slave.test; + +--echo +--echo # CREATE TEMPORARY TABLE ... SELECT with InnoDB engine +--echo # ---------------------------------------------------- +let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB + SELECT c1 FROM t2; +source extra/rpl_tests/rpl_stop_slave.test; + +# Don't need to verify 'CREATE TEMPORARY TABLE' with MyIASM engine, as it +# never is binlogged into a transaction since 5.5. + +--echo +--echo # Test end +SET GLOBAL debug= '$debug_save'; +source include/restart_slave_sql.inc; + +connection slave; +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); +connection master; + +--source include/rpl_connection_master.inc +DROP TABLE t1, t2; + +--echo +--echo # Bug#58546 test rpl_packet timeout failure sporadically on PB +--echo # ---------------------------------------------------------------------- +--echo # STOP SLAVE stopped IO thread first and then stopped SQL thread. It was +--echo # possible that IO thread stopped after replicating part of a transaction +--echo # which SQL thread was executing. SQL thread would be hung if the +--echo # transaction could not be rolled back safely. +--echo # It caused some sporadic failures on PB2. +--echo # +--echo # This test verifies that when 'STOP SLAVE' is issued by a user, IO +--echo # thread will continue to fetch the rest events of the transaction which +--echo # is being executed by SQL thread and is not able to be rolled back safely. + +CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB; +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES(1, 1); + +sync_slave_with_master; + +--source include/rpl_connection_master.inc + +let $debug_save= `SELECT @@GLOBAL.debug`; +SET GLOBAL debug= 'd,dump_thread_wait_before_send_xid'; + +--source include/rpl_connection_slave.inc +source include/restart_slave_sql.inc; + +BEGIN; +UPDATE t1 SET c2 = 2 WHERE c1 = 1; + +--source include/rpl_connection_master.inc +BEGIN; +INSERT INTO t1 VALUES(2, 2); +INSERT INTO t2 VALUES(1); +UPDATE t1 SET c2 = 3 WHERE c1 = 1; +COMMIT; + +--source include/rpl_connection_slave1.inc +let $show_statement= SHOW PROCESSLIST; +let $field= Info; +let $condition= = 'UPDATE t1 SET c2 = 3 WHERE c1 = 1'; +source include/wait_show_condition.inc; + +send STOP SLAVE; + +--source include/rpl_connection_slave.inc +ROLLBACK; + +--source include/rpl_connection_master.inc +SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_connection_slave.inc +source include/wait_for_slave_to_stop.inc; + +--source include/rpl_connection_slave1.inc +reap; +source include/start_slave.inc; + +--source include/rpl_connection_master.inc +DROP TABLE t1, t2; +SET GLOBAL debug= $debug_save; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test index 63efcbeec04..6dab08ac503 100644 --- a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test @@ -621,3 +621,4 @@ sync_slave_with_master; connection master; # Restore binlog format setting set global binlog_format =@my_binlog_format; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sync-slave.opt b/mysql-test/suite/rpl/t/rpl_sync-slave.opt index fba451a5b3e..3816e61bb1e 100644 --- a/mysql-test/suite/rpl/t/rpl_sync-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_sync-slave.opt @@ -1 +1,2 @@ --sync-relay-log-info=1 --relay-log-recovery=1 --innodb_file_format_check=1 --default-storage-engine=MyISAM --innodb-file-per-table=0 +--skip-core-file diff --git a/mysql-test/suite/rpl/t/rpl_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test index 48c8dc02efb..e1750be0ff6 100644 --- a/mysql-test/suite/rpl/t/rpl_sync.test +++ b/mysql-test/suite/rpl/t/rpl_sync.test @@ -31,6 +31,7 @@ --source include/not_valgrind.inc --source include/have_debug.inc --source include/have_innodb.inc +--source include/not_crashrep.inc call mtr.add_suppression('Attempting backtrace'); call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001"); @@ -50,8 +51,7 @@ connection slave; let $MYSQLD_SLAVE_DATADIR= `select @@datadir`; --replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR --copy_file $MYSQLD_SLAVE_DATADIR/master.info $MYSQLD_SLAVE_DATADIR/master.backup -stop slave SQL_THREAD; -source include/wait_for_slave_sql_to_stop.inc; +--source include/stop_slave_sql.inc connection master; insert into t1(a) values(4); @@ -60,8 +60,7 @@ insert into t1(a) values(6); --echo =====Removing relay log files and crashing/recoverying the slave=======; connection slave; -stop slave IO_THREAD; -source include/wait_for_slave_io_to_stop.inc; +--source include/stop_slave_io.inc let $file= query_get_value("SHOW SLAVE STATUS", Relay_Log_File, 1); @@ -79,18 +78,16 @@ SET SESSION debug="d,crash_before_rotate_relaylog"; --error 2013 FLUSH LOGS; ---enable_reconnect ---source include/wait_until_connected_again.inc +--let $rpl_server_number= 2 +--source include/rpl_reconnect.inc --echo =====Dumping and comparing tables=======; -start slave; -source include/wait_for_slave_to_start.inc; +--source include/start_slave.inc connection master; sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables=master:t1,slave:t1; source include/diff_tables.inc; ######################################################################################## @@ -98,8 +95,7 @@ source include/diff_tables.inc; ######################################################################################## --echo =====Corrupting the master.info=======; connection slave; -stop slave; -source include/wait_for_slave_to_stop.inc; +--source include/stop_slave.inc connection master; FLUSH LOGS; @@ -130,18 +126,16 @@ SET SESSION debug="d,crash_before_rotate_relaylog"; --error 2013 FLUSH LOGS; ---enable_reconnect ---source include/wait_until_connected_again.inc +--let $rpl_server_number= 2 +--source include/rpl_reconnect.inc --echo =====Dumping and comparing tables=======; -start slave; -source include/wait_for_slave_to_start.inc; +--source include/start_slave.inc connection master; sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables=master:t1,slave:t1; source include/diff_tables.inc; ######################################################################################## @@ -150,3 +144,7 @@ source include/diff_tables.inc; --echo =====Clean up=======; connection master; drop table t1; + +--remove_file $MYSQLD_SLAVE_DATADIR/master.backup +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_temp_table.test b/mysql-test/suite/rpl/t/rpl_temp_table.test index 62c3633b7b2..92f8cef9c10 100644 --- a/mysql-test/suite/rpl/t/rpl_temp_table.test +++ b/mysql-test/suite/rpl/t/rpl_temp_table.test @@ -64,3 +64,6 @@ connect (master2,localhost,root,,); connection master2; drop table if exists t1,t2; sync_slave_with_master; + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test index e19c3019aa1..63f0b6c2234 100644 --- a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test +++ b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test @@ -11,6 +11,7 @@ source include/master-slave.inc; source include/have_binlog_format_mixed.inc; +source include/have_innodb.inc; --echo ==== Initialize ==== @@ -31,6 +32,7 @@ SHOW STATUS LIKE "Slave_open_temp_tables"; --connection master disconnect master; +--echo [on master1] --connection master1 # waiting DROP TEMPORARY TABLE event to be written into binlog @@ -46,7 +48,10 @@ SHOW STATUS LIKE "Slave_open_temp_tables"; --echo ==== Clean up ==== --echo [on master] ---connection master1 +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc +--connection master DROP TABLE t1; --echo [on slave] @@ -88,8 +93,7 @@ sync_slave_with_master; # 10. in the end the slave should not have open temp tables. # -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); --- source include/master-slave-reset.inc +--source include/rpl_reset.inc -- connection master # action: setup environment @@ -146,3 +150,61 @@ DROP TABLE t3, t1; -- sync_slave_with_master -- source include/show_binlog_events.inc + +--echo +--echo # Bug#55478 Row events wrongly apply on the temporary table of the same name +--echo # ========================================================================== +connection master; + +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); + +--echo # The statement should be binlogged +CREATE TEMPORARY TABLE t1(c1 INT) ENGINE=InnoDB; + +--echo +--echo # Case 1: CREATE TABLE t1 ... SELECT +--echo # ---------------------------------- +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); + +--echo +--echo # The statement generates row events on t1. And the rows events should +--echo # be inserted into the base table on slave. +CREATE TABLE t1 ENGINE=MyISAM SELECT rand(); + +source include/show_binlog_events.inc; +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); + +--echo +--echo # Case 2: DROP TEMPORARY TABLE in a transacation +--echo # ---------------------------------------------- +--echo + +BEGIN; +DROP TEMPORARY TABLE t1; + +# The patch for BUG#55478 fixed the problem only on RBR. The problem on SBR +# will be fixed by the patch for bug#55709. So This statement cannot be +# executed until Bug#55709 is fixed +# +# INSERT INTO t1 VALUES(1); + +--echo # The rows event will binlogged before 'DROP TEMPORARY TABLE t1', +--echo # as t1 is non-transactional table +INSERT INTO t1 VALUES(Rand()); +COMMIT; + +source include/show_binlog_events.inc; + +--sync_slave_with_master + +--echo # Compare the base table. +--let $diff_tables= master:t1, slave:t1 +--source include/diff_tables.inc + +--echo +connection master; +DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test index 7a66a55d510..878589ef006 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary.test +++ b/mysql-test/suite/rpl/t/rpl_temporary.test @@ -313,12 +313,15 @@ select * from t1; connection master; drop table t1; --remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql +--sync_slave_with_master -# Delete the anonymous users -SET sql_log_bin = 0; +# Delete the anonymous users. +--source include/stop_slave.inc source include/delete_anonymous_users.inc; -SET sql_log_bin = 1; - +--connection master +source include/delete_anonymous_users.inc; +--let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc # @@ -350,9 +353,7 @@ connection slave; DROP USER user43748@127.0.0.1; ---echo -- done. back to master. -connection master; - - --echo End of 5.1 tests +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt b/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt index 80c171170f6..b37427aa2cd 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_temporary_errors-slave.opt @@ -1,3 +1,2 @@ --loose-debug="+d,all_errors_are_temporary_errors" --slave-transaction-retries=2 - - +--force-restart diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test index f05cf73c6ed..07b23e10847 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test +++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test @@ -26,8 +26,12 @@ set @@global.slave_exec_mode= default; SHOW STATUS LIKE 'Slave_retried_transactions'; SELECT * FROM t1; source include/check_slave_is_running.inc; -DROP TABLE t1; + +connection slave; +call mtr.add_suppression("Slave SQL.*Could not execute Update_rows event on table test.t1"); --echo **** On Master **** connection master; DROP TABLE t1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_test_framework.cnf b/mysql-test/suite/rpl/t/rpl_test_framework.cnf new file mode 100644 index 00000000000..8934d1c9ae1 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_test_framework.cnf @@ -0,0 +1,46 @@ +!include ../my.cnf +[mysqld.1] +log-slave-updates +[mysqld.2] +log-slave-updates +[mysqld.3] +log-slave-updates +[mysqld.4] +log-slave-updates +[mysqld.5] +log-slave-updates +[mysqld.6] +log-slave-updates +[mysqld.7] +log-slave-updates +[mysqld.8] +log-slave-updates +[mysqld.9] +log-slave-updates +#[mysqld.10] +#log-slave-updates +#[mysqld.11] +#log-slave-updates +#[mysqld.12] +#log-slave-updates +#[mysqld.13] +#log-slave-updates +#[mysqld.14] +#log-slave-updates +#[mysqld.15] +#log-slave-updates + +[ENV] +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYPORT_4= @mysqld.4.port +SERVER_MYPORT_5= @mysqld.5.port +SERVER_MYPORT_6= @mysqld.6.port +SERVER_MYPORT_7= @mysqld.7.port +SERVER_MYPORT_8= @mysqld.8.port +SERVER_MYPORT_9= @mysqld.9.port +#SERVER_MYPORT_10= @mysqld.10.port +#SERVER_MYPORT_11= @mysqld.11.port +#SERVER_MYPORT_12= @mysqld.12.port +#SERVER_MYPORT_13= @mysqld.13.port +#SERVER_MYPORT_14= @mysqld.14.port +#SERVER_MYPORT_15= @mysqld.15.port diff --git a/mysql-test/suite/rpl/t/rpl_test_framework.test b/mysql-test/suite/rpl/t/rpl_test_framework.test new file mode 100644 index 00000000000..e0f961caff1 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_test_framework.test @@ -0,0 +1,143 @@ +# ==== Purpose ==== +# +# Test that the sync chain generated by +# include/rpl_change_topology.inc (sourced from include/rpl_init.inc) +# is correct. +# +# We test a number of different topologies. Each topology is tested +# in extra/rpl_tests/rpl_test_framework.inc. See +# extra/rpl_tests/rpl_test_framework.inc for details on how the sync +# chain is tested. +# +# ==== Related bugs ==== +# +# BUG#49978: Replication tests don't clean up replication state at the end + + +# We only need to execute this test once. Also, we rely on 'DELETE +# FROM t1' to remove rows in slave tables that don't exist in master +# tables (see include/rpl_test_framework.inc for details). +--source include/have_binlog_format_statement.inc + + +--echo ==== Create t1 on all servers. ==== +if ($mtr_supports_more_than_10_servers) +{ + --let $rpl_server_count= 15 + --let $rpl_topology= 1->2->3->4->5->6->7->8->9->10->11->12->13->14->15 +} +if (!$mtr_supports_more_than_10_servers) +{ + --let $rpl_server_count= 9 + --let $rpl_topology= 1->2->3->4->5->6->7->8->9 +} +--source include/rpl_init.inc +CREATE TABLE t1 (a INT); +--source include/rpl_end.inc + +# Initialize $next_number before first call to +# extra/rpl_tests/rpl_test_framework.text +--let $next_number= 0 + + +--echo ==== Test 3-server topologies ==== + +--let $rpl_server_count= 3 + +--let $rpl_topology= 1 -> 2 +--let $masters= 1,3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 2 -> 3 +--let $masters= 1,2 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= none +--let $masters= 1,2,3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->2, 2->1 +--let $masters= 1,3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->2->1 +--let $masters= 2,3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 2->1->2 +--let $masters= 1,3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->2->3 +--let $masters= 1 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 2->3->2->1 +--let $masters= 3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->2,2->3,3->1 +--let $masters= 3 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->3->2->1 +--let $masters= 3 +--source extra/rpl_tests/rpl_test_framework.inc + + +--echo ==== Test 6-server topologies ==== + +--let $rpl_server_count= 6 + +--let $rpl_topology= 1->2->3->4->1->5->6 +--let $masters= 1 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 3->4->5->6->3->1->2 +--let $masters= 4 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 6->5->4->3->2->1 +--let $masters= 6 +--source extra/rpl_tests/rpl_test_framework.inc + +--let $rpl_topology= 1->2->3->1,4->5->6 +--let $masters= 3,4 +--source extra/rpl_tests/rpl_test_framework.inc + + +--echo ==== Test 9-server topology ==== + +--let $rpl_server_count= 9 + +--let $rpl_topology= 1->2, 2->3, 3->4, 4->5, 5->1, 1->6, 6->7, 6->8, 8->9 +--let $masters= 2 +--source extra/rpl_tests/rpl_test_framework.inc + +if ($mtr_supports_more_than_10_servers) { +--echo ==== Test 15-server topologies ==== + +--let $rpl_server_count= 15 + +--let $rpl_topology= 1->2->3->4->5->6->7->8->9->10->11->12->13->14->15->1 +--let $masters= 2 +--source extra/rpl_tests/rpl_test_framework.inc + +# This is a binary tree +--let $rpl_topology= 1->2->4->8,1->3->6->12,2->5->10,3->7->14,4->9,5->11,6->13,7->15 +--let $masters= 1 +--source extra/rpl_tests/rpl_test_framework.inc +} + +--echo ==== Clean up ==== + +if ($mtr_supports_more_than_10_servers) { + --let $rpl_topology= 1->2->3->4->5->6->7->8->9->10->11->12->13->14->15 +} +if (!$mtr_supports_more_than_10_servers) { + --let $rpl_topology= 1->2->3->4->5->6->7->8->9 +} +--source include/rpl_init.inc +--connection server_1 +DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_timezone.test b/mysql-test/suite/rpl/t/rpl_timezone.test index 1b380062dd7..7355106b6b4 100644 --- a/mysql-test/suite/rpl/t/rpl_timezone.test +++ b/mysql-test/suite/rpl/t/rpl_timezone.test @@ -168,6 +168,8 @@ SET @@session.time_zone = default; connection master; DROP TABLE t1; SET @@session.time_zone = default; +--sync_slave_with_master +--source include/stop_slave.inc # Bug#41719 delayed INSERT into timestamp col needs set time_zone for concurrent binlogging # To test that time_zone is correctly binloging for 'insert delayed' statement @@ -200,4 +202,7 @@ select * from t1 order by a; DROP TABLE t1; SET @@session.time_zone = default; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc + --echo End of 5.0 tests diff --git a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test index b30548d0e45..aa22b23925c 100644 --- a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test +++ b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test @@ -20,6 +20,7 @@ sync_slave_with_master; # to stop. # +--connection master --disable_abort_on_error CREATE TABLE t1 (a CHAR(30)); @@ -155,5 +156,4 @@ DROP PROCEDURE p2; DROP EVENT e2; DROP TABLE t1, t2; ---source include/master-slave-end.inc - +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test index 5642b865e6e..e2974a21bf7 100644 --- a/mysql-test/suite/rpl/t/rpl_trigger.test +++ b/mysql-test/suite/rpl/t/rpl_trigger.test @@ -319,24 +319,19 @@ let $MYSQLD_DATADIR= `select @@datadir`; FLUSH LOGS; # Stop master server ---echo --> Stop master server ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF ---shutdown_server 10 ---source include/wait_until_disconnected.inc +--let $rpl_server_number= 1 +--source include/rpl_stop_server.inc + # Replace binlog remove_file $MYSQLD_DATADIR/master-bin.000001; copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLD_DATADIR/master-bin.000001; - ---echo --> Start master server ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart -EOF ---enable_reconnect ---source include/wait_until_connected_again.inc + +--let $rpl_server_number= 1 +--source include/rpl_start_server.inc + let $binlog_version= query_get_value(SHOW BINLOG EVENTS, Info, 1); + # Make the slave to replay the new binlog. --echo --> Master binlog: $binlog_version @@ -512,7 +507,8 @@ sync_slave_with_master; # connection master; -source include/master-slave-reset.inc; +--source include/rpl_reset.inc + connection slave; connection master; @@ -529,12 +525,10 @@ insert into t1 values ( 1 ); rollback; sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; --source include/diff_tables.inc -let $diff_table_1=master:test.log; -let $diff_table_2=slave:test.log; +let $diff_tables= master:log, slave:log; --source include/diff_tables.inc connection master; @@ -544,3 +538,4 @@ sync_slave_with_master; # # End of tests # +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_trunc_temp.test b/mysql-test/suite/rpl/t/rpl_trunc_temp.test index 88ecb7c18b0..0e7d5483f62 100644 --- a/mysql-test/suite/rpl/t/rpl_trunc_temp.test +++ b/mysql-test/suite/rpl/t/rpl_trunc_temp.test @@ -52,3 +52,6 @@ let $wait_binlog_event= DROP; source include/wait_for_binlog_event.inc; show status like 'Slave_open_temp_tables'; + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_truncate_2myisam.test b/mysql-test/suite/rpl/t/rpl_truncate_2myisam.test index a0f0ea04f44..bea6332963e 100644 --- a/mysql-test/suite/rpl/t/rpl_truncate_2myisam.test +++ b/mysql-test/suite/rpl/t/rpl_truncate_2myisam.test @@ -1,4 +1,3 @@ --source include/not_ndb_default.inc let $engine=MyISAM; --source extra/rpl_tests/rpl_truncate.test - diff --git a/mysql-test/suite/rpl/t/rpl_truncate_3innodb.test b/mysql-test/suite/rpl/t/rpl_truncate_3innodb.test index a31fd62a29a..093cf56a316 100644 --- a/mysql-test/suite/rpl/t/rpl_truncate_3innodb.test +++ b/mysql-test/suite/rpl/t/rpl_truncate_3innodb.test @@ -1,6 +1,4 @@ - --source include/have_innodb.inc --source include/not_ndb_default.inc - let $engine=InnoDB; --source extra/rpl_tests/rpl_truncate.test diff --git a/mysql-test/suite/rpl/t/rpl_typeconv-master.opt b/mysql-test/suite/rpl/t/rpl_typeconv-master.opt new file mode 100644 index 00000000000..de048691031 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_typeconv-master.opt @@ -0,0 +1 @@ +--testcase-timeout=40 diff --git a/mysql-test/suite/rpl/t/rpl_typeconv.test b/mysql-test/suite/rpl/t/rpl_typeconv.test index 2a6a3f3b33d..efcbe97049f 100644 --- a/mysql-test/suite/rpl/t/rpl_typeconv.test +++ b/mysql-test/suite/rpl/t/rpl_typeconv.test @@ -61,9 +61,12 @@ SELECT RPAD(Source, 15, ' ') AS Source_Type, enable_query_log; DROP TABLE type_conversions; +call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* Error_code: 1677"); + connection master; DROP TABLE t1; sync_slave_with_master; set global slave_type_conversions = @saved_slave_type_conversions; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test b/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test index 729a622348f..ba2172106b6 100644 --- a/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test @@ -6,8 +6,6 @@ # BUG#49618: Field length stored incorrectly in binary log for InnoDB # -source include/reset_master_and_slave.inc; - connection slave; SET @saved_slave_type_conversions = @@GLOBAL.SLAVE_TYPE_CONVERSIONS; SET GLOBAL SLAVE_TYPE_CONVERSIONS = ''; @@ -17,13 +15,12 @@ CREATE TABLE t1(b1 BIT(1), b2 BIT(2), b3 BIT(3)) ENGINE=InnoDB; INSERT INTO t1 VALUES (b'0', b'01', b'101'); sync_slave_with_master; -let $diff_table_1=master:test.t1; -let $diff_table_2=slave:test.t1; +let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; connection master; DROP TABLE t1; sync_slave_with_master; -connection slave; SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_udf.test b/mysql-test/suite/rpl/t/rpl_udf.test index b52fea144ba..8643654f2a1 100644 --- a/mysql-test/suite/rpl/t/rpl_udf.test +++ b/mysql-test/suite/rpl/t/rpl_udf.test @@ -13,3 +13,5 @@ enable_query_log; let $engine_type= MyISAM; --source include/rpl_udf.inc + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_user.test b/mysql-test/suite/rpl/t/rpl_user.test index b8fe41d03c4..caa17b47733 100644 --- a/mysql-test/suite/rpl/t/rpl_user.test +++ b/mysql-test/suite/rpl/t/rpl_user.test @@ -59,3 +59,4 @@ select Host,User from mysql.user where Host='fakehost'; # connection master; source include/show_binlog_events.inc; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_user_variables.test b/mysql-test/suite/rpl/t/rpl_user_variables.test index 915bcb9ae65..dd6ddf39580 100644 --- a/mysql-test/suite/rpl/t/rpl_user_variables.test +++ b/mysql-test/suite/rpl/t/rpl_user_variables.test @@ -381,4 +381,5 @@ DROP FUNCTION f2; DROP TABLE t1; sync_slave_with_master; -stop slave; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_variables.test b/mysql-test/suite/rpl/t/rpl_variables.test index 6c3b3ab6d8a..c3a6f6e273e 100644 --- a/mysql-test/suite/rpl/t/rpl_variables.test +++ b/mysql-test/suite/rpl/t/rpl_variables.test @@ -109,14 +109,11 @@ SET @user_text = 'Alunda'; # Stop slave so that we get a fresh sql thread, reading the slave's # global values of variables into its local copies. ---echo [on master] -connection master; -source include/reset_master_and_slave.inc; +--source include/stop_slave.inc +--source include/start_slave.inc # We would have wanted to set this together with the other variables # above, but can't because it affects how the slave works. ---echo [on slave] -connection slave; SET @@global.init_slave = 'SELECT 1'; @@ -674,35 +671,19 @@ EXECUTE p49; EXECUTE p50; EXECUTE p51; EXECUTE p52; EXECUTE p53; EXECUTE p54; EXECUTE p55; EXECUTE p56; EXECUTE p57; EXECUTE p58; EXECUTE p59; EXECUTE p60; EXECUTE p61; EXECUTE p62; EXECUTE p63; EXECUTE p64; +--sync_slave_with_master +--connection master + --echo ==== Results ==== # Show the result in table test.tstmt on master... SELECT * FROM tstmt ORDER BY id; -let $diff_table_1=master:test.tstmt; -# ... then compare test.tstmt on master to the other tables on master... -let $diff_table_2=master:test.tproc; -source include/diff_tables.inc; -let $diff_table_2=master:test.tfunc; -source include/diff_tables.inc; -let $diff_table_2=master:test.ttrig; -source include/diff_tables.inc; -let $diff_table_2=master:test.tprep; -source include/diff_tables.inc; +--sync_slave_with_master -# ... and to all tables on slave. -connection master; -sync_slave_with_master; -let $diff_table_2=slave:test.tstmt; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tproc; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tfunc; -source include/diff_tables.inc; -let $diff_table_2=slave:test.ttrig; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tprep; +# ... then compare test.tstmt on master to the other tables on master and slave. +let $diff_tables= master:tstmt, master:tproc, master:tfunc, master:ttrig, master:tprep, slave:tstmt, slave:tproc, slave:tfunc, slave:ttrig, slave:tprep; source include/diff_tables.inc; @@ -737,3 +718,4 @@ SET @@global.sync_binlog= @s_sync_binlog; connection master; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_variables_stm.test b/mysql-test/suite/rpl/t/rpl_variables_stm.test index 9e9bff03830..8943585bc1d 100644 --- a/mysql-test/suite/rpl/t/rpl_variables_stm.test +++ b/mysql-test/suite/rpl/t/rpl_variables_stm.test @@ -571,34 +571,19 @@ EXECUTE p49; EXECUTE p50; EXECUTE p51; EXECUTE p52; EXECUTE p53; EXECUTE p54; EXECUTE p55; EXECUTE p56; EXECUTE p57; EXECUTE p58; EXECUTE p59; EXECUTE p60; EXECUTE p61; EXECUTE p62; EXECUTE p63; EXECUTE p64; +--sync_slave_with_master +--connection master + --echo ==== Results ==== # Show the result in table test.tstmt on master... SELECT * FROM tstmt ORDER BY id; -let $diff_table_1=master:test.tstmt; -# ... then compare test.tstmt on master to the other tables on master... -let $diff_table_2=master:test.tproc; -source include/diff_tables.inc; -let $diff_table_2=master:test.tfunc; -source include/diff_tables.inc; -let $diff_table_2=master:test.ttrig; -source include/diff_tables.inc; -let $diff_table_2=master:test.tprep; -source include/diff_tables.inc; +--sync_slave_with_master -# ... and to all tables on slave. -sync_slave_with_master; -let $diff_table_2=slave:test.tstmt; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tproc; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tfunc; -source include/diff_tables.inc; -let $diff_table_2=slave:test.ttrig; -source include/diff_tables.inc; -let $diff_table_2=slave:test.tprep; +# ... then compare test.tstmt on master to the other tables on master and slave. +let $diff_tables= master:tstmt, master:tproc, master:tfunc, master:ttrig, master:tprep, slave:tstmt, slave:tproc, slave:tfunc, slave:ttrig, slave:tprep; source include/diff_tables.inc; @@ -633,3 +618,4 @@ SET @@global.collation_database= @s_collation_database; connection master; sync_slave_with_master; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_view.test b/mysql-test/suite/rpl/t/rpl_view.test index 01b4dc5ef55..3f0052cd544 100644 --- a/mysql-test/suite/rpl/t/rpl_view.test +++ b/mysql-test/suite/rpl/t/rpl_view.test @@ -177,3 +177,4 @@ DROP TABLE t1; sync_slave_with_master; --echo End of 5.0 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_view_multi.test b/mysql-test/suite/rpl/t/rpl_view_multi.test index 5b3e7cf76f8..22509f8e4fc 100644 --- a/mysql-test/suite/rpl/t/rpl_view_multi.test +++ b/mysql-test/suite/rpl/t/rpl_view_multi.test @@ -143,3 +143,4 @@ drop table t1, t2; drop view v1; --echo # Syncing slave with master and switching to connection 'slave' --sync_slave_with_master +--source include/rpl_end.inc |