summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/t
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-02-20 18:51:43 +0200
committerMichael Widenius <monty@askmonty.org>2011-02-20 18:51:43 +0200
commit58bb0769bdf13a9747e900aa2f0955137738ce9d (patch)
tree1b46ea0f72dce27532f0c87c60ba8a1baa453fa0 /mysql-test/suite/rpl/t
parent7e497abcfb3e761ba5a368316192ae930fb58f6b (diff)
parentde3c4428b8c759e85631d8d70b5845c872de5400 (diff)
downloadmariadb-git-58bb0769bdf13a9747e900aa2f0955137738ce9d.tar.gz
Merge with MySQL 5.1.55
- Fixed some issues with partitions and connection_string, which also fixed lp:716890 "Pre- and post-recovery crash in Aria" - Fixed wrong assert in Aria Now need to merge with latest xtradb before pushing sql/ha_partition.cc: Ensure that m_ordered_rec_buffer is not freed before close. sql/mysqld.cc: Changed to use opt_stack_trace instead of opt_pstack. Removed references to pstack sql/partition_element.h: Ensure that connect_string is initialized storage/maria/ma_key_recover.c: Fixed wrong assert
Diffstat (limited to 'mysql-test/suite/rpl/t')
-rw-r--r--mysql-test/suite/rpl/t/disabled.def2
-rwxr-xr-xmysql-test/suite/rpl/t/rpl000017-slave.sh12
-rw-r--r--mysql-test/suite/rpl/t/rpl000017.test22
-rw-r--r--mysql-test/suite/rpl/t/rpl_000010-slave.opt (renamed from mysql-test/suite/rpl/t/rpl000010-slave.opt)0
-rw-r--r--mysql-test/suite/rpl/t/rpl_000010.test (renamed from mysql-test/suite/rpl/t/rpl000010.test)1
-rw-r--r--mysql-test/suite/rpl/t/rpl_000011.test (renamed from mysql-test/suite/rpl/t/rpl000011.test)1
-rw-r--r--mysql-test/suite/rpl/t/rpl_000013.test (renamed from mysql-test/suite/rpl/t/rpl000013.test)10
-rw-r--r--mysql-test/suite/rpl/t/rpl_000017-slave.opt (renamed from mysql-test/suite/rpl/t/rpl000017-slave.opt)0
-rw-r--r--mysql-test/suite/rpl/t/rpl_000017.test48
-rw-r--r--mysql-test/suite/rpl/t/rpl_EE_err.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_LD_INFILE.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_alter.test15
-rw-r--r--mysql-test/suite/rpl/t/rpl_alter_db.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment_11932.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment_bug33029.test56
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test13
-rw-r--r--mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_corruption.test14
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_errors.test413
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_grant.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_max_cache_size.test56
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test32
-rw-r--r--mysql-test/suite/rpl/t/rpl_bit.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_bit_npk.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_blackhole.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug26395.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug31076.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug33931.test25
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug38694.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_change_master.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_charset.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_charset_sjis.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf11
-rw-r--r--mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test285
-rw-r--r--mysql-test/suite/rpl/t/rpl_colSize.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_commit_after_flush.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_concurrency_error.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_conditional_comments.test20
-rw-r--r--mysql-test/suite/rpl/t/rpl_create_database.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_create_if_not_exists.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_critical_errors.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_cross_version-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_cross_version.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_current_user-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_current_user.cnf7
-rw-r--r--mysql-test/suite/rpl/t/rpl_current_user.test131
-rw-r--r--mysql-test/suite/rpl/t/rpl_ddl.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_deadlock_innodb.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_delete_no_where.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_do_grant.test28
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_db.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_if_exists.test115
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_temp.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_view.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_dual_pos_advance.test41
-rw-r--r--mysql-test/suite/rpl/t/rpl_empty_master_crash.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_err_ignoredtable.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_events.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_extraCol_innodb.test13
-rw-r--r--mysql-test/suite/rpl/t/rpl_extraCol_myisam.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test (renamed from mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test)7
-rw-r--r--mysql-test/suite/rpl/t/rpl_extra_col_master_myisam.test (renamed from mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test)7
-rw-r--r--mysql-test/suite/rpl/t/rpl_extra_col_slave_innodb.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_extra_col_slave_myisam.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_failed_optimize.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt2
-rwxr-xr-xmysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh5
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt2
-rwxr-xr-xmysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh4
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop.test39
-rw-r--r--mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_found_rows.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_free_items.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_geometry.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_get_lock.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test21
-rw-r--r--mysql-test/suite/rpl/t/rpl_grant.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_idempotency.test80
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_grant.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_revoke.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table_update.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_incident.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_init_slave.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_init_slave_errors.test26
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb_bug28430.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb_bug30888.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb_mixed_ddl.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb_mixed_dml.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_id.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_id_pk.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_ignore.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_select.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_invoked_features.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_killed_ddl.test21
-rw-r--r--mysql-test/suite/rpl/t/rpl_known_bugs_detection.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_load_from_master.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_load_table_from_master.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_charset.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_fatal.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_m.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_map.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_s.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_simple.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_symlink.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddatalocal.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loadfile.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_locale.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_log_pos.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_manual_change_index_file.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_many_optimize.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_master_pos_wait.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_misc_functions.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_delete.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_delete2.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_engine.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_update.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_update2.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_update3.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_update4.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysql_upgrade.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_name_const.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_not_null_innodb.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_not_null_myisam.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_optimize.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet.test49
-rw-r--r--mysql-test/suite/rpl/t/rpl_plugin_load.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_ps.test43
-rw-r--r--mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_read_only.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_relay_space_innodb.test18
-rw-r--r--mysql-test/suite/rpl/t/rpl_relay_space_myisam.test18
-rw-r--r--mysql-test/suite/rpl/t/rpl_relayrotate.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_relayspace.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_replicate_do.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_report.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_rewrt_db.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt1
-rwxr-xr-xmysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh2
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs.test17
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_001.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_4_bytes.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_NOW.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_USER.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_UUID.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test33
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_8partition.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_blob_innodb.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_blob_myisam.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_colSize.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_conflicts.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_create_table.test34
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_delayed_ins.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_drop.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_find_row.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_func001.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_func002.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_func003.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_insert_delayed.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_log.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_log_innodb.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp001.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp003.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp005.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp008.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp009.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp010.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp011.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp012.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig001.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig002.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig003.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig004.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trunc_temp.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_until.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_view01.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_wide_table.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id.test29
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id1.test30
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id2.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_set_charset.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_set_null_innodb.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_set_null_myisam.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_sf.test187
-rw-r--r--mysql-test/suite/rpl/t/rpl_show_slave_running.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_skip_error.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_grp_exec.test19
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_load_in.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test25
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_skip.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_status.test17
-rw-r--r--mysql-test/suite/rpl/t/rpl_slow_query_log.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp004.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp_effects.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_sporadic_master.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl1.test27
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_stop_slave.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_000001.test130
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_binlog_direct.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_conflicts.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_create_if_not_exists.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_loadfile.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_log.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_maria.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_multi_query.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_no_op.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_sql_mode.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_until-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_until.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_stop_slave.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_temp_table.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test17
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporary.test22
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporary_errors.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_test_framework.cnf46
-rw-r--r--mysql-test/suite/rpl/t/rpl_test_framework.test143
-rw-r--r--mysql-test/suite/rpl/t/rpl_timezone.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_trigger.test31
-rw-r--r--mysql-test/suite/rpl/t/rpl_trunc_temp.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_truncate_2myisam.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_truncate_3innodb.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_typeconv_innodb.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_udf.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_user.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_user_variables.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_variables.test30
-rw-r--r--mysql-test/suite/rpl/t/rpl_variables_stm.test25
-rw-r--r--mysql-test/suite/rpl/t/rpl_view.test1
271 files changed, 1713 insertions, 1400 deletions
diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def
index ef77c54e067..93d21fd6653 100644
--- a/mysql-test/suite/rpl/t/disabled.def
+++ b/mysql-test/suite/rpl/t/disabled.def
@@ -11,3 +11,5 @@
##############################################################################
rpl_row_create_table : Bug#51574 Feb 27 2010 andrei failed different way than earlier with bug#45576
+#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_get_master_version_and_clock : Bug#59178 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.sh b/mysql-test/suite/rpl/t/rpl000017-slave.sh
deleted file mode 100755
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 2ba321cd8c3..00000000000
--- a/mysql-test/suite/rpl/t/rpl000017.test
+++ /dev/null
@@ -1,22 +0,0 @@
-source include/master-slave.inc;
-connection slave;
-stop slave;
-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;
-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 261b9148774..7e7ca103d2c 100644
--- a/mysql-test/suite/rpl/t/rpl000010.test
+++ b/mysql-test/suite/rpl/t/rpl_000010.test
@@ -17,3 +17,4 @@ connection slave;
sync_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 32f6227f7c5..357a291ddb2 100644
--- a/mysql-test/suite/rpl/t/rpl000011.test
+++ b/mysql-test/suite/rpl/t/rpl_000011.test
@@ -15,3 +15,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 69a102e84ce..f64c484b003 100644
--- a/mysql-test/suite/rpl/t/rpl000013.test
+++ b/mysql-test/suite/rpl/t/rpl_000013.test
@@ -9,9 +9,7 @@
--source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
connection master;
create table t2(n int);
@@ -46,8 +44,8 @@ connection master2;
# exist in this connection.
drop table if exists t1,t2;
-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/rpl000017-slave.opt b/mysql-test/suite/rpl/t/rpl_000017-slave.opt
index 58a964c90d0..58a964c90d0 100644
--- a/mysql-test/suite/rpl/t/rpl000017-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_000017-slave.opt
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 bc42476244a..e34f670ea18 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);
@@ -58,14 +55,16 @@ if (`SELECT 'table_id: 0 (test.t2)' = '$_info'`)
--die test.t2's table map id is 0;
}
-let diff_table= test.t1;
-source include/rpl_diff_tables.inc;
-let diff_table= test.t2;
-source include/rpl_diff_tables.inc;
+--sync_slave_with_master
+
+--let $diff_tables= master:t1, slave:t1
+--source include/diff_tables.inc
+--let $diff_tables= master:t2, slave:t2
+--source include/diff_tables.inc
--echo
connection master;
DROP TABLE t1, t2;
-source include/master-slave-end.inc;
# 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 d4b7872fb2b..6b7c97298f4 100644
--- a/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test
+++ b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test
@@ -58,6 +58,6 @@ sync_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..0163550a3c5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_auto_increment_bug33029.test
@@ -0,0 +1,56 @@
+# 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
+--let $rpl_skip_change_master= 1
+source include/master-slave.inc;
+
+--echo ==== Initialize ====
+--connection slave
+
+# 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 28164686c39..8cddc43b84e 100644
--- a/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test
+++ b/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test
@@ -169,4 +169,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_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..d613a72e48c 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_corruption.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test
@@ -15,13 +15,12 @@
# 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/have_log_bin.inc;
+-- source include/have_log_bin.inc
# BUG#40482 only manifested itself in debug-compiled binaries.
-source include/have_debug.inc;
+-- source include/have_debug.inc
+-- source include/master-slave.inc
+--connection slave
call mtr.add_suppression('Found invalid event in binary log');
@@ -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..a20853e35a9 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_grant.test
@@ -41,3 +41,4 @@ 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_max_cache_size.test b/mysql-test/suite/rpl/t/rpl_binlog_max_cache_size.test
index 9dca61d8f75..265bde2ccf6 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_max_cache_size.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_max_cache_size.test
@@ -69,16 +69,17 @@ if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
CONCAT($data, $data, $data, $data, $data, $data));
# Below code fakes the result of 'ROW' mode.
--echo Got one of the listed errors
- --echo --source include/wait_for_slave_sql_error_and_skip.inc
- --echo include/start_slave.inc
+ # Ensure same message as in the case binlog_format=row below
+ --echo include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
}
if (`SELECT @@binlog_format = 'ROW'`)
{
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
eval INSERT INTO t2 (a, data) VALUES (2,
CONCAT($data, $data, $data, $data, $data, $data));
- # Incident event
- --let $slave_sql_errno=1590
+
+ # 1590=ER_SLAVE_INCIDENT
+ --let $slave_sql_errno= 1590
--source include/wait_for_slave_sql_error_and_skip.inc
}
--enable_warnings
@@ -101,8 +102,8 @@ eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data),
t1.data = CONCAT($data, $data, $data, $data);
--enable_query_log
-# Incident event
---let $slave_sql_errno=1590
+# 1590=ER_SLAVE_INCIDENT
+--let $slave_sql_errno= 1590
--source include/wait_for_slave_sql_error_and_skip.inc
#--echo ########################################################################################
@@ -192,8 +193,9 @@ BEGIN;
CREATE TABLE t5 (a int);
--enable_query_log
-let $diff_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--sync_slave_with_master
+--let $diff_tables= master:t1,slave:t1
+--source include/diff_tables.inc
--echo ########################################################################################
--echo # 3 - BEGIN - COMMIT
@@ -221,8 +223,9 @@ BEGIN;
--enable_query_log
COMMIT;
-let $diff_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--sync_slave_with_master
+--let $diff_tables= master:t1,slave:t1
+--source include/diff_tables.inc
--echo ########################################################################################
--echo # 4 - BEGIN - ROLLBACK
@@ -250,8 +253,9 @@ BEGIN;
--enable_query_log
ROLLBACK;
-let $diff_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--sync_slave_with_master
+--let $diff_tables= master:t1,slave:t1
+--source include/diff_tables.inc
--echo ########################################################################################
--echo # 5 - PROCEDURE
@@ -299,8 +303,9 @@ eval CALL p1($data);
--enable_query_log
ROLLBACK;
-let $diff_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--sync_slave_with_master
+--let $diff_tables= master:t1,slave:t1
+--source include/diff_tables.inc
--echo ########################################################################################
--echo # 6 - XID
@@ -330,8 +335,9 @@ SAVEPOINT sv;
ROLLBACK TO sv;
COMMIT;
-let $diff_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--sync_slave_with_master
+--let $diff_tables= master:t1,slave:t1
+--source include/diff_tables.inc
--echo ########################################################################################
--echo # 7 - NON-TRANS TABLE
@@ -374,8 +380,8 @@ BEGIN;
--enable_query_log
COMMIT;
-# Incident event
---let $slave_sql_errno=1590
+# 1590=ER_SLAVE_INCIDENT
+--let $slave_sql_errno= 1590
--source include/wait_for_slave_sql_error_and_skip.inc
sync_slave_with_master;
@@ -420,7 +426,7 @@ while ($n)
--enable_query_log
COMMIT;
-connection slave;
+--connection slave
--let $slave_sql_errno= 1197
source include/wait_for_slave_sql_error.inc;
@@ -443,14 +449,16 @@ SELECT count(*) FROM t1;
--echo # CLEAN
--echo ########################################################################################
---disable_warnings
connection master;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+# t4 exists only if binlog_format!=row, so so a warning is generated
+# if binog_format=row
+--disable_warnings
DROP TABLE IF EXISTS t4;
-DROP TABLE IF EXISTS t5;
-DROP TABLE IF EXISTS t6;
-DROP PROCEDURE p1;
--enable_warnings
-source include/master-slave-end.inc;
+DROP TABLE t5;
+DROP PROCEDURE p1;
+
+--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 07b0778296c..2ee4074c4e3 100644
--- a/mysql-test/suite/rpl/t/rpl_bit.test
+++ b/mysql-test/suite/rpl/t/rpl_bit.test
@@ -92,3 +92,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 12b587919f9..40f375b92f3 100644
--- a/mysql-test/suite/rpl/t/rpl_bit_npk.test
+++ b/mysql-test/suite/rpl/t/rpl_bit_npk.test
@@ -114,3 +114,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 f0c698cb9e2..098cf48c38c 100644
--- a/mysql-test/suite/rpl/t/rpl_blackhole.test
+++ b/mysql-test/suite/rpl/t/rpl_blackhole.test
@@ -80,4 +80,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 9176bafe022..d81d646ebe3 100644
--- a/mysql-test/suite/rpl/t/rpl_bug31076.test
+++ b/mysql-test/suite/rpl/t/rpl_bug31076.test
@@ -134,3 +134,4 @@ SELECT * FROM visits_events;
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.test b/mysql-test/suite/rpl/t/rpl_bug33931.test
index 3327a36622c..c2cf5811938 100644
--- a/mysql-test/suite/rpl/t/rpl_bug33931.test
+++ b/mysql-test/suite/rpl/t/rpl_bug33931.test
@@ -3,23 +3,14 @@
# 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;
# Add suppression for expected warnings in slaves error log
call mtr.add_suppression("Failed during slave I/O thread initialization");
---disable_warnings
-stop slave;
---enable_warnings
+--source include/stop_slave.inc
reset slave;
# Set debug flags on slave to force errors to occur
@@ -27,18 +18,13 @@ SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_
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
@@ -47,3 +33,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_bug38694.test b/mysql-test/suite/rpl/t/rpl_bug38694.test
index 32128a44121..57d7dde0338 100644
--- a/mysql-test/suite/rpl/t/rpl_bug38694.test
+++ b/mysql-test/suite/rpl/t/rpl_bug38694.test
@@ -10,3 +10,4 @@ source include/master-slave.inc;
call mtr.add_suppression("Aborted connection");
# End of tests
+--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 33bd9d51b11..65af5e72865 100644
--- a/mysql-test/suite/rpl/t/rpl_change_master.test
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test
@@ -49,3 +49,4 @@ connection slave;
sync_with_master;
# End of 4.1 tests
+--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 3633462d68e..6099637e3e9 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,24 +1,32 @@
-#############################################################
-# 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
# 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
--echo
#
@@ -28,121 +36,134 @@ 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
+--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 ***
@@ -150,158 +171,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
+--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
+--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
START SLAVE;
---connection master_c
---sync_slave_with_master master_d
---source include/circular_rpl_for_4_hosts_sync.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 c20f2c3fd35..0a64817bf36 100644
--- a/mysql-test/suite/rpl/t/rpl_colSize.test
+++ b/mysql-test/suite/rpl/t/rpl_colSize.test
@@ -218,3 +218,4 @@ DROP TABLE t1;
sync_slave_with_master;
# 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 da2951afb1a..a5c77e830d6 100644
--- a/mysql-test/suite/rpl/t/rpl_concurrency_error.test
+++ b/mysql-test/suite/rpl/t/rpl_concurrency_error.test
@@ -125,13 +125,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
@@ -147,3 +145,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 cf26e58c3ec..12183531677 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
@@ -147,4 +147,4 @@ sync_slave_with_master;
connection master;
DROP TABLE t1;
-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 0ea05290c11..2b2d357b124 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 --secure-file-priv=$MYSQL_TMP_DIR
+--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..d3e834b5358 100644
--- a/mysql-test/suite/rpl/t/rpl_cross_version.test
+++ b/mysql-test/suite/rpl/t/rpl_cross_version.test
@@ -10,7 +10,7 @@
# The master's binlog is treated as a relay log that the SQL thread executes.
#
---source include/have_log_bin.inc
+--source include/master-slave.inc
# The test is disabled for windows due to
# Bug #42879 CHANGE MASTER RELAY_LOG_FILE=path fails on windows
@@ -22,6 +22,10 @@
#
--echo ==== Initialize ====
+--connection slave
+--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 +40,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 72581ed7049..bdb53cbcdfe 100644
--- a/mysql-test/suite/rpl/t/rpl_current_user.test
+++ b/mysql-test/suite/rpl/t/rpl_current_user.test
@@ -10,34 +10,22 @@
# 'ALTER EVENT'.
#
##############################################################################
-source include/master-slave.inc;
+
source include/have_binlog_format_statement.inc;
---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
+
+--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%';
@@ -63,75 +51,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;
@@ -142,7 +131,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
@@ -151,16 +142,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()
@@ -172,8 +164,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;
@@ -183,8 +175,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;
@@ -194,8 +186,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;
@@ -218,8 +210,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;
@@ -233,6 +225,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 169ccbf7f18..14776263516 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
-- source include/long_test.inc
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 64f00a98a78..6965dfc9047 100644
--- a/mysql-test/suite/rpl/t/rpl_do_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test
@@ -221,17 +221,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 ...'
@@ -256,7 +258,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);
@@ -277,7 +279,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);
@@ -337,8 +339,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";
@@ -352,11 +353,7 @@ 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";
@@ -364,8 +361,7 @@ DROP USER foo@"1.2.3.4";
--echo
--echo # Bug#27606 GRANT statement should be replicated with DEFINER information
---connection master
---source include/master-slave-reset.inc
+--source include/rpl_reset.inc
--connection master
GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost;
@@ -382,5 +378,5 @@ SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
--connection master
DROP USER user_bug27606@localhost;
---source include/master-slave-end.inc
--echo "End of test"
+--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 336edad6fc5..748a5759513 100644
--- a/mysql-test/suite/rpl/t/rpl_drop.test
+++ b/mysql-test/suite/rpl/t/rpl_drop.test
@@ -2,15 +2,12 @@
# exist, must be binlogged with a non-zero error code)
source include/master-slave.inc;
source include/have_innodb.inc;
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
+
create table t1 (a int);
--error 1051
drop table t1, t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
+
# End of 4.1 tests
# BUG#55625 RBR breaks on failing 'CREATE TABLE'
@@ -65,3 +62,5 @@ SET @@global.binlog_format= @old_binlog_format;
SET @@global.binlog_format= @old_binlog_format;
# End of 5.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 f2a4dd70da6..0b6d1458893 100644
--- a/mysql-test/suite/rpl/t/rpl_drop_temp.test
+++ b/mysql-test/suite/rpl/t/rpl_drop_temp.test
@@ -67,3 +67,4 @@ connection 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_view.test b/mysql-test/suite/rpl/t/rpl_drop_view.test
index 11633a0a7e8..99c5edb928d 100644
--- a/mysql-test/suite/rpl/t/rpl_drop_view.test
+++ b/mysql-test/suite/rpl/t/rpl_drop_view.test
@@ -34,3 +34,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_crash.test b/mysql-test/suite/rpl/t/rpl_empty_master_crash.test
index 863b450a6d9..a657b82fc94 100644
--- a/mysql-test/suite/rpl/t/rpl_empty_master_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_empty_master_crash.test
@@ -10,3 +10,4 @@ connection slave;
load table t1 from master;
# End of 4.1 tests
+--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 f358c0ee356..01ef5298e48 100644
--- a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
+++ b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
@@ -62,3 +62,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 327ad9bf22c..ed5ebd3dbc4 100644
--- a/mysql-test/suite/rpl/t/rpl_events.test
+++ b/mysql-test/suite/rpl/t/rpl_events.test
@@ -111,3 +111,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 5255a9cfbad..11211e51286 100644
--- a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test
+++ b/mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test
@@ -7,10 +7,11 @@
let $engine_type = 'InnoDB';
set binlog_format=row;
--- source extra/rpl_tests/rpl_extraMaster_Col.test
+-- source extra/rpl_tests/rpl_extra_col_master.test
set binlog_format=statement;
--- source extra/rpl_tests/rpl_extraMaster_Col.test
+-- source extra/rpl_tests/rpl_extra_col_master.test
set binlog_format=mixed;
--- 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 e6b41eabd0d..2343d430784 100644
--- a/mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test
+++ b/mysql-test/suite/rpl/t/rpl_extra_col_master_myisam.test
@@ -6,10 +6,11 @@
let $engine_type = 'MyISAM';
set binlog_format=row;
--- source extra/rpl_tests/rpl_extraMaster_Col.test
+-- source extra/rpl_tests/rpl_extra_col_master.test
set binlog_format=statement;
--- source extra/rpl_tests/rpl_extraMaster_Col.test
+-- source extra/rpl_tests/rpl_extra_col_master.test
set binlog_format=mixed;
--- 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..8b2cb2ded1c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_extra_col_slave_innodb.test
@@ -0,0 +1,6 @@
+-- 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..52d312de878
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_extra_col_slave_myisam.test
@@ -0,0 +1,5 @@
+-- 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.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..8e1c9eb98b2 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
@@ -204,4 +204,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_flushlog_loop-master.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt
index 95bca94fd3a..eb35347af33 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 @@
--O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/mysqld.1/data/relay-log
+-O 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 100755
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 e2aa63225a3..eb35347af33 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 @@
--O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/mysqld.2/data/relay-log
+-O 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 100755
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 487f910ba2b..d5d362bac0f 100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
@@ -1,33 +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
+--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;
---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;
-
-#
-# Start replication slave -> master
-#
-connection master;
---disable_warnings
-stop slave;
---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
#
@@ -39,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
@@ -59,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_found_rows.test b/mysql-test/suite/rpl/t/rpl_found_rows.test
index ff8d2c3107a..3e5d741d788 100644
--- a/mysql-test/suite/rpl/t/rpl_found_rows.test
+++ b/mysql-test/suite/rpl/t/rpl_found_rows.test
@@ -114,9 +114,8 @@ DELETE FROM 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_reset.inc
--echo #### 2. Using mixed mode ####
@@ -254,3 +253,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_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 87366f41ba2..f87932113ac 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 28f13c17042..ec1d6d57555 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;
@@ -47,20 +41,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
@@ -68,3 +48,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_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test
index ac0749bbec8..ffdc21a5756 100644
--- a/mysql-test/suite/rpl/t/rpl_idempotency.test
+++ b/mysql-test/suite/rpl/t/rpl_idempotency.test
@@ -38,10 +38,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
@@ -54,10 +51,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
@@ -81,10 +75,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
connection master;
DROP TABLE t1, t2;
@@ -212,12 +203,9 @@ select * from ti1 order by b /* must be (2),(3) */;
--echo *** slave must stop (Trying to delete a referenced foreing key)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
-
-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;
+# 1451 = ER_ROW_ID_REFERENCED_2
+--let $slave_sql_errno= 1451
+--source include/wait_for_slave_sql_error.inc
select * from ti1 order by b /* must be (1),(2),(3) - not deleted */;
set foreign_key_checks= 0;
@@ -246,12 +234,9 @@ insert into ti2 set a=3, b=3 /* offending write event */;
--echo *** slave must stop (Trying to insert an invalid foreign key)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
-
-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;
+# 1452 = ER_NO_REFERENCED_ROW_2
+--let $slave_sql_errno= 1452
+--source include/wait_for_slave_sql_error.inc
select * from ti2 order by b /* must be (2,2) */;
set foreign_key_checks= 0;
@@ -285,12 +270,9 @@ insert into ti1 set b=1 /* offending write event */;
--echo *** slave must stop (Trying to insert a dupliacte key)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
-
-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;
+# 1062 = ER_DUP_ENTRY
+--let $slave_sql_errno= 1062
+--source include/wait_for_slave_sql_error.inc
set foreign_key_checks= 0;
delete from ti1 where b=1;
@@ -320,12 +302,9 @@ DELETE FROM t1 WHERE a = -2;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
-
-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;
+# 1032 = ER_KEY_NOT_FOUND
+--let $slave_sql_errno= 1032
+--source include/wait_for_slave_sql_error.inc
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
@@ -338,12 +317,9 @@ connection master;
DELETE FROM t2 WHERE a = -2;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
-
-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;
+# 1032 = ER_KEY_NOT_FOUND
+--let $slave_sql_errno= 1032
+source include/wait_for_slave_sql_error.inc;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
@@ -360,12 +336,9 @@ UPDATE t1 SET a = 1 WHERE a = -1;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
-
-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;
+# 1032 = ER_KEY_NOT_FOUND
+--let $slave_sql_errno= 1032
+source include/wait_for_slave_sql_error.inc;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
@@ -380,12 +353,9 @@ UPDATE t2 SET a = 1 WHERE a = -1;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
-
-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;
+# 1032 = ER_KEY_NOT_FOUND
+--let $slave_sql_errno= 1032
+source include/wait_for_slave_sql_error.inc;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
@@ -400,6 +370,6 @@ connection master;
set @@session.binlog_format= @save_binlog_format;
drop table t1,t2,ti2,ti1;
---source include/master-slave-end.inc
+--source include/rpl_end.inc
--echo *** end of tests
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 d3a087e0e79..64a3338b16e 100644
--- a/mysql-test/suite/rpl/t/rpl_ignore_table.test
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test
@@ -180,3 +180,7 @@ SELECT * FROM tmptbl504451f4258$1;
connection master;
DROP TABLE t5;
sync_slave_with_master;
+
+--source include/force_restart.inc
+
+--source include/rpl_end.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..b65441c7d50 100644
--- a/mysql-test/suite/rpl/t/rpl_incident.test
+++ b/mysql-test/suite/rpl/t/rpl_incident.test
@@ -37,3 +37,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..cf72de18e13 100644
--- a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test
@@ -53,10 +53,11 @@ 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");
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.test b/mysql-test/suite/rpl/t/rpl_innodb.test
index 64a85d27c88..b9b6080cfe5 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb.test
+++ b/mysql-test/suite/rpl/t/rpl_innodb.test
@@ -120,6 +120,6 @@ connection master;
FLUSH LOGS;
DROP DATABASE mysqltest1;
--- source include/master-slave-end.inc
+--source include/rpl_end.inc
--echo End of 5.1 tests
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 6fb9ec8fd72..45576e53070 100644
--- a/mysql-test/suite/rpl/t/rpl_insert.test
+++ b/mysql-test/suite/rpl/t/rpl_insert.test
@@ -38,3 +38,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_id.test b/mysql-test/suite/rpl/t/rpl_insert_id.test
index 45cc32c9d39..f2f62a207a0 100644
--- a/mysql-test/suite/rpl/t/rpl_insert_id.test
+++ b/mysql-test/suite/rpl/t/rpl_insert_id.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=myisam;
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 2709430f85d..1d6c8e7168e 100644
--- a/mysql-test/suite/rpl/t/rpl_insert_ignore.test
+++ b/mysql-test/suite/rpl/t/rpl_insert_ignore.test
@@ -7,3 +7,4 @@
let $engine_type=innodb;
let $engine_type2=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 e73964a6e14..7082117b9eb 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_killed_ddl.test b/mysql-test/suite/rpl/t/rpl_killed_ddl.test
index 21ac1af3f06..97ef2fcaf96 100644
--- a/mysql-test/suite/rpl/t/rpl_killed_ddl.test
+++ b/mysql-test/suite/rpl/t/rpl_killed_ddl.test
@@ -142,7 +142,7 @@ disable_warnings;
######## DATABASE ########
-let $diff_statement= SHOW DATABASES LIKE 'd%';
+--let $rpl_diff_statement= SHOW DATABASES LIKE \'d%\'
send CREATE DATABASE d2;
source include/kill_query_and_diff_master_slave.inc;
@@ -161,7 +161,7 @@ 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%';
+--let $rpl_diff_statement= SELECT event_name, event_body, execute_at FROM information_schema.events where event_name like \'e%\'
send CREATE EVENT e2
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
@@ -182,7 +182,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;
@@ -211,7 +211,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)
@@ -234,7 +234,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;
@@ -247,7 +247,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;
@@ -260,7 +260,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
@@ -284,7 +284,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
@@ -303,7 +303,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;
@@ -316,7 +316,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;
@@ -357,3 +357,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 5b31b094b62..a8c7c2c1f5b 100644
--- a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
+++ b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
@@ -25,7 +25,7 @@ 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
@@ -81,17 +81,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.test b/mysql-test/suite/rpl/t/rpl_load_from_master.test
index 0f085457817..6d09f71e809 100644
--- a/mysql-test/suite/rpl/t/rpl_load_from_master.test
+++ b/mysql-test/suite/rpl/t/rpl_load_from_master.test
@@ -179,3 +179,4 @@ drop database mysqltest2;
drop database mysqltest3;
# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
index aad113878d3..5474124c337 100644
--- a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
+++ b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
@@ -96,3 +96,4 @@ drop table t1;
# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata.test b/mysql-test/suite/rpl/t/rpl_loaddata.test
index 6f9ee4ef80a..4682e1e59eb 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
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_loaddata.test
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
index 031a0f6c351..768b61d5741 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
@@ -48,3 +48,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..ecbaddb6995 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
@@ -23,3 +23,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 42c3ad99f33..bbe11bbb887 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_m.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_m.test
@@ -50,3 +50,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.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 2dd2218eb5c..80785bb562f 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_s.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_s.test
@@ -26,3 +26,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 a93a82d6d9f..572c660faf7 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
@@ -168,3 +168,4 @@ SET SESSION sql_mode=@old_mode;
sync_slave_with_master;
connection master;
+--source include/rpl_end.inc
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..0e746d55935 100644
--- a/mysql-test/suite/rpl/t/rpl_log_pos.test
+++ b/mysql-test/suite/rpl/t/rpl_log_pos.test
@@ -33,7 +33,7 @@ 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;
+source include/stop_slave_sql.inc;
--enable_warnings
connection master;
@@ -54,3 +54,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 2f7b18ae04b..a6a49950300 100644
--- a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
+++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
@@ -27,3 +27,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 b84042160cd..9b7bfd35579 100644
--- a/mysql-test/suite/rpl/t/rpl_misc_functions.test
+++ b/mysql-test/suite/rpl/t/rpl_misc_functions.test
@@ -122,3 +122,4 @@ DROP FUNCTION test_replication_sf;
--sync_slave_with_master
+--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 55f6ad61446..d2aa8363060 100644
--- a/mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test
+++ b/mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test
@@ -76,3 +76,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 3df43607bfe..238ea9aa29c 100644
--- a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test
+++ b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test
@@ -45,3 +45,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_multi_delete.test b/mysql-test/suite/rpl/t/rpl_multi_delete.test
index a251cbf8833..9df8ca4d29a 100644
--- a/mysql-test/suite/rpl/t/rpl_multi_delete.test
+++ b/mysql-test/suite/rpl/t/rpl_multi_delete.test
@@ -24,3 +24,4 @@ connection slave;
sync_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 81379d4056b..7317dfa8732 100644
--- a/mysql-test/suite/rpl/t/rpl_multi_delete2.test
+++ b/mysql-test/suite/rpl/t/rpl_multi_delete2.test
@@ -66,3 +66,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 bf5c6d2b921..beefd8bc0cf 100644
--- a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
+++ b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
@@ -54,3 +54,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_nondeterministic_functions.test b/mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test
index 9ff2e2d081e..2c5db21b0e3 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 7bd53a3fead..840c37d96d4 100644
--- a/mysql-test/suite/rpl/t/rpl_optimize.test
+++ b/mysql-test/suite/rpl/t/rpl_optimize.test
@@ -61,3 +61,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 08a533e22ca..b11bd0a227e 100644
--- a/mysql-test/suite/rpl/t/rpl_packet.test
+++ b/mysql-test/suite/rpl/t/rpl_packet.test
@@ -43,20 +43,16 @@ select @@net_buffer_length, @@max_allowed_packet;
create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023');
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
eval select count(*) from `$db`.`t1` /* must be 1 */;
SHOW STATUS LIKE 'Slave_running';
select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING';
connection master;
eval drop database $db;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#
# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits
@@ -89,17 +85,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
@@ -107,7 +107,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;
@@ -117,12 +124,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;
@@ -165,4 +170,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 b00dec6b80c..e93c68d0e10 100644
--- a/mysql-test/suite/rpl/t/rpl_ps.test
+++ b/mysql-test/suite/rpl/t/rpl_ps.test
@@ -72,75 +72,36 @@ stop slave;
###############################################################################
---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
---save_master_pos
-
---echo
--echo # Connection: slave
---echo
---connection slave
---sync_with_master
+--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
---save_master_pos
-
---echo
---echo # Connection: slave
---echo
---connection slave
---sync_with_master
-
---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 ec50311fc7c..86dd2eb78eb 100644
--- a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
+++ b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
@@ -38,3 +38,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 62864b62a28..c791bc3e1ea 100644
--- a/mysql-test/suite/rpl/t/rpl_read_only.test
+++ b/mysql-test/suite/rpl/t/rpl_read_only.test
@@ -111,3 +111,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..9df62e3a095 100644
--- a/mysql-test/suite/rpl/t/rpl_relayspace.test
+++ b/mysql-test/suite/rpl/t/rpl_relayspace.test
@@ -40,3 +40,4 @@ eval select master_pos_wait('$master_log_file',200,30)=-1;
# 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 382e198aaf9..c6cbf819deb 100644
--- a/mysql-test/suite/rpl/t/rpl_replicate_do.test
+++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test
@@ -88,3 +88,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 100755
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 e8bcc904e4c..68a3a20b501 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)
@@ -97,11 +92,9 @@ 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;
+# 1062 = ER_DUP_ENTRY
+--let $slave_sql_errno= 1062
+--source include/wait_for_slave_sql_error_and_skip.inc
connection master;
@@ -194,3 +187,5 @@ show binlog events in '';
purge master logs before now();
--echo End of 5.0 tests
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_HOST = '';
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 e063a52b44e..b7fc0d3bd2a 100644
--- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
@@ -37,13 +37,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);
@@ -59,9 +61,7 @@ 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;
@@ -93,12 +93,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;
@@ -124,9 +125,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
@@ -231,13 +230,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 ****
@@ -245,7 +241,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 ****
@@ -259,9 +255,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 3786a697e3f..d5dfcd7b75c 100644
--- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
@@ -6,3 +6,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_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..04434517518 100644
--- a/mysql-test/suite/rpl/t/rpl_row_colSize.test
+++ b/mysql-test/suite/rpl/t/rpl_row_colSize.test
@@ -166,3 +166,4 @@ 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 e9c62c1f77c..0f525e0f58d 100644
--- a/mysql-test/suite/rpl/t/rpl_row_conflicts.test
+++ b/mysql-test/suite/rpl/t/rpl_row_conflicts.test
@@ -21,6 +21,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 ########
@@ -29,4 +31,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 148032f2987..bfe480f724e 100644
--- a/mysql-test/suite/rpl/t/rpl_row_create_table.test
+++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test
@@ -29,7 +29,7 @@ SET GLOBAL storage_engine=memory;
START SLAVE;
--enable_query_log
---source include/reset_master_and_slave.inc
+--source include/rpl_reset.inc
connection master;
CREATE TABLE t1 (a INT, b INT);
@@ -65,7 +65,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
@@ -84,7 +84,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);
@@ -97,7 +97,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;
@@ -127,7 +127,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;
@@ -164,15 +164,7 @@ SET AUTOCOMMIT=1;
sync_slave_with_master;
# Some tests with temporary tables
-connection slave;
-STOP SLAVE;
-RESET SLAVE;
-
-connection master;
-RESET MASTER;
-
-connection slave;
-START SLAVE;
+--source include/rpl_reset.inc
connection master;
CREATE TABLE t1 (a INT);
@@ -198,7 +190,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;
@@ -247,7 +239,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
@@ -269,7 +261,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);
@@ -299,6 +291,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;
+
sync_slave_with_master;
#
@@ -308,9 +301,10 @@ sync_slave_with_master;
connection master;
CREATE TABLE t1 SELECT 1;
CREATE TABLE IF NOT EXISTS t1 SELECT 1;
-let $diff_table=test.t1;
-source include/rpl_diff_tables.inc;
+--let $diff_tables= master:test.t1,slave:test.t1
+--source include/diff_tables.inc
DROP TABLE t1;
-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_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 064a7c89dbe..f506d0c54f5 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= 925;
--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_inexist_tbl.test b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test
index 0c038c41ebf..b695428dd38 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,16 @@ 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
+--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 9aeb57c4fa2..71ae0cb5e17 100644
--- a/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test
+++ b/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test
@@ -12,3 +12,4 @@ set @@global.binlog_format = row;
connection master;
set @@global.binlog_format = @old_global_binlog_format;
+--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_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
index 7515249fe0c..eb4eb2e0ce8 100644
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
@@ -359,3 +359,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..e40cd615ca6 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
@@ -12,7 +12,7 @@
-- 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 +22,10 @@ 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 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 1595c4a21d5..07345781225 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp001.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp001.test
@@ -148,3 +148,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 8ed47232ba9..b5d62f60199 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp003.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp003.test
@@ -15,3 +15,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 f5a74325b7c..2a06a6ae1dc 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp005.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp005.test
@@ -112,3 +112,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 b1295820c99..8c3e2966647 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp008.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp008.test
@@ -55,3 +55,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 92d47c6f50f..2f05a55e6f8 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp009.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp009.test
@@ -103,3 +103,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 28b82217517..71ab3c1a772 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp010.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp010.test
@@ -78,3 +78,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_stop_middle_update.test b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
index 9b24c78e62d..b9b7a2cfc0e 100644
--- a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
+++ b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
@@ -28,5 +28,6 @@ select count(*) from t1;
connection master;
drop table t1;
connection slave; # slave SQL thread is stopped
-source include/stop_slave.inc;
drop table t1;
+--let $rpl_only_running_threads= 1
+--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 7ca8a68f060..2835d07ce2a 100644
--- a/mysql-test/suite/rpl/t/rpl_row_trig002.test
+++ b/mysql-test/suite/rpl/t/rpl_row_trig002.test
@@ -78,3 +78,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 dada855a89e..67c05174fae 100644
--- a/mysql-test/suite/rpl/t/rpl_row_trig003.test
+++ b/mysql-test/suite/rpl/t/rpl_row_trig003.test
@@ -154,3 +154,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 9e3cbbd325a..afd964ca81a 100644
--- a/mysql-test/suite/rpl/t/rpl_row_until.test
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test
@@ -4,9 +4,6 @@
# 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);
@@ -121,3 +118,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_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_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 488a3aa6ab6..32d5e1ec8f2 100644
--- a/mysql-test/suite/rpl/t/rpl_server_id2.test
+++ b/mysql-test/suite/rpl/t/rpl_server_id2.test
@@ -61,3 +61,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_session_var.test b/mysql-test/suite/rpl/t/rpl_session_var.test
index 50efc8930a1..4ea07d4f9d6 100644
--- a/mysql-test/suite/rpl/t/rpl_session_var.test
+++ b/mysql-test/suite/rpl/t/rpl_session_var.test
@@ -63,3 +63,4 @@ drop table t1;
save_master_pos;
connection slave;
sync_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 c70eb2681f5..53ec08f752f 100644
--- a/mysql-test/suite/rpl/t/rpl_set_charset.test
+++ b/mysql-test/suite/rpl/t/rpl_set_charset.test
@@ -33,3 +33,4 @@ connection slave;
sync_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_running.test b/mysql-test/suite/rpl/t/rpl_show_slave_running.test
index 8a3e56975ad..e589e126186 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..2853c95b212 100644
--- a/mysql-test/suite/rpl/t/rpl_skip_error.test
+++ b/mysql-test/suite/rpl/t/rpl_skip_error.test
@@ -167,3 +167,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..70ebba0047b 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,9 @@ 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
+--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 +79,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 +109,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 +123,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 +155,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 +169,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 +180,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.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
index b7342fd1c40..d80a2ed9e25 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
@@ -42,8 +42,12 @@ 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: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3");
+--let $rpl_only_running_threads= 1
+--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..0481581998c 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,17 @@
--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???
+--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 4c5930d74fe..2dddabf4b4c 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_skip.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test
@@ -299,3 +299,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 4edf1802a5d..83a18474976 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_status.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_status.test
@@ -55,15 +55,20 @@ source include/stop_slave.inc;
START SLAVE;
source include/wait_for_slave_sql_to_start.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
+--let $rpl_only_running_threads= 1
+--source include/rpl_reset.inc
--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_slow_query_log.test b/mysql-test/suite/rpl/t/rpl_slow_query_log.test
index ced4859ebe7..76664705f99 100644
--- a/mysql-test/suite/rpl/t/rpl_slow_query_log.test
+++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test
@@ -195,7 +195,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;
@@ -306,3 +306,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 243136a0d38..10e23eb5928 100644
--- a/mysql-test/suite/rpl/t/rpl_sp.test
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -643,3 +643,4 @@ drop function mysqltestbug36570_f1;
# 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 967e7007c15..b916c78a6fb 100644
--- a/mysql-test/suite/rpl/t/rpl_sp004.test
+++ b/mysql-test/suite/rpl/t/rpl_sp004.test
@@ -95,3 +95,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_sporadic_master.test b/mysql-test/suite/rpl/t/rpl_sporadic_master.test
index 824f7abc9f5..2a60a5c5e29 100644
--- a/mysql-test/suite/rpl/t/rpl_sporadic_master.test
+++ b/mysql-test/suite/rpl/t/rpl_sporadic_master.test
@@ -27,3 +27,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_ssl.test b/mysql-test/suite/rpl/t/rpl_ssl.test
index 803b08eeec5..0ba88a62242 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl.test
@@ -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 eca6a8cf46e..0a64415dbd8 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl1.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl1.test
@@ -9,11 +9,8 @@ source include/master-slave.inc;
connection master;
grant replication slave on *.* to replssl@localhost require ssl;
create table t1 (t int);
-save_master_pos;
-#syncing with master
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#trying to use this user without ssl
stop slave;
@@ -37,9 +34,7 @@ start slave;
#avoiding unneeded sleeps
connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#checking that replication is ok
select * from t1;
@@ -56,9 +51,8 @@ start slave;
connection master;
drop user replssl@localhost;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+
+sync_slave_with_master;
source include/show_slave_status.inc;
source include/check_slave_is_running.inc;
# End of 4.1 tests
@@ -90,6 +84,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_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
index 709731d5889..15f98916485 100644
--- a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
@@ -123,3 +123,4 @@ drop table t1i, t2m;
sync_slave_with_master;
# End of tests
+--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..9841ecb040a 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
+
+--let $engine_type= myisam
+CALL mtr.add_suppression("Statement may not be safe to log in statement format.");
+
+# 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;
+#hope this is long enough for I/O thread to fetch over 16K relay log data
+sleep 3;
+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 a8139bbbcd2..6381150217f 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
@@ -108,3 +108,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_direct.test b/mysql-test/suite/rpl/t/rpl_stm_binlog_direct.test
index f0c36c7b40c..2a899b06a2d 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_binlog_direct.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_binlog_direct.test
@@ -228,3 +228,4 @@ sync_slave_with_master;
--echo ###################################################################################
SET @commands= 'clean';
--source extra/rpl_tests/rpl_mixing_engines.inc
+--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_create_if_not_exists.test b/mysql-test/suite/rpl/t/rpl_stm_create_if_not_exists.test
index 69866cad267..b72a2e1532d 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_create_if_not_exists.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_create_if_not_exists.test
@@ -11,4 +11,4 @@ source extra/rpl_tests/rpl_stm_create_if_not_exists.test;
let $is_temporary=1;
source extra/rpl_tests/rpl_stm_create_if_not_exists.test;
-source include/master-slave-end.inc;
+--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 dad61002be4..f0a2e660830 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= 684;
-- 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_insert_delayed.test b/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test
index d55e3a4da2c..e9ee040c890 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test
@@ -18,3 +18,4 @@ set @@global.binlog_format = mixed;
connection master;
set @@global.binlog_format = @old_global_binlog_format;
+--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 3db8385a2f2..acf8c9a1bde 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_loadfile.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_loadfile.test
@@ -18,3 +18,4 @@
-- 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_maria.test b/mysql-test/suite/rpl/t/rpl_stm_maria.test
index b4dc0ef7e4a..ebcddf4175d 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_maria.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_maria.test
@@ -54,3 +54,6 @@ sync_slave_with_master;
connection master;
drop table t1,t2,t3;
sync_slave_with_master;
+
+# End of tests
+--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_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test
index 4086fd03ca1..575180e9177 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test
@@ -8,7 +8,7 @@
# BUG#49522: Replication problem with mixed MyISAM/InnoDB
#
--- source include/master-slave-reset.inc
+--source include/rpl_reset.inc
-- connection master
CREATE TABLE `t1` (
@@ -32,12 +32,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_until-master.opt b/mysql-test/suite/rpl/t/rpl_stm_until-master.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_until-master.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test
index f5e57ec2bd6..feac9b21c84 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_until.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_until.test
@@ -19,6 +19,7 @@
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc
+-- source include/rpl_reset.inc
# Test is dependent on binlog positions
@@ -192,10 +193,12 @@ 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;
+--disable_warnings
drop table if exists t1; # there is create table t1 in bug47142_master-bin.000001
+--enable_warnings
sync_slave_with_master;
connection slave;
stop slave;
@@ -218,9 +221,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_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test
index e44cf3e94b7..e7c67448dbe 100644
--- a/mysql-test/suite/rpl/t/rpl_stop_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test
@@ -57,4 +57,4 @@ SET GLOBAL debug= '$debug_save';
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_switch_stm_row_mixed.test b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
index a9c668b4293..e44d2d9912b 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
@@ -611,3 +611,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_temp_table.test b/mysql-test/suite/rpl/t/rpl_temp_table.test
index 9b73961aeea..4118e9783fa 100644
--- a/mysql-test/suite/rpl/t/rpl_temp_table.test
+++ b/mysql-test/suite/rpl/t/rpl_temp_table.test
@@ -54,6 +54,7 @@ show status like 'Slave_open_temp_tables';
connect (master2,localhost,root,,);
connection master2;
drop table if exists t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
+
+
+--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 82537a06e89..b41fb83fa4a 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
@@ -32,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
@@ -47,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]
@@ -89,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
@@ -191,11 +194,13 @@ COMMIT;
source include/show_binlog_events.inc;
+--sync_slave_with_master
+
--echo # Compare the base table.
-let diff_table= test.t1;
-source include/rpl_diff_tables.inc;
+--let $diff_tables= master:t1, slave:t1
+--source include/diff_tables.inc
--echo
connection master;
DROP TABLE t1;
-source include/master-slave-end.inc;
+--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 26273e86c48..f9e481c1e7b 100644
--- a/mysql-test/suite/rpl/t/rpl_temporary.test
+++ b/mysql-test/suite/rpl/t/rpl_temporary.test
@@ -1,11 +1,11 @@
--- source include/master-slave.inc
-
# Test need anonymous user when connection are made as "zedjzlcsjhd"
# But we only need it on the master, not the slave.
SET sql_log_bin = 0;
source include/add_anonymous_users.inc;
SET sql_log_bin = 1;
+-- source include/master-slave.inc
+
# Clean up old slave's binlogs.
# The slave is started with --log-slave-updates
# and this test does SHOW BINLOG EVENTS on the slave's
@@ -292,11 +292,15 @@ connection master;
drop table t1;
--remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
-# Delete the anonymous users
-SET sql_log_bin = 0;
-source include/delete_anonymous_users.inc;
-SET sql_log_bin = 1;
+--sync_slave_with_master
+# Delete the anonymous users.
+--source include/stop_slave.inc
+source include/delete_anonymous_users.inc;
+--connection master
+source include/delete_anonymous_users.inc;
+--let $rpl_only_running_threads= 1
+--source include/rpl_reset.inc
#
@@ -328,9 +332,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.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
index 0a36f31201e..e441dd8cb85 100644
--- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
@@ -28,13 +28,13 @@ 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;
--echo **** On Master ****
connection master;
-SET SQL_LOG_BIN= 0;
DROP TABLE t1;
-SET SQL_LOG_BIN= 1;
+--sync_slave_with_master
+--connection master
+
# BUG#Bug #53259 Unsafe statement binlogged in statement format w/MyIsam temp tables
#
@@ -79,6 +79,4 @@ DROP TABLE t_myisam, t_innodb;
# "Deadlock found" set in this test case is not effective during server
# shutdown.
--sync_slave_with_master
-connection slave;
-STOP SLAVE;
---source include/wait_for_slave_to_stop.inc
+--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 45d1f12b5d5..5b8b1df2652 100644
--- a/mysql-test/suite/rpl/t/rpl_timezone.test
+++ b/mysql-test/suite/rpl/t/rpl_timezone.test
@@ -164,6 +164,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
@@ -196,4 +198,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 d8c6ae5ade8..f4860d112eb 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
@@ -10,3 +10,5 @@ source include/have_binlog_format_row.inc;
LET $ENGINE_TYPE= MyISAM;
source extra/rpl_tests/rpl_tmp_table_and_DDL.test;
+
+--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 442f18ca61d..6baf7077d52 100644
--- a/mysql-test/suite/rpl/t/rpl_trigger.test
+++ b/mysql-test/suite/rpl/t/rpl_trigger.test
@@ -317,24 +317,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
@@ -510,7 +505,8 @@ sync_slave_with_master;
#
connection master;
-source include/master-slave-reset.inc;
+--source include/rpl_reset.inc
+
connection slave;
connection master;
@@ -525,12 +521,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;
@@ -540,3 +534,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_innodb.test b/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test
index e7882b28065..d4aae5736b4 100644
--- a/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test
+++ b/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test
@@ -6,17 +6,16 @@
# BUG#49618: Field length stored incorrectly in binary log for InnoDB
#
-source include/reset_master_and_slave.inc;
-
connection master;
CREATE TABLE t1(b1 BIT(1), b2 BIT(2), b3 BIT(3)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (b'0', b'01', b'101');
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_udf.test b/mysql-test/suite/rpl/t/rpl_udf.test
index 262ad04630c..452431e2f52 100644
--- a/mysql-test/suite/rpl/t/rpl_udf.test
+++ b/mysql-test/suite/rpl/t/rpl_udf.test
@@ -20,3 +20,4 @@ set binlog_format=statement;
# Embedded server doesn't support binlogging
--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 8d570f28f64..d496458c3fb 100644
--- a/mysql-test/suite/rpl/t/rpl_user_variables.test
+++ b/mysql-test/suite/rpl/t/rpl_user_variables.test
@@ -378,4 +378,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..001b8a6bc8e 100644
--- a/mysql-test/suite/rpl/t/rpl_variables.test
+++ b/mysql-test/suite/rpl/t/rpl_variables.test
@@ -109,9 +109,7 @@ 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/rpl_reset.inc
# We would have wanted to set this together with the other variables
# above, but can't because it affects how the slave works.
@@ -679,30 +677,11 @@ EXECUTE p61; EXECUTE p62; EXECUTE p63; EXECUTE p64;
# 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,tproc,tfunc,ttrig,tprep, slave:tstmt,tproc,tfunc,ttrig,tprep;
source include/diff_tables.inc;
@@ -737,3 +716,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 85152ae878a..f2f535f27d1 100644
--- a/mysql-test/suite/rpl/t/rpl_variables_stm.test
+++ b/mysql-test/suite/rpl/t/rpl_variables_stm.test
@@ -575,29 +575,11 @@ EXECUTE p61; EXECUTE p62; EXECUTE p63; EXECUTE p64;
# 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,tproc,tfunc,ttrig,tprep, slave:tstmt,tproc,tfunc,ttrig,tprep;
source include/diff_tables.inc;
@@ -634,3 +616,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 1053514bfec..5d878fda205 100644
--- a/mysql-test/suite/rpl/t/rpl_view.test
+++ b/mysql-test/suite/rpl/t/rpl_view.test
@@ -183,3 +183,4 @@ DROP TABLE t1;
sync_slave_with_master;
--echo End of 5.0 tests
+--source include/rpl_end.inc