summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.(none)>2007-06-27 14:28:02 +0200
committerunknown <msvensson@pilot.(none)>2007-06-27 14:28:02 +0200
commita40e44efed0794ed91e7d454743fdaa7d6099f45 (patch)
tree7685fdafab101eb337d2a982d91411513f0eb399 /mysql-test/suite/rpl
parent75689af808d935de69a39138e35cde575c982251 (diff)
downloadmariadb-git-a40e44efed0794ed91e7d454743fdaa7d6099f45.tar.gz
WL#3933 Split main test suite to rpl, rpl_ndb and ndb
- Update mysql-test-run.pl to collect tests from several suites - Group test into suites - Add suite.opt file mysql-test/suite/ndb/r/ndb_multi.result: Rename: mysql-test/r/ndb_multi.result -> mysql-test/suite/ndb/r/ndb_multi.result mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test: Rename: mysql-test/t/rpl_replicate_ignore_db.test -> mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test mysql-test/suite/rpl/t/rpl_row_trig001.test: Rename: mysql-test/t/rpl_row_trig001.test -> mysql-test/suite/rpl/t/rpl_row_trig001.test mysql-test/suite/rpl_ndb/r/rpl_ndb_sp003.result: Rename: mysql-test/r/rpl_ndb_sp003.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_sp003.result mysql-test/suite/binlog/r/binlog_stm_insert_select.result: Rename: mysql-test/r/binlog_stm_insert_select.result -> mysql-test/suite/binlog/r/binlog_stm_insert_select.result mysql-test/suite/ndb/t/ndb_condition_pushdown.test: Rename: mysql-test/t/ndb_condition_pushdown.test -> mysql-test/suite/ndb/t/ndb_condition_pushdown.test mysql-test/suite/ndb/t/ndb_dd_dump.test: Rename: mysql-test/t/ndb_dd_dump.test -> mysql-test/suite/ndb/t/ndb_dd_dump.test mysql-test/suite/ndb/t/ndb_partition_range.test: Rename: mysql-test/t/ndb_partition_range.test -> mysql-test/suite/ndb/t/ndb_partition_range.test mysql-test/suite/ndb/t/strict_autoinc_5ndb.test: Rename: mysql-test/t/strict_autoinc_5ndb.test -> mysql-test/suite/ndb/t/strict_autoinc_5ndb.test mysql-test/suite/rpl/r/rpl_commit_after_flush.result: Rename: mysql-test/r/rpl_commit_after_flush.result -> mysql-test/suite/rpl/r/rpl_commit_after_flush.result mysql-test/suite/rpl/r/rpl_view.result: Rename: mysql-test/r/rpl_view.result -> mysql-test/suite/rpl/r/rpl_view.result mysql-test/suite/rpl/t/rpl_insert_select.test: Rename: mysql-test/t/rpl_insert_select.test -> mysql-test/suite/rpl/t/rpl_insert_select.test mysql-test/suite/rpl/t/rpl_load_from_master-slave.opt: Rename: mysql-test/t/rpl_load_from_master-slave.opt -> mysql-test/suite/rpl/t/rpl_load_from_master-slave.opt mysql-test/suite/rpl/t/rpl_many_optimize.test: Rename: mysql-test/t/rpl_many_optimize.test -> mysql-test/suite/rpl/t/rpl_many_optimize.test mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test: Rename: mysql-test/t/rpl_mixed_ddl_dml.test -> mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test mysql-test/suite/rpl/t/rpl_multi_delete.test: Rename: mysql-test/t/rpl_multi_delete.test -> mysql-test/suite/rpl/t/rpl_multi_delete.test mysql-test/suite/rpl/t/rpl_row_log_innodb.test: Rename: mysql-test/t/rpl_row_log_innodb.test -> mysql-test/suite/rpl/t/rpl_row_log_innodb.test mysql-test/suite/rpl/t/rpl_row_reset_slave.test: Rename: mysql-test/t/rpl_row_reset_slave.test -> mysql-test/suite/rpl/t/rpl_row_reset_slave.test mysql-test/suite/rpl/t/rpl_row_stop_middle.test: Rename: mysql-test/t/rpl_row_stop_middle.test -> mysql-test/suite/rpl/t/rpl_row_stop_middle.test mysql-test/suite/rpl/t/rpl_stm_log-master.opt: Rename: mysql-test/t/rpl_stm_log-master.opt -> mysql-test/suite/rpl/t/rpl_stm_log-master.opt mysql-test/suite/rpl_ndb/r/rpl_ndb_delete_nowhere.result: Rename: mysql-test/r/rpl_ndb_delete_nowhere.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_delete_nowhere.result mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test: Rename: mysql-test/t/rpl_ndb_sync.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result: Rename: mysql-test/r/binlog_row_mix_innodb_myisam.result -> mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result mysql-test/suite/ndb/r/ndb_dd_alter.result: Rename: mysql-test/r/ndb_dd_alter.result -> mysql-test/suite/ndb/r/ndb_dd_alter.result mysql-test/suite/ndb/r/ndb_index_unique.result: Rename: mysql-test/r/ndb_index_unique.result -> mysql-test/suite/ndb/r/ndb_index_unique.result mysql-test/suite/ndb/r/ndb_rename.result: Rename: mysql-test/r/ndb_rename.result -> mysql-test/suite/ndb/r/ndb_rename.result mysql-test/suite/ndb/r/ndb_update.result: Rename: mysql-test/r/ndb_update.result -> mysql-test/suite/ndb/r/ndb_update.result mysql-test/suite/ndb/r/ndb_view.result: Rename: mysql-test/r/ndb_view.result -> mysql-test/suite/ndb/r/ndb_view.result mysql-test/suite/ndb/t/ndb_alter_table2.test: Rename: mysql-test/t/ndb_alter_table2.test -> mysql-test/suite/ndb/t/ndb_alter_table2.test mysql-test/suite/ndb/t/ndb_autodiscover.test: Rename: mysql-test/t/ndb_autodiscover.test -> mysql-test/suite/ndb/t/ndb_autodiscover.test mysql-test/suite/ndb/t/ndb_binlog_discover.test: Rename: mysql-test/t/ndb_binlog_discover.test -> mysql-test/suite/ndb/t/ndb_binlog_discover.test mysql-test/suite/ndb/t/ndb_binlog_multi.test: Rename: mysql-test/t/ndb_binlog_multi.test -> mysql-test/suite/ndb/t/ndb_binlog_multi.test mysql-test/suite/ndb/t/ndb_cache_multi.test: Rename: mysql-test/t/ndb_cache_multi.test -> mysql-test/suite/ndb/t/ndb_cache_multi.test mysql-test/suite/ndb/t/ndb_partition_error2-master.opt: Rename: mysql-test/t/ndb_partition_error2-master.opt -> mysql-test/suite/ndb/t/ndb_partition_error2-master.opt mysql-test/suite/rpl/r/rpl000001.a.result: Rename: mysql-test/r/rpl000001.a.result -> mysql-test/suite/rpl/r/rpl000001.a.result mysql-test/suite/rpl/r/rpl_alter.result: Rename: mysql-test/r/rpl_alter.result -> mysql-test/suite/rpl/r/rpl_alter.result mysql-test/suite/rpl/r/rpl_insert_ignore.result: Rename: mysql-test/r/rpl_insert_ignore.result -> mysql-test/suite/rpl/r/rpl_insert_ignore.result mysql-test/suite/rpl/r/rpl_relayspace.result: Rename: mysql-test/r/rpl_relayspace.result -> mysql-test/suite/rpl/r/rpl_relayspace.result mysql-test/suite/rpl/r/rpl_row_func001.result: Rename: mysql-test/r/rpl_row_func001.result -> mysql-test/suite/rpl/r/rpl_row_func001.result mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result: Rename: mysql-test/r/rpl_row_inexist_tbl.result -> mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result: Rename: mysql-test/r/rpl_stm_insert_delayed.result -> mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result mysql-test/suite/rpl/t/rpl_create_database.test: Rename: mysql-test/t/rpl_create_database.test -> mysql-test/suite/rpl/t/rpl_create_database.test mysql-test/suite/rpl/t/rpl_dual_pos_advance-master.opt: Rename: mysql-test/t/rpl_dual_pos_advance-master.opt -> mysql-test/suite/rpl/t/rpl_dual_pos_advance-master.opt mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh: Rename: mysql-test/t/rpl_flushlog_loop-slave.sh -> mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh mysql-test/suite/rpl/t/rpl_ignore_grant.test: Rename: mysql-test/t/rpl_ignore_grant.test -> mysql-test/suite/rpl/t/rpl_ignore_grant.test mysql-test/suite/rpl/t/rpl_multi_update2-slave.opt: Rename: mysql-test/t/rpl_multi_update2-slave.opt -> mysql-test/suite/rpl/t/rpl_multi_update2-slave.opt mysql-test/suite/rpl/t/rpl_multi_update4.test: Rename: mysql-test/t/rpl_multi_update4.test -> mysql-test/suite/rpl/t/rpl_multi_update4.test mysql-test/suite/rpl/t/rpl_rewrt_db.test: Rename: mysql-test/t/rpl_rewrt_db.test -> mysql-test/suite/rpl/t/rpl_rewrt_db.test mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt: Rename: mysql-test/t/rpl_rotate_logs-master.opt -> mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt mysql-test/suite/rpl/t/rpl_row_4_bytes.test: Rename: mysql-test/t/rpl_row_4_bytes.test -> mysql-test/suite/rpl/t/rpl_row_4_bytes.test mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt: Rename: mysql-test/t/rpl_row_create_table-slave.opt -> mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test: Rename: mysql-test/t/rpl_row_flsh_tbls.test -> mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test mysql-test/suite/rpl/t/rpl_row_func003.test: Rename: mysql-test/t/rpl_row_func003.test -> mysql-test/suite/rpl/t/rpl_row_func003.test mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test: Rename: mysql-test/t/rpl_row_sp007_innodb.test -> mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt: Rename: mysql-test/t/rpl_row_stop_middle_update-slave.opt -> mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test: Rename: mysql-test/t/rpl_row_tabledefs_3innodb.test -> mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test mysql-test/suite/rpl/t/rpl_ssl1.test: Rename: mysql-test/t/rpl_ssl1.test -> mysql-test/suite/rpl/t/rpl_ssl1.test mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test: Rename: mysql-test/t/rpl_stm_max_relay_size.test -> mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test mysql-test/suite/rpl/t/rpl_stm_mystery22.test: Rename: mysql-test/t/rpl_stm_mystery22.test -> mysql-test/suite/rpl/t/rpl_stm_mystery22.test mysql-test/suite/rpl/t/rpl_truncate_7ndb_2.test: Rename: mysql-test/t/rpl_truncate_7ndb_2.test -> mysql-test/suite/rpl/t/rpl_truncate_7ndb_2.test mysql-test/suite/rpl/t/rpl_variables.test: Rename: mysql-test/t/rpl_variables.test -> mysql-test/suite/rpl/t/rpl_variables.test mysql-test/suite/rpl_ndb/r/rpl_ndb_auto_inc.result: Rename: mysql-test/r/rpl_ndb_auto_inc.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_auto_inc.result mysql-test/suite/rpl_ndb/r/rpl_ndb_do_db.result: Rename: mysql-test/r/rpl_ndb_do_db.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_do_db.result mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result: Rename: mysql-test/r/rpl_truncate_7ndb.result -> mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test: Rename: mysql-test/t/rpl_ndb_do_table.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test: Rename: mysql-test/t/rpl_ndb_multi.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test mysql-test/suite/binlog/r/binlog_row_blackhole.result: Rename: mysql-test/r/binlog_row_blackhole.result -> mysql-test/suite/binlog/r/binlog_row_blackhole.result mysql-test/suite/binlog/r/binlog_row_ctype_cp932.result: Rename: mysql-test/r/binlog_row_ctype_cp932.result -> mysql-test/suite/binlog/r/binlog_row_ctype_cp932.result mysql-test/suite/binlog/r/binlog_row_insert_select.result: Rename: mysql-test/r/binlog_row_insert_select.result -> mysql-test/suite/binlog/r/binlog_row_insert_select.result mysql-test/suite/binlog/r/binlog_stm_ps.result: Rename: mysql-test/r/binlog_stm_ps.result -> mysql-test/suite/binlog/r/binlog_stm_ps.result mysql-test/suite/binlog/t/binlog_row_binlog-master.opt: Rename: mysql-test/t/binlog_row_binlog-master.opt -> mysql-test/suite/binlog/t/binlog_row_binlog-master.opt mysql-test/suite/binlog/t/binlog_row_innodb_stat-master.opt: Rename: mysql-test/t/binlog_row_innodb_stat-master.opt -> mysql-test/suite/binlog/t/binlog_row_innodb_stat-master.opt mysql-test/suite/binlog/t/binlog_row_innodb_stat.test: Rename: mysql-test/t/binlog_row_innodb_stat.test -> mysql-test/suite/binlog/t/binlog_row_innodb_stat.test mysql-test/suite/binlog/t/binlog_stm_ctype_ucs.test: Rename: mysql-test/t/binlog_stm_ctype_ucs.test -> mysql-test/suite/binlog/t/binlog_stm_ctype_ucs.test mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result: Rename: mysql-test/r/ndb_binlog_ddl_multi.result -> mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result mysql-test/suite/ndb/r/ndb_dd_backuprestore.result: Rename: mysql-test/r/ndb_dd_backuprestore.result -> mysql-test/suite/ndb/r/ndb_dd_backuprestore.result mysql-test/suite/ndb/r/ndb_index_ordered.result: Rename: mysql-test/r/ndb_index_ordered.result -> mysql-test/suite/ndb/r/ndb_index_ordered.result mysql-test/suite/ndb/r/ndb_lock.result: Rename: mysql-test/r/ndb_lock.result -> mysql-test/suite/ndb/r/ndb_lock.result mysql-test/suite/ndb/r/ndb_partition_range.result: Rename: mysql-test/r/ndb_partition_range.result -> mysql-test/suite/ndb/r/ndb_partition_range.result mysql-test/suite/ndb/r/ndb_replace.result: Rename: mysql-test/r/ndb_replace.result -> mysql-test/suite/ndb/r/ndb_replace.result mysql-test/suite/ndb/t/ndb_alter_table3.test: Rename: mysql-test/t/ndb_alter_table3.test -> mysql-test/suite/ndb/t/ndb_alter_table3.test mysql-test/suite/ndb/t/ndb_binlog_basic.test: Rename: mysql-test/t/ndb_binlog_basic.test -> mysql-test/suite/ndb/t/ndb_binlog_basic.test mysql-test/suite/ndb/t/ndb_bitfield.test: Rename: mysql-test/t/ndb_bitfield.test -> mysql-test/suite/ndb/t/ndb_bitfield.test mysql-test/suite/ndb/t/ndb_blob_partition.test: Rename: mysql-test/t/ndb_blob_partition.test -> mysql-test/suite/ndb/t/ndb_blob_partition.test mysql-test/suite/ndb/t/ndb_cache.test: Rename: mysql-test/t/ndb_cache.test -> mysql-test/suite/ndb/t/ndb_cache.test mysql-test/suite/ndb/t/ndb_cache2.test: Rename: mysql-test/t/ndb_cache2.test -> mysql-test/suite/ndb/t/ndb_cache2.test mysql-test/suite/ndb/t/ndb_dd_alter.test: Rename: mysql-test/t/ndb_dd_alter.test -> mysql-test/suite/ndb/t/ndb_dd_alter.test mysql-test/suite/ndb/t/ndb_dd_backuprestore.test: Rename: mysql-test/t/ndb_dd_backuprestore.test -> mysql-test/suite/ndb/t/ndb_dd_backuprestore.test mysql-test/suite/ndb/t/ndb_limit.test: Rename: mysql-test/t/ndb_limit.test -> mysql-test/suite/ndb/t/ndb_limit.test mysql-test/suite/ndb/t/ndb_minmax.test: Rename: mysql-test/t/ndb_minmax.test -> mysql-test/suite/ndb/t/ndb_minmax.test mysql-test/suite/ndb/t/ndb_partition_list.test: Rename: mysql-test/t/ndb_partition_list.test -> mysql-test/suite/ndb/t/ndb_partition_list.test mysql-test/suite/ndb/t/ndb_restore_partition.test: Rename: mysql-test/t/ndb_restore_partition.test -> mysql-test/suite/ndb/t/ndb_restore_partition.test mysql-test/suite/ndb/t/ndb_restore_print.test: Rename: mysql-test/t/ndb_restore_print.test -> mysql-test/suite/ndb/t/ndb_restore_print.test mysql-test/suite/rpl/r/rpl000001.b.result: Rename: mysql-test/r/rpl000001.b.result -> mysql-test/suite/rpl/r/rpl000001.b.result mysql-test/suite/rpl/r/rpl000017.result: Rename: mysql-test/r/rpl000017.result -> mysql-test/suite/rpl/r/rpl000017.result mysql-test/suite/rpl/r/rpl_bit.result: Rename: mysql-test/r/rpl_bit.result -> mysql-test/suite/rpl/r/rpl_bit.result mysql-test/suite/rpl/r/rpl_dual_pos_advance.result: Rename: mysql-test/r/rpl_dual_pos_advance.result -> mysql-test/suite/rpl/r/rpl_dual_pos_advance.result mysql-test/suite/rpl/r/rpl_failed_optimize.result: Rename: mysql-test/r/rpl_failed_optimize.result -> mysql-test/suite/rpl/r/rpl_failed_optimize.result mysql-test/suite/rpl/r/rpl_ignore_table_update.result: Rename: mysql-test/r/rpl_ignore_table_update.result -> mysql-test/suite/rpl/r/rpl_ignore_table_update.result mysql-test/suite/rpl/r/rpl_insert_id_pk.result: Rename: mysql-test/r/rpl_insert_id_pk.result -> mysql-test/suite/rpl/r/rpl_insert_id_pk.result mysql-test/suite/rpl/r/rpl_known_bugs_detection.result: Rename: mysql-test/r/rpl_known_bugs_detection.result -> mysql-test/suite/rpl/r/rpl_known_bugs_detection.result mysql-test/suite/rpl/r/rpl_loaddata.result: Rename: mysql-test/r/rpl_loaddata.result -> mysql-test/suite/rpl/r/rpl_loaddata.result mysql-test/suite/rpl/r/rpl_redirect.result: Rename: mysql-test/r/rpl_redirect.result -> mysql-test/suite/rpl/r/rpl_redirect.result mysql-test/suite/rpl/r/rpl_row_NOW.result: Rename: mysql-test/r/rpl_row_NOW.result -> mysql-test/suite/rpl/r/rpl_row_NOW.result mysql-test/suite/rpl/r/rpl_row_func002.result: Rename: mysql-test/r/rpl_row_func002.result -> mysql-test/suite/rpl/r/rpl_row_func002.result mysql-test/suite/rpl/r/rpl_row_loaddata_m.result: Rename: mysql-test/r/rpl_row_loaddata_m.result -> mysql-test/suite/rpl/r/rpl_row_loaddata_m.result mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result: Rename: mysql-test/r/rpl_row_stop_middle_update.result -> mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result mysql-test/suite/rpl/r/rpl_row_trig001.result: Rename: mysql-test/r/rpl_row_trig001.result -> mysql-test/suite/rpl/r/rpl_row_trig001.result mysql-test/suite/rpl/r/rpl_stm_no_op.result: Rename: mysql-test/r/rpl_stm_no_op.result -> mysql-test/suite/rpl/r/rpl_stm_no_op.result mysql-test/suite/rpl/r/rpl_truncate_3innodb.result: Rename: mysql-test/r/rpl_truncate_3innodb.result -> mysql-test/suite/rpl/r/rpl_truncate_3innodb.result mysql-test/suite/rpl/t/rpl000011.test: Rename: mysql-test/t/rpl000011.test -> mysql-test/suite/rpl/t/rpl000011.test mysql-test/suite/rpl/t/rpl_alter_db.test: Rename: mysql-test/t/rpl_alter_db.test -> mysql-test/suite/rpl/t/rpl_alter_db.test mysql-test/suite/rpl/t/rpl_delete_no_where.test: Rename: mysql-test/t/rpl_delete_no_where.test -> mysql-test/suite/rpl/t/rpl_delete_no_where.test mysql-test/suite/rpl/t/rpl_dual_pos_advance.test: Rename: mysql-test/t/rpl_dual_pos_advance.test -> mysql-test/suite/rpl/t/rpl_dual_pos_advance.test mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt: Rename: mysql-test/t/rpl_flushlog_loop-master.opt -> mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh: Rename: mysql-test/t/rpl_flushlog_loop-master.sh -> mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh mysql-test/suite/rpl/t/rpl_get_lock.test: Rename: mysql-test/t/rpl_get_lock.test -> mysql-test/suite/rpl/t/rpl_get_lock.test mysql-test/suite/rpl/t/rpl_ignore_grant-slave.opt: Rename: mysql-test/t/rpl_ignore_grant-slave.opt -> mysql-test/suite/rpl/t/rpl_ignore_grant-slave.opt mysql-test/suite/rpl/t/rpl_incident.test: Rename: mysql-test/t/rpl_incident.test -> mysql-test/suite/rpl/t/rpl_incident.test mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt: Rename: mysql-test/t/rpl_insert_ignore-slave.opt -> mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt mysql-test/suite/rpl/t/rpl_known_bugs_detection-master.opt: Rename: mysql-test/t/rpl_known_bugs_detection-master.opt -> mysql-test/suite/rpl/t/rpl_known_bugs_detection-master.opt mysql-test/suite/rpl/t/rpl_loaddata_m.test: Rename: mysql-test/t/rpl_loaddata_m.test -> mysql-test/suite/rpl/t/rpl_loaddata_m.test mysql-test/suite/rpl/t/rpl_loaddata_s-slave.opt: Rename: mysql-test/t/rpl_loaddata_s-slave.opt -> mysql-test/suite/rpl/t/rpl_loaddata_s-slave.opt mysql-test/suite/rpl/t/rpl_loadfile.test: Rename: mysql-test/t/rpl_loadfile.test -> mysql-test/suite/rpl/t/rpl_loadfile.test mysql-test/suite/rpl/t/rpl_read_only.test: Rename: mysql-test/t/rpl_read_only.test -> mysql-test/suite/rpl/t/rpl_read_only.test mysql-test/suite/rpl/t/rpl_redirect.test: Rename: mysql-test/t/rpl_redirect.test -> mysql-test/suite/rpl/t/rpl_redirect.test mysql-test/suite/rpl/t/rpl_relay_space_innodb.test: Rename: mysql-test/t/rpl_relay_space_innodb.test -> mysql-test/suite/rpl/t/rpl_relay_space_innodb.test mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt: Rename: mysql-test/t/rpl_row_basic_11bugs-master.opt -> mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt mysql-test/suite/rpl/t/rpl_row_err_daisychain-slave.opt: Rename: mysql-test/t/rpl_row_err_daisychain-slave.opt -> mysql-test/suite/rpl/t/rpl_row_err_daisychain-slave.opt mysql-test/suite/rpl/t/rpl_row_log-slave.opt: Rename: mysql-test/t/rpl_row_log-slave.opt -> mysql-test/suite/rpl/t/rpl_row_log-slave.opt mysql-test/suite/rpl/t/rpl_row_mysqlbinlog-master.opt: Rename: mysql-test/t/rpl_row_mysqlbinlog-master.opt -> mysql-test/suite/rpl/t/rpl_row_mysqlbinlog-master.opt mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test: Rename: mysql-test/t/rpl_row_sp006_InnoDB.test -> mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt: Rename: mysql-test/t/rpl_row_sp007_innodb-slave.opt -> mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt: Rename: mysql-test/t/rpl_row_stop_middle_update-master.opt -> mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt: Rename: mysql-test/t/rpl_row_tabledefs_3innodb-slave.opt -> mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt mysql-test/suite/rpl/t/rpl_sp_effects-slave.opt: Rename: mysql-test/t/rpl_sp_effects-slave.opt -> mysql-test/suite/rpl/t/rpl_sp_effects-slave.opt mysql-test/suite/rpl/t/rpl_sp_effects.test: Rename: mysql-test/t/rpl_sp_effects.test -> mysql-test/suite/rpl/t/rpl_sp_effects.test mysql-test/suite/rpl/t/rpl_sporadic_master-master.opt: Rename: mysql-test/t/rpl_sporadic_master-master.opt -> mysql-test/suite/rpl/t/rpl_sporadic_master-master.opt mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test: Rename: mysql-test/t/rpl_switch_stm_row_mixed.test -> mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test mysql-test/suite/rpl/t/rpl_temporary.test: Rename: mysql-test/t/rpl_temporary.test -> mysql-test/suite/rpl/t/rpl_temporary.test mysql-test/suite/rpl/t/rpl_timezone-master.opt: Rename: mysql-test/t/rpl_timezone-master.opt -> mysql-test/suite/rpl/t/rpl_timezone-master.opt mysql-test/suite/rpl/t/rpl_trigger.test: Rename: mysql-test/t/rpl_trigger.test -> mysql-test/suite/rpl/t/rpl_trigger.test mysql-test/suite/rpl/t/rpl_trunc_temp.test: Rename: mysql-test/t/rpl_trunc_temp.test -> mysql-test/suite/rpl/t/rpl_trunc_temp.test mysql-test/suite/rpl_ndb/r/rpl_ndb_bank.result: Rename: mysql-test/r/rpl_ndb_bank.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_bank.result mysql-test/suite/rpl_ndb/r/rpl_ndb_blob.result: Rename: mysql-test/r/rpl_ndb_blob.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_blob.result mysql-test/suite/rpl_ndb/r/rpl_ndb_blob2.result: Rename: mysql-test/r/rpl_ndb_blob2.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_blob2.result mysql-test/suite/rpl_ndb/r/rpl_ndb_relayrotate.result: Rename: mysql-test/r/rpl_ndb_relayrotate.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_relayrotate.result mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test: Rename: mysql-test/t/rpl_ndb_2innodb.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test mysql-test/suite/rpl_ndb/t/rpl_ndb_charset.test: Rename: mysql-test/t/rpl_ndb_charset.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_charset.test mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_basic.test: Rename: mysql-test/t/rpl_ndb_dd_basic.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_basic.test mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test: Rename: mysql-test/t/rpl_ndb_ddl.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test: Rename: mysql-test/t/rpl_ndb_delete_nowhere.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db-slave.opt: Rename: mysql-test/t/rpl_ndb_do_db-slave.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-master.opt: Rename: mysql-test/t/rpl_ndb_innodb2ndb-master.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-master.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_log-master.opt: Rename: mysql-test/t/rpl_ndb_log-master.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_log-master.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate-slave.opt: Rename: mysql-test/t/rpl_ndb_relayrotate-slave.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test: Rename: mysql-test/t/rpl_ndb_sp006.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test: Rename: mysql-test/t/rpl_ndb_trig004.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result: Rename: mysql-test/r/binlog_stm_ctype_cp932.result -> mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result mysql-test/suite/ndb/r/ndb_basic.result: Rename: mysql-test/r/ndb_basic.result -> mysql-test/suite/ndb/r/ndb_basic.result mysql-test/suite/ndb/r/ndb_binlog_log_bin.result: Rename: mysql-test/r/ndb_binlog_log_bin.result -> mysql-test/suite/ndb/r/ndb_binlog_log_bin.result mysql-test/suite/ndb/r/ndb_cursor.result: Rename: mysql-test/r/ndb_cursor.result -> mysql-test/suite/ndb/r/ndb_cursor.result mysql-test/suite/ndb/r/ndb_dd_basic.result: Rename: mysql-test/r/ndb_dd_basic.result -> mysql-test/suite/ndb/r/ndb_dd_basic.result mysql-test/suite/ndb/r/ndb_dd_sql_features.result: Rename: mysql-test/r/ndb_dd_sql_features.result -> mysql-test/suite/ndb/r/ndb_dd_sql_features.result mysql-test/suite/ndb/r/ndb_gis.result: Rename: mysql-test/r/ndb_gis.result -> mysql-test/suite/ndb/r/ndb_gis.result mysql-test/suite/ndb/r/ndb_load.result: Rename: mysql-test/r/ndb_load.result -> mysql-test/suite/ndb/r/ndb_load.result mysql-test/suite/ndb/r/ndb_multi_row.result: Rename: mysql-test/r/ndb_multi_row.result -> mysql-test/suite/ndb/r/ndb_multi_row.result mysql-test/suite/ndb/r/ndb_trigger.result: Rename: mysql-test/r/ndb_trigger.result -> mysql-test/suite/ndb/r/ndb_trigger.result mysql-test/suite/ndb/r/ndb_types.result: Rename: mysql-test/r/ndb_types.result -> mysql-test/suite/ndb/r/ndb_types.result mysql-test/suite/ndb/t/ndb_alter_table.test: Rename: mysql-test/t/ndb_alter_table.test -> mysql-test/suite/ndb/t/ndb_alter_table.test mysql-test/suite/ndb/t/ndb_basic.test: Rename: mysql-test/t/ndb_basic.test -> mysql-test/suite/ndb/t/ndb_basic.test mysql-test/suite/ndb/t/ndb_binlog_ignore_db-master.opt: Rename: mysql-test/t/ndb_binlog_ignore_db-master.opt -> mysql-test/suite/ndb/t/ndb_binlog_ignore_db-master.opt mysql-test/suite/ndb/t/ndb_blob.test: Rename: mysql-test/t/ndb_blob.test -> mysql-test/suite/ndb/t/ndb_blob.test mysql-test/suite/ndb/t/ndb_dd_ddl.test: Rename: mysql-test/t/ndb_dd_ddl.test -> mysql-test/suite/ndb/t/ndb_dd_ddl.test mysql-test/suite/ndb/t/ndb_dd_disk2memory.test: Rename: mysql-test/t/ndb_dd_disk2memory.test -> mysql-test/suite/ndb/t/ndb_dd_disk2memory.test mysql-test/suite/ndb/t/ndb_index_unique.test: Rename: mysql-test/t/ndb_index_unique.test -> mysql-test/suite/ndb/t/ndb_index_unique.test mysql-test/suite/ndb/t/ndb_read_multi_range.test: Rename: mysql-test/t/ndb_read_multi_range.test -> mysql-test/suite/ndb/t/ndb_read_multi_range.test mysql-test/suite/ndb/t/ndb_row_format.test: Rename: mysql-test/t/ndb_row_format.test -> mysql-test/suite/ndb/t/ndb_row_format.test mysql-test/suite/rpl/r/rpl_alter_db.result: Rename: mysql-test/r/rpl_alter_db.result -> mysql-test/suite/rpl/r/rpl_alter_db.result mysql-test/suite/rpl/r/rpl_drop_db.result: Rename: mysql-test/r/rpl_drop_db.result -> mysql-test/suite/rpl/r/rpl_drop_db.result mysql-test/suite/rpl/r/rpl_log_pos.result: Rename: mysql-test/r/rpl_log_pos.result -> mysql-test/suite/rpl/r/rpl_log_pos.result mysql-test/suite/rpl/r/rpl_multi_update3.result: Rename: mysql-test/r/rpl_multi_update3.result -> mysql-test/suite/rpl/r/rpl_multi_update3.result mysql-test/suite/rpl/r/rpl_rewrt_db.result: Rename: mysql-test/r/rpl_rewrt_db.result -> mysql-test/suite/rpl/r/rpl_rewrt_db.result mysql-test/suite/rpl/r/rpl_row_create_table.result: Rename: mysql-test/r/rpl_row_create_table.result -> mysql-test/suite/rpl/r/rpl_row_create_table.result mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result: Rename: mysql-test/r/rpl_row_flsh_tbls.result -> mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result mysql-test/suite/rpl/r/rpl_row_func003.result: Rename: mysql-test/r/rpl_row_func003.result -> mysql-test/suite/rpl/r/rpl_row_func003.result mysql-test/suite/rpl/r/rpl_row_sp008.result: Rename: mysql-test/r/rpl_row_sp008.result -> mysql-test/suite/rpl/r/rpl_row_sp008.result mysql-test/suite/rpl/r/rpl_row_trig002.result: Rename: mysql-test/r/rpl_row_trig002.result -> mysql-test/suite/rpl/r/rpl_row_trig002.result mysql-test/suite/rpl/r/rpl_sp004.result: Rename: mysql-test/r/rpl_sp004.result -> mysql-test/suite/rpl/r/rpl_sp004.result mysql-test/suite/rpl/r/rpl_ssl.result: Rename: mysql-test/r/rpl_ssl.result -> mysql-test/suite/rpl/r/rpl_ssl.result mysql-test/suite/rpl/r/rpl_stm_EE_err2.result: Rename: mysql-test/r/rpl_stm_EE_err2.result -> mysql-test/suite/rpl/r/rpl_stm_EE_err2.result mysql-test/suite/rpl/r/rpl_stm_multi_query.result: Rename: mysql-test/r/rpl_stm_multi_query.result -> mysql-test/suite/rpl/r/rpl_stm_multi_query.result mysql-test/suite/rpl/t/rpl000013.test: Rename: mysql-test/t/rpl000013.test -> mysql-test/suite/rpl/t/rpl000013.test mysql-test/suite/rpl/t/rpl000017-slave.opt: Rename: mysql-test/t/rpl000017-slave.opt -> mysql-test/suite/rpl/t/rpl000017-slave.opt mysql-test/suite/rpl/t/rpl_drop_db.test: Rename: mysql-test/t/rpl_drop_db.test -> mysql-test/suite/rpl/t/rpl_drop_db.test mysql-test/suite/rpl/t/rpl_flushlog_loop.test: Rename: mysql-test/t/rpl_flushlog_loop.test -> mysql-test/suite/rpl/t/rpl_flushlog_loop.test mysql-test/suite/rpl/t/rpl_load_from_master.test: Rename: mysql-test/t/rpl_load_from_master.test -> mysql-test/suite/rpl/t/rpl_load_from_master.test mysql-test/suite/rpl/t/rpl_locale.test: Rename: mysql-test/t/rpl_locale.test -> mysql-test/suite/rpl/t/rpl_locale.test mysql-test/suite/rpl/t/rpl_multi_delete-slave.opt: Rename: mysql-test/t/rpl_multi_delete-slave.opt -> mysql-test/suite/rpl/t/rpl_multi_delete-slave.opt mysql-test/suite/rpl/t/rpl_rotate_logs.test: Rename: mysql-test/t/rpl_rotate_logs.test -> mysql-test/suite/rpl/t/rpl_rotate_logs.test mysql-test/suite/rpl/t/rpl_row_NOW.test: Rename: mysql-test/t/rpl_row_NOW.test -> mysql-test/suite/rpl/t/rpl_row_NOW.test mysql-test/suite/rpl/t/rpl_row_err_daisychain-master.opt: Rename: mysql-test/t/rpl_row_err_daisychain-master.opt -> mysql-test/suite/rpl/t/rpl_row_err_daisychain-master.opt mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test: Rename: mysql-test/t/rpl_row_inexist_tbl.test -> mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test mysql-test/suite/rpl/t/rpl_row_mystery22.test: Rename: mysql-test/t/rpl_row_mystery22.test -> mysql-test/suite/rpl/t/rpl_row_mystery22.test mysql-test/suite/rpl/t/rpl_row_sp003.test: Rename: mysql-test/t/rpl_row_sp003.test -> mysql-test/suite/rpl/t/rpl_row_sp003.test mysql-test/suite/rpl/t/rpl_row_sp011.test: Rename: mysql-test/t/rpl_row_sp011.test -> mysql-test/suite/rpl/t/rpl_row_sp011.test mysql-test/suite/rpl/t/rpl_server_id1.test: Rename: mysql-test/t/rpl_server_id1.test -> mysql-test/suite/rpl/t/rpl_server_id1.test mysql-test/suite/rpl/t/rpl_session_var.test: Rename: mysql-test/t/rpl_session_var.test -> mysql-test/suite/rpl/t/rpl_session_var.test mysql-test/suite/rpl/t/rpl_skip_error.test: Rename: mysql-test/t/rpl_skip_error.test -> mysql-test/suite/rpl/t/rpl_skip_error.test mysql-test/suite/rpl_ndb/r/rpl_ndb_commit_afterflush.result: Rename: mysql-test/r/rpl_ndb_commit_afterflush.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_commit_afterflush.result mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test: Rename: mysql-test/t/rpl_ndb_do_db.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-slave.opt: Rename: mysql-test/t/rpl_ndb_innodb2ndb-slave.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2-slave.opt: Rename: mysql-test/t/rpl_ndb_multi_update2-slave.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2.test: Rename: mysql-test/t/rpl_ndb_multi_update2.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2.test mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result: Rename: mysql-test/r/binlog_statement_insert_delayed.result -> mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result mysql-test/suite/binlog/t/binlog_row_blackhole.test: Rename: mysql-test/t/binlog_row_blackhole.test -> mysql-test/suite/binlog/t/binlog_row_blackhole.test mysql-test/suite/ndb/r/ndb_limit.result: Rename: mysql-test/r/ndb_limit.result -> mysql-test/suite/ndb/r/ndb_limit.result mysql-test/suite/ndb/t/ndb_dd_basic.test: Rename: mysql-test/t/ndb_dd_basic.test -> mysql-test/suite/ndb/t/ndb_dd_basic.test mysql-test/suite/ndb/t/ndb_types.test: Rename: mysql-test/t/ndb_types.test -> mysql-test/suite/ndb/t/ndb_types.test mysql-test/suite/ndb/t/ndb_update.test: Rename: mysql-test/t/ndb_update.test -> mysql-test/suite/ndb/t/ndb_update.test mysql-test/suite/rpl/r/rpl_extraCol_innodb.result: Rename: mysql-test/r/rpl_extraCol_innodb.result -> mysql-test/suite/rpl/r/rpl_extraCol_innodb.result mysql-test/suite/rpl/r/rpl_loaddata_charset.result: Rename: mysql-test/r/rpl_loaddata_charset.result -> mysql-test/suite/rpl/r/rpl_loaddata_charset.result mysql-test/suite/rpl/r/rpl_loaddata_m.result: Rename: mysql-test/r/rpl_loaddata_m.result -> mysql-test/suite/rpl/r/rpl_loaddata_m.result mysql-test/suite/rpl/r/rpl_multi_delete.result: Rename: mysql-test/r/rpl_multi_delete.result -> mysql-test/suite/rpl/r/rpl_multi_delete.result mysql-test/suite/rpl/r/rpl_multi_delete2.result: Rename: mysql-test/r/rpl_multi_delete2.result -> mysql-test/suite/rpl/r/rpl_multi_delete2.result mysql-test/suite/rpl/r/rpl_row_sp009.result: Rename: mysql-test/r/rpl_row_sp009.result -> mysql-test/suite/rpl/r/rpl_row_sp009.result mysql-test/suite/rpl/r/rpl_row_sp010.result: Rename: mysql-test/r/rpl_row_sp010.result -> mysql-test/suite/rpl/r/rpl_row_sp010.result mysql-test/suite/rpl/r/rpl_set_charset.result: Rename: mysql-test/r/rpl_set_charset.result -> mysql-test/suite/rpl/r/rpl_set_charset.result mysql-test/suite/rpl/r/rpl_skip_error.result: Rename: mysql-test/r/rpl_skip_error.result -> mysql-test/suite/rpl/r/rpl_skip_error.result mysql-test/suite/rpl/r/rpl_stm_charset.result: Rename: mysql-test/r/rpl_stm_charset.result -> mysql-test/suite/rpl/r/rpl_stm_charset.result mysql-test/suite/rpl/r/rpl_trigger.result: Rename: mysql-test/r/rpl_trigger.result -> mysql-test/suite/rpl/r/rpl_trigger.result mysql-test/suite/rpl/t/rpl_auto_increment-master.opt: Rename: mysql-test/t/rpl_auto_increment-master.opt -> mysql-test/suite/rpl/t/rpl_auto_increment-master.opt mysql-test/suite/rpl/t/rpl_bit_npk.test: Rename: mysql-test/t/rpl_bit_npk.test -> mysql-test/suite/rpl/t/rpl_bit_npk.test mysql-test/suite/rpl/t/rpl_extraCol_innodb.test: Rename: mysql-test/t/rpl_extraCol_innodb.test -> mysql-test/suite/rpl/t/rpl_extraCol_innodb.test mysql-test/suite/rpl/t/rpl_free_items-slave.opt: Rename: mysql-test/t/rpl_free_items-slave.opt -> mysql-test/suite/rpl/t/rpl_free_items-slave.opt mysql-test/suite/rpl/t/rpl_init_slave.test: Rename: mysql-test/t/rpl_init_slave.test -> mysql-test/suite/rpl/t/rpl_init_slave.test mysql-test/suite/rpl/t/rpl_packet-slave.opt: Rename: mysql-test/t/rpl_packet-slave.opt -> mysql-test/suite/rpl/t/rpl_packet-slave.opt mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt: Rename: mysql-test/t/rpl_relay_space_innodb-slave.opt -> mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi: Rename: mysql-test/t/rpl_rotate_logs.slave-mi -> mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi mysql-test/suite/rpl/t/rpl_row_USER.test: Rename: mysql-test/t/rpl_row_USER.test -> mysql-test/suite/rpl/t/rpl_row_USER.test mysql-test/suite/rpl/t/rpl_row_delayed_ins.test: Rename: mysql-test/t/rpl_row_delayed_ins.test -> mysql-test/suite/rpl/t/rpl_row_delayed_ins.test mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt: Rename: mysql-test/t/rpl_row_sp002_innodb-slave.opt -> mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt mysql-test/suite/rpl/t/rpl_row_trig002.test: Rename: mysql-test/t/rpl_row_trig002.test -> mysql-test/suite/rpl/t/rpl_row_trig002.test mysql-test/suite/rpl/t/rpl_sf.test: Rename: mysql-test/t/rpl_sf.test -> mysql-test/suite/rpl/t/rpl_sf.test mysql-test/suite/rpl/t/rpl_stm_no_op.test: Rename: mysql-test/t/rpl_stm_no_op.test -> mysql-test/suite/rpl/t/rpl_stm_no_op.test mysql-test/suite/rpl/t/rpl_udf-slave.opt: Rename: mysql-test/t/rpl_udf-slave.opt -> mysql-test/suite/rpl/t/rpl_udf-slave.opt mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_partitions.result: Rename: mysql-test/r/rpl_ndb_dd_partitions.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_partitions.result mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result: Rename: mysql-test/r/rpl_ndb_multi.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result mysql-test/suite/rpl_ndb/r/rpl_ndb_rep_ignore.result: Rename: mysql-test/r/rpl_ndb_rep_ignore.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_rep_ignore.result mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result: Rename: mysql-test/r/rpl_ndb_sp006.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-slave.opt: Rename: mysql-test/t/rpl_ndb_2myisam-slave.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test: Rename: mysql-test/t/rpl_ndb_idempotent.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test: Rename: mysql-test/t/rpl_ndb_sp003.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test mysql-test/suite/binlog/r/binlog_row_binlog.result: Rename: mysql-test/r/binlog_row_binlog.result -> mysql-test/suite/binlog/r/binlog_row_binlog.result mysql-test/suite/binlog/r/binlog_stm_blackhole.result: Rename: mysql-test/r/binlog_stm_blackhole.result -> mysql-test/suite/binlog/r/binlog_stm_blackhole.result mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: Rename: mysql-test/r/binlog_stm_mix_innodb_myisam.result -> mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result mysql-test/suite/binlog/t/binlog_row_drop_tmp_tbl.test: Rename: mysql-test/t/binlog_row_drop_tmp_tbl.test -> mysql-test/suite/binlog/t/binlog_row_drop_tmp_tbl.test mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt: Rename: mysql-test/t/binlog_row_mix_innodb_myisam-master.opt -> mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt mysql-test/suite/binlog/t/binlog_statement_insert_delayed.test: Rename: mysql-test/t/binlog_statement_insert_delayed.test -> mysql-test/suite/binlog/t/binlog_statement_insert_delayed.test mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt: Rename: mysql-test/t/binlog_stm_binlog-master.opt -> mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt mysql-test/suite/ndb/r/ndb_alter_table2.result: Rename: mysql-test/r/ndb_alter_table2.result -> mysql-test/suite/ndb/r/ndb_alter_table2.result mysql-test/suite/ndb/r/ndb_blob.result: Rename: mysql-test/r/ndb_blob.result -> mysql-test/suite/ndb/r/ndb_blob.result mysql-test/suite/ndb/r/ndb_cache_multi2.result: Rename: mysql-test/r/ndb_cache_multi2.result -> mysql-test/suite/ndb/r/ndb_cache_multi2.result mysql-test/suite/ndb/r/ndb_config2.result: Rename: mysql-test/r/ndb_config2.result -> mysql-test/suite/ndb/r/ndb_config2.result mysql-test/suite/ndb/t/ndb_truncate.test: Rename: mysql-test/t/ndb_truncate.test -> mysql-test/suite/ndb/t/ndb_truncate.test mysql-test/suite/ndb/t/ndbapi.test: Rename: mysql-test/t/ndbapi.test -> mysql-test/suite/ndb/t/ndbapi.test mysql-test/suite/rpl/r/rpl_charset_sjis.result: Rename: mysql-test/r/rpl_charset_sjis.result -> mysql-test/suite/rpl/r/rpl_charset_sjis.result mysql-test/suite/rpl/r/rpl_extraCol_myisam.result: Rename: mysql-test/r/rpl_extraCol_myisam.result -> mysql-test/suite/rpl/r/rpl_extraCol_myisam.result mysql-test/suite/rpl/r/rpl_locale.result: Rename: mysql-test/r/rpl_locale.result -> mysql-test/suite/rpl/r/rpl_locale.result mysql-test/suite/rpl/r/rpl_multi_update2.result: Rename: mysql-test/r/rpl_multi_update2.result -> mysql-test/suite/rpl/r/rpl_multi_update2.result mysql-test/suite/rpl/r/rpl_relay_space_innodb.result: Rename: mysql-test/r/rpl_relay_space_innodb.result -> mysql-test/suite/rpl/r/rpl_relay_space_innodb.result mysql-test/suite/rpl/r/rpl_row_insert_delayed.result: Rename: mysql-test/r/rpl_row_insert_delayed.result -> mysql-test/suite/rpl/r/rpl_row_insert_delayed.result mysql-test/suite/rpl/r/rpl_row_log_innodb.result: Rename: mysql-test/r/rpl_row_log_innodb.result -> mysql-test/suite/rpl/r/rpl_row_log_innodb.result mysql-test/suite/rpl/r/rpl_row_multi_query.result: Rename: mysql-test/r/rpl_row_multi_query.result -> mysql-test/suite/rpl/r/rpl_row_multi_query.result mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result: Rename: mysql-test/r/rpl_row_tabledefs_3innodb.result -> mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result mysql-test/suite/rpl/r/rpl_row_trig003.result: Rename: mysql-test/r/rpl_row_trig003.result -> mysql-test/suite/rpl/r/rpl_row_trig003.result mysql-test/suite/rpl/r/rpl_row_until.result: Rename: mysql-test/r/rpl_row_until.result -> mysql-test/suite/rpl/r/rpl_row_until.result mysql-test/suite/rpl/t/rpl_empty_master_crash-master.opt: Rename: mysql-test/t/rpl_empty_master_crash-master.opt -> mysql-test/suite/rpl/t/rpl_empty_master_crash-master.opt mysql-test/suite/rpl/t/rpl_free_items.test: Rename: mysql-test/t/rpl_free_items.test -> mysql-test/suite/rpl/t/rpl_free_items.test mysql-test/suite/rpl/t/rpl_ps.test: Rename: mysql-test/t/rpl_ps.test -> mysql-test/suite/rpl/t/rpl_ps.test mysql-test/suite/rpl/t/rpl_relay_space_myisam.test: Rename: mysql-test/t/rpl_relay_space_myisam.test -> mysql-test/suite/rpl/t/rpl_relay_space_myisam.test mysql-test/suite/rpl/t/rpl_relayrotate.test: Rename: mysql-test/t/rpl_relayrotate.test -> mysql-test/suite/rpl/t/rpl_relayrotate.test mysql-test/suite/rpl/t/rpl_relayspace.test: Rename: mysql-test/t/rpl_relayspace.test -> mysql-test/suite/rpl/t/rpl_relayspace.test mysql-test/suite/rpl/t/rpl_row_sp003-master.opt: Rename: mysql-test/t/rpl_row_sp003-master.opt -> mysql-test/suite/rpl/t/rpl_row_sp003-master.opt mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result: Rename: mysql-test/r/rpl_ndb_sync.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result mysql-test/suite/rpl_ndb/r/rpl_ndbapi_multi.result: Rename: mysql-test/r/rpl_ndbapi_multi.result -> mysql-test/suite/rpl_ndb/r/rpl_ndbapi_multi.result mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test: Rename: mysql-test/t/rpl_ndb_2myisam.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test: Rename: mysql-test/t/rpl_ndb_func003.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test: Rename: mysql-test/t/rpl_ndb_innodb_trans.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test: Rename: mysql-test/t/rpl_ndb_load.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test: Rename: mysql-test/t/rpl_truncate_7ndb.test -> mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test: Rename: mysql-test/t/binlog_row_mix_innodb_myisam.test -> mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test mysql-test/suite/binlog/t/binlog_stm_binlog.test: Rename: mysql-test/t/binlog_stm_binlog.test -> mysql-test/suite/binlog/t/binlog_stm_binlog.test mysql-test/suite/binlog/t/binlog_stm_ctype_cp932.test: Rename: mysql-test/t/binlog_stm_ctype_cp932.test -> mysql-test/suite/binlog/t/binlog_stm_ctype_cp932.test mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt: Rename: mysql-test/t/binlog_stm_mix_innodb_myisam-master.opt -> mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test: Rename: mysql-test/t/binlog_stm_mix_innodb_myisam.test -> mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test mysql-test/suite/ndb/r/ndb_alter_table3.result: Rename: mysql-test/r/ndb_alter_table3.result -> mysql-test/suite/ndb/r/ndb_alter_table3.result mysql-test/suite/ndb/r/ndb_autodiscover2.result: Rename: mysql-test/r/ndb_autodiscover2.result -> mysql-test/suite/ndb/r/ndb_autodiscover2.result mysql-test/suite/ndb/r/ndb_backup_print.result: Rename: mysql-test/r/ndb_backup_print.result -> mysql-test/suite/ndb/r/ndb_backup_print.result mysql-test/suite/ndb/r/ndb_binlog_basic.result: Rename: mysql-test/r/ndb_binlog_basic.result -> mysql-test/suite/ndb/r/ndb_binlog_basic.result mysql-test/suite/ndb/r/ndb_condition_pushdown.result: Rename: mysql-test/r/ndb_condition_pushdown.result -> mysql-test/suite/ndb/r/ndb_condition_pushdown.result mysql-test/suite/ndb/r/ndb_dd_ddl.result: Rename: mysql-test/r/ndb_dd_ddl.result -> mysql-test/suite/ndb/r/ndb_dd_ddl.result mysql-test/suite/ndb/r/ndb_dd_dump.result: Rename: mysql-test/r/ndb_dd_dump.result -> mysql-test/suite/ndb/r/ndb_dd_dump.result mysql-test/suite/ndb/r/ndb_loaddatalocal.result: Rename: mysql-test/r/ndb_loaddatalocal.result -> mysql-test/suite/ndb/r/ndb_loaddatalocal.result mysql-test/suite/ndb/r/ndb_restore_compat.result: Rename: mysql-test/r/ndb_restore_compat.result -> mysql-test/suite/ndb/r/ndb_restore_compat.result mysql-test/suite/ndb/r/ndb_row_format.result: Rename: mysql-test/r/ndb_row_format.result -> mysql-test/suite/ndb/r/ndb_row_format.result mysql-test/suite/ndb/r/ndb_sp.result: Rename: mysql-test/r/ndb_sp.result -> mysql-test/suite/ndb/r/ndb_sp.result mysql-test/suite/ndb/r/ndb_temporary.result: Rename: mysql-test/r/ndb_temporary.result -> mysql-test/suite/ndb/r/ndb_temporary.result mysql-test/suite/ndb/r/ps_7ndb.result: Rename: mysql-test/r/ps_7ndb.result -> mysql-test/suite/ndb/r/ps_7ndb.result mysql-test/suite/ndb/t/ndb_binlog_ddl_multi.test: Rename: mysql-test/t/ndb_binlog_ddl_multi.test -> mysql-test/suite/ndb/t/ndb_binlog_ddl_multi.test mysql-test/suite/ndb/t/ndb_cache_multi2.test: Rename: mysql-test/t/ndb_cache_multi2.test -> mysql-test/suite/ndb/t/ndb_cache_multi2.test mysql-test/suite/ndb/t/ndb_charset.test: Rename: mysql-test/t/ndb_charset.test -> mysql-test/suite/ndb/t/ndb_charset.test mysql-test/suite/ndb/t/ndb_dd_sql_features.test: Rename: mysql-test/t/ndb_dd_sql_features.test -> mysql-test/suite/ndb/t/ndb_dd_sql_features.test mysql-test/suite/ndb/t/ndb_loaddatalocal.test: Rename: mysql-test/t/ndb_loaddatalocal.test -> mysql-test/suite/ndb/t/ndb_loaddatalocal.test mysql-test/suite/ndb/t/ndb_multi_row.test: Rename: mysql-test/t/ndb_multi_row.test -> mysql-test/suite/ndb/t/ndb_multi_row.test mysql-test/suite/ndb/t/ndb_restore.test: Rename: mysql-test/t/ndb_restore.test -> mysql-test/suite/ndb/t/ndb_restore.test mysql-test/suite/ndb/t/partition_03ndb.test: Rename: mysql-test/t/partition_03ndb.test -> mysql-test/suite/ndb/t/partition_03ndb.test mysql-test/suite/ndb/t/ps_7ndb.test: Rename: mysql-test/t/ps_7ndb.test -> mysql-test/suite/ndb/t/ps_7ndb.test mysql-test/suite/rpl/r/rpl000013.result: Rename: mysql-test/r/rpl000013.result -> mysql-test/suite/rpl/r/rpl000013.result mysql-test/suite/rpl/r/rpl_auto_increment_11932.result: Rename: mysql-test/r/rpl_auto_increment_11932.result -> mysql-test/suite/rpl/r/rpl_auto_increment_11932.result mysql-test/suite/rpl/r/rpl_change_master.result: Rename: mysql-test/r/rpl_change_master.result -> mysql-test/suite/rpl/r/rpl_change_master.result mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result: Rename: mysql-test/r/rpl_foreign_key_innodb.result -> mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result mysql-test/suite/rpl/r/rpl_insert_select.result: Rename: mysql-test/r/rpl_insert_select.result -> mysql-test/suite/rpl/r/rpl_insert_select.result mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result: Rename: mysql-test/r/rpl_mixed_ddl_dml.result -> mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result mysql-test/suite/rpl/r/rpl_replicate_do.result: Rename: mysql-test/r/rpl_replicate_do.result -> mysql-test/suite/rpl/r/rpl_replicate_do.result mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result: Rename: mysql-test/r/rpl_row_basic_2myisam.result -> mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result mysql-test/suite/rpl/r/rpl_row_sp011.result: Rename: mysql-test/r/rpl_row_sp011.result -> mysql-test/suite/rpl/r/rpl_row_sp011.result mysql-test/suite/rpl/r/rpl_row_trig004.result: Rename: mysql-test/r/rpl_row_trig004.result -> mysql-test/suite/rpl/r/rpl_row_trig004.result mysql-test/suite/rpl/r/rpl_slave_status.result: Rename: mysql-test/r/rpl_slave_status.result -> mysql-test/suite/rpl/r/rpl_slave_status.result mysql-test/suite/rpl/r/rpl_stm_log.result: Rename: mysql-test/r/rpl_stm_log.result -> mysql-test/suite/rpl/r/rpl_stm_log.result mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result: Rename: mysql-test/r/rpl_stm_max_relay_size.result -> mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result: Rename: mysql-test/r/rpl_switch_stm_row_mixed.result -> mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result mysql-test/suite/rpl/r/rpl_temp_table.result: Rename: mysql-test/r/rpl_temp_table.result -> mysql-test/suite/rpl/r/rpl_temp_table.result mysql-test/suite/rpl/r/rpl_timezone.result: Rename: mysql-test/r/rpl_timezone.result -> mysql-test/suite/rpl/r/rpl_timezone.result mysql-test/suite/rpl/t/rpl000017-slave.sh: Rename: mysql-test/t/rpl000017-slave.sh -> mysql-test/suite/rpl/t/rpl000017-slave.sh mysql-test/suite/rpl/t/rpl000018-slave.opt: Rename: mysql-test/t/rpl000018-slave.opt -> mysql-test/suite/rpl/t/rpl000018-slave.opt mysql-test/suite/rpl/t/rpl_auto_increment_11932.test: Rename: mysql-test/t/rpl_auto_increment_11932.test -> mysql-test/suite/rpl/t/rpl_auto_increment_11932.test mysql-test/suite/rpl/t/rpl_commit_after_flush.test: Rename: mysql-test/t/rpl_commit_after_flush.test -> mysql-test/suite/rpl/t/rpl_commit_after_flush.test mysql-test/suite/rpl/t/rpl_create_database-master.opt: Rename: mysql-test/t/rpl_create_database-master.opt -> mysql-test/suite/rpl/t/rpl_create_database-master.opt mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt: Rename: mysql-test/t/rpl_deadlock_innodb-slave.opt -> mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt mysql-test/suite/rpl/t/rpl_drop.test: Rename: mysql-test/t/rpl_drop.test -> mysql-test/suite/rpl/t/rpl_drop.test mysql-test/suite/rpl/t/rpl_empty_master_crash.test: Rename: mysql-test/t/rpl_empty_master_crash.test -> mysql-test/suite/rpl/t/rpl_empty_master_crash.test mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt: Rename: mysql-test/t/rpl_flushlog_loop-slave.opt -> mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt mysql-test/suite/rpl/t/rpl_ignore_table_update.test: Rename: mysql-test/t/rpl_ignore_table_update.test -> mysql-test/suite/rpl/t/rpl_ignore_table_update.test mysql-test/suite/rpl/t/rpl_innodb.test: Rename: mysql-test/t/rpl_innodb.test -> mysql-test/suite/rpl/t/rpl_innodb.test mysql-test/suite/rpl/t/rpl_known_bugs_detection.test: Rename: mysql-test/t/rpl_known_bugs_detection.test -> mysql-test/suite/rpl/t/rpl_known_bugs_detection.test mysql-test/suite/rpl/t/rpl_multi_update4-slave.opt: Rename: mysql-test/t/rpl_multi_update4-slave.opt -> mysql-test/suite/rpl/t/rpl_multi_update4-slave.opt mysql-test/suite/rpl/t/rpl_packet-master.opt: Rename: mysql-test/t/rpl_packet-master.opt -> mysql-test/suite/rpl/t/rpl_packet-master.opt mysql-test/suite/rpl/t/rpl_row_4_bytes-master.opt: Rename: mysql-test/t/rpl_row_4_bytes-master.opt -> mysql-test/suite/rpl/t/rpl_row_4_bytes-master.opt mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test: Rename: mysql-test/t/rpl_row_basic_3innodb.test -> mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test mysql-test/suite/rpl/t/rpl_row_func001.test: Rename: mysql-test/t/rpl_row_func001.test -> mysql-test/suite/rpl/t/rpl_row_func001.test mysql-test/suite/rpl/t/rpl_row_func003-slave.opt: Rename: mysql-test/t/rpl_row_func003-slave.opt -> mysql-test/suite/rpl/t/rpl_row_func003-slave.opt mysql-test/suite/rpl/t/rpl_row_until.test: Rename: mysql-test/t/rpl_row_until.test -> mysql-test/suite/rpl/t/rpl_row_until.test mysql-test/suite/rpl/t/rpl_set_charset.test: Rename: mysql-test/t/rpl_set_charset.test -> mysql-test/suite/rpl/t/rpl_set_charset.test mysql-test/suite/rpl/t/rpl_skip_error-slave.opt: Rename: mysql-test/t/rpl_skip_error-slave.opt -> mysql-test/suite/rpl/t/rpl_skip_error-slave.opt mysql-test/suite/rpl/t/rpl_slave_status.test: Rename: mysql-test/t/rpl_slave_status.test -> mysql-test/suite/rpl/t/rpl_slave_status.test mysql-test/suite/rpl/t/rpl_sp-master.opt: Rename: mysql-test/t/rpl_sp-master.opt -> mysql-test/suite/rpl/t/rpl_sp-master.opt mysql-test/suite/rpl/t/rpl_sp004.test: Rename: mysql-test/t/rpl_sp004.test -> mysql-test/suite/rpl/t/rpl_sp004.test mysql-test/suite/rpl/t/rpl_start_stop_slave.test: Rename: mysql-test/t/rpl_start_stop_slave.test -> mysql-test/suite/rpl/t/rpl_start_stop_slave.test mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test: Rename: mysql-test/t/rpl_stm_flsh_tbls.test -> mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test mysql-test/suite/rpl/t/rpl_stm_log.test: Rename: mysql-test/t/rpl_stm_log.test -> mysql-test/suite/rpl/t/rpl_stm_log.test mysql-test/suite/rpl/t/rpl_truncate_2myisam.test: Rename: mysql-test/t/rpl_truncate_2myisam.test -> mysql-test/suite/rpl/t/rpl_truncate_2myisam.test mysql-test/suite/rpl_ndb/r/rpl_ndb_UUID.result: Rename: mysql-test/r/rpl_ndb_UUID.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_UUID.result mysql-test/suite/rpl_ndb/r/rpl_ndb_insert_ignore.result: Rename: mysql-test/r/rpl_ndb_insert_ignore.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_insert_ignore.result mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test: Rename: mysql-test/t/rpl_ndb_circular.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test: Rename: mysql-test/t/rpl_ndb_commit_afterflush.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate.test: Rename: mysql-test/t/rpl_ndb_relayrotate.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate.test mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore-slave.opt: Rename: mysql-test/t/rpl_ndb_rep_ignore-slave.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore-slave.opt mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result: Rename: mysql-test/r/binlog_stm_ctype_ucs.result -> mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result mysql-test/suite/binlog/t/binlog_stm_drop_tmp_tbl.test: Rename: mysql-test/t/binlog_stm_drop_tmp_tbl.test -> mysql-test/suite/binlog/t/binlog_stm_drop_tmp_tbl.test mysql-test/suite/binlog/t/binlog_stm_innodb_stat-master.opt: Rename: mysql-test/t/binlog_stm_innodb_stat-master.opt -> mysql-test/suite/binlog/t/binlog_stm_innodb_stat-master.opt mysql-test/suite/ndb/r/loaddata_autocom_ndb.result: Rename: mysql-test/r/loaddata_autocom_ndb.result -> mysql-test/suite/ndb/r/loaddata_autocom_ndb.result mysql-test/suite/ndb/r/ndb_autodiscover3.result: Rename: mysql-test/r/ndb_autodiscover3.result -> mysql-test/suite/ndb/r/ndb_autodiscover3.result mysql-test/suite/ndb/r/ndb_binlog_basic2.result: Rename: mysql-test/r/ndb_binlog_basic2.result -> mysql-test/suite/ndb/r/ndb_binlog_basic2.result mysql-test/suite/ndb/r/ndb_blob_partition.result: Rename: mysql-test/r/ndb_blob_partition.result -> mysql-test/suite/ndb/r/ndb_blob_partition.result mysql-test/suite/ndb/r/ndb_insert.result: Rename: mysql-test/r/ndb_insert.result -> mysql-test/suite/ndb/r/ndb_insert.result mysql-test/suite/ndb/r/ndb_partition_error2.result: Rename: mysql-test/r/ndb_partition_error2.result -> mysql-test/suite/ndb/r/ndb_partition_error2.result mysql-test/suite/ndb/r/ndb_partition_list.result: Rename: mysql-test/r/ndb_partition_list.result -> mysql-test/suite/ndb/r/ndb_partition_list.result mysql-test/suite/ndb/r/ndb_restore_print.result: Rename: mysql-test/r/ndb_restore_print.result -> mysql-test/suite/ndb/r/ndb_restore_print.result mysql-test/suite/ndb/r/ndb_transaction.result: Rename: mysql-test/r/ndb_transaction.result -> mysql-test/suite/ndb/r/ndb_transaction.result mysql-test/suite/ndb/r/partition_03ndb.result: Rename: mysql-test/r/partition_03ndb.result -> mysql-test/suite/ndb/r/partition_03ndb.result mysql-test/suite/ndb/t/loaddata_autocom_ndb.test: Rename: mysql-test/t/loaddata_autocom_ndb.test -> mysql-test/suite/ndb/t/loaddata_autocom_ndb.test mysql-test/suite/ndb/t/ndb_autodiscover3.test: Rename: mysql-test/t/ndb_autodiscover3.test -> mysql-test/suite/ndb/t/ndb_autodiscover3.test mysql-test/suite/ndb/t/ndb_config2.test: Rename: mysql-test/t/ndb_config2.test -> mysql-test/suite/ndb/t/ndb_config2.test mysql-test/suite/ndb/t/ndb_cursor.test: Rename: mysql-test/t/ndb_cursor.test -> mysql-test/suite/ndb/t/ndb_cursor.test mysql-test/suite/ndb/t/ndb_database.test: Rename: mysql-test/t/ndb_database.test -> mysql-test/suite/ndb/t/ndb_database.test mysql-test/suite/ndb/t/ndb_index_ordered.test: Rename: mysql-test/t/ndb_index_ordered.test -> mysql-test/suite/ndb/t/ndb_index_ordered.test mysql-test/suite/ndb/t/ndb_restore_partition-master.opt: Rename: mysql-test/t/ndb_restore_partition-master.opt -> mysql-test/suite/ndb/t/ndb_restore_partition-master.opt mysql-test/suite/rpl/r/rpl_000015.result: Rename: mysql-test/r/rpl_000015.result -> mysql-test/suite/rpl/r/rpl_000015.result mysql-test/suite/rpl/r/rpl_bit_npk.result: Rename: mysql-test/r/rpl_bit_npk.result -> mysql-test/suite/rpl/r/rpl_bit_npk.result mysql-test/suite/rpl/r/rpl_critical_errors.result: Rename: mysql-test/r/rpl_critical_errors.result -> mysql-test/suite/rpl/r/rpl_critical_errors.result mysql-test/suite/rpl/r/rpl_delete_no_where.result: Rename: mysql-test/r/rpl_delete_no_where.result -> mysql-test/suite/rpl/r/rpl_delete_no_where.result mysql-test/suite/rpl/r/rpl_do_grant.result: Rename: mysql-test/r/rpl_do_grant.result -> mysql-test/suite/rpl/r/rpl_do_grant.result mysql-test/suite/rpl/r/rpl_events.result: Rename: mysql-test/r/rpl_events.result -> mysql-test/suite/rpl/r/rpl_events.result mysql-test/suite/rpl/r/rpl_get_lock.result: Rename: mysql-test/r/rpl_get_lock.result -> mysql-test/suite/rpl/r/rpl_get_lock.result mysql-test/suite/rpl/r/rpl_incident.result: Rename: mysql-test/r/rpl_incident.result -> mysql-test/suite/rpl/r/rpl_incident.result mysql-test/suite/rpl/r/rpl_init_slave.result: Rename: mysql-test/r/rpl_init_slave.result -> mysql-test/suite/rpl/r/rpl_init_slave.result mysql-test/suite/rpl/r/rpl_insert.result: Rename: mysql-test/r/rpl_insert.result -> mysql-test/suite/rpl/r/rpl_insert.result mysql-test/suite/rpl/r/rpl_insert_id.result: Rename: mysql-test/r/rpl_insert_id.result -> mysql-test/suite/rpl/r/rpl_insert_id.result mysql-test/suite/rpl/r/rpl_loaddata_s.result: Rename: mysql-test/r/rpl_loaddata_s.result -> mysql-test/suite/rpl/r/rpl_loaddata_s.result mysql-test/suite/rpl/r/rpl_multi_update4.result: Rename: mysql-test/r/rpl_multi_update4.result -> mysql-test/suite/rpl/r/rpl_multi_update4.result mysql-test/suite/rpl/r/rpl_optimize.result: Rename: mysql-test/r/rpl_optimize.result -> mysql-test/suite/rpl/r/rpl_optimize.result mysql-test/suite/rpl/r/rpl_row_blob_innodb.result: Rename: mysql-test/r/rpl_row_blob_innodb.result -> mysql-test/suite/rpl/r/rpl_row_blob_innodb.result mysql-test/suite/rpl/r/rpl_row_charset.result: Rename: mysql-test/r/rpl_row_charset.result -> mysql-test/suite/rpl/r/rpl_row_charset.result mysql-test/suite/rpl/r/rpl_row_drop.result: Rename: mysql-test/r/rpl_row_drop.result -> mysql-test/suite/rpl/r/rpl_row_drop.result mysql-test/suite/rpl/r/rpl_row_sp001.result: Rename: mysql-test/r/rpl_row_sp001.result -> mysql-test/suite/rpl/r/rpl_row_sp001.result mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result: Rename: mysql-test/r/rpl_row_sp006_InnoDB.result -> mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result mysql-test/suite/rpl/r/rpl_row_sp012.result: Rename: mysql-test/r/rpl_row_sp012.result -> mysql-test/suite/rpl/r/rpl_row_sp012.result mysql-test/suite/rpl/r/rpl_row_stop_middle.result: Rename: mysql-test/r/rpl_row_stop_middle.result -> mysql-test/suite/rpl/r/rpl_row_stop_middle.result mysql-test/suite/rpl/r/rpl_sp_effects.result: Rename: mysql-test/r/rpl_sp_effects.result -> mysql-test/suite/rpl/r/rpl_sp_effects.result mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result: Rename: mysql-test/r/rpl_stm_flsh_tbls.result -> mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result mysql-test/suite/rpl/r/rpl_stm_mystery22.result: Rename: mysql-test/r/rpl_stm_mystery22.result -> mysql-test/suite/rpl/r/rpl_stm_mystery22.result mysql-test/suite/rpl/t/rpl000010.test: Rename: mysql-test/t/rpl000010.test -> mysql-test/suite/rpl/t/rpl000010.test mysql-test/suite/rpl/t/rpl000017.test: Rename: mysql-test/t/rpl000017.test -> mysql-test/suite/rpl/t/rpl000017.test mysql-test/suite/rpl/t/rpl_000015.slave-mi: Rename: mysql-test/t/rpl_000015.slave-mi -> mysql-test/suite/rpl/t/rpl_000015.slave-mi mysql-test/suite/rpl/t/rpl_EE_err.test: Rename: mysql-test/t/rpl_EE_err.test -> mysql-test/suite/rpl/t/rpl_EE_err.test mysql-test/suite/rpl/t/rpl_LD_INFILE.test: Rename: mysql-test/t/rpl_LD_INFILE.test -> mysql-test/suite/rpl/t/rpl_LD_INFILE.test mysql-test/suite/rpl/t/rpl_charset_sjis.test: Rename: mysql-test/t/rpl_charset_sjis.test -> mysql-test/suite/rpl/t/rpl_charset_sjis.test mysql-test/suite/rpl/t/rpl_create_database-slave.opt: Rename: mysql-test/t/rpl_create_database-slave.opt -> mysql-test/suite/rpl/t/rpl_create_database-slave.opt mysql-test/suite/rpl/t/rpl_err_ignoredtable.test: Rename: mysql-test/t/rpl_err_ignoredtable.test -> mysql-test/suite/rpl/t/rpl_err_ignoredtable.test mysql-test/suite/rpl/t/rpl_extraCol_innodb-master.opt: Rename: mysql-test/t/rpl_extraCol_innodb-master.opt -> mysql-test/suite/rpl/t/rpl_extraCol_innodb-master.opt mysql-test/suite/rpl/t/rpl_extraCol_myisam.test: Rename: mysql-test/t/rpl_extraCol_myisam.test -> mysql-test/suite/rpl/t/rpl_extraCol_myisam.test mysql-test/suite/rpl/t/rpl_failed_optimize.test: Rename: mysql-test/t/rpl_failed_optimize.test -> mysql-test/suite/rpl/t/rpl_failed_optimize.test mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt: Rename: mysql-test/t/rpl_foreign_key_innodb-slave.opt -> mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt mysql-test/suite/rpl/t/rpl_insert_id-slave.opt: Rename: mysql-test/t/rpl_insert_id-slave.opt -> mysql-test/suite/rpl/t/rpl_insert_id-slave.opt mysql-test/suite/rpl/t/rpl_load_table_from_master.test: Rename: mysql-test/t/rpl_load_table_from_master.test -> mysql-test/suite/rpl/t/rpl_load_table_from_master.test mysql-test/suite/rpl/t/rpl_loaddata.test: Rename: mysql-test/t/rpl_loaddata.test -> mysql-test/suite/rpl/t/rpl_loaddata.test mysql-test/suite/rpl/t/rpl_loaddata_s.test: Rename: mysql-test/t/rpl_loaddata_s.test -> mysql-test/suite/rpl/t/rpl_loaddata_s.test mysql-test/suite/rpl/t/rpl_master_pos_wait.test: Rename: mysql-test/t/rpl_master_pos_wait.test -> mysql-test/suite/rpl/t/rpl_master_pos_wait.test mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh: Rename: mysql-test/t/rpl_misc_functions-slave.sh -> mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh mysql-test/suite/rpl/t/rpl_multi_update2.test: Rename: mysql-test/t/rpl_multi_update2.test -> mysql-test/suite/rpl/t/rpl_multi_update2.test mysql-test/suite/rpl/t/rpl_packet.test: Rename: mysql-test/t/rpl_packet.test -> mysql-test/suite/rpl/t/rpl_packet.test mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt: Rename: mysql-test/t/rpl_relay_space_innodb-master.opt -> mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt: Rename: mysql-test/t/rpl_row_basic_11bugs-slave.opt -> mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt: Rename: mysql-test/t/rpl_row_inexist_tbl-slave.opt -> mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt mysql-test/suite/rpl/t/rpl_row_insert_delayed.test: Rename: mysql-test/t/rpl_row_insert_delayed.test -> mysql-test/suite/rpl/t/rpl_row_insert_delayed.test mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt: Rename: mysql-test/t/rpl_row_log_innodb-slave.opt -> mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt mysql-test/suite/rpl/t/rpl_row_max_relay_size.test: Rename: mysql-test/t/rpl_row_max_relay_size.test -> mysql-test/suite/rpl/t/rpl_row_max_relay_size.test mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test: Rename: mysql-test/t/rpl_row_sp002_innodb.test -> mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt: Rename: mysql-test/t/rpl_row_sp003-slave.opt -> mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt: Rename: mysql-test/t/rpl_row_sp006_InnoDB-slave.opt -> mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt mysql-test/suite/rpl/t/rpl_row_sp012.test: Rename: mysql-test/t/rpl_row_sp012.test -> mysql-test/suite/rpl/t/rpl_row_sp012.test mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test: Rename: mysql-test/t/rpl_row_stop_middle_update.test -> mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test: Rename: mysql-test/t/rpl_row_tabledefs_2myisam.test -> mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test mysql-test/suite/rpl/t/rpl_row_trig003.test: Rename: mysql-test/t/rpl_row_trig003.test -> mysql-test/suite/rpl/t/rpl_row_trig003.test mysql-test/suite/rpl/t/rpl_server_id2.test: Rename: mysql-test/t/rpl_server_id2.test -> mysql-test/suite/rpl/t/rpl_server_id2.test mysql-test/suite/rpl/t/rpl_sporadic_master.test: Rename: mysql-test/t/rpl_sporadic_master.test -> mysql-test/suite/rpl/t/rpl_sporadic_master.test mysql-test/suite/rpl/t/rpl_stm_000001.test: Rename: mysql-test/t/rpl_stm_000001.test -> mysql-test/suite/rpl/t/rpl_stm_000001.test mysql-test/suite/rpl/t/rpl_stm_reset_slave.test: Rename: mysql-test/t/rpl_stm_reset_slave.test -> mysql-test/suite/rpl/t/rpl_stm_reset_slave.test mysql-test/suite/rpl/t/rpl_temp_table.test: Rename: mysql-test/t/rpl_temp_table.test -> mysql-test/suite/rpl/t/rpl_temp_table.test mysql-test/suite/rpl/t/rpl_timezone-slave.opt: Rename: mysql-test/t/rpl_timezone-slave.opt -> mysql-test/suite/rpl/t/rpl_timezone-slave.opt mysql-test/suite/rpl_ndb/r/rpl_ndb_2innodb.result: Rename: mysql-test/r/rpl_ndb_2innodb.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_2innodb.result mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result: Rename: mysql-test/r/rpl_ndb_circular.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result: Rename: mysql-test/r/rpl_ndb_innodb_trans.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test: Rename: mysql-test/t/rpl_ndb_blob2.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table-slave.opt: Rename: mysql-test/t/rpl_ndb_do_table-slave.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb.test: Rename: mysql-test/t/rpl_ndb_innodb2ndb.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb.test mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test: Rename: mysql-test/t/rpl_ndb_insert_ignore.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test: Rename: mysql-test/t/rpl_ndb_multi_update3.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb.test: Rename: mysql-test/t/rpl_ndb_myisam2ndb.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb.test mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result: Rename: mysql-test/r/binlog_stm_drop_tmp_tbl.result -> mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result mysql-test/suite/binlog/r/binlog_stm_innodb_stat.result: Rename: mysql-test/r/binlog_stm_innodb_stat.result -> mysql-test/suite/binlog/r/binlog_stm_innodb_stat.result mysql-test/suite/binlog/t/binlog_stm_blackhole.test: Rename: mysql-test/t/binlog_stm_blackhole.test -> mysql-test/suite/binlog/t/binlog_stm_blackhole.test mysql-test/suite/binlog/t/binlog_stm_insert_select.test: Rename: mysql-test/t/binlog_stm_insert_select.test -> mysql-test/suite/binlog/t/binlog_stm_insert_select.test mysql-test/suite/ndb/r/ndb_binlog_discover.result: Rename: mysql-test/r/ndb_binlog_discover.result -> mysql-test/suite/ndb/r/ndb_binlog_discover.result mysql-test/suite/ndb/r/ndb_bitfield.result: Rename: mysql-test/r/ndb_bitfield.result -> mysql-test/suite/ndb/r/ndb_bitfield.result mysql-test/suite/ndb/r/ndb_minmax.result: Rename: mysql-test/r/ndb_minmax.result -> mysql-test/suite/ndb/r/ndb_minmax.result mysql-test/suite/ndb/r/ndb_single_user.result: Rename: mysql-test/r/ndb_single_user.result -> mysql-test/suite/ndb/r/ndb_single_user.result mysql-test/suite/ndb/r/ndb_subquery.result: Rename: mysql-test/r/ndb_subquery.result -> mysql-test/suite/ndb/r/ndb_subquery.result mysql-test/suite/ndb/t/ndb_binlog_log_bin.test: Rename: mysql-test/t/ndb_binlog_log_bin.test -> mysql-test/suite/ndb/t/ndb_binlog_log_bin.test mysql-test/suite/ndb/t/ndb_config.test: Rename: mysql-test/t/ndb_config.test -> mysql-test/suite/ndb/t/ndb_config.test mysql-test/suite/ndb/t/ndb_replace.test: Rename: mysql-test/t/ndb_replace.test -> mysql-test/suite/ndb/t/ndb_replace.test mysql-test/suite/ndb/t/ndb_transaction.test: Rename: mysql-test/t/ndb_transaction.test -> mysql-test/suite/ndb/t/ndb_transaction.test mysql-test/suite/ndb/t/ndb_trigger.test: Rename: mysql-test/t/ndb_trigger.test -> mysql-test/suite/ndb/t/ndb_trigger.test mysql-test/suite/ndb/t/ndb_view.test: Rename: mysql-test/t/ndb_view.test -> mysql-test/suite/ndb/t/ndb_view.test mysql-test/suite/rpl/r/rpl000011.result: Rename: mysql-test/r/rpl000011.result -> mysql-test/suite/rpl/r/rpl000011.result mysql-test/suite/rpl/r/rpl_free_items.result: Rename: mysql-test/r/rpl_free_items.result -> mysql-test/suite/rpl/r/rpl_free_items.result mysql-test/suite/rpl/r/rpl_ignore_revoke.result: Rename: mysql-test/r/rpl_ignore_revoke.result -> mysql-test/suite/rpl/r/rpl_ignore_revoke.result mysql-test/suite/rpl/r/rpl_innodb.result: Rename: mysql-test/r/rpl_innodb.result -> mysql-test/suite/rpl/r/rpl_innodb.result mysql-test/suite/rpl/r/rpl_loadfile.result: Rename: mysql-test/r/rpl_loadfile.result -> mysql-test/suite/rpl/r/rpl_loadfile.result mysql-test/suite/rpl/r/rpl_multi_update.result: Rename: mysql-test/r/rpl_multi_update.result -> mysql-test/suite/rpl/r/rpl_multi_update.result mysql-test/suite/rpl/r/rpl_ps.result: Rename: mysql-test/r/rpl_ps.result -> mysql-test/suite/rpl/r/rpl_ps.result mysql-test/suite/rpl/r/rpl_read_only.result: Rename: mysql-test/r/rpl_read_only.result -> mysql-test/suite/rpl/r/rpl_read_only.result mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result: Rename: mysql-test/r/rpl_replicate_ignore_db.result -> mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result mysql-test/suite/rpl/r/rpl_row_4_bytes.result: Rename: mysql-test/r/rpl_row_4_bytes.result -> mysql-test/suite/rpl/r/rpl_row_4_bytes.result mysql-test/suite/rpl/r/rpl_row_USER.result: Rename: mysql-test/r/rpl_row_USER.result -> mysql-test/suite/rpl/r/rpl_row_USER.result mysql-test/suite/rpl/r/rpl_row_UUID.result: Rename: mysql-test/r/rpl_row_UUID.result -> mysql-test/suite/rpl/r/rpl_row_UUID.result mysql-test/suite/rpl/r/rpl_row_blob_myisam.result: Rename: mysql-test/r/rpl_row_blob_myisam.result -> mysql-test/suite/rpl/r/rpl_row_blob_myisam.result mysql-test/suite/rpl/r/rpl_row_err_ignoredtable.result: Rename: mysql-test/r/rpl_row_err_ignoredtable.result -> mysql-test/suite/rpl/r/rpl_row_err_ignoredtable.result mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result: Rename: mysql-test/r/rpl_row_sp002_innodb.result -> mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result: Rename: mysql-test/r/rpl_row_sp007_innodb.result -> mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result mysql-test/suite/rpl/r/rpl_ssl1.result: Rename: mysql-test/r/rpl_ssl1.result -> mysql-test/suite/rpl/r/rpl_ssl1.result mysql-test/suite/rpl/r/rpl_stm_000001.result: Rename: mysql-test/r/rpl_stm_000001.result -> mysql-test/suite/rpl/r/rpl_stm_000001.result mysql-test/suite/rpl/r/rpl_truncate_2myisam.result: Rename: mysql-test/r/rpl_truncate_2myisam.result -> mysql-test/suite/rpl/r/rpl_truncate_2myisam.result mysql-test/suite/rpl/t/rpl000018-master.opt: Rename: mysql-test/t/rpl000018-master.opt -> mysql-test/suite/rpl/t/rpl000018-master.opt mysql-test/suite/rpl/t/rpl_000015.test: Rename: mysql-test/t/rpl_000015.test -> mysql-test/suite/rpl/t/rpl_000015.test mysql-test/suite/rpl/t/rpl_drop_temp.test: Rename: mysql-test/t/rpl_drop_temp.test -> mysql-test/suite/rpl/t/rpl_drop_temp.test mysql-test/suite/rpl/t/rpl_err_ignoredtable-slave.opt: Rename: mysql-test/t/rpl_err_ignoredtable-slave.opt -> mysql-test/suite/rpl/t/rpl_err_ignoredtable-slave.opt mysql-test/suite/rpl/t/rpl_failed_optimize-master.opt: Rename: mysql-test/t/rpl_failed_optimize-master.opt -> mysql-test/suite/rpl/t/rpl_failed_optimize-master.opt mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test: Rename: mysql-test/t/rpl_foreign_key_innodb.test -> mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test mysql-test/suite/rpl/t/rpl_ignore_table.test: Rename: mysql-test/t/rpl_ignore_table.test -> mysql-test/suite/rpl/t/rpl_ignore_table.test mysql-test/suite/rpl/t/rpl_ignore_table_update-slave.opt: Rename: mysql-test/t/rpl_ignore_table_update-slave.opt -> mysql-test/suite/rpl/t/rpl_ignore_table_update-slave.opt mysql-test/suite/rpl/t/rpl_incident-master.opt: Rename: mysql-test/t/rpl_incident-master.opt -> mysql-test/suite/rpl/t/rpl_incident-master.opt mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt: Rename: mysql-test/t/rpl_insert_id_pk-slave.opt -> mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt mysql-test/suite/rpl/t/rpl_loaddata_m-master.opt: Rename: mysql-test/t/rpl_loaddata_m-master.opt -> mysql-test/suite/rpl/t/rpl_loaddata_m-master.opt mysql-test/suite/rpl/t/rpl_loaddatalocal.test: Rename: mysql-test/t/rpl_loaddatalocal.test -> mysql-test/suite/rpl/t/rpl_loaddatalocal.test mysql-test/suite/rpl/t/rpl_misc_functions.test: Rename: mysql-test/t/rpl_misc_functions.test -> mysql-test/suite/rpl/t/rpl_misc_functions.test mysql-test/suite/rpl/t/rpl_multi_update.test: Rename: mysql-test/t/rpl_multi_update.test -> mysql-test/suite/rpl/t/rpl_multi_update.test mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test: Rename: mysql-test/t/rpl_row_basic_11bugs.test -> mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt: Rename: mysql-test/t/rpl_row_blob_innodb-slave.opt -> mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt mysql-test/suite/rpl/t/rpl_row_log-master.opt: Rename: mysql-test/t/rpl_row_log-master.opt -> mysql-test/suite/rpl/t/rpl_row_log-master.opt mysql-test/suite/rpl/t/rpl_row_sp001.test: Rename: mysql-test/t/rpl_row_sp001.test -> mysql-test/suite/rpl/t/rpl_row_sp001.test mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt: Rename: mysql-test/t/rpl_row_sp002_innodb-master.opt -> mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt mysql-test/suite/rpl/t/rpl_row_sp008.test: Rename: mysql-test/t/rpl_row_sp008.test -> mysql-test/suite/rpl/t/rpl_row_sp008.test mysql-test/suite/rpl/t/rpl_sp-slave.opt: Rename: mysql-test/t/rpl_sp-slave.opt -> mysql-test/suite/rpl/t/rpl_sp-slave.opt mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt: Rename: mysql-test/t/rpl_stm_000001-slave.opt -> mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt mysql-test/suite/rpl/t/rpl_timezone.test: Rename: mysql-test/t/rpl_timezone.test -> mysql-test/suite/rpl/t/rpl_timezone.test mysql-test/suite/rpl_ndb/r/rpl_ndb_2myisam.result: Rename: mysql-test/r/rpl_ndb_2myisam.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_2myisam.result mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result: Rename: mysql-test/r/rpl_ndb_basic.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result: Rename: mysql-test/r/rpl_ndb_extraCol.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result: Rename: mysql-test/r/rpl_ndb_idempotent.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result: Rename: mysql-test/r/rpl_ndb_log.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result: Rename: mysql-test/r/rpl_ndb_row_001.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result: Rename: mysql-test/r/rpl_ndb_stm_innodb.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt: Rename: mysql-test/t/rpl_ndb_2innodb-slave.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test: Rename: mysql-test/t/rpl_ndb_blob.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test: Rename: mysql-test/t/rpl_ndb_dd_advance.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans-slave.opt: Rename: mysql-test/t/rpl_ndb_innodb_trans-slave.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb-slave.opt: Rename: mysql-test/t/rpl_ndb_myisam2ndb-slave.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test: Rename: mysql-test/t/rpl_ndb_rep_ignore.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test: Rename: mysql-test/t/rpl_ndb_stm_innodb.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test: Rename: mysql-test/t/rpl_ndbapi_multi.test -> mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test mysql-test/suite/binlog/r/binlog_killed.result: Rename: mysql-test/r/binlog_killed.result -> mysql-test/suite/binlog/r/binlog_killed.result mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result: Rename: mysql-test/r/binlog_row_ctype_ucs.result -> mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result mysql-test/suite/binlog/r/binlog_stm_binlog.result: Rename: mysql-test/r/binlog_stm_binlog.result -> mysql-test/suite/binlog/r/binlog_stm_binlog.result mysql-test/suite/binlog/t/binlog_row_ctype_ucs.test: Rename: mysql-test/t/binlog_row_ctype_ucs.test -> mysql-test/suite/binlog/t/binlog_row_ctype_ucs.test mysql-test/suite/binlog/t/binlog_stm_innodb_stat.test: Rename: mysql-test/t/binlog_stm_innodb_stat.test -> mysql-test/suite/binlog/t/binlog_stm_innodb_stat.test mysql-test/suite/binlog/t/binlog_stm_ps.test: Rename: mysql-test/t/binlog_stm_ps.test -> mysql-test/suite/binlog/t/binlog_stm_ps.test mysql-test/suite/ndb/r/ndb_cache.result: Rename: mysql-test/r/ndb_cache.result -> mysql-test/suite/ndb/r/ndb_cache.result mysql-test/suite/ndb/r/ndb_charset.result: Rename: mysql-test/r/ndb_charset.result -> mysql-test/suite/ndb/r/ndb_charset.result mysql-test/suite/ndb/r/ndb_config.result: Rename: mysql-test/r/ndb_config.result -> mysql-test/suite/ndb/r/ndb_config.result mysql-test/suite/ndb/r/ndb_dd_disk2memory.result: Rename: mysql-test/r/ndb_dd_disk2memory.result -> mysql-test/suite/ndb/r/ndb_dd_disk2memory.result mysql-test/suite/ndb/r/ndb_index.result: Rename: mysql-test/r/ndb_index.result -> mysql-test/suite/ndb/r/ndb_index.result mysql-test/suite/ndb/r/ndb_partition_key.result: Rename: mysql-test/r/ndb_partition_key.result -> mysql-test/suite/ndb/r/ndb_partition_key.result mysql-test/suite/ndb/r/strict_autoinc_5ndb.result: Rename: mysql-test/r/strict_autoinc_5ndb.result -> mysql-test/suite/ndb/r/strict_autoinc_5ndb.result mysql-test/suite/ndb/t/ndb_backup_print.test: Rename: mysql-test/t/ndb_backup_print.test -> mysql-test/suite/ndb/t/ndb_backup_print.test mysql-test/suite/ndb/t/ndb_binlog_basic2.test: Rename: mysql-test/t/ndb_binlog_basic2.test -> mysql-test/suite/ndb/t/ndb_binlog_basic2.test mysql-test/suite/ndb/t/ndb_binlog_ignore_db.test: Rename: mysql-test/t/ndb_binlog_ignore_db.test -> mysql-test/suite/ndb/t/ndb_binlog_ignore_db.test mysql-test/suite/ndb/t/ndb_insert.test: Rename: mysql-test/t/ndb_insert.test -> mysql-test/suite/ndb/t/ndb_insert.test mysql-test/suite/ndb/t/ndb_load.test: Rename: mysql-test/t/ndb_load.test -> mysql-test/suite/ndb/t/ndb_load.test mysql-test/suite/ndb/t/ndb_multi.test: Rename: mysql-test/t/ndb_multi.test -> mysql-test/suite/ndb/t/ndb_multi.test mysql-test/suite/ndb/t/ndb_partition_error.test: Rename: mysql-test/t/ndb_partition_error.test -> mysql-test/suite/ndb/t/ndb_partition_error.test mysql-test/suite/ndb/t/ndb_partition_error2.test: Rename: mysql-test/t/ndb_partition_error2.test -> mysql-test/suite/ndb/t/ndb_partition_error2.test mysql-test/suite/ndb/t/ndb_partition_key.test: Rename: mysql-test/t/ndb_partition_key.test -> mysql-test/suite/ndb/t/ndb_partition_key.test mysql-test/suite/ndb/t/ndb_rename.test: Rename: mysql-test/t/ndb_rename.test -> mysql-test/suite/ndb/t/ndb_rename.test mysql-test/suite/ndb/t/ndb_single_user.test: Rename: mysql-test/t/ndb_single_user.test -> mysql-test/suite/ndb/t/ndb_single_user.test mysql-test/suite/rpl/r/rpl000010.result: Rename: mysql-test/r/rpl000010.result -> mysql-test/suite/rpl/r/rpl000010.result mysql-test/suite/rpl/r/rpl_EE_err.result: Rename: mysql-test/r/rpl_EE_err.result -> mysql-test/suite/rpl/r/rpl_EE_err.result mysql-test/suite/rpl/r/rpl_ddl.result: Rename: mysql-test/r/rpl_ddl.result -> mysql-test/suite/rpl/r/rpl_ddl.result mysql-test/suite/rpl/r/rpl_deadlock_innodb.result: Rename: mysql-test/r/rpl_deadlock_innodb.result -> mysql-test/suite/rpl/r/rpl_deadlock_innodb.result mysql-test/suite/rpl/r/rpl_drop.result: Rename: mysql-test/r/rpl_drop.result -> mysql-test/suite/rpl/r/rpl_drop.result mysql-test/suite/rpl/r/rpl_drop_temp.result: Rename: mysql-test/r/rpl_drop_temp.result -> mysql-test/suite/rpl/r/rpl_drop_temp.result mysql-test/suite/rpl/r/rpl_many_optimize.result: Rename: mysql-test/r/rpl_many_optimize.result -> mysql-test/suite/rpl/r/rpl_many_optimize.result mysql-test/suite/rpl/r/rpl_multi_engine.result: Rename: mysql-test/r/rpl_multi_engine.result -> mysql-test/suite/rpl/r/rpl_multi_engine.result mysql-test/suite/rpl/r/rpl_packet.result: Rename: mysql-test/r/rpl_packet.result -> mysql-test/suite/rpl/r/rpl_packet.result mysql-test/suite/rpl/r/rpl_relayrotate.result: Rename: mysql-test/r/rpl_relayrotate.result -> mysql-test/suite/rpl/r/rpl_relayrotate.result mysql-test/suite/rpl/r/rpl_row_basic_8partition.result: Rename: mysql-test/r/rpl_row_basic_8partition.result -> mysql-test/suite/rpl/r/rpl_row_basic_8partition.result mysql-test/suite/rpl/r/rpl_row_log.result: Rename: mysql-test/r/rpl_row_log.result -> mysql-test/suite/rpl/r/rpl_row_log.result mysql-test/suite/rpl/r/rpl_row_sp003.result: Rename: mysql-test/r/rpl_row_sp003.result -> mysql-test/suite/rpl/r/rpl_row_sp003.result mysql-test/suite/rpl/r/rpl_row_view01.result: Rename: mysql-test/r/rpl_row_view01.result -> mysql-test/suite/rpl/r/rpl_row_view01.result mysql-test/suite/rpl/r/rpl_session_var.result: Rename: mysql-test/r/rpl_session_var.result -> mysql-test/suite/rpl/r/rpl_session_var.result mysql-test/suite/rpl/r/rpl_sporadic_master.result: Rename: mysql-test/r/rpl_sporadic_master.result -> mysql-test/suite/rpl/r/rpl_sporadic_master.result mysql-test/suite/rpl/r/rpl_udf.result: Rename: mysql-test/r/rpl_udf.result -> mysql-test/suite/rpl/r/rpl_udf.result mysql-test/suite/rpl/r/rpl_variables.result: Rename: mysql-test/r/rpl_variables.result -> mysql-test/suite/rpl/r/rpl_variables.result mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt: Rename: mysql-test/t/rpl_auto_increment-slave.opt -> mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt mysql-test/suite/rpl/t/rpl_auto_increment.test: Rename: mysql-test/t/rpl_auto_increment.test -> mysql-test/suite/rpl/t/rpl_auto_increment.test mysql-test/suite/rpl/t/rpl_bit.test: Rename: mysql-test/t/rpl_bit.test -> mysql-test/suite/rpl/t/rpl_bit.test mysql-test/suite/rpl/t/rpl_critical_errors.test: Rename: mysql-test/t/rpl_critical_errors.test -> mysql-test/suite/rpl/t/rpl_critical_errors.test mysql-test/suite/rpl/t/rpl_ddl.test: Rename: mysql-test/t/rpl_ddl.test -> mysql-test/suite/rpl/t/rpl_ddl.test mysql-test/suite/rpl/t/rpl_do_grant.test: Rename: mysql-test/t/rpl_do_grant.test -> mysql-test/suite/rpl/t/rpl_do_grant.test mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt: Rename: mysql-test/t/rpl_extraCol_innodb-slave.opt -> mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt mysql-test/suite/rpl/t/rpl_ignore_revoke.test: Rename: mysql-test/t/rpl_ignore_revoke.test -> mysql-test/suite/rpl/t/rpl_ignore_revoke.test mysql-test/suite/rpl/t/rpl_init_slave-slave.opt: Rename: mysql-test/t/rpl_init_slave-slave.opt -> mysql-test/suite/rpl/t/rpl_init_slave-slave.opt mysql-test/suite/rpl/t/rpl_log_pos.test: Rename: mysql-test/t/rpl_log_pos.test -> mysql-test/suite/rpl/t/rpl_log_pos.test mysql-test/suite/rpl/t/rpl_multi_delete2-slave.opt: Rename: mysql-test/t/rpl_multi_delete2-slave.opt -> mysql-test/suite/rpl/t/rpl_multi_delete2-slave.opt mysql-test/suite/rpl/t/rpl_multi_update3.test: Rename: mysql-test/t/rpl_multi_update3.test -> mysql-test/suite/rpl/t/rpl_multi_update3.test mysql-test/suite/rpl/t/rpl_optimize.test: Rename: mysql-test/t/rpl_optimize.test -> mysql-test/suite/rpl/t/rpl_optimize.test mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test: Rename: mysql-test/t/rpl_rbr_to_sbr.test -> mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test mysql-test/suite/rpl/t/rpl_replicate_do-slave.opt: Rename: mysql-test/t/rpl_replicate_do-slave.opt -> mysql-test/suite/rpl/t/rpl_replicate_do-slave.opt mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt: Rename: mysql-test/t/rpl_rewrt_db-slave.opt -> mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh: Rename: mysql-test/t/rpl_rotate_logs-slave.sh -> mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh mysql-test/suite/rpl/t/rpl_row_UUID.test: Rename: mysql-test/t/rpl_row_UUID.test -> mysql-test/suite/rpl/t/rpl_row_UUID.test mysql-test/suite/rpl/t/rpl_row_blob_innodb.test: Rename: mysql-test/t/rpl_row_blob_innodb.test -> mysql-test/suite/rpl/t/rpl_row_blob_innodb.test mysql-test/suite/rpl/t/rpl_row_create_table.test: Rename: mysql-test/t/rpl_row_create_table.test -> mysql-test/suite/rpl/t/rpl_row_create_table.test mysql-test/suite/rpl/t/rpl_row_func002.test: Rename: mysql-test/t/rpl_row_func002.test -> mysql-test/suite/rpl/t/rpl_row_func002.test mysql-test/suite/rpl/t/rpl_row_log.test: Rename: mysql-test/t/rpl_row_log.test -> mysql-test/suite/rpl/t/rpl_row_log.test mysql-test/suite/rpl/t/rpl_row_log_innodb-master.opt: Rename: mysql-test/t/rpl_row_log_innodb-master.opt -> mysql-test/suite/rpl/t/rpl_row_log_innodb-master.opt mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test: Rename: mysql-test/t/rpl_row_mysqlbinlog.test -> mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test mysql-test/suite/rpl/t/rpl_row_sp005.test: Rename: mysql-test/t/rpl_row_sp005.test -> mysql-test/suite/rpl/t/rpl_row_sp005.test mysql-test/suite/rpl/t/rpl_server_id2-slave.opt: Rename: mysql-test/t/rpl_server_id2-slave.opt -> mysql-test/suite/rpl/t/rpl_server_id2-slave.opt mysql-test/suite/rpl/t/rpl_sp.test: Rename: mysql-test/t/rpl_sp.test -> mysql-test/suite/rpl/t/rpl_sp.test mysql-test/suite/rpl/t/rpl_ssl.test: Rename: mysql-test/t/rpl_ssl.test -> mysql-test/suite/rpl/t/rpl_ssl.test mysql-test/suite/rpl/t/rpl_stm_EE_err2.test: Rename: mysql-test/t/rpl_stm_EE_err2.test -> mysql-test/suite/rpl/t/rpl_stm_EE_err2.test mysql-test/suite/rpl/t/rpl_stm_multi_query.test: Rename: mysql-test/t/rpl_stm_multi_query.test -> mysql-test/suite/rpl/t/rpl_stm_multi_query.test mysql-test/suite/rpl/t/rpl_udf-master.opt: Rename: mysql-test/t/rpl_udf-master.opt -> mysql-test/suite/rpl/t/rpl_udf-master.opt mysql-test/suite/rpl/t/rpl_udf.test: Rename: mysql-test/t/rpl_udf.test -> mysql-test/suite/rpl/t/rpl_udf.test mysql-test/suite/rpl/t/rpl_user_variables.test: Rename: mysql-test/t/rpl_user_variables.test -> mysql-test/suite/rpl/t/rpl_user_variables.test mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result: Rename: mysql-test/r/rpl_ndb_dd_basic.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result: Rename: mysql-test/r/rpl_ndb_ddl.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result mysql-test/suite/rpl_ndb/r/rpl_ndb_do_table.result: Rename: mysql-test/r/rpl_ndb_do_table.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_do_table.result mysql-test/suite/rpl_ndb/r/rpl_ndb_func003.result: Rename: mysql-test/r/rpl_ndb_func003.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_func003.result mysql-test/suite/rpl_ndb/r/rpl_ndb_load.result: Rename: mysql-test/r/rpl_ndb_load.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_load.result mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update2.result: Rename: mysql-test/r/rpl_ndb_multi_update2.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update2.result mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update3.result: Rename: mysql-test/r/rpl_ndb_multi_update3.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update3.result mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result: Rename: mysql-test/r/rpl_row_basic_7ndb.result -> mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-master.opt: Rename: mysql-test/t/rpl_ndb_2myisam-master.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-master.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test: Rename: mysql-test/t/rpl_ndb_auto_inc.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test: Rename: mysql-test/t/rpl_ndb_basic.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_partitions.test: Rename: mysql-test/t/rpl_ndb_dd_partitions.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_partitions.test mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test: Rename: mysql-test/t/rpl_ndb_log.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb-master.opt: Rename: mysql-test/t/rpl_ndb_myisam2ndb-master.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb-master.opt mysql-test/suite/rpl_ndb/t/rpl_row_basic_7ndb.test: Rename: mysql-test/t/rpl_row_basic_7ndb.test -> mysql-test/suite/rpl_ndb/t/rpl_row_basic_7ndb.test mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result: Rename: mysql-test/r/binlog_row_drop_tmp_tbl.result -> mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result mysql-test/suite/binlog/r/binlog_row_innodb_stat.result: Rename: mysql-test/r/binlog_row_innodb_stat.result -> mysql-test/suite/binlog/r/binlog_row_innodb_stat.result mysql-test/suite/binlog/t/binlog_killed.test: Rename: mysql-test/t/binlog_killed.test -> mysql-test/suite/binlog/t/binlog_killed.test mysql-test/suite/binlog/t/binlog_row_ctype_cp932.test: Rename: mysql-test/t/binlog_row_ctype_cp932.test -> mysql-test/suite/binlog/t/binlog_row_ctype_cp932.test mysql-test/suite/binlog/t/binlog_row_insert_select.test: Rename: mysql-test/t/binlog_row_insert_select.test -> mysql-test/suite/binlog/t/binlog_row_insert_select.test mysql-test/suite/ndb/r/ndb_alter_table.result: Rename: mysql-test/r/ndb_alter_table.result -> mysql-test/suite/ndb/r/ndb_alter_table.result mysql-test/suite/ndb/r/ndb_binlog_multi.result: Rename: mysql-test/r/ndb_binlog_multi.result -> mysql-test/suite/ndb/r/ndb_binlog_multi.result mysql-test/suite/ndb/r/ndb_cache2.result: Rename: mysql-test/r/ndb_cache2.result -> mysql-test/suite/ndb/r/ndb_cache2.result mysql-test/suite/ndb/r/ndb_database.result: Rename: mysql-test/r/ndb_database.result -> mysql-test/suite/ndb/r/ndb_database.result mysql-test/suite/ndb/r/ndb_grant.result: Rename: mysql-test/r/ndb_grant.result -> mysql-test/suite/ndb/r/ndb_grant.result mysql-test/suite/ndb/r/ndb_restore.result: Rename: mysql-test/r/ndb_restore.result -> mysql-test/suite/ndb/r/ndb_restore.result mysql-test/suite/ndb/r/ndb_restore_partition.result: Rename: mysql-test/r/ndb_restore_partition.result -> mysql-test/suite/ndb/r/ndb_restore_partition.result mysql-test/suite/ndb/r/ndbapi.result: Rename: mysql-test/r/ndbapi.result -> mysql-test/suite/ndb/r/ndbapi.result mysql-test/suite/ndb/t/ndb_autodiscover2-master.opt: Rename: mysql-test/t/ndb_autodiscover2-master.opt -> mysql-test/suite/ndb/t/ndb_autodiscover2-master.opt mysql-test/suite/ndb/t/ndb_autodiscover2.test: Rename: mysql-test/t/ndb_autodiscover2.test -> mysql-test/suite/ndb/t/ndb_autodiscover2.test mysql-test/suite/ndb/t/ndb_index.test: Rename: mysql-test/t/ndb_index.test -> mysql-test/suite/ndb/t/ndb_index.test mysql-test/suite/ndb/t/ndb_lock.test: Rename: mysql-test/t/ndb_lock.test -> mysql-test/suite/ndb/t/ndb_lock.test mysql-test/suite/ndb/t/ndb_restore_compat.test: Rename: mysql-test/t/ndb_restore_compat.test -> mysql-test/suite/ndb/t/ndb_restore_compat.test mysql-test/suite/ndb/t/ndb_sp.test: Rename: mysql-test/t/ndb_sp.test -> mysql-test/suite/ndb/t/ndb_sp.test mysql-test/suite/ndb/t/ndb_subquery.test: Rename: mysql-test/t/ndb_subquery.test -> mysql-test/suite/ndb/t/ndb_subquery.test mysql-test/suite/ndb/t/ndb_temporary.test: Rename: mysql-test/t/ndb_temporary.test -> mysql-test/suite/ndb/t/ndb_temporary.test mysql-test/suite/rpl/r/rpl_LD_INFILE.result: Rename: mysql-test/r/rpl_LD_INFILE.result -> mysql-test/suite/rpl/r/rpl_LD_INFILE.result mysql-test/suite/rpl/r/rpl_auto_increment.result: Rename: mysql-test/r/rpl_auto_increment.result -> mysql-test/suite/rpl/r/rpl_auto_increment.result mysql-test/suite/rpl/r/rpl_create_database.result: Rename: mysql-test/r/rpl_create_database.result -> mysql-test/suite/rpl/r/rpl_create_database.result mysql-test/suite/rpl/r/rpl_critical_errors.result.txt: Rename: mysql-test/r/rpl_critical_errors.result.txt -> mysql-test/suite/rpl/r/rpl_critical_errors.result.txt mysql-test/suite/rpl/r/rpl_empty_master_crash.result: Rename: mysql-test/r/rpl_empty_master_crash.result -> mysql-test/suite/rpl/r/rpl_empty_master_crash.result mysql-test/suite/rpl/r/rpl_flushlog_loop.result: Rename: mysql-test/r/rpl_flushlog_loop.result -> mysql-test/suite/rpl/r/rpl_flushlog_loop.result mysql-test/suite/rpl/r/rpl_ignore_table.result: Rename: mysql-test/r/rpl_ignore_table.result -> mysql-test/suite/rpl/r/rpl_ignore_table.result mysql-test/suite/rpl/r/rpl_load_table_from_master.result: Rename: mysql-test/r/rpl_load_table_from_master.result -> mysql-test/suite/rpl/r/rpl_load_table_from_master.result mysql-test/suite/rpl/r/rpl_loaddata_simple.result: Rename: mysql-test/r/rpl_loaddata_simple.result -> mysql-test/suite/rpl/r/rpl_loaddata_simple.result mysql-test/suite/rpl/r/rpl_loaddatalocal.result: Rename: mysql-test/r/rpl_loaddatalocal.result -> mysql-test/suite/rpl/r/rpl_loaddatalocal.result mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result: Rename: mysql-test/r/rpl_rbr_to_sbr.result -> mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result mysql-test/suite/rpl/r/rpl_relay_space_myisam.result: Rename: mysql-test/r/rpl_relay_space_myisam.result -> mysql-test/suite/rpl/r/rpl_relay_space_myisam.result mysql-test/suite/rpl/r/rpl_rotate_logs.result: Rename: mysql-test/r/rpl_rotate_logs.result -> mysql-test/suite/rpl/r/rpl_rotate_logs.result mysql-test/suite/rpl/r/rpl_row_001.result: Rename: mysql-test/r/rpl_row_001.result -> mysql-test/suite/rpl/r/rpl_row_001.result mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt: Rename: mysql-test/r/rpl_row_basic_11bugs-master.opt -> mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt: Rename: mysql-test/r/rpl_row_basic_11bugs-slave.opt -> mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result: Rename: mysql-test/r/rpl_row_basic_3innodb.result -> mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result mysql-test/suite/rpl/r/rpl_row_delayed_ins.result: Rename: mysql-test/r/rpl_row_delayed_ins.result -> mysql-test/suite/rpl/r/rpl_row_delayed_ins.result mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result: Rename: mysql-test/r/rpl_row_mysqlbinlog.result -> mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result mysql-test/suite/rpl/r/rpl_row_mystery22.result: Rename: mysql-test/r/rpl_row_mystery22.result -> mysql-test/suite/rpl/r/rpl_row_mystery22.result mysql-test/suite/rpl/r/rpl_row_reset_slave.result: Rename: mysql-test/r/rpl_row_reset_slave.result -> mysql-test/suite/rpl/r/rpl_row_reset_slave.result mysql-test/suite/rpl/r/rpl_row_sp005.result: Rename: mysql-test/r/rpl_row_sp005.result -> mysql-test/suite/rpl/r/rpl_row_sp005.result mysql-test/suite/rpl/r/rpl_row_tabledefs_7ndb.result: Rename: mysql-test/r/rpl_row_tabledefs_7ndb.result -> mysql-test/suite/rpl/r/rpl_row_tabledefs_7ndb.result mysql-test/suite/rpl/r/rpl_server_id2.result: Rename: mysql-test/r/rpl_server_id2.result -> mysql-test/suite/rpl/r/rpl_server_id2.result mysql-test/suite/rpl/r/rpl_sp.result: Rename: mysql-test/r/rpl_sp.result -> mysql-test/suite/rpl/r/rpl_sp.result mysql-test/suite/rpl/r/rpl_temporary.result: Rename: mysql-test/r/rpl_temporary.result -> mysql-test/suite/rpl/r/rpl_temporary.result mysql-test/suite/rpl/r/rpl_trunc_temp.result: Rename: mysql-test/r/rpl_trunc_temp.result -> mysql-test/suite/rpl/r/rpl_trunc_temp.result mysql-test/suite/rpl/r/rpl_truncate_7ndb_2.result: Rename: mysql-test/r/rpl_truncate_7ndb_2.result -> mysql-test/suite/rpl/r/rpl_truncate_7ndb_2.result mysql-test/suite/rpl/r/rpl_user_variables.result: Rename: mysql-test/r/rpl_user_variables.result -> mysql-test/suite/rpl/r/rpl_user_variables.result mysql-test/suite/rpl/t/rpl000010-slave.opt: Rename: mysql-test/t/rpl000010-slave.opt -> mysql-test/suite/rpl/t/rpl000010-slave.opt mysql-test/suite/rpl/t/rpl_alter.test: Rename: mysql-test/t/rpl_alter.test -> mysql-test/suite/rpl/t/rpl_alter.test mysql-test/suite/rpl/t/rpl_deadlock_innodb.test: Rename: mysql-test/t/rpl_deadlock_innodb.test -> mysql-test/suite/rpl/t/rpl_deadlock_innodb.test mysql-test/suite/rpl/t/rpl_events.test: Rename: mysql-test/t/rpl_events.test -> mysql-test/suite/rpl/t/rpl_events.test mysql-test/suite/rpl/t/rpl_ignore_revoke-slave.opt: Rename: mysql-test/t/rpl_ignore_revoke-slave.opt -> mysql-test/suite/rpl/t/rpl_ignore_revoke-slave.opt mysql-test/suite/rpl/t/rpl_ignore_table-slave.opt: Rename: mysql-test/t/rpl_ignore_table-slave.opt -> mysql-test/suite/rpl/t/rpl_ignore_table-slave.opt mysql-test/suite/rpl/t/rpl_insert.test: Rename: mysql-test/t/rpl_insert.test -> mysql-test/suite/rpl/t/rpl_insert.test mysql-test/suite/rpl/t/rpl_insert_id.test: Rename: mysql-test/t/rpl_insert_id.test -> mysql-test/suite/rpl/t/rpl_insert_id.test mysql-test/suite/rpl/t/rpl_insert_id_pk.test: Rename: mysql-test/t/rpl_insert_id_pk.test -> mysql-test/suite/rpl/t/rpl_insert_id_pk.test mysql-test/suite/rpl/t/rpl_insert_ignore.test: Rename: mysql-test/t/rpl_insert_ignore.test -> mysql-test/suite/rpl/t/rpl_insert_ignore.test mysql-test/suite/rpl/t/rpl_loaddata_charset.test: Rename: mysql-test/t/rpl_loaddata_charset.test -> mysql-test/suite/rpl/t/rpl_loaddata_charset.test mysql-test/suite/rpl/t/rpl_loaddata_simple.test: Rename: mysql-test/t/rpl_loaddata_simple.test -> mysql-test/suite/rpl/t/rpl_loaddata_simple.test mysql-test/suite/rpl/t/rpl_multi_delete2.test: Rename: mysql-test/t/rpl_multi_delete2.test -> mysql-test/suite/rpl/t/rpl_multi_delete2.test mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt: Rename: mysql-test/t/rpl_multi_engine-slave.opt -> mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt mysql-test/suite/rpl/t/rpl_read_only-slave.opt: Rename: mysql-test/t/rpl_read_only-slave.opt -> mysql-test/suite/rpl/t/rpl_read_only-slave.opt mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt: Rename: mysql-test/t/rpl_relayrotate-slave.opt -> mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt mysql-test/suite/rpl/t/rpl_replicate_do.test: Rename: mysql-test/t/rpl_replicate_do.test -> mysql-test/suite/rpl/t/rpl_replicate_do.test mysql-test/suite/rpl/t/rpl_replicate_ignore_db-slave.opt: Rename: mysql-test/t/rpl_replicate_ignore_db-slave.opt -> mysql-test/suite/rpl/t/rpl_replicate_ignore_db-slave.opt mysql-test/suite/rpl/t/rpl_row_001.test: Rename: mysql-test/t/rpl_row_001.test -> mysql-test/suite/rpl/t/rpl_row_001.test mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test: Rename: mysql-test/t/rpl_row_basic_2myisam.test -> mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt: Rename: mysql-test/t/rpl_row_basic_3innodb-slave.opt -> mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt mysql-test/suite/rpl/t/rpl_row_basic_8partition.test: Rename: mysql-test/t/rpl_row_basic_8partition.test -> mysql-test/suite/rpl/t/rpl_row_basic_8partition.test mysql-test/suite/rpl/t/rpl_row_charset.test: Rename: mysql-test/t/rpl_row_charset.test -> mysql-test/suite/rpl/t/rpl_row_charset.test mysql-test/suite/rpl/t/rpl_row_drop.test: Rename: mysql-test/t/rpl_row_drop.test -> mysql-test/suite/rpl/t/rpl_row_drop.test mysql-test/suite/rpl/t/rpl_row_trig004.test: Rename: mysql-test/t/rpl_row_trig004.test -> mysql-test/suite/rpl/t/rpl_row_trig004.test mysql-test/suite/rpl/t/rpl_row_view01.test: Rename: mysql-test/t/rpl_row_view01.test -> mysql-test/suite/rpl/t/rpl_row_view01.test mysql-test/suite/rpl/t/rpl_sp_effects-master.opt: Rename: mysql-test/t/rpl_sp_effects-master.opt -> mysql-test/suite/rpl/t/rpl_sp_effects-master.opt mysql-test/suite/rpl/t/rpl_stm_charset.test: Rename: mysql-test/t/rpl_stm_charset.test -> mysql-test/suite/rpl/t/rpl_stm_charset.test mysql-test/suite/rpl/t/rpl_stm_log-slave.opt: Rename: mysql-test/t/rpl_stm_log-slave.opt -> mysql-test/suite/rpl/t/rpl_stm_log-slave.opt mysql-test/suite/rpl/t/rpl_truncate_7ndb_2-master.opt: Rename: mysql-test/t/rpl_truncate_7ndb_2-master.opt -> mysql-test/suite/rpl/t/rpl_truncate_7ndb_2-master.opt mysql-test/suite/rpl/t/rpl_variables-master.opt: Rename: mysql-test/t/rpl_variables-master.opt -> mysql-test/suite/rpl/t/rpl_variables-master.opt mysql-test/suite/rpl/t/rpl_view-slave.opt: Rename: mysql-test/t/rpl_view-slave.opt -> mysql-test/suite/rpl/t/rpl_view-slave.opt mysql-test/suite/rpl/t/rpl_view.test: Rename: mysql-test/t/rpl_view.test -> mysql-test/suite/rpl/t/rpl_view.test mysql-test/suite/rpl_ndb/r/rpl_ndb_charset.result: Rename: mysql-test/r/rpl_ndb_charset.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_charset.result mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result: Rename: mysql-test/r/rpl_ndb_circular_simplex.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result: Rename: mysql-test/r/rpl_ndb_dd_advance.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result mysql-test/suite/rpl_ndb/r/rpl_ndb_trig004.result: Rename: mysql-test/r/rpl_ndb_trig004.result -> mysql-test/suite/rpl_ndb/r/rpl_ndb_trig004.result mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-master.opt: Rename: mysql-test/t/rpl_ndb_2innodb-master.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-master.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_UUID.test: Rename: mysql-test/t/rpl_ndb_UUID.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_UUID.test mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test: Rename: mysql-test/t/rpl_ndb_circular_simplex.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test mysql-test/suite/rpl_ndb/t/rpl_ndb_extraCol.test: Rename: mysql-test/t/rpl_ndb_extraCol.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_extraCol.test mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-master.opt: Rename: mysql-test/t/rpl_ndb_stm_innodb-master.opt -> mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-master.opt mysql-test/suite/binlog/t/binlog_row_binlog.test: Rename: mysql-test/t/binlog_row_binlog.test -> mysql-test/suite/binlog/t/binlog_row_binlog.test mysql-test/suite/ndb/r/ndb_autodiscover.result: Rename: mysql-test/r/ndb_autodiscover.result -> mysql-test/suite/ndb/r/ndb_autodiscover.result mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result: Rename: mysql-test/r/ndb_binlog_ignore_db.result -> mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result mysql-test/suite/ndb/r/ndb_cache_multi.result: Rename: mysql-test/r/ndb_cache_multi.result -> mysql-test/suite/ndb/r/ndb_cache_multi.result mysql-test/suite/ndb/r/ndb_partition_error.result: Rename: mysql-test/r/ndb_partition_error.result -> mysql-test/suite/ndb/r/ndb_partition_error.result mysql-test/suite/ndb/r/ndb_read_multi_range.result: Rename: mysql-test/r/ndb_read_multi_range.result -> mysql-test/suite/ndb/r/ndb_read_multi_range.result mysql-test/suite/ndb/r/ndb_truncate.result: Rename: mysql-test/r/ndb_truncate.result -> mysql-test/suite/ndb/r/ndb_truncate.result mysql-test/suite/ndb/t/ndb_gis.test: Rename: mysql-test/t/ndb_gis.test -> mysql-test/suite/ndb/t/ndb_gis.test mysql-test/suite/ndb/t/ndb_grant.later: Rename: mysql-test/t/ndb_grant.later -> mysql-test/suite/ndb/t/ndb_grant.later mysql-test/suite/rpl/r/rpl_err_ignoredtable.result: Rename: mysql-test/r/rpl_err_ignoredtable.result -> mysql-test/suite/rpl/r/rpl_err_ignoredtable.result mysql-test/suite/rpl/r/rpl_ignore_grant.result: Rename: mysql-test/r/rpl_ignore_grant.result -> mysql-test/suite/rpl/r/rpl_ignore_grant.result mysql-test/suite/rpl/r/rpl_load_from_master.result: Rename: mysql-test/r/rpl_load_from_master.result -> mysql-test/suite/rpl/r/rpl_load_from_master.result mysql-test/suite/rpl/r/rpl_master_pos_wait.result: Rename: mysql-test/r/rpl_master_pos_wait.result -> mysql-test/suite/rpl/r/rpl_master_pos_wait.result mysql-test/suite/rpl/r/rpl_misc_functions.result: Rename: mysql-test/r/rpl_misc_functions.result -> mysql-test/suite/rpl/r/rpl_misc_functions.result mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result: Rename: mysql-test/r/rpl_row_basic_11bugs.result -> mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result mysql-test/suite/rpl/r/rpl_row_max_relay_size.result: Rename: mysql-test/r/rpl_row_max_relay_size.result -> mysql-test/suite/rpl/r/rpl_row_max_relay_size.result mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result: Rename: mysql-test/r/rpl_row_tabledefs_2myisam.result -> mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result mysql-test/suite/rpl/r/rpl_server_id1.result: Rename: mysql-test/r/rpl_server_id1.result -> mysql-test/suite/rpl/r/rpl_server_id1.result mysql-test/suite/rpl/r/rpl_sf.result: Rename: mysql-test/r/rpl_sf.result -> mysql-test/suite/rpl/r/rpl_sf.result mysql-test/suite/rpl/r/rpl_start_stop_slave.result: Rename: mysql-test/r/rpl_start_stop_slave.result -> mysql-test/suite/rpl/r/rpl_start_stop_slave.result mysql-test/suite/rpl/r/rpl_stm_reset_slave.result: Rename: mysql-test/r/rpl_stm_reset_slave.result -> mysql-test/suite/rpl/r/rpl_stm_reset_slave.result mysql-test/suite/rpl/r/rpl_stm_until.result: Rename: mysql-test/r/rpl_stm_until.result -> mysql-test/suite/rpl/r/rpl_stm_until.result mysql-test/suite/rpl/t/rpl_000015-slave.sh: Rename: mysql-test/t/rpl_000015-slave.sh -> mysql-test/suite/rpl/t/rpl_000015-slave.sh mysql-test/suite/rpl/t/rpl_change_master.test: Rename: mysql-test/t/rpl_change_master.test -> mysql-test/suite/rpl/t/rpl_change_master.test mysql-test/suite/rpl/t/rpl_drop_temp-slave.opt: Rename: mysql-test/t/rpl_drop_temp-slave.opt -> mysql-test/suite/rpl/t/rpl_drop_temp-slave.opt mysql-test/suite/rpl/t/rpl_multi_engine.test: Rename: mysql-test/t/rpl_multi_engine.test -> mysql-test/suite/rpl/t/rpl_multi_engine.test mysql-test/suite/rpl/t/rpl_relayspace-slave.opt: Rename: mysql-test/t/rpl_relayspace-slave.opt -> mysql-test/suite/rpl/t/rpl_relayspace-slave.opt mysql-test/suite/rpl/t/rpl_row_blob_myisam.test: Rename: mysql-test/t/rpl_row_blob_myisam.test -> mysql-test/suite/rpl/t/rpl_row_blob_myisam.test mysql-test/suite/rpl/t/rpl_row_sp009.test: Rename: mysql-test/t/rpl_row_sp009.test -> mysql-test/suite/rpl/t/rpl_row_sp009.test mysql-test/suite/rpl/t/rpl_row_sp010.test: Rename: mysql-test/t/rpl_row_sp010.test -> mysql-test/suite/rpl/t/rpl_row_sp010.test mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test: Rename: mysql-test/t/rpl_stm_insert_delayed.test -> mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test mysql-test/suite/rpl/t/rpl_stm_until.test: Rename: mysql-test/t/rpl_stm_until.test -> mysql-test/suite/rpl/t/rpl_stm_until.test mysql-test/suite/rpl/t/rpl_truncate_3innodb.test: Rename: mysql-test/t/rpl_truncate_3innodb.test -> mysql-test/suite/rpl/t/rpl_truncate_3innodb.test mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test: Rename: mysql-test/t/rpl_ndb_bank.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test: Rename: mysql-test/t/rpl_ndb_row_001.test -> mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test mysql-test/lib/mtr_cases.pl: Reorganize collect function to collect from more than one suite Add new function collect_one_suite Set name of test to <suite>.<testname> mysql-test/lib/mtr_report.pl: Determine name of files from "result_file" name mysql-test/mysql-test-run.pl: Collect tests from suites main, binlog, rpl, rpl_ndb and ndb as default. Add --suites as a synonym of --suite and allow a semicolon separated list of suite names to be passed to it. Determine name of files to cleanup from "result_file" name Update usage Add possibility to add a suite.opt file mysql-test/t/disabled.def: Move disabled testcases to their respective suite mysql-test/suite/funcs_1/t/suite.opt: New BitKeeper file ``mysql-test/suite/funcs_1/t/suite.opt'' mysql-test/suite/funcs_2/t/suite.opt: New BitKeeper file ``mysql-test/suite/funcs_2/t/suite.opt'' mysql-test/suite/ndb/t/disabled.def: New BitKeeper file ``mysql-test/suite/ndb/t/disabled.def'' mysql-test/suite/rpl/t/disabled.def: New BitKeeper file ``mysql-test/suite/rpl/t/disabled.def'' mysql-test/suite/rpl_ndb/t/disabled.def: New BitKeeper file ``mysql-test/suite/rpl_ndb/t/disabled.def''
Diffstat (limited to 'mysql-test/suite/rpl')
-rw-r--r--mysql-test/suite/rpl/r/rpl000001.a.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl000001.b.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl000010.result14
-rw-r--r--mysql-test/suite/rpl/r/rpl000011.result16
-rw-r--r--mysql-test/suite/rpl/r/rpl000013.result28
-rw-r--r--mysql-test/suite/rpl/r/rpl000017.result18
-rw-r--r--mysql-test/suite/rpl/r/rpl_000015.result34
-rw-r--r--mysql-test/suite/rpl/r/rpl_EE_err.result11
-rw-r--r--mysql-test/suite/rpl/r/rpl_LD_INFILE.result117
-rw-r--r--mysql-test/suite/rpl/r/rpl_alter.result21
-rw-r--r--mysql-test/suite/rpl/r/rpl_alter_db.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_auto_increment.result229
-rw-r--r--mysql-test/suite/rpl/r/rpl_auto_increment_11932.result47
-rw-r--r--mysql-test/suite/rpl/r/rpl_bit.result138
-rw-r--r--mysql-test/suite/rpl/r/rpl_bit_npk.result169
-rw-r--r--mysql-test/suite/rpl/r/rpl_change_master.result26
-rw-r--r--mysql-test/suite/rpl/r/rpl_charset_sjis.result26
-rw-r--r--mysql-test/suite/rpl/r/rpl_commit_after_flush.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_create_database.result70
-rw-r--r--mysql-test/suite/rpl/r/rpl_critical_errors.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_critical_errors.result.txt56
-rw-r--r--mysql-test/suite/rpl/r/rpl_ddl.result1616
-rw-r--r--mysql-test/suite/rpl/r/rpl_deadlock_innodb.result199
-rw-r--r--mysql-test/suite/rpl/r/rpl_delete_no_where.result15
-rw-r--r--mysql-test/suite/rpl/r/rpl_do_grant.result91
-rw-r--r--mysql-test/suite/rpl/r/rpl_drop.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_drop_db.result38
-rw-r--r--mysql-test/suite/rpl/r/rpl_drop_temp.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_dual_pos_advance.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_empty_master_crash.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_err_ignoredtable.result42
-rw-r--r--mysql-test/suite/rpl/r/rpl_events.result165
-rw-r--r--mysql-test/suite/rpl/r/rpl_extraCol_innodb.result749
-rw-r--r--mysql-test/suite/rpl/r/rpl_extraCol_myisam.result749
-rw-r--r--mysql-test/suite/rpl/r/rpl_failed_optimize.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_flushlog_loop.result54
-rw-r--r--mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result42
-rw-r--r--mysql-test/suite/rpl/r/rpl_free_items.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_get_lock.result35
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_grant.result37
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_revoke.result30
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_table.result140
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_table_update.result23
-rw-r--r--mysql-test/suite/rpl/r/rpl_incident.result106
-rw-r--r--mysql-test/suite/rpl/r/rpl_init_slave.result27
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb.result37
-rw-r--r--mysql-test/suite/rpl/r/rpl_insert.result23
-rw-r--r--mysql-test/suite/rpl/r/rpl_insert_id.result538
-rw-r--r--mysql-test/suite/rpl/r/rpl_insert_id_pk.result76
-rw-r--r--mysql-test/suite/rpl/r/rpl_insert_ignore.result70
-rw-r--r--mysql-test/suite/rpl/r/rpl_insert_select.result17
-rw-r--r--mysql-test/suite/rpl/r/rpl_known_bugs_detection.result135
-rw-r--r--mysql-test/suite/rpl/r/rpl_load_from_master.result139
-rw-r--r--mysql-test/suite/rpl/r/rpl_load_table_from_master.result51
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata.result92
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_charset.result37
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_m.result38
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_s.result15
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_simple.result153
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddatalocal.result31
-rw-r--r--mysql-test/suite/rpl/r/rpl_loadfile.result227
-rw-r--r--mysql-test/suite/rpl/r/rpl_locale.result20
-rw-r--r--mysql-test/suite/rpl/r/rpl_log_pos.result99
-rw-r--r--mysql-test/suite/rpl/r/rpl_many_optimize.result9
-rw-r--r--mysql-test/suite/rpl/r/rpl_master_pos_wait.result18
-rw-r--r--mysql-test/suite/rpl/r/rpl_misc_functions.result46
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result46
-rw-r--r--mysql-test/suite/rpl/r/rpl_multi_delete.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_multi_delete2.result44
-rw-r--r--mysql-test/suite/rpl/r/rpl_multi_engine.result366
-rw-r--r--mysql-test/suite/rpl/r/rpl_multi_update.result27
-rw-r--r--mysql-test/suite/rpl/r/rpl_multi_update2.result55
-rw-r--r--mysql-test/suite/rpl/r/rpl_multi_update3.result197
-rw-r--r--mysql-test/suite/rpl/r/rpl_multi_update4.result25
-rw-r--r--mysql-test/suite/rpl/r/rpl_optimize.result27
-rw-r--r--mysql-test/suite/rpl/r/rpl_packet.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_ps.result30
-rw-r--r--mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result67
-rw-r--r--mysql-test/suite/rpl/r/rpl_read_only.result116
-rw-r--r--mysql-test/suite/rpl/r/rpl_redirect.result41
-rw-r--r--mysql-test/suite/rpl/r/rpl_relay_space_innodb.result25
-rw-r--r--mysql-test/suite/rpl/r/rpl_relay_space_myisam.result25
-rw-r--r--mysql-test/suite/rpl/r/rpl_relayrotate.result16
-rw-r--r--mysql-test/suite/rpl/r/rpl_relayspace.result19
-rw-r--r--mysql-test/suite/rpl/r/rpl_replicate_do.result77
-rw-r--r--mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result23
-rw-r--r--mysql-test/suite/rpl/r/rpl_rewrt_db.result94
-rw-r--r--mysql-test/suite/rpl/r/rpl_rotate_logs.result97
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_001.result55
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_4_bytes.result27
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_NOW.result29
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_USER.result38
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_UUID.result40
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt1
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt1
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result220
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result418
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result418
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_8partition.result655
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_blob_innodb.result156
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_blob_myisam.result156
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_charset.result201
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_create_table.result403
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_delayed_ins.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_drop.result56
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_err_ignoredtable.result44
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result33
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_func001.result30
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_func002.result26
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_func003.result29
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result55
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_insert_delayed.result48
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_loaddata_m.result20
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log.result116
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log_innodb.result124
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_max_relay_size.result281
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_multi_query.result37
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result352
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_mystery22.result30
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_reset_slave.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp001.result85
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result239
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp003.result49
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp005.result100
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result46
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result50
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp008.result34
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp009.result77
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp010.result56
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp011.result69
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_sp012.result59
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_stop_middle.result26
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result16
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result389
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result389
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_tabledefs_7ndb.result288
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_trig001.result30
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_trig002.result69
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_trig003.result83
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_trig004.result30
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_until.result190
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_view01.result101
-rw-r--r--mysql-test/suite/rpl/r/rpl_server_id1.result19
-rw-r--r--mysql-test/suite/rpl/r/rpl_server_id2.result21
-rw-r--r--mysql-test/suite/rpl/r/rpl_session_var.result43
-rw-r--r--mysql-test/suite/rpl/r/rpl_set_charset.result48
-rw-r--r--mysql-test/suite/rpl/r/rpl_sf.result23
-rw-r--r--mysql-test/suite/rpl/r/rpl_skip_error.result16
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_status.result58
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result536
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp004.result93
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp_effects.result238
-rw-r--r--mysql-test/suite/rpl/r/rpl_sporadic_master.result26
-rw-r--r--mysql-test/suite/rpl/r/rpl_ssl.result99
-rw-r--r--mysql-test/suite/rpl/r/rpl_ssl1.result146
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_stop_slave.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_000001.result82
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_EE_err2.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_charset.result270
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result33
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result88
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_log.result115
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result279
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_multi_query.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_mystery22.result31
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_no_op.result52
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_reset_slave.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_until.result190
-rw-r--r--mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result1017
-rw-r--r--mysql-test/suite/rpl/r/rpl_temp_table.result48
-rw-r--r--mysql-test/suite/rpl/r/rpl_temporary.result106
-rw-r--r--mysql-test/suite/rpl/r/rpl_timezone.result107
-rw-r--r--mysql-test/suite/rpl/r/rpl_trigger.result973
-rw-r--r--mysql-test/suite/rpl/r/rpl_trunc_temp.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_truncate_2myisam.result196
-rw-r--r--mysql-test/suite/rpl/r/rpl_truncate_3innodb.result208
-rw-r--r--mysql-test/suite/rpl/r/rpl_truncate_7ndb_2.result91
-rw-r--r--mysql-test/suite/rpl/r/rpl_udf.result310
-rw-r--r--mysql-test/suite/rpl/r/rpl_user_variables.result266
-rw-r--r--mysql-test/suite/rpl/r/rpl_variables.result19
-rw-r--r--mysql-test/suite/rpl/r/rpl_view.result104
-rw-r--r--mysql-test/suite/rpl/t/disabled.def15
-rw-r--r--mysql-test/suite/rpl/t/rpl000010-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl000010.test19
-rw-r--r--mysql-test/suite/rpl/t/rpl000011.test17
-rw-r--r--mysql-test/suite/rpl/t/rpl000013.test53
-rw-r--r--mysql-test/suite/rpl/t/rpl000017-slave.opt1
-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/rpl000018-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl000018-slave.opt1
-rwxr-xr-xmysql-test/suite/rpl/t/rpl_000015-slave.sh1
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015.slave-mi1
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015.test48
-rw-r--r--mysql-test/suite/rpl/t/rpl_EE_err.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_LD_INFILE.test38
-rw-r--r--mysql-test/suite/rpl/t/rpl_alter.test24
-rw-r--r--mysql-test/suite/rpl/t/rpl_alter_db.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment_11932.test63
-rw-r--r--mysql-test/suite/rpl/t/rpl_bit.test94
-rw-r--r--mysql-test/suite/rpl/t/rpl_bit_npk.test116
-rw-r--r--mysql-test/suite/rpl/t/rpl_change_master.test37
-rw-r--r--mysql-test/suite/rpl/t/rpl_charset_sjis.test25
-rw-r--r--mysql-test/suite/rpl/t/rpl_commit_after_flush.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_create_database-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_create_database-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_create_database.test72
-rw-r--r--mysql-test/suite/rpl/t/rpl_critical_errors.test66
-rw-r--r--mysql-test/suite/rpl/t/rpl_ddl.test32
-rw-r--r--mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_deadlock_innodb.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_delete_no_where.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_do_grant.test114
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_db.test61
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_temp-slave.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_temp.test27
-rw-r--r--mysql-test/suite/rpl/t/rpl_dual_pos_advance-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_dual_pos_advance.test114
-rw-r--r--mysql-test/suite/rpl/t/rpl_empty_master_crash-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_empty_master_crash.test15
-rw-r--r--mysql-test/suite/rpl/t/rpl_err_ignoredtable-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_err_ignoredtable.test66
-rw-r--r--mysql-test/suite/rpl/t/rpl_events.test47
-rw-r--r--mysql-test/suite/rpl/t/rpl_extraCol_innodb-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt1
-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_failed_optimize-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_failed_optimize.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt1
-rwxr-xr-xmysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh5
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt1
-rwxr-xr-xmysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh4
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop.test50
-rw-r--r--mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_free_items-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_free_items.test22
-rw-r--r--mysql-test/suite/rpl/t/rpl_get_lock.test43
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_grant-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_grant.test59
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_revoke-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_revoke.test51
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table.test164
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table_update-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table_update.test38
-rw-r--r--mysql-test/suite/rpl/t/rpl_incident-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_incident.test42
-rw-r--r--mysql-test/suite/rpl/t/rpl_init_slave-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_init_slave.test34
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb.test48
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert.test44
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_id-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_id.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_id_pk.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_ignore.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_select.test19
-rw-r--r--mysql-test/suite/rpl/t/rpl_known_bugs_detection-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_known_bugs_detection.test93
-rw-r--r--mysql-test/suite/rpl/t/rpl_load_from_master-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_load_from_master.test180
-rw-r--r--mysql-test/suite/rpl/t/rpl_load_table_from_master.test98
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_charset.test33
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_m-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_m.test52
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_s-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_s.test28
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_simple.test14
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddatalocal.test65
-rw-r--r--mysql-test/suite/rpl/t/rpl_loadfile.test52
-rw-r--r--mysql-test/suite/rpl/t/rpl_locale.test24
-rw-r--r--mysql-test/suite/rpl/t/rpl_log_pos.test57
-rw-r--r--mysql-test/suite/rpl/t/rpl_many_optimize.test22
-rw-r--r--mysql-test/suite/rpl/t/rpl_master_pos_wait.test18
-rwxr-xr-xmysql-test/suite/rpl/t/rpl_misc_functions-slave.sh1
-rw-r--r--mysql-test/suite/rpl/t/rpl_misc_functions.test103
-rw-r--r--mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test46
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_delete-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_delete.test26
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_delete2-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_delete2.test68
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_engine.test108
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_update.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_update2-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_update2.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_update3.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_update4-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_update4.test45
-rw-r--r--mysql-test/suite/rpl/t/rpl_optimize.test54
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet.test80
-rw-r--r--mysql-test/suite/rpl/t/rpl_ps.test51
-rw-r--r--mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test47
-rw-r--r--mysql-test/suite/rpl/t/rpl_read_only-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_read_only.test113
-rw-r--r--mysql-test/suite/rpl/t/rpl_redirect.test47
-rw-r--r--mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_relay_space_innodb.test22
-rw-r--r--mysql-test/suite/rpl/t/rpl_relay_space_myisam.test21
-rw-r--r--mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt3
-rw-r--r--mysql-test/suite/rpl/t/rpl_relayrotate.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_relayspace-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_relayspace.test34
-rw-r--r--mysql-test/suite/rpl/t/rpl_replicate_do-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_replicate_do.test92
-rw-r--r--mysql-test/suite/rpl/t/rpl_replicate_ignore_db-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test30
-rw-r--r--mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_rewrt_db.test84
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt1
-rwxr-xr-xmysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh2
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi1
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs.test175
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_001.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_4_bytes-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_4_bytes.test33
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_NOW.test74
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_USER.test60
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_UUID.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test186
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_8partition.test210
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_blob_innodb.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_blob_myisam.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_charset.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_create_table.test236
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_delayed_ins.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_drop.test48
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_err_daisychain-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_err_daisychain-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test17
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_func001.test57
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_func002.test104
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_func003-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_func003.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test35
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_insert_delayed.test14
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_log-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_log-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_log.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_log_innodb-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_log_innodb.test13
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_max_relay_size.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mysqlbinlog-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test348
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mystery22.test45
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_reset_slave.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp001.test146
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp003-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp003.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp005.test110
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp008.test57
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp009.test105
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp010.test80
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp011.test111
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp012.test75
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_stop_middle.test44
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test31
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig001.test100
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig002.test80
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig003.test152
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig004.test18
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_until.test87
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_view01.test89
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id1.test26
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id2-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id2.test26
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var.test42
-rw-r--r--mysql-test/suite/rpl/t/rpl_set_charset.test35
-rw-r--r--mysql-test/suite/rpl/t/rpl_sf.test70
-rw-r--r--mysql-test/suite/rpl/t/rpl_skip_error-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_skip_error.test29
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_status.test58
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp.test585
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp004.test97
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp_effects-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp_effects-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp_effects.test211
-rw-r--r--mysql-test/suite/rpl/t/rpl_sporadic_master-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_sporadic_master.test29
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl.test71
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl1.test97
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_stop_slave.test36
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_000001.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_EE_err2.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_charset.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test20
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_log-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_log-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_log.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_multi_query.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_mystery22.test66
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_no_op.test93
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_reset_slave.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_until.test88
-rw-r--r--mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test568
-rw-r--r--mysql-test/suite/rpl/t/rpl_temp_table.test59
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporary.test215
-rw-r--r--mysql-test/suite/rpl/t/rpl_timezone-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_timezone-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_timezone.test142
-rw-r--r--mysql-test/suite/rpl/t/rpl_trigger.test477
-rw-r--r--mysql-test/suite/rpl/t/rpl_trunc_temp.test35
-rw-r--r--mysql-test/suite/rpl/t/rpl_truncate_2myisam.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_truncate_3innodb.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_truncate_7ndb_2-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_truncate_7ndb_2.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_udf-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_udf-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_udf.test22
-rw-r--r--mysql-test/suite/rpl/t/rpl_user_variables.test362
-rw-r--r--mysql-test/suite/rpl/t/rpl_variables-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_variables.test20
-rw-r--r--mysql-test/suite/rpl/t/rpl_view-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_view.test167
452 files changed, 32180 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/r/rpl000001.a.result b/mysql-test/suite/rpl/r/rpl000001.a.result
new file mode 100644
index 00000000000..c52b83d729a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl000001.a.result
@@ -0,0 +1,3 @@
+n
+1
+2
diff --git a/mysql-test/suite/rpl/r/rpl000001.b.result b/mysql-test/suite/rpl/r/rpl000001.b.result
new file mode 100644
index 00000000000..5108cfdaf26
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl000001.b.result
@@ -0,0 +1,2 @@
+sum(length(word))
+71
diff --git a/mysql-test/suite/rpl/r/rpl000010.result b/mysql-test/suite/rpl/r/rpl000010.result
new file mode 100644
index 00000000000..65191ea411f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl000010.result
@@ -0,0 +1,14 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (n int not null auto_increment primary key);
+insert into t1 values(NULL);
+insert into t1 values(2);
+select n from t1;
+n
+1
+2
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl000011.result b/mysql-test/suite/rpl/r/rpl000011.result
new file mode 100644
index 00000000000..dd0fa2fbe74
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl000011.result
@@ -0,0 +1,16 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (n int);
+insert into t1 values(1);
+stop slave;
+start slave;
+insert into t1 values(2);
+select * from t1;
+n
+1
+2
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl000013.result b/mysql-test/suite/rpl/r/rpl000013.result
new file mode 100644
index 00000000000..37838bb88e0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl000013.result
@@ -0,0 +1,28 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t2(n int);
+create temporary table t1 (n int);
+insert into t1 values(1),(2),(3);
+insert into t2 select * from t1;
+create temporary table t1 (n int);
+insert into t1 values (4),(5);
+insert into t2 select * from t1 as t10;
+insert into t2 values(6);
+select * from t2;
+n
+1
+2
+3
+4
+5
+6
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 0
+drop table if exists t1,t2;
+Warnings:
+Note 1051 Unknown table 't1'
diff --git a/mysql-test/suite/rpl/r/rpl000017.result b/mysql-test/suite/rpl/r/rpl000017.result
new file mode 100644
index 00000000000..1c611357e64
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl000017.result
@@ -0,0 +1,18 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
+grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
+start slave;
+drop table if exists t1;
+create table t1(n int);
+insert into t1 values(24);
+select * from t1;
+n
+24
+drop table t1;
+delete from mysql.user where user="replicate";
diff --git a/mysql-test/suite/rpl/r/rpl_000015.result b/mysql-test/suite/rpl/r/rpl_000015.result
new file mode 100644
index 00000000000..8d23136420f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_000015.result
@@ -0,0 +1,34 @@
+reset master;
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 106
+reset slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+change master to master_host='127.0.0.1';
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 test DEFAULT_MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No # No
+change master to master_host='127.0.0.1',master_user='root',
+master_password='',master_port=MASTER_PORT;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No # No
+start slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No # No
+drop table if exists t1;
+create table t1 (n int, PRIMARY KEY(n));
+insert into t1 values (10),(45),(90);
+SELECT * FROM t1 ORDER BY n;
+n
+10
+45
+90
+SELECT * FROM t1 ORDER BY n;
+n
+10
+45
+90
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_EE_err.result b/mysql-test/suite/rpl/r/rpl_EE_err.result
new file mode 100644
index 00000000000..16fa931e303
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_EE_err.result
@@ -0,0 +1,11 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int) engine=myisam;
+flush tables;
+drop table if exists t1;
+Warnings:
+Error 2 Can't find file: 't1' (errno: 2)
diff --git a/mysql-test/suite/rpl/r/rpl_LD_INFILE.result b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result
new file mode 100644
index 00000000000..70013f95d85
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result
@@ -0,0 +1,117 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
+LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+DELETE FROM test.t1 WHERE a = 'abashed';
+DELETE FROM test.t1;
+LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+SELECT * FROM test.t1 ORDER BY a DESC;
+a
+aberration
+aberrant
+Abernathy
+Aberdeen
+Abelson
+Abelian
+Abel
+abed
+Abe
+abducts
+abductors
+abductor
+abductions
+abduction
+abducted
+abduct
+abdominal
+abdomens
+abdomen
+Abby
+abbreviations
+abbreviation
+abbreviating
+abbreviates
+abbreviated
+abbreviate
+Abbott
+abbots
+abbot
+abbeys
+abbey
+abbe
+Abba
+abating
+abates
+abater
+abatements
+abatement
+abated
+abate
+abasing
+abashing
+abashes
+abashed
+abash
+abases
+abasements
+abasement
+abased
+abase
+SELECT * FROM test.t1 ORDER BY a DESC;
+a
+aberration
+aberrant
+Abernathy
+Aberdeen
+Abelson
+Abelian
+Abel
+abed
+Abe
+abducts
+abductors
+abductor
+abductions
+abduction
+abducted
+abduct
+abdominal
+abdomens
+abdomen
+Abby
+abbreviations
+abbreviation
+abbreviating
+abbreviates
+abbreviated
+abbreviate
+Abbott
+abbots
+abbot
+abbeys
+abbey
+abbe
+Abba
+abating
+abates
+abater
+abatements
+abatement
+abated
+abate
+abasing
+abashing
+abashes
+abashed
+abash
+abases
+abasements
+abasement
+abased
+abase
+DROP TABLE test.t1;
diff --git a/mysql-test/suite/rpl/r/rpl_alter.result b/mysql-test/suite/rpl/r/rpl_alter.result
new file mode 100644
index 00000000000..6ef5ce3462a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_alter.result
@@ -0,0 +1,21 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest;
+create database mysqltest;
+create table mysqltest.t1 ( n int);
+alter table mysqltest.t1 add m int;
+insert into mysqltest.t1 values (1,2);
+create table mysqltest.t2 (n int);
+insert into mysqltest.t2 values (45);
+rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
+select * from mysqltest.t2;
+n m
+1 2
+select * from mysqltest.t3;
+n
+45
+drop database mysqltest;
diff --git a/mysql-test/suite/rpl/r/rpl_alter_db.result b/mysql-test/suite/rpl/r/rpl_alter_db.result
new file mode 100644
index 00000000000..6edbe5d427f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_alter_db.result
@@ -0,0 +1,8 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+use mysql;
+alter database collate latin1_bin;
diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment.result b/mysql-test/suite/rpl/r/rpl_auto_increment.result
new file mode 100644
index 00000000000..083f3a4e901
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result
@@ -0,0 +1,229 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
+insert into t1 values (NULL,1),(NULL,2),(NULL,3);
+select * from t1;
+a b
+12 1
+22 2
+32 3
+select * from t1;
+a b
+12 1
+22 2
+32 3
+drop table t1;
+create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam;
+insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
+delete from t1 where b=4;
+insert into t1 values (NULL,5),(NULL,6);
+select * from t1;
+a b
+1 1
+2 2
+3 3
+22 5
+32 6
+select * from t1;
+a b
+1 1
+2 2
+3 3
+22 5
+32 6
+drop table t1;
+set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
+show variables like "%auto_inc%";
+Variable_name Value
+auto_increment_increment 100
+auto_increment_offset 10
+create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
+insert into t1 values (NULL),(5),(NULL);
+insert into t1 values (250),(NULL);
+select * from t1;
+a
+5
+10
+110
+250
+310
+insert into t1 values (1000);
+set @@insert_id=400;
+insert into t1 values(NULL),(NULL);
+select * from t1;
+a
+5
+10
+110
+250
+310
+400
+410
+1000
+select * from t1;
+a
+5
+10
+110
+250
+310
+400
+410
+1000
+drop table t1;
+create table t1 (a int not null auto_increment, primary key (a)) engine=innodb;
+insert into t1 values (NULL),(5),(NULL);
+insert into t1 values (250),(NULL);
+select * from t1;
+a
+5
+10
+110
+250
+310
+insert into t1 values (1000);
+set @@insert_id=400;
+insert into t1 values(NULL),(NULL);
+select * from t1;
+a
+5
+10
+110
+250
+310
+400
+410
+1000
+select * from t1;
+a
+5
+10
+110
+250
+310
+400
+410
+1000
+drop table t1;
+set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
+create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
+insert into t1 values (NULL),(5),(NULL),(NULL);
+insert into t1 values (500),(NULL),(502),(NULL),(NULL);
+select * from t1;
+a
+1
+5
+6
+7
+500
+501
+502
+503
+504
+set @@insert_id=600;
+insert into t1 values(600),(NULL),(NULL);
+ERROR 23000: Duplicate entry '600' for key 'PRIMARY'
+set @@insert_id=600;
+insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
+select * from t1;
+a
+1
+5
+6
+7
+500
+501
+502
+503
+504
+600
+610
+611
+select * from t1;
+a
+1
+5
+6
+7
+500
+501
+502
+503
+504
+600
+610
+611
+drop table t1;
+set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1;
+create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
+insert into t1 values(2),(12),(22),(32),(42);
+insert into t1 values (NULL),(NULL);
+insert into t1 values (3),(NULL),(NULL);
+select * from t1;
+a
+1
+3
+11
+21
+31
+select * from t1;
+a
+1
+2
+3
+11
+12
+21
+22
+31
+32
+42
+drop table t1;
+create table t1 (a tinyint not null auto_increment primary key) engine=myisam;
+insert into t1 values(103);
+set auto_increment_increment=11;
+set auto_increment_offset=4;
+insert into t1 values(null);
+insert into t1 values(null);
+insert into t1 values(null);
+ERROR 23000: Duplicate entry '125' for key 'PRIMARY'
+select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
+a mod(a-@@auto_increment_offset,@@auto_increment_increment)
+103 0
+114 0
+125 0
+create table t2 (a tinyint unsigned not null auto_increment primary key) engine=myisam;
+set auto_increment_increment=10;
+set auto_increment_offset=1;
+set insert_id=1000;
+insert into t2 values(null);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
+a mod(a-@@auto_increment_offset,@@auto_increment_increment)
+251 0
+create table t3 like t1;
+set auto_increment_increment=1000;
+set auto_increment_offset=700;
+insert into t3 values(null);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+select * from t3 order by a;
+a
+127
+select * from t1 order by a;
+a
+103
+114
+125
+select * from t2 order by a;
+a
+251
+select * from t3 order by a;
+a
+127
+drop table t1,t2,t3;
diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result b/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result
new file mode 100644
index 00000000000..25eda6ee454
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result
@@ -0,0 +1,47 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists test1;
+create database test1;
+use test1;
+CREATE TABLE `t1` (
+`id` int(10) unsigned NOT NULL auto_increment,
+`fname` varchar(100) default NULL,
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+INSERT INTO `t1` VALUES (1, 'blablabla');
+CREATE TABLE `t2` (
+`id` int(10) NOT NULL auto_increment,
+`comment` varchar(255) NOT NULL default '',
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=3 ;
+INSERT INTO `t2` VALUES (1, 'testtest 1');
+INSERT INTO `t2` VALUES (2, 'test 2');
+CREATE PROCEDURE simpleproc3 ()
+NOT DETERMINISTIC
+BEGIN
+INSERT INTO t1 (fname) (SELECT t2.comment FROM t2 WHERE t2.id = '1');
+INSERT INTO t1 (fname) VALUES('test');
+END
+$
+CALL simpleproc3();
+select * from t2;
+id comment
+1 testtest 1
+2 test 2
+TRUNCATE TABLE `t1`;
+CALL simpleproc3();
+select * from t1;
+id fname
+1 testtest 1
+2 test
+use test1;
+select * from t1;
+id fname
+1 testtest 1
+2 test
+drop database test1;
+drop database test1;
diff --git a/mysql-test/suite/rpl/r/rpl_bit.result b/mysql-test/suite/rpl/r/rpl_bit.result
new file mode 100644
index 00000000000..924de8a65f8
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_bit.result
@@ -0,0 +1,138 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (
+dummyKey INTEGER NOT NULL,
+f01 TINYINT,
+f10 TINYINT,
+f12 TINYINT,
+f15 TINYINT,
+f16 TINYINT,
+f7 TINYINT,
+f9 TINYINT,
+f29 TINYINT,
+f0 TINYINT,
+fA1 TINYINT,
+C32 TINYINT,
+A42 TINYINT,
+CA3 TINYINT,
+A044 TINYINT,
+f001 TINYINT,
+A3002 TINYINT,
+fC003 TINYINT,
+CA300 TINYINT,
+A305 TINYINT,
+CA321 TINYINT,
+r001 TINYINT,
+bit1 BIT(6),
+bit2 BIT(6),
+bit3 BIT(6),
+State1 TINYINT,
+State2 TINYINT,
+State3 TINYINT,
+State4 TINYINT,
+SubState TINYINT,
+gState TINYINT,
+oSupp TINYINT,
+tSupp TINYINT,
+sSuppD TINYINT,
+mSuppf TINYINT,
+GSuppDf TINYINT,
+VNotSupp TINYINT,
+x034 TINYINT,
+PRIMARY KEY USING HASH (dummyKey) );
+LOCK TABLES test.t1 WRITE;
+INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+UNLOCK TABLES;
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
+oSupp sSuppD GSuppDf VNotSupp x034
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
+hex(bit1)
+0
+0
+0
+0
+0
+2A
+3F
+3F
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+hex(bit2)
+0
+1
+1
+1
+1
+2A
+3E
+3F
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+hex(bit3)
+0
+1
+1
+1
+1
+15
+24
+35
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
+oSupp sSuppD GSuppDf VNotSupp x034
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+5 5 3 2 1
+SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
+hex(bit1)
+0
+0
+0
+0
+0
+2A
+3F
+3F
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+hex(bit2)
+0
+1
+1
+1
+1
+2A
+3E
+3F
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+hex(bit3)
+0
+1
+1
+1
+1
+15
+24
+35
+DROP TABLE IF EXISTS test.t1;
diff --git a/mysql-test/suite/rpl/r/rpl_bit_npk.result b/mysql-test/suite/rpl/r/rpl_bit_npk.result
new file mode 100644
index 00000000000..9599660f18f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_bit_npk.result
@@ -0,0 +1,169 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (
+dummyKey INTEGER NOT NULL,
+f01 TINYINT,
+f10 TINYINT,
+f12 TINYINT,
+f15 TINYINT,
+f16 TINYINT,
+f7 TINYINT,
+f9 TINYINT,
+f29 TINYINT,
+f0 TINYINT,
+fA1 TINYINT,
+C32 TINYINT,
+A42 TINYINT,
+CA3 TINYINT,
+A044 TINYINT,
+f001 TINYINT,
+A3002 TINYINT,
+fC003 TINYINT,
+CA300 TINYINT,
+A305 TINYINT,
+CA321 TINYINT,
+r001 TINYINT,
+bit1 BIT(6),
+bit2 BIT(6),
+bit3 BIT(6),
+State1 TINYINT,
+State2 TINYINT,
+State3 TINYINT,
+State4 TINYINT,
+SubState TINYINT,
+gState TINYINT,
+oSupp TINYINT,
+tSupp TINYINT,
+sSuppD TINYINT,
+mSuppf TINYINT,
+GSuppDf TINYINT,
+VNotSupp TINYINT,
+x034 TINYINT);
+LOCK TABLES test.t1 WRITE;
+INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,NULL,1);
+INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'0',1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+UNLOCK TABLES;
+UPDATE test.t1 set x034 = 50 where bit3 = b'000000';
+UPDATE test.t1 set VNotSupp = 33 where bit1 = b'0';
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
+FROM test.t1
+ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
+oSupp sSuppD GSuppDf VNotSupp x034
+5 5 3 NULL 1
+5 5 3 2 1
+5 5 3 2 50
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+SELECT hex(bit1) from test.t1 ORDER BY bit1;
+hex(bit1)
+0
+0
+0
+0
+0
+2A
+3F
+3F
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+hex(bit2)
+0
+1
+1
+1
+1
+2A
+3E
+3F
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+hex(bit3)
+0
+1
+1
+1
+1
+15
+24
+35
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
+FROM test.t1
+ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
+oSupp sSuppD GSuppDf VNotSupp x034
+5 5 3 NULL 1
+5 5 3 2 1
+5 5 3 2 50
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+5 5 3 33 1
+SELECT hex(bit1) from test.t1 ORDER BY bit1;
+hex(bit1)
+0
+0
+0
+0
+0
+2A
+3F
+3F
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+hex(bit2)
+0
+1
+1
+1
+1
+2A
+3E
+3F
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+hex(bit3)
+0
+1
+1
+1
+1
+15
+24
+35
+CREATE TABLE test.t2 (a INT, b BIT(1));
+INSERT INTO test.t2 VALUES (1, b'0');
+INSERT INTO test.t2 VALUES (1, b'1');
+UPDATE test.t2 SET a = 2 WHERE b = b'1';
+CREATE TABLE test.t3 (a INT, b INT);
+INSERT INTO test.t3 VALUES (1, NULL);
+INSERT INTO test.t3 VALUES (1, 0);
+UPDATE test.t3 SET a = 2 WHERE b = 0;
+SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
+a hex(b)
+1 0
+2 1
+SELECT * FROM test.t3 ORDER BY a,b;
+a b
+1 NULL
+2 0
+SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
+a hex(b)
+1 0
+2 1
+SELECT * FROM test.t3 ORDER BY a,b;
+a b
+1 NULL
+2 0
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result
new file mode 100644
index 00000000000..680328bcea5
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result
@@ -0,0 +1,26 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(n int);
+select * from t1;
+n
+stop slave sql_thread;
+insert into t1 values(1);
+insert into t1 values(2);
+stop slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # No
+change master to master_user='root';
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # No
+start slave;
+select * from t1;
+n
+1
+2
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_charset_sjis.result b/mysql-test/suite/rpl/r/rpl_charset_sjis.result
new file mode 100644
index 00000000000..770ad0588d1
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_charset_sjis.result
@@ -0,0 +1,26 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop table if exists t1;
+drop procedure if exists p1;
+create table t1 (a varchar(255) character set sjis);
+create procedure p1 (in a varchar(255) character set sjis) insert into t1 values (a);
+SET NAMES binary;
+CALL p1 ('–\\');
+select "--- on master ---";
+--- on master ---
+--- on master ---
+select hex(a) from t1 ;
+hex(a)
+965C
+select "--- on slave ---";
+--- on slave ---
+--- on slave ---
+select hex(a) from t1;
+hex(a)
+965C
+drop table t1;
+drop procedure p1;
diff --git a/mysql-test/suite/rpl/r/rpl_commit_after_flush.result b/mysql-test/suite/rpl/r/rpl_commit_after_flush.result
new file mode 100644
index 00000000000..eaddda63b6a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_commit_after_flush.result
@@ -0,0 +1,13 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT) ENGINE=innodb;
+begin;
+insert into t1 values(1);
+flush tables with read lock;
+commit;
+unlock tables;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_create_database.result b/mysql-test/suite/rpl/r/rpl_create_database.result
new file mode 100644
index 00000000000..0cfd44bc58c
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_create_database.result
@@ -0,0 +1,70 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
+DROP DATABASE IF EXISTS mysqltest_bob;
+CREATE DATABASE mysqltest_prometheus;
+CREATE DATABASE mysqltest_sisyfos;
+CREATE DATABASE mysqltest_bob;
+USE mysqltest_sisyfos;
+CREATE TABLE t1 (b int);
+INSERT INTO t1 VALUES(1);
+USE mysqltest_bob;
+CREATE TABLE t2 (b int);
+INSERT INTO t2 VALUES(2);
+ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
+USE mysqltest_sisyfos;
+ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
+SHOW DATABASES;
+Database
+information_schema
+mysql
+mysqltest_bob
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+SHOW DATABASES;
+Database
+information_schema
+mysql
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+USE mysqltest_prometheus;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+CREATE DATABASE mysqltest_sisyfos;
+USE mysqltest_sisyfos;
+CREATE TABLE t2 (a INT);
+SHOW DATABASES;
+Database
+information_schema
+mysql
+mysqltest_bob
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+SHOW DATABASES;
+Database
+information_schema
+mysql
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+USE mysqltest_prometheus;
+SHOW TABLES;
+Tables_in_mysqltest_prometheus
+t1
+USE mysqltest_sisyfos;
+SHOW TABLES;
+Tables_in_mysqltest_sisyfos
+t2
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
diff --git a/mysql-test/suite/rpl/r/rpl_critical_errors.result b/mysql-test/suite/rpl/r/rpl_critical_errors.result
new file mode 100644
index 00000000000..bcc53565084
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_critical_errors.result
@@ -0,0 +1 @@
+Turn on parsing to run this test
diff --git a/mysql-test/suite/rpl/r/rpl_critical_errors.result.txt b/mysql-test/suite/rpl/r/rpl_critical_errors.result.txt
new file mode 100644
index 00000000000..0df2e1ef369
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_critical_errors.result.txt
@@ -0,0 +1,56 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (data LONGBLOB) ENGINE=MYISAM;
+CREATE TABLE t2 (data LONGBLOB) ENGINE=MYISAM;
+INSERT INTO t1 (data) VALUES (repeat('a',1024*1024));
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t2 SELECT * FROM t1;
+KILL QUERY 2;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+0
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1317
+Last_Error #
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
diff --git a/mysql-test/suite/rpl/r/rpl_ddl.result b/mysql-test/suite/rpl/r/rpl_ddl.result
new file mode 100644
index 00000000000..d41462de621
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_ddl.result
@@ -0,0 +1,1616 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+-------- switch to master -------
+SET AUTOCOMMIT = 1;
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+DROP DATABASE IF EXISTS mysqltest3;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=InnoDB;
+INSERT INTO mysqltest1.t1 SET f1= 0;
+CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=InnoDB;
+CREATE INDEX my_idx6 ON mysqltest1.t6(f1);
+CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=InnoDB;
+INSERT INTO mysqltest1.t7 SET f1= 0;
+CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=InnoDB;
+CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=MEMORY;
+SET AUTOCOMMIT = 0;
+use mysqltest1;
+
+-------- switch to slave --------
+SET AUTOCOMMIT = 1;
+use mysqltest1;
+
+-------- switch to master -------
+
+######## SELECT 1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 0 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+-------- switch to master -------
+SELECT 1;
+1
+1
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+
+######## SELECT COUNT(*) FROM t1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 0 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+-------- switch to master -------
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+
+######## COMMIT ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 0 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+0
+
+-------- switch to master -------
+COMMIT;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+
+######## ROLLBACK ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 1 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+
+######## SET AUTOCOMMIT=1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 1 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+1
+
+-------- switch to master -------
+SET AUTOCOMMIT=1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SET AUTOCOMMIT=0;
+
+######## START TRANSACTION ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 2 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+2
+
+-------- switch to master -------
+START TRANSACTION;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+
+######## BEGIN ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 3 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+3
+
+-------- switch to master -------
+BEGIN;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+
+######## DROP TABLE mysqltest1.t2 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 4 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+4
+
+-------- switch to master -------
+DROP TABLE mysqltest1.t2;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW TABLES LIKE 't2';
+Tables_in_mysqltest1 (t2)
+
+-------- switch to slave --------
+SHOW TABLES LIKE 't2';
+Tables_in_mysqltest1 (t2)
+
+-------- switch to master -------
+
+######## DROP TEMPORARY TABLE mysqltest1.t23 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 5 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+-------- switch to master -------
+DROP TEMPORARY TABLE mysqltest1.t23;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+SHOW TABLES LIKE 't23';
+Tables_in_mysqltest1 (t23)
+
+-------- switch to slave --------
+SHOW TABLES LIKE 't23';
+Tables_in_mysqltest1 (t23)
+
+-------- switch to master -------
+
+######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 5 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+5
+
+-------- switch to master -------
+RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW TABLES LIKE 't20';
+Tables_in_mysqltest1 (t20)
+t20
+
+-------- switch to slave --------
+SHOW TABLES LIKE 't20';
+Tables_in_mysqltest1 (t20)
+t20
+
+-------- switch to master -------
+
+######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 6 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+6
+
+-------- switch to master -------
+ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+describe mysqltest1.t4;
+Field Type Null Key Default Extra
+f1 bigint(20) YES NULL
+f2 bigint(20) YES NULL
+
+-------- switch to slave --------
+describe mysqltest1.t4;
+Field Type Null Key Default Extra
+f1 bigint(20) YES NULL
+f2 bigint(20) YES NULL
+
+-------- switch to master -------
+
+######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= InnoDB ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 7 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+7
+
+-------- switch to master -------
+CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= InnoDB;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+
+######## CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 8 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+-------- switch to master -------
+CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+
+######## TRUNCATE TABLE mysqltest1.t7 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 8 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+8
+
+-------- switch to master -------
+TRUNCATE TABLE mysqltest1.t7;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SELECT * FROM mysqltest1.t7;
+f1
+
+-------- switch to slave --------
+SELECT * FROM mysqltest1.t7;
+f1
+
+-------- switch to master -------
+
+######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 9 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+9
+
+-------- switch to master -------
+LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+UNLOCK TABLES;
+
+######## UNLOCK TABLES ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 10 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+UNLOCK TABLES;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+LOCK TABLES mysqltest1.t1 READ;
+
+######## UNLOCK TABLES ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 10 + 1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+UNLOCK TABLES;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: MASTER: The INSERT is not committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+TEST-INFO: SLAVE: The INSERT is not committed (Succeeded)
+
+-------- switch to master -------
+LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
+
+######## UNLOCK TABLES ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 10 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+10
+
+-------- switch to master -------
+UNLOCK TABLES;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+
+######## DROP INDEX my_idx6 ON mysqltest1.t6 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 11 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+11
+
+-------- switch to master -------
+DROP INDEX my_idx6 ON mysqltest1.t6;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW INDEX FROM mysqltest1.t6;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+
+-------- switch to slave --------
+SHOW INDEX FROM mysqltest1.t6;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+
+-------- switch to master -------
+
+######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 12 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+12
+
+-------- switch to master -------
+CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW INDEX FROM mysqltest1.t5;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE
+
+-------- switch to slave --------
+SHOW INDEX FROM mysqltest1.t5;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t5 1 my_idx5 1 f1 A NULL NULL NULL YES BTREE
+
+-------- switch to master -------
+
+######## DROP DATABASE mysqltest2 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 13 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+13
+
+-------- switch to master -------
+DROP DATABASE mysqltest2;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW DATABASES LIKE "mysqltest2";
+Database (mysqltest2)
+
+-------- switch to slave --------
+SHOW DATABASES LIKE "mysqltest2";
+Database (mysqltest2)
+
+-------- switch to master -------
+
+######## CREATE DATABASE mysqltest3 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 14 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+14
+
+-------- switch to master -------
+CREATE DATABASE mysqltest3;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW DATABASES LIKE "mysqltest3";
+Database (mysqltest3)
+mysqltest3
+
+-------- switch to slave --------
+SHOW DATABASES LIKE "mysqltest3";
+Database (mysqltest3)
+mysqltest3
+
+-------- switch to master -------
+
+######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 15 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+15
+
+-------- switch to master -------
+CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW PROCEDURE STATUS LIKE 'p1';
+Db mysqltest1
+Name p1
+Type PROCEDURE
+Definer root@localhost
+Modified #
+Created #
+Security_type DEFINER
+Comment
+
+-------- switch to slave --------
+SHOW PROCEDURE STATUS LIKE 'p1';
+Db mysqltest1
+Name p1
+Type PROCEDURE
+Definer root@localhost
+Modified #
+Created #
+Security_type DEFINER
+Comment
+
+-------- switch to master -------
+
+######## ALTER PROCEDURE p1 COMMENT "I have been altered" ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 16 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+16
+
+-------- switch to master -------
+ALTER PROCEDURE p1 COMMENT "I have been altered";
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW PROCEDURE STATUS LIKE 'p1';
+Db mysqltest1
+Name p1
+Type PROCEDURE
+Definer root@localhost
+Modified #
+Created #
+Security_type DEFINER
+Comment I have been altered
+
+-------- switch to slave --------
+SHOW PROCEDURE STATUS LIKE 'p1';
+Db mysqltest1
+Name p1
+Type PROCEDURE
+Definer root@localhost
+Modified #
+Created #
+Security_type DEFINER
+Comment I have been altered
+
+-------- switch to master -------
+
+######## DROP PROCEDURE p1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 17 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+17
+
+-------- switch to master -------
+DROP PROCEDURE p1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW PROCEDURE STATUS LIKE 'p1';
+
+-------- switch to slave --------
+SHOW PROCEDURE STATUS LIKE 'p1';
+
+-------- switch to master -------
+
+######## CREATE OR REPLACE VIEW v1 as select * from t1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 18 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+18
+
+-------- switch to master -------
+CREATE OR REPLACE VIEW v1 as select * from t1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
+
+-------- switch to slave --------
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
+
+-------- switch to master -------
+
+######## ALTER VIEW v1 AS select f1 from t1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 19 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+19
+
+-------- switch to master -------
+ALTER VIEW v1 AS select f1 from t1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
+
+-------- switch to slave --------
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
+
+-------- switch to master -------
+
+######## DROP VIEW IF EXISTS v1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 20 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+20
+
+-------- switch to master -------
+DROP VIEW IF EXISTS v1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW CREATE VIEW v1;
+ERROR 42S02: Table 'mysqltest1.v1' doesn't exist
+
+-------- switch to slave --------
+SHOW CREATE VIEW v1;
+ERROR 42S02: Table 'mysqltest1.v1' doesn't exist
+
+-------- switch to master -------
+
+######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 21 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+21
+
+-------- switch to master -------
+CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer
+trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
+
+-------- switch to slave --------
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer
+trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
+
+-------- switch to master -------
+
+######## DROP TRIGGER trg1 ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 22 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+22
+
+-------- switch to master -------
+DROP TRIGGER trg1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer
+
+-------- switch to slave --------
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer
+
+-------- switch to master -------
+
+######## CREATE USER user1@localhost ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 23 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+23
+
+-------- switch to master -------
+CREATE USER user1@localhost;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SELECT user FROM mysql.user WHERE user = 'user1';
+user
+user1
+
+-------- switch to slave --------
+SELECT user FROM mysql.user WHERE user = 'user1';
+user
+user1
+
+-------- switch to master -------
+
+######## RENAME USER user1@localhost TO rename1@localhost ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 24 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+24
+
+-------- switch to master -------
+RENAME USER user1@localhost TO rename1@localhost;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SELECT user FROM mysql.user WHERE user = 'rename1';
+user
+rename1
+
+-------- switch to slave --------
+SELECT user FROM mysql.user WHERE user = 'rename1';
+user
+rename1
+
+-------- switch to master -------
+
+######## DROP USER rename1@localhost ########
+
+-------- switch to master -------
+INSERT INTO t1 SET f1= 25 + 1;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+26
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+25
+
+-------- switch to master -------
+DROP USER rename1@localhost;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+26
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+26
+
+-------- switch to master -------
+ROLLBACK;
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+26
+
+TEST-INFO: MASTER: The INSERT is committed (Succeeded)
+
+-------- switch to slave --------
+SELECT MAX(f1) FROM t1;
+MAX(f1)
+26
+
+TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
+
+-------- switch to master -------
+SELECT user FROM mysql.user WHERE user = 'rename1';
+user
+
+-------- switch to slave --------
+SELECT user FROM mysql.user WHERE user = 'rename1';
+user
+use test;
+
+-------- switch to master -------
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest3;
diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
new file mode 100644
index 00000000000..914e1497094
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
@@ -0,0 +1,199 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=innodb;
+CREATE TABLE t2 (a INT NOT NULL, KEY(a)) ENGINE=innodb;
+CREATE TABLE t3 (a INT UNIQUE) ENGINE=innodb;
+CREATE TABLE t4 (a INT) ENGINE=innodb;
+show variables like 'slave_transaction_retries';
+Variable_name Value
+slave_transaction_retries 10
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show variables like 'slave_transaction_retries';
+Variable_name Value
+slave_transaction_retries 2
+stop slave;
+begin;
+insert into t2 values (0);
+insert into t1 values(1);
+commit;
+begin;
+select * from t1 for update;
+a
+start slave;
+select * from t2 for update /* dl */;
+a
+commit;
+select * from t1;
+a
+1
+select * from t2 /* must be 1 */;
+a
+0
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+stop slave;
+delete from t3;
+change master to master_log_pos=548;
+begin;
+select * from t2 for update;
+a
+0
+start slave;
+select count(*) from t3 /* must be zero */;
+count(*)
+0
+commit;
+select * from t1;
+a
+1
+1
+select * from t2;
+a
+0
+0
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running #
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+set @my_max_relay_log_size= @@global.max_relay_log_size;
+set global max_relay_log_size=0;
+stop slave;
+delete from t3;
+change master to master_log_pos=548;
+begin;
+select * from t2 for update;
+a
+0
+0
+start slave;
+select count(*) from t3 /* must be zero */;
+count(*)
+0
+commit;
+select * from t1;
+a
+1
+1
+1
+select * from t2;
+a
+0
+0
+0
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running #
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+drop table t1,t2,t3,t4;
+set global max_relay_log_size= @my_max_relay_log_size;
+End of 5.1 tests
diff --git a/mysql-test/suite/rpl/r/rpl_delete_no_where.result b/mysql-test/suite/rpl/r/rpl_delete_no_where.result
new file mode 100644
index 00000000000..78edf4bf3fa
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_delete_no_where.result
@@ -0,0 +1,15 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int, b int) engine=myisam;
+insert into t1 values(1,1);
+select * from t1;
+a b
+1 1
+delete from t1;
+select * from t1;
+a b
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result
new file mode 100644
index 00000000000..f7f1ce66656
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_do_grant.result
@@ -0,0 +1,91 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
+flush privileges;
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
+flush privileges;
+grant select on *.* to rpl_do_grant@localhost;
+grant drop on test.* to rpl_do_grant@localhost;
+show grants for rpl_do_grant@localhost;
+Grants for rpl_do_grant@localhost
+GRANT SELECT ON *.* TO 'rpl_do_grant'@'localhost'
+GRANT DROP ON `test`.* TO 'rpl_do_grant'@'localhost'
+set password for rpl_do_grant@localhost=password("does it work?");
+select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
+password<>_binary''
+1
+update mysql.user set password='' where user='rpl_do_grant';
+flush privileges;
+select password<>'' from mysql.user where user='rpl_do_grant';
+password<>''
+0
+set sql_mode='ANSI_QUOTES';
+set password for rpl_do_grant@localhost=password('does it work?');
+set sql_mode='';
+select password<>'' from mysql.user where user='rpl_do_grant';
+password<>''
+1
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
+flush privileges;
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
+flush privileges;
+show grants for rpl_do_grant@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost'
+show grants for rpl_do_grant@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost'
+create user rpl_do_grant@localhost;
+show grants for rpl_do_grant@localhost;
+Grants for rpl_do_grant@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant'@'localhost'
+show grants for rpl_do_grant2@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+show grants for rpl_do_grant@localhost;
+Grants for rpl_do_grant@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant'@'localhost'
+show grants for rpl_do_grant2@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+rename user rpl_do_grant@localhost to rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT INSERT, DELETE ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT INSERT, DELETE ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT INSERT ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT INSERT ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+revoke all privileges, grant option from rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+show grants for rpl_do_grant2@localhost;
+Grants for rpl_do_grant2@localhost
+GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+drop user rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+show grants for rpl_do_grant2@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
diff --git a/mysql-test/suite/rpl/r/rpl_drop.result b/mysql-test/suite/rpl/r/rpl_drop.result
new file mode 100644
index 00000000000..b83594c9bb1
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_drop.result
@@ -0,0 +1,10 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop table if exists t1, t2;
+create table t1 (a int);
+drop table t1, t2;
+ERROR 42S02: Unknown table 't2'
diff --git a/mysql-test/suite/rpl/r/rpl_drop_db.result b/mysql-test/suite/rpl/r/rpl_drop_db.result
new file mode 100644
index 00000000000..c0efdf5290d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_drop_db.result
@@ -0,0 +1,38 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+create database mysqltest1;
+create table mysqltest1.t1 (n int);
+insert into mysqltest1.t1 values (1);
+select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt';
+create table mysqltest1.t2 (n int);
+create table mysqltest1.t3 (n int);
+drop database mysqltest1;
+ERROR HY000: Error dropping database (can't rmdir './mysqltest1/', errno: 17)
+use mysqltest1;
+show tables;
+Tables_in_mysqltest1
+drop database mysqltest1;
+ERROR HY000: Error dropping database (can't rmdir './mysqltest1/', errno: 17)
+use mysqltest1;
+show tables;
+Tables_in_mysqltest1
+use test;
+create table t1 (n int);
+insert into t1 values (1234);
+use mysqltest1;
+show tables;
+Tables_in_mysqltest1
+use test;
+select * from t1;
+n
+1234
+stop slave;
+drop database mysqltest1;
+drop database mysqltest1;
+use test;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_drop_temp.result b/mysql-test/suite/rpl/r/rpl_drop_temp.result
new file mode 100644
index 00000000000..40d578dd13e
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_drop_temp.result
@@ -0,0 +1,13 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database if not exists mysqltest;
+create temporary table mysqltest.t1 (n int)ENGINE=MyISAM;
+create temporary table mysqltest.t2 (n int)ENGINE=MyISAM;
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 0
+drop database mysqltest;
diff --git a/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result
new file mode 100644
index 00000000000..257baa81b74
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result
@@ -0,0 +1,22 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+reset master;
+change master to master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root";
+start slave;
+create table t1 (n int);
+create table t4 (n int);
+create table t5 (n int);
+create table t6 (n int);
+show tables;
+Tables_in_test
+t1
+t4
+t5
+t6
+stop slave;
+reset slave;
+drop table t1,t4,t5,t6;
diff --git a/mysql-test/suite/rpl/r/rpl_empty_master_crash.result b/mysql-test/suite/rpl/r/rpl_empty_master_crash.result
new file mode 100644
index 00000000000..d57600d7396
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_empty_master_crash.result
@@ -0,0 +1,12 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+load table t1 from master;
+ERROR 08S01: Error connecting to master: Master is not configured
+load table t1 from master;
+ERROR HY000: Error from master: 'Table 'test.t1' doesn't exist'
diff --git a/mysql-test/suite/rpl/r/rpl_err_ignoredtable.result b/mysql-test/suite/rpl/r/rpl_err_ignoredtable.result
new file mode 100644
index 00000000000..f211d5d9a2f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_err_ignoredtable.result
@@ -0,0 +1,42 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int primary key);
+create table t4 (a int primary key);
+insert into t1 values (1),(1);
+Got one of the listed errors
+insert into t4 values (1),(2);
+show tables like 't1';
+Tables_in_test (t1)
+show tables like 't4';
+Tables_in_test (t4)
+t4
+SELECT * FROM test.t4 ORDER BY a;
+a
+1
+2
+drop table t1;
+select get_lock('crash_lock%20C', 10);
+get_lock('crash_lock%20C', 10)
+1
+create table t2 (a int primary key);
+insert into t2 values(1);
+create table t3 (id int);
+insert into t3 values(connection_id());
+update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
+select (@id := id) - id from t3;
+(@id := id) - id
+0
+kill @id;
+drop table t2,t3;
+insert into t4 values (3),(4);
+SELECT * FROM test.t4 ORDER BY a;
+a
+1
+2
+3
+4
+DROP TABLE test.t4;
diff --git a/mysql-test/suite/rpl/r/rpl_events.result b/mysql-test/suite/rpl/r/rpl_events.result
new file mode 100644
index 00000000000..0d7e7bb28a7
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_events.result
@@ -0,0 +1,165 @@
+set global event_scheduler=1;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+set binlog_format=row;
+DROP EVENT IF EXISTS test.justonce;
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
+`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+`c` VARCHAR(50) NOT NULL,
+`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 (c) VALUES ('manually');
+CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1
+(c) VALUES ('from justonce');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
+db name status originator
+test justonce ENABLED 1
+"in the master"
+SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
+id c ts
+1 manually TIMESTAMP
+2 from justonce TIMESTAMP
+affected rows: 2
+"in the slave"
+SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
+id c ts
+1 manually TIMESTAMP
+2 from justonce TIMESTAMP
+affected rows: 2
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
+db name status originator
+DROP EVENT IF EXISTS test.slave_once;
+CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
+INSERT INTO t1(c) VALUES ('from slave_once');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
+db name status originator
+test slave_once ENABLED 2
+DROP EVENT IF EXISTS test.slave_once;
+DROP EVENT IF EXISTS test.justonce;
+CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
+INSERT INTO t1(c) VALUES ('from er');
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er')
+"in the slave"
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er')
+"in the master"
+ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er');
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er')
+"in the slave"
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er')
+"in the master"
+DROP EVENT test.er;
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
+db name status originator
+"in the slave"
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
+db name status originator
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
+DO INSERT INTO t1(c) VALUES ('from slave_terminate');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
+db name status originator
+test slave_terminate ENABLED 2
+DROP EVENT test.slave_terminate;
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
+DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
+db name status originator
+test slave_terminate SLAVESIDE_DISABLED 2
+DROP EVENT test.slave_terminate;
+"in the master"
+DROP TABLE t1;
+set binlog_format=statement;
+DROP EVENT IF EXISTS test.justonce;
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
+`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+`c` VARCHAR(50) NOT NULL,
+`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 (c) VALUES ('manually');
+CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1
+(c) VALUES ('from justonce');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
+db name status originator
+test justonce ENABLED 1
+"in the master"
+SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
+id c ts
+1 manually TIMESTAMP
+2 from justonce TIMESTAMP
+affected rows: 2
+"in the slave"
+SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id;
+id c ts
+1 manually TIMESTAMP
+2 from justonce TIMESTAMP
+affected rows: 2
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
+db name status originator
+DROP EVENT IF EXISTS test.slave_once;
+CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
+INSERT INTO t1(c) VALUES ('from slave_once');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
+db name status originator
+test slave_once ENABLED 2
+DROP EVENT IF EXISTS test.slave_once;
+DROP EVENT IF EXISTS test.justonce;
+CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
+INSERT INTO t1(c) VALUES ('from er');
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er')
+"in the slave"
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er')
+"in the master"
+ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er');
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er')
+"in the slave"
+SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
+db name status originator body
+test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er')
+"in the master"
+DROP EVENT test.er;
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
+db name status originator
+"in the slave"
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
+db name status originator
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
+DO INSERT INTO t1(c) VALUES ('from slave_terminate');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
+db name status originator
+test slave_terminate ENABLED 2
+DROP EVENT test.slave_terminate;
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND
+DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate');
+SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
+db name status originator
+test slave_terminate SLAVESIDE_DISABLED 2
+DROP EVENT test.slave_terminate;
+"in the master"
+DROP TABLE t1;
+CREATE EVENT event1 ON SCHEDULE EVERY 1 YEAR
+DO BEGIN
+select * from t1;
+END;|
+ALTER EVENT event1 RENAME TO event2;
+DROP EVENT event2;
diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
new file mode 100644
index 00000000000..a237edc8063
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
@@ -0,0 +1,749 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** Diff Table Def Start ****
+*** On Slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
+d FLOAT DEFAULT '2.00',
+e CHAR(4) DEFAULT 'TEST')
+ENGINE='InnoDB';
+*** Create t1 on Master ***
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c CHAR(10)
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t1 () VALUES(1,2,'TEXAS'),(2,1,'AUSTIN'),(3,4,'QA');
+SELECT * FROM t1 ORDER BY a;
+a b c
+1 2 TEXAS
+2 1 AUSTIN
+3 4 QA
+*** Select from slave ***
+SELECT * FROM t1 ORDER BY a;
+a b c d e
+1 2 TEXAS 2 TEST
+2 1 AUSTIN 2 TEST
+3 4 QA 2 TEST
+*** Drop t1 ***
+DROP TABLE t1;
+*** Create t3 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t3 (a INT, b INT PRIMARY KEY, c CHAR(20),
+d FLOAT DEFAULT '2.00',
+e CHAR(5) DEFAULT 'TEST2')
+ENGINE='InnoDB';
+*** Create t3 on Master ***
+CREATE TABLE t3 (a BLOB, b INT PRIMARY KEY, c CHAR(20)
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 0 type mismatch - received type 252, test.t3 has type 3
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t3 ***
+DROP TABLE t3;
+*** Create t4 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t4 (a INT, b INT PRIMARY KEY, c CHAR(20),
+d FLOAT DEFAULT '2.00',
+e CHAR(5) DEFAULT 'TEST2')
+ENGINE='InnoDB';
+*** Create t4 on Master ***
+CREATE TABLE t4 (a DECIMAL(8,2), b INT PRIMARY KEY, c CHAR(20)
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
+(30000.22,4,'QA TESTING');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 0 type mismatch - received type 246, test.t4 has type 3
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t4 ***
+DROP TABLE t4;
+*** Create t5 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t5 (a INT PRIMARY KEY, b CHAR(5),
+c FLOAT, d INT, e DOUBLE,
+f DECIMAL(8,2))ENGINE='InnoDB';
+*** Create t5 on Master ***
+CREATE TABLE t5 (a INT PRIMARY KEY, b VARCHAR(6),
+c DECIMAL(8,2), d BIT, e BLOB,
+f FLOAT) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
+(2,'JOE',300.01,0,'b2b2',1.0000009);
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 5 type mismatch - received type 4, test.t5 has type 246
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t5 ***
+DROP TABLE t5;
+*** Create t6 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t6 (a INT PRIMARY KEY, b CHAR(5),
+c FLOAT, d INT)ENGINE='InnoDB';
+*** Create t6 on Master ***
+CREATE TABLE t6 (a INT PRIMARY KEY, b VARCHAR(6),
+c DECIMAL(8,2), d BIT
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
+(2,'JOE',300.01,0);
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 3 type mismatch - received type 16, test.t6 has type 3
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
+*** Drop t6 ***
+DROP TABLE t6;
+DROP TABLE t6;
+START SLAVE;
+**** Diff Table Def End ****
+**** Extra Colums Start ****
+*** Create t7 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t7 (a INT KEY, b BLOB, c CHAR(5),
+d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
+e CHAR(20) DEFAULT 'Extra Column Testing')
+ENGINE='InnoDB';
+*** Create t7 on Master ***
+CREATE TABLE t7 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t7 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+SELECT * FROM t7 ORDER BY a;
+a b c
+1 b1b1 Kyle
+2 b1b1 JOE
+3 b1b1 QA
+*** Select from slave ***
+SELECT * FROM t7 ORDER BY a;
+a b c d e
+1 b1b1 Kyle 0000-00-00 00:00:00 Extra Column Testing
+2 b1b1 JOE 0000-00-00 00:00:00 Extra Column Testing
+3 b1b1 QA 0000-00-00 00:00:00 Extra Column Testing
+*** Drop t7 ***
+DROP TABLE t7;
+*** Create t8 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t8 (a INT KEY, b BLOB, c CHAR(5),
+d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
+e INT)ENGINE='InnoDB';
+*** Create t8 on Master ***
+CREATE TABLE t8 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+*** Drop t8 ***
+DROP TABLE t8;
+*** Create t10 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
+c CHAR(5), e INT DEFAULT '1')ENGINE='InnoDB';
+*** Create t10 on Master ***
+CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 2 type mismatch - received type 254, test.t10 has type 5
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t10 ***
+DROP TABLE t10;
+*** Create t11 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
+c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='InnoDB';
+*** Create t11 on Master ***
+CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 2 type mismatch - received type 15, test.t11 has type 252
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t11 ***
+DROP TABLE t11;
+*** Create t12 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
+c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='InnoDB';
+*** Create t12 on Master ***
+CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t12 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+SELECT * FROM t12 ORDER BY a;
+a b c
+1 b1b1b1b1b1b1b1b1 Kyle
+2 b1b1b1b1b1b1b1b1 JOE
+3 b1b1b1b1b1b1b1b1 QA
+*** Select on Slave ***
+SELECT * FROM t12 ORDER BY a;
+a b f c e
+1 b1b1b1b1b1b1b1b1 Kyle test 1
+2 b1b1b1b1b1b1b1b1 JOE test 1
+3 b1b1b1b1b1b1b1b1 QA test 1
+*** Drop t12 ***
+DROP TABLE t12;
+**** Extra Colums End ****
+*** BUG 22177 Start ***
+*** Create t13 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t13 (a INT KEY, b BLOB, c CHAR(5),
+d INT DEFAULT '1',
+e TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='InnoDB';
+*** Create t13 on Master ***
+CREATE TABLE t13 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t13 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+SELECT * FROM t13 ORDER BY a;
+a b c
+1 b1b1b1b1b1b1b1b1 Kyle
+2 b1b1b1b1b1b1b1b1 JOE
+3 b1b1b1b1b1b1b1b1 QA
+*** Select on Slave ****
+SELECT * FROM t13 ORDER BY a;
+a b c d e
+1 b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
+2 b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
+3 b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+*** Drop t13 ***
+DROP TABLE t13;
+*** 22117 END ***
+*** Alter Master Table Testing Start ***
+*** Create t14 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='InnoDB';
+*** Create t14 on Master ***
+CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
+ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
+(2,2.00,'This Test Should work',@b1,'JOE'),
+(3,3.00,'If is does not, I will open a bug',@b1,'QA');
+SELECT * FROM t14 ORDER BY c1;
+c1 c2 c3 c4 c5
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA
+*** Select on Slave ****
+SELECT * FROM t14 ORDER BY c1;
+c1 c2 c3 c4 c5 c6 c7
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+*** connect to master and drop columns ***
+ALTER TABLE t14 DROP COLUMN c2;
+ALTER TABLE t14 DROP COLUMN c4;
+*** Select from Master ***
+SELECT * FROM t14 ORDER BY c1;
+c1 c3 c5
+1 Replication Testing Extra Col Kyle
+2 This Test Should work JOE
+3 If is does not, I will open a bug QA
+*** Select from Slave ***
+SELECT * FROM t14 ORDER BY c1;
+c1 c3 c5 c6 c7
+1 Replication Testing Extra Col Kyle 1 CURRENT_TIMESTAMP
+2 This Test Should work JOE 1 CURRENT_TIMESTAMP
+3 If is does not, I will open a bug QA 1 CURRENT_TIMESTAMP
+*** Drop t14 ***
+DROP TABLE t14;
+*** Create t15 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t15 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='InnoDB';
+*** Create t15 on Master ***
+CREATE TABLE t15 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5)) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t15 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
+(2,2.00,'This Test Should work',@b1,'JOE'),
+(3,3.00,'If is does not, I will open a bug',@b1,'QA');
+SELECT * FROM t15 ORDER BY c1;
+c1 c2 c3 c4 c5
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA
+*** Select on Slave ****
+SELECT * FROM t15 ORDER BY c1;
+c1 c2 c3 c4 c5 c6 c7
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+*** Add column on master that is a Extra on Slave ***
+ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
+********************************************
+*** Expect slave to fail with Error 1060 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1060
+Last_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Try to insert in master ****
+INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
+SELECT * FROM t15 ORDER BY c1;
+c1 c2 c3 c4 c5 c6
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL
+5 2.00 Replication Testing b1b1b1b1b1b1b1b1 Buda 2
+*** Try to select from slave ****
+SELECT * FROM t15 ORDER BY c1;
+c1 c2 c3 c4 c5 c6 c7
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+*** DROP TABLE t15 ***
+DROP TABLE t15;
+*** Create t16 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t16 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='InnoDB';
+*** Create t16 on Master ***
+CREATE TABLE t16 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5))ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t16 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
+(2,2.00,'This Test Should work',@b1,'JOE'),
+(3,3.00,'If is does not, I will open a bug',@b1,'QA');
+SELECT * FROM t16 ORDER BY c1;
+c1 c2 c3 c4 c5
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA
+*** Select on Slave ****
+SELECT * FROM t16 ORDER BY c1;
+c1 c2 c3 c4 c5 c6 c7
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+*** Add Partition on master ***
+ALTER TABLE t16 PARTITION BY KEY(c1) PARTITIONS 4;
+INSERT INTO t16 () VALUES(4,1.00,'Replication Rocks',@b1,'Omer');
+SHOW CREATE TABLE t16;
+Table Create Table
+t16 CREATE TABLE `t16` (
+ `c1` int(11) NOT NULL,
+ `c2` decimal(8,2) DEFAULT NULL,
+ `c3` text,
+ `c4` blob,
+ `c5` char(5) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c1) PARTITIONS 4 */
+*** Show table on Slave ****
+SHOW CREATE TABLE t16;
+Table Create Table
+t16 CREATE TABLE `t16` (
+ `c1` int(11) NOT NULL,
+ `c2` decimal(8,2) DEFAULT NULL,
+ `c3` text,
+ `c4` blob,
+ `c5` char(5) DEFAULT NULL,
+ `c6` int(11) DEFAULT '1',
+ `c7` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c1) PARTITIONS 4 */
+*** DROP TABLE t16 ***
+DROP TABLE t16;
+*** Alter Master End ***
+*** Create t17 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t17 (a SMALLINT, b INT PRIMARY KEY, c CHAR(5),
+d FLOAT DEFAULT '2.00',
+e CHAR(5) DEFAULT 'TEST2')
+ENGINE='InnoDB';
+*** Create t17 on Master ***
+CREATE TABLE t17 (a BIGINT PRIMARY KEY, b INT, c CHAR(10)
+) ENGINE='InnoDB';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 0 type mismatch - received type 8, test.t17 has type 2
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+** DROP table t17 ***
+DROP TABLE t17;
diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
new file mode 100644
index 00000000000..95f99ba1014
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
@@ -0,0 +1,749 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** Diff Table Def Start ****
+*** On Slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
+d FLOAT DEFAULT '2.00',
+e CHAR(4) DEFAULT 'TEST')
+ENGINE='MyISAM';
+*** Create t1 on Master ***
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c CHAR(10)
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t1 () VALUES(1,2,'TEXAS'),(2,1,'AUSTIN'),(3,4,'QA');
+SELECT * FROM t1 ORDER BY a;
+a b c
+1 2 TEXAS
+2 1 AUSTIN
+3 4 QA
+*** Select from slave ***
+SELECT * FROM t1 ORDER BY a;
+a b c d e
+1 2 TEXAS 2 TEST
+2 1 AUSTIN 2 TEST
+3 4 QA 2 TEST
+*** Drop t1 ***
+DROP TABLE t1;
+*** Create t3 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t3 (a INT, b INT PRIMARY KEY, c CHAR(20),
+d FLOAT DEFAULT '2.00',
+e CHAR(5) DEFAULT 'TEST2')
+ENGINE='MyISAM';
+*** Create t3 on Master ***
+CREATE TABLE t3 (a BLOB, b INT PRIMARY KEY, c CHAR(20)
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 0 type mismatch - received type 252, test.t3 has type 3
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t3 ***
+DROP TABLE t3;
+*** Create t4 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t4 (a INT, b INT PRIMARY KEY, c CHAR(20),
+d FLOAT DEFAULT '2.00',
+e CHAR(5) DEFAULT 'TEST2')
+ENGINE='MyISAM';
+*** Create t4 on Master ***
+CREATE TABLE t4 (a DECIMAL(8,2), b INT PRIMARY KEY, c CHAR(20)
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
+(30000.22,4,'QA TESTING');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 0 type mismatch - received type 246, test.t4 has type 3
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t4 ***
+DROP TABLE t4;
+*** Create t5 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t5 (a INT PRIMARY KEY, b CHAR(5),
+c FLOAT, d INT, e DOUBLE,
+f DECIMAL(8,2))ENGINE='MyISAM';
+*** Create t5 on Master ***
+CREATE TABLE t5 (a INT PRIMARY KEY, b VARCHAR(6),
+c DECIMAL(8,2), d BIT, e BLOB,
+f FLOAT) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
+(2,'JOE',300.01,0,'b2b2',1.0000009);
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 5 type mismatch - received type 4, test.t5 has type 246
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t5 ***
+DROP TABLE t5;
+*** Create t6 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t6 (a INT PRIMARY KEY, b CHAR(5),
+c FLOAT, d INT)ENGINE='MyISAM';
+*** Create t6 on Master ***
+CREATE TABLE t6 (a INT PRIMARY KEY, b VARCHAR(6),
+c DECIMAL(8,2), d BIT
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
+(2,'JOE',300.01,0);
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 3 type mismatch - received type 16, test.t6 has type 3
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
+*** Drop t6 ***
+DROP TABLE t6;
+DROP TABLE t6;
+START SLAVE;
+**** Diff Table Def End ****
+**** Extra Colums Start ****
+*** Create t7 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t7 (a INT KEY, b BLOB, c CHAR(5),
+d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
+e CHAR(20) DEFAULT 'Extra Column Testing')
+ENGINE='MyISAM';
+*** Create t7 on Master ***
+CREATE TABLE t7 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t7 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+SELECT * FROM t7 ORDER BY a;
+a b c
+1 b1b1 Kyle
+2 b1b1 JOE
+3 b1b1 QA
+*** Select from slave ***
+SELECT * FROM t7 ORDER BY a;
+a b c d e
+1 b1b1 Kyle 0000-00-00 00:00:00 Extra Column Testing
+2 b1b1 JOE 0000-00-00 00:00:00 Extra Column Testing
+3 b1b1 QA 0000-00-00 00:00:00 Extra Column Testing
+*** Drop t7 ***
+DROP TABLE t7;
+*** Create t8 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t8 (a INT KEY, b BLOB, c CHAR(5),
+d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
+e INT)ENGINE='MyISAM';
+*** Create t8 on Master ***
+CREATE TABLE t8 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+*** Drop t8 ***
+DROP TABLE t8;
+*** Create t10 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
+c CHAR(5), e INT DEFAULT '1')ENGINE='MyISAM';
+*** Create t10 on Master ***
+CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 2 type mismatch - received type 254, test.t10 has type 5
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t10 ***
+DROP TABLE t10;
+*** Create t11 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
+c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
+*** Create t11 on Master ***
+CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 2 type mismatch - received type 15, test.t11 has type 252
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t11 ***
+DROP TABLE t11;
+*** Create t12 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
+c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
+*** Create t12 on Master ***
+CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t12 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+SELECT * FROM t12 ORDER BY a;
+a b c
+1 b1b1b1b1b1b1b1b1 Kyle
+2 b1b1b1b1b1b1b1b1 JOE
+3 b1b1b1b1b1b1b1b1 QA
+*** Select on Slave ***
+SELECT * FROM t12 ORDER BY a;
+a b f c e
+1 b1b1b1b1b1b1b1b1 Kyle test 1
+2 b1b1b1b1b1b1b1b1 JOE test 1
+3 b1b1b1b1b1b1b1b1 QA test 1
+*** Drop t12 ***
+DROP TABLE t12;
+**** Extra Colums End ****
+*** BUG 22177 Start ***
+*** Create t13 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t13 (a INT KEY, b BLOB, c CHAR(5),
+d INT DEFAULT '1',
+e TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='MyISAM';
+*** Create t13 on Master ***
+CREATE TABLE t13 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t13 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+SELECT * FROM t13 ORDER BY a;
+a b c
+1 b1b1b1b1b1b1b1b1 Kyle
+2 b1b1b1b1b1b1b1b1 JOE
+3 b1b1b1b1b1b1b1b1 QA
+*** Select on Slave ****
+SELECT * FROM t13 ORDER BY a;
+a b c d e
+1 b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
+2 b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
+3 b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+*** Drop t13 ***
+DROP TABLE t13;
+*** 22117 END ***
+*** Alter Master Table Testing Start ***
+*** Create t14 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='MyISAM';
+*** Create t14 on Master ***
+CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
+ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
+(2,2.00,'This Test Should work',@b1,'JOE'),
+(3,3.00,'If is does not, I will open a bug',@b1,'QA');
+SELECT * FROM t14 ORDER BY c1;
+c1 c2 c3 c4 c5
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA
+*** Select on Slave ****
+SELECT * FROM t14 ORDER BY c1;
+c1 c2 c3 c4 c5 c6 c7
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+*** connect to master and drop columns ***
+ALTER TABLE t14 DROP COLUMN c2;
+ALTER TABLE t14 DROP COLUMN c4;
+*** Select from Master ***
+SELECT * FROM t14 ORDER BY c1;
+c1 c3 c5
+1 Replication Testing Extra Col Kyle
+2 This Test Should work JOE
+3 If is does not, I will open a bug QA
+*** Select from Slave ***
+SELECT * FROM t14 ORDER BY c1;
+c1 c3 c5 c6 c7
+1 Replication Testing Extra Col Kyle 1 CURRENT_TIMESTAMP
+2 This Test Should work JOE 1 CURRENT_TIMESTAMP
+3 If is does not, I will open a bug QA 1 CURRENT_TIMESTAMP
+*** Drop t14 ***
+DROP TABLE t14;
+*** Create t15 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t15 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='MyISAM';
+*** Create t15 on Master ***
+CREATE TABLE t15 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5)) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t15 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
+(2,2.00,'This Test Should work',@b1,'JOE'),
+(3,3.00,'If is does not, I will open a bug',@b1,'QA');
+SELECT * FROM t15 ORDER BY c1;
+c1 c2 c3 c4 c5
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA
+*** Select on Slave ****
+SELECT * FROM t15 ORDER BY c1;
+c1 c2 c3 c4 c5 c6 c7
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+*** Add column on master that is a Extra on Slave ***
+ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
+********************************************
+*** Expect slave to fail with Error 1060 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1060
+Last_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Try to insert in master ****
+INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
+SELECT * FROM t15 ORDER BY c1;
+c1 c2 c3 c4 c5 c6
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL
+5 2.00 Replication Testing b1b1b1b1b1b1b1b1 Buda 2
+*** Try to select from slave ****
+SELECT * FROM t15 ORDER BY c1;
+c1 c2 c3 c4 c5 c6 c7
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+*** DROP TABLE t15 ***
+DROP TABLE t15;
+*** Create t16 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t16 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='MyISAM';
+*** Create t16 on Master ***
+CREATE TABLE t16 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5))ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t16 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
+(2,2.00,'This Test Should work',@b1,'JOE'),
+(3,3.00,'If is does not, I will open a bug',@b1,'QA');
+SELECT * FROM t16 ORDER BY c1;
+c1 c2 c3 c4 c5
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA
+*** Select on Slave ****
+SELECT * FROM t16 ORDER BY c1;
+c1 c2 c3 c4 c5 c6 c7
+1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
+2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
+3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
+*** Add Partition on master ***
+ALTER TABLE t16 PARTITION BY KEY(c1) PARTITIONS 4;
+INSERT INTO t16 () VALUES(4,1.00,'Replication Rocks',@b1,'Omer');
+SHOW CREATE TABLE t16;
+Table Create Table
+t16 CREATE TABLE `t16` (
+ `c1` int(11) NOT NULL,
+ `c2` decimal(8,2) DEFAULT NULL,
+ `c3` text,
+ `c4` blob,
+ `c5` char(5) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c1) PARTITIONS 4 */
+*** Show table on Slave ****
+SHOW CREATE TABLE t16;
+Table Create Table
+t16 CREATE TABLE `t16` (
+ `c1` int(11) NOT NULL,
+ `c2` decimal(8,2) DEFAULT NULL,
+ `c3` text,
+ `c4` blob,
+ `c5` char(5) DEFAULT NULL,
+ `c6` int(11) DEFAULT '1',
+ `c7` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`c1`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c1) PARTITIONS 4 */
+*** DROP TABLE t16 ***
+DROP TABLE t16;
+*** Alter Master End ***
+*** Create t17 on slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t17 (a SMALLINT, b INT PRIMARY KEY, c CHAR(5),
+d FLOAT DEFAULT '2.00',
+e CHAR(5) DEFAULT 'TEST2')
+ENGINE='MyISAM';
+*** Create t17 on Master ***
+CREATE TABLE t17 (a BIGINT PRIMARY KEY, b INT, c CHAR(10)
+) ENGINE='MyISAM';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 0 type mismatch - received type 8, test.t17 has type 2
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+** DROP table t17 ***
+DROP TABLE t17;
diff --git a/mysql-test/suite/rpl/r/rpl_failed_optimize.result b/mysql-test/suite/rpl/r/rpl_failed_optimize.result
new file mode 100644
index 00000000000..7e397550331
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_failed_optimize.result
@@ -0,0 +1,24 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize error Lock wait timeout exceeded; try restarting transaction
+test.t1 optimize status Operation failed
+Warnings:
+Error 1205 Lock wait timeout exceeded; try restarting transaction
+OPTIMIZE TABLE non_existing;
+Table Op Msg_type Msg_text
+test.non_existing optimize Error Table 'test.non_existing' doesn't exist
+test.non_existing optimize error Corrupt
+select * from t1;
+a
+1
+commit;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
new file mode 100644
index 00000000000..1e90796b2ea
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
@@ -0,0 +1,54 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+change master to master_host='127.0.0.1',master_user='root',
+master_password='',master_port=MASTER_PORT;
+start slave;
+stop slave;
+change master to master_host='127.0.0.1',master_user='root',
+master_password='',master_port=SLAVE_PORT;
+start slave;
+
+let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%' ;
+
+--source include/wait_slave_status.inc
+flush logs;
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port SLAVE_PORT
+Connect_Retry 60
+Master_Log_File slave-bin.000001
+Read_Master_Log_Pos 216
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File slave-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 216
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
diff --git a/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result b/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result
new file mode 100644
index 00000000000..2239c32eea3
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result
@@ -0,0 +1,42 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT AUTO_INCREMENT KEY) ENGINE=INNODB;
+CREATE TABLE t2 (b INT AUTO_INCREMENT KEY, c INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=INNODB;
+SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO t1 VALUES (10);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
+INSERT INTO t2 VALUES (5,0);
+INSERT INTO t2 VALUES (NULL,LAST_INSERT_ID());
+SET FOREIGN_KEY_CHECKS=1;
+SELECT * FROM t1 ORDER BY a;
+a
+10
+11
+12
+13
+SELECT * FROM t2 ORDER BY b;
+b c
+5 0
+6 11
+SELECT * FROM t1 ORDER BY a;
+a
+10
+11
+12
+13
+SELECT * FROM t2 ORDER BY b;
+b c
+5 0
+6 11
+SET TIMESTAMP=1000000000;
+CREATE TABLE t3 ( a INT UNIQUE );
+SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO t3 VALUES (1),(1);
+Got one of the listed errors
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE IF EXISTS t1,t2,t3;
+SET FOREIGN_KEY_CHECKS=1;
diff --git a/mysql-test/suite/rpl/r/rpl_free_items.result b/mysql-test/suite/rpl/r/rpl_free_items.result
new file mode 100644
index 00000000000..91c1e2aa6e5
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_free_items.result
@@ -0,0 +1,10 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int);
+create table t2 (a int);
+drop table t1;
+drop table t2;
diff --git a/mysql-test/suite/rpl/r/rpl_get_lock.result b/mysql-test/suite/rpl/r/rpl_get_lock.result
new file mode 100644
index 00000000000..235640acad0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_get_lock.result
@@ -0,0 +1,35 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(n int);
+insert into t1 values(get_lock("lock",2));
+select get_lock("lock",2);
+get_lock("lock",2)
+1
+select release_lock("lock");
+release_lock("lock")
+1
+select get_lock("lock",3);
+get_lock("lock",3)
+1
+select * from t1;
+n
+1
+select is_free_lock("lock"), is_used_lock("lock") = connection_id();
+is_free_lock("lock") is_used_lock("lock") = connection_id()
+0 1
+explain extended select is_free_lock("lock"), is_used_lock("lock");
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select is_free_lock(_latin1'lock') AS `is_free_lock("lock")`,is_used_lock(_latin1'lock') AS `is_used_lock("lock")`
+select is_free_lock("lock2");
+is_free_lock("lock2")
+1
+select is_free_lock(NULL);
+is_free_lock(NULL)
+NULL
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_grant.result b/mysql-test/suite/rpl/r/rpl_ignore_grant.result
new file mode 100644
index 00000000000..5169cc8e888
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_ignore_grant.result
@@ -0,0 +1,37 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
+flush privileges;
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
+flush privileges;
+grant select on *.* to rpl_ignore_grant@localhost;
+grant drop on test.* to rpl_ignore_grant@localhost;
+show grants for rpl_ignore_grant@localhost;
+Grants for rpl_ignore_grant@localhost
+GRANT SELECT ON *.* TO 'rpl_ignore_grant'@'localhost'
+GRANT DROP ON `test`.* TO 'rpl_ignore_grant'@'localhost'
+show grants for rpl_ignore_grant@localhost;
+ERROR 42000: There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost'
+select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
+count(*)
+0
+select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
+count(*)
+0
+grant select on *.* to rpl_ignore_grant@localhost;
+set password for rpl_ignore_grant@localhost=password("does it work?");
+select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
+password<>_binary''
+0
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
+flush privileges;
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
+flush privileges;
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_revoke.result b/mysql-test/suite/rpl/r/rpl_ignore_revoke.result
new file mode 100644
index 00000000000..b1ccd2f0442
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_ignore_revoke.result
@@ -0,0 +1,30 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
+revoke select on *.* from 'user_foo'@'%';
+select select_priv from mysql.user where user='user_foo' /* master:must be N */;
+select_priv
+N
+grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
+revoke select on *.* from 'user_foo'@'%';
+select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
+select_priv
+N
+grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
+select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
+select_priv
+Y
+revoke select on *.* from 'user_foo';
+select select_priv from mysql.user where user='user_foo' /* master:must be N */;
+select_priv
+N
+select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
+select_priv
+Y
+revoke select on *.* FROM 'user_foo';
+delete from mysql.user where user="user_foo";
+delete from mysql.user where user="user_foo";
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result
new file mode 100644
index 00000000000..e7200b31212
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result
@@ -0,0 +1,140 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** Test case for BUG#16487 ****
+**** Master ****
+CREATE TABLE test.t4 (a int);
+CREATE TABLE test.t1 (a int);
+UPDATE test.t4 NATURAL JOIN test.t1 SET t1.a=5;
+**** Slave ****
+SELECT * FROM t4;
+a
+DROP TABLE t1;
+DROP TABLE t4;
+**** Test case for BUG#25482 ****
+**** Adding GRANTS on master ****
+create table test.t1(a int);
+create table test.t4(a int);
+GRANT SELECT ON test.t1 TO mysqltest1@localhost;
+GRANT INSERT ON test.t4 TO mysqltest2@localhost;
+GRANT select, update, insert, references on t1
+to mysqltest2@localhost;
+GRANT SELECT ON test.* TO mysqltest3@localhost;
+GRANT INSERT ON test.t4 TO mysqltest3@localhost;
+GRANT select(a), update(a), insert(a), references(a) on t4
+to mysqltest3@localhost;
+create database mysqltest2;
+create table mysqltest2.t2 (id int);
+GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass';
+insert into mysql.user (user, host) values ("mysqltest5", "somehost");
+Warnings:
+Warning 1364 Field 'ssl_cipher' doesn't have a default value
+Warning 1364 Field 'x509_issuer' doesn't have a default value
+Warning 1364 Field 'x509_subject' doesn't have a default value
+GRANT SELECT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON test.* TO mysqltest6@localhost;
+GRANT INSERT ON test.t1 TO mysqltest6@localhost;
+show grants for mysqltest1@localhost;
+Grants for mysqltest1@localhost
+GRANT USAGE ON *.* TO 'mysqltest1'@'localhost'
+GRANT SELECT ON `test`.`t1` TO 'mysqltest1'@'localhost'
+show grants for mysqltest2@localhost;
+Grants for mysqltest2@localhost
+GRANT USAGE ON *.* TO 'mysqltest2'@'localhost'
+GRANT SELECT, INSERT, UPDATE, REFERENCES ON `test`.`t1` TO 'mysqltest2'@'localhost'
+GRANT INSERT ON `test`.`t4` TO 'mysqltest2'@'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT SELECT (a), INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+GRANT SELECT ON `mysqltest2`.`t2` TO 'mysqltest4'@'localhost'
+show grants for mysqltest6@localhost;
+Grants for mysqltest6@localhost
+GRANT SELECT, INSERT ON *.* TO 'mysqltest6'@'localhost'
+GRANT INSERT ON `test`.* TO 'mysqltest6'@'localhost'
+GRANT INSERT ON `test`.`t1` TO 'mysqltest6'@'localhost'
+flush privileges;
+show grants for mysqltest5@somehost;
+Grants for mysqltest5@somehost
+GRANT USAGE ON *.* TO 'mysqltest5'@'somehost'
+**** Checking grants on slave ****
+show grants for mysqltest2@localhost;
+Grants for mysqltest2@localhost
+GRANT USAGE ON *.* TO 'mysqltest2'@'localhost'
+GRANT INSERT ON `test`.`t4` TO 'mysqltest2'@'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT SELECT (a), INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+GRANT SELECT ON `mysqltest2`.`t2` TO 'mysqltest4'@'localhost'
+show grants for mysqltest5@somehost;
+Grants for mysqltest5@somehost
+GRANT USAGE ON *.* TO 'mysqltest5'@'somehost'
+show grants for mysqltest6@localhost;
+Grants for mysqltest6@localhost
+GRANT SELECT, INSERT ON *.* TO 'mysqltest6'@'localhost'
+GRANT INSERT ON `test`.* TO 'mysqltest6'@'localhost'
+show grants for mysqltest1@localhost;
+ERROR 42000: There is no such grant defined for user 'mysqltest1' on host 'localhost'
+**** Revoking grants on master ****
+REVOKE SELECT ON test.t1 FROM mysqltest1@localhost;
+REVOKE SELECT ON mysqltest2.t2 FROM mysqltest4@localhost;
+REVOKE select(a) on t4
+from mysqltest3@localhost;
+show grants for mysqltest1@localhost;
+Grants for mysqltest1@localhost
+GRANT USAGE ON *.* TO 'mysqltest1'@'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+**** Checking grants on slave ****
+show grants for mysqltest1@localhost;
+ERROR 42000: There is no such grant defined for user 'mysqltest1' on host 'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+drop table t1, t4, mysqltest2.t2;
+drop database mysqltest2;
+delete from mysql.user where user like "mysqltest%";
+delete from mysql.db where user like "mysqltest%";
+delete from mysql.columns_priv where user like "mysqltest%";
+delete from mysql.tables_priv where user like "mysqltest%";
+delete from mysql.tables_priv where user like "mysqltest%";
+DROP TABLE IF EXISTS t5;
+CREATE TABLE t5 (
+word varchar(50) collate utf8_unicode_ci NOT NULL default ''
+) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+SET @@session.character_set_client=33,@@session.collation_connection=192;
+CREATE TEMPORARY TABLE tmptbl504451f4258$1 (id INT NOT NULL) ENGINE=MEMORY;
+INSERT INTO t5 (word) VALUES ('TEST’');
+SELECT HEX(word) FROM t5;
+HEX(word)
+54455354E28099
+SELECT HEX(word) FROM t5;
+HEX(word)
+54455354E28099
+SELECT * FROM tmptbl504451f4258$1;
+ERROR 42S02: Table 'test.tmptbl504451f4258$1' doesn't exist
+DROP TABLE t5;
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table_update.result b/mysql-test/suite/rpl/r/rpl_ignore_table_update.result
new file mode 100644
index 00000000000..a88a3c690ed
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_ignore_table_update.result
@@ -0,0 +1,23 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+use test;
+drop table if exists mysqltest_foo;
+drop table if exists mysqltest_bar;
+create table mysqltest_foo (n int);
+insert into mysqltest_foo values(4);
+use test;
+create table mysqltest_foo (n int);
+insert into mysqltest_foo values(5);
+create table mysqltest_bar (m int);
+insert into mysqltest_bar values(15);
+create table t1 (k int);
+insert into t1 values(55);
+select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1;
+n m k
+4 15 55
+drop table mysqltest_foo,mysqltest_bar,t1;
+drop table mysqltest_foo,mysqltest_bar,t1;
diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result
new file mode 100644
index 00000000000..1a0da45f3e1
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_incident.result
@@ -0,0 +1,106 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM t1;
+a
+1
+2
+3
+REPLACE INTO t1 VALUES (4);
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+**** On Slave ****
+SELECT * FROM t1;
+a
+1
+2
+3
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File #
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1586
+Last_Error The incident LOST_EVENTS occured on the master. Message: <none>
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
+START SLAVE;
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File #
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000002
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_init_slave.result b/mysql-test/suite/rpl/r/rpl_init_slave.result
new file mode 100644
index 00000000000..740c918976c
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_init_slave.result
@@ -0,0 +1,27 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+show variables like 'init_slave';
+Variable_name Value
+init_slave set global max_connections=500
+show variables like 'max_connections';
+Variable_name Value
+max_connections 500
+reset master;
+show variables like 'init_slave';
+Variable_name Value
+init_slave
+show variables like 'max_connections';
+Variable_name Value
+max_connections 151
+set @my_global_init_connect= @@global.init_connect;
+set global init_connect="set @c=1";
+show variables like 'init_connect';
+Variable_name Value
+init_connect set @c=1
+stop slave;
+set global init_connect= @my_global_init_connect;
+set global max_connections= default;
diff --git a/mysql-test/suite/rpl/r/rpl_innodb.result b/mysql-test/suite/rpl/r/rpl_innodb.result
new file mode 100644
index 00000000000..765de8af458
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_innodb.result
@@ -0,0 +1,37 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t4 (
+id INT(5) unsigned NOT NULL auto_increment,
+name varchar(15) NOT NULL default '',
+number varchar(35) NOT NULL default 'default',
+PRIMARY KEY (id),
+UNIQUE KEY unique_rec (name,number)
+) ENGINE=InnoDB;
+LOAD DATA
+INFILE '../std_data_ln/loaddata_pair.dat'
+REPLACE INTO TABLE t4
+(name,number);
+SELECT * FROM t4;
+id name number
+1 XXX 12345
+2 XXY 12345
+SELECT * FROM t4;
+id name number
+1 XXX 12345
+2 XXY 12345
+LOAD DATA
+INFILE '../std_data_ln/loaddata_pair.dat'
+REPLACE INTO TABLE t4
+(name,number);
+SELECT * FROM t4;
+id name number
+3 XXX 12345
+4 XXY 12345
+SELECT * FROM t4;
+id name number
+3 XXX 12345
+4 XXY 12345
diff --git a/mysql-test/suite/rpl/r/rpl_insert.result b/mysql-test/suite/rpl/r/rpl_insert.result
new file mode 100644
index 00000000000..b6a97926f73
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_insert.result
@@ -0,0 +1,23 @@
+#
+# Bug#20821: INSERT DELAYED fails to write some rows to binlog
+#
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE SCHEMA IF NOT EXISTS mysqlslap;
+USE mysqlslap;
+CREATE TABLE t1 (id INT, name VARCHAR(64));
+SELECT COUNT(*) FROM mysqlslap.t1;
+COUNT(*)
+5000
+SELECT COUNT(*) FROM mysqlslap.t1;
+COUNT(*)
+5000
+#
+# Cleanup
+#
+USE test;
+DROP SCHEMA mysqlslap;
diff --git a/mysql-test/suite/rpl/r/rpl_insert_id.result b/mysql-test/suite/rpl/r/rpl_insert_id.result
new file mode 100644
index 00000000000..b0c1b6cfd73
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_insert_id.result
@@ -0,0 +1,538 @@
+#
+# Setup
+#
+use test;
+drop table if exists t1, t2, t3;
+#
+# See if queries that use both auto_increment and LAST_INSERT_ID()
+# are replicated well
+#
+# We also check how the foreign_key_check variable is replicated
+#
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(a int auto_increment, key(a));
+create table t2(b int auto_increment, c int, key(b));
+insert into t1 values (1),(2),(3);
+insert into t1 values (null);
+insert into t2 values (null,last_insert_id());
+select * from t1 ORDER BY a;
+a
+1
+2
+3
+4
+select * from t2 ORDER BY b;
+b c
+1 4
+drop table t1;
+drop table t2;
+create table t1(a int auto_increment, key(a)) engine=innodb;
+create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=innodb;
+SET FOREIGN_KEY_CHECKS=0;
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 values (null,last_insert_id());
+SET FOREIGN_KEY_CHECKS=1;
+select * from t1;
+a
+10
+11
+12
+13
+select * from t2;
+b c
+5 0
+6 11
+#
+# check if INSERT SELECT in auto_increment is well replicated (bug #490)
+#
+drop table t2;
+drop table t1;
+create table t1(a int auto_increment, key(a));
+create table t2(b int auto_increment, c int, key(b));
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 (c) select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
+b c
+5 0
+6 10
+7 11
+8 12
+9 13
+select * from t1 ORDER BY a;
+a
+10
+11
+12
+13
+select * from t2 ORDER BY b;
+b c
+5 0
+6 10
+7 11
+8 12
+9 13
+drop table t1;
+drop table t2;
+#
+# Bug#8412: Error codes reported in binary log for CHARACTER SET,
+# FOREIGN_KEY_CHECKS
+#
+SET TIMESTAMP=1000000000;
+CREATE TABLE t1 ( a INT UNIQUE );
+SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO t1 VALUES (1),(1);
+Got one of the listed errors
+drop table t1;
+#
+# Bug#14553: NULL in WHERE resets LAST_INSERT_ID
+#
+create table t1(a int auto_increment, key(a));
+create table t2(a int);
+insert into t1 (a) values (null);
+insert into t2 (a) select a from t1 where a is null;
+insert into t2 (a) select a from t1 where a is null;
+select * from t2;
+a
+1
+select * from t2;
+a
+1
+drop table t1;
+drop table t2;
+#
+# End of 4.1 tests
+#
+#
+# BUG#15728: LAST_INSERT_ID function inside a stored function returns 0
+#
+# The solution is not to reset last_insert_id on enter to sub-statement.
+#
+drop function if exists bug15728;
+drop function if exists bug15728_insert;
+drop table if exists t1, t2;
+create table t1 (
+id int not null auto_increment,
+last_id int,
+primary key (id)
+);
+create function bug15728() returns int(11)
+return last_insert_id();
+insert into t1 (last_id) values (0);
+insert into t1 (last_id) values (last_insert_id());
+insert into t1 (last_id) values (bug15728());
+create table t2 (
+id int not null auto_increment,
+last_id int,
+primary key (id)
+);
+create function bug15728_insert() returns int(11) modifies sql data
+begin
+insert into t2 (last_id) values (bug15728());
+return bug15728();
+end|
+create trigger t1_bi before insert on t1 for each row
+begin
+declare res int;
+select bug15728_insert() into res;
+set NEW.last_id = res;
+end|
+insert into t1 (last_id) values (0);
+drop trigger t1_bi;
+select last_insert_id();
+last_insert_id()
+4
+select bug15728_insert();
+bug15728_insert()
+2
+select last_insert_id();
+last_insert_id()
+4
+insert into t1 (last_id) values (bug15728());
+select last_insert_id();
+last_insert_id()
+5
+drop procedure if exists foo;
+create procedure foo()
+begin
+declare res int;
+insert into t2 (last_id) values (bug15728());
+insert into t1 (last_id) values (bug15728());
+end|
+call foo();
+select * from t1;
+id last_id
+1 0
+2 1
+3 2
+4 1
+5 4
+6 3
+select * from t2;
+id last_id
+1 3
+2 4
+3 5
+select * from t1;
+id last_id
+1 0
+2 1
+3 2
+4 1
+5 4
+6 3
+select * from t2;
+id last_id
+1 3
+2 4
+3 5
+drop function bug15728;
+drop function bug15728_insert;
+drop table t1,t2;
+drop procedure foo;
+create table t1 (n int primary key auto_increment not null,
+b int, unique(b));
+set sql_log_bin=0;
+insert into t1 values(null,100);
+replace into t1 values(null,50),(null,100),(null,150);
+select * from t1 order by n;
+n b
+2 50
+3 100
+4 150
+truncate table t1;
+set sql_log_bin=1;
+insert into t1 values(null,100);
+select * from t1 order by n;
+n b
+1 100
+insert into t1 values(null,200),(null,300);
+delete from t1 where b <> 100;
+select * from t1 order by n;
+n b
+1 100
+replace into t1 values(null,100),(null,350);
+select * from t1 order by n;
+n b
+2 100
+3 350
+select * from t1 order by n;
+n b
+2 100
+3 350
+insert into t1 values (NULL,400),(3,500),(NULL,600) on duplicate key UPDATE n=1000;
+select * from t1 order by n;
+n b
+2 100
+4 400
+1000 350
+1001 600
+select * from t1 order by n;
+n b
+2 100
+4 400
+1000 350
+1001 600
+drop table t1;
+create table t1 (n int primary key auto_increment not null,
+b int, unique(b));
+insert into t1 values(null,100);
+select * from t1 order by n;
+n b
+1 100
+insert into t1 values(null,200),(null,300);
+delete from t1 where b <> 100;
+select * from t1 order by n;
+n b
+1 100
+insert into t1 values(null,100),(null,350) on duplicate key update n=2;
+select * from t1 order by n;
+n b
+2 100
+3 350
+select * from t1 order by n;
+n b
+2 100
+3 350
+drop table t1;
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
+UNIQUE(b));
+INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
+SELECT * FROM t1;
+a b
+1 10
+2 2
+SELECT * FROM t1;
+a b
+1 10
+2 2
+drop table t1;
+CREATE TABLE t1 (
+id bigint(20) unsigned NOT NULL auto_increment,
+field_1 int(10) unsigned NOT NULL,
+field_2 varchar(255) NOT NULL,
+field_3 varchar(255) NOT NULL,
+PRIMARY KEY (id),
+UNIQUE KEY field_1 (field_1, field_2)
+);
+CREATE TABLE t2 (
+field_a int(10) unsigned NOT NULL,
+field_b varchar(255) NOT NULL,
+field_c varchar(255) NOT NULL
+);
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (1, 'a', '1a');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (2, 'b', '2b');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (4, 'd', '4d');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (5, 'e', '5e');
+INSERT INTO t1 (field_1, field_2, field_3)
+SELECT t2.field_a, t2.field_b, t2.field_c
+FROM t2
+ON DUPLICATE KEY UPDATE
+t1.field_3 = t2.field_c;
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f');
+INSERT INTO t1 (field_1, field_2, field_3)
+SELECT t2.field_a, t2.field_b, t2.field_c
+FROM t2
+ON DUPLICATE KEY UPDATE
+t1.field_3 = t2.field_c;
+SELECT * FROM t1;
+id field_1 field_2 field_3
+1 1 a 1a
+2 2 b 2b
+3 3 c 3c
+4 4 d 4d
+5 5 e 5e
+6 6 f 6f
+SELECT * FROM t1;
+id field_1 field_2 field_3
+1 1 a 1a
+2 2 b 2b
+3 3 c 3c
+4 4 d 4d
+5 5 e 5e
+6 6 f 6f
+drop table t1, t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP TABLE IF EXISTS t1, t2;
+SELECT LAST_INSERT_ID(0);
+LAST_INSERT_ID(0)
+0
+CREATE TABLE t1 (
+id INT NOT NULL DEFAULT 0,
+last_id INT,
+PRIMARY KEY (id)
+);
+CREATE TABLE t2 (
+id INT NOT NULL AUTO_INCREMENT,
+last_id INT,
+PRIMARY KEY (id)
+);
+CREATE PROCEDURE p1()
+BEGIN
+INSERT INTO t2 (last_id) VALUES (LAST_INSERT_ID());
+INSERT INTO t1 (last_id) VALUES (LAST_INSERT_ID());
+END|
+CALL p1();
+SELECT * FROM t1;
+id last_id
+0 1
+SELECT * FROM t2;
+id last_id
+1 0
+SELECT * FROM t1;
+id last_id
+0 1
+SELECT * FROM t2;
+id last_id
+1 0
+DROP PROCEDURE p1;
+DROP TABLE t1, t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+DROP FUNCTION IF EXISTS f3;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (
+i INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+j INT DEFAULT 0
+);
+CREATE TABLE t2 (i INT);
+CREATE PROCEDURE p1()
+BEGIN
+INSERT INTO t1 (i) VALUES (NULL);
+INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+INSERT INTO t1 (i) VALUES (NULL), (NULL);
+INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+END |
+CREATE FUNCTION f1() RETURNS INT MODIFIES SQL DATA
+BEGIN
+INSERT INTO t1 (i) VALUES (NULL);
+INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+INSERT INTO t1 (i) VALUES (NULL), (NULL);
+INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+RETURN 0;
+END |
+CREATE FUNCTION f2() RETURNS INT NOT DETERMINISTIC
+RETURN LAST_INSERT_ID() |
+CREATE FUNCTION f3() RETURNS INT MODIFIES SQL DATA
+BEGIN
+INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+RETURN 0;
+END |
+INSERT INTO t1 VALUES (NULL, -1);
+CALL p1();
+SELECT f1();
+f1()
+0
+INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
+(NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
+INSERT INTO t1 VALUES (NULL, f2());
+INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
+(NULL, @@LAST_INSERT_ID);
+INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
+UPDATE t1 SET j= -1 WHERE i IS NULL;
+INSERT INTO t1 (i) VALUES (NULL);
+INSERT INTO t1 (i) VALUES (NULL);
+SELECT f3();
+f3()
+0
+SELECT * FROM t1;
+i j
+1 -1
+2 0
+3 0
+4 0
+5 0
+6 0
+7 0
+8 3
+9 3
+10 3
+11 3
+12 3
+13 8
+14 13
+15 5
+16 13
+17 -1
+18 14
+19 0
+20 0
+SELECT * FROM t2;
+i
+2
+3
+5
+6
+19
+SELECT * FROM t1;
+i j
+1 -1
+2 0
+3 0
+4 0
+5 0
+6 0
+7 0
+8 3
+9 3
+10 3
+11 3
+12 3
+13 8
+14 13
+15 5
+16 13
+17 -1
+18 14
+19 0
+20 0
+SELECT * FROM t2;
+i
+2
+3
+5
+6
+19
+DROP PROCEDURE p1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP FUNCTION f3;
+DROP TABLE t1, t2;
+#
+# End of 5.0 tests
+#
+create table t2 (
+id int not null auto_increment,
+last_id int,
+primary key (id)
+);
+truncate table t2;
+create table t1 (id tinyint primary key);
+create function insid() returns int
+begin
+insert into t2 (last_id) values (0);
+return 0;
+end|
+set sql_log_bin=0;
+insert into t2 (id) values(1),(2),(3);
+delete from t2;
+set sql_log_bin=1;
+select insid();
+insid()
+0
+set sql_log_bin=0;
+insert into t2 (id) values(5),(6),(7);
+delete from t2 where id>=5;
+set sql_log_bin=1;
+insert into t1 select insid();
+select * from t1;
+id
+0
+select * from t2;
+id last_id
+4 0
+8 0
+select * from t1;
+id
+0
+select * from t2;
+id last_id
+4 0
+8 0
+drop table t1;
+drop function insid;
+truncate table t2;
+create table t1 (n int primary key auto_increment not null,
+b int, unique(b));
+create procedure foo()
+begin
+insert into t1 values(null,10);
+insert ignore into t1 values(null,10);
+insert ignore into t1 values(null,10);
+insert into t2 values(null,3);
+end|
+call foo();
+select * from t1;
+n b
+1 10
+select * from t2;
+id last_id
+1 3
+select * from t1;
+n b
+1 10
+select * from t2;
+id last_id
+1 3
+drop table t1, t2;
+drop procedure foo;
diff --git a/mysql-test/suite/rpl/r/rpl_insert_id_pk.result b/mysql-test/suite/rpl/r/rpl_insert_id_pk.result
new file mode 100644
index 00000000000..79815355332
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_insert_id_pk.result
@@ -0,0 +1,76 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(a int auto_increment, primary key(a));
+create table t2(b int auto_increment, c int, primary key(b));
+insert into t1 values (1),(2),(3);
+insert into t1 values (null);
+insert into t2 values (null,last_insert_id());
+select * from t1 ORDER BY a;
+a
+1
+2
+3
+4
+select * from t2 ORDER BY b;
+b c
+1 4
+drop table t1;
+drop table t2;
+create table t1(a int auto_increment, key(a)) engine=innodb;
+create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=innodb;
+SET FOREIGN_KEY_CHECKS=0;
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 values (null,last_insert_id());
+SET FOREIGN_KEY_CHECKS=1;
+select * from t1;
+a
+10
+11
+12
+13
+select * from t2;
+b c
+5 0
+6 11
+drop table t2;
+drop table t1;
+create table t1(a int auto_increment, primary key(a));
+create table t2(b int auto_increment, c int, primary key(b));
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 (c) select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
+b c
+5 0
+6 10
+7 11
+8 12
+9 13
+select * from t1 ORDER BY a;
+a
+10
+11
+12
+13
+select * from t2 ORDER BY b;
+b c
+5 0
+6 10
+7 11
+8 12
+9 13
+drop table t1;
+drop table t2;
+SET TIMESTAMP=1000000000;
+CREATE TABLE t1 ( a INT UNIQUE );
+SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO t1 VALUES (1),(1);
+Got one of the listed errors
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_insert_ignore.result b/mysql-test/suite/rpl/r/rpl_insert_ignore.result
new file mode 100644
index 00000000000..da24c86627c
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_insert_ignore.result
@@ -0,0 +1,70 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=innodb;
+CREATE TABLE t2 (
+a int unsigned, # to force INSERT SELECT to have a certain order
+b int unsigned
+) ENGINE=innodb;
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 2);
+INSERT INTO t1 VALUES (NULL, 3);
+INSERT INTO t1 VALUES (NULL, 4);
+INSERT INTO t2 VALUES (1, 1);
+INSERT INTO t2 VALUES (2, 2);
+INSERT INTO t2 VALUES (3, 5);
+INSERT INTO t2 VALUES (4, 3);
+INSERT INTO t2 VALUES (5, 4);
+INSERT INTO t2 VALUES (6, 6);
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+drop table t1;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=myisam;
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+drop table t1, t2;
diff --git a/mysql-test/suite/rpl/r/rpl_insert_select.result b/mysql-test/suite/rpl/r/rpl_insert_select.result
new file mode 100644
index 00000000000..1aff39e0026
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_insert_select.result
@@ -0,0 +1,17 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (n int not null primary key);
+insert into t1 values (1);
+create table t2 (n int);
+insert into t2 values (1);
+insert ignore into t1 select * from t2;
+insert into t1 values (2);
+select * from t1;
+n
+1
+2
+drop table t1,t2;
diff --git a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
new file mode 100644
index 00000000000..318bc3d63e7
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
@@ -0,0 +1,135 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
+UNIQUE(b));
+INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
+SELECT * FROM t1;
+a b
+1 10
+2 2
+show slave status;;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port #
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1105
+Last_Error Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10'
+Skip_Counter 0
+Exec_Master_Log_Pos 246
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SELECT * FROM t1;
+a b
+stop slave;
+reset slave;
+reset master;
+drop table t1;
+start slave;
+CREATE TABLE t1 (
+id bigint(20) unsigned NOT NULL auto_increment,
+field_1 int(10) unsigned NOT NULL,
+field_2 varchar(255) NOT NULL,
+field_3 varchar(255) NOT NULL,
+PRIMARY KEY (id),
+UNIQUE KEY field_1 (field_1, field_2)
+);
+CREATE TABLE t2 (
+field_a int(10) unsigned NOT NULL,
+field_b varchar(255) NOT NULL,
+field_c varchar(255) NOT NULL
+);
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (1, 'a', '1a');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (2, 'b', '2b');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (4, 'd', '4d');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (5, 'e', '5e');
+INSERT INTO t1 (field_1, field_2, field_3)
+SELECT t2.field_a, t2.field_b, t2.field_c
+FROM t2
+ON DUPLICATE KEY UPDATE
+t1.field_3 = t2.field_c;
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f');
+INSERT INTO t1 (field_1, field_2, field_3)
+SELECT t2.field_a, t2.field_b, t2.field_c
+FROM t2
+ON DUPLICATE KEY UPDATE
+t1.field_3 = t2.field_c;
+SELECT * FROM t1;
+id field_1 field_2 field_3
+1 1 a 1a
+2 2 b 2b
+3 3 c 3c
+4 4 d 4d
+5 5 e 5e
+6 6 f 6f
+show slave status;;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port #
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1105
+Last_Error Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1 (field_1, field_2, field_3)
+SELECT t2.field_a, t2.field_b, t2.field_c
+FROM t2
+ON DUPLICATE KEY UPDATE
+t1.field_3 = t2.field_c'
+Skip_Counter 0
+Exec_Master_Log_Pos 1278
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SELECT * FROM t1;
+id field_1 field_2 field_3
+drop table t1, t2;
+drop table t1, t2;
diff --git a/mysql-test/suite/rpl/r/rpl_load_from_master.result b/mysql-test/suite/rpl/r/rpl_load_from_master.result
new file mode 100644
index 00000000000..08b45ec1db0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_load_from_master.result
@@ -0,0 +1,139 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+create database mysqltest2;
+create database mysqltest;
+create database mysqltest2;
+create table mysqltest2.foo (n int)ENGINE=MyISAM;
+insert into mysqltest2.foo values(4);
+create table mysqltest2.foo (n int)ENGINE=MyISAM;
+insert into mysqltest2.foo values(5);
+create table mysqltest.bar (m int)ENGINE=MyISAM;
+insert into mysqltest.bar values(15);
+select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
+n m
+4 15
+drop database mysqltest;
+drop database if exists mysqltest2;
+drop database mysqltest;
+ERROR HY000: Can't drop database 'mysqltest'; database doesn't exist
+drop database mysqltest2;
+set sql_log_bin = 0;
+create database mysqltest2;
+create database mysqltest;
+show databases;
+Database
+information_schema
+mysql
+mysqltest
+mysqltest2
+test
+create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
+create table mysqltest2.t2(n int, s text)ENGINE=MyISAM;
+insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
+insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
+create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
+create table mysqltest.t2(n int, s text)ENGINE=MyISAM;
+insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
+insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
+(13, 'thirteen test');
+set sql_log_bin = 1;
+show databases;
+Database
+information_schema
+mysql
+test
+create database mysqltest2;
+create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
+insert into mysqltest2.t1 values (1, 'original foo.t1');
+create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM;
+insert into mysqltest2.t3 values (1, 'original foo.t3');
+create database mysqltest3;
+create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM;
+insert into mysqltest3.t1 values (1, 'original foo2.t1');
+create database mysqltest;
+create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
+insert into mysqltest.t1 values (1, 'original bar.t1');
+create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM;
+insert into mysqltest.t3 values (1, 'original bar.t3');
+load data from master;
+show databases;
+Database
+information_schema
+mysql
+mysqltest
+mysqltest2
+mysqltest3
+test
+use mysqltest2;
+show tables;
+Tables_in_mysqltest2
+t1
+t3
+select * from t1;
+n s
+1 original foo.t1
+use mysqltest3;
+show tables;
+Tables_in_mysqltest3
+t1
+select * from t1;
+n s
+1 original foo2.t1
+use mysqltest;
+show tables;
+Tables_in_mysqltest
+t1
+t2
+t3
+select * from mysqltest.t1;
+n s
+1 one test
+2 two test
+3 three test
+select * from mysqltest.t2;
+n s
+11 eleven test
+12 twelve test
+13 thirteen test
+select * from mysqltest.t3;
+n s
+1 original bar.t3
+insert into mysqltest.t1 values (4, 'four test');
+select * from mysqltest.t1;
+n s
+1 one test
+2 two test
+3 three test
+4 four test
+stop slave;
+reset slave;
+load data from master;
+start slave;
+insert into mysqltest.t1 values (5, 'five bar');
+select * from mysqltest.t1;
+n s
+1 one test
+2 two test
+3 three test
+4 four test
+5 five bar
+load table mysqltest.t1 from master;
+ERROR 42S01: Table 't1' already exists
+drop table mysqltest.t1;
+load table mysqltest.t1 from master;
+load table bar.t1 from master;
+ERROR HY000: Error from master: 'Table 'bar.t1' doesn't exist'
+drop database mysqltest;
+drop database mysqltest2;
+drop database mysqltest2;
+drop database mysqltest3;
diff --git a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result
new file mode 100644
index 00000000000..c24f857d829
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result
@@ -0,0 +1,51 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+"******************** Test Requirment 1 *************"
+SET SQL_LOG_BIN=0,timestamp=200006;
+CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM;
+INSERT INTO t1 ( a) VALUE ('F');
+select unix_timestamp(t) from t1;
+unix_timestamp(t)
+200006
+load table t1 from master;
+select unix_timestamp(t) from t1;
+unix_timestamp(t)
+200006
+set SQL_LOG_BIN=1,timestamp=default;
+drop table t1;
+set SQL_LOG_BIN=0;
+"******************** Test Requirment 2 *************"
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
+INSERT INTO t1 VALUES (1);
+load table t1 from master;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+drop table t1;
+set SQL_LOG_BIN=0;
+create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t1;
+create table t2 (word char(20) not null)ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t2;
+create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
+load table t1 from master;
+load table t2 from master;
+load table t3 from master;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select count(*) from t2;
+count(*)
+70
+select count(*) from t3;
+count(*)
+0
+set SQL_LOG_BIN=1;
+drop table if exists t1,t2,t3;
+create table t1(n int);
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata.result b/mysql-test/suite/rpl/r/rpl_loaddata.result
new file mode 100644
index 00000000000..680796a4be6
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_loaddata.result
@@ -0,0 +1,92 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+reset master;
+select last_insert_id();
+last_insert_id()
+0
+create table t1(a int not null auto_increment, b int, primary key(a) );
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+select last_insert_id();
+last_insert_id()
+1
+create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
+load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
+create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
+insert into t3 select * from t2;
+select * from t1;
+a b
+1 10
+2 15
+select * from t3;
+day id category name
+2003-02-22 2461 b a a a @ %  ' " a
+2003-03-22 2161 c asdf
+2003-03-22 2416 a bbbbb
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+slave-bin.000001 1280
+drop table t1;
+drop table t2;
+drop table t3;
+create table t1(a int, b int, unique(b));
+insert into t1 values(1,10);
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+set global sql_slave_skip_counter=1;
+start slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1797 # # master-bin.000001 Yes Yes # 0 0 1797 # None 0 No # No
+set sql_log_bin=0;
+delete from t1;
+set sql_log_bin=1;
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+stop slave;
+change master to master_user='test';
+change master to master_user='root';
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1832 # # master-bin.000001 No No # 0 0 1832 # None 0 No # No
+set global sql_slave_skip_counter=1;
+start slave;
+set sql_log_bin=0;
+delete from t1;
+set sql_log_bin=1;
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+stop slave;
+reset slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # No
+reset master;
+create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
+unique(day)) engine=MyISAM;
+load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
+'\n##\n' starting by '>' ignore 1 lines;
+ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
+select * from t2;
+day id category name
+2003-02-22 2461 b a a a @ %  ' " a
+2003-03-22 2161 c asdf
+start slave;
+select * from t2;
+day id category name
+2003-02-22 2461 b a a a @ %  ' " a
+2003-03-22 2161 c asdf
+alter table t2 drop key day;
+delete from t2;
+load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
+'\n##\n' starting by '>' ignore 1 lines;
+ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
+drop table t2;
+drop table t2;
+drop table t1;
+CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
+LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1;
+ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY'
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_charset.result b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result
new file mode 100644
index 00000000000..929d06e74cf
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result
@@ -0,0 +1,37 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a varchar(10) character set utf8);
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+set @@character_set_database=koi8r;
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+set @@character_set_database=DEFAULT;
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+set @@character_set_database=koi8r;
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+set @@character_set_database=DEFAULT;
+load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
+select hex(a) from t1;
+hex(a)
+C3BF
+D0AA
+C3BF
+C3BF
+C3BF
+D0AA
+D0AA
+select hex(a) from t1;
+hex(a)
+C3BF
+D0AA
+C3BF
+C3BF
+C3BF
+D0AA
+D0AA
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_loaddata_m.result
new file mode 100644
index 00000000000..9dbae6d38c4
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_m.result
@@ -0,0 +1,38 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest;
+USE test;
+CREATE TABLE t1(a INT, b INT, UNIQUE(b));
+LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE test.t1;
+SELECT COUNT(*) FROM test.t1;
+COUNT(*)
+2
+CREATE DATABASE mysqltest;
+USE mysqltest;
+CREATE TABLE t1(a INT, b INT, UNIQUE(b));
+LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
+SELECT COUNT(*) FROM mysqltest.t1;
+COUNT(*)
+2
+SHOW DATABASES;
+Database
+information_schema
+mysql
+mysqltest
+test
+USE test;
+SHOW TABLES;
+Tables_in_test
+USE mysqltest;
+SHOW TABLES;
+Tables_in_mysqltest
+t1
+SELECT COUNT(*) FROM mysqltest.t1;
+COUNT(*)
+2
+DROP DATABASE mysqltest;
+DROP TABLE test.t1;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_s.result b/mysql-test/suite/rpl/r/rpl_loaddata_s.result
new file mode 100644
index 00000000000..4fc33eee20d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_s.result
@@ -0,0 +1,15 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+reset master;
+create table test.t1(a int, b int, unique(b));
+load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
+select count(*) from test.t1;
+count(*)
+2
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+drop table test.t1;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_simple.result b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result
new file mode 100644
index 00000000000..196093211b6
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result
@@ -0,0 +1,153 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (word CHAR(20) NOT NULL);
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY word;
+word
+Aarhus
+Aarhus
+Aaron
+Aaron
+Ababa
+Ababa
+aback
+aback
+abaft
+abaft
+abandon
+abandon
+abandoned
+abandoned
+abandoning
+abandoning
+abandonment
+abandonment
+abandons
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+SELECT * FROM t1 ORDER BY word;
+word
+Aarhus
+Aarhus
+Aaron
+Aaron
+Ababa
+Ababa
+aback
+aback
+abaft
+abaft
+abandon
+abandon
+abandoned
+abandoned
+abandoning
+abandoning
+abandonment
+abandonment
+abandons
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
new file mode 100644
index 00000000000..bb1b0610aa8
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
@@ -0,0 +1,31 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(a int);
+select * into outfile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
+truncate table t1;
+load data local infile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
+select a,count(*) from t1 group by a;
+a count(*)
+1 10000
+drop table t1;
+create table t1(a int);
+insert into t1 values (1), (2), (2), (3);
+select * into outfile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
+drop table t1;
+create table t1(a int primary key);
+load data local infile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_loadfile.result b/mysql-test/suite/rpl/r/rpl_loadfile.result
new file mode 100644
index 00000000000..7487693a9f7
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_loadfile.result
@@ -0,0 +1,227 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES(1,'test');
+UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1;
+create procedure test.p1()
+begin
+INSERT INTO test.t1 VALUES(2,'test');
+UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2;
+end|
+CALL test.p1();
+SELECT * FROM test.t1 ORDER BY blob_column;
+a blob_column
+1 abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+
+2 abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+
+SELECT * FROM test.t1 ORDER BY blob_column;
+a blob_column
+1 abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+
+2 abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE test.t1;
diff --git a/mysql-test/suite/rpl/r/rpl_locale.result b/mysql-test/suite/rpl/r/rpl_locale.result
new file mode 100644
index 00000000000..b7396084663
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_locale.result
@@ -0,0 +1,20 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (s1 char(10));
+set lc_time_names= 'de_DE';
+insert into t1 values (date_format('2001-01-01','%W'));
+set lc_time_names= 'en_US';
+insert into t1 values (date_format('2001-01-01','%W'));
+select * from t1;
+s1
+Montag
+Monday
+select * from t1;
+s1
+Montag
+Monday
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result
new file mode 100644
index 00000000000..7543814578a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result
@@ -0,0 +1,99 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 106 <Binlog_Ignore_DB>
+stop slave;
+change master to master_log_pos=75;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 75
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 75
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+start slave;
+stop slave;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 75
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 75
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 106 <Binlog_Ignore_DB>
+create table if not exists t1 (n int);
+drop table if exists t1;
+create table t1 (n int);
+insert into t1 values (1),(2),(3);
+change master to master_log_pos=106;
+start slave;
+select * from t1 ORDER BY n;
+n
+1
+2
+3
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/suite/rpl/r/rpl_many_optimize.result b/mysql-test/suite/rpl/r/rpl_many_optimize.result
new file mode 100644
index 00000000000..b2148892591
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_many_optimize.result
@@ -0,0 +1,9 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int not null auto_increment primary key, b int, key(b));
+INSERT INTO t1 (a) VALUES (1),(2);
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
new file mode 100644
index 00000000000..951e944fddc
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
@@ -0,0 +1,18 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+select master_pos_wait('master-bin.999999',0,2);
+master_pos_wait('master-bin.999999',0,2)
+-1
+explain extended select master_pos_wait('master-bin.999999',0,2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
+select master_pos_wait('master-bin.999999',0);
+stop slave sql_thread;
+master_pos_wait('master-bin.999999',0)
+NULL
diff --git a/mysql-test/suite/rpl/r/rpl_misc_functions.result b/mysql-test/suite/rpl/r/rpl_misc_functions.result
new file mode 100644
index 00000000000..526414cec9c
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_misc_functions.result
@@ -0,0 +1,46 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(id int, i int, r1 int, r2 int, p varchar(100));
+insert into t1 values(1, connection_id(), 0, 0, "");
+insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
+set sql_log_bin=0;
+insert into t1 values(6, 0, rand(), rand(), "");
+delete from t1 where id=6;
+set sql_log_bin=1;
+insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
+insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
+select * into outfile 'rpl_misc_functions.outfile' from t1;
+create table t2 like t1;
+load data local infile 'MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2;
+select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
+id i r1 r2 p id i r1 r2 p
+drop table t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (col_a double default NULL);
+CREATE PROCEDURE test_replication_sp1()
+BEGIN
+INSERT INTO t1 VALUES (rand()), (rand());
+INSERT INTO t1 VALUES (rand());
+END|
+CREATE PROCEDURE test_replication_sp2()
+BEGIN
+CALL test_replication_sp1();
+CALL test_replication_sp1();
+END|
+CREATE FUNCTION test_replication_sf() RETURNS DOUBLE DETERMINISTIC
+BEGIN
+RETURN (rand() + rand());
+END|
+CALL test_replication_sp1();
+CALL test_replication_sp2();
+INSERT INTO t1 VALUES (test_replication_sf());
+INSERT INTO t1 VALUES (test_replication_sf());
+INSERT INTO t1 VALUES (test_replication_sf());
+DROP PROCEDURE IF EXISTS test_replication_sp1;
+DROP PROCEDURE IF EXISTS test_replication_sp2;
+DROP FUNCTION IF EXISTS test_replication_sf;
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result
new file mode 100644
index 00000000000..38972a4f571
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result
@@ -0,0 +1,46 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (n int auto_increment primary key);
+set insert_id = 2000;
+insert into t1 values (NULL),(NULL),(NULL);
+select * from t1;
+n
+2000
+2001
+2002
+show slave hosts;
+Server_id Host Port Rpl_recovery_rank Master_id
+2 127.0.0.1 9999 2 1
+drop table t1;
+stop slave;
+create table t2(id int auto_increment primary key, created datetime);
+set timestamp=12345;
+insert into t2 set created=now();
+select * from t2;
+id created
+1 1970-01-01 06:25:45
+create table t3 like t2;
+create temporary table t4 like t2;
+create table t5 select * from t4;
+start slave;
+select * from t2;
+id created
+1 1970-01-01 06:25:45
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `created` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show create table t5;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `id` int(11) NOT NULL DEFAULT '0',
+ `created` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t2,t3,t5;
diff --git a/mysql-test/suite/rpl/r/rpl_multi_delete.result b/mysql-test/suite/rpl/r/rpl_multi_delete.result
new file mode 100644
index 00000000000..4831502eb88
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_multi_delete.result
@@ -0,0 +1,22 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int primary key);
+create table t2 (a int);
+insert into t1 values (1);
+insert into t2 values (1);
+delete t1.* from t1, t2 where t1.a = t2.a;
+select * from t1;
+a
+select * from t2;
+a
+1
+select * from t1;
+a
+select * from t2;
+a
+1
+drop table t1,t2;
diff --git a/mysql-test/suite/rpl/r/rpl_multi_delete2.result b/mysql-test/suite/rpl/r/rpl_multi_delete2.result
new file mode 100644
index 00000000000..87abe60b268
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_multi_delete2.result
@@ -0,0 +1,44 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+set sql_log_bin=0;
+create database mysqltest_from;
+set sql_log_bin=1;
+create database mysqltest_to;
+use mysqltest_from;
+drop table if exists a;
+CREATE TABLE a (i INT);
+INSERT INTO a VALUES(1);
+DELETE alias FROM a alias WHERE alias.i=1;
+SELECT * FROM a;
+i
+insert into a values(2),(3);
+delete a alias FROM a alias where alias.i=2;
+select * from a;
+i
+3
+use mysqltest_to;
+select * from a;
+i
+3
+create table t1 (a int primary key);
+create table t2 (a int);
+insert into t1 values (1);
+insert into t2 values (1);
+delete t1.* from t1, t2 where t1.a = t2.a;
+select * from t1;
+a
+select * from t2;
+a
+1
+select * from t1;
+ERROR 42S02: Table 'mysqltest_to.t1' doesn't exist
+select * from t2;
+ERROR 42S02: Table 'mysqltest_to.t2' doesn't exist
+set sql_log_bin=0;
+drop database mysqltest_from;
+set sql_log_bin=1;
+drop database mysqltest_to;
diff --git a/mysql-test/suite/rpl/r/rpl_multi_engine.result b/mysql-test/suite/rpl/r/rpl_multi_engine.result
new file mode 100644
index 00000000000..7cb7d873415
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_multi_engine.result
@@ -0,0 +1,366 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database if not exists mysqltest1;
+use mysqltest1;
+drop table if exists t1;
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc
+VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT
+0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+use mysqltest1;
+alter table t1 engine=myisam;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 engine=myisam;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=memory;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=memory;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+alter table t1 engine=myisam;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=memory;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t1 engine=myisam;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+alter table t1 engine=memory;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,"2005-11-14");
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 00:00:00
+UPDATE t1 SET b1 = 0, t="2005-09-09" WHERE b1 = 1;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
+DELETE FROM mysqltest1.t1 WHERE id = 42;
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+DROP TABLE t1;
+DROP DATABASE mysqltest1;
diff --git a/mysql-test/suite/rpl/r/rpl_multi_update.result b/mysql-test/suite/rpl/r/rpl_multi_update.result
new file mode 100644
index 00000000000..524278be042
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_multi_update.result
@@ -0,0 +1,27 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
+drop table t1, t2;
diff --git a/mysql-test/suite/rpl/r/rpl_multi_update2.result b/mysql-test/suite/rpl/r/rpl_multi_update2.result
new file mode 100644
index 00000000000..5bb262764fa
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_multi_update2.result
@@ -0,0 +1,55 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop table if exists t1,t2;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 4
+2 5
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+SELECT * FROM t1 ORDER BY a;
+a b
+1 4
+2 5
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+drop table t1,t2;
+reset master;
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (0);
+UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b;
+select * from t1;
+a
+3
+select * from t1;
+a
+3
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_multi_update3.result b/mysql-test/suite/rpl/r/rpl_multi_update3.result
new file mode 100644
index 00000000000..dba7f770ba2
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_multi_update3.result
@@ -0,0 +1,197 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+-------- Test for BUG#9361 --------
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+UPDATE t2, (SELECT a FROM t1 ORDER BY a) AS t SET t2.b = t.a+5 ;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 6
+2 6
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 6
+2 6
+drop table t1,t2;
+
+-------- Test 1 for BUG#9361 --------
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (
+a1 char(30),
+a2 int,
+a3 int,
+a4 char(30),
+a5 char(30)
+);
+CREATE TABLE t2 (
+b1 int,
+b2 char(30)
+);
+INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
+INSERT INTO t2 VALUES (1, 'baz');
+UPDATE t1 a, t2
+SET a.a1 = 'No'
+WHERE a.a2 =
+(SELECT b1
+FROM t2
+WHERE b2 = 'baz')
+AND a.a3 IS NULL
+AND a.a4 = 'foo'
+AND a.a5 = 'bar';
+SELECT * FROM t1;
+a1 a2 a3 a4 a5
+No 1 NULL foo bar
+SELECT * FROM t2;
+b1 b2
+1 baz
+DROP TABLE t1, t2;
+
+-------- Test 2 for BUG#9361 --------
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+CREATE TABLE t1 (
+i INT,
+j INT,
+x INT,
+y INT,
+z INT
+);
+CREATE TABLE t2 (
+i INT,
+k INT,
+x INT,
+y INT,
+z INT
+);
+CREATE TABLE t3 (
+j INT,
+k INT,
+x INT,
+y INT,
+z INT
+);
+INSERT INTO t1 VALUES ( 1, 2,13,14,15);
+INSERT INTO t2 VALUES ( 1, 3,23,24,25);
+INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
+UPDATE t1 AS a
+INNER JOIN t2 AS b
+ON a.i = b.i
+INNER JOIN t3 AS c
+ON a.j = c.j AND b.k = c.k
+SET a.x = b.x,
+a.y = b.y,
+a.z = (
+SELECT sum(z)
+FROM t3
+WHERE y = 34
+)
+WHERE b.x = 23;
+SELECT * FROM t1;
+i j x y z
+1 2 23 24 71
+DROP TABLE t1, t2, t3;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+DROP TABLE IF EXISTS t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t1 (
+idp int(11) NOT NULL default '0',
+idpro int(11) default NULL,
+price decimal(19,4) default NULL,
+PRIMARY KEY (idp)
+);
+CREATE TABLE t2 (
+idpro int(11) NOT NULL default '0',
+price decimal(19,4) default NULL,
+nbprice int(11) default NULL,
+PRIMARY KEY (idpro)
+);
+INSERT INTO t1 VALUES
+(1,1,'3.0000'),
+(2,2,'1.0000'),
+(3,1,'1.0000'),
+(4,1,'4.0000'),
+(5,3,'2.0000'),
+(6,2,'4.0000');
+INSERT INTO t2 VALUES
+(1,'0.0000',0),
+(2,'0.0000',0),
+(3,'0.0000',0);
+update
+t2
+join
+( select idpro, min(price) as min_price, count(*) as nbr_price
+from t1
+where idpro>0 and price>0
+group by idpro
+) as table_price
+on t2.idpro = table_price.idpro
+set t2.price = table_price.min_price,
+t2.nbprice = table_price.nbr_price;
+select "-- MASTER AFTER JOIN --" as "";
+
+-- MASTER AFTER JOIN --
+select * from t1;
+idp idpro price
+1 1 3.0000
+2 2 1.0000
+3 1 1.0000
+4 1 4.0000
+5 3 2.0000
+6 2 4.0000
+select * from t2;
+idpro price nbprice
+1 1.0000 3
+2 1.0000 2
+3 2.0000 1
+select "-- SLAVE AFTER JOIN --" as "";
+
+-- SLAVE AFTER JOIN --
+select * from t1;
+idp idpro price
+1 1 3.0000
+2 2 1.0000
+3 1 1.0000
+4 1 4.0000
+5 3 2.0000
+6 2 4.0000
+select * from t2;
+idpro price nbprice
+1 1.0000 3
+2 1.0000 2
+3 2.0000 1
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/rpl/r/rpl_multi_update4.result b/mysql-test/suite/rpl/r/rpl_multi_update4.result
new file mode 100644
index 00000000000..f6dde65a35d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_multi_update4.result
@@ -0,0 +1,25 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists d1;
+drop database if exists d2;
+drop database if exists d2;
+create database d1;
+create table d1.t0 (id int);
+create database d2;
+use d2;
+create table t1 (id int);
+create table t2 (id int);
+insert into t1 values (1), (2), (3), (4), (5);
+insert into t2 select id + 3 from t1;
+update t1 join t2 using (id) set t1.id = 0;
+insert into d1.t0 values (0);
+use d1;
+select * from t0 where id=0;
+id
+0
+drop database d1;
+drop database d2;
diff --git a/mysql-test/suite/rpl/r/rpl_optimize.result b/mysql-test/suite/rpl/r/rpl_optimize.result
new file mode 100644
index 00000000000..79891169fbc
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_optimize.result
@@ -0,0 +1,27 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int not null auto_increment primary key, b int, key(b));
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+update t1 set b=(a/2*rand());
+delete from t1 order by b limit 10000;
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_packet.result b/mysql-test/suite/rpl/r/rpl_packet.result
new file mode 100644
index 00000000000..981c234d380
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_packet.result
@@ -0,0 +1,32 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
+create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
+select @@net_buffer_length, @@max_allowed_packet;
+@@net_buffer_length @@max_allowed_packet
+1024 1024
+create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
+INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023');
+select count(*) from `DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________`.`t1` /* must be 1 */;
+count(*)
+1
+SHOW STATUS LIKE 'Slave_running';
+Variable_name Value
+Slave_running ON
+select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING';
+VARIABLE_NAME VARIABLE_VALUE
+SLAVE_RUNNING ON
+drop database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
+SET @@global.max_allowed_packet=4096;
+SET @@global.net_buffer_length=4096;
+STOP SLAVE;
+START SLAVE;
+CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
+INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
+SHOW STATUS LIKE 'Slave_running';
+Variable_name Value
+Slave_running OFF
diff --git a/mysql-test/suite/rpl/r/rpl_ps.result b/mysql-test/suite/rpl/r/rpl_ps.result
new file mode 100644
index 00000000000..73c36af4862
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_ps.result
@@ -0,0 +1,30 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop table if exists t1;
+create table t1(n char(30));
+prepare stmt1 from 'insert into t1 values (?)';
+set @var1= "from-master-1";
+execute stmt1 using @var1;
+set @var1= "from-master-2-'',";
+execute stmt1 using @var1;
+SELECT * FROM t1 ORDER BY n;
+n
+from-master-1
+from-master-2-'',
+set @var2= 'insert into t1 values (concat("from-var-", ?))';
+prepare stmt2 from @var2;
+set @var1='from-master-3';
+execute stmt2 using @var1;
+SELECT * FROM t1 ORDER BY n;
+n
+from-master-1
+from-master-2-'',
+from-var-from-master-3
+drop table t1;
+stop slave;
+reset master;
+reset slave;
diff --git a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
new file mode 100644
index 00000000000..47adb70bcf5
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
@@ -0,0 +1,67 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SET BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
+@@GLOBAL.BINLOG_FORMAT @@SESSION.BINLOG_FORMAT
+MIXED MIXED
+**** On Master ****
+CREATE TABLE t1 (a INT, b LONG);
+INSERT INTO t1 VALUES (1,1), (2,2);
+INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a INT, b LONG)
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+**** On Slave ****
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 454
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 454
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Query 2 # use `test`; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9
+slave-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a INT, b LONG)
+slave-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl/r/rpl_read_only.result b/mysql-test/suite/rpl/r/rpl_read_only.result
new file mode 100644
index 00000000000..6b1404b4f68
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_read_only.result
@@ -0,0 +1,116 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create user test;
+create table t1(a int) engine=InnoDB;
+create table t2(a int) engine=MyISAM;
+insert into t1 values(1001);
+insert into t2 values(2001);
+set global read_only=1;
+select @@read_only;
+@@read_only
+1
+select * from t1;
+a
+1001
+select * from t2;
+a
+2001
+select @@read_only;
+@@read_only
+0
+select * from t1;
+a
+1001
+select * from t2;
+a
+2001
+set global read_only=0;
+BEGIN;
+insert into t1 values(1002);
+insert into t2 values(2002);
+BEGIN;
+insert into t1 values(1003);
+insert into t2 values(2003);
+set global read_only=1;
+COMMIT;
+COMMIT;
+ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
+set global read_only=0;
+insert into t1 values(1004);
+insert into t2 values(2004);
+select * from t1;
+a
+1001
+1002
+1004
+select * from t2;
+a
+2001
+2002
+2003
+2004
+select * from t1;
+a
+1001
+1002
+1004
+select * from t2;
+a
+2001
+2002
+2003
+2004
+set global read_only=1;
+select @@read_only;
+@@read_only
+1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values(1005);
+insert into t2 values(2005);
+select * from t1;
+a
+1001
+1002
+1004
+1005
+select * from t2;
+a
+2001
+2002
+2003
+2004
+2005
+select * from t1;
+a
+1001
+1002
+1004
+1005
+select * from t2;
+a
+2001
+2002
+2003
+2004
+2005
+insert into t1 values(1006);
+ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
+insert into t2 values(2006);
+ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
+drop user test;
+drop table t1;
+drop table t2;
+set global read_only=0;
diff --git a/mysql-test/suite/rpl/r/rpl_redirect.result b/mysql-test/suite/rpl/r/rpl_redirect.result
new file mode 100644
index 00000000000..64866df1c15
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_redirect.result
@@ -0,0 +1,41 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SHOW SLAVE STATUS;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+SHOW SLAVE HOSTS;
+Server_id Host Port Rpl_recovery_rank Master_id
+2 127.0.0.1 SLAVE_PORT 2 1
+create table t1 ( n int);
+insert into t1 values (1),(2),(3),(4);
+insert into t1 values(5);
+SELECT * FROM t1 ORDER BY n;
+n
+1
+2
+3
+4
+5
+SELECT * FROM t1 ORDER BY n;
+n
+1
+2
+3
+4
+SELECT * FROM t1 ORDER BY n;
+n
+1
+2
+3
+4
+SELECT * FROM t1 ORDER BY n;
+n
+1
+2
+3
+4
+5
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_relay_space_innodb.result b/mysql-test/suite/rpl/r/rpl_relay_space_innodb.result
new file mode 100644
index 00000000000..54aac2eca35
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_relay_space_innodb.result
@@ -0,0 +1,25 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SHOW VARIABLES LIKE 'relay_log_space_limit';
+Variable_name Value
+relay_log_space_limit 0
+CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=InnoDB;
+INSERT INTO t1 SET name='Andy', age=31;
+INSERT INTO t1 SET name='Jacob', age=2;
+INSERT INTO t1 SET name='Caleb', age=1;
+ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
+SELECT * FROM t1 ORDER BY id;
+name age id
+Andy 31 00000001
+Jacob 2 00000002
+Caleb 1 00000003
+SELECT * FROM t1 ORDER BY id;
+name age id
+Andy 31 00000001
+Jacob 2 00000002
+Caleb 1 00000003
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_relay_space_myisam.result b/mysql-test/suite/rpl/r/rpl_relay_space_myisam.result
new file mode 100644
index 00000000000..e8d2d63e46e
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_relay_space_myisam.result
@@ -0,0 +1,25 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SHOW VARIABLES LIKE 'relay_log_space_limit';
+Variable_name Value
+relay_log_space_limit 0
+CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=MyISAM;
+INSERT INTO t1 SET name='Andy', age=31;
+INSERT INTO t1 SET name='Jacob', age=2;
+INSERT INTO t1 SET name='Caleb', age=1;
+ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
+SELECT * FROM t1 ORDER BY id;
+name age id
+Andy 31 00000001
+Jacob 2 00000002
+Caleb 1 00000003
+SELECT * FROM t1 ORDER BY id;
+name age id
+Andy 31 00000001
+Jacob 2 00000002
+Caleb 1 00000003
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_relayrotate.result b/mysql-test/suite/rpl/r/rpl_relayrotate.result
new file mode 100644
index 00000000000..20f19973d83
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_relayrotate.result
@@ -0,0 +1,16 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+create table t1 (a int) engine=innodb;
+reset slave;
+start slave;
+stop slave;
+start slave;
+select max(a) from t1;
+max(a)
+8000
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_relayspace.result b/mysql-test/suite/rpl/r/rpl_relayspace.result
new file mode 100644
index 00000000000..1f2a739d3e3
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_relayspace.result
@@ -0,0 +1,19 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+create table t1 (a int);
+drop table t1;
+create table t1 (a int);
+drop table t1;
+reset slave;
+start slave io_thread;
+stop slave io_thread;
+reset slave;
+start slave;
+select master_pos_wait('master-bin.001',200,6)=-1;
+master_pos_wait('master-bin.001',200,6)=-1
+0
diff --git a/mysql-test/suite/rpl/r/rpl_replicate_do.result b/mysql-test/suite/rpl/r/rpl_replicate_do.result
new file mode 100644
index 00000000000..fa4f7e224d1
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result
@@ -0,0 +1,77 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop table if exists t11;
+drop table if exists t11;
+create table t2 (n int);
+insert into t2 values(4);
+create table t2 (s char(20));
+load data infile '../std_data_ln/words.dat' into table t2;
+insert into t2 values('five');
+create table t1 (m int);
+insert into t1 values(15),(16),(17);
+update t1 set m=20 where m=16;
+delete from t1 where m=17;
+create table t11 select * from t1;
+select * from t1 ORDER BY m;
+m
+15
+20
+select * from t2;
+n
+4
+select * from t11;
+ERROR 42S02: Table 'test.t11' doesn't exist
+drop table if exists t1,t2,t11;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 # # # master-bin.000001 Yes Yes test.t1 # 0 0 # # None 0 No # No
+create table t1 (ts timestamp);
+set one_shot time_zone='met';
+insert into t1 values('2005-08-12 00:00:00');
+set one_shot time_zone='met';
+select * from t1;
+ts
+2005-08-12 00:00:00
+set one_shot time_zone='met';
+select * from t1;
+ts
+2005-08-12 00:00:00
+drop table t1;
+*** master ***
+create table t1 (a int, b int);
+create trigger trg1 before insert on t1 for each row set new.b=2;
+create table t2 (a int, b int);
+create trigger trg2 before insert on t2 for each row set new.b=2;
+show tables;
+Tables_in_test
+t1
+t2
+show triggers;
+Trigger Event Table Statement Timing Created sql_mode Definer
+trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost
+trg2 INSERT t2 set new.b=2 BEFORE NULL root@localhost
+*** slave ***
+show tables;
+Tables_in_test
+t1
+show triggers;
+Trigger Event Table Statement Timing Created sql_mode Definer
+trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost
+*** master ***
+drop trigger trg1;
+drop trigger trg2;
+show triggers;
+Trigger Event Table Statement Timing Created sql_mode Definer
+*** slave ***
+show tables;
+Tables_in_test
+t1
+show triggers;
+Trigger Event Table Statement Timing Created sql_mode Definer
+*** master ***
+drop table t1;
+drop table t2;
diff --git a/mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result b/mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result
new file mode 100644
index 00000000000..0135804c02d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result
@@ -0,0 +1,23 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+drop database if exists mysqltest2;
+create database mysqltest1;
+create database mysqltest2;
+use mysqltest1;
+create table t1 (a int);
+insert into t1 values(1);
+select * from mysqltest1.t1;
+ERROR 42S02: Table 'mysqltest1.t1' doesn't exist
+use mysqltest2;
+create table t1 (a int);
+insert into t1 values(1);
+select * from mysqltest2.t1;
+a
+1
+drop database mysqltest1;
+drop database mysqltest2;
diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
new file mode 100644
index 00000000000..1b843bffdca
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
@@ -0,0 +1,94 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+create database mysqltest1;
+use mysqltest1;
+create table t1 (a int);
+insert into t1 values(9);
+select * from mysqltest1.t1;
+a
+9
+show databases like 'mysqltest1';
+Database (mysqltest1)
+mysqltest1
+select * from test.t1;
+a
+9
+drop table t1;
+drop database mysqltest1;
+drop database if exists rewrite;
+create database rewrite;
+use test;
+create table t1 (a date, b date, c date not null, d date);
+load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'd' at row 2
+load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
+select * from rewrite.t1;
+a b c d
+0000-00-00 NULL 0000-00-00 0000-00-00
+0000-00-00 0000-00-00 0000-00-00 0000-00-00
+2003-03-03 2003-03-03 2003-03-03 NULL
+2003-03-03 2003-03-03 2003-03-03 NULL
+truncate table t1;
+load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'd' at row 2
+select * from rewrite.t1;
+a b c d
+NULL NULL 0000-00-00 0000-00-00
+NULL 0000-00-00 0000-00-00 0000-00-00
+NULL 2003-03-03 2003-03-03 NULL
+drop table t1;
+create table t1 (a text, b text);
+load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+Warnings:
+Warning 1261 Row 3 doesn't contain data for all columns
+select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
+concat('|',a,'|') concat('|',b,'|')
+|Field A| |Field B|
+|Field 1| |Field 2'
+Field 3,'Field 4|
+|Field 5' ,'Field 6| NULL
+|Field 6| | 'Field 7'|
+drop table t1;
+create table t1 (a int, b char(10));
+load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+Warnings:
+Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
+Warning 1262 Row 3 was truncated; it contained more data than there were input columns
+Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 5
+Warning 1262 Row 5 was truncated; it contained more data than there were input columns
+select * from rewrite.t1;
+a b
+1 row 1
+2 row 2
+0 1234567890
+3 row 3
+0 1234567890
+truncate table t1;
+load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+Warnings:
+Warning 1366 Incorrect integer value: '
+' for column 'a' at row 4
+Warning 1261 Row 4 doesn't contain data for all columns
+select * from rewrite.t1;
+a b
+1 row 1
+2 row 2
+3 row 3
+0
+drop database rewrite;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result
new file mode 100644
index 00000000000..f82a1a69060
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result
@@ -0,0 +1,97 @@
+drop table if exists t1, t2, t3, t4;
+drop table if exists t1, t2, t3, t4;
+start slave;
+Got one of the listed errors
+start slave;
+ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
+ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
+reset slave;
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
+reset master;
+start slave;
+create temporary table temp_table (a char(80) not null);
+insert into temp_table values ("testing temporary tables");
+create table t1 (s text);
+insert into t1 values('Could not break slave'),('Tried hard');
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 556 # # master-bin.000001 Yes Yes # 0 0 556 # None 0 No # No
+select * from t1;
+s
+Could not break slave
+Tried hard
+flush logs;
+create table t2(m int not null auto_increment primary key);
+insert into t2 values (34),(67),(123);
+flush logs;
+show binary logs;
+Log_name File_size
+master-bin.000001 600
+master-bin.000002 371
+master-bin.000003 106
+create table t3 select * from temp_table;
+select * from t3;
+a
+testing temporary tables
+drop table temp_table, t3;
+insert into t2 values(1234);
+set insert_id=1234;
+insert into t2 values(NULL);
+set global sql_slave_skip_counter=1;
+start slave;
+purge master logs to 'master-bin.000002';
+show master logs;
+Log_name File_size
+master-bin.000002 371
+master-bin.000003 415
+purge binary logs to 'master-bin.000002';
+show binary logs;
+Log_name File_size
+master-bin.000002 371
+master-bin.000003 415
+select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND)
+from information_schema.tables
+where TABLE_SCHEMA="test" and TABLE_NAME="t2";
+purge master logs before (@time_for_purge);
+show binary logs;
+Log_name File_size
+master-bin.000003 415
+insert into t2 values (65);
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 504 # # master-bin.000003 Yes Yes # 0 0 504 # None 0 No # No
+select * from t2;
+m
+34
+65
+67
+123
+1234
+create temporary table temp_table (a char(80) not null);
+insert into temp_table values ("testing temporary tables part 2");
+create table t3 (n int);
+select count(*) from t3 where n >= 4;
+count(*)
+100
+create table t4 select * from temp_table;
+show binary logs;
+Log_name File_size
+master-bin.000003 4193
+master-bin.000004 4198
+master-bin.000005 2040
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000005 2040
+select * from t4;
+a
+testing temporary tables part 2
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2040 # # master-bin.000005 Yes Yes # 0 0 2040 # None 0 No # No
+lock tables t3 read;
+select count(*) from t3 where n >= 4;
+count(*)
+100
+unlock tables;
+drop table if exists t1,t2,t3,t4;
diff --git a/mysql-test/suite/rpl/r/rpl_row_001.result b/mysql-test/suite/rpl/r/rpl_row_001.result
new file mode 100644
index 00000000000..fad60af664f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_001.result
@@ -0,0 +1,55 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (word CHAR(20) NOT NULL);
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY word LIMIT 10;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aaron
+Aaron
+Aaron
+Aaron
+Ababa
+Ababa
+STOP SLAVE;
+SET PASSWORD FOR root@"localhost" = PASSWORD('foo');
+START SLAVE;
+SET PASSWORD FOR root@"localhost" = PASSWORD('');
+CREATE TABLE t3(n INT);
+INSERT INTO t3 VALUES(1),(2);
+SELECT * FROM t3 ORDER BY n;
+n
+1
+2
+SELECT SUM(LENGTH(word)) FROM t1;
+SUM(LENGTH(word))
+1022
+DROP TABLE t1,t3;
+CREATE TABLE t1 (n INT) ENGINE=MYISAM;
+RESET MASTER;
+STOP SLAVE;
+RESET SLAVE;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+LOCK TABLES t1 READ;
+START SLAVE;
+UNLOCK TABLES;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+DROP TABLE t1;
+CREATE TABLE t1 (n INT);
+INSERT INTO t1 VALUES(3456);
+SELECT n FROM t1;
+n
+3456
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_4_bytes.result b/mysql-test/suite/rpl/r/rpl_row_4_bytes.result
new file mode 100644
index 00000000000..e2431364ed3
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_4_bytes.result
@@ -0,0 +1,27 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+create database mysqltest1;
+use mysqltest1;
+CREATE TABLE t1 (a char(3));
+CREATE TABLE t2 (a char(3));
+insert into t1 values("ANN");
+insert into t1 values("GUI");
+insert into t2 values("LIL");
+insert into t2 values("ABE");
+insert into t2 values("ANG");
+use mysqltest1;
+select * from t1 order by a;
+a
+ANN
+GUI
+select * from t2 order by a;
+a
+ABE
+ANG
+LIL
+DROP DATABASE mysqltest1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_NOW.result b/mysql-test/suite/rpl/r/rpl_row_NOW.result
new file mode 100644
index 00000000000..23f95878608
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_NOW.result
@@ -0,0 +1,29 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database if not exists mysqltest1;
+DROP TABLE IF EXISTS mysqltest1.t1;
+CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT,
+a TIMESTAMP DEFAULT '2005-05-05 01:01:01',
+b TIMESTAMP DEFAULT '2005-05-05 01:01:01',
+PRIMARY KEY(n));
+CREATE FUNCTION mysqltest1.f1() RETURNS TIMESTAMP
+BEGIN
+DECLARE v1 INT DEFAULT 300;
+WHILE v1 > 0 DO
+SET v1 = v1 - 1;
+END WHILE;
+RETURN NOW();
+END|
+INSERT INTO mysqltest1.t1 VALUES(NULL,NOW(),mysqltest1.f1());
+CREATE TRIGGER mysqltest1.trig1 BEFORE INSERT ON mysqltest1.t1
+FOR EACH ROW BEGIN
+SET new.b = mysqltest1.f1();
+END|
+INSERT INTO mysqltest1.t1 SET n = NULL, a = now();
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP FUNCTION mysqltest1.f1;
+DROP DATABASE mysqltest1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_USER.result b/mysql-test/suite/rpl/r/rpl_row_USER.result
new file mode 100644
index 00000000000..98755fb4653
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_USER.result
@@ -0,0 +1,38 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP DATABASE IF EXISTS mysqltest1;
+CREATE DATABASE mysqltest1;
+CREATE USER tester IDENTIFIED BY 'test';
+GRANT ALL ON mysqltest1.* TO 'tester'@'%' IDENTIFIED BY 'test';
+GRANT ALL ON mysqltest1.* TO ''@'localhost%';
+FLUSH PRIVILEGES;
+CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a));
+INSERT INTO mysqltest1.t1 VALUES(1,USER());
+INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER());
+create procedure mysqltest1.p1()
+begin
+INSERT INTO mysqltest1.t1 VALUES(3,USER());
+INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER());
+end|
+CALL mysqltest1.p1();
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+a users
+1 tester@localhost
+2 @localhost%
+3 tester@localhost
+4 @localhost%
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+a users
+1 tester@localhost
+2 @localhost%
+3 tester@localhost
+4 @localhost%
+DROP DATABASE mysqltest1;
+REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
+REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
+DROP USER tester@'%';
+DROP USER ''@'localhost%';
diff --git a/mysql-test/suite/rpl/r/rpl_row_UUID.result b/mysql-test/suite/rpl/r/rpl_row_UUID.result
new file mode 100644
index 00000000000..f56dc145901
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_UUID.result
@@ -0,0 +1,40 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=myisam;
+INSERT INTO test.t1 VALUES(1,UUID(),UUID());
+create procedure test.p1()
+begin
+INSERT INTO test.t1 VALUES(2,UUID(),UUID());
+INSERT INTO test.t1 VALUES(3,UUID(),UUID());
+end|
+CALL test.p1();
+create function test.fn1(x int)
+returns int
+begin
+insert into t1 values (4+x,UUID(),UUID());
+insert into t1 values (5+x,UUID(),UUID());
+return 0;
+end|
+select fn1(0);
+fn1(0)
+0
+create table t2 (a int);
+insert into t2 values(fn1(2));
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT '0',
+ `blob_column` longblob,
+ `vchar_column` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP PROCEDURE test.p1;
+DROP FUNCTION test.fn1;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
new file mode 100644
index 00000000000..1025b965589
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
@@ -0,0 +1,220 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE DATABASE test_ignore;
+**** On Master ****
+SHOW DATABASES;
+Database
+information_schema
+mysql
+test
+test_ignore
+USE test;
+CREATE TABLE t1 (a INT, b INT);
+SHOW TABLES;
+Tables_in_test
+t1
+INSERT INTO t1 VALUES (1,1), (2,2);
+USE test_ignore;
+CREATE TABLE t2 (a INT, b INT);
+SHOW TABLES;
+Tables_in_test_ignore
+t2
+INSERT INTO t2 VALUES (3,3), (4,4);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+**** On Slave ****
+SHOW DATABASES;
+Database
+information_schema
+mysql
+test
+USE test;
+SHOW TABLES;
+Tables_in_test
+t1
+USE test_ignore;
+ERROR 42000: Unknown database 'test_ignore'
+DROP DATABASE test_ignore;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT);
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+DELETE FROM t1 WHERE a = 0;
+UPDATE t1 SET a=99 WHERE a = 0;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 192 Table_map 1 231 table_id: # (test.t1)
+master-bin.000001 231 Write_rows 1 270 table_id: # flags: STMT_END_F
+DROP TABLE t1;
+================ Test for BUG#17620 ================
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Slave ****
+SET GLOBAL QUERY_CACHE_SIZE=0;
+**** On Master ****
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+**** On Slave ****
+SET GLOBAL QUERY_CACHE_SIZE=16*1024*1024;
+**** On Master ****
+INSERT INTO t1 VALUES (4),(5),(6);
+**** On Slave ****
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+5
+6
+**** On Master ****
+INSERT INTO t1 VALUES (7),(8),(9);
+**** On Slave ****
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SET GLOBAL QUERY_CACHE_SIZE=0;
+================ Test for BUG#22550 ================
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a BIT(1), b INT) ENGINE=MYISAM;
+INSERT INTO t1 VALUES(1,2);
+SELECT HEX(a),b FROM t1;
+HEX(a) b
+1 2
+SELECT HEX(a),b FROM t1;
+HEX(a) b
+1 2
+UPDATE t1 SET a=0 WHERE b=2;
+SELECT HEX(a),b FROM t1;
+HEX(a) b
+0 2
+SELECT HEX(a),b FROM t1;
+HEX(a) b
+0 2
+DROP TABLE IF EXISTS t1;
+================ Test for BUG#22583 ================
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+CREATE TABLE t1_myisam (k INT, a BIT(1), b BIT(9)) ENGINE=MYISAM;
+CREATE TABLE t1_innodb (k INT, a BIT(1), b BIT(9)) ENGINE=INNODB;
+CREATE TABLE t2_myisam (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=MYISAM;
+CREATE TABLE t2_innodb (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=INNODB;
+**** On Slave ****
+ALTER TABLE t1_myisam ENGINE=INNODB;
+ALTER TABLE t1_innodb ENGINE=MYISAM;
+ALTER TABLE t2_myisam ENGINE=INNODB;
+ALTER TABLE t2_innodb ENGINE=MYISAM;
+**** On Master ****
+INSERT INTO t1_myisam VALUES(1, b'0', 257);
+INSERT INTO t1_myisam VALUES(2, b'1', 256);
+INSERT INTO t1_innodb VALUES(1, b'0', 257);
+INSERT INTO t1_innodb VALUES(2, b'1', 256);
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+k HEX(a) HEX(b)
+1 0 101
+2 1 100
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+k HEX(a) HEX(b)
+1 0 101
+2 1 100
+INSERT INTO t2_myisam VALUES(1, b'0', 9);
+INSERT INTO t2_myisam VALUES(2, b'1', 8);
+INSERT INTO t2_innodb VALUES(1, b'0', 9);
+INSERT INTO t2_innodb VALUES(2, b'1', 8);
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+k HEX(a) HEX(b)
+1 0 9
+2 1 8
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+k HEX(a) HEX(b)
+1 0 9
+2 1 8
+**** On Slave ****
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+k HEX(a) HEX(b)
+1 0 101
+2 1 100
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+k HEX(a) HEX(b)
+1 0 101
+2 1 100
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+k HEX(a) HEX(b)
+1 0 9
+2 1 8
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+k HEX(a) HEX(b)
+1 0 9
+2 1 8
+**** On Master ****
+UPDATE t1_myisam SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+k HEX(a) HEX(b)
+1 0 101
+2 0 100
+UPDATE t1_innodb SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+k HEX(a) HEX(b)
+1 0 101
+2 0 100
+UPDATE t2_myisam SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+k HEX(a) HEX(b)
+1 0 9
+2 0 8
+UPDATE t2_innodb SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+k HEX(a) HEX(b)
+1 0 9
+2 0 8
+**** On Slave ****
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+k HEX(a) HEX(b)
+1 0 101
+2 0 100
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+k HEX(a) HEX(b)
+1 0 101
+2 0 100
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+k HEX(a) HEX(b)
+1 0 9
+2 0 8
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+k HEX(a) HEX(b)
+1 0 9
+2 0 8
+**** On Master ****
+DROP TABLE IF EXISTS t1_myisam, t1_innodb, t2_myisam, t2_innodb;
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
new file mode 100644
index 00000000000..a6877b27b95
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
@@ -0,0 +1,418 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'MYISAM' ;
+SELECT * FROM t1;
+C1 C2
+SELECT * FROM t1;
+C1 C2
+INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
+INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+DELETE FROM t1 WHERE C1 = C2;
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = 'MYISAM' ;
+INSERT INTO t2
+VALUES (1,'A',2), (2,'A',4), (3,'A',9), (4,'A',15), (5,'A',25),
+(6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+DELETE FROM t2 WHERE c1 % 4 = 0;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+UPDATE t2 SET c12='X';
+CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = 'MYISAM' ;
+INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
+INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+DELETE FROM t3 WHERE C1 = C2;
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT) ENGINE = 'MYISAM' ;
+INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+DELETE FROM t6 WHERE C1 = C2;
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = 'MYISAM' ;
+INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1;
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = 'MYISAM' ;
+INSERT INTO t4 SET C1 = 1;
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'MYISAM' ;
+--- on slave: original values ---
+INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 3
+2 6
+3 9
+--- on master: new values inserted ---
+INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+--- on slave: old values should be overwritten by replicated values ---
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+--- on master ---
+CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'MYISAM' ;
+INSERT INTO t8 VALUES (99,99,99);
+INSERT INTO t8 VALUES (99,22,33);
+ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
+INSERT INTO t8 VALUES (11,99,33);
+ERROR 23000: Duplicate entry '99' for key 'b'
+INSERT INTO t8 VALUES (11,22,99);
+ERROR 23000: Duplicate entry '99' for key 'c'
+SELECT * FROM t8 ORDER BY a;
+a b c
+99 99 99
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a b c
+99 99 99
+INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
+SELECT * FROM t8 ORDER BY a;
+a b c
+1 2 3
+2 4 6
+3 6 9
+99 99 99
+--- on master ---
+INSERT INTO t8 VALUES (2,4,8);
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a b c
+1 2 3
+2 4 8
+3 6 9
+99 99 99
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
new file mode 100644
index 00000000000..4c6ec627db5
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
@@ -0,0 +1,418 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'INNODB' ;
+SELECT * FROM t1;
+C1 C2
+SELECT * FROM t1;
+C1 C2
+INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
+INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A A
+A B
+A C
+X X
+X Y
+X Z
+DELETE FROM t1 WHERE C1 = C2;
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A C
+X Y
+X Z
+UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1 C2
+A B
+A I
+X Y
+X Z
+UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+SELECT * FROM t1 ORDER BY c1,c2;
+C1 C2
+A B
+A I
+X Y
+X Z
+CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = 'INNODB' ;
+INSERT INTO t2
+VALUES (1,'A',2), (2,'A',4), (3,'A',9), (4,'A',15), (5,'A',25),
+(6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 2
+2 A 4
+3 A 9
+4 A 15
+5 A 25
+6 A 35
+7 A 50
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+2 A 4
+3 A 9
+5 A 25
+8 A 64
+9 A 81
+UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+4 A 16
+5 A 25
+6 A 36
+7 A 49
+8 A 64
+9 A 81
+DELETE FROM t2 WHERE c1 % 4 = 0;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1 c12 c2
+1 A 1
+2 A 4
+3 A 9
+5 A 25
+6 A 36
+7 A 49
+9 A 81
+UPDATE t2 SET c12='X';
+CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = 'INNODB' ;
+INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
+INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A A 3 B 2
+A B 1 B 1
+A C 1 B 2
+X X 3 B 1
+X Y 2 B 1
+X Z 2 B 2
+DELETE FROM t3 WHERE C1 = C2;
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A C 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1 C2 pk1 C3 pk2
+A B 1 B 1
+A I 1 B 2
+X Y 2 B 1
+X Z 2 B 2
+CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT) ENGINE = 'INNODB' ;
+INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+X X 3
+A C 4
+X Z 5
+A A 6
+DELETE FROM t6 WHERE C1 = C2;
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A C 4
+X Z 5
+UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+SELECT * FROM t6 ORDER BY C3;
+C1 C2 C3
+A B 1
+X Y 2
+A I 4
+X Z 5
+CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = 'INNODB' ;
+INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1;
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2
+X Q 2 1 R 1 X Y 2 S 1
+X Q 2 1 R 1 X Z 2 S 2
+X Q 2 2 R 4 X Y 2 S 1
+X Q 2 2 R 4 X Z 2 S 2
+X Q 2 3 R 9 X Y 2 S 1
+X Q 2 3 R 9 X Z 2 S 2
+X Q 2 5 R 25 X Y 2 S 1
+X Q 2 5 R 25 X Z 2 S 2
+X Q 2 6 R 36 X Y 2 S 1
+X Q 2 6 R 36 X Z 2 S 2
+X Q 2 7 R 49 X Y 2 S 1
+X Q 2 7 R 49 X Z 2 S 2
+X Q 2 9 R 81 X Y 2 S 1
+X Q 2 9 R 81 X Z 2 S 2
+X Q 3 1 R 1 X Y 2 S 1
+X Q 3 1 R 1 X Z 2 S 2
+X Q 3 2 R 4 X Y 2 S 1
+X Q 3 2 R 4 X Z 2 S 2
+X Q 3 3 R 9 X Y 2 S 1
+X Q 3 3 R 9 X Z 2 S 2
+X Q 3 5 R 25 X Y 2 S 1
+X Q 3 5 R 25 X Z 2 S 2
+X Q 3 6 R 36 X Y 2 S 1
+X Q 3 6 R 36 X Z 2 S 2
+X Q 3 7 R 49 X Y 2 S 1
+X Q 3 7 R 49 X Z 2 S 2
+X Q 3 9 R 81 X Y 2 S 1
+X Q 3 9 R 81 X Z 2 S 2
+X Q 5 1 R 1 X Y 2 S 1
+X Q 5 1 R 1 X Z 2 S 2
+X Q 5 2 R 4 X Y 2 S 1
+X Q 5 2 R 4 X Z 2 S 2
+X Q 5 3 R 9 X Y 2 S 1
+X Q 5 3 R 9 X Z 2 S 2
+X Q 5 5 R 25 X Y 2 S 1
+X Q 5 5 R 25 X Z 2 S 2
+X Q 5 6 R 36 X Y 2 S 1
+X Q 5 6 R 36 X Z 2 S 2
+X Q 5 7 R 49 X Y 2 S 1
+X Q 5 7 R 49 X Z 2 S 2
+X Q 5 9 R 81 X Y 2 S 1
+X Q 5 9 R 81 X Z 2 S 2
+CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = 'INNODB' ;
+INSERT INTO t4 SET C1 = 1;
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1 HEX(B1) HEX(B2)
+1 NULL 0
+CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'INNODB' ;
+--- on slave: original values ---
+INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 3
+2 6
+3 9
+--- on master: new values inserted ---
+INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+--- on slave: old values should be overwritten by replicated values ---
+SELECT * FROM t7 ORDER BY C1;
+C1 C2
+1 2
+2 4
+3 6
+--- on master ---
+CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'INNODB' ;
+INSERT INTO t8 VALUES (99,99,99);
+INSERT INTO t8 VALUES (99,22,33);
+ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
+INSERT INTO t8 VALUES (11,99,33);
+ERROR 23000: Duplicate entry '99' for key 'b'
+INSERT INTO t8 VALUES (11,22,99);
+ERROR 23000: Duplicate entry '99' for key 'c'
+SELECT * FROM t8 ORDER BY a;
+a b c
+99 99 99
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a b c
+99 99 99
+INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
+SELECT * FROM t8 ORDER BY a;
+a b c
+1 2 3
+2 4 6
+3 6 9
+99 99 99
+--- on master ---
+INSERT INTO t8 VALUES (2,4,8);
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a b c
+1 2 3
+2 4 8
+3 6 9
+99 99 99
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result
new file mode 100644
index 00000000000..dedd5d044e0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_8partition.result
@@ -0,0 +1,655 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS t1;
+SET @@BINLOG_FORMAT = ROW;
+SELECT @@BINLOG_FORMAT;
+@@BINLOG_FORMAT
+ROW
+**** Partition RANGE testing ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY RANGE (YEAR(t))
+(PARTITION p0 VALUES LESS THAN (1901),
+PARTITION p1 VALUES LESS THAN (1946),
+PARTITION p2 VALUES LESS THAN (1966),
+PARTITION p3 VALUES LESS THAN (1986),
+PARTITION p4 VALUES LESS THAN (2005),
+PARTITION p5 VALUES LESS THAN MAXVALUE);
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+--- On slave --
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
+**** Partition LIST testing ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY LIST(id)
+(PARTITION p0 VALUES IN (2, 4),
+PARTITION p1 VALUES IN (42, 142),
+PARTITION p2 VALUES IN (412));
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
+**** Partition HASH testing ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE)
+PARTITION BY HASH( YEAR(t) )
+PARTITIONS 4;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
+**** Partition by KEY ****
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+y YEAR, t DATE,PRIMARY KEY(id))
+PARTITION BY KEY()
+PARTITIONS 4;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned DEFAULT NULL,
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` varchar(255) DEFAULT NULL,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+ALTER TABLE t1 MODIFY vc TEXT;
+--- On master ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+--- On slave ---
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL,
+ `b1` bit(8) DEFAULT NULL,
+ `vc` text,
+ `bc` char(255) DEFAULT NULL,
+ `d` decimal(10,4) DEFAULT '0.0000',
+ `f` float DEFAULT '0',
+ `total` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `y` year(4) DEFAULT NULL,
+ `t` date DEFAULT NULL,
+ PRIMARY KEY (`id`,`total`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */
+"--- Insert into t1 --" as "";
+--- Select from t1 on master ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Select from t1 on slave ---
+select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
+id hex(b1) vc bc d f total y t
+2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
+4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
+42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
+142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
+412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
+--- Update t1 on master --
+UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
+--- Check the update on master ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Check Update on slave ---
+SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
+id hex(b1) vc bc d f total y t
+412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22
+--- Remove a record from t1 on master ---
+DELETE FROM t1 WHERE id = 42;
+--- Show current count on master for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+--- Show current count on slave for t1 ---
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4
+DELETE FROM t1;
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_blob_innodb.result b/mysql-test/suite/rpl/r/rpl_row_blob_innodb.result
new file mode 100644
index 00000000000..055efffbd6a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_blob_innodb.result
@@ -0,0 +1,156 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+***** Table Create Section ****
+
+CREATE TABLE test.t1 (c1 int not null auto_increment,
+data LONGBLOB, PRIMARY KEY(c1))ENGINE=#;
+
+**** Data Insert Section test.t1 *****
+
+INSERT INTO test.t1 VALUES (NULL, NULL);
+INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
+INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
+
+**** Data Insert Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Insert Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Update Section test.t1 ****
+
+UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
+UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
+
+**** Data Update Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** Data Update Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** End Test Section test.t1 ****
+
+**** Create Table test.t2 ****
+
+CREATE TABLE test.t2 (
+c1 INT NOT NULL PRIMARY KEY,
+c2 TEXT,
+c3 INT,
+c4 LONGBLOB,
+KEY(c3))ENGINE=#;
+
+*** Setup Values For test.t2 ***
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+
+**** Data Insert Section test.t2 *****
+
+INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
+INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
+
+**** Data Insert Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 2256 b1 3000 dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 20000 b2 30000 dd2
+
+**** Data Insert Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 2256 b1 3000 dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 20000 b2 30000 dd2
+
+**** Data Update Section test.t2 ****
+
+UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
+UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
+
+**** Data Update Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 20000 b2 30000 dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 2256 b1 3000 dd1
+
+**** Data Update Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 20000 b2 30000 dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 2256 b1 3000 dd1
+
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_blob_myisam.result b/mysql-test/suite/rpl/r/rpl_row_blob_myisam.result
new file mode 100644
index 00000000000..055efffbd6a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_blob_myisam.result
@@ -0,0 +1,156 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+***** Table Create Section ****
+
+CREATE TABLE test.t1 (c1 int not null auto_increment,
+data LONGBLOB, PRIMARY KEY(c1))ENGINE=#;
+
+**** Data Insert Section test.t1 *****
+
+INSERT INTO test.t1 VALUES (NULL, NULL);
+INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
+INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
+
+**** Data Insert Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Insert Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Update Section test.t1 ****
+
+UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
+UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
+
+**** Data Update Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** Data Update Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** End Test Section test.t1 ****
+
+**** Create Table test.t2 ****
+
+CREATE TABLE test.t2 (
+c1 INT NOT NULL PRIMARY KEY,
+c2 TEXT,
+c3 INT,
+c4 LONGBLOB,
+KEY(c3))ENGINE=#;
+
+*** Setup Values For test.t2 ***
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+
+**** Data Insert Section test.t2 *****
+
+INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
+INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
+
+**** Data Insert Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 2256 b1 3000 dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 20000 b2 30000 dd2
+
+**** Data Insert Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 2256 b1 3000 dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 20000 b2 30000 dd2
+
+**** Data Update Section test.t2 ****
+
+UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
+UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
+
+**** Data Update Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 20000 b2 30000 dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 2256 b1 3000 dd1
+
+**** Data Update Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+1 20000 b2 30000 dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
+2 2256 b1 3000 dd1
+
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_charset.result b/mysql-test/suite/rpl/r/rpl_row_charset.result
new file mode 100644
index 00000000000..e51f3e57d1f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_charset.result
@@ -0,0 +1,201 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+set timestamp=1000000000;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+create database mysqltest2 character set latin2;
+set @@character_set_server=latin5;
+create database mysqltest3;
+
+--- --master--
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
+
+--- --slave--
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
+set @@collation_server=armscii8_bin;
+drop database mysqltest3;
+create database mysqltest3;
+
+--- --master--
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
+
+--- --slave--
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
+use mysqltest2;
+create table t1 (a int auto_increment primary key, b varchar(100));
+set character_set_client=cp850, collation_connection=latin2_croatian_ci;
+insert into t1 (b) values(@@character_set_server);
+insert into t1 (b) values(@@collation_server);
+insert into t1 (b) values(@@character_set_client);
+insert into t1 (b) values(@@character_set_connection);
+insert into t1 (b) values(@@collation_connection);
+
+--- --master--
+select * from t1 order by a;
+a b
+1 armscii8
+2 armscii8_bin
+3 cp850
+4 latin2
+5 latin2_croatian_ci
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 armscii8
+2 armscii8_bin
+3 cp850
+4 latin2
+5 latin2_croatian_ci
+select "--- --muller--" as "";
+
+--- --muller--
+set character_set_client=latin1, collation_connection=latin1_german1_ci;
+truncate table t1;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Müller","Muffler"));
+set collation_connection=latin1_german2_ci;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Müller","Muffler"));
+
+--- --master--
+select * from t1 order by a;
+a b
+1 latin1_german1_ci
+2 Muffler
+3 latin1_german2_ci
+4 Müller
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 latin1_german1_ci
+2 Muffler
+3 latin1_german2_ci
+4 Müller
+select "--- --INSERT--" as "";
+
+--- --INSERT--
+set @a= _cp850 'Müller' collate cp850_general_ci;
+truncate table t1;
+insert into t1 (b) values(collation(@a));
+
+--- --master--
+select * from t1 order by a;
+a b
+1 cp850_general_ci
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 cp850_general_ci
+drop database mysqltest2;
+drop database mysqltest3;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # drop database if exists mysqltest2
+master-bin.000001 # Query # # drop database if exists mysqltest3
+master-bin.000001 # Query # # create database mysqltest2 character set latin2
+master-bin.000001 # Query # # create database mysqltest3
+master-bin.000001 # Query # # drop database mysqltest3
+master-bin.000001 # Query # # create database mysqltest3
+master-bin.000001 # Query # # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest2`; truncate table t1
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest2`; truncate table t1
+master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # drop database mysqltest2
+master-bin.000001 # Query # # drop database mysqltest3
+select "--- --global--" as "";
+
+--- --global--
+set global character_set_server=latin2;
+set global character_set_server=latin1;
+set global character_set_server=latin2;
+set global character_set_server=latin1;
+select "--- --oneshot--" as "";
+
+--- --oneshot--
+set one_shot @@character_set_server=latin5;
+set @@max_join_size=1000;
+select @@character_set_server;
+@@character_set_server
+latin5
+select @@character_set_server;
+@@character_set_server
+latin1
+set @@character_set_server=latin5;
+select @@character_set_server;
+@@character_set_server
+latin5
+select @@character_set_server;
+@@character_set_server
+latin5
+set one_shot max_join_size=10;
+ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
+set character_set_client=9999999;
+ERROR 42000: Unknown character set: '9999999'
+set collation_server=9999998;
+ERROR HY000: Unknown collation: '9999998'
+select "--- --3943--" as "";
+
+--- --3943--
+use test;
+CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
+SET CHARACTER_SET_CLIENT=koi8r,
+CHARACTER_SET_CONNECTION=cp1251,
+CHARACTER_SET_RESULTS=koi8r;
+INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ');
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+drop table t1;
+select "--- --6676--" as "";
+
+--- --6676--
+create table `t1` (
+`pk` varchar(10) not null default '',
+primary key (`pk`)
+) engine=myisam default charset=latin1;
+set @p=_latin1 'test';
+update t1 set pk='test' where pk=@p;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result
new file mode 100644
index 00000000000..e76ce5b962d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result
@@ -0,0 +1,403 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT, b INT);
+CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
+CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
+CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
+SHOW BINLOG EVENTS FROM 216;
+Log_name #
+Pos 216
+Event_type Query
+Server_id #
+End_log_pos 309
+Info use `test`; CREATE TABLE t1 (a INT, b INT)
+Log_name #
+Pos 309
+Event_type Query
+Server_id #
+End_log_pos 415
+Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
+Log_name #
+Pos 415
+Event_type Query
+Server_id #
+End_log_pos 521
+Info use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
+Log_name #
+Pos 521
+Event_type Query
+Server_id #
+End_log_pos 640
+Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
+**** On Master ****
+SHOW CREATE TABLE t1;
+Table t1
+Create Table CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t2;
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=()
+SHOW CREATE TABLE t3;
+Table t3
+Create Table CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+**** On Slave ****
+SHOW CREATE TABLE t1;
+Table t1
+Create Table CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t2;
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=()
+SHOW CREATE TABLE t3;
+Table t3
+Create Table CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+CREATE TABLE t5 (b INT, c INT) SELECT * FROM t3;
+CREATE TEMPORARY TABLE tt3 (a INT, b INT);
+INSERT INTO tt3 VALUES (1,2), (2,4), (3,6), (4,2), (5,10), (6,12);
+CREATE TABLE t6 (b INT, c INT) SELECT * FROM tt3;
+**** On Master ****
+SHOW CREATE TABLE t5;
+Table t5
+Create Table CREATE TABLE `t5` (
+ `c` int(11) DEFAULT NULL,
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t5 ORDER BY a,b,c;
+c a b
+SHOW CREATE TABLE t6;
+Table t6
+Create Table CREATE TABLE `t6` (
+ `c` int(11) DEFAULT NULL,
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t6 ORDER BY a,b,c;
+c a b
+NULL 1 2
+NULL 2 4
+NULL 3 6
+NULL 4 2
+NULL 5 10
+NULL 6 12
+**** On Slave ****
+SHOW CREATE TABLE t5;
+Table t5
+Create Table CREATE TABLE `t5` (
+ `c` int(11) DEFAULT NULL,
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+SELECT * FROM t5 ORDER BY a,b,c;
+c a b
+SHOW CREATE TABLE t6;
+Table t6
+Create Table CREATE TABLE `t6` (
+ `c` int(11) DEFAULT NULL,
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+SELECT * FROM t6 ORDER BY a,b,c;
+c a b
+NULL 1 2
+NULL 2 4
+NULL 3 6
+NULL 4 2
+NULL 5 10
+NULL 6 12
+CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
+ERROR 23000: Duplicate entry '2' for key 'b'
+SHOW BINLOG EVENTS FROM 1098;
+Log_name Pos Event_type Server_id End_log_pos Info
+CREATE TABLE t7 (a INT, b INT UNIQUE);
+INSERT INTO t7 SELECT a,b FROM tt3;
+ERROR 23000: Duplicate entry '2' for key 'b'
+SELECT * FROM t7 ORDER BY a,b;
+a b
+1 2
+2 4
+3 6
+SHOW BINLOG EVENTS FROM 1098;
+Log_name Pos Event_type Server_id End_log_pos Info
+# 1098 Query # 1198 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
+# 1198 Table_map # 1238 table_id: # (test.t7)
+# 1238 Write_rows # 1294 table_id: # flags: STMT_END_F
+SELECT * FROM t7 ORDER BY a,b;
+a b
+1 2
+2 4
+3 6
+CREATE TEMPORARY TABLE tt4 (a INT, b INT);
+INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
+BEGIN;
+INSERT INTO t7 SELECT a,b FROM tt4;
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SHOW BINLOG EVENTS FROM 1294;
+Log_name Pos Event_type Server_id End_log_pos Info
+# 1294 Table_map # 1334 table_id: # (test.t7)
+# 1334 Write_rows # 1390 table_id: # flags: STMT_END_F
+SELECT * FROM t7 ORDER BY a,b;
+a b
+1 2
+2 4
+3 6
+4 8
+5 10
+6 12
+SELECT * FROM t7 ORDER BY a,b;
+a b
+1 2
+2 4
+3 6
+4 8
+5 10
+6 12
+CREATE TABLE t8 LIKE t4;
+CREATE TABLE t9 LIKE tt4;
+CREATE TEMPORARY TABLE tt5 LIKE t4;
+CREATE TEMPORARY TABLE tt6 LIKE tt4;
+CREATE TEMPORARY TABLE tt7 SELECT 1;
+**** On Master ****
+SHOW CREATE TABLE t8;
+Table t8
+Create Table CREATE TABLE `t8` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 UNION=()
+SHOW CREATE TABLE t9;
+Table t9
+Create Table CREATE TABLE `t9` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW BINLOG EVENTS FROM 1390;
+Log_name Pos Event_type Server_id End_log_pos Info
+# 1390 Query # 1476 use `test`; CREATE TABLE t8 LIKE t4
+# 1476 Query # 1615 use `test`; CREATE TABLE `t9` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+)
+**** On Slave ****
+SHOW CREATE TABLE t8;
+Table t8
+Create Table CREATE TABLE `t8` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 UNION=()
+SHOW CREATE TABLE t9;
+Table t9
+Create Table CREATE TABLE `t9` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+STOP SLAVE;
+SET GLOBAL storage_engine=@storage_engine;
+START SLAVE;
+================ BUG#22864 ================
+STOP SLAVE;
+RESET SLAVE;
+RESET MASTER;
+START SLAVE;
+SET AUTOCOMMIT=0;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 ENGINE=INNODB SELECT * FROM t1;
+ROLLBACK;
+CREATE TABLE t3 ENGINE=INNODB SELECT * FROM t1;
+INSERT INTO t3 VALUES (4),(5),(6);
+ROLLBACK;
+CREATE TABLE t4 ENGINE=INNODB SELECT * FROM t1;
+INSERT INTO t1 VALUES (4),(5),(6);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+t3
+t4
+SELECT TABLE_NAME,ENGINE
+FROM INFORMATION_SCHEMA.TABLES
+WHERE TABLE_NAME LIKE 't_'
+ORDER BY TABLE_NAME;
+TABLE_NAME ENGINE
+t1 MyISAM
+t2 InnoDB
+t3 InnoDB
+t4 InnoDB
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+4
+5
+6
+SELECT * FROM t2 ORDER BY a;
+a
+1
+2
+3
+SELECT * FROM t3 ORDER BY a;
+a
+1
+2
+3
+SELECT * FROM t4 ORDER BY a;
+a
+1
+2
+3
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+# 4 Format_desc # 106 Server ver: #, Binlog ver: #
+# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT)
+# 192 Table_map # 231 table_id: # (test.t1)
+# 231 Write_rows # 275 table_id: # flags: STMT_END_F
+# 275 Query # 343 use `test`; BEGIN
+# 343 Query # 125 use `test`; CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB
+# 468 Table_map # 164 table_id: # (test.t2)
+# 507 Write_rows # 208 table_id: # flags: STMT_END_F
+# 551 Xid # 578 COMMIT /* XID */
+# 578 Query # 646 use `test`; BEGIN
+# 646 Query # 125 use `test`; CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB
+# 771 Table_map # 164 table_id: # (test.t3)
+# 810 Write_rows # 208 table_id: # flags: STMT_END_F
+# 854 Xid # 881 COMMIT /* XID */
+# 881 Query # 949 use `test`; BEGIN
+# 949 Query # 125 use `test`; CREATE TABLE `t4` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB
+# 1074 Table_map # 164 table_id: # (test.t4)
+# 1113 Write_rows # 208 table_id: # flags: STMT_END_F
+# 1157 Xid # 1184 COMMIT /* XID */
+# 1184 Table_map # 1223 table_id: # (test.t1)
+# 1223 Write_rows # 1267 table_id: # flags: STMT_END_F
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+t3
+t4
+SELECT TABLE_NAME,ENGINE
+FROM INFORMATION_SCHEMA.TABLES
+WHERE TABLE_NAME LIKE 't_'
+ORDER BY TABLE_NAME;
+TABLE_NAME ENGINE
+t1 MyISAM
+t2 InnoDB
+t3 InnoDB
+t4 InnoDB
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+4
+5
+6
+SELECT * FROM t2 ORDER BY a;
+a
+1
+2
+3
+SELECT * FROM t3 ORDER BY a;
+a
+1
+2
+3
+SELECT * FROM t4 ORDER BY a;
+a
+1
+2
+3
+DROP TABLE IF EXISTS t1,t2,t3,t4;
+SET AUTOCOMMIT=1;
+STOP SLAVE;
+RESET SLAVE;
+RESET MASTER;
+START SLAVE;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 (a INT) ENGINE=INNODB;
+BEGIN;
+INSERT INTO t2 SELECT a*a FROM t1;
+CREATE TEMPORARY TABLE tt1
+SELECT a+1 AS a
+FROM t1
+WHERE a MOD 2 = 1;
+INSERT INTO t2 SELECT a+2 FROM tt1;
+COMMIT;
+SELECT * FROM t2 ORDER BY a;
+a
+1
+4
+4
+6
+9
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+# 4 Format_desc # 106 Server ver: #, Binlog ver: #
+# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT)
+# 192 Table_map # 231 table_id: # (test.t1)
+# 231 Write_rows # 275 table_id: # flags: STMT_END_F
+# 275 Query # 375 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
+# 375 Query # 443 use `test`; BEGIN
+# 443 Table_map # 39 table_id: # (test.t2)
+# 482 Write_rows # 83 table_id: # flags: STMT_END_F
+# 526 Table_map # 122 table_id: # (test.t2)
+# 565 Write_rows # 161 table_id: # flags: STMT_END_F
+# 604 Xid # 631 COMMIT /* XID */
+SELECT * FROM t2 ORDER BY a;
+a
+1
+4
+4
+6
+9
+TRUNCATE TABLE t2;
+BEGIN;
+INSERT INTO t2 SELECT a*a FROM t1;
+CREATE TEMPORARY TABLE tt2
+SELECT a+1 AS a
+FROM t1
+WHERE a MOD 2 = 1;
+INSERT INTO t2 SELECT a+2 FROM tt2;
+ROLLBACK;
+SELECT * FROM t2 ORDER BY a;
+a
+SHOW BINLOG EVENTS FROM 631;
+Log_name Pos Event_type Server_id End_log_pos Info
+# 631 Query # 80 use `test`; TRUNCATE TABLE t2
+# 711 Xid # 738 COMMIT /* XID */
+SELECT * FROM t2 ORDER BY a;
+a
+DROP TABLE t1,t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result b/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result
new file mode 100644
index 00000000000..800a39bd567
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result
@@ -0,0 +1,32 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(a int not null primary key) engine=myisam;
+insert delayed into t1 values (1);
+insert delayed into t1 values (2);
+insert delayed into t1 values (3);
+flush tables;
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; create table t1(a int not null primary key) engine=myisam
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; flush tables
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_drop.result b/mysql-test/suite/rpl/r/rpl_row_drop.result
new file mode 100644
index 00000000000..89654ebf165
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_drop.result
@@ -0,0 +1,56 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (a int);
+CREATE TEMPORARY TABLE t2 (a int, b int);
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Slave ****
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Master ****
+DROP TABLE t2;
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Slave ****
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Master ****
+CREATE TEMPORARY TABLE t2 (a int, b int);
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Slave ****
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+**** On Master ****
+DROP TABLE t1,t2;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a int)
+master-bin.000001 192 Query 1 278 use `test`; CREATE TABLE t2 (a int)
+master-bin.000001 278 Query 1 382 use `test`; DROP TABLE `t1` /* generated by server */
+SHOW TABLES;
+Tables_in_test
+t2
+**** On Slave ****
+SHOW TABLES;
+Tables_in_test
+t2
diff --git a/mysql-test/suite/rpl/r/rpl_row_err_ignoredtable.result b/mysql-test/suite/rpl/r/rpl_row_err_ignoredtable.result
new file mode 100644
index 00000000000..b696baa57db
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_err_ignoredtable.result
@@ -0,0 +1,44 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int primary key);
+insert into t1 values (1),(1);
+ERROR 23000: Duplicate entry '1' for key 1
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 269 # # master-bin.000001 Yes Yes 0 0 269 # None 0 No #
+show tables like 't1';
+Tables_in_test (t1)
+t1
+drop table t1;
+select get_lock('crash_lock%20C', 10);
+get_lock('crash_lock%20C', 10)
+1
+create table t2 (a int primary key);
+insert into t2 values(1);
+create table t3 (id int);
+insert into t3 values(connection_id());
+ update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
+select (@id := id) - id from t3;
+(@id := id) - id
+0
+kill @id;
+drop table t2,t3;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Update_rows 1 # #
+master-bin.000001 # Query 1 # #
diff --git a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
new file mode 100644
index 00000000000..942a6b83bf6
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
@@ -0,0 +1,33 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int);
+insert into t1 values (10);
+create table t2 (a int);
+create table t3 (a int) engine=merge union(t1);
+create table t4 (a int);
+insert into t4 select * from t3;
+rename table t1 to t5, t2 to t1;
+flush no_write_to_binlog tables;
+SHOW BINLOG EVENTS FROM 619 ;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
+select * from t3;
+a
+flush tables;
+SHOW BINLOG EVENTS FROM 619 ;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
+master-bin.000001 # Query 1 # use `test`; flush tables
+select * from t3;
+a
+stop slave;
+drop table t1;
+flush tables with read lock;
+start slave;
+stop slave;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+drop table t3, t4, t5;
diff --git a/mysql-test/suite/rpl/r/rpl_row_func001.result b/mysql-test/suite/rpl/r/rpl_row_func001.result
new file mode 100644
index 00000000000..b20f3f724d0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_func001.result
@@ -0,0 +1,30 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP FUNCTION test.f1;
+DROP TABLE IF EXISTS test.t1;
+create table test.t1 (a int, PRIMARY KEY(a));
+create function test.f1(i int) returns int
+begin
+insert into test.t1 values(i);
+return 0;
+end//
+select test.f1(1);
+test.f1(1)
+0
+select test.f1(2);
+test.f1(2)
+0
+select * from test.t1;
+a
+1
+2
+select * from test.t1;
+a
+1
+2
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_func002.result b/mysql-test/suite/rpl/r/rpl_row_func002.result
new file mode 100644
index 00000000000..03f5b3115c3
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_func002.result
@@ -0,0 +1,26 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP FUNCTION test.f1;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
+CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
+create function test.f1() RETURNS TIMESTAMP
+BEGIN
+UPDATE test.t1 SET t = CURRENT_TIMESTAMP;
+RETURN CURRENT_TIMESTAMP;
+END//
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+SET TIMESTAMP=2;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+SET TIMESTAMP=1;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+SET TIMESTAMP=333300000;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_func003.result b/mysql-test/suite/rpl/r/rpl_row_func003.result
new file mode 100644
index 00000000000..a5fd46a2ce3
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_func003.result
@@ -0,0 +1,29 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP FUNCTION IF EXISTS test.f1;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=INNODB;
+create function test.f1() RETURNS CHAR(16)
+BEGIN
+DECLARE tmp CHAR(16);
+DECLARE var_name FLOAT;
+SET var_name = RAND();
+IF var_name > .6
+THEN SET tmp = 'Texas';
+ELSE SET tmp = 'MySQL';
+END IF;
+RETURN tmp;
+END|
+INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
+INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
+SET AUTOCOMMIT=0;
+START TRANSACTION;
+INSERT INTO test.t1 VALUES (null,test.f1());
+ROLLBACK;
+SET AUTOCOMMIT=1;
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
new file mode 100644
index 00000000000..4412a1fa75c
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
@@ -0,0 +1,55 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int not null primary key);
+insert into t1 values (1);
+create table t2 (a int);
+insert into t2 values (1);
+update t1, t2 set t1.a = 0 where t1.a = t2.a;
+show tables;
+Tables_in_test
+t1
+select * from t1;
+a
+0
+drop table t1;
+insert into t1 values (1);
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table test.t2
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1146
+Last_Error Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
+Skip_Counter 0
+Exec_Master_Log_Pos 524
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+drop table t1, t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result b/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result
new file mode 100644
index 00000000000..2044672f49d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result
@@ -0,0 +1,48 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+set @old_global_binlog_format = @@global.binlog_format;
+set @@global.binlog_format = row;
+CREATE SCHEMA IF NOT EXISTS mysqlslap;
+USE mysqlslap;
+select @@global.binlog_format;
+@@global.binlog_format
+ROW
+CREATE TABLE t1 (id INT primary key auto_increment, name VARCHAR(64));
+FLUSH TABLE t1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+use mysqlslap;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+truncate table t1;
+insert delayed into t1 values(10, "my name");
+insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
+flush table t1;
+select * from t1;
+id name
+10 my name
+20 James Bond
+select * from t1;
+id name
+10 my name
+20 James Bond
+delete from t1 where id!=10;
+insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
+flush table t1;
+select * from t1;
+id name
+10 my name
+20 is Bond
+select * from t1;
+id name
+10 my name
+20 is Bond
+USE test;
+DROP SCHEMA mysqlslap;
+set @@global.binlog_format = @old_global_binlog_format;
diff --git a/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result
new file mode 100644
index 00000000000..149efddaf8d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result
@@ -0,0 +1,20 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest;
+stop slave;
+create database mysqltest;
+use mysqltest;
+create table t1(a int, b int, unique(b));
+load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+drop database mysqltest;
diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result
new file mode 100644
index 00000000000..9de0d3d0ebb
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result
@@ -0,0 +1,116 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+reset master;
+reset slave;
+reset master;
+create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
+insert into t1 values (NULL);
+drop table t1;
+create table t1 (word char(20) not null)ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+select count(*) from t1;
+count(*)
+69
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+show binlog events from 106 limit 1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+show binlog events from 106 limit 2;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+show binlog events from 106 limit 2,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+flush logs;
+create table t3 (a int)ENGINE=MyISAM;
+start slave;
+
+let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
+
+--source include/wait_slave_status.inc
+flush logs;
+stop slave;
+create table t2 (n int)ENGINE=MyISAM;
+insert into t2 values (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Rotate # # master-bin.000002;pos=4
+show binlog events in 'master-bin.000002';
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
+master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
+master-bin.000002 # Table_map 1 # table_id: # (test.t2)
+master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
+show binary logs;
+Log_name File_size
+master-bin.000001 1260
+master-bin.000002 377
+start slave;
+show binary logs;
+Log_name File_size
+slave-bin.000001 1358
+slave-bin.000002 278
+show binlog events in 'slave-bin.000001' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 1 # use `test`; drop table t1
+slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
+slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
+slave-bin.000002 # Table_map 1 # table_id: # (test.t2)
+slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 377 # # master-bin.000002 Yes Yes # 0 0 377 # None 0 No # No
+show binlog events in 'slave-bin.000005' from 4;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
new file mode 100644
index 00000000000..4d8175142b2
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
@@ -0,0 +1,124 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+reset master;
+reset slave;
+reset master;
+create table t1(n int not null auto_increment primary key)ENGINE=InnoDB;
+insert into t1 values (NULL);
+drop table t1;
+create table t1 (word char(20) not null)ENGINE=InnoDB;
+load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+select count(*) from t1;
+count(*)
+69
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* XID */
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid 1 # COMMIT /* XID */
+show binlog events from 106 limit 1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+show binlog events from 106 limit 2;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+show binlog events from 106 limit 2,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+flush logs;
+create table t3 (a int)ENGINE=InnoDB;
+start slave;
+
+let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
+
+--source include/wait_slave_status.inc
+flush logs;
+stop slave;
+create table t2 (n int)ENGINE=InnoDB;
+insert into t2 values (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Rotate # # master-bin.000002;pos=4
+show binlog events in 'master-bin.000002';
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB
+master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB
+master-bin.000002 # Table_map 1 # table_id: # (test.t2)
+master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000002 # Xid 1 # COMMIT /* XID */
+show binary logs;
+Log_name File_size
+master-bin.000001 1314
+master-bin.000002 404
+start slave;
+show binary logs;
+Log_name File_size
+slave-bin.000001 1412
+slave-bin.000002 305
+show binlog events in 'slave-bin.000001' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Xid 1 # COMMIT /* XID */
+slave-bin.000001 # Query 1 # use `test`; drop table t1
+slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
+slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+slave-bin.000001 # Xid 1 # COMMIT /* XID */
+slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB
+slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB
+slave-bin.000002 # Table_map 1 # table_id: # (test.t2)
+slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
+slave-bin.000002 # Xid 1 # COMMIT /* XID */
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 404 # # master-bin.000002 Yes Yes # 0 0 404 # None 0 No # No
+show binlog events in 'slave-bin.000005' from 4;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
new file mode 100644
index 00000000000..cb1692568fc
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
@@ -0,0 +1,281 @@
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+#
+# Generate a big enough master's binlog to cause relay log rotations
+#
+create table t1 (a int);
+drop table t1;
+reset slave;
+#
+# Test 1
+#
+set @my_max_binlog_size= @@global.max_binlog_size;
+set global max_binlog_size=8192;
+set global max_relay_log_size=8192-1;
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size
+4096
+start slave;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 58668
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 58668
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+#
+# Test 2
+#
+stop slave;
+reset slave;
+set global max_relay_log_size=(5*4096);
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size 20480
+start slave;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 58668
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 58668
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+#
+# Test 3: max_relay_log_size = 0
+#
+stop slave;
+reset slave;
+set global max_relay_log_size=0;
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size 0
+start slave;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 58668
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 58668
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+#
+# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
+#
+stop slave;
+reset slave;
+flush logs;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File
+Read_Master_Log_Pos 4
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 0
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+#
+# Test 5
+#
+reset slave;
+start slave;
+flush logs;
+create table t1 (a int);
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 58754
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 58754
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+#
+# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
+#
+flush logs;
+drop table t1;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 58830
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 58830
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+flush logs;
+show master status;
+File master-bin.000002
+Position 106
+Binlog_Do_DB <Binlog_Ignore_DB>
+Binlog_Ignore_DB
+set global max_binlog_size= @my_max_binlog_size;
+#
+# End of 4.1 tests
+#
diff --git a/mysql-test/suite/rpl/r/rpl_row_multi_query.result b/mysql-test/suite/rpl/r/rpl_row_multi_query.result
new file mode 100644
index 00000000000..8cb1aec522b
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_multi_query.result
@@ -0,0 +1,37 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest;
+create database mysqltest;
+create table mysqltest.t1 ( n int);
+insert into mysqltest.t1 values(1)/
+insert into mysqltest.t1 values(2);
+insert into mysqltest.t1 values(3);
+insert into mysqltest.t1 values(4);
+insert into mysqltest.t1 values(5)/
+select * from mysqltest.t1;
+n
+1
+2
+3
+4
+5
+show binlog events from 102;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Query 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+drop database mysqltest;
diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
new file mode 100644
index 00000000000..e2df1459ac0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
@@ -0,0 +1,352 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+---Setup Section --
+set timestamp=1000000000;
+DROP TABLE IF EXISTS t1,t2,t3;
+CREATE TABLE t1(word VARCHAR(20));
+CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
+
+---Test1 check table load --
+SELECT COUNT(*) from t1;
+COUNT(*)
+351
+SELECT COUNT(*) from t2;
+COUNT(*)
+500
+SELECT COUNT(*) from t3;
+COUNT(*)
+500
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+id
+1
+2
+3
+4
+5
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+c1 c3 c4 c5
+1 2006-02-22 00:00:00 Tested in Texas 2.2
+2 2006-02-22 00:00:00 Tested in Texas 4.4
+3 2006-02-22 00:00:00 Tested in Texas 6.6
+4 2006-02-22 00:00:00 Tested in Texas 8.8
+5 2006-02-22 00:00:00 Tested in Texas 11
+SELECT COUNT(*) from t1;
+COUNT(*)
+351
+SELECT COUNT(*) from t2;
+COUNT(*)
+500
+SELECT COUNT(*) from t3;
+COUNT(*)
+500
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+id
+1
+2
+3
+4
+5
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+c1 c3 c4 c5
+1 2006-02-22 00:00:00 Tested in Texas 2.2
+2 2006-02-22 00:00:00 Tested in Texas 4.4
+3 2006-02-22 00:00:00 Tested in Texas 6.6
+4 2006-02-22 00:00:00 Tested in Texas 8.8
+5 2006-02-22 00:00:00 Tested in Texas 11
+insert into t1 values ("Alas");
+flush logs;
+
+--- Test 1 Dump binlog to file --
+
+--- Test 1 delete tables, clean master and slave --
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+stop slave;
+reset master;
+reset slave;
+start slave;
+
+--- Test 1 Load from Dump binlog file --
+
+--- Test 1 Check Load Results --
+SELECT COUNT(*) from t1;
+COUNT(*)
+352
+SELECT COUNT(*) from t2;
+COUNT(*)
+500
+SELECT COUNT(*) from t3;
+COUNT(*)
+500
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+id
+1
+2
+3
+4
+5
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+c1 c3 c4 c5
+1 2006-02-22 00:00:00 Tested in Texas 2.2
+2 2006-02-22 00:00:00 Tested in Texas 4.4
+3 2006-02-22 00:00:00 Tested in Texas 6.6
+4 2006-02-22 00:00:00 Tested in Texas 8.8
+5 2006-02-22 00:00:00 Tested in Texas 11
+SELECT COUNT(*) from t1;
+COUNT(*)
+352
+SELECT COUNT(*) from t2;
+COUNT(*)
+500
+SELECT COUNT(*) from t3;
+COUNT(*)
+500
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+id
+1
+2
+3
+4
+5
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+c1 c3 c4 c5
+1 2006-02-22 00:00:00 Tested in Texas 2.2
+2 2006-02-22 00:00:00 Tested in Texas 4.4
+3 2006-02-22 00:00:00 Tested in Texas 6.6
+4 2006-02-22 00:00:00 Tested in Texas 8.8
+5 2006-02-22 00:00:00 Tested in Texas 11
+
+--- Test 2 position test --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+use test/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+--- Test 3 First Remote test --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+use test/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+DROP TABLE IF EXISTS t1,t2,t3/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+CREATE TABLE t1(word VARCHAR(20))/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY)/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+--- Test 4 Second Remote test --
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+stop slave;
+reset master;
+reset slave;
+start slave;
+SELECT COUNT(*) from t1;
+COUNT(*)
+352
+SELECT COUNT(*) from t2;
+COUNT(*)
+500
+SELECT COUNT(*) from t3;
+COUNT(*)
+500
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+id
+1
+2
+3
+4
+5
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+c1 c3 c4 c5
+1 2006-02-22 00:00:00 Tested in Texas 2.2
+2 2006-02-22 00:00:00 Tested in Texas 4.4
+3 2006-02-22 00:00:00 Tested in Texas 6.6
+4 2006-02-22 00:00:00 Tested in Texas 8.8
+5 2006-02-22 00:00:00 Tested in Texas 11
+SELECT COUNT(*) from t1;
+COUNT(*)
+352
+SELECT COUNT(*) from t2;
+COUNT(*)
+500
+SELECT COUNT(*) from t3;
+COUNT(*)
+500
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+word
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+Aarhus
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+id
+1
+2
+3
+4
+5
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+c1 c3 c4 c5
+1 2006-02-22 00:00:00 Tested in Texas 2.2
+2 2006-02-22 00:00:00 Tested in Texas 4.4
+3 2006-02-22 00:00:00 Tested in Texas 6.6
+4 2006-02-22 00:00:00 Tested in Texas 8.8
+5 2006-02-22 00:00:00 Tested in Texas 11
+
+--- Test 5 LOAD DATA --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+--- Test 6 reading stdin --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+use test/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+DROP TABLE IF EXISTS t1,t2,t3/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+CREATE TABLE t1(word VARCHAR(20))/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY)/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+--- Test 7 reading stdin w/position --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+use test/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+--- Test 8 switch internal charset --
+stop slave;
+reset master;
+reset slave;
+start slave;
+create table t4 (f text character set utf8);
+create table t5 (f text character set cp932);
+flush logs;
+rename table t4 to t04, t5 to t05;
+select HEX(f) from t04;
+HEX(f)
+E382BD
+select HEX(f) from t4;
+HEX(f)
+E382BD
+select HEX(f) from t05;
+HEX(f)
+835C
+select HEX(f) from t5;
+HEX(f)
+835C
+select HEX(f) from t04;
+HEX(f)
+E382BD
+select HEX(f) from t4;
+HEX(f)
+E382BD
+select HEX(f) from t05;
+HEX(f)
+835C
+select HEX(f) from t5;
+HEX(f)
+835C
+
+--- Test cleanup --
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT NOT NULL KEY, b INT);
+INSERT INTO t1 VALUES(1,1);
+SELECT * FROM t1;
+a b
+1 1
+FLUSH LOGS;
+DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;
diff --git a/mysql-test/suite/rpl/r/rpl_row_mystery22.result b/mysql-test/suite/rpl/r/rpl_row_mystery22.result
new file mode 100644
index 00000000000..bcf65e4ede3
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_mystery22.result
@@ -0,0 +1,30 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(n int auto_increment primary key, s char(10));
+insert into t1 values (2,'old');
+insert into t1 values(NULL,'new');
+insert into t1 values(NULL,'new');
+select * from t1 order by n;
+n s
+1 new
+2 new
+delete from t1 where n = 2;
+start slave;
+stop slave;
+create table t2(n int);
+drop table t2;
+insert into t1 values(NULL,'new');
+set sql_log_bin=0;
+insert into t1 values(NULL,'new');
+set sql_log_bin=1;
+delete from t1 where n=4;
+start slave;
+select * from t1 order by n;
+n s
+1 new
+3 new
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
new file mode 100644
index 00000000000..c9ae5ced7bc
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
@@ -0,0 +1,32 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # No
+stop slave;
+change master to master_user='test';
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 No No # 0 0 106 # None 0 No # No
+reset slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # No
+start slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # No
+stop slave;
+reset slave;
+start slave;
+create temporary table t1 (a int);
+stop slave;
+reset slave;
+start slave;
+show status like 'slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 0
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp001.result b/mysql-test/suite/rpl/r/rpl_row_sp001.result
new file mode 100644
index 00000000000..8c26c061376
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_sp001.result
@@ -0,0 +1,85 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+<Begin test section 1 (non deterministic SP)>
+---------------------------------------------
+create table test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+create procedure test.p1()
+begin
+INSERT INTO test.t1 (f,d) VALUES (RAND(),NOW());
+end//
+
+<End test section 1 (non deterministic SP)>
+-------------------------------------------
+CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t CHAR(4), PRIMARY KEY(a));
+CREATE PROCEDURE test.p2(n int)
+begin
+CASE n
+WHEN 1 THEN
+UPDATE test.t2 set t ='Tex';
+WHEN 2 THEN
+UPDATE test.t2 set t ='SQL';
+ELSE
+UPDATE test.t2 set t ='NONE';
+END CASE;
+end//
+INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW');
+SELECT * FROM t2 ORDER BY a;
+a t
+1 NEW
+2 NEW
+3 NEW
+4 NEW
+SELECT * FROM t2 ORDER BY a;
+a t
+1 NEW
+2 NEW
+3 NEW
+4 NEW
+call test.p2(1);
+SELECT * FROM t2 ORDER BY a;
+a t
+1 Tex
+2 Tex
+3 Tex
+4 Tex
+SELECT * FROM t2 ORDER BY a;
+a t
+1 Tex
+2 Tex
+3 Tex
+4 Tex
+call test.p2(2);
+SELECT * FROM t2 ORDER BY a;
+a t
+1 SQL
+2 SQL
+3 SQL
+4 SQL
+SELECT * FROM t2 ORDER BY a;
+a t
+1 SQL
+2 SQL
+3 SQL
+4 SQL
+call test.p2(3);
+SELECT * FROM t2 ORDER BY a;
+a t
+1 NONE
+2 NONE
+3 NONE
+4 NONE
+SELECT * FROM t2 ORDER BY a;
+a t
+1 NONE
+2 NONE
+3 NONE
+4 NONE
+DROP PROCEDURE test.p1;
+DROP PROCEDURE test.p2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result b/mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result
new file mode 100644
index 00000000000..a42c9af988c
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result
@@ -0,0 +1,239 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP TABLE IF EXISTS test.t3;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=INNODB;
+CREATE TABLE test.t2 (a INT AUTO_INCREMENT KEY, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON DELETE CASCADE) ENGINE=INNODB;
+create procedure test.p1(IN i CHAR(6))
+begin
+INSERT INTO test.t1 (t) VALUES (i);
+INSERT INTO test.t2 VALUES (NULL,LAST_INSERT_ID());
+end|
+create procedure test.p2(IN i INT)
+begin
+DELETE FROM test.t1 where a < i;
+end|
+
+< -- test 1 call p1 -- >
+------------------------
+SET FOREIGN_KEY_CHECKS=1;
+call test.p1('texas');
+call test.p1('Live');
+call test.p1('next');
+call test.p1('to');
+call test.p1('OK');
+call test.p1('MySQL');
+
+< -- test 1 select master after p1 -- >
+---------------------------------------
+SELECT * FROM test.t1;
+a t
+1 texas
+2 Live
+3 next
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+
+< -- test 1 select slave after p1 -- >
+--------------------------------------
+SELECT * FROM test.t1;
+a t
+1 texas
+2 Live
+3 next
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+
+< -- test 1 call p2 & select master -- >
+----------------------------------------
+call test.p2(4);
+SELECT * FROM test.t1;
+a t
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+4 4
+5 5
+6 6
+
+< -- test 1 select slave after p2 -- >
+--------------------------------------
+SELECT * FROM test.t1;
+a t
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+4 4
+5 5
+6 6
+
+< -- End test 1 Begin test 2 -- >
+---------------------------------
+SET FOREIGN_KEY_CHECKS=0;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a INT, t CHAR(6), PRIMARY KEY(a)) ENGINE=INNODB;
+CREATE TABLE test.t2 (a INT, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON UPDATE CASCADE, PRIMARY KEY(a)) ENGINE=INNODB;
+CREATE PROCEDURE test.p1(IN nm INT, IN ch CHAR(6))
+BEGIN
+INSERT INTO test.t1 (a,t) VALUES (nm, ch);
+INSERT INTO test.t2 VALUES (nm, LAST_INSERT_ID());
+END|
+CREATE PROCEDURE test.p2(IN i INT)
+BEGIN
+UPDATE test.t1 SET a = i*10 WHERE a = i;
+END|
+SET FOREIGN_KEY_CHECKS=1;
+CALL test.p1(1,'texas');
+CALL test.p1(2,'Live');
+CALL test.p1(3,'next');
+CALL test.p1(4,'to');
+CALL test.p1(5,'OK');
+CALL test.p1(6,'MySQL');
+
+< -- test 2 select Master after p1 -- >
+---------------------------------------
+SELECT * FROM test.t1;
+a t
+1 texas
+2 Live
+3 next
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+1 6
+2 6
+3 6
+4 6
+5 6
+6 6
+
+< -- test 2 select Slave after p1 -- >
+--------------------------------------
+SELECT * FROM test.t1;
+a t
+1 texas
+2 Live
+3 next
+4 to
+5 OK
+6 MySQL
+SELECT * FROM test.t2;
+a f
+1 6
+2 6
+3 6
+4 6
+5 6
+6 6
+
+< -- test 2 call p2 & select Master -- >
+----------------------------------------
+CALL test.p2(2);
+CALL test.p2(4);
+CALL test.p2(6);
+SELECT * FROM test.t1;
+a t
+1 texas
+3 next
+5 OK
+20 Live
+40 to
+60 MySQL
+SELECT * FROM test.t2;
+a f
+1 6
+3 6
+5 6
+20 6
+40 6
+60 6
+
+< -- test 1 select Slave after p2 -- >
+--------------------------------------
+SELECT * FROM test.t1;
+a t
+1 texas
+3 next
+5 OK
+20 Live
+40 to
+60 MySQL
+SELECT * FROM test.t2;
+a f
+1 6
+3 6
+5 6
+20 6
+40 6
+60 6
+
+< -- End test 2 Begin test 3 -- >
+---------------------------------
+CREATE TABLE test.t3 (a INT AUTO_INCREMENT KEY, t CHAR(6))ENGINE=INNODB;
+CREATE PROCEDURE test.p3(IN n INT)
+begin
+CASE n
+WHEN 2 THEN
+DELETE from test.t3;
+ELSE
+INSERT INTO test.t3 VALUES (NULL,'NONE');
+END CASE;
+end|
+SET AUTOCOMMIT=0;
+START TRANSACTION;
+ROLLBACK;
+select * from test.t3;
+a t
+select * from test.t3;
+a t
+START TRANSACTION;
+COMMIT;
+select * from test.t3;
+a t
+98 NONE
+select * from test.t3;
+a t
+98 NONE
+SET AUTOCOMMIT=1;
+SET FOREIGN_KEY_CHECKS=0;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp003.result b/mysql-test/suite/rpl/r/rpl_row_sp003.result
new file mode 100644
index 00000000000..df3e2a7ceed
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_sp003.result
@@ -0,0 +1,49 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=INNODB;
+CREATE PROCEDURE test.p1()
+BEGIN
+INSERT INTO test.t1 VALUES (4);
+SELECT get_lock("test", 100);
+UPDATE test.t1 set a=a+4 WHERE a=4;
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+UPDATE test.t1 SET a=a+1;
+END|
+SELECT get_lock("test", 200);
+get_lock("test", 200)
+1
+CALL test.p1();
+CALL test.p2();
+SELECT release_lock("test");
+release_lock("test")
+1
+SELECT * FROM test.t1;
+a
+5
+SELECT * FROM test.t1;
+a
+5
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=INNODB;
+CALL test.p2();
+CALL test.p1();
+get_lock("test", 100)
+0
+SELECT * FROM test.t1;
+a
+8
+SELECT * FROM test.t1;
+a
+8
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp005.result b/mysql-test/suite/rpl/r/rpl_row_sp005.result
new file mode 100644
index 00000000000..01e1970e0df
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_sp005.result
@@ -0,0 +1,100 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t3;
+CREATE TABLE IF NOT EXISTS test.t1(id INT, data CHAR(16),PRIMARY KEY(id));
+CREATE TABLE IF NOT EXISTS test.t2(id2 INT,PRIMARY KEY(id2));
+CREATE TABLE IF NOT EXISTS test.t3(id3 INT,PRIMARY KEY(id3), c CHAR(16));
+CREATE PROCEDURE test.p1()
+BEGIN
+DECLARE done INT DEFAULT 0;
+DECLARE spa CHAR(16);
+DECLARE spb,spc INT;
+DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1 ORDER BY id;
+DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2 ORDER BY id2;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+OPEN cur1;
+OPEN cur2;
+REPEAT
+FETCH cur1 INTO spb, spa;
+FETCH cur2 INTO spc;
+IF NOT done THEN
+IF spb < spc THEN
+INSERT INTO test.t3 VALUES (spb,spa);
+ELSE
+INSERT INTO test.t3 VALUES (spc,spa);
+END IF;
+END IF;
+UNTIL done END REPEAT;
+CLOSE cur1;
+CLOSE cur2;
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+INSERT INTO test.t1 VALUES (4,'MySQL'),(20,'ROCKS'),(11,'Texas'),(10,'kyle');
+INSERT INTO test.t2 VALUES (4),(2),(1),(3);
+UPDATE test.t1 SET id=id+4 WHERE id=4;
+END|
+
+< ---- Master selects-- >
+-------------------------
+CALL test.p2();
+SELECT * FROM test.t1 ORDER BY id;
+id data
+8 MySQL
+10 kyle
+11 Texas
+20 ROCKS
+SELECT * FROM test.t2 ORDER BY id2;
+id2
+1
+2
+3
+4
+
+< ---- Slave selects-- >
+------------------------
+SELECT * FROM test.t1 ORDER BY id;
+id data
+8 MySQL
+10 kyle
+11 Texas
+20 ROCKS
+SELECT * FROM test.t2 ORDER BY id2;
+id2
+1
+2
+3
+4
+
+< ---- Master selects-- >
+-------------------------
+CALL test.p1();
+SELECT * FROM test.t3 ORDER BY id3;
+id3 c
+1 MySQL
+2 kyle
+3 Texas
+4 ROCKS
+
+< ---- Slave selects-- >
+------------------------
+SELECT * FROM test.t3 ORDER BY id3;
+id3 c
+1 MySQL
+2 kyle
+3 Texas
+4 ROCKS
+ALTER PROCEDURE test.p1 MODIFIES SQL DATA;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result
new file mode 100644
index 00000000000..8339e77d3a0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result
@@ -0,0 +1,46 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database if not exists mysqltest1;
+DROP PROCEDURE IF EXISTS mysqltest1.p1;
+DROP PROCEDURE IF EXISTS mysqltest1.p2;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t1;
+CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=InnoDB;
+CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=InnoDB;
+CREATE PROCEDURE mysqltest1.p1()
+BEGIN
+DECLARE done INT DEFAULT 0;
+DECLARE spa CHAR(16);
+DECLARE spb INT;
+DECLARE cur1 CURSOR FOR SELECT name,
+(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
+FROM mysqltest1.t1;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+OPEN cur1;
+SET AUTOCOMMIT=0;
+REPEAT
+FETCH cur1 INTO spa, spb;
+IF NOT done THEN
+START TRANSACTION;
+INSERT INTO mysqltest1.t2 VALUES (spa,spb);
+COMMIT;
+END IF;
+UNTIL done END REPEAT;
+SET AUTOCOMMIT=1;
+CLOSE cur1;
+END|
+CREATE PROCEDURE mysqltest1.p2()
+BEGIN
+INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
+END|
+CALL mysqltest1.p2();
+CALL mysqltest1.p1();
+DROP PROCEDURE IF EXISTS mysqltest1.p1;
+DROP PROCEDURE IF EXISTS mysqltest1.p2;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP DATABASE mysqltest1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result b/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result
new file mode 100644
index 00000000000..9a2822835f8
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result
@@ -0,0 +1,50 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+CREATE PROCEDURE test.p1(IN i INT)
+BEGIN
+DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1 (num INT,PRIMARY KEY(num))ENGINE=INNODB;
+START TRANSACTION;
+INSERT INTO test.t1 VALUES(i);
+savepoint t1_save;
+INSERT INTO test.t1 VALUES (14);
+ROLLBACK to savepoint t1_save;
+COMMIT;
+END|
+
+< ---- Master selects-- >
+-------------------------
+CALL test.p1(12);
+Warnings:
+Note 1051 Unknown table 't1'
+SELECT * FROM test.t1;
+num
+12
+
+< ---- Slave selects-- >
+------------------------
+SELECT * FROM test.t1;
+num
+12
+
+< ---- Master selects-- >
+-------------------------
+CALL test.p1(13);
+SELECT * FROM test.t1;
+num
+13
+
+< ---- Slave selects-- >
+------------------------
+SELECT * FROM test.t1;
+num
+13
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp008.result b/mysql-test/suite/rpl/r/rpl_row_sp008.result
new file mode 100644
index 00000000000..23197964a24
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_sp008.result
@@ -0,0 +1,34 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a INT,PRIMARY KEY(a));
+CREATE TABLE test.t2 (a INT,PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES(1),(2);
+CREATE PROCEDURE test.p1()
+BEGIN
+SELECT SQL_CALC_FOUND_ROWS * FROM test.t1 LIMIT 1;
+INSERT INTO test.t2 VALUES(FOUND_ROWS());
+END|
+
+< ---- Master selects-- >
+-------------------------
+CALL test.p1();
+a
+1
+SELECT * FROM test.t2;
+a
+2
+
+< ---- Slave selects-- >
+------------------------
+SELECT * FROM test.t2;
+a
+2
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp009.result b/mysql-test/suite/rpl/r/rpl_row_sp009.result
new file mode 100644
index 00000000000..35ce0d7b420
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_sp009.result
@@ -0,0 +1,77 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a INT, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES (1),(2),(3),(4);
+CREATE TABLE test.t2 (a INT, PRIMARY KEY(a));
+CREATE PROCEDURE test.p1 (arg1 CHAR(1))
+BEGIN
+DECLARE b, c INT;
+IF arg1 = 'a' THEN
+BEGIN
+DECLARE cur1 CURSOR FOR SELECT A FROM test.t1 WHERE a % 2;
+DECLARE continue handler for not found set b = 1;
+SET b = 0;
+OPEN cur1;
+c1_repeat: REPEAT
+FETCH cur1 INTO c;
+IF (b = 1) THEN
+LEAVE c1_repeat;
+END IF;
+INSERT INTO test.t2 VALUES (c);
+UNTIL b = 1
+END REPEAT;
+CLOSE cur1;
+END;
+END IF;
+IF arg1 = 'b' THEN
+BEGIN
+DECLARE cur2 CURSOR FOR SELECT a FROM test.t1 WHERE NOT a % 2;
+DECLARE continue handler for not found set b = 1;
+SET b = 0;
+OPEN cur2;
+c2_repeat: REPEAT
+FETCH cur2 INTO c;
+IF (b = 1) THEN
+LEAVE c2_repeat;
+END IF;
+INSERT INTO test.t2 VALUES (c);
+UNTIL b = 1
+END REPEAT;
+CLOSE cur2;
+END;
+END IF;
+END|
+CALL test.p1('a');
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+3
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+3
+truncate test.t2;
+call test.p1('b');
+select * from test.t2 ORDER BY a;
+a
+2
+4
+SELECT * FROM test.t2 ORDER BY a;
+a
+2
+4
+truncate test.t2;
+SELECT * FROM test.t2 ORDER BY a;
+a
+SELECT * FROM test.t2 ORDER BY a;
+a
+DROP PROCEDURE test.p1;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp010.result b/mysql-test/suite/rpl/r/rpl_row_sp010.result
new file mode 100644
index 00000000000..02567465428
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_sp010.result
@@ -0,0 +1,56 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE PROCEDURE test.p1()
+BEGIN
+INSERT INTO test.t1 VALUES(2);
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+DROP TEMPORARY TABLE IF EXISTS test.t1;
+CREATE TEMPORARY TABLE test.t1 (a int, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES(1);
+CALL test.p1();
+END|
+CALL test.p2();
+SELECT * FROM test.t1 ORDER BY a;
+a
+1
+2
+show tables;
+Tables_in_test
+CREATE PROCEDURE test.p3()
+BEGIN
+INSERT INTO test.t2 VALUES(7);
+END|
+CREATE PROCEDURE test.p4()
+BEGIN
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t2 (a int, PRIMARY KEY(a));
+INSERT INTO test.t2 VALUES(6);
+CALL test.p3();
+END|
+CALL test.p4();
+SELECT * FROM test.t2 ORDER BY a;
+a
+6
+7
+SELECT * FROM test.t2 ORDER BY a;
+a
+6
+7
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp011.result b/mysql-test/suite/rpl/r/rpl_row_sp011.result
new file mode 100644
index 00000000000..e35c9f21adb
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_sp011.result
@@ -0,0 +1,69 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP PROCEDURE IF EXISTS test.p5;
+DROP PROCEDURE IF EXISTS test.p6;
+DROP PROCEDURE IF EXISTS test.p7;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (a int, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES (1);
+CREATE PROCEDURE test.p1()
+BEGIN
+ALTER TABLE test.t1 ADD COLUMN b CHAR(4) AFTER a;
+UPDATE test.t1 SET b = 'rbr' WHERE a = 1;
+CALL test.p2();
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+ALTER TABLE test.t1 ADD COLUMN f FLOAT AFTER b;
+UPDATE test.t1 SET f = RAND() WHERE a = 1;
+CALL test.p3();
+END|
+CREATE PROCEDURE test.p3()
+BEGIN
+ALTER TABLE test.t1 RENAME test.t2;
+CALL test.p4();
+END|
+CREATE PROCEDURE test.p4()
+BEGIN
+ALTER TABLE test.t2 ADD INDEX (f);
+ALTER TABLE test.t2 CHANGE a a INT UNSIGNED NOT NULL AUTO_INCREMENT;
+INSERT INTO test.t2 VALUES (NULL,'TEST',RAND());
+CALL test.p5();
+END|
+CREATE PROCEDURE test.p5()
+BEGIN
+ALTER TABLE test.t2 ORDER BY f;
+INSERT INTO test.t2 VALUES (NULL,'STM',RAND());
+CALL test.p6();
+END|
+CREATE PROCEDURE test.p6()
+BEGIN
+ALTER TABLE test.t2 ADD COLUMN b2 CHAR(4) FIRST;
+ALTER TABLE test.t2 ADD COLUMN to_drop BIT(8) AFTER b2;
+INSERT INTO test.t2 VALUES ('new',1,NULL,'STM',RAND());
+CALL test.p7();
+END|
+CREATE PROCEDURE test.p7()
+BEGIN
+ALTER TABLE test.t2 DROP COLUMN to_drop;
+INSERT INTO test.t2 VALUES ('gone',NULL,'STM',RAND());
+END|
+CALL test.p1();
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP PROCEDURE IF EXISTS test.p5;
+DROP PROCEDURE IF EXISTS test.p6;
+DROP PROCEDURE IF EXISTS test.p7;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_sp012.result b/mysql-test/suite/rpl/r/rpl_row_sp012.result
new file mode 100644
index 00000000000..b9c818bad9a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_sp012.result
@@ -0,0 +1,59 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+grant usage on *.* to user1@localhost;
+flush privileges;
+SELECT CURRENT_USER();
+CURRENT_USER()
+root@localhost
+SELECT USER();
+USER()
+root@localhost
+CREATE PROCEDURE test.p1 () SQL SECURITY INVOKER SELECT CURRENT_USER(), USER();
+CREATE PROCEDURE test.p2 () SQL SECURITY DEFINER CALL test.p1();
+CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
+GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
+GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
+GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
+
+<******** Master user1 p3 & p2 calls *******>
+----------------------------------------------
+SELECT CURRENT_USER();
+CURRENT_USER()
+user1@localhost
+SELECT USER();
+USER()
+user1@localhost
+CALL test.p3();
+CURRENT_USER() USER()
+user1@localhost user1@localhost
+CALL test.p2();
+CURRENT_USER() USER()
+root@localhost user1@localhost
+
+<******** Slave user1 p3 & p2 calls *******>
+---------------------------------------------
+SELECT CURRENT_USER();
+CURRENT_USER()
+user1@localhost
+SELECT USER();
+USER()
+user1@localhost
+CALL test.p3();
+CURRENT_USER() USER()
+user1@localhost user1@localhost
+CALL test.p2();
+CURRENT_USER() USER()
+root@localhost user1@localhost
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP USER user1@localhost;
diff --git a/mysql-test/suite/rpl/r/rpl_row_stop_middle.result b/mysql-test/suite/rpl/r/rpl_row_stop_middle.result
new file mode 100644
index 00000000000..46ca5748174
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_stop_middle.result
@@ -0,0 +1,26 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int not null auto_increment primary key, b int, key(b));
+stop slave;
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+start slave;
+stop slave;
+drop table t1;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result
new file mode 100644
index 00000000000..0fd4ff86893
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result
@@ -0,0 +1,16 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (words varchar(20)) engine=myisam;
+load data infile '../std_data_ln/words.dat' into table t1 (words);
+select count(*) from t1;
+count(*)
+70
+select count(*) from t1;
+count(*)
+70
+drop table t1;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
new file mode 100644
index 00000000000..4eca19ff098
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
@@ -0,0 +1,389 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+SET @my_sql_mode= @@global.sql_mode;
+SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
+START SLAVE;
+CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE='MyISAM';
+CREATE TABLE t4 (a INT) ENGINE='MyISAM';
+CREATE TABLE t5 (a INT, b INT, c INT) ENGINE='MyISAM';
+CREATE TABLE t6 (a INT, b INT, c INT) ENGINE='MyISAM';
+CREATE TABLE t7 (a INT NOT NULL) ENGINE='MyISAM';
+CREATE TABLE t8 (a INT NOT NULL) ENGINE='MyISAM';
+CREATE TABLE t9 (a INT) ENGINE='MyISAM';
+ALTER TABLE t1_int ADD x INT DEFAULT 42;
+ALTER TABLE t1_bit
+ADD x BIT(3) DEFAULT b'011',
+ADD y BIT(5) DEFAULT b'10101',
+ADD z BIT(2) DEFAULT b'10';
+ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
+ALTER TABLE t1_nodef ADD x INT NOT NULL;
+ALTER TABLE t2 DROP b;
+ALTER TABLE t4 MODIFY a FLOAT;
+ALTER TABLE t5 MODIFY b FLOAT;
+ALTER TABLE t6 MODIFY c FLOAT;
+ALTER TABLE t7 ADD e1 INT, ADD e2 INT, ADD e3 INT, ADD e4 INT,
+ADD e5 INT, ADD e6 INT, ADD e7 INT, ADD e8 INT;
+ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
+ADD e3 INT NOT NULL DEFAULT 0, ADD e4 INT NOT NULL DEFAULT 0,
+ADD e5 INT NOT NULL DEFAULT 0, ADD e6 INT NOT NULL DEFAULT 0,
+ADD e7 INT NOT NULL DEFAULT 0, ADD e8 INT NOT NULL DEFAULT 0;
+INSERT INTO t1_int VALUES (2, 4, 4711);
+INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
+INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
+**** On Master ****
+INSERT INTO t1_int VALUES (1,2);
+INSERT INTO t1_int VALUES (2,5);
+INSERT INTO t1_bit VALUES (1,2);
+INSERT INTO t1_bit VALUES (2,5);
+INSERT INTO t1_char VALUES (1,2);
+INSERT INTO t1_char VALUES (2,5);
+SELECT * FROM t1_int ORDER BY a;
+a b
+1 2
+2 5
+SELECT * FROM t1_bit ORDER BY a;
+a b
+1 2
+2 5
+SELECT * FROM t1_char ORDER BY a;
+a b
+1 2
+2 5
+**** On Slave ****
+SELECT a,b,x FROM t1_int ORDER BY a;
+a b x
+1 2 42
+2 5 4711
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
+a b HEX(x) HEX(y) HEX(z)
+1 2 3 15 2
+2 5 5 1C 1
+SELECT a,b,x FROM t1_char ORDER BY a;
+a b x
+1 2 Just a test
+2 5 Foo is a bar
+**** On Master ****
+UPDATE t1_int SET b=2*b WHERE a=2;
+UPDATE t1_char SET b=2*b WHERE a=2;
+UPDATE t1_bit SET b=2*b WHERE a=2;
+SELECT * FROM t1_int ORDER BY a;
+a b
+1 2
+2 10
+SELECT * FROM t1_bit ORDER BY a;
+a b
+1 2
+2 10
+SELECT * FROM t1_char ORDER BY a;
+a b
+1 2
+2 10
+**** On Slave ****
+SELECT a,b,x FROM t1_int ORDER BY a;
+a b x
+1 2 42
+2 10 4711
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
+a b HEX(x) HEX(y) HEX(z)
+1 2 3 15 2
+2 10 5 1C 1
+SELECT a,b,x FROM t1_char ORDER BY a;
+a b x
+1 2 Just a test
+2 10 Foo is a bar
+INSERT INTO t9 VALUES (2);
+INSERT INTO t1_nodef VALUES (1,2);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1105
+Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (2);
+INSERT INTO t2 VALUES (2,4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Table width mismatch - received 2 columns, test.t2 has 1 columns
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (4);
+INSERT INTO t4 VALUES (4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 0 type mismatch - received type 3, test.t4 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (5);
+INSERT INTO t5 VALUES (5,10,25);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 1 type mismatch - received type 3, test.t5 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (6);
+INSERT INTO t6 VALUES (6,12,36);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 2 type mismatch - received type 3, test.t6 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (6);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+INSERT INTO t7 VALUES (1),(2),(3);
+INSERT INTO t8 VALUES (1),(2),(3);
+SELECT * FROM t7 ORDER BY a;
+a
+1
+2
+3
+SELECT * FROM t8 ORDER BY a;
+a
+1
+2
+3
+SELECT * FROM t7 ORDER BY a;
+a e1 e2 e3 e4 e5 e6 e7 e8
+1 NULL NULL NULL NULL NULL NULL NULL NULL
+2 NULL NULL NULL NULL NULL NULL NULL NULL
+3 NULL NULL NULL NULL NULL NULL NULL NULL
+SELECT * FROM t8 ORDER BY a;
+a e1 e2 e3 e4 e5 e6 e7 e8
+1 0 0 0 0 0 0 0 0
+2 0 0 0 0 0 0 0 0
+3 0 0 0 0 0 0 0 0
+**** On Master ****
+TRUNCATE t1_nodef;
+SET SQL_LOG_BIN=0;
+INSERT INTO t1_nodef VALUES (1,2);
+INSERT INTO t1_nodef VALUES (2,4);
+SET SQL_LOG_BIN=1;
+**** On Slave ****
+INSERT INTO t1_nodef VALUES (1,2,3);
+INSERT INTO t1_nodef VALUES (2,4,6);
+**** On Master ****
+UPDATE t1_nodef SET b=2*b WHERE a=1;
+SELECT * FROM t1_nodef ORDER BY a;
+a b
+1 4
+2 4
+**** On Slave ****
+SELECT * FROM t1_nodef ORDER BY a;
+a b x
+1 4 3
+2 4 6
+**** On Master ****
+DELETE FROM t1_nodef WHERE a=2;
+SELECT * FROM t1_nodef ORDER BY a;
+a b
+1 4
+**** On Slave ****
+SELECT * FROM t1_nodef ORDER BY a;
+a b x
+1 4 3
+**** Cleanup ****
+DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
+DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9;
+SET @@global.sql_mode= @my_sql_mode;
diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
new file mode 100644
index 00000000000..687108e17e5
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
@@ -0,0 +1,389 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+SET @my_sql_mode= @@global.sql_mode;
+SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
+START SLAVE;
+CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE='InnoDB';
+CREATE TABLE t4 (a INT) ENGINE='InnoDB';
+CREATE TABLE t5 (a INT, b INT, c INT) ENGINE='InnoDB';
+CREATE TABLE t6 (a INT, b INT, c INT) ENGINE='InnoDB';
+CREATE TABLE t7 (a INT NOT NULL) ENGINE='InnoDB';
+CREATE TABLE t8 (a INT NOT NULL) ENGINE='InnoDB';
+CREATE TABLE t9 (a INT) ENGINE='InnoDB';
+ALTER TABLE t1_int ADD x INT DEFAULT 42;
+ALTER TABLE t1_bit
+ADD x BIT(3) DEFAULT b'011',
+ADD y BIT(5) DEFAULT b'10101',
+ADD z BIT(2) DEFAULT b'10';
+ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
+ALTER TABLE t1_nodef ADD x INT NOT NULL;
+ALTER TABLE t2 DROP b;
+ALTER TABLE t4 MODIFY a FLOAT;
+ALTER TABLE t5 MODIFY b FLOAT;
+ALTER TABLE t6 MODIFY c FLOAT;
+ALTER TABLE t7 ADD e1 INT, ADD e2 INT, ADD e3 INT, ADD e4 INT,
+ADD e5 INT, ADD e6 INT, ADD e7 INT, ADD e8 INT;
+ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
+ADD e3 INT NOT NULL DEFAULT 0, ADD e4 INT NOT NULL DEFAULT 0,
+ADD e5 INT NOT NULL DEFAULT 0, ADD e6 INT NOT NULL DEFAULT 0,
+ADD e7 INT NOT NULL DEFAULT 0, ADD e8 INT NOT NULL DEFAULT 0;
+INSERT INTO t1_int VALUES (2, 4, 4711);
+INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
+INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
+**** On Master ****
+INSERT INTO t1_int VALUES (1,2);
+INSERT INTO t1_int VALUES (2,5);
+INSERT INTO t1_bit VALUES (1,2);
+INSERT INTO t1_bit VALUES (2,5);
+INSERT INTO t1_char VALUES (1,2);
+INSERT INTO t1_char VALUES (2,5);
+SELECT * FROM t1_int ORDER BY a;
+a b
+1 2
+2 5
+SELECT * FROM t1_bit ORDER BY a;
+a b
+1 2
+2 5
+SELECT * FROM t1_char ORDER BY a;
+a b
+1 2
+2 5
+**** On Slave ****
+SELECT a,b,x FROM t1_int ORDER BY a;
+a b x
+1 2 42
+2 5 4711
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
+a b HEX(x) HEX(y) HEX(z)
+1 2 3 15 2
+2 5 5 1C 1
+SELECT a,b,x FROM t1_char ORDER BY a;
+a b x
+1 2 Just a test
+2 5 Foo is a bar
+**** On Master ****
+UPDATE t1_int SET b=2*b WHERE a=2;
+UPDATE t1_char SET b=2*b WHERE a=2;
+UPDATE t1_bit SET b=2*b WHERE a=2;
+SELECT * FROM t1_int ORDER BY a;
+a b
+1 2
+2 10
+SELECT * FROM t1_bit ORDER BY a;
+a b
+1 2
+2 10
+SELECT * FROM t1_char ORDER BY a;
+a b
+1 2
+2 10
+**** On Slave ****
+SELECT a,b,x FROM t1_int ORDER BY a;
+a b x
+1 2 42
+2 10 4711
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
+a b HEX(x) HEX(y) HEX(z)
+1 2 3 15 2
+2 10 5 1C 1
+SELECT a,b,x FROM t1_char ORDER BY a;
+a b x
+1 2 Just a test
+2 10 Foo is a bar
+INSERT INTO t9 VALUES (2);
+INSERT INTO t1_nodef VALUES (1,2);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1105
+Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (2);
+INSERT INTO t2 VALUES (2,4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Table width mismatch - received 2 columns, test.t2 has 1 columns
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (4);
+INSERT INTO t4 VALUES (4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 0 type mismatch - received type 3, test.t4 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (5);
+INSERT INTO t5 VALUES (5,10,25);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 1 type mismatch - received type 3, test.t5 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (6);
+INSERT INTO t6 VALUES (6,12,36);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1523
+Last_Error Column 2 type mismatch - received type 3, test.t6 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (6);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+INSERT INTO t7 VALUES (1),(2),(3);
+INSERT INTO t8 VALUES (1),(2),(3);
+SELECT * FROM t7 ORDER BY a;
+a
+1
+2
+3
+SELECT * FROM t8 ORDER BY a;
+a
+1
+2
+3
+SELECT * FROM t7 ORDER BY a;
+a e1 e2 e3 e4 e5 e6 e7 e8
+1 NULL NULL NULL NULL NULL NULL NULL NULL
+2 NULL NULL NULL NULL NULL NULL NULL NULL
+3 NULL NULL NULL NULL NULL NULL NULL NULL
+SELECT * FROM t8 ORDER BY a;
+a e1 e2 e3 e4 e5 e6 e7 e8
+1 0 0 0 0 0 0 0 0
+2 0 0 0 0 0 0 0 0
+3 0 0 0 0 0 0 0 0
+**** On Master ****
+TRUNCATE t1_nodef;
+SET SQL_LOG_BIN=0;
+INSERT INTO t1_nodef VALUES (1,2);
+INSERT INTO t1_nodef VALUES (2,4);
+SET SQL_LOG_BIN=1;
+**** On Slave ****
+INSERT INTO t1_nodef VALUES (1,2,3);
+INSERT INTO t1_nodef VALUES (2,4,6);
+**** On Master ****
+UPDATE t1_nodef SET b=2*b WHERE a=1;
+SELECT * FROM t1_nodef ORDER BY a;
+a b
+1 4
+2 4
+**** On Slave ****
+SELECT * FROM t1_nodef ORDER BY a;
+a b x
+1 4 3
+2 4 6
+**** On Master ****
+DELETE FROM t1_nodef WHERE a=2;
+SELECT * FROM t1_nodef ORDER BY a;
+a b
+1 4
+**** On Slave ****
+SELECT * FROM t1_nodef ORDER BY a;
+a b x
+1 4 3
+**** Cleanup ****
+DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
+DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9;
+SET @@global.sql_mode= @my_sql_mode;
diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_7ndb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_7ndb.result
new file mode 100644
index 00000000000..5876a0e1b65
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_7ndb.result
@@ -0,0 +1,288 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+SET @my_sql_mode= @@global.sql_mode;
+SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
+START SLAVE;
+CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE='NDB';
+CREATE TABLE t4 (a INT) ENGINE='NDB';
+CREATE TABLE t5 (a INT, b INT, c INT) ENGINE='NDB';
+CREATE TABLE t6 (a INT, b INT, c INT) ENGINE='NDB';
+CREATE TABLE t9 (a INT) ENGINE='NDB';
+ALTER TABLE t1_int ADD x INT DEFAULT 42;
+ALTER TABLE t1_bit
+ADD x BIT(3) DEFAULT b'011',
+ADD y BIT(5) DEFAULT b'10101',
+ADD z BIT(2) DEFAULT b'10';
+ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
+ALTER TABLE t1_nodef ADD x INT NOT NULL;
+ALTER TABLE t2 DROP b;
+ALTER TABLE t4 MODIFY a FLOAT;
+ALTER TABLE t5 MODIFY b FLOAT;
+ALTER TABLE t6 MODIFY c FLOAT;
+INSERT INTO t1_int VALUES (2, 4, 4711);
+INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
+INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
+**** On Master ****
+INSERT INTO t1_int VALUES (1,2);
+INSERT INTO t1_int VALUES (2,5);
+INSERT INTO t1_bit VALUES (1,2);
+INSERT INTO t1_bit VALUES (2,5);
+INSERT INTO t1_char VALUES (1,2);
+INSERT INTO t1_char VALUES (2,5);
+SELECT * FROM t1_int;
+a b
+1 2
+2 5
+SELECT * FROM t1_bit;
+a b
+1 2
+2 5
+SELECT * FROM t1_char;
+a b
+1 2
+2 5
+**** On Slave ****
+SELECT a,b,x FROM t1_int;
+a b x
+1 2 42
+2 5 42
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+a b HEX(x) HEX(y) HEX(z)
+1 2 3 15 2
+2 5 3 15 2
+SELECT a,b,x FROM t1_char;
+a b x
+1 2 Just a test
+2 5 Just a test
+**** On Master ****
+UPDATE t1_int SET b=2*b WHERE a=2;
+UPDATE t1_char SET b=2*b WHERE a=2;
+UPDATE t1_bit SET b=2*b WHERE a=2;
+SELECT * FROM t1_int;
+a b
+1 2
+2 10
+SELECT * FROM t1_bit;
+a b
+1 2
+2 10
+SELECT * FROM t1_char;
+a b
+1 2
+2 10
+**** On Slave ****
+SELECT a,b,x FROM t1_int;
+a b x
+1 2 42
+2 10 42
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+a b HEX(x) HEX(y) HEX(z)
+1 2 3 15 2
+2 10 3 15 2
+SELECT a,b,x FROM t1_char;
+a b x
+1 2 Just a test
+2 10 Just a test
+INSERT INTO t9 VALUES (2);
+INSERT INTO t1_nodef VALUES (1,2);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1364
+Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (2);
+INSERT INTO t2 VALUES (2,4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1514
+Last_Error Table width mismatch - received 2 columns, test.t2 has 1 columns
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (4);
+INSERT INTO t4 VALUES (4);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1514
+Last_Error Column 0 type mismatch - received type 3, test.t4 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (5);
+INSERT INTO t5 VALUES (5,10,25);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1514
+Last_Error Column 1 type mismatch - received type 3, test.t5 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+INSERT INTO t9 VALUES (6);
+INSERT INTO t6 VALUES (6,12,36);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 1514
+Last_Error Column 2 type mismatch - received type 3, test.t6 has type 4
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
+DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t9;
+SET @@global.sql_mode= @my_sql_mode;
diff --git a/mysql-test/suite/rpl/r/rpl_row_trig001.result b/mysql-test/suite/rpl/r/rpl_row_trig001.result
new file mode 100644
index 00000000000..6665dc6d555
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_trig001.result
@@ -0,0 +1,30 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n));
+CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n));
+INSERT INTO test.t1 VALUES (1,NOW());
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1;//
+CREATE PROCEDURE test.p3()
+BEGIN
+INSERT INTO test.t3 (d) VALUES (NOW());
+END//
+CREATE TRIGGER test.t3_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW CALL test.p3()//
+CREATE PROCEDURE test.p2()
+BEGIN
+INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW());
+END//
+
+<End test section 2 (Tiggers & SP)>
+-----------------------------------
+DROP PROCEDURE test.p2;
+DROP PROCEDURE test.p3;
+DROP TRIGGER test.t2_ai;
+DROP TRIGGER test.t3_bi_t2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
diff --git a/mysql-test/suite/rpl/r/rpl_row_trig002.result b/mysql-test/suite/rpl/r/rpl_row_trig002.result
new file mode 100644
index 00000000000..794104db750
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_trig002.result
@@ -0,0 +1,69 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TRIGGER test.t2_ai;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+CREATE TABLE test.t2 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
+CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
+CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL AND ms.program='spamfilter' AND ms.keey='scan_incoming'|
+INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com');
+SELECT * FROM test.t1 ORDER BY id;
+id domain
+1 example.com
+2 mysql.com
+3 earthmotherwear.com
+4 yahoo.com
+5 example.com
+SELECT * FROM test.t1 ORDER BY id;
+id domain
+1 example.com
+2 mysql.com
+3 earthmotherwear.com
+4 yahoo.com
+5 example.com
+INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming');
+INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+select * from test.t2;
+value domain_id mailaccount_id program keey
+Yes 1 NULL spamfilter scan_incoming
+select * from test.t3;
+value domain_id mailaccount_id program keey
+No 5 NULL spamfilter scan_incoming
+Yes 1 NULL spamfilter scan_incoming
+select * from test.t2;
+value domain_id mailaccount_id program keey
+Yes 1 NULL spamfilter scan_incoming
+select * from test.t3;
+value domain_id mailaccount_id program keey
+No 5 NULL spamfilter scan_incoming
+Yes 1 NULL spamfilter scan_incoming
+DELETE FROM test.t1 WHERE id = 1;
+SELECT * FROM test.t1 ORDER BY id;
+id domain
+2 mysql.com
+3 earthmotherwear.com
+4 yahoo.com
+5 example.com
+SELECT * FROM test.t1 ORDER BY id;
+id domain
+2 mysql.com
+3 earthmotherwear.com
+4 yahoo.com
+5 example.com
+SELECT * FROM test.t1 ORDER BY id;
+id domain
+2 mysql.com
+3 earthmotherwear.com
+4 yahoo.com
+5 example.com
+DROP TRIGGER test.t2_ai;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
diff --git a/mysql-test/suite/rpl/r/rpl_row_trig003.result b/mysql-test/suite/rpl/r/rpl_row_trig003.result
new file mode 100644
index 00000000000..43c2ecde2b4
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_trig003.result
@@ -0,0 +1,83 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TRIGGER test.t1_bi;
+DROP TRIGGER test.t2_ai;
+DROP TRIGGER test.t1_bu;
+DROP TRIGGER test.t2_au;
+DROP TRIGGER test.t1_bd;
+DROP TRIGGER test.t2_ad;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+CREATE TABLE test.t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+CREATE TABLE test.t2 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+CREATE TABLE test.t3 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+CREATE TRIGGER test.t1_bi BEFORE INSERT ON test.t1 FOR EACH ROW UPDATE test.t3 SET b1=1 and y=YEAR(NOW())|
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW BEGIN
+INSERT INTO test.t3 VALUES(NULL,0,'MySQL Replication team rocks!', 'Dark beer in prague is #1',12345.34,12.51,0,1965,NOW());
+UPDATE test.t3 SET f = ROUND(f);
+END|
+CREATE TRIGGER test.t1_bu BEFORE UPDATE on test.t1 FOR EACH ROW BEGIN
+UPDATE test.t3 SET y = '2000';
+INSERT INTO test.t3 VALUES(NULL,1,'Testing MySQL databases before update ', 'Insert should work',621.43, 0105.21,0,1974,NOW());
+END|
+CREATE TRIGGER test.t2_au AFTER UPDATE on test.t2 FOR EACH ROW BEGIN
+DECLARE done INT DEFAULT 0;
+DECLARE a DECIMAL(10,4);
+DECLARE b FLOAT;
+DECLARE num MEDIUMINT;
+DECLARE cur1 CURSOR FOR SELECT t2.id, t2.d, t2.f FROM test.t2;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+OPEN cur1;
+REPEAT
+FETCH cur1 INTO num, a, b;
+IF NOT done THEN
+UPDATE test.t3 SET total =(a*b) WHERE ID = num;
+END IF;
+UNTIL done END REPEAT;
+CLOSE cur1;
+END|
+CREATE TRIGGER test.t1_bd BEFORE DELETE on test.t1 FOR EACH ROW BEGIN
+DECLARE done INT DEFAULT 0;
+DECLARE a BIT(8);
+DECLARE b VARCHAR(255);
+DECLARE c CHAR(255);
+DECLARE d DECIMAL(10,4);
+DECLARE e FLOAT;
+DECLARE f BIGINT UNSIGNED;
+DECLARE g YEAR;
+DECLARE h TIMESTAMP;
+DECLARE cur1 CURSOR FOR SELECT t1.b1, t1.vc, t1.bc, t1.d, t1.f, t1.total, t1.y, t1.t FROM test.t1;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+OPEN cur1;
+REPEAT
+FETCH cur1 INTO a, b, c, d, e, f, g, h;
+IF NOT done THEN
+INSERT INTO test.t3 VALUES(NULL, a, b, c, d, e, f, g, h);
+END IF;
+UNTIL done END REPEAT;
+CLOSE cur1;
+END|
+CREATE TRIGGER test.t2_ad AFTER DELETE ON test.t2 FOR EACH ROW
+DELETE FROM test.t1|
+INSERT INTO test.t1 VALUES(NULL,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,NOW());
+INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL Customers ROCK!',654321.4321,1.24521,0,YEAR(NOW()),NOW());
+UPDATE test.t1 SET b1 = 0 WHERE b1 = 1;
+INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW());
+UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
+INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
+DELETE FROM test.t1 WHERE id = 1;
+DELETE FROM test.t2 WHERE id = 1;
+DROP TRIGGER test.t1_bi;
+DROP TRIGGER test.t2_ai;
+DROP TRIGGER test.t1_bu;
+DROP TRIGGER test.t2_au;
+DROP TRIGGER test.t1_bd;
+DROP TRIGGER test.t2_ad;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
diff --git a/mysql-test/suite/rpl/r/rpl_row_trig004.result b/mysql-test/suite/rpl/r/rpl_row_trig004.result
new file mode 100644
index 00000000000..d0d0657f875
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_trig004.result
@@ -0,0 +1,30 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TRIGGER test.t1_bi_t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d FLOAT, PRIMARY KEY(n))ENGINE=INNODB;
+CREATE TABLE test.t2 (n MEDIUMINT NOT NULL, f FLOAT, PRIMARY KEY(n))ENGINE=INNODB;
+CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO test.t1 VALUES (NULL, 1.234)//
+INSERT INTO test.t2 VALUES (1, 0.0);
+INSERT INTO test.t2 VALUES (1, 0.0);
+Got one of the listed errors
+select * from test.t1;
+n d
+1 1.234
+select * from test.t2;
+n f
+1 0
+select * from test.t1;
+n d
+1 1.234
+select * from test.t2;
+n f
+1 0
+DROP TRIGGER test.t1_bi_t2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result
new file mode 100644
index 00000000000..d71cc479f7a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result
@@ -0,0 +1,190 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (1),(2),(3),(4);
+drop table t1;
+create table t2(n int not null auto_increment primary key);
+insert into t2 values (1),(2);
+insert into t2 values (3),(4);
+drop table t2;
+start slave until master_log_file='master-bin.000001', master_log_pos=311;
+select * from t1;
+n
+1
+2
+3
+4
+SHOW SLAVE STATUS;;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 744
+Relay_Log_File slave-relay-bin.000004
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running #
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 315
+Relay_Log_Space #
+Until_Condition Master
+Until_Log_File master-bin.000001
+Until_Log_Pos 311
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+select * from t1;
+n
+1
+2
+3
+4
+SHOW SLAVE STATUS;;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 744
+Relay_Log_File slave-relay-bin.000004
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running #
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 315
+Relay_Log_Space #
+Until_Condition Master
+Until_Log_File master-no-such-bin.000001
+Until_Log_Pos 291
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
+select * from t2;
+n
+1
+2
+SHOW SLAVE STATUS;;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 744
+Relay_Log_File slave-relay-bin.000004
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running #
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 590
+Relay_Log_Space #
+Until_Condition Relay
+Until_Log_File slave-relay-bin.000004
+Until_Log_Pos 728
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+start slave;
+stop slave;
+start slave until master_log_file='master-bin.000001', master_log_pos=740;
+SHOW SLAVE STATUS;;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 744
+Relay_Log_File slave-relay-bin.000004
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 744
+Relay_Log_Space #
+Until_Condition Master
+Until_Log_File master-bin.000001
+Until_Log_Pos 740
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+start slave until master_log_file='master-bin', master_log_pos=561;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until master_log_file='master-bin.000001';
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until relay_log_file='slave-relay-bin.000002';
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave sql_thread;
+start slave until master_log_file='master-bin.000001', master_log_pos=740;
+Warnings:
+Note 1254 Slave is already running
diff --git a/mysql-test/suite/rpl/r/rpl_row_view01.result b/mysql-test/suite/rpl/r/rpl_row_view01.result
new file mode 100644
index 00000000000..a4b8d0a05e3
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_view01.result
@@ -0,0 +1,101 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database if not exists mysqltest1;
+DROP VIEW IF EXISTS mysqltest1.v1;
+DROP VIEW IF EXISTS mysqltest1.v2;
+DROP VIEW IF EXISTS mysqltest1.v3;
+DROP VIEW IF EXISTS mysqltest1.v4;
+DROP TABLE IF EXISTS mysqltest1.t3;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t4;
+CREATE TABLE mysqltest1.t1 (a INT, c CHAR(6),PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t2 (a INT, c CHAR(6),PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t3 (a INT, c CHAR(6), c2 CHAR(6), PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t4 (a INT, qty INT, price INT,PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t5 (qty INT, price INT, total INT, PRIMARY KEY(qty));
+INSERT INTO mysqltest1.t1 VALUES (1,'Thank'),(2,'it'),(3,'Friday');
+INSERT INTO mysqltest1.t2 VALUES (1,'GOD'),(2,'is'),(3,'TGIF');
+INSERT INTO mysqltest1.t4 VALUES(1, 3, 50),(2, 18, 3),(4, 4, 4);
+CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4 ORDER BY qty;
+CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a ORDER BY a;
+CREATE VIEW mysqltest1.v3 AS SELECT * FROM mysqltest1.t1;
+CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL CHECK OPTION;
+SELECT * FROM mysqltest1.v2;
+qty price value
+3 50 150
+4 4 16
+18 3 54
+SELECT * FROM mysqltest1.v1;
+a c c2
+1 Thank GOD
+2 it is
+3 Friday TGIF
+SELECT * FROM mysqltest1.v2;
+qty price value
+3 50 150
+4 4 16
+18 3 54
+SELECT * FROM mysqltest1.v1;
+a c c2
+1 Thank GOD
+2 it is
+3 Friday TGIF
+INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2;
+INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1;
+SELECT * FROM mysqltest1.t5 ORDER BY qty;
+qty price total
+3 50 150
+4 4 16
+18 3 54
+SELECT * FROM mysqltest1.t3 ORDER BY a;
+a c c2
+1 Thank GOD
+2 it is
+3 Friday TGIF
+SELECT * FROM mysqltest1.t5 ORDER BY qty;
+qty price total
+3 50 150
+4 4 16
+18 3 54
+SELECT * FROM mysqltest1.t3 ORDER BY a;
+a c c2
+1 Thank GOD
+2 it is
+3 Friday TGIF
+INSERT INTO mysqltest1.v4 VALUES (4,'TEST');
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+a c
+1 Thank
+2 it
+3 Friday
+4 TEST
+SELECT * FROM mysqltest1.v4 ORDER BY a;
+a c
+2 it
+3 Friday
+4 TEST
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+a c
+1 Thank
+2 it
+3 Friday
+4 TEST
+SELECT * FROM mysqltest1.v4 ORDER BY a;
+a c
+2 it
+3 Friday
+4 TEST
+DROP VIEW IF EXISTS mysqltest1.v1;
+DROP VIEW IF EXISTS mysqltest1.v2;
+DROP VIEW IF EXISTS mysqltest1.v3;
+DROP VIEW IF EXISTS mysqltest1.v4;
+DROP TABLE IF EXISTS mysqltest1.t3;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t4;
+DROP DATABASE mysqltest1;
diff --git a/mysql-test/suite/rpl/r/rpl_server_id1.result b/mysql-test/suite/rpl/r/rpl_server_id1.result
new file mode 100644
index 00000000000..8f82ca8ea12
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_server_id1.result
@@ -0,0 +1,19 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (n int);
+reset master;
+stop slave;
+change master to master_port=SLAVE_PORT;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 106 None 0 No NULL No
+start slave;
+insert into t1 values (1);
+show status like "slave_running";
+Variable_name Value
+Slave_running OFF
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_server_id2.result b/mysql-test/suite/rpl/r/rpl_server_id2.result
new file mode 100644
index 00000000000..a5c7fc07714
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_server_id2.result
@@ -0,0 +1,21 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (n int);
+reset master;
+stop slave;
+change master to master_port=SLAVE_PORT;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 106 None 0 No NULL No
+start slave;
+insert into t1 values (1);
+select * from t1;
+n
+1
+1
+stop slave;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_session_var.result b/mysql-test/suite/rpl/r/rpl_session_var.result
new file mode 100644
index 00000000000..b5b4b815ade
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_session_var.result
@@ -0,0 +1,43 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+create table t1(a varchar(100),b int);
+set @@session.sql_mode=pipes_as_concat;
+insert into t1 values('My'||'SQL', 1);
+set @@session.sql_mode=default;
+insert into t1 values('1'||'2', 2);
+select * from t1 where b<3 order by a;
+a b
+1 2
+MySQL 1
+select * from t1 where b<3 order by a;
+a b
+1 2
+MySQL 1
+set @@session.sql_mode=ignore_space;
+insert into t1 values(password ('MySQL'), 3);
+set @@session.sql_mode=ansi_quotes;
+create table "t2" ("a" int);
+drop table t1, t2;
+set @@session.sql_mode=default;
+create table t1(a int auto_increment primary key);
+create table t2(b int, a int);
+set @@session.sql_auto_is_null=1;
+insert into t1 values(null);
+insert into t2 select 1,a from t1 where a is null;
+set @@session.sql_auto_is_null=0;
+insert into t1 values(null);
+insert into t2 select 2,a from t1 where a is null;
+select * from t2 order by b;
+b a
+1 1
+select * from t2 order by b;
+b a
+1 1
+drop table t1,t2;
diff --git a/mysql-test/suite/rpl/r/rpl_set_charset.result b/mysql-test/suite/rpl/r/rpl_set_charset.result
new file mode 100644
index 00000000000..480d926fbba
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_set_charset.result
@@ -0,0 +1,48 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+create database mysqltest1 /*!40100 character set latin2 */;
+use mysqltest1;
+drop table if exists t1;
+create table t1 (a varchar(255) character set latin2, b varchar(4));
+SET CHARACTER SET cp1250_latin2;
+INSERT INTO t1 VALUES ('ŠŒŽ','80');
+INSERT INTO t1 VALUES ('šœžŸ','90');
+INSERT INTO t1 VALUES ('£¥ª¯','A0');
+INSERT INTO t1 VALUES ('³¹º¼¾¿','B0');
+INSERT INTO t1 VALUES ('ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ','C0');
+INSERT INTO t1 VALUES ('ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß','D0');
+INSERT INTO t1 VALUES ('àáâãäåæçèéêëìíîï','E0');
+INSERT INTO t1 VALUES ('ðñòóôõö÷øùúûüýþÿ','F0');
+select "--- on master ---";
+--- on master ---
+--- on master ---
+select hex(a),b from t1 order by b;
+hex(a) b
+A9A6ABAEAC 80
+B9B6BBBEBC 90
+A3A1AAAF A0
+B3B1BAA5B5BF B0
+C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF C0
+D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF D0
+E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF E0
+F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF F0
+use mysqltest1;
+select "--- on slave ---";
+--- on slave ---
+--- on slave ---
+select hex(a),b from t1 order by b;
+hex(a) b
+A9A6ABAEAC 80
+B9B6BBBEBC 90
+A3A1AAAF A0
+B3B1BAA5B5BF B0
+C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF C0
+D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF D0
+E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF E0
+F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF F0
+drop database mysqltest1;
diff --git a/mysql-test/suite/rpl/r/rpl_sf.result b/mysql-test/suite/rpl/r/rpl_sf.result
new file mode 100644
index 00000000000..46defc6908a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_sf.result
@@ -0,0 +1,23 @@
+set global log_bin_trust_function_creators=0;
+set binlog_format=STATEMENT;
+create function fn16456()
+returns int
+begin
+return unix_timestamp();
+end|
+ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
+set global log_bin_trust_function_creators=1;
+create function fn16456()
+returns int
+begin
+return unix_timestamp();
+end|
+set global log_bin_trust_function_creators=0;
+set binlog_format=ROW;
+select fn16456();
+fn16456()
+timestamp
+set binlog_format=STATEMENT;
+select fn16456();
+ERROR HY000: Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events
+drop function fn16456;
diff --git a/mysql-test/suite/rpl/r/rpl_skip_error.result b/mysql-test/suite/rpl/r/rpl_skip_error.result
new file mode 100644
index 00000000000..248ce5b52c3
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_skip_error.result
@@ -0,0 +1,16 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (n int not null primary key);
+insert into t1 values (1);
+insert into t1 values (1);
+insert into t1 values (2),(3);
+select * from t1 ORDER BY n;
+n
+1
+2
+3
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_slave_status.result b/mysql-test/suite/rpl/r/rpl_slave_status.result
new file mode 100644
index 00000000000..29ec7b77b45
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_slave_status.result
@@ -0,0 +1,58 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+stop slave;
+change master to master_user='rpl',master_password='rpl';
+start slave;
+drop table if exists t1;
+create table t1 (n int);
+insert into t1 values (1);
+select * from t1;
+n
+1
+delete from mysql.user where user='rpl';
+flush privileges;
+stop slave;
+start slave;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User rpl
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running No
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master NULL
+Master_SSL_Verify_Server_Cert No
+drop table t1;
+delete from mysql.user where user='rpl';
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
new file mode 100644
index 00000000000..208c46c5fab
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -0,0 +1,536 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+create database mysqltest1;
+use mysqltest1;
+create table t1 (a varchar(100));
+use mysqltest1;
+create procedure foo()
+begin
+declare b int;
+set b = 8;
+insert into t1 values (b);
+insert into t1 values (unix_timestamp());
+end|
+select * from mysql.proc where name='foo' and db='mysqltest1';
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
+mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin
+declare b int;
+set b = 8;
+insert into t1 values (b);
+insert into t1 values (unix_timestamp());
+end root@localhost # #
+select * from mysql.proc where name='foo' and db='mysqltest1';
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
+mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin
+declare b int;
+set b = 8;
+insert into t1 values (b);
+insert into t1 values (unix_timestamp());
+end root@localhost # #
+set timestamp=1000000000;
+call foo();
+select * from t1;
+a
+8
+1000000000
+select * from t1;
+a
+8
+1000000000
+delete from t1;
+create procedure foo2()
+select * from mysqltest1.t1;
+call foo2();
+a
+alter procedure foo2 contains sql;
+drop table t1;
+create table t1 (a int);
+create table t2 like t1;
+create procedure foo3()
+deterministic
+insert into t1 values (15);
+grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
+grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
+grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
+SELECT 1;
+1
+1
+create procedure foo4()
+deterministic
+begin
+insert into t2 values(3);
+insert into t1 values (5);
+end|
+call foo4();
+Got one of the listed errors
+call foo3();
+show warnings;
+Level Code Message
+call foo4();
+Got one of the listed errors
+alter procedure foo4 sql security invoker;
+call foo4();
+show warnings;
+Level Code Message
+select * from t1;
+a
+15
+5
+select * from t2;
+a
+3
+3
+3
+select * from t1;
+a
+15
+5
+select * from t2;
+a
+3
+3
+3
+delete from t2;
+alter table t2 add unique (a);
+drop procedure foo4;
+create procedure foo4()
+deterministic
+begin
+insert into t2 values(20),(20);
+end|
+call foo4();
+ERROR 23000: Duplicate entry '20' for key 'a'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry '20' for key 'a'
+select * from t2;
+a
+20
+select * from t2;
+a
+20
+select * from mysql.proc where name="foo4" and db='mysqltest1';
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
+mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin
+insert into t2 values(20),(20);
+end root@localhost # #
+drop procedure foo4;
+select * from mysql.proc where name="foo4" and db='mysqltest1';
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
+select * from mysql.proc where name="foo4" and db='mysqltest1';
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
+drop procedure foo;
+drop procedure foo2;
+drop procedure foo3;
+create function fn1(x int)
+returns int
+begin
+insert into t1 values (x);
+return x+2;
+end|
+ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
+create function fn1(x int)
+returns int
+deterministic
+begin
+insert into t1 values (x);
+return x+2;
+end|
+delete t1,t2 from t1,t2;
+select fn1(20);
+fn1(20)
+22
+insert into t2 values(fn1(21));
+select * from t1;
+a
+21
+20
+select * from t2;
+a
+23
+select * from t1;
+a
+21
+20
+select * from t2;
+a
+23
+drop function fn1;
+create function fn1()
+returns int
+no sql
+begin
+return unix_timestamp();
+end|
+alter function fn1 contains sql;
+ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
+delete from t1;
+set timestamp=1000000000;
+insert into t1 values(fn1());
+create function fn2()
+returns int
+no sql
+begin
+return unix_timestamp();
+end|
+ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
+set global log_bin_trust_routine_creators=1;
+Warnings:
+Warning 1543 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+set global log_bin_trust_function_creators=0;
+set global log_bin_trust_function_creators=1;
+set global log_bin_trust_function_creators=1;
+create function fn2()
+returns int
+no sql
+begin
+return unix_timestamp();
+end|
+create function fn3()
+returns int
+not deterministic
+reads sql data
+begin
+return 0;
+end|
+select fn3();
+fn3()
+0
+select * from mysql.proc where db='mysqltest1';
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
+mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin
+return unix_timestamp();
+end root@localhost # #
+mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
+return unix_timestamp();
+end zedjzlcsjhd@localhost # #
+mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
+return 0;
+end root@localhost # #
+select * from t1;
+a
+1000000000
+use mysqltest1;
+select * from t1;
+a
+1000000000
+select * from mysql.proc where db='mysqltest1';
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
+mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin
+return unix_timestamp();
+end root@localhost # #
+mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
+return unix_timestamp();
+end zedjzlcsjhd@localhost # #
+mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
+return 0;
+end root@localhost # #
+delete from t2;
+alter table t2 add unique (a);
+drop function fn1;
+create function fn1(x int)
+returns int
+begin
+insert into t2 values(x),(x);
+return 10;
+end|
+do fn1(100);
+Warnings:
+Error 1062 Duplicate entry '100' for key 'a'
+select fn1(20);
+ERROR 23000: Duplicate entry '20' for key 'a'
+select * from t2;
+a
+20
+100
+select * from t2;
+a
+20
+100
+create trigger trg before insert on t1 for each row set new.a= 10;
+ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table 't1'
+delete from t1;
+create trigger trg before insert on t1 for each row set new.a= 10;
+insert into t1 values (1);
+select * from t1;
+a
+10
+select * from t1;
+a
+10
+delete from t1;
+drop trigger trg;
+insert into t1 values (1);
+select * from t1;
+a
+1
+select * from t1;
+a
+1
+create procedure foo()
+not deterministic
+reads sql data
+select * from t1;
+call foo();
+a
+1
+drop procedure foo;
+drop function fn1;
+drop database mysqltest1;
+drop user "zedjzlcsjhd"@127.0.0.1;
+use test;
+use test;
+drop function if exists f1;
+create function f1() returns int reads sql data
+begin
+declare var integer;
+declare c cursor for select a from v1;
+open c;
+fetch c into var;
+close c;
+return var;
+end|
+create view v1 as select 1 as a;
+create table t1 (a int);
+insert into t1 (a) values (f1());
+select * from t1;
+a
+1
+drop view v1;
+drop function f1;
+select * from t1;
+a
+1
+DROP PROCEDURE IF EXISTS p1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(col VARCHAR(10));
+CREATE PROCEDURE p1(arg VARCHAR(10))
+INSERT INTO t1 VALUES(arg);
+CALL p1('test');
+SELECT * FROM t1;
+col
+test
+SELECT * FROM t1;
+col
+test
+DROP PROCEDURE p1;
+
+---> Test for BUG#20438
+
+---> Preparing environment...
+---> connection: master
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+
+---> Synchronizing slave with master...
+
+---> connection: master
+
+---> Creating procedure...
+/*!50003 CREATE PROCEDURE p1() SET @a = 1 */;
+/*!50003 CREATE FUNCTION f1() RETURNS INT RETURN 0 */;
+
+---> Checking on master...
+SHOW CREATE PROCEDURE p1;
+Procedure sql_mode Create Procedure
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @a = 1
+SHOW CREATE FUNCTION f1;
+Function sql_mode Create Function
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 0
+
+---> Synchronizing slave with master...
+---> connection: master
+
+---> Checking on slave...
+SHOW CREATE PROCEDURE p1;
+Procedure sql_mode Create Procedure
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @a = 1
+SHOW CREATE FUNCTION f1;
+Function sql_mode Create Function
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 0
+
+---> connection: master
+
+---> Cleaning up...
+DROP PROCEDURE p1;
+DROP FUNCTION f1;
+drop table t1;
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+create database mysqltest;
+create database mysqltest2;
+use mysqltest2;
+create table t ( t integer );
+create procedure mysqltest.test() begin end;
+insert into t values ( 1 );
+create procedure `\\`.test() begin end;
+ERROR 42000: Unknown database '\\'
+create function f1 () returns int
+begin
+insert into t values (1);
+return 0;
+end|
+use mysqltest;
+set @a:= mysqltest2.f1();
+show binlog events in 'master-bin.000001' from 106;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # drop database if exists mysqltest1
+master-bin.000001 # Query 1 # create database mysqltest1
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100))
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo()
+begin
+declare b int;
+set b = 8;
+insert into t1 values (b);
+insert into t1 values (unix_timestamp());
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8))
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp())
+master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2()
+select * from mysqltest1.t1
+master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo2 contains sql
+master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int)
+master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo3()
+deterministic
+insert into t1 values (15)
+master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` procedure foo4()
+deterministic
+begin
+insert into t2 values(3);
+insert into t1 values (5);
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15)
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5)
+master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2
+master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a)
+master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4()
+deterministic
+begin
+insert into t2 values(20),(20);
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(20),(20)
+master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4
+master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo
+master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo2
+master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo3
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int)
+returns int
+deterministic
+begin
+insert into t1 values (x);
+return x+2;
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21))
+master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1()
+returns int
+no sql
+begin
+return unix_timestamp();
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(fn1())
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` function fn2()
+returns int
+no sql
+begin
+return unix_timestamp();
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn3()
+returns int
+not deterministic
+reads sql data
+begin
+return 0;
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2
+master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a)
+master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int)
+returns int
+begin
+insert into t2 values(x),(x);
+return 10;
+end
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100)
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
+master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1)
+master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
+master-bin.000001 # Query 1 # use `mysqltest1`; drop trigger trg
+master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1)
+master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo()
+not deterministic
+reads sql data
+select * from t1
+master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo
+master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
+master-bin.000001 # Query 1 # drop database mysqltest1
+master-bin.000001 # Query 1 # drop user "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` function f1() returns int reads sql data
+begin
+declare var integer;
+declare c cursor for select a from v1;
+open c;
+fetch c into var;
+close c;
+return var;
+end
+master-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
+master-bin.000001 # Query 1 # use `test`; insert into t1 (a) values (f1())
+master-bin.000001 # Query 1 # use `test`; drop view v1
+master-bin.000001 # Query 1 # use `test`; drop function f1
+master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1
+master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(col VARCHAR(10))
+master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1(arg VARCHAR(10))
+INSERT INTO t1 VALUES(arg)
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test'))
+master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1
+master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1() SET @a = 1
+master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION f1() RETURNS INT RETURN 0
+master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1
+master-bin.000001 # Query 1 # use `test`; DROP FUNCTION f1
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # drop database if exists mysqltest
+master-bin.000001 # Query 1 # drop database if exists mysqltest2
+master-bin.000001 # Query 1 # create database mysqltest
+master-bin.000001 # Query 1 # create database mysqltest2
+master-bin.000001 # Query 1 # use `mysqltest2`; create table t ( t integer )
+master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` procedure mysqltest.test() begin end
+master-bin.000001 # Query 1 # use `mysqltest2`; insert into t values ( 1 )
+master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` function f1 () returns int
+begin
+insert into t values (1);
+return 0;
+end
+master-bin.000001 # Query 1 # use `mysqltest`; SELECT `mysqltest2`.`f1`()
+set global log_bin_trust_function_creators=0;
+set global log_bin_trust_function_creators=0;
+drop database mysqltest;
+drop database mysqltest2;
+End of 5.0 tests
+End of 5.1 tests
diff --git a/mysql-test/suite/rpl/r/rpl_sp004.result b/mysql-test/suite/rpl/r/rpl_sp004.result
new file mode 100644
index 00000000000..1c0ed3cc50a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_sp004.result
@@ -0,0 +1,93 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t3;
+CREATE PROCEDURE test.p1()
+BEGIN
+CREATE TABLE IF NOT EXISTS test.t1(a INT,PRIMARY KEY(a));
+CREATE TABLE IF NOT EXISTS test.t2(a INT,PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES (4),(2),(1),(3);
+UPDATE test.t1 SET a=a+4 WHERE a=4;
+INSERT INTO test.t2 (a) SELECT t1.a FROM test.t1;
+UPDATE test.t1 SET a=a+4 WHERE a=8;
+CREATE TABLE IF NOT EXISTS test.t3(n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+INSERT INTO test.t3 VALUES(NULL,11111111.233333,NOW());
+END|
+CALL test.p1();
+SELECT * FROM test.t1 ORDER BY a;
+a
+1
+2
+3
+12
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+2
+3
+8
+SELECT * FROM test.t1 ORDER BY a;
+a
+1
+2
+3
+12
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+2
+3
+8
+CALL test.p2();
+USE test;
+SHOW TABLES;
+Tables_in_test
+t3
+USE test;
+SHOW TABLES;
+Tables_in_test
+t3
+CALL test.p1();
+Warnings:
+Note 1050 Table 't3' already exists
+SELECT * FROM test.t1 ORDER BY a;
+a
+1
+2
+3
+12
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+2
+3
+8
+SELECT * FROM test.t1 ORDER BY a;
+a
+1
+2
+3
+12
+SELECT * FROM test.t2 ORDER BY a;
+a
+1
+2
+3
+8
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
diff --git a/mysql-test/suite/rpl/r/rpl_sp_effects.result b/mysql-test/suite/rpl/r/rpl_sp_effects.result
new file mode 100644
index 00000000000..c2c44b06972
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_sp_effects.result
@@ -0,0 +1,238 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop function if exists f1;
+drop table if exists t1,t2;
+drop view if exists v1;
+create table t1 (a int);
+SET GLOBAL log_bin_trust_function_creators = 1;
+create procedure p1()
+begin
+declare spv int default 0;
+while spv < 5 do
+insert into t1 values(spv+1);
+set spv=spv+1;
+end while;
+end//
+call p1();
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+4
+5
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+4
+5
+create procedure p2()
+begin
+declare a int default 4;
+create table t2 as select a;
+end//
+call p2();
+SELECT * FROM t2 ORDER BY a;
+a
+4
+SELECT * FROM t2 ORDER BY a;
+a
+4
+drop procedure p1;
+drop procedure p2;
+drop table t2;
+create function f1(x int) returns int
+begin
+insert into t1 values(x);
+return x+1;
+end//
+create procedure p1(a int, b int)
+begin
+declare v int default f1(5);
+if (f1(6)) then
+select 'yes';
+end if;
+set v = f1(7);
+while f1(8) < 1 do
+select 'this cant be';
+end while;
+end//
+call p1(f1(1), f1(2));
+yes
+yes
+SELECT * FROM t1 ORDER BY a;
+a
+1
+1
+2
+2
+3
+4
+5
+5
+6
+7
+8
+create table t2(a int);
+insert into t2 values (10),(11);
+SELECT a,f1(a) FROM t2 ORDER BY a;
+a f1(a)
+10 11
+11 12
+insert into t2 select f1(3);
+SELECT 'master:',a FROM t1 ORDER BY a;
+master: a
+master: 1
+master: 1
+master: 2
+master: 2
+master: 3
+master: 3
+master: 4
+master: 5
+master: 5
+master: 6
+master: 7
+master: 8
+master: 10
+master: 11
+SELECT 'slave:',a FROM t1 ORDER BY a;
+slave: a
+slave: 1
+slave: 1
+slave: 2
+slave: 2
+slave: 3
+slave: 3
+slave: 4
+slave: 5
+slave: 5
+slave: 6
+slave: 7
+slave: 8
+slave: 10
+slave: 11
+drop procedure p1;
+delete from t1;
+delete from t2;
+delete from t1;
+insert into t2 values(1),(2);
+create view v1 as select f1(a) as f from t2;
+select * from v1 order by f;
+f
+2
+3
+SELECT 'master:',a FROM t1 ORDER BY a;
+master: a
+master: 1
+master: 2
+SELECT 'slave:',a FROM t1 ORDER BY a;
+slave: a
+slave: 1
+slave: 2
+drop view v1;
+delete from t1;
+prepare s1 from 'select f1(?)';
+set @xx=123;
+execute s1 using @xx;
+f1(?)
+124
+SELECT 'master:',a FROM t1 ORDER BY a;
+master: a
+master: 123
+SELECT 'slave:',a FROM t1 ORDER BY a;
+slave: a
+slave: 123
+delete from t1;
+create procedure p1(spv int)
+begin
+declare c cursor for select f1(spv) from t2;
+while (spv > 2) do
+open c;
+fetch c into spv;
+close c;
+set spv= spv - 10;
+end while;
+end//
+call p1(15);
+SELECT 'master:',a FROM t1 ORDER BY a;
+master: a
+master: 6
+master: 6
+master: 15
+master: 15
+SELECT 'slave:',a FROM t1 ORDER BY a;
+slave: a
+slave: 6
+slave: 6
+slave: 15
+slave: 15
+drop procedure p1;
+drop function f1;
+drop table t1,t2;
+create table t1 (a int);
+create procedure p1()
+begin
+insert into t1 values(@x);
+set @x=@x+1;
+insert into t1 values(@x);
+if (f2()) then
+insert into t1 values(1243);
+end if;
+end//
+create function f2() returns int
+begin
+insert into t1 values(@z);
+set @z=@z+1;
+insert into t1 values(@z);
+return 0;
+end//
+create function f1() returns int
+begin
+insert into t1 values(@y);
+call p1();
+return 0;
+end//
+set @x=10;
+set @y=20;
+set @z=100;
+select f1();
+f1()
+0
+set @x=30;
+call p1();
+SELECT 'master', a FROM t1 ORDER BY a;
+master a
+master 10
+master 11
+master 20
+master 30
+master 31
+master 100
+master 101
+master 101
+master 102
+SELECT 'slave', a FROM t1 ORDER BY a;
+slave a
+slave 10
+slave 11
+slave 20
+slave 30
+slave 31
+slave 100
+slave 101
+slave 101
+slave 102
+drop table t1;
+drop function f1;
+drop function f2;
+drop procedure p1;
+SET GLOBAL log_bin_trust_function_creators = 0;
diff --git a/mysql-test/suite/rpl/r/rpl_sporadic_master.result b/mysql-test/suite/rpl/r/rpl_sporadic_master.result
new file mode 100644
index 00000000000..14fb673a081
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_sporadic_master.result
@@ -0,0 +1,26 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t2(n int);
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (NULL),(NULL);
+truncate table t1;
+insert into t1 values (4),(NULL);
+stop slave;
+start slave;
+insert into t1 values (NULL),(NULL);
+flush logs;
+truncate table t1;
+insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
+select * from t1 ORDER BY n;
+n
+10
+11
+12
+13
+14
+15
+drop table t1,t2;
diff --git a/mysql-test/suite/rpl/r/rpl_ssl.result b/mysql-test/suite/rpl/r/rpl_ssl.result
new file mode 100644
index 00000000000..64d52d63f78
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_ssl.result
@@ -0,0 +1,99 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+grant replication slave on *.* to replssl@localhost require ssl;
+create table t1 (t int auto_increment, KEY(t));
+stop slave;
+change master to
+master_user='replssl',
+master_password='',
+master_ssl=1,
+master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem',
+master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem',
+master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem';
+start slave;
+insert into t1 values(1);
+select * from t1;
+t
+1
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User replssl
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed Yes
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
+Master_SSL_CA_Path
+Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
+Master_SSL_Cipher
+Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+STOP SLAVE;
+select * from t1;
+t
+1
+insert into t1 values (NULL);
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User replssl
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed Yes
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
+Master_SSL_CA_Path
+Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
+Master_SSL_Cipher
+Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+drop user replssl@localhost;
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/suite/rpl/r/rpl_ssl1.result b/mysql-test/suite/rpl/r/rpl_ssl1.result
new file mode 100644
index 00000000000..6bc4b53849f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_ssl1.result
@@ -0,0 +1,146 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+grant replication slave on *.* to replssl@localhost require ssl;
+create table t1 (t int);
+stop slave;
+change master to master_user='replssl',master_password='';
+start slave;
+insert into t1 values (1);
+select * from t1;
+t
+stop slave;
+change master to master_ssl=1 , master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem';
+start slave;
+select * from t1;
+t
+1
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User replssl
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File #
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File #
+Slave_IO_Running #
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed Yes
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
+Master_SSL_CA_Path
+Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
+Master_SSL_Cipher
+Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+stop slave;
+change master to master_user='root',master_password='', master_ssl=0;
+start slave;
+drop user replssl@localhost;
+drop table t1;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File #
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File #
+Slave_IO_Running #
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
+Master_SSL_CA_Path
+Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
+Master_SSL_Cipher
+Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+stop slave;
+change master to
+master_host="localhost",
+master_ssl=1 ,
+master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem',
+master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem',
+master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem',
+master_ssl_verify_server_cert=1;
+start slave;
+create table t1 (t int);
+insert into t1 values (1);
+on slave
+select * from t1;
+t
+1
+show slave status;
+Slave_IO_State #
+Master_Host localhost
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File #
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File #
+Slave_IO_Running #
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed Yes
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
+Master_SSL_CA_Path
+Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
+Master_SSL_Cipher
+Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert Yes
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_start_stop_slave.result b/mysql-test/suite/rpl/r/rpl_start_stop_slave.result
new file mode 100644
index 00000000000..1fcb586d1fb
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_start_stop_slave.result
@@ -0,0 +1,12 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+create table t1(n int);
+start slave;
+stop slave io_thread;
+start slave io_thread;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_000001.result b/mysql-test/suite/rpl/r/rpl_stm_000001.result
new file mode 100644
index 00000000000..3b4cd05f640
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_000001.result
@@ -0,0 +1,82 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (word char(20) not null);
+load data infile '../std_data_ln/words.dat' into table t1;
+load data local infile 'MYSQL_TEST_DIR/std_data/words.dat' into table t1;
+select * from t1 limit 10;
+word
+Aarhus
+Aaron
+Ababa
+aback
+abaft
+abandon
+abandoned
+abandoning
+abandonment
+abandons
+stop slave;
+set password for root@"localhost" = password('foo');
+start slave;
+set password for root@"localhost" = password('');
+create table t3(n int);
+insert into t3 values(1),(2);
+select * from t3;
+n
+1
+2
+select sum(length(word)) from t1;
+sum(length(word))
+1022
+drop table t1,t3;
+create table t1 (n int) engine=myisam;
+reset master;
+stop slave;
+reset slave;
+lock tables t1 read;
+start slave;
+unlock tables;
+create table t2(id int);
+insert into t2 values(connection_id());
+create temporary table t3(n int);
+insert into t3 select get_lock('crash_lock%20C', 1) from t2;
+update t1 set n = n + get_lock('crash_lock%20C', 2);
+select (@id := id) - id from t2;
+(@id := id) - id
+0
+kill @id;
+drop table t2;
+Got one of the listed errors
+set global sql_slave_skip_counter=1;
+start slave;
+select count(*) from t1;
+count(*)
+5000
+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"));
+Warnings:
+Warning 1364 Field 'ssl_cipher' doesn't have a default value
+Warning 1364 Field 'x509_issuer' doesn't have a default value
+Warning 1364 Field 'x509_subject' doesn't have a default value
+select select_priv,user from mysql.user where user = _binary'blafasel2';
+select_priv user
+N blafasel2
+update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
+select select_priv,user from mysql.user where user = _binary'blafasel2';
+select_priv user
+Y blafasel2
+select n from t1;
+n
+3456
+select select_priv,user from mysql.user where user = _binary'blafasel2';
+select_priv user
+Y blafasel2
+drop table t1;
+delete from mysql.user where user="blafasel2";
diff --git a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
new file mode 100644
index 00000000000..13aa45d8ced
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
@@ -0,0 +1,13 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int, unique(a)) engine=myisam;
+set sql_log_bin=0;
+insert into t1 values(2);
+set sql_log_bin=1;
+insert into t1 values(1),(2);
+ERROR 23000: Duplicate entry '2' for key 'a'
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_charset.result b/mysql-test/suite/rpl/r/rpl_stm_charset.result
new file mode 100644
index 00000000000..fd9c40843d5
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_charset.result
@@ -0,0 +1,270 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+set timestamp=1000000000;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+create database mysqltest2 character set latin2;
+set @@character_set_server=latin5;
+create database mysqltest3;
+
+--- --master--
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
+
+--- --slave--
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
+set @@collation_server=armscii8_bin;
+drop database mysqltest3;
+create database mysqltest3;
+
+--- --master--
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
+
+--- --slave--
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
+use mysqltest2;
+create table t1 (a int auto_increment primary key, b varchar(100));
+set character_set_client=cp850, collation_connection=latin2_croatian_ci;
+insert into t1 (b) values(@@character_set_server);
+insert into t1 (b) values(@@collation_server);
+insert into t1 (b) values(@@character_set_client);
+insert into t1 (b) values(@@character_set_connection);
+insert into t1 (b) values(@@collation_connection);
+
+--- --master--
+select * from t1 order by a;
+a b
+1 armscii8
+2 armscii8_bin
+3 cp850
+4 latin2
+5 latin2_croatian_ci
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 armscii8
+2 armscii8_bin
+3 cp850
+4 latin2
+5 latin2_croatian_ci
+set character_set_client=latin1, collation_connection=latin1_german1_ci;
+truncate table t1;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Müller","Muffler"));
+set collation_connection=latin1_german2_ci;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Müller","Muffler"));
+
+--- --master--
+select * from t1 order by a;
+a b
+1 latin1_german1_ci
+2 Muffler
+3 latin1_german2_ci
+4 Müller
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 latin1_german1_ci
+2 Muffler
+3 latin1_german2_ci
+4 Müller
+set @a= _cp850 'Müller' collate cp850_general_ci;
+truncate table t1;
+insert into t1 (b) values(collation(@a));
+
+--- --master--
+select * from t1 order by a;
+a b
+1 cp850_general_ci
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 cp850_general_ci
+drop database mysqltest2;
+drop database mysqltest3;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # drop database if exists mysqltest2
+master-bin.000001 # Query # # drop database if exists mysqltest3
+master-bin.000001 # Query # # create database mysqltest2 character set latin2
+master-bin.000001 # Query # # create database mysqltest3
+master-bin.000001 # Query # # drop database mysqltest3
+master-bin.000001 # Query # # create database mysqltest3
+master-bin.000001 # Query # # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@character_set_server)
+master-bin.000001 # Intvar # # INSERT_ID=2
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_server)
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@character_set_client)
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@character_set_connection)
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 # Query # # use `mysqltest2`; truncate table t1
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 # Intvar # # INSERT_ID=2
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
+master-bin.000001 # Query # # use `mysqltest2`; truncate table t1
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # User var # # @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
+master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(collation(@a))
+master-bin.000001 # Query # # drop database mysqltest2
+master-bin.000001 # Query # # drop database mysqltest3
+set global character_set_server=latin2;
+set global character_set_server=latin1;
+set global character_set_server=latin2;
+set global character_set_server=latin1;
+set one_shot @@character_set_server=latin5;
+set @@max_join_size=1000;
+select @@character_set_server;
+@@character_set_server
+latin5
+select @@character_set_server;
+@@character_set_server
+latin1
+set @@character_set_server=latin5;
+select @@character_set_server;
+@@character_set_server
+latin5
+select @@character_set_server;
+@@character_set_server
+latin5
+set one_shot max_join_size=10;
+ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
+set character_set_client=9999999;
+ERROR 42000: Unknown character set: '9999999'
+set collation_server=9999998;
+ERROR HY000: Unknown collation: '9999998'
+use test;
+CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
+SET CHARACTER_SET_CLIENT=koi8r,
+CHARACTER_SET_CONNECTION=cp1251,
+CHARACTER_SET_RESULTS=koi8r;
+INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ');
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+flush logs;
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+drop database if exists mysqltest2/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+drop database if exists mysqltest3/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+create database mysqltest2 character set latin2/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30/*!*/;
+create database mysqltest3/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=64/*!*/;
+drop database mysqltest3/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+create database mysqltest3/*!*/;
+use mysqltest2/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+create table t1 (a int auto_increment primary key, b varchar(100))/*!*/;
+SET INSERT_ID=1/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+/*!\C cp850 *//*!*/;
+SET @@session.character_set_client=4,@@session.collation_connection=27,@@session.collation_server=64/*!*/;
+insert into t1 (b) values(@@character_set_server)/*!*/;
+SET INSERT_ID=2/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+insert into t1 (b) values(@@collation_server)/*!*/;
+SET INSERT_ID=3/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+insert into t1 (b) values(@@character_set_client)/*!*/;
+SET INSERT_ID=4/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+insert into t1 (b) values(@@character_set_connection)/*!*/;
+SET INSERT_ID=5/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+insert into t1 (b) values(@@collation_connection)/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=5,@@session.collation_server=64/*!*/;
+truncate table t1/*!*/;
+SET INSERT_ID=1/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+insert into t1 (b) values(@@collation_connection)/*!*/;
+SET INSERT_ID=2/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+insert into t1 (b) values(LEAST("Müller","Muffler"))/*!*/;
+SET INSERT_ID=3/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=31,@@session.collation_server=64/*!*/;
+insert into t1 (b) values(@@collation_connection)/*!*/;
+SET INSERT_ID=4/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+insert into t1 (b) values(LEAST("Müller","Muffler"))/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+truncate table t1/*!*/;
+SET INSERT_ID=1/*!*/;
+SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+insert into t1 (b) values(collation(@a))/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+drop database mysqltest2/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+drop database mysqltest3/*!*/;
+use test/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30/*!*/;
+CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255))/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+/*!\C koi8r *//*!*/;
+SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30/*!*/;
+INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ')/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+drop table t1;
+create table `t1` (
+`pk` varchar(10) not null default '',
+primary key (`pk`)
+) engine=myisam default charset=latin1;
+set @p=_latin1 'test';
+update t1 set pk='test' where pk=@p;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
new file mode 100644
index 00000000000..1c6b5615b6e
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
@@ -0,0 +1,33 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int);
+insert into t1 values (10);
+create table t2 (a int);
+create table t3 (a int) engine=merge union(t1);
+create table t4 (a int);
+insert into t4 select * from t3;
+rename table t1 to t5, t2 to t1;
+flush no_write_to_binlog tables;
+SHOW BINLOG EVENTS FROM 656 ;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
+select * from t3;
+a
+flush tables;
+SHOW BINLOG EVENTS FROM 656 ;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
+master-bin.000001 # Query 1 # use `test`; flush tables
+select * from t3;
+a
+stop slave;
+drop table t1;
+flush tables with read lock;
+start slave;
+stop slave;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+drop table t3, t4, t5;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result
new file mode 100644
index 00000000000..1c003856eb9
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result
@@ -0,0 +1,88 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+set @old_global_binlog_format = @@global.binlog_format;
+set @@global.binlog_format = statement;
+CREATE SCHEMA IF NOT EXISTS mysqlslap;
+USE mysqlslap;
+select @@global.binlog_format;
+@@global.binlog_format
+STATEMENT
+CREATE TABLE t1 (id INT primary key auto_increment, name VARCHAR(64));
+FLUSH TABLE t1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+use mysqlslap;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+truncate table t1;
+insert delayed into t1 values(10, "my name");
+insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
+ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
+flush table t1;
+select * from t1;
+id name
+10 my name
+select * from t1;
+id name
+10 my name
+delete from t1 where id!=10;
+insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
+ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
+flush table t1;
+select * from t1;
+id name
+10 my name
+20 is Bond
+select * from t1;
+id name
+10 my name
+20 is Bond
+USE test;
+DROP SCHEMA mysqlslap;
+set @@global.binlog_format = mixed;
+CREATE SCHEMA IF NOT EXISTS mysqlslap;
+USE mysqlslap;
+select @@global.binlog_format;
+@@global.binlog_format
+MIXED
+CREATE TABLE t1 (id INT primary key auto_increment, name VARCHAR(64));
+FLUSH TABLE t1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+use mysqlslap;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+truncate table t1;
+insert delayed into t1 values(10, "my name");
+insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
+flush table t1;
+select * from t1;
+id name
+10 my name
+20 James Bond
+select * from t1;
+id name
+10 my name
+20 James Bond
+delete from t1 where id!=10;
+insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
+flush table t1;
+select * from t1;
+id name
+10 my name
+20 is Bond
+select * from t1;
+id name
+10 my name
+20 is Bond
+USE test;
+DROP SCHEMA mysqlslap;
+set @@global.binlog_format = @old_global_binlog_format;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result
new file mode 100644
index 00000000000..3ee2d990159
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result
@@ -0,0 +1,115 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+reset master;
+reset slave;
+reset master;
+create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
+insert into t1 values (NULL);
+drop table t1;
+create table t1 (word char(20) not null)ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+select count(*) from t1;
+count(*)
+69
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Intvar 1 # INSERT_ID=1
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
+master-bin.000001 # Query 1 # use `test`; drop table t1
+master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
+master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
+show binlog events from 106 limit 1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+show binlog events from 106 limit 2;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Intvar 1 # INSERT_ID=1
+show binlog events from 106 limit 2,1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
+flush logs;
+create table t3 (a int)ENGINE=MyISAM;
+start slave;
+
+let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
+
+--source include/wait_slave_status.inc
+flush logs;
+stop slave;
+create table t2 (n int)ENGINE=MyISAM;
+insert into t2 values (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=581
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
+master-bin.000001 # Rotate # # master-bin.000002;pos=4
+show binlog events in 'master-bin.000002';
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
+master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
+master-bin.000002 # Query 1 # use `test`; insert into t2 values (1)
+show binary logs;
+Log_name File_size
+master-bin.000001 1347
+master-bin.000002 392
+start slave;
+show binary logs;
+Log_name File_size
+slave-bin.000001 1447
+slave-bin.000002 293
+show binlog events in 'slave-bin.000001' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+slave-bin.000001 # Intvar 1 # INSERT_ID=1
+slave-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
+slave-bin.000001 # Query 1 # use `test`; drop table t1
+slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
+slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
+slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
+slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from 4;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
+slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
+slave-bin.000002 # Query 1 # use `test`; insert into t2 values (1)
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 392 # # master-bin.000002 Yes Yes # 0 0 392 # None 0 No # No
+show binlog events in 'slave-bin.000005' from 4;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+reset master;
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Intvar # # LAST_INSERT_ID=1
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id())
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
new file mode 100644
index 00000000000..c2e57be6ad4
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
@@ -0,0 +1,279 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+#
+# Generate a big enough master's binlog to cause relay log rotations
+#
+create table t1 (a int);
+drop table t1;
+reset slave;
+#
+# Test 1
+#
+set @my_max_binlog_size= @@global.max_binlog_size;
+set global max_binlog_size=8192;
+set global max_relay_log_size=8192-1;
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size
+4096
+start slave;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 72960
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 72960
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+#
+# Test 2
+#
+stop slave;
+reset slave;
+set global max_relay_log_size=(5*4096);
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size 20480
+start slave;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 72960
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 72960
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+#
+# Test 3: max_relay_log_size = 0
+#
+stop slave;
+reset slave;
+set global max_relay_log_size=0;
+select @@global.max_relay_log_size;
+@@global.max_relay_log_size 0
+start slave;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 72960
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 72960
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+#
+# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
+#
+stop slave;
+reset slave;
+flush logs;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File
+Read_Master_Log_Pos 4
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 0
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+#
+# Test 5
+#
+reset slave;
+start slave;
+flush logs;
+create table t1 (a int);
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 73046
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 73046
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+#
+# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
+#
+flush logs;
+drop table t1;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 73122
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 73122
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+flush logs;
+show master status;
+File master-bin.000002
+Position 106
+Binlog_Do_DB <Binlog_Ignore_DB>
+Binlog_Ignore_DB
+set global max_binlog_size= @my_max_binlog_size;
+#
+# End of 4.1 tests
+#
diff --git a/mysql-test/suite/rpl/r/rpl_stm_multi_query.result b/mysql-test/suite/rpl/r/rpl_stm_multi_query.result
new file mode 100644
index 00000000000..625c686f383
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_multi_query.result
@@ -0,0 +1,32 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest;
+create database mysqltest;
+create table mysqltest.t1 ( n int);
+insert into mysqltest.t1 values(1)/
+insert into mysqltest.t1 values(2);
+insert into mysqltest.t1 values(3);
+insert into mysqltest.t1 values(4);
+insert into mysqltest.t1 values(5)/
+select * from mysqltest.t1;
+n
+1
+2
+3
+4
+5
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # drop database if exists mysqltest
+master-bin.000001 # Query # # create database mysqltest
+master-bin.000001 # Query # # use `test`; create table mysqltest.t1 ( n int)
+master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(1)
+master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(2)
+master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(3)
+master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(4)
+master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(5)
+drop database mysqltest;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_mystery22.result b/mysql-test/suite/rpl/r/rpl_stm_mystery22.result
new file mode 100644
index 00000000000..ea34b308ec2
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_mystery22.result
@@ -0,0 +1,31 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(n int auto_increment primary key, s char(10));
+insert into t1 values (2,'old');
+insert into t1 values(NULL,'new');
+insert into t1 values(NULL,'new');
+select * from t1 order by n;
+n s
+1 new
+2 old
+delete from t1 where n = 2;
+start slave;
+stop slave;
+create table t2(n int);
+drop table t2;
+insert into t1 values(NULL,'new');
+set sql_log_bin=0;
+insert into t1 values(NULL,'new');
+set sql_log_bin=1;
+delete from t1 where n=4;
+start slave;
+select * from t1 order by n;
+n s
+1 new
+2 new
+3 new
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_no_op.result b/mysql-test/suite/rpl/r/rpl_stm_no_op.result
new file mode 100644
index 00000000000..5a253d61fcb
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_no_op.result
@@ -0,0 +1,52 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database mysqltest;
+drop database if exists mysqltest;
+Warnings:
+Note 1008 Can't drop database 'mysqltest'; database doesn't exist
+show tables from mysqltest;
+ERROR 42000: Unknown database 'mysqltest'
+create table t1 (a int);
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+create table t1 (a int, b int);
+insert into t1 values(1,1);
+delete from t1;
+select * from t1;
+a b
+insert into t1 values(1,1);
+insert into t1 values(2,1);
+update t1 set a=2;
+select * from t1;
+a b
+2 1
+2 1
+create table t2 (a int, b int);
+delete from t1;
+insert into t1 values(1,1);
+insert into t2 values(1,1);
+update t1 set a=2;
+UPDATE t1, t2 SET t1.a = t2.a;
+select * from t1;
+a b
+1 1
+select * from t2;
+a b
+1 1
+delete from t1;
+delete from t2;
+insert into t1 values(1,1);
+insert into t2 values(1,1);
+DELETE t1.*, t2.* from t1, t2;
+select * from t1;
+a b
+select * from t2;
+a b
+drop table t1, t2;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
new file mode 100644
index 00000000000..e134629d597
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
@@ -0,0 +1,32 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # No
+stop slave;
+change master to master_user='test';
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 No No # 0 0 106 # None 0 No # No
+reset slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # No
+start slave;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # No
+stop slave;
+reset slave;
+start slave;
+create temporary table t1 (a int);
+stop slave;
+reset slave;
+start slave;
+show status like 'slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 1
diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result
new file mode 100644
index 00000000000..ffe6216a42b
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_until.result
@@ -0,0 +1,190 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (1),(2),(3),(4);
+drop table t1;
+create table t2(n int not null auto_increment primary key);
+insert into t2 values (1),(2);
+insert into t2 values (3),(4);
+drop table t2;
+start slave until master_log_file='master-bin.000001', master_log_pos=323;
+select * from t1;
+n
+1
+2
+3
+4
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 784
+Relay_Log_File slave-relay-bin.000004
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running #
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 327
+Relay_Log_Space #
+Until_Condition Master
+Until_Log_File master-bin.000001
+Until_Log_Pos 323
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+select * from t1;
+n
+1
+2
+3
+4
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 784
+Relay_Log_File slave-relay-bin.000004
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running #
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 327
+Relay_Log_Space #
+Until_Condition Master
+Until_Log_File master-no-such-bin.000001
+Until_Log_Pos 291
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
+select * from t2;
+n
+1
+2
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 784
+Relay_Log_File slave-relay-bin.000004
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running #
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 616
+Relay_Log_Space #
+Until_Condition Relay
+Until_Log_File slave-relay-bin.000004
+Until_Log_Pos 746
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+start slave;
+stop slave;
+start slave until master_log_file='master-bin.000001', master_log_pos=776;
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 784
+Relay_Log_File slave-relay-bin.000004
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 784
+Relay_Log_Space #
+Until_Condition Master
+Until_Log_File master-bin.000001
+Until_Log_Pos 776
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+start slave until master_log_file='master-bin', master_log_pos=561;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until master_log_file='master-bin.000001';
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until relay_log_file='slave-relay-bin.000002';
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave sql_thread;
+start slave until master_log_file='master-bin.000001', master_log_pos=776;
+Warnings:
+Note 1254 Slave is already running
diff --git a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result
new file mode 100644
index 00000000000..7c796bd5449
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result
@@ -0,0 +1,1017 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+create database mysqltest1;
+use mysqltest1;
+set @my_binlog_format= @@global.binlog_format;
+set session binlog_format=mixed;
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format MIXED
+set session binlog_format=statement;
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
+set session binlog_format=row;
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format ROW
+set global binlog_format=DEFAULT;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format MIXED
+set global binlog_format=MIXED;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format MIXED
+set global binlog_format=STATEMENT;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
+set global binlog_format=ROW;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format ROW
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format ROW
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+ROW ROW
+CREATE TABLE t1 (a varchar(100));
+prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+set @string="emergency_1_";
+insert into t1 values("work_2_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_3_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+insert into t1 values(concat("for_4_",UUID()));
+insert into t1 select "yesterday_5_";
+create temporary table tmp(a char(100));
+insert into tmp values("see_6_");
+set binlog_format=statement;
+ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
+insert into t1 select * from tmp;
+drop temporary table tmp;
+set binlog_format=statement;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format ROW
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+ROW STATEMENT
+set global binlog_format=statement;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+STATEMENT STATEMENT
+prepare stmt1 from 'insert into t1 select ?';
+set @string="emergency_7_";
+insert into t1 values("work_8_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values("work_9_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+insert into t1 values("for_10_");
+insert into t1 select "yesterday_11_";
+set binlog_format=statement;
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+STATEMENT STATEMENT
+set global binlog_format=statement;
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+STATEMENT STATEMENT
+prepare stmt1 from 'insert into t1 select ?';
+set @string="emergency_12_";
+insert into t1 values("work_13_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values("work_14_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+insert into t1 values("for_15_");
+insert into t1 select "yesterday_16_";
+set global binlog_format=mixed;
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+MIXED STATEMENT
+set binlog_format=default;
+select @@global.binlog_format, @@session.binlog_format;
+@@global.binlog_format @@session.binlog_format
+MIXED MIXED
+prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+set @string="emergency_17_";
+insert into t1 values("work_18_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_19_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+insert into t1 values(concat("for_20_",UUID()));
+insert into t1 select "yesterday_21_";
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_22_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+insert into t1 values(concat("for_23_",UUID()));
+insert into t1 select "yesterday_24_";
+create table t2 select rpad(UUID(),100,' ');
+create table t3 select 1 union select UUID();
+create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
+create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
+insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
+create procedure foo()
+begin
+insert into t1 values("work_25_");
+insert into t1 values(concat("for_26_",UUID()));
+insert into t1 select "yesterday_27_";
+end|
+create procedure foo2()
+begin
+insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values("work_29_");
+insert into t1 values(concat("for_30_",UUID()));
+set session binlog_format=row; # accepted for stored procs
+insert into t1 values("more work_31_");
+set session binlog_format=mixed;
+end|
+create function foo3() returns bigint unsigned
+begin
+set session binlog_format=row; # rejected for stored funcs
+insert into t1 values("alarm");
+return 100;
+end|
+create procedure foo4(x varchar(100))
+begin
+insert into t1 values(concat("work_250_",x));
+insert into t1 select "yesterday_270_";
+end|
+call foo();
+call foo2();
+call foo4("hello");
+call foo4(UUID());
+call foo4("world");
+select foo3();
+ERROR HY000: Cannot change the binary logging format inside a stored function or trigger
+select * from t1 where a="alarm";
+a
+drop function foo3;
+create function foo3() returns bigint unsigned
+begin
+insert into t1 values("foo3_32_");
+call foo();
+return 100;
+end|
+insert into t2 select foo3();
+prepare stmt1 from 'insert into t2 select foo3()';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+create function foo4() returns bigint unsigned
+begin
+insert into t2 select foo3();
+return 100;
+end|
+select foo4();
+foo4()
+100
+prepare stmt1 from 'select foo4()';
+execute stmt1;
+foo4()
+100
+execute stmt1;
+foo4()
+100
+deallocate prepare stmt1;
+create function foo5() returns bigint unsigned
+begin
+insert into t2 select UUID();
+return 100;
+end|
+select foo5();
+foo5()
+100
+prepare stmt1 from 'select foo5()';
+execute stmt1;
+foo5()
+100
+execute stmt1;
+foo5()
+100
+deallocate prepare stmt1;
+create function foo6(x varchar(100)) returns bigint unsigned
+begin
+insert into t2 select x;
+return 100;
+end|
+select foo6("foo6_1_");
+foo6("foo6_1_")
+100
+select foo6(concat("foo6_2_",UUID()));
+foo6(concat("foo6_2_",UUID()))
+100
+prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
+execute stmt1;
+foo6(concat("foo6_3_",UUID()))
+100
+execute stmt1;
+foo6(concat("foo6_3_",UUID()))
+100
+deallocate prepare stmt1;
+create view v1 as select uuid();
+create table t11 (data varchar(255));
+insert into t11 select * from v1;
+insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
+prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')";
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+create trigger t11_bi before insert on t11 for each row
+begin
+set NEW.data = concat(NEW.data,UUID());
+end|
+insert into t11 values("try_560_");
+insert delayed into t2 values("delay_1_");
+insert delayed into t2 values(concat("delay_2_",UUID()));
+insert delayed into t2 values("delay_6_");
+insert delayed into t2 values(rand());
+set @a=2.345;
+insert delayed into t2 values(@a);
+create table t20 select * from t1;
+create table t21 select * from t2;
+create table t22 select * from t3;
+drop table t1,t2,t3;
+create table t1 (a int primary key auto_increment, b varchar(100));
+create table t2 (a int primary key auto_increment, b varchar(100));
+create table t3 (b varchar(100));
+create function f (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+insert into t2 values(null,x);
+return 1;
+end|
+select f("try_41_");
+f("try_41_")
+1
+use mysqltest1;
+insert into t2 values(2,null),(3,null),(4,null);
+delete from t2 where a>=2;
+select f("try_42_");
+f("try_42_")
+1
+insert into t2 values(3,null),(4,null);
+delete from t2 where a>=3;
+prepare stmt1 from 'select f(?)';
+set @string="try_43_";
+insert into t1 values(null,"try_44_");
+execute stmt1 using @string;
+f(?)
+1
+deallocate prepare stmt1;
+create table t12 select * from t1;
+drop table t1;
+create table t1 (a int, b varchar(100), key(a));
+select f("try_45_");
+f("try_45_")
+1
+create table t13 select * from t1;
+drop table t1;
+create table t1 (a int primary key auto_increment, b varchar(100));
+drop function f;
+create table t14 (unique (a)) select * from t2;
+truncate table t2;
+create function f1 (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+return 1;
+end|
+create function f2 (x varchar(100)) returns int deterministic
+begin
+insert into t2 values(null,x);
+return 1;
+end|
+select f1("try_46_"),f2("try_47_");
+f1("try_46_") f2("try_47_")
+1 1
+insert into t2 values(2,null),(3,null),(4,null);
+delete from t2 where a>=2;
+select f1("try_48_"),f2("try_49_");
+f1("try_48_") f2("try_49_")
+1 1
+insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
+drop function f2;
+create function f2 (x varchar(100)) returns int deterministic
+begin
+declare y int;
+insert into t1 values(null,x);
+set y = (select count(*) from t2);
+return y;
+end|
+select f1("try_53_"),f2("try_54_");
+f1("try_53_") f2("try_54_")
+1 3
+drop function f2;
+create trigger t1_bi before insert on t1 for each row
+begin
+insert into t2 values(null,"try_55_");
+end|
+insert into t1 values(null,"try_56_");
+alter table t1 modify a int, drop primary key;
+insert into t1 values(null,"try_57_");
+CREATE TEMPORARY TABLE t15 SELECT UUID();
+create table t16 like t15;
+INSERT INTO t16 SELECT * FROM t15;
+insert into t16 values("try_65_");
+drop table t15;
+insert into t16 values("try_66_");
+select count(*) from t1;
+count(*)
+7
+select count(*) from t2;
+count(*)
+5
+select count(*) from t3;
+count(*)
+1
+select count(*) from t4;
+count(*)
+29
+select count(*) from t5;
+count(*)
+58
+select count(*) from t11;
+count(*)
+8
+select count(*) from t20;
+count(*)
+66
+select count(*) from t21;
+count(*)
+19
+select count(*) from t22;
+count(*)
+2
+select count(*) from t12;
+count(*)
+4
+select count(*) from t13;
+count(*)
+1
+select count(*) from t14;
+count(*)
+4
+select count(*) from t16;
+count(*)
+3
+DROP TABLE IF EXISTS t11;
+SET SESSION BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t11 (song VARCHAR(255));
+LOCK TABLES t11 WRITE;
+SET SESSION BINLOG_FORMAT=ROW;
+INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
+SET SESSION BINLOG_FORMAT=STATEMENT;
+INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
+UNLOCK TABLES;
+SELECT * FROM t11;
+song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
+song Careful With That Axe, Eugene
+USE mysqltest1;
+SELECT * FROM t11;
+song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
+song Careful With That Axe, Eugene
+DROP TABLE IF EXISTS t12;
+SET SESSION BINLOG_FORMAT=MIXED;
+CREATE TABLE t12 (data LONG);
+LOCK TABLES t12 WRITE;
+INSERT INTO t12 VALUES(UUID());
+UNLOCK TABLES;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # drop database if exists mysqltest1
+master-bin.000001 # Query # # create database mysqltest1
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t1 (a varchar(100))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_8_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_7_'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_9_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_7_'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_10_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_11_"
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_13_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_12_'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_14_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_12_'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_15_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_16_"
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_18_")
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_17_'
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_21_"
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_17_'
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_24_"
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t2` (
+ `rpad(UUID(),100,' ')` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t3` (
+ `1` varbinary(36) NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t4` (
+ `a` varchar(100) DEFAULT NULL
+)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t4)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t5)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo()
+begin
+insert into t1 values("work_25_");
+insert into t1 values(concat("for_26_",UUID()));
+insert into t1 select "yesterday_27_";
+end
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2()
+begin
+insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values("work_29_");
+insert into t1 values(concat("for_30_",UUID()));
+set session binlog_format=row; # accepted for stored procs
+insert into t1 values("more work_31_");
+set session binlog_format=mixed;
+end
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned
+begin
+set session binlog_format=row; # rejected for stored funcs
+insert into t1 values("alarm");
+return 100;
+end
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4(x varchar(100))
+begin
+insert into t1 values(concat("work_250_",x));
+insert into t1 select "yesterday_270_";
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'hello')))
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'world')))
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Query # # use `mysqltest1`; drop function foo3
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned
+begin
+insert into t1 values("foo3_32_");
+call foo();
+return 100;
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo4() returns bigint unsigned
+begin
+insert into t2 select foo3();
+return 100;
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo5() returns bigint unsigned
+begin
+insert into t2 select UUID();
+return 100;
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo6(x varchar(100)) returns bigint unsigned
+begin
+insert into t2 select x;
+return 100;
+end
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`foo6`(_latin1'foo6_1_')
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select uuid()
+master-bin.000001 # Query # # use `mysqltest1`; create table t11 (data varchar(255))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t11_bi before insert on t11 for each row
+begin
+set NEW.data = concat(NEW.data,UUID());
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; create table t20 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t21 select * from t2
+master-bin.000001 # Query # # use `mysqltest1`; create table t22 select * from t3
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1,t2,t3
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; create table t2 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; create table t3 (b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+insert into t2 values(null,x);
+return 1;
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_44_")
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; create table t12 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a))
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f`(_latin1'try_45_')
+master-bin.000001 # Query # # use `mysqltest1`; create table t13 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; drop function f
+master-bin.000001 # Query # # use `mysqltest1`; create table t14 (unique (a)) select * from t2
+master-bin.000001 # Query # # use `mysqltest1`; truncate table t2
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f1 (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+return 1;
+end
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic
+begin
+insert into t2 values(null,x);
+return 1;
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; drop function f2
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic
+begin
+declare y int;
+insert into t1 values(null,x);
+set y = (select count(*) from t2);
+return y;
+end
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f1`(_latin1'try_53_')
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f2`(_latin1'try_54_')
+master-bin.000001 # Query # # use `mysqltest1`; drop function f2
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1 for each row
+begin
+insert into t2 values(null,"try_55_");
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; alter table t1 modify a int, drop primary key
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_57_")
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t16` (
+ `UUID()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t16 values("try_66_")
+master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t11
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene')
+master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t12
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t12 (data LONG)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t12)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # drop database if exists mysqltest1
+master-bin.000001 # Query # # create database mysqltest1
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t1 (a varchar(100))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_8_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_7_'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_9_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_7_'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_10_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_11_"
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_13_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_12_'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_14_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_12_'
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_15_")
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_16_"
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_18_")
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_17_'
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_21_"
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select 'emergency_17_'
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_24_"
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t2` (
+ `rpad(UUID(),100,' ')` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t3` (
+ `1` varbinary(36) NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t4` (
+ `a` varchar(100) DEFAULT NULL
+)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t4)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t5)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo()
+begin
+insert into t1 values("work_25_");
+insert into t1 values(concat("for_26_",UUID()));
+insert into t1 select "yesterday_27_";
+end
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2()
+begin
+insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values("work_29_");
+insert into t1 values(concat("for_30_",UUID()));
+set session binlog_format=row; # accepted for stored procs
+insert into t1 values("more work_31_");
+set session binlog_format=mixed;
+end
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned
+begin
+set session binlog_format=row; # rejected for stored funcs
+insert into t1 values("alarm");
+return 100;
+end
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4(x varchar(100))
+begin
+insert into t1 values(concat("work_250_",x));
+insert into t1 select "yesterday_270_";
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'hello')))
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'world')))
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_"
+master-bin.000001 # Query # # use `mysqltest1`; drop function foo3
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned
+begin
+insert into t1 values("foo3_32_");
+call foo();
+return 100;
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo4() returns bigint unsigned
+begin
+insert into t2 select foo3();
+return 100;
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo5() returns bigint unsigned
+begin
+insert into t2 select UUID();
+return 100;
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo6(x varchar(100)) returns bigint unsigned
+begin
+insert into t2 select x;
+return 100;
+end
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`foo6`(_latin1'foo6_1_')
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select uuid()
+master-bin.000001 # Query # # use `mysqltest1`; create table t11 (data varchar(255))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t11_bi before insert on t11 for each row
+begin
+set NEW.data = concat(NEW.data,UUID());
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; create table t20 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t21 select * from t2
+master-bin.000001 # Query # # use `mysqltest1`; create table t22 select * from t3
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1,t2,t3
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; create table t2 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; create table t3 (b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+insert into t2 values(null,x);
+return 1;
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_44_")
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; create table t12 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a))
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f`(_latin1'try_45_')
+master-bin.000001 # Query # # use `mysqltest1`; create table t13 select * from t1
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100))
+master-bin.000001 # Query # # use `mysqltest1`; drop function f
+master-bin.000001 # Query # # use `mysqltest1`; create table t14 (unique (a)) select * from t2
+master-bin.000001 # Query # # use `mysqltest1`; truncate table t2
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f1 (x varchar(100)) returns int deterministic
+begin
+insert into t1 values(null,x);
+return 1;
+end
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic
+begin
+insert into t2 values(null,x);
+return 1;
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; drop function f2
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic
+begin
+declare y int;
+insert into t1 values(null,x);
+set y = (select count(*) from t2);
+return y;
+end
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f1`(_latin1'try_53_')
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f2`(_latin1'try_54_')
+master-bin.000001 # Query # # use `mysqltest1`; drop function f2
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1 for each row
+begin
+insert into t2 values(null,"try_55_");
+end
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; alter table t1 modify a int, drop primary key
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_57_")
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t16` (
+ `UUID()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT ''
+)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; insert into t16 values("try_66_")
+master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t11
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255))
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene')
+master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t12
+master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t12 (data LONG)
+master-bin.000001 # Table_map # # table_id: # (mysqltest1.t12)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+drop database mysqltest1;
+set global binlog_format =@my_binlog_format;
diff --git a/mysql-test/suite/rpl/r/rpl_temp_table.result b/mysql-test/suite/rpl/r/rpl_temp_table.result
new file mode 100644
index 00000000000..e4ca31d8908
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_temp_table.result
@@ -0,0 +1,48 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t2 (n int, PRIMARY KEY(n));
+create temporary table t1 (n int);
+create temporary table t3 (n int not null);
+insert into t1 values(1),(2),(3),(100),(25),(26),(200),(300);
+insert into t2 select * from t1;
+alter table t3 add primary key(n);
+flush logs;
+insert into t3 values (1010);
+insert into t2 select * from t3;
+drop table if exists t3;
+insert into t2 values (1012);
+create temporary table t1 (n int);
+insert into t1 values (4),(5);
+insert into t2 select * from t1;
+insert into t2 values(61);
+select * from t2;
+n
+1
+2
+3
+4
+5
+25
+26
+61
+100
+200
+300
+1010
+1012
+select count(*) from t2;
+count(*)
+13
+select sum(n) from t2;
+sum(n)
+2749
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 0
+drop table if exists t1,t2;
+Warnings:
+Note 1051 Unknown table 't1'
diff --git a/mysql-test/suite/rpl/r/rpl_temporary.result b/mysql-test/suite/rpl/r/rpl_temporary.result
new file mode 100644
index 00000000000..7e7d0cebe1d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_temporary.result
@@ -0,0 +1,106 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+reset master;
+SET @save_select_limit=@@session.sql_select_limit;
+SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+SELECT @@session.sql_select_limit = @save_select_limit;
+@@session.sql_select_limit = @save_select_limit
+1
+SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+SELECT @@session.sql_select_limit = @save_select_limit;
+@@session.sql_select_limit = @save_select_limit
+1
+SET @@session.pseudo_thread_id=100;
+SET @@session.pseudo_thread_id=connection_id();
+SET @@session.sql_log_bin=0;
+SET @@session.sql_log_bin=1;
+drop table if exists t1,t2;
+create table t1(f int);
+create table t2(f int);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+create temporary table t3(f int);
+insert into t3 select * from t1 where f<6;
+create temporary table t3(f int);
+insert into t2 select count(*) from t3;
+insert into t3 select * from t1 where f>=4;
+drop temporary table t3;
+insert into t2 select count(*) from t3;
+drop temporary table t3;
+select * from t2 ORDER BY f;
+f
+5
+7
+drop table t1, t2;
+use test;
+SET TIMESTAMP=1040323920;
+create table t1(f int);
+SET TIMESTAMP=1040323931;
+create table t2(f int);
+SET TIMESTAMP=1040323938;
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SET TIMESTAMP=1040323945;
+SET @@session.pseudo_thread_id=1;
+create temporary table t3(f int);
+SET TIMESTAMP=1040323952;
+SET @@session.pseudo_thread_id=1;
+insert into t3 select * from t1 where f<6;
+SET TIMESTAMP=1040324145;
+SET @@session.pseudo_thread_id=2;
+create temporary table t3(f int);
+SET TIMESTAMP=1040324186;
+SET @@session.pseudo_thread_id=1;
+insert into t2 select count(*) from t3;
+SET TIMESTAMP=1040324200;
+SET @@session.pseudo_thread_id=2;
+insert into t3 select * from t1 where f>=4;
+SET TIMESTAMP=1040324211;
+SET @@session.pseudo_thread_id=1;
+drop temporary table t3;
+SET TIMESTAMP=1040324219;
+SET @@session.pseudo_thread_id=2;
+insert into t2 select count(*) from t3;
+SET TIMESTAMP=1040324224;
+SET @@session.pseudo_thread_id=2;
+drop temporary table t3;
+select * from t2 ORDER BY f;
+f
+5
+7
+drop table t1,t2;
+create temporary table t3 (f int);
+create temporary table t4 (f int);
+create table t5 (f int);
+select id from information_schema.processlist where command='Binlog Dump' into @id;
+kill @id;
+insert into t5 select * from t4;
+select * from t5 /* must be 1 after reconnection */;
+f
+drop temporary table t4;
+drop table t5;
+set @@session.pseudo_thread_id=100;
+create temporary table t101 (id int);
+create temporary table t102 (id int);
+set @@session.pseudo_thread_id=200;
+create temporary table t201 (id int);
+create temporary table `t``201` (id int);
+create temporary table `#sql_not_user_table202` (id int);
+set @@session.pseudo_thread_id=300;
+create temporary table t301 (id int);
+create temporary table t302 (id int);
+create temporary table `#sql_not_user_table303` (id int);
+create table t1(f int);
+insert into t1 values (1);
+select * from t1 /* must be 1 */;
+f
+1
+drop table t1;
+select * from t1;
+a
+1
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_timezone.result b/mysql-test/suite/rpl/r/rpl_timezone.result
new file mode 100644
index 00000000000..47ef16b9d49
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_timezone.result
@@ -0,0 +1,107 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+set @my_time_zone= @@global.time_zone;
+set timestamp=100000000;
+create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n));
+create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n));
+select @@time_zone;
+@@time_zone
+Japan
+select @@time_zone;
+@@time_zone
+Europe/Moscow
+insert into t1 values ('20050101000000', NULL), ('20050611093902',NULL);
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
+SELECT * FROM t1 ORDER BY n;
+t n
+2005-01-01 00:00:00 1
+2005-06-11 09:39:02 2
+2004-01-01 00:00:00 3
+2004-06-11 09:39:02 4
+SELECT * FROM t1 ORDER BY n;
+t n
+2005-01-01 06:00:00 1
+2005-06-11 14:39:02 2
+2004-01-01 06:00:00 3
+2004-06-11 14:39:02 4
+delete from t1;
+set time_zone='Europe/Moscow';
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
+SELECT * FROM t1 ORDER BY n;
+t n
+2004-01-01 00:00:00 5
+2004-06-11 09:39:02 6
+set time_zone='Europe/Moscow';
+SELECT * FROM t1 ORDER BY n;
+t n
+2004-01-01 00:00:00 5
+2004-06-11 09:39:02 6
+delete from t1;
+set time_zone='UTC';
+load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
+Warnings:
+Warning 1265 Data truncated for column 't' at row 1
+Warning 1261 Row 1 doesn't contain data for all columns
+Warning 1265 Data truncated for column 't' at row 2
+Warning 1261 Row 2 doesn't contain data for all columns
+SELECT * FROM t1 ORDER BY n;
+t n
+0000-00-00 00:00:00 7
+0000-00-00 00:00:00 8
+set time_zone='UTC';
+SELECT * FROM t1 ORDER BY n;
+t n
+0000-00-00 00:00:00 7
+0000-00-00 00:00:00 8
+set time_zone='Europe/Moscow';
+set time_zone='Europe/Moscow';
+delete from t1;
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
+set time_zone='MET';
+insert into t2 (select * from t1);
+SELECT * FROM t1 ORDER BY n;
+t n
+2003-12-31 22:00:00 9
+2004-06-11 07:39:02 10
+SELECT * FROM t2 ORDER BY n;
+t n
+2003-12-31 22:00:00 9
+2004-06-11 07:39:02 10
+delete from t2;
+set timestamp=1000072000;
+insert into t2 values (current_timestamp,NULL), (current_date,NULL), (current_time,NULL);
+SELECT * FROM t2 ORDER BY n;
+t n
+2001-09-09 23:46:40 11
+2001-09-09 12
+23:46:40 13
+delete from t2;
+insert into t2 values (from_unixtime(1000000000),NULL),
+(unix_timestamp('2001-09-09 03:46:40'),NULL);
+SELECT * FROM t2 ORDER BY n;
+t n
+2001-09-09 03:46:40 14
+1000000000 15
+SELECT * FROM t2 ORDER BY n;
+t n
+2001-09-09 03:46:40 14
+1000000000 15
+set global time_zone='MET';
+delete from t2;
+set time_zone='UTC';
+insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone),NULL);
+insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'),NULL);
+SELECT * FROM t2 ORDER BY n;
+t n
+2003-12-31 23:00:00 16
+2005-01-01 08:00:00 17
+SELECT * FROM t2 ORDER BY n;
+t n
+2003-12-31 23:00:00 16
+2005-01-01 08:00:00 17
+drop table t1, t2;
+set global time_zone= @my_time_zone;
diff --git a/mysql-test/suite/rpl/r/rpl_trigger.result b/mysql-test/suite/rpl/r/rpl_trigger.result
new file mode 100644
index 00000000000..815a87eede5
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_trigger.result
@@ -0,0 +1,973 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+create table t1 (a int auto_increment, primary key (a), b int, rand_value double not null);
+create table t2 (a int auto_increment, primary key (a), b int);
+create table t3 (a int auto_increment, primary key (a), name varchar(64) not null, old_a int, old_b int, rand_value double not null);
+create trigger t1 before insert on t1 for each row
+begin
+insert into t3 values (NULL, "t1", new.a, new.b, rand());
+end|
+create trigger t2 after insert on t2 for each row
+begin
+insert into t3 values (NULL, "t2", new.a, new.b, rand());
+end|
+insert into t3 values(100,"log",0,0,0);
+SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186;
+insert into t1 values(1,1,rand()),(NULL,2,rand());
+insert into t2 (b) values(last_insert_id());
+insert into t2 values(3,0),(NULL,0);
+insert into t2 values(NULL,0),(500,0);
+select a,b, truncate(rand_value,4) from t1;
+a b truncate(rand_value,4)
+1 1 0.4320
+2 2 0.3055
+select * from t2;
+a b
+1 2
+3 0
+4 0
+5 0
+500 0
+select a,name, old_a, old_b, truncate(rand_value,4) from t3;
+a name old_a old_b truncate(rand_value,4)
+100 log 0 0 0.0000
+101 t1 1 1 0.3203
+102 t1 0 2 0.5666
+103 t2 1 2 0.9164
+104 t2 3 0 0.8826
+105 t2 4 0 0.6635
+106 t2 5 0 0.6699
+107 t2 500 0 0.3593
+
+--- On slave --
+select a,b, truncate(rand_value,4) from t1;
+a b truncate(rand_value,4)
+1 1 0.4320
+2 2 0.3055
+select * from t2;
+a b
+1 2
+3 0
+4 0
+5 0
+500 0
+select a,name, old_a, old_b, truncate(rand_value,4) from t3;
+a name old_a old_b truncate(rand_value,4)
+100 log 0 0 0.0000
+101 t1 1 1 0.3203
+102 t1 0 2 0.5666
+103 t2 1 2 0.9164
+104 t2 3 0 0.8826
+105 t2 4 0 0.6635
+106 t2 5 0 0.6699
+107 t2 500 0 0.3593
+drop table t1,t2,t3;
+select get_lock("bug12480",2);
+get_lock("bug12480",2)
+1
+create table t1 (a datetime,b datetime, c datetime);
+drop function if exists bug12480;
+create function bug12480() returns datetime
+begin
+set @a=get_lock("bug12480",2);
+return now();
+end|
+create trigger t1_first before insert on t1
+for each row begin
+set @a=get_lock("bug12480",2);
+set new.b= now();
+set new.c= bug12480();
+end
+|
+insert into t1 set a = now();
+select a=b && a=c from t1;
+a=b && a=c
+1
+SELECT routine_name, definer
+FROM information_schema.routines;
+routine_name definer
+bug12480 root@localhost
+SELECT trigger_name, definer
+FROM information_schema.triggers;
+trigger_name definer
+t1_first root@localhost
+
+--- On slave --
+SELECT routine_name, definer
+FROM information_schema.routines;
+routine_name definer
+bug12480 root@localhost
+SELECT trigger_name, definer
+FROM information_schema.triggers;
+trigger_name definer
+t1_first root@localhost
+select a=b && a=c from t1;
+a=b && a=c
+1
+test
+1
+truncate table t1;
+drop trigger t1_first;
+insert into t1 values ("2003-03-03","2003-03-03","2003-03-03"),(bug12480(),bug12480(),bug12480()),(now(),now(),now());
+select a=b && a=c from t1;
+a=b && a=c
+1
+1
+1
+drop function bug12480;
+drop table t1;
+create table t1 (i int);
+create table t2 (i int);
+create trigger tr1 before insert on t1 for each row
+begin
+insert into t2 values (1);
+end|
+create database other;
+use other;
+insert into test.t1 values (1);
+use test;
+drop table t1,t2;
+drop database other;
+test case for BUG#13227
+-------------------
+10
+-------------------
+drop table if exists t110;
+drop table if exists t210,t310;
+create table t110 (f1 int) /* 2 replicate */;
+insert into t110 values (-5);
+insert into t110 values (-4);
+insert into t110 values (-3);
+insert into t110 values (-2);
+insert into t110 values (-1);
+select * from t110;
+f1
+-5
+-4
+-3
+-2
+-1
+create trigger trg110 before update on t110 /* slave local */
+for each row
+begin
+DECLARE r integer;
+SELECT f2 INTO r FROM t210 where f1=NEW.f1;
+INSERT INTO t310 values (r);
+end|
+create table t210 (f1 int, f2 int) /* slave local */;
+create table t310 (f3 int) /* slave local */;
+insert into t210 values (5, 5*100);
+insert into t210 values (4, 4*100);
+insert into t210 values (3, 3*100);
+insert into t210 values (2, 2*100);
+insert into t210 values (1, 1*100);
+select * from t210;
+f1 f2
+5 500
+4 400
+3 300
+2 200
+1 100
+UPDATE t110 SET f1=5 where f1=-5;
+SELECT * from t110 /* must be f1 5, 1 - 5 2 - 5 ... -1 */;
+f1
+5
+-4
+-3
+-2
+-1
+SELECT * from t310 /* must be f3 5*100 */;
+f3
+500
+UPDATE t110 SET f1=5 where f1=-5;
+UPDATE t110 SET f1=4 where f1=-4;
+UPDATE t110 SET f1=3 where f1=-3;
+UPDATE t110 SET f1=2 where f1=-2;
+UPDATE t110 SET f1=1 where f1=-1;
+SELECT * from t110 /* must be f1 5 ... 1 */;
+f1
+5
+4
+3
+2
+1
+SELECT * from t310 /* must be f3 5 * 100 ... 100 */;
+f3
+500
+400
+300
+200
+100
+drop trigger trg110;
+drop table t210,t310;
+drop table t110;
+-------------------
+9
+-------------------
+drop table if exists t19;
+drop table if exists t29,t39;
+create table t19 (f1 int) /* 2 replicate */;
+insert into t19 values (-5);
+insert into t19 values (-4);
+insert into t19 values (-3);
+insert into t19 values (-2);
+insert into t19 values (-1);
+select * from t19;
+f1
+-5
+-4
+-3
+-2
+-1
+create trigger trg19 before update on t19 /* slave local */
+for each row
+begin
+DECLARE r integer;
+SELECT f2 INTO r FROM t29 where f1=NEW.f1;
+INSERT INTO t39 values (r);
+end|
+create table t29 (f1 int, f2 int) /* slave local */;
+create table t39 (f3 int) /* slave local */;
+insert into t29 values (5, 5*100);
+insert into t29 values (4, 4*100);
+insert into t29 values (3, 3*100);
+insert into t29 values (2, 2*100);
+insert into t29 values (1, 1*100);
+select * from t29;
+f1 f2
+5 500
+4 400
+3 300
+2 200
+1 100
+UPDATE t19 SET f1=5 where f1=-5;
+SELECT * from t19 /* must be f1 5, 1 - 5 2 - 5 ... -1 */;
+f1
+5
+-4
+-3
+-2
+-1
+SELECT * from t39 /* must be f3 5*100 */;
+f3
+500
+UPDATE t19 SET f1=5 where f1=-5;
+UPDATE t19 SET f1=4 where f1=-4;
+UPDATE t19 SET f1=3 where f1=-3;
+UPDATE t19 SET f1=2 where f1=-2;
+UPDATE t19 SET f1=1 where f1=-1;
+SELECT * from t19 /* must be f1 5 ... 1 */;
+f1
+5
+4
+3
+2
+1
+SELECT * from t39 /* must be f3 5 * 100 ... 100 */;
+f3
+500
+400
+300
+200
+100
+drop trigger trg19;
+drop table t29,t39;
+drop table t19;
+-------------------
+8
+-------------------
+drop table if exists t18;
+drop table if exists t28,t38;
+create table t18 (f1 int) /* 2 replicate */;
+insert into t18 values (-5);
+insert into t18 values (-4);
+insert into t18 values (-3);
+insert into t18 values (-2);
+insert into t18 values (-1);
+select * from t18;
+f1
+-5
+-4
+-3
+-2
+-1
+create trigger trg18 before update on t18 /* slave local */
+for each row
+begin
+DECLARE r integer;
+SELECT f2 INTO r FROM t28 where f1=NEW.f1;
+INSERT INTO t38 values (r);
+end|
+create table t28 (f1 int, f2 int) /* slave local */;
+create table t38 (f3 int) /* slave local */;
+insert into t28 values (5, 5*100);
+insert into t28 values (4, 4*100);
+insert into t28 values (3, 3*100);
+insert into t28 values (2, 2*100);
+insert into t28 values (1, 1*100);
+select * from t28;
+f1 f2
+5 500
+4 400
+3 300
+2 200
+1 100
+UPDATE t18 SET f1=5 where f1=-5;
+SELECT * from t18 /* must be f1 5, 1 - 5 2 - 5 ... -1 */;
+f1
+5
+-4
+-3
+-2
+-1
+SELECT * from t38 /* must be f3 5*100 */;
+f3
+500
+UPDATE t18 SET f1=5 where f1=-5;
+UPDATE t18 SET f1=4 where f1=-4;
+UPDATE t18 SET f1=3 where f1=-3;
+UPDATE t18 SET f1=2 where f1=-2;
+UPDATE t18 SET f1=1 where f1=-1;
+SELECT * from t18 /* must be f1 5 ... 1 */;
+f1
+5
+4
+3
+2
+1
+SELECT * from t38 /* must be f3 5 * 100 ... 100 */;
+f3
+500
+400
+300
+200
+100
+drop trigger trg18;
+drop table t28,t38;
+drop table t18;
+-------------------
+7
+-------------------
+drop table if exists t17;
+drop table if exists t27,t37;
+create table t17 (f1 int) /* 2 replicate */;
+insert into t17 values (-5);
+insert into t17 values (-4);
+insert into t17 values (-3);
+insert into t17 values (-2);
+insert into t17 values (-1);
+select * from t17;
+f1
+-5
+-4
+-3
+-2
+-1
+create trigger trg17 before update on t17 /* slave local */
+for each row
+begin
+DECLARE r integer;
+SELECT f2 INTO r FROM t27 where f1=NEW.f1;
+INSERT INTO t37 values (r);
+end|
+create table t27 (f1 int, f2 int) /* slave local */;
+create table t37 (f3 int) /* slave local */;
+insert into t27 values (5, 5*100);
+insert into t27 values (4, 4*100);
+insert into t27 values (3, 3*100);
+insert into t27 values (2, 2*100);
+insert into t27 values (1, 1*100);
+select * from t27;
+f1 f2
+5 500
+4 400
+3 300
+2 200
+1 100
+UPDATE t17 SET f1=5 where f1=-5;
+SELECT * from t17 /* must be f1 5, 1 - 5 2 - 5 ... -1 */;
+f1
+5
+-4
+-3
+-2
+-1
+SELECT * from t37 /* must be f3 5*100 */;
+f3
+500
+UPDATE t17 SET f1=5 where f1=-5;
+UPDATE t17 SET f1=4 where f1=-4;
+UPDATE t17 SET f1=3 where f1=-3;
+UPDATE t17 SET f1=2 where f1=-2;
+UPDATE t17 SET f1=1 where f1=-1;
+SELECT * from t17 /* must be f1 5 ... 1 */;
+f1
+5
+4
+3
+2
+1
+SELECT * from t37 /* must be f3 5 * 100 ... 100 */;
+f3
+500
+400
+300
+200
+100
+drop trigger trg17;
+drop table t27,t37;
+drop table t17;
+-------------------
+6
+-------------------
+drop table if exists t16;
+drop table if exists t26,t36;
+create table t16 (f1 int) /* 2 replicate */;
+insert into t16 values (-5);
+insert into t16 values (-4);
+insert into t16 values (-3);
+insert into t16 values (-2);
+insert into t16 values (-1);
+select * from t16;
+f1
+-5
+-4
+-3
+-2
+-1
+create trigger trg16 before update on t16 /* slave local */
+for each row
+begin
+DECLARE r integer;
+SELECT f2 INTO r FROM t26 where f1=NEW.f1;
+INSERT INTO t36 values (r);
+end|
+create table t26 (f1 int, f2 int) /* slave local */;
+create table t36 (f3 int) /* slave local */;
+insert into t26 values (5, 5*100);
+insert into t26 values (4, 4*100);
+insert into t26 values (3, 3*100);
+insert into t26 values (2, 2*100);
+insert into t26 values (1, 1*100);
+select * from t26;
+f1 f2
+5 500
+4 400
+3 300
+2 200
+1 100
+UPDATE t16 SET f1=5 where f1=-5;
+SELECT * from t16 /* must be f1 5, 1 - 5 2 - 5 ... -1 */;
+f1
+5
+-4
+-3
+-2
+-1
+SELECT * from t36 /* must be f3 5*100 */;
+f3
+500
+UPDATE t16 SET f1=5 where f1=-5;
+UPDATE t16 SET f1=4 where f1=-4;
+UPDATE t16 SET f1=3 where f1=-3;
+UPDATE t16 SET f1=2 where f1=-2;
+UPDATE t16 SET f1=1 where f1=-1;
+SELECT * from t16 /* must be f1 5 ... 1 */;
+f1
+5
+4
+3
+2
+1
+SELECT * from t36 /* must be f3 5 * 100 ... 100 */;
+f3
+500
+400
+300
+200
+100
+drop trigger trg16;
+drop table t26,t36;
+drop table t16;
+-------------------
+5
+-------------------
+drop table if exists t15;
+drop table if exists t25,t35;
+create table t15 (f1 int) /* 2 replicate */;
+insert into t15 values (-5);
+insert into t15 values (-4);
+insert into t15 values (-3);
+insert into t15 values (-2);
+insert into t15 values (-1);
+select * from t15;
+f1
+-5
+-4
+-3
+-2
+-1
+create trigger trg15 before update on t15 /* slave local */
+for each row
+begin
+DECLARE r integer;
+SELECT f2 INTO r FROM t25 where f1=NEW.f1;
+INSERT INTO t35 values (r);
+end|
+create table t25 (f1 int, f2 int) /* slave local */;
+create table t35 (f3 int) /* slave local */;
+insert into t25 values (5, 5*100);
+insert into t25 values (4, 4*100);
+insert into t25 values (3, 3*100);
+insert into t25 values (2, 2*100);
+insert into t25 values (1, 1*100);
+select * from t25;
+f1 f2
+5 500
+4 400
+3 300
+2 200
+1 100
+UPDATE t15 SET f1=5 where f1=-5;
+SELECT * from t15 /* must be f1 5, 1 - 5 2 - 5 ... -1 */;
+f1
+5
+-4
+-3
+-2
+-1
+SELECT * from t35 /* must be f3 5*100 */;
+f3
+500
+UPDATE t15 SET f1=5 where f1=-5;
+UPDATE t15 SET f1=4 where f1=-4;
+UPDATE t15 SET f1=3 where f1=-3;
+UPDATE t15 SET f1=2 where f1=-2;
+UPDATE t15 SET f1=1 where f1=-1;
+SELECT * from t15 /* must be f1 5 ... 1 */;
+f1
+5
+4
+3
+2
+1
+SELECT * from t35 /* must be f3 5 * 100 ... 100 */;
+f3
+500
+400
+300
+200
+100
+drop trigger trg15;
+drop table t25,t35;
+drop table t15;
+-------------------
+4
+-------------------
+drop table if exists t14;
+drop table if exists t24,t34;
+create table t14 (f1 int) /* 2 replicate */;
+insert into t14 values (-5);
+insert into t14 values (-4);
+insert into t14 values (-3);
+insert into t14 values (-2);
+insert into t14 values (-1);
+select * from t14;
+f1
+-5
+-4
+-3
+-2
+-1
+create trigger trg14 before update on t14 /* slave local */
+for each row
+begin
+DECLARE r integer;
+SELECT f2 INTO r FROM t24 where f1=NEW.f1;
+INSERT INTO t34 values (r);
+end|
+create table t24 (f1 int, f2 int) /* slave local */;
+create table t34 (f3 int) /* slave local */;
+insert into t24 values (5, 5*100);
+insert into t24 values (4, 4*100);
+insert into t24 values (3, 3*100);
+insert into t24 values (2, 2*100);
+insert into t24 values (1, 1*100);
+select * from t24;
+f1 f2
+5 500
+4 400
+3 300
+2 200
+1 100
+UPDATE t14 SET f1=5 where f1=-5;
+SELECT * from t14 /* must be f1 5, 1 - 5 2 - 5 ... -1 */;
+f1
+5
+-4
+-3
+-2
+-1
+SELECT * from t34 /* must be f3 5*100 */;
+f3
+500
+UPDATE t14 SET f1=5 where f1=-5;
+UPDATE t14 SET f1=4 where f1=-4;
+UPDATE t14 SET f1=3 where f1=-3;
+UPDATE t14 SET f1=2 where f1=-2;
+UPDATE t14 SET f1=1 where f1=-1;
+SELECT * from t14 /* must be f1 5 ... 1 */;
+f1
+5
+4
+3
+2
+1
+SELECT * from t34 /* must be f3 5 * 100 ... 100 */;
+f3
+500
+400
+300
+200
+100
+drop trigger trg14;
+drop table t24,t34;
+drop table t14;
+-------------------
+3
+-------------------
+drop table if exists t13;
+drop table if exists t23,t33;
+create table t13 (f1 int) /* 2 replicate */;
+insert into t13 values (-5);
+insert into t13 values (-4);
+insert into t13 values (-3);
+insert into t13 values (-2);
+insert into t13 values (-1);
+select * from t13;
+f1
+-5
+-4
+-3
+-2
+-1
+create trigger trg13 before update on t13 /* slave local */
+for each row
+begin
+DECLARE r integer;
+SELECT f2 INTO r FROM t23 where f1=NEW.f1;
+INSERT INTO t33 values (r);
+end|
+create table t23 (f1 int, f2 int) /* slave local */;
+create table t33 (f3 int) /* slave local */;
+insert into t23 values (5, 5*100);
+insert into t23 values (4, 4*100);
+insert into t23 values (3, 3*100);
+insert into t23 values (2, 2*100);
+insert into t23 values (1, 1*100);
+select * from t23;
+f1 f2
+5 500
+4 400
+3 300
+2 200
+1 100
+UPDATE t13 SET f1=5 where f1=-5;
+SELECT * from t13 /* must be f1 5, 1 - 5 2 - 5 ... -1 */;
+f1
+5
+-4
+-3
+-2
+-1
+SELECT * from t33 /* must be f3 5*100 */;
+f3
+500
+UPDATE t13 SET f1=5 where f1=-5;
+UPDATE t13 SET f1=4 where f1=-4;
+UPDATE t13 SET f1=3 where f1=-3;
+UPDATE t13 SET f1=2 where f1=-2;
+UPDATE t13 SET f1=1 where f1=-1;
+SELECT * from t13 /* must be f1 5 ... 1 */;
+f1
+5
+4
+3
+2
+1
+SELECT * from t33 /* must be f3 5 * 100 ... 100 */;
+f3
+500
+400
+300
+200
+100
+drop trigger trg13;
+drop table t23,t33;
+drop table t13;
+-------------------
+2
+-------------------
+drop table if exists t12;
+drop table if exists t22,t32;
+create table t12 (f1 int) /* 2 replicate */;
+insert into t12 values (-5);
+insert into t12 values (-4);
+insert into t12 values (-3);
+insert into t12 values (-2);
+insert into t12 values (-1);
+select * from t12;
+f1
+-5
+-4
+-3
+-2
+-1
+create trigger trg12 before update on t12 /* slave local */
+for each row
+begin
+DECLARE r integer;
+SELECT f2 INTO r FROM t22 where f1=NEW.f1;
+INSERT INTO t32 values (r);
+end|
+create table t22 (f1 int, f2 int) /* slave local */;
+create table t32 (f3 int) /* slave local */;
+insert into t22 values (5, 5*100);
+insert into t22 values (4, 4*100);
+insert into t22 values (3, 3*100);
+insert into t22 values (2, 2*100);
+insert into t22 values (1, 1*100);
+select * from t22;
+f1 f2
+5 500
+4 400
+3 300
+2 200
+1 100
+UPDATE t12 SET f1=5 where f1=-5;
+SELECT * from t12 /* must be f1 5, 1 - 5 2 - 5 ... -1 */;
+f1
+5
+-4
+-3
+-2
+-1
+SELECT * from t32 /* must be f3 5*100 */;
+f3
+500
+UPDATE t12 SET f1=5 where f1=-5;
+UPDATE t12 SET f1=4 where f1=-4;
+UPDATE t12 SET f1=3 where f1=-3;
+UPDATE t12 SET f1=2 where f1=-2;
+UPDATE t12 SET f1=1 where f1=-1;
+SELECT * from t12 /* must be f1 5 ... 1 */;
+f1
+5
+4
+3
+2
+1
+SELECT * from t32 /* must be f3 5 * 100 ... 100 */;
+f3
+500
+400
+300
+200
+100
+drop trigger trg12;
+drop table t22,t32;
+drop table t12;
+-------------------
+1
+-------------------
+drop table if exists t11;
+drop table if exists t21,t31;
+create table t11 (f1 int) /* 2 replicate */;
+insert into t11 values (-5);
+insert into t11 values (-4);
+insert into t11 values (-3);
+insert into t11 values (-2);
+insert into t11 values (-1);
+select * from t11;
+f1
+-5
+-4
+-3
+-2
+-1
+create trigger trg11 before update on t11 /* slave local */
+for each row
+begin
+DECLARE r integer;
+SELECT f2 INTO r FROM t21 where f1=NEW.f1;
+INSERT INTO t31 values (r);
+end|
+create table t21 (f1 int, f2 int) /* slave local */;
+create table t31 (f3 int) /* slave local */;
+insert into t21 values (5, 5*100);
+insert into t21 values (4, 4*100);
+insert into t21 values (3, 3*100);
+insert into t21 values (2, 2*100);
+insert into t21 values (1, 1*100);
+select * from t21;
+f1 f2
+5 500
+4 400
+3 300
+2 200
+1 100
+UPDATE t11 SET f1=5 where f1=-5;
+SELECT * from t11 /* must be f1 5, 1 - 5 2 - 5 ... -1 */;
+f1
+5
+-4
+-3
+-2
+-1
+SELECT * from t31 /* must be f3 5*100 */;
+f3
+500
+UPDATE t11 SET f1=5 where f1=-5;
+UPDATE t11 SET f1=4 where f1=-4;
+UPDATE t11 SET f1=3 where f1=-3;
+UPDATE t11 SET f1=2 where f1=-2;
+UPDATE t11 SET f1=1 where f1=-1;
+SELECT * from t11 /* must be f1 5 ... 1 */;
+f1
+5
+4
+3
+2
+1
+SELECT * from t31 /* must be f3 5 * 100 ... 100 */;
+f3
+500
+400
+300
+200
+100
+drop trigger trg11;
+drop table t21,t31;
+drop table t11;
+STOP SLAVE;
+FLUSH LOGS;
+RESET SLAVE;
+START SLAVE;
+SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0;
+MASTER_POS_WAIT('master-bin.000001', 513) >= 0
+1
+SHOW TABLES LIKE 't_';
+Tables_in_test (t_)
+t1
+t2
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer
+trg1 INSERT t1 INSERT INTO t2 VALUES(CURRENT_USER()) AFTER NULL
+SELECT * FROM t1;
+c
+1
+SELECT * FROM t2;
+s
+@
+INSERT INTO t1 VALUES(2);
+SELECT * FROM t1;
+c
+1
+2
+SELECT * FROM t2;
+s
+@
+root@localhost
+DROP TRIGGER trg1;
+Warnings:
+Warning 1454 No definer attribute for trigger 'test'.'trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
+DROP TABLE t1;
+DROP TABLE t2;
+STOP SLAVE;
+RESET SLAVE;
+SHOW TABLES LIKE 't_';
+Tables_in_test (t_)
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer
+RESET MASTER;
+START SLAVE;
+
+---> Test for BUG#20438
+
+---> Preparing environment...
+---> connection: master
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+
+---> Synchronizing slave with master...
+
+---> connection: master
+
+---> Creating objects...
+CREATE TABLE t1(c INT);
+CREATE TABLE t2(c INT);
+/*!50003 CREATE TRIGGER t1_bi BEFORE INSERT ON t1
+FOR EACH ROW
+INSERT INTO t2 VALUES(NEW.c * 10) */;
+
+---> Inserting value...
+INSERT INTO t1 VALUES(1);
+
+---> Checking on master...
+SELECT * FROM t1;
+c
+1
+SELECT * FROM t2;
+c
+10
+
+---> Synchronizing slave with master...
+---> connection: master
+
+---> Checking on slave...
+SELECT * FROM t1;
+c
+1
+SELECT * FROM t2;
+c
+10
+
+---> connection: master
+
+---> Cleaning up...
+DROP TABLE t1;
+DROP TABLE t2;
+drop table if exists t1;
+create table t1(a int, b varchar(50));
+drop trigger not_a_trigger;
+ERROR HY000: Trigger does not exist
+drop trigger if exists not_a_trigger;
+Warnings:
+Note 1360 Trigger does not exist
+create trigger t1_bi before insert on t1
+for each row set NEW.b := "In trigger t1_bi";
+insert into t1 values (1, "a");
+drop trigger if exists t1_bi;
+insert into t1 values (2, "b");
+drop trigger if exists t1_bi;
+Warnings:
+Note 1360 Trigger does not exist
+insert into t1 values (3, "c");
+select * from t1;
+a b
+1 In trigger t1_bi
+2 b
+3 c
+select * from t1;
+a b
+1 In trigger t1_bi
+2 b
+3 c
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_trunc_temp.result b/mysql-test/suite/rpl/r/rpl_trunc_temp.result
new file mode 100644
index 00000000000..44624a38875
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_trunc_temp.result
@@ -0,0 +1,22 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create temporary table t1 (n int);
+insert into t1 values(1);
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 1
+delete from t1;
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 1
+truncate t1;
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 1
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 0
diff --git a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result
new file mode 100644
index 00000000000..c7ef28ba56b
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result
@@ -0,0 +1,196 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Query # # use `test`; DELETE FROM t1
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Query # # use `test`; DELETE FROM t1
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+3 3
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
diff --git a/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result
new file mode 100644
index 00000000000..7ce48c2e983
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result
@@ -0,0 +1,208 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET GLOBAL BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a b
+**** On Slave ****
+SELECT * FROM t1;
+a b
+3 3
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
diff --git a/mysql-test/suite/rpl/r/rpl_truncate_7ndb_2.result b/mysql-test/suite/rpl/r/rpl_truncate_7ndb_2.result
new file mode 100644
index 00000000000..ca323e193fa
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_truncate_7ndb_2.result
@@ -0,0 +1,91 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Slave ****
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 219 Query 1 283 BEGIN
+master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 323 Table_map 1 93 table_id: # (mysql.apply_status)
+master-bin.000001 376 Write_rows 1 135 table_id: #
+master-bin.000001 418 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 465 Query 1 530 COMMIT
+master-bin.000001 530 Query 1 610 use `test`; TRUNCATE TABLE t1
+master-bin.000001 610 Query 1 686 use `test`; DROP TABLE t1
+**** On Master ****
+CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1 ORDER BY a,b;
+a b
+1 1
+2 2
+3 3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1 ORDER BY a,b;
+a b
+**** On Slave ****
+SELECT * FROM t1 ORDER BY a,b;
+a b
+3 3
+**** On Master ****
+DROP TABLE t1;
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 219 Query 1 283 BEGIN
+master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 323 Table_map 1 93 table_id: # (mysql.apply_status)
+master-bin.000001 376 Write_rows 1 135 table_id: #
+master-bin.000001 418 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 465 Query 1 530 COMMIT
+master-bin.000001 530 Query 1 610 use `test`; TRUNCATE TABLE t1
+master-bin.000001 610 Query 1 686 use `test`; DROP TABLE t1
+master-bin.000001 686 Query 1 803 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 803 Query 1 867 BEGIN
+master-bin.000001 867 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 907 Table_map 1 93 table_id: # (mysql.apply_status)
+master-bin.000001 960 Write_rows 1 135 table_id: #
+master-bin.000001 1002 Write_rows 1 182 table_id: # flags: STMT_END_F
+master-bin.000001 1049 Query 1 1114 COMMIT
+master-bin.000001 1114 Query 1 1178 BEGIN
+master-bin.000001 1178 Table_map 1 40 table_id: # (test.t1)
+master-bin.000001 1218 Table_map 1 93 table_id: # (mysql.apply_status)
+master-bin.000001 1271 Write_rows 1 135 table_id: #
+master-bin.000001 1313 Delete_rows 1 174 table_id: # flags: STMT_END_F
+master-bin.000001 1352 Query 1 1417 COMMIT
+master-bin.000001 1417 Query 1 1493 use `test`; DROP TABLE t1
diff --git a/mysql-test/suite/rpl/r/rpl_udf.result b/mysql-test/suite/rpl/r/rpl_udf.result
new file mode 100644
index 00000000000..6587632bca0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_udf.result
@@ -0,0 +1,310 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+set binlog_format=row;
+drop table if exists t1;
+"*** Test 1) Test UDFs via loadable libraries ***
+"Running on the master"
+CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
+affected rows: 0
+CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+affected rows: 0
+CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
+SELECT * FROM mysql.func;
+name ret dl type
+myfunc_double 1 UDF_LIB function
+myfunc_int 2 UDF_LIB function
+affected rows: 2
+"Running on the slave"
+SELECT * FROM mysql.func;
+name ret dl type
+myfunc_double 1 UDF_LIB function
+myfunc_int 2 UDF_LIB function
+affected rows: 2
+"Running on the master"
+CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
+affected rows: 0
+INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
+affected rows: 1
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 48.5
+10 48.75
+100 48.6
+200 49
+affected rows: 4
+"Running on the slave"
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 48.5
+10 48.75
+100 48.6
+200 49
+affected rows: 4
+SELECT myfunc_int(25);
+myfunc_int(25)
+25
+affected rows: 1
+SELECT myfunc_double(75.00);
+myfunc_double(75.00)
+50.00
+affected rows: 1
+"Running on the master"
+DROP FUNCTION myfunc_double;
+affected rows: 0
+DROP FUNCTION myfunc_int;
+affected rows: 0
+SELECT * FROM mysql.func;
+name ret dl type
+affected rows: 0
+"Running on the slave"
+SELECT * FROM mysql.func;
+name ret dl type
+affected rows: 0
+"Running on the master"
+DROP TABLE t1;
+affected rows: 0
+"*** Test 2) Test UDFs with SQL body ***
+"Running on the master"
+CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
+affected rows: 0
+CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
+test myfuncsql_int FUNCTION i INT RETURN i
+affected rows: 2
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
+test myfuncsql_int FUNCTION i INT RETURN i
+affected rows: 2
+"Running on the master"
+CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
+affected rows: 0
+INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00));
+affected rows: 1
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 1000
+10 10
+100 100
+200 50
+affected rows: 4
+"Running on the slave"
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 1000
+10 10
+100 100
+200 50
+affected rows: 4
+"Running on the master"
+ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
+affected rows: 0
+ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
+test myfuncsql_int FUNCTION i INT RETURN i This was altered.
+affected rows: 2
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
+test myfuncsql_int FUNCTION i INT RETURN i This was altered.
+affected rows: 2
+SELECT myfuncsql_int(25);
+myfuncsql_int(25)
+25
+affected rows: 1
+SELECT myfuncsql_double(75.00);
+myfuncsql_double(75.00)
+150
+affected rows: 1
+"Running on the master"
+DROP FUNCTION myfuncsql_double;
+affected rows: 0
+DROP FUNCTION myfuncsql_int;
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+affected rows: 0
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+affected rows: 0
+"Running on the master"
+DROP TABLE t1;
+affected rows: 0
+set binlog_format=statement;
+drop table if exists t1;
+"*** Test 1) Test UDFs via loadable libraries ***
+"Running on the master"
+CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
+affected rows: 0
+CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+affected rows: 0
+CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
+SELECT * FROM mysql.func;
+name ret dl type
+myfunc_int 2 UDF_LIB function
+myfunc_double 1 UDF_LIB function
+affected rows: 2
+"Running on the slave"
+SELECT * FROM mysql.func;
+name ret dl type
+myfunc_int 2 UDF_LIB function
+myfunc_double 1 UDF_LIB function
+affected rows: 2
+"Running on the master"
+CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
+affected rows: 0
+INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
+affected rows: 1
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 48.5
+10 48.75
+100 48.6
+200 49
+affected rows: 4
+"Running on the slave"
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 48.5
+10 48.75
+100 48.6
+200 49
+affected rows: 4
+SELECT myfunc_int(25);
+myfunc_int(25)
+25
+affected rows: 1
+SELECT myfunc_double(75.00);
+myfunc_double(75.00)
+50.00
+affected rows: 1
+"Running on the master"
+DROP FUNCTION myfunc_double;
+affected rows: 0
+DROP FUNCTION myfunc_int;
+affected rows: 0
+SELECT * FROM mysql.func;
+name ret dl type
+affected rows: 0
+"Running on the slave"
+SELECT * FROM mysql.func;
+name ret dl type
+affected rows: 0
+"Running on the master"
+DROP TABLE t1;
+affected rows: 0
+"*** Test 2) Test UDFs with SQL body ***
+"Running on the master"
+CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
+affected rows: 0
+CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
+test myfuncsql_int FUNCTION i INT RETURN i
+affected rows: 2
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00
+test myfuncsql_int FUNCTION i INT RETURN i
+affected rows: 2
+"Running on the master"
+CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
+affected rows: 0
+INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00));
+affected rows: 1
+INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00));
+affected rows: 1
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 1000
+10 10
+100 100
+200 50
+affected rows: 4
+"Running on the slave"
+SELECT * FROM t1 ORDER BY sum;
+sum price
+1 1000
+10 10
+100 100
+200 50
+affected rows: 4
+"Running on the master"
+ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
+affected rows: 0
+ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
+test myfuncsql_int FUNCTION i INT RETURN i This was altered.
+affected rows: 2
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered.
+test myfuncsql_int FUNCTION i INT RETURN i This was altered.
+affected rows: 2
+SELECT myfuncsql_int(25);
+myfuncsql_int(25)
+25
+affected rows: 1
+SELECT myfuncsql_double(75.00);
+myfuncsql_double(75.00)
+150
+affected rows: 1
+"Running on the master"
+DROP FUNCTION myfuncsql_double;
+affected rows: 0
+DROP FUNCTION myfuncsql_int;
+affected rows: 0
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+affected rows: 0
+"Running on the slave"
+SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
+db name type param_list body comment
+affected rows: 0
+"Running on the master"
+DROP TABLE t1;
+affected rows: 0
diff --git a/mysql-test/suite/rpl/r/rpl_user_variables.result b/mysql-test/suite/rpl/r/rpl_user_variables.result
new file mode 100644
index 00000000000..d3363df3b58
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_user_variables.result
@@ -0,0 +1,266 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+reset master;
+create table t1(n char(30));
+set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
+set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
+set @n1:=null;
+set @s2:='', @s3:='abc\'def', @s4:= 'abc\\def', @s5:= 'abc''def';
+insert into t1 values (@i1), (@i2), (@i3), (@i4);
+insert into t1 values (@r1), (@r2);
+insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5);
+insert into t1 values (@n1);
+insert into t1 values (@n2);
+insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
+insert into t1 values (@a+(@b:=@a+1));
+set @q:='abc';
+insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
+set @a:=5;
+insert into t1 values (@a),(@a);
+select * from t1 where n = '<nonexistant>';
+n
+insert into t1 values (@a),(@a),(@a*5);
+SELECT * FROM t1 ORDER BY n;
+n
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-1
+-12.5
+-12345678901234
+0
+0
+1
+12.5
+12345678901234
+2
+5
+5
+5
+abc
+abc'def
+abc'def
+abcn1
+abcn1n2
+abc\def
+This is a test
+SELECT * FROM t1 ORDER BY n;
+n
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-1
+-12.5
+-12345678901234
+0
+0
+1
+12.5
+12345678901234
+2
+5
+5
+5
+abc
+abc'def
+abc'def
+abcn1
+abcn1n2
+abc\def
+This is a test
+insert into t1 select * FROM (select @var1 union select @var2) AS t2;
+drop table t1;
+End of 4.1 tests.
+DROP TABLE IF EXISTS t20;
+DROP TABLE IF EXISTS t21;
+DROP PROCEDURE IF EXISTS test.insert;
+CREATE TABLE t20 (a VARCHAR(20));
+CREATE TABLE t21 (a VARCHAR(20));
+CREATE PROCEDURE test.insert()
+BEGIN
+IF (@VAR)
+THEN
+INSERT INTO test.t20 VALUES ('SP_TRUE');
+ELSE
+INSERT INTO test.t20 VALUES ('SP_FALSE');
+END IF;
+END|
+CREATE TRIGGER test.insert_bi BEFORE INSERT
+ON test.t20 FOR EACH ROW
+BEGIN
+IF (@VAR)
+THEN
+INSERT INTO test.t21 VALUES ('TRIG_TRUE');
+ELSE
+INSERT INTO test.t21 VALUES ('TRIG_FALSE');
+END IF;
+END|
+SET @VAR=0;
+CALL test.insert();
+SET @VAR=1;
+CALL test.insert();
+On master: Check the tables for correct data
+SELECT * FROM t20;
+a
+SP_FALSE
+SP_TRUE
+SELECT * FROM t21;
+a
+TRIG_FALSE
+TRIG_TRUE
+On slave: Check the tables for correct data and it matches master
+SELECT * FROM t20;
+a
+SP_FALSE
+SP_TRUE
+SELECT * FROM t21;
+a
+TRIG_FALSE
+TRIG_TRUE
+DROP TABLE t20;
+DROP TABLE t21;
+DROP PROCEDURE test.insert;
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS test.square;
+CREATE TABLE t1 (i INT);
+CREATE FUNCTION test.square() RETURNS INTEGER DETERMINISTIC RETURN
+(@var * @var);
+SET @var = 1;
+INSERT INTO t1 VALUES (square());
+SET @var = 2;
+INSERT INTO t1 VALUES (square());
+SET @var = 3;
+INSERT INTO t1 VALUES (square());
+SET @var = 4;
+INSERT INTO t1 VALUES (square());
+SET @var = 5;
+INSERT INTO t1 VALUES (square());
+On master: Retrieve the values from the table
+SELECT * FROM t1;
+i
+1
+4
+9
+16
+25
+On slave: Retrieve the values from the table and verify they are the same as on master
+SELECT * FROM t1;
+i
+1
+4
+9
+16
+25
+DROP TABLE t1;
+DROP FUNCTION test.square;
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+CREATE TABLE t1(a int);
+CREATE FUNCTION f1() returns int deterministic BEGIN
+return @a;
+END |
+CREATE FUNCTION f2() returns int deterministic BEGIN
+IF (@b > 0) then
+SET @c = (@a + @b);
+else
+SET @c = (@a - 1);
+END if;
+return @c;
+END |
+SET @a=500;
+INSERT INTO t1 values(f1());
+SET @b = 125;
+SET @c = 1;
+INSERT INTO t1 values(f2());
+On master: Retrieve the values from the table
+SELECT * from t1;
+a
+500
+625
+On slave: Check the tables for correct data and it matches master
+SELECT * from t1;
+a
+500
+625
+DROP TABLE t1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (i int);
+CREATE TABLE t2 (k int);
+CREATE trigger t1_bi before INSERT on t1 for each row BEGIN
+INSERT INTO t2 values (@a);
+SET @a:=42;
+INSERT INTO t2 values (@a);
+END |
+SET @a:=100;
+INSERT INTO t1 values (5);
+On master: Check to see that data was inserted correctly in both tables
+SELECT * from t1;
+i
+5
+SELECT * from t2;
+k
+100
+42
+On slave: Check the tables for correct data and it matches master
+SELECT * from t1;
+i
+5
+SELECT * from t2;
+k
+100
+42
+drop table t1, t2;
+create table t1(a int, b int);
+prepare s1 from 'insert into t1 values (@x:=@x+1, ?)';
+set @x=1;
+execute s1 using @x;
+select * from t1;
+a b
+2 1
+select * from t1;
+a b
+2 1
+drop table t1;
+End of 5.0 tests.
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+CREATE TABLE t1 (i INT);
+CREATE FUNCTION f1() RETURNS INT RETURN @a;
+CREATE
+FUNCTION f2() RETURNS INT BEGIN
+INSERT INTO t1 VALUES (10 + @a);
+RETURN 0;
+END|
+SET @a:=123;
+SELECT f1(), f2();
+f1() f2()
+123 0
+On master: Check to see that data was inserted correctly
+INSERT INTO t1 VALUES(f1());
+SELECT * FROM t1;
+i
+133
+123
+On slave: Check the table for correct data and it matches master
+SELECT * FROM t1;
+i
+133
+123
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP TABLE t1;
+stop slave;
diff --git a/mysql-test/suite/rpl/r/rpl_variables.result b/mysql-test/suite/rpl/r/rpl_variables.result
new file mode 100644
index 00000000000..605a48859a0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_variables.result
@@ -0,0 +1,19 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+set @my_slave_net_timeout =@@global.slave_net_timeout;
+set global slave_net_timeout=100;
+set global sql_slave_skip_counter=100;
+show variables like 'slave_compressed_protocol';
+Variable_name Value
+slave_compressed_protocol OFF
+show variables like 'slave_load_tmpdir';
+Variable_name Value
+slave_load_tmpdir SLAVE_LOAD_TMPDIR
+show variables like 'slave_skip_errors';
+Variable_name Value
+slave_skip_errors 3,100,137,643,1752
+set global slave_net_timeout=default;
diff --git a/mysql-test/suite/rpl/r/rpl_view.result b/mysql-test/suite/rpl/r/rpl_view.result
new file mode 100644
index 00000000000..0d862a2a912
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_view.result
@@ -0,0 +1,104 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop table if exists t1,v1;
+drop view if exists t1,v1;
+reset master;
+create table t1 (a int);
+insert into t1 values (1);
+create view v1 as select a from t1;
+insert into v1 values (2);
+select * from v1 order by a;
+a
+1
+2
+select * from v1 order by a;
+a
+1
+2
+update v1 set a=3 where a=1;
+select * from v1 order by a;
+a
+2
+3
+select * from v1 order by a;
+a
+2
+3
+delete from v1 where a=2;
+select * from v1 order by a;
+a
+3
+select * from v1 order by a;
+a
+3
+alter view v1 as select a as b from t1;
+select * from v1 order by 1;
+b
+3
+drop view v1;
+select * from v1 order by a;
+ERROR 42S02: Table 'test.v1' doesn't exist
+drop table t1;
+
+---> Test for BUG#20438
+
+---> Preparing environment...
+---> connection: master
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+
+---> Synchronizing slave with master...
+
+---> connection: master
+
+---> Creating objects...
+CREATE TABLE t1(c INT);
+/*!50003 CREATE VIEW v1 AS SELECT * FROM t1 */;
+
+---> Inserting value...
+INSERT INTO t1 VALUES(1);
+
+---> Checking on master...
+SELECT * FROM t1;
+c
+1
+
+---> Synchronizing slave with master...
+---> connection: master
+
+---> Checking on slave...
+SELECT * FROM t1;
+c
+1
+
+---> connection: master
+
+---> Cleaning up...
+DROP VIEW v1;
+DROP TABLE t1;
+create table t1(a int, b int);
+insert into t1 values (1, 1), (1, 2), (1, 3);
+create view v1(a, b) as select a, sum(b) from t1 group by a;
+explain v1;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+b decimal(32,0) YES NULL
+show create table v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,sum(`t1`.`b`) AS `b` from `t1` group by `t1`.`a`
+select * from v1;
+a b
+1 6
+drop table t1;
+drop view v1;
+CREATE TABLE t1(a INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v1 AS SELECT * FROM t1;
+ERROR 42S01: Table 'v1' already exists
+DROP VIEW v1;
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def
new file mode 100644
index 00000000000..180a700acaf
--- /dev/null
+++ b/mysql-test/suite/rpl/t/disabled.def
@@ -0,0 +1,15 @@
+##############################################################################
+#
+# List the test cases that are to be disabled temporarily.
+#
+# Separate the test case name and the comment with ':'.
+#
+# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
+#
+# Do not use any TAB characters for whitespace.
+#
+##############################################################################
+
+rpl_ddl : BUG#26418 2007-03-01 mleich Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master
+rpl_innodb_mixed_ddl : Bug #29363 rpl.rpl_innodb_mixed_* test failures
+rpl_innodb_mixed_dml : Bug #29363 rpl.rpl_innodb_mixed_* test failures
diff --git a/mysql-test/suite/rpl/t/rpl000010-slave.opt b/mysql-test/suite/rpl/t/rpl000010-slave.opt
new file mode 100644
index 00000000000..0dbfb311e33
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl000010-slave.opt
@@ -0,0 +1 @@
+--disconnect-slave-event-count=2
diff --git a/mysql-test/suite/rpl/t/rpl000010.test b/mysql-test/suite/rpl/t/rpl000010.test
new file mode 100644
index 00000000000..261b9148774
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl000010.test
@@ -0,0 +1,19 @@
+# This tests the offset off by 22 mystery bug
+# Must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1
+
+source include/master-slave.inc;
+
+create table t1 (n int not null auto_increment primary key);
+insert into t1 values(NULL);
+insert into t1 values(2);
+save_master_pos;
+connection slave;
+sync_with_master;
+select n from t1;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl000011.test b/mysql-test/suite/rpl/t/rpl000011.test
new file mode 100644
index 00000000000..32f6227f7c5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl000011.test
@@ -0,0 +1,17 @@
+source include/master-slave.inc;
+
+create table t1 (n int);
+insert into t1 values(1);
+sync_slave_with_master;
+stop slave;
+start slave;
+connection master;
+insert into t1 values(2);
+#let slave catch up
+sync_slave_with_master;
+select * from t1;
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl000013.test b/mysql-test/suite/rpl/t/rpl000013.test
new file mode 100644
index 00000000000..69a102e84ce
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl000013.test
@@ -0,0 +1,53 @@
+# This test is to verify that DROP TEMPORARY TABLE
+# is automatically binlogged and sent to slave
+# when a temp table is dropped by disconnection
+# of a master's conection.
+# So it does not apply to row-based, where we neither need
+# nor do this automatic binlogging. And if we run this test
+# in row-based, it hangs waiting for an offset which is never
+# reached (the "sync_with_master 1"), logically.
+
+--source include/have_binlog_format_mixed_or_statement.inc
+source include/master-slave.inc;
+save_master_pos;
+connection slave;
+sync_with_master;
+connection master;
+
+create table t2(n int);
+create temporary table t1 (n int);
+insert into t1 values(1),(2),(3);
+insert into t2 select * from t1;
+connection master1;
+create temporary table t1 (n int);
+insert into t1 values (4),(5);
+insert into t2 select * from t1 as t10;
+save_master_pos;
+disconnect master;
+connection slave;
+#add 1 to catch drop table
+sync_with_master 1;
+connection master1;
+insert into t2 values(6);
+save_master_pos;
+disconnect master1;
+connection slave;
+# same trick to go one more event
+sync_with_master 1;
+select * from t2;
+show status like 'Slave_open_temp_tables';
+#
+# Clean up
+#
+connect (master2,localhost,root,,);
+connection master2;
+
+# We will get a warning for t1 as this is a temporary table that doesn't
+# exist in this connection.
+
+drop table if exists t1,t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.opt b/mysql-test/suite/rpl/t/rpl000017-slave.opt
new file mode 100644
index 00000000000..58a964c90d0
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl000017-slave.opt
@@ -0,0 +1 @@
+--skip-slave-start
diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.sh b/mysql-test/suite/rpl/t/rpl000017-slave.sh
new file mode 100755
index 00000000000..17188aba0db
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl000017-slave.sh
@@ -0,0 +1,12 @@
+rm -f $MYSQLTEST_VARDIR/log/*relay*
+rm -f $MYSQLTEST_VARDIR/slave-data/relay-log.info
+cat > $MYSQLTEST_VARDIR/slave-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
new file mode 100644
index 00000000000..2ba321cd8c3
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl000017.test
@@ -0,0 +1,22 @@
+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/rpl000018-master.opt b/mysql-test/suite/rpl/t/rpl000018-master.opt
new file mode 100644
index 00000000000..ad2c6a647b5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl000018-master.opt
@@ -0,0 +1 @@
+-O max_binlog_size=4096
diff --git a/mysql-test/suite/rpl/t/rpl000018-slave.opt b/mysql-test/suite/rpl/t/rpl000018-slave.opt
new file mode 100644
index 00000000000..e854f0d0bb2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl000018-slave.opt
@@ -0,0 +1 @@
+--skip-slave-start --abort-slave-event-count=1
diff --git a/mysql-test/suite/rpl/t/rpl_000015-slave.sh b/mysql-test/suite/rpl/t/rpl_000015-slave.sh
new file mode 100755
index 00000000000..7deeca3d2d6
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_000015-slave.sh
@@ -0,0 +1 @@
+rm -f $MYSQLTEST_VARDIR/slave-data/master.info
diff --git a/mysql-test/suite/rpl/t/rpl_000015.slave-mi b/mysql-test/suite/rpl/t/rpl_000015.slave-mi
new file mode 100644
index 00000000000..28bc753dd56
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_000015.slave-mi
@@ -0,0 +1 @@
+--server-id=22 --master-connect-retry=7
diff --git a/mysql-test/suite/rpl/t/rpl_000015.test b/mysql-test/suite/rpl/t/rpl_000015.test
new file mode 100644
index 00000000000..9daa765084b
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_000015.test
@@ -0,0 +1,48 @@
+-- source include/have_log_bin.inc
+#####################
+# Change Author: JBM
+# Change Date: 2006-01-17
+# Change: added order by in select
+#####################
+
+connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
+connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK);
+connection master;
+reset master;
+show master status;
+save_master_pos;
+connection slave;
+reset slave;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+show slave status;
+
+change master to master_host='127.0.0.1';
+# The following needs to be cleaned up when change master is fixed
+--replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+show slave status;
+--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;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+show slave status;
+start slave;
+sync_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+show slave status;
+connection master;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (n int, PRIMARY KEY(n));
+insert into t1 values (10),(45),(90);
+sync_slave_with_master;
+connection slave;
+SELECT * FROM t1 ORDER BY n;
+connection master;
+SELECT * FROM t1 ORDER BY n;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_EE_err.test b/mysql-test/suite/rpl/t/rpl_EE_err.test
new file mode 100644
index 00000000000..6d064ae3197
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_EE_err.test
@@ -0,0 +1,7 @@
+########################################################
+# 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
new file mode 100644
index 00000000000..bace5d4c1f5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_LD_INFILE.test
@@ -0,0 +1,38 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+#############################################################################
+# TEST: To test the LOAD DATA INFILE in rbr #
+#############################################################################
+
+# Includes
+-- source include/master-slave.inc
+
+# Begin clean up test section
+--disable_warnings
+connection master;
+DROP TABLE IF EXISTS test.t1;
+--enable_warnings
+
+# Section 1 test
+CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
+LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+DELETE FROM test.t1 WHERE a = 'abashed';
+DELETE FROM test.t1;
+LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+
+
+SELECT * FROM test.t1 ORDER BY a DESC;
+save_master_pos;
+sync_slave_with_master;
+connection slave;
+SELECT * FROM test.t1 ORDER BY a DESC;
+
+# Cleanup
+#show binlog events;
+connection master;
+DROP TABLE test.t1;
+sync_slave_with_master;
+
+# End of 5.0 test case
+
diff --git a/mysql-test/suite/rpl/t/rpl_alter.test b/mysql-test/suite/rpl/t/rpl_alter.test
new file mode 100644
index 00000000000..576376a0264
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_alter.test
@@ -0,0 +1,24 @@
+source include/master-slave.inc;
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+create database mysqltest;
+
+create table mysqltest.t1 ( n int);
+alter table mysqltest.t1 add m int;
+insert into mysqltest.t1 values (1,2);
+create table mysqltest.t2 (n int);
+insert into mysqltest.t2 values (45);
+rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from mysqltest.t2;
+select * from mysqltest.t3;
+connection master;
+drop database mysqltest;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_alter_db.test b/mysql-test/suite/rpl/t/rpl_alter_db.test
new file mode 100644
index 00000000000..5ac8a2f4018
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_alter_db.test
@@ -0,0 +1,10 @@
+source include/master-slave.inc;
+connection master;
+use mysql; # to be different from initial `test' db of mysqltest client
+alter database collate latin1_bin;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment-master.opt b/mysql-test/suite/rpl/t/rpl_auto_increment-master.opt
new file mode 100644
index 00000000000..a8a6af19da9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_auto_increment-master.opt
@@ -0,0 +1 @@
+--auto-increment-increment=10 --auto-increment-offset=2
diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt b/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment.test b/mysql-test/suite/rpl/t/rpl_auto_increment.test
new file mode 100644
index 00000000000..19770ffbdc0
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_auto_increment.test
@@ -0,0 +1,12 @@
+#####################################
+# 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;
+let $engine_type2=myisam;
+-- source extra/rpl_tests/rpl_auto_increment.test
diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test
new file mode 100644
index 00000000000..d4b7872fb2b
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test
@@ -0,0 +1,63 @@
+#
+# Test of auto_increment
+# BUG#11932
+#
+# Bug reported that master and slave get out of sync after TRUNCATE
+# TABLE.
+#
+# Test supplied by Are Casilla
+
+source include/master-slave.inc;
+--disable_warnings
+connection master;
+drop database if exists test1;
+--enable_warnings
+create database test1;
+use test1;
+
+CREATE TABLE `t1` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `fname` varchar(100) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+
+INSERT INTO `t1` VALUES (1, 'blablabla');
+
+CREATE TABLE `t2` (
+ `id` int(10) NOT NULL auto_increment,
+ `comment` varchar(255) NOT NULL default '',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=3 ;
+
+INSERT INTO `t2` VALUES (1, 'testtest 1');
+INSERT INTO `t2` VALUES (2, 'test 2');
+
+DELIMITER $;
+CREATE PROCEDURE simpleproc3 ()
+ NOT DETERMINISTIC
+ BEGIN
+ INSERT INTO t1 (fname) (SELECT t2.comment FROM t2 WHERE t2.id = '1');
+ INSERT INTO t1 (fname) VALUES('test');
+ END
+ $
+DELIMITER ;$
+
+CALL simpleproc3();
+
+select * from t2;
+
+TRUNCATE TABLE `t1`;
+CALL simpleproc3();
+
+select * from t1;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+
+use test1;
+select * from t1;
+
+drop database test1;
+connection master;
+drop database test1;
diff --git a/mysql-test/suite/rpl/t/rpl_bit.test b/mysql-test/suite/rpl/t/rpl_bit.test
new file mode 100644
index 00000000000..07b0778296c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_bit.test
@@ -0,0 +1,94 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Sept/15/2005 #
+#############################################################################
+# Test: To test the replication of the bit field #
+#############################################################################
+# Change Author: JBM
+# Change Date: 2006-01-16
+# Change: Added Order by for NDB
+##########
+
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS test.t1;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+
+CREATE TABLE test.t1 (
+ dummyKey INTEGER NOT NULL,
+ f01 TINYINT,
+ f10 TINYINT,
+ f12 TINYINT,
+ f15 TINYINT,
+ f16 TINYINT,
+ f7 TINYINT,
+ f9 TINYINT,
+ f29 TINYINT,
+ f0 TINYINT,
+ fA1 TINYINT,
+ C32 TINYINT,
+ A42 TINYINT,
+ CA3 TINYINT,
+ A044 TINYINT,
+ f001 TINYINT,
+ A3002 TINYINT,
+ fC003 TINYINT,
+ CA300 TINYINT,
+ A305 TINYINT,
+ CA321 TINYINT,
+ r001 TINYINT,
+ bit1 BIT(6),
+ bit2 BIT(6),
+ bit3 BIT(6),
+ State1 TINYINT,
+ State2 TINYINT,
+ State3 TINYINT,
+ State4 TINYINT,
+ SubState TINYINT,
+ gState TINYINT,
+ oSupp TINYINT,
+ tSupp TINYINT,
+ sSuppD TINYINT,
+ mSuppf TINYINT,
+ GSuppDf TINYINT,
+ VNotSupp TINYINT,
+ x034 TINYINT,
+PRIMARY KEY USING HASH (dummyKey) );
+
+LOCK TABLES test.t1 WRITE;
+INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+UNLOCK TABLES;
+
+
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
+SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
+SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+
+connection master;
+DROP TABLE IF EXISTS test.t1;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_bit_npk.test b/mysql-test/suite/rpl/t/rpl_bit_npk.test
new file mode 100644
index 00000000000..12b587919f9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_bit_npk.test
@@ -0,0 +1,116 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Sept/15/2005 #
+#############################################################################
+# Test: To test the replication of the bit field #
+#############################################################################
+
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS test.t1;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+
+CREATE TABLE test.t1 (
+ dummyKey INTEGER NOT NULL,
+ f01 TINYINT,
+ f10 TINYINT,
+ f12 TINYINT,
+ f15 TINYINT,
+ f16 TINYINT,
+ f7 TINYINT,
+ f9 TINYINT,
+ f29 TINYINT,
+ f0 TINYINT,
+ fA1 TINYINT,
+ C32 TINYINT,
+ A42 TINYINT,
+ CA3 TINYINT,
+ A044 TINYINT,
+ f001 TINYINT,
+ A3002 TINYINT,
+ fC003 TINYINT,
+ CA300 TINYINT,
+ A305 TINYINT,
+ CA321 TINYINT,
+ r001 TINYINT,
+ bit1 BIT(6),
+ bit2 BIT(6),
+ bit3 BIT(6),
+ State1 TINYINT,
+ State2 TINYINT,
+ State3 TINYINT,
+ State4 TINYINT,
+ SubState TINYINT,
+ gState TINYINT,
+ oSupp TINYINT,
+ tSupp TINYINT,
+ sSuppD TINYINT,
+ mSuppf TINYINT,
+ GSuppDf TINYINT,
+ VNotSupp TINYINT,
+ x034 TINYINT);
+
+LOCK TABLES test.t1 WRITE;
+INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,NULL,1);
+INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'0',1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
+UNLOCK TABLES;
+
+UPDATE test.t1 set x034 = 50 where bit3 = b'000000';
+UPDATE test.t1 set VNotSupp = 33 where bit1 = b'0';
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
+ FROM test.t1
+ ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
+SELECT hex(bit1) from test.t1 ORDER BY bit1;
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
+ FROM test.t1
+ ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
+SELECT hex(bit1) from test.t1 ORDER BY bit1;
+SELECT hex(bit2) from test.t1 ORDER BY bit2;
+SELECT hex(bit3) from test.t1 ORDER BY bit3;
+
+connection master;
+CREATE TABLE test.t2 (a INT, b BIT(1));
+INSERT INTO test.t2 VALUES (1, b'0');
+INSERT INTO test.t2 VALUES (1, b'1');
+UPDATE test.t2 SET a = 2 WHERE b = b'1';
+
+CREATE TABLE test.t3 (a INT, b INT);
+INSERT INTO test.t3 VALUES (1, NULL);
+INSERT INTO test.t3 VALUES (1, 0);
+UPDATE test.t3 SET a = 2 WHERE b = 0;
+
+SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
+SELECT * FROM test.t3 ORDER BY a,b;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
+SELECT * FROM test.t3 ORDER BY a,b;
+
+connection master;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test
new file mode 100644
index 00000000000..c031464c95e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test
@@ -0,0 +1,37 @@
+# Verify that after CHANGE MASTER, replication (I/O thread and SQL
+# thread) restart from where SQL thread left, not from where
+# I/O thread left (some old bug fixed in 4.0.17)
+
+source include/master-slave.inc;
+
+connection master;
+# Make SQL slave thread advance a bit
+create table t1(n int);
+sync_slave_with_master;
+select * from t1;
+# Now stop it and make I/O slave thread be ahead
+stop slave sql_thread;
+connection master;
+insert into t1 values(1);
+insert into t1 values(2);
+save_master_pos;
+connection slave;
+--real_sleep 3 # wait for I/O thread to have read updates
+stop slave;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 8 # 9 # 23 # 33 #
+show slave status;
+change master to master_user='root';
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 8 # 9 # 23 # 33 #
+show slave status;
+start slave;
+sync_with_master;
+select * from t1;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_charset_sjis.test b/mysql-test/suite/rpl/t/rpl_charset_sjis.test
new file mode 100644
index 00000000000..2469b0db8a2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_charset_sjis.test
@@ -0,0 +1,25 @@
+source include/have_sjis.inc;
+source include/master-slave.inc;
+
+--disable_warnings
+drop table if exists t1;
+drop procedure if exists p1;
+--enable_warnings
+create table t1 (a varchar(255) character set sjis);
+create procedure p1 (in a varchar(255) character set sjis) insert into t1 values (a);
+
+SET NAMES binary;
+CALL p1 ('–\\');
+select "--- on master ---";
+select hex(a) from t1 ;
+sync_slave_with_master;
+connection slave;
+select "--- on slave ---";
+select hex(a) from t1;
+connection master;
+drop table t1;
+drop procedure p1;
+sync_slave_with_master;
+connection master;
+
+# End of 5.0 tests
diff --git a/mysql-test/suite/rpl/t/rpl_commit_after_flush.test b/mysql-test/suite/rpl/t/rpl_commit_after_flush.test
new file mode 100644
index 00000000000..7a924ddb11e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_commit_after_flush.test
@@ -0,0 +1,11 @@
+#####################################
+# 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
+let $engine_type=innodb;
+-- source extra/rpl_tests/rpl_commit_after_flush.test
diff --git a/mysql-test/suite/rpl/t/rpl_create_database-master.opt b/mysql-test/suite/rpl/t/rpl_create_database-master.opt
new file mode 100644
index 00000000000..85660a17140
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_create_database-master.opt
@@ -0,0 +1 @@
+--binlog-do-db=mysqltest_sisyfos --binlog-do-db=mysqltest_prometheus
diff --git a/mysql-test/suite/rpl/t/rpl_create_database-slave.opt b/mysql-test/suite/rpl/t/rpl_create_database-slave.opt
new file mode 100644
index 00000000000..96d630c9229
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_create_database-slave.opt
@@ -0,0 +1 @@
+--replicate-do-db=mysqltest_sisyfos --replicate-do-db=mysqltest_prometheus
diff --git a/mysql-test/suite/rpl/t/rpl_create_database.test b/mysql-test/suite/rpl/t/rpl_create_database.test
new file mode 100644
index 00000000000..70cff8daca2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_create_database.test
@@ -0,0 +1,72 @@
+#
+# Tests for replication of statements that manipulate databases.
+#
+# For this test file, we have a number of databases. All databases
+# with "greek" names will be replicated on the slave, while other names
+# (e.g., american) will not be replicated.
+#
+
+source include/master-slave.inc;
+
+# Bug#6391 (binlog-do-db rules ignored)
+# In this case, 'mysqltest_bob' should not be replicated to the slave.
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
+sync_slave_with_master;
+# This database is not replicated
+DROP DATABASE IF EXISTS mysqltest_bob;
+--enable_warnings
+
+connection master;
+CREATE DATABASE mysqltest_prometheus;
+CREATE DATABASE mysqltest_sisyfos;
+CREATE DATABASE mysqltest_bob;
+
+USE mysqltest_sisyfos;
+# These should be replicated
+CREATE TABLE t1 (b int);
+INSERT INTO t1 VALUES(1);
+
+USE mysqltest_bob;
+# These should *not* be replicated
+CREATE TABLE t2 (b int);
+INSERT INTO t2 VALUES(2);
+
+# Current database is now 'mysqltest_bob'
+# The following should be replicated
+ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
+
+USE mysqltest_sisyfos;
+# The following should *not* be replicated
+ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
+
+SHOW DATABASES;
+sync_slave_with_master;
+SHOW DATABASES;
+
+connection master;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+USE mysqltest_prometheus;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+CREATE DATABASE mysqltest_sisyfos;
+USE mysqltest_sisyfos;
+CREATE TABLE t2 (a INT);
+let $VERSION=`select version()`;
+SHOW DATABASES;
+sync_slave_with_master;
+SHOW DATABASES;
+USE mysqltest_prometheus;
+SHOW TABLES;
+USE mysqltest_sisyfos;
+SHOW TABLES;
+
+connection master;
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_critical_errors.test b/mysql-test/suite/rpl/t/rpl_critical_errors.test
new file mode 100644
index 00000000000..abf827c8d1f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_critical_errors.test
@@ -0,0 +1,66 @@
+# Test for BUG#26551
+#
+
+# This test is unfortunately very fragile and very dependent on the
+# load of the computer. The test is therefore disabled normally. It is
+# entered here to demonstrate how to check that the bug is actually
+# solved.
+
+--echo Turn on parsing to run this test
+
+disable_parsing;
+
+source include/master-slave.inc;
+
+connection master;
+CREATE TABLE t1 (data LONGBLOB) ENGINE=MYISAM;
+CREATE TABLE t2 (data LONGBLOB) ENGINE=MYISAM;
+
+INSERT INTO t1 (data) VALUES (repeat('a',1024*1024));
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+sync_slave_with_master;
+
+connection master;
+send INSERT INTO t2 SELECT * FROM t1;
+
+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.
+sleep 4;
+
+# SHOW PROCESSLIST;
+
+# Code for the 5.1 server to get the thread id of the thread executing
+# the query above.
+#
+#SET @id = 0;
+#SELECT id INTO @id
+# FROM information_schema.processlist
+# WHERE info LIKE 'INSERT INTO t2%';
+
+# This is the connection that is executing the INSERT INTO t2...
+KILL QUERY 2;
+
+connection slave;
+
+# Here the slave will only stop if the query above actually started
+# inserting some rows into t2. Otherwise, it will hang forever.
+--source include/wait_for_slave_to_stop.inc
+
+# The following should be 0
+SELECT COUNT(*) FROM t2;
+
+# ... and there the error code should be 1317 (ER_QUERY_INTERRUPTED)
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 20 # 22 # 23 # 33 #
+query_vertical SHOW SLAVE STATUS;
+
+enable_parsing;
diff --git a/mysql-test/suite/rpl/t/rpl_ddl.test b/mysql-test/suite/rpl/t/rpl_ddl.test
new file mode 100644
index 00000000000..80df16a7a00
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ddl.test
@@ -0,0 +1,32 @@
+######################## rpl_ddl.test ########################
+# #
+# DDL statements (sometimes with implicit COMMIT) executed #
+# by the master and it's propagation into the slave #
+# #
+##############################################################
+
+#
+# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
+#
+# 1. !All! objects to be dropped, renamed, altered ... must be created
+# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test
+# sequences start.
+#
+# 2. Never use a test object, which was direct or indirect affected by a
+# preceeding test sequence again.
+# Except table d1.t1 where ONLY DML is allowed.
+#
+# If one preceeding test sequence hits a (sometimes not good visible,
+# because the sql error code of the statement might be 0) bug
+# and these rules are ignored, a following test sequence might earn ugly
+# effects like failing 'sync_slave_with_master', crashes of the slave or
+# abort of the test case etc..
+#
+--source include/not_ndb_default.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+let $engine_type= InnoDB;
+let $temp_engine_type= MEMORY;
+let $show_binlog = 0;
+let $manipulate = 0;
+-- source extra/rpl_tests/rpl_ddl.test
diff --git a/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt
new file mode 100644
index 00000000000..c52c239a1a1
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb --innodb_lock_wait_timeout=4 --slave-transaction-retries=2 --max-relay-log-size=4096
diff --git a/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test b/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test
new file mode 100644
index 00000000000..ee907f81b22
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_deadlock_innodb.test
@@ -0,0 +1,11 @@
+################################
+# Wrapper for rpl_deadlock.test#
+################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+-- source extra/rpl_tests/rpl_deadlock.test
diff --git a/mysql-test/suite/rpl/t/rpl_delete_no_where.test b/mysql-test/suite/rpl/t/rpl_delete_no_where.test
new file mode 100644
index 00000000000..11adb2e6dd5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_delete_no_where.test
@@ -0,0 +1,6 @@
+###################################################
+# By JBM 2006-02-14 added to skip test when NDB #
+##################################################
+-- source include/not_ndb_default.inc
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_delete_no_where.test
diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test
new file mode 100644
index 00000000000..5615900c2dd
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test
@@ -0,0 +1,114 @@
+# Works in statement-based and row-based binlogging.
+# Test that GRANT and other user management commands are replicated to the slave
+
+-- source include/master-slave.inc
+
+# do not be influenced by other tests.
+connection master;
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
+flush privileges;
+save_master_pos;
+connection slave;
+sync_with_master;
+# if these DELETE did nothing on the master, we need to do them manually on the
+# slave.
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
+flush privileges;
+
+# test replication of GRANT
+connection master;
+grant select on *.* to rpl_do_grant@localhost;
+grant drop on test.* to rpl_do_grant@localhost;
+save_master_pos;
+connection slave;
+sync_with_master;
+show grants for rpl_do_grant@localhost;
+
+# test replication of SET PASSWORD
+connection master;
+set password for rpl_do_grant@localhost=password("does it work?");
+save_master_pos;
+connection slave;
+sync_with_master;
+select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
+
+#
+# Bug#24158 SET PASSWORD in binary log fails under ANSI_QUOTES
+#
+connection master;
+update mysql.user set password='' where user='rpl_do_grant';
+flush privileges;
+select password<>'' from mysql.user where user='rpl_do_grant';
+set sql_mode='ANSI_QUOTES';
+set password for rpl_do_grant@localhost=password('does it work?');
+set sql_mode='';
+save_master_pos;
+connection slave;
+sync_with_master;
+select password<>'' from mysql.user where user='rpl_do_grant';
+
+
+# clear what we have done, to not influence other tests.
+connection master;
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
+flush privileges;
+sync_slave_with_master;
+# The mysql database is not replicated, so we have to do the deletes
+# manually on the slave as well.
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
+flush privileges;
+
+# End of 4.1 tests
+
+connection master;
+--error 1141
+show grants for rpl_do_grant@localhost;
+connection slave;
+--error 1141
+show grants for rpl_do_grant@localhost;
+
+connection master;
+create user rpl_do_grant@localhost;
+show grants for rpl_do_grant@localhost;
+--error 1141
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+show grants for rpl_do_grant@localhost;
+--error 1141
+show grants for rpl_do_grant2@localhost;
+
+connection master;
+rename user rpl_do_grant@localhost to rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+show grants for rpl_do_grant2@localhost;
+
+connection master;
+grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+show grants for rpl_do_grant2@localhost;
+
+connection master;
+revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+show grants for rpl_do_grant2@localhost;
+
+connection master;
+revoke all privileges, grant option from rpl_do_grant2@localhost;
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+show grants for rpl_do_grant2@localhost;
+
+connection master;
+drop user rpl_do_grant2@localhost;
+--error 1141
+show grants for rpl_do_grant2@localhost;
+sync_slave_with_master;
+--error 1141
+show grants for rpl_do_grant2@localhost;
diff --git a/mysql-test/suite/rpl/t/rpl_drop.test b/mysql-test/suite/rpl/t/rpl_drop.test
new file mode 100644
index 00000000000..b38007a755f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_drop.test
@@ -0,0 +1,16 @@
+# Testcase for BUG#4552 (DROP on two tables, one of which does not
+# exist, must be binlogged with a non-zero error code)
+source include/master-slave.inc;
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+create table t1 (a int);
+--error 1051
+drop table t1, t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_drop_db.test b/mysql-test/suite/rpl/t/rpl_drop_db.test
new file mode 100644
index 00000000000..7f4a7843c4a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_drop_db.test
@@ -0,0 +1,61 @@
+# test case for BUG#4680 -- if there are extra files in the db directory
+# dropping the db on the master causes replication problems
+
+-- source include/master-slave.inc
+connection master;
+
+--disable_warnings
+drop database if exists mysqltest1;
+--enable_warnings
+create database mysqltest1;
+create table mysqltest1.t1 (n int);
+insert into mysqltest1.t1 values (1);
+select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt';
+create table mysqltest1.t2 (n int);
+create table mysqltest1.t3 (n int);
+--replace_result \\ /
+--error 1010
+drop database mysqltest1;
+use mysqltest1;
+show tables;
+
+# test the branch of the code that deals with the query buffer overflow
+
+--disable_query_log
+let $1=50;
+while ($1)
+{
+ eval create table mysqltest1.mysqltest_long_table_name$1 (n int);
+ dec $1;
+}
+--enable_query_log
+
+--replace_result \\ /
+--error 1010
+drop database mysqltest1;
+use mysqltest1;
+show tables;
+use test;
+create table t1 (n int);
+insert into t1 values (1234);
+sync_slave_with_master;
+
+connection slave;
+use mysqltest1;
+show tables;
+use test;
+select * from t1;
+
+#cleanup
+connection slave;
+stop slave;
+drop database mysqltest1;
+
+connection master;
+# Remove the "extra" file created above
+--remove_file $MYSQLTEST_VARDIR/master-data/mysqltest1/f1.txt
+drop database mysqltest1;
+
+use test;
+drop table t1;
+
diff --git a/mysql-test/suite/rpl/t/rpl_drop_temp-slave.opt b/mysql-test/suite/rpl/t/rpl_drop_temp-slave.opt
new file mode 100644
index 00000000000..2f9244c65ff
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_drop_temp-slave.opt
@@ -0,0 +1,2 @@
+--replicate-ignore-table=mysqltest.t2
+
diff --git a/mysql-test/suite/rpl/t/rpl_drop_temp.test b/mysql-test/suite/rpl/t/rpl_drop_temp.test
new file mode 100644
index 00000000000..305c78d3f06
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_drop_temp.test
@@ -0,0 +1,27 @@
+##############################################
+# Change Author: JBM
+# Change Date: 2006-02-07
+# Change: Added ENGINE=MyISAM
+# Purpose: According to TU in 16552 This is how
+# to work around NDB's issue with temp tables
+##############################################
+source include/master-slave.inc;
+--disable_warnings
+create database if not exists mysqltest;
+--enable_warnings
+
+create temporary table mysqltest.t1 (n int)ENGINE=MyISAM;
+create temporary table mysqltest.t2 (n int)ENGINE=MyISAM;
+sync_slave_with_master;
+connection master;
+disconnect master;
+connection slave;
+--real_sleep 3 # time for DROP to be written
+show status like 'Slave_open_temp_tables';
+
+# Cleanup
+connection default;
+drop database mysqltest;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance-master.opt b/mysql-test/suite/rpl/t/rpl_dual_pos_advance-master.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_dual_pos_advance-master.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
new file mode 100644
index 00000000000..27c920a3186
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
@@ -0,0 +1,114 @@
+# This test checks that in a dual-head setup
+# A->B->A, where A has --log-slave-updates (why would it?
+# assume that there is a C as slave of A),
+# then the Exec_master_log_pos of SHOW SLAVE STATUS does
+# not stay too low on B(BUG#13023 due to events ignored because
+# of their server id).
+# It also will test BUG#13861.
+
+source include/master-slave.inc;
+
+
+# set up "dual head"
+
+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";
+
+start slave;
+
+# now we test it
+
+connection slave;
+
+create table t1 (n int);
+
+save_master_pos;
+connection master;
+sync_with_master;
+
+# Now test BUG#13861. This will be enabled when Guilhem fixes this
+# bug.
+
+# stop slave
+
+# create table t2 (n int); # create one ignored event
+
+# save_master_pos;
+# connection slave;
+# sync_with_master;
+
+# connection slave;
+
+# show tables;
+
+# save_master_pos;
+
+# create table t3 (n int);
+
+# connection master;
+
+# bug is that START SLAVE UNTIL may stop too late, we test that by
+# asking it to stop before creation of t3.
+
+# start slave until master_log_file="slave-bin.000001",master_log_pos=195;
+
+# wait until it's started (the position below is the start of "CREATE
+# TABLE t2") (otherwise wait_for_slave_to_stop may return at once)
+
+# select master_pos_wait("slave-bin.000001",137);
+
+# --source include/wait_for_slave_to_stop.inc
+
+# then BUG#13861 causes t3 to show up below (because stopped too
+# late).
+
+# show tables;
+
+# start slave;
+
+# BUG#13023 is that Exec_master_log_pos may stay too low "forever":
+
+connection master;
+
+create table t4 (n int); # create 3 ignored events
+create table t5 (n int);
+create table t6 (n int);
+
+save_master_pos;
+connection slave;
+sync_with_master;
+
+connection slave;
+
+save_master_pos;
+
+connection master;
+
+# then BUG#13023 caused hang below ("master" looks behind, while it's
+# not in terms of updates done).
+
+sync_with_master;
+
+show tables;
+
+# cleanup
+
+stop slave;
+reset slave;
+drop table t1,t4,t5,t6; # add t2 and t3 later
+
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
+
+# Cleanup
+# The A->B->A replication causes the master to start writing relay logs
+# in var/run, remove them
+remove_file $MYSQLTEST_VARDIR/run/master-relay-bin.000001;
+remove_file $MYSQLTEST_VARDIR/run/master-relay-bin.index;
diff --git a/mysql-test/suite/rpl/t/rpl_empty_master_crash-master.opt b/mysql-test/suite/rpl/t/rpl_empty_master_crash-master.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_empty_master_crash-master.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_empty_master_crash.test b/mysql-test/suite/rpl/t/rpl_empty_master_crash.test
new file mode 100644
index 00000000000..707d1eca8c2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_empty_master_crash.test
@@ -0,0 +1,15 @@
+source include/master-slave.inc;
+
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+show slave status;
+
+#
+# Load table should not succeed on the master as this is not a slave
+#
+--error 1218
+load table t1 from master;
+connection slave;
+--error 1188
+load table t1 from master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_err_ignoredtable-slave.opt b/mysql-test/suite/rpl/t/rpl_err_ignoredtable-slave.opt
new file mode 100644
index 00000000000..cb49119bfcb
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_err_ignoredtable-slave.opt
@@ -0,0 +1 @@
+--replicate-ignore-table=test.t1 --replicate-ignore-table=test.t2 --replicate-ignore-table=test.t3
diff --git a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
new file mode 100644
index 00000000000..4e06a6a7096
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
@@ -0,0 +1,66 @@
+# Test for
+# Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave
+# still checks that it has the same error as on the master.
+##########################################################################
+# 2006-02-07 JBM Added error code 1022 for NDB Engine + ORDER BY
+##########################################################################
+
+-- source include/master-slave.inc
+
+connection master;
+create table t1 (a int primary key);
+create table t4 (a int primary key);
+# generate an error that goes to the binlog
+--error 1022, ER_DUP_ENTRY
+insert into t1 values (1),(1);
+insert into t4 values (1),(2);
+save_master_pos;
+connection slave;
+# as the t1 table is ignored on the slave, the slave should be able to sync
+sync_with_master;
+# check that the table has been ignored, because otherwise the test is nonsense
+show tables like 't1';
+show tables like 't4';
+SELECT * FROM test.t4 ORDER BY a;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# Now test that even critical errors (connection killed)
+# are ignored if rules allow it.
+# The "kill" idea was copied from rpl000001.test.
+
+connection master1;
+select get_lock('crash_lock%20C', 10);
+
+connection master;
+create table t2 (a int primary key);
+insert into t2 values(1);
+create table t3 (id int);
+insert into t3 values(connection_id());
+send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
+
+connection master1;
+real_sleep 2;
+select (@id := id) - id from t3;
+kill @id;
+drop table t2,t3;
+insert into t4 values (3),(4);
+connection master;
+--error 0,1053,2013
+reap;
+connection master1;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t4 ORDER BY a;
+
+connection master1;
+DROP TABLE test.t4;
+save_master_pos;
+connection slave;
+sync_with_master;
+# End of 4.1 tests
+# Adding comment for force manual merge 5.0 -> wl1012. delete me if needed
diff --git a/mysql-test/suite/rpl/t/rpl_events.test b/mysql-test/suite/rpl/t/rpl_events.test
new file mode 100644
index 00000000000..62ffead7dcb
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_events.test
@@ -0,0 +1,47 @@
+##################################################################
+# Author: Giuseppe #
+# Date: 2006-12-20 #
+# Purpose: To test that event effects are replicated #
+# in both row based and statement based format #
+##################################################################
+
+set global event_scheduler=1;
+
+--source include/not_embedded.inc
+--source include/master-slave.inc
+
+let $engine_type= MyISAM;
+
+set binlog_format=row;
+
+# Embedded server doesn't support binlogging
+--source include/rpl_events.inc
+
+set binlog_format=statement;
+
+# Embedded server doesn't support binlogging
+--source include/rpl_events.inc
+
+#
+# Bug #28953 Using events in a replication let the slave crash.
+#
+
+connection master;
+
+DELIMITER |;
+CREATE EVENT event1 ON SCHEDULE EVERY 1 YEAR
+DO BEGIN
+ select * from t1;
+END;|
+DELIMITER ;|
+
+ALTER EVENT event1 RENAME TO event2;
+
+sync_slave_with_master;
+
+connection master;
+
+DROP EVENT event2;
+
+sync_slave_with_master;
+
diff --git a/mysql-test/suite/rpl/t/rpl_extraCol_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_extraCol_innodb-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_extraCol_innodb-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_extraCol_innodb.test b/mysql-test/suite/rpl/t/rpl_extraCol_innodb.test
new file mode 100644
index 00000000000..e9685baf01b
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_extraCol_innodb.test
@@ -0,0 +1,13 @@
+###########################################
+# 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
new file mode 100644
index 00000000000..d56df394ccf
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_extraCol_myisam.test
@@ -0,0 +1,12 @@
+###########################################
+# 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_failed_optimize-master.opt b/mysql-test/suite/rpl/t/rpl_failed_optimize-master.opt
new file mode 100644
index 00000000000..3f82baff598
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_failed_optimize-master.opt
@@ -0,0 +1 @@
+--loose-innodb-lock-wait-timeout=1
diff --git a/mysql-test/suite/rpl/t/rpl_failed_optimize.test b/mysql-test/suite/rpl/t/rpl_failed_optimize.test
new file mode 100644
index 00000000000..81e8342b5c0
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_failed_optimize.test
@@ -0,0 +1,11 @@
+#######################################
+# 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;
+-- source extra/rpl_tests/rpl_failed_optimize.test
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt
new file mode 100644
index 00000000000..a4d1d403dc9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt
@@ -0,0 +1 @@
+-O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/master-data/relay-log
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh
new file mode 100755
index 00000000000..a321dd690cd
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh
@@ -0,0 +1,5 @@
+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
new file mode 100644
index 00000000000..95839c831c9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt
@@ -0,0 +1 @@
+-O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/slave-data/relay-log
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh
new file mode 100755
index 00000000000..e46ea6d400b
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 00000000000..471c45a1aa3
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
@@ -0,0 +1,50 @@
+# Testing if "flush logs" command bouncing resulting in logs created in a loop
+# in case of bi-directional replication
+-- source include/master-slave.inc
+
+#
+# Start replication master -> slave
+#
+# We have to sync with master, to ensure slave had time to start properly
+# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
+sync_slave_with_master;
+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;
+start slave;
+
+#
+# Wait for start of slave IO and SQL threads
+#
+let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%';
+--source include/wait_slave_status.inc
+
+#
+# Flush logs of slave
+#
+flush logs;
+sleep 5;
+
+#
+# Show status of slave
+#
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+--vertical_results
+SHOW SLAVE STATUS;
diff --git a/mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test b/mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test
new file mode 100644
index 00000000000..d085bff2012
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test
@@ -0,0 +1,11 @@
+###################################
+# 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;
+-- source extra/rpl_tests/rpl_foreign_key.test
diff --git a/mysql-test/suite/rpl/t/rpl_free_items-slave.opt b/mysql-test/suite/rpl/t/rpl_free_items-slave.opt
new file mode 100644
index 00000000000..b828d03fafb
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_free_items-slave.opt
@@ -0,0 +1 @@
+--replicate-wild-ignore-table=test.%
diff --git a/mysql-test/suite/rpl/t/rpl_free_items.test b/mysql-test/suite/rpl/t/rpl_free_items.test
new file mode 100644
index 00000000000..043e84160b8
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_free_items.test
@@ -0,0 +1,22 @@
+source include/master-slave.inc;
+create table t1 (a int);
+create table t2 (a int);
+disable_query_log;
+SET @query="INSERT INTO t2 SELECT * FROM t1 WHERE a REGEXP \"0\"";
+let $1 = 2000;
+while ($1)
+{
+ eval SET @query=concat(@query, " OR a REGEXP '$1'");
+ dec $1;
+}
+let $1=`select @query`;
+eval $1;
+enable_query_log;
+# I have seen the slave crash either now or at shutdown
+sync_slave_with_master;
+connection master;
+drop table t1;
+drop table t2;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_get_lock.test b/mysql-test/suite/rpl/t/rpl_get_lock.test
new file mode 100644
index 00000000000..945bd98c993
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_get_lock.test
@@ -0,0 +1,43 @@
+source include/master-slave.inc;
+
+create table t1(n int);
+insert into t1 values(get_lock("lock",2));
+dirty_close master;
+connection master1;
+select get_lock("lock",2);
+
+select release_lock("lock");
+#ignore
+disable_query_log;
+let $1=2000;
+while ($1)
+{
+ do get_lock("lock",2);
+ do release_lock("lock");
+ dec $1;
+}
+enable_query_log;
+save_master_pos;
+connection slave;
+sync_with_master;
+select get_lock("lock",3);
+select * from t1;
+# There is no point in testing REPLICATIION of the IS_*_LOCK
+# functions; slave does not run with the same concurrency context as
+# master (generally in slave we can't know that on master this lock
+# was already held by another connection and so that the the
+# get_lock() we're replicating timed out on master hence returned 0,
+# or that the is_free_lock() we're playing returned 0 etc.
+# But here all we do is test these functions outside of replication.
+select is_free_lock("lock"), is_used_lock("lock") = connection_id();
+explain extended select is_free_lock("lock"), is_used_lock("lock");
+# Check lock functions
+select is_free_lock("lock2");
+select is_free_lock(NULL);
+connection master1;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_grant-slave.opt b/mysql-test/suite/rpl/t/rpl_ignore_grant-slave.opt
new file mode 100644
index 00000000000..e931bfbd37e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ignore_grant-slave.opt
@@ -0,0 +1 @@
+--replicate-wild-ignore-table=mysql.%
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_grant.test b/mysql-test/suite/rpl/t/rpl_ignore_grant.test
new file mode 100644
index 00000000000..2e6e2ce9a31
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ignore_grant.test
@@ -0,0 +1,59 @@
+# Test that GRANT is not replicated to the slave
+# when --replicate-wild-ignore-table=mysql.%
+# In BUG#980, this test would _randomly_ fail.
+
+source include/master-slave.inc;
+
+# do not be influenced by other tests.
+connection master;
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
+flush privileges;
+save_master_pos;
+connection slave;
+sync_with_master;
+# as these DELETE were not replicated, we need to do them manually on the
+# slave.
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
+flush privileges;
+
+# test non-replication of GRANT
+connection master;
+grant select on *.* to rpl_ignore_grant@localhost;
+grant drop on test.* to rpl_ignore_grant@localhost;
+show grants for rpl_ignore_grant@localhost;
+save_master_pos;
+connection slave;
+sync_with_master;
+--error 1141 #("no such grant for user")
+show grants for rpl_ignore_grant@localhost;
+# check it another way
+select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
+select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
+
+# test non-replication of SET PASSWORD
+# first force creation of the user on slave (because as the user does not exist
+# on slave, the SET PASSWORD may be replicated but silently do nothing; this is
+# not what we want; we want it to be not-replicated).
+grant select on *.* to rpl_ignore_grant@localhost;
+connection master;
+set password for rpl_ignore_grant@localhost=password("does it work?");
+save_master_pos;
+connection slave;
+sync_with_master;
+select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
+
+# clear what we have done, to not influence other tests.
+connection master;
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
+flush privileges;
+save_master_pos;
+connection slave;
+sync_with_master;
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
+flush privileges;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_revoke-slave.opt b/mysql-test/suite/rpl/t/rpl_ignore_revoke-slave.opt
new file mode 100644
index 00000000000..e931bfbd37e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ignore_revoke-slave.opt
@@ -0,0 +1 @@
+--replicate-wild-ignore-table=mysql.%
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_revoke.test b/mysql-test/suite/rpl/t/rpl_ignore_revoke.test
new file mode 100644
index 00000000000..00171605a92
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ignore_revoke.test
@@ -0,0 +1,51 @@
+# test verifies that REVOKE must not be replicated when
+# slave server starts with --replicate-wild-ignore-table=mysql.%
+# the option is set in rpl_ignore_revoke-slave.opt
+# The first part of BUG#9483 for GRANT is checked by
+# existed specific rpl_ignore_grant test case (BUG#980)
+
+
+source include/master-slave.inc;
+
+### CLEAN-UP: create an account and manually duplicate it on the slave
+
+connection master;
+grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
+revoke select on *.* from 'user_foo'@'%';
+select select_priv from mysql.user where user='user_foo' /* master:must be N */;
+
+sync_slave_with_master;
+#connection slave;
+grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
+revoke select on *.* from 'user_foo'@'%';
+select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
+
+
+### TEST
+
+#connection slave;
+grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
+select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
+
+connection master;
+revoke select on *.* from 'user_foo';
+select select_priv from mysql.user where user='user_foo' /* master:must be N */;
+
+sync_slave_with_master;
+#connection slave;
+select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
+
+### CLEAN-UP
+
+connection slave;
+--disable_abort_on_error
+revoke select on *.* FROM 'user_foo';
+--enable_abort_on_error
+
+connection master;
+delete from mysql.user where user="user_foo";
+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";
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table-slave.opt b/mysql-test/suite/rpl/t/rpl_ignore_table-slave.opt
new file mode 100644
index 00000000000..3aabbb2e0f5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table-slave.opt
@@ -0,0 +1 @@
+--replicate-ignore-table=test.t1 --replicate-ignore-table=test.t2 --replicate-ignore-table=test.t3 --replicate-wild-ignore-table=%.tmptbl%
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test
new file mode 100644
index 00000000000..fd4ae64165a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test
@@ -0,0 +1,164 @@
+source include/master-slave.inc;
+
+#
+# BUG#16487
+#
+# Requirement:
+# Multi-updates on ignored tables should not fail even if the slave does
+# not have the ignored tables.
+#
+# Note table t1, t2, and t3 are ignored in the option file to this test.
+#
+
+--echo **** Test case for BUG#16487 ****
+--echo **** Master ****
+connection master;
+CREATE TABLE test.t4 (a int);
+CREATE TABLE test.t1 (a int);
+
+# Expect: The row must *not* by updated on slave, since t1 is ignored
+UPDATE test.t4 NATURAL JOIN test.t1 SET t1.a=5;
+
+--echo **** Slave ****
+sync_slave_with_master;
+SELECT * FROM t4;
+
+# Cleanup
+connection master;
+DROP TABLE t1;
+DROP TABLE t4;
+
+sync_slave_with_master;
+
+
+#
+# Bug#25482 GRANT statements are not replicated if
+# you use "replicate-ignore-table"
+#
+
+--echo **** Test case for BUG#25482 ****
+--echo **** Adding GRANTS on master ****
+
+connection master;
+create table test.t1(a int);
+create table test.t4(a int);
+
+# Simple user that should not replicate
+GRANT SELECT ON test.t1 TO mysqltest1@localhost;
+
+# Partial replicate
+GRANT INSERT ON test.t4 TO mysqltest2@localhost;
+GRANT select, update, insert, references on t1
+ to mysqltest2@localhost;
+
+# Partial replicate 2
+GRANT SELECT ON test.* TO mysqltest3@localhost;
+GRANT INSERT ON test.t4 TO mysqltest3@localhost;
+GRANT select(a), update(a), insert(a), references(a) on t4
+ to mysqltest3@localhost;
+
+# Create another database and table
+create database mysqltest2;
+create table mysqltest2.t2 (id int);
+# Create a grant that should replicate
+GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass';
+
+# Create a grant manually
+insert into mysql.user (user, host) values ("mysqltest5", "somehost");
+
+# Partial replicate 3 with *.*
+GRANT SELECT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON test.* TO mysqltest6@localhost;
+GRANT INSERT ON test.t1 TO mysqltest6@localhost;
+
+show grants for mysqltest1@localhost;
+show grants for mysqltest2@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+show grants for mysqltest6@localhost;
+
+flush privileges;
+show grants for mysqltest5@somehost;
+
+
+sync_slave_with_master;
+
+--echo **** Checking grants on slave ****
+
+# Check that grants are replicated to slave
+show grants for mysqltest2@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+show grants for mysqltest5@somehost;
+show grants for mysqltest6@localhost;
+
+# mysqltest1 should not be on slave
+--error 1141
+show grants for mysqltest1@localhost;
+
+--echo **** Revoking grants on master ****
+connection master;
+REVOKE SELECT ON test.t1 FROM mysqltest1@localhost;
+REVOKE SELECT ON mysqltest2.t2 FROM mysqltest4@localhost;
+REVOKE select(a) on t4
+ from mysqltest3@localhost;
+
+show grants for mysqltest1@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+
+sync_slave_with_master;
+
+--echo **** Checking grants on slave ****
+
+# mysqltest1 should not be on slave
+--error 1141
+show grants for mysqltest1@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+
+# Cleanup
+connection master;
+drop table t1, t4, mysqltest2.t2;
+drop database mysqltest2;
+delete from mysql.user where user like "mysqltest%";
+delete from mysql.db where user like "mysqltest%";
+#
+# BUG 27606 causes failure to replicate this statement
+# move it to slave instead
+#delete from mysql.tables_priv where user like "mysqltest%";
+delete from mysql.columns_priv where user like "mysqltest%";
+sync_slave_with_master;
+
+#BUG27606
+delete from mysql.tables_priv where user like "mysqltest%";
+
+connection master;
+
+#BUG27606
+delete from mysql.tables_priv where user like "mysqltest%";
+
+#
+# bug#22877 replication character sets get out of sync
+# using replicate-wild-ignore-table
+#
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS t5;
+--enable_warnings
+CREATE TABLE t5 (
+ word varchar(50) collate utf8_unicode_ci NOT NULL default ''
+) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+SET @@session.character_set_client=33,@@session.collation_connection=192;
+CREATE TEMPORARY TABLE tmptbl504451f4258$1 (id INT NOT NULL) ENGINE=MEMORY;
+INSERT INTO t5 (word) VALUES ('TEST’');
+SELECT HEX(word) FROM t5;
+sync_slave_with_master;
+connection slave;
+SELECT HEX(word) FROM t5;
+--error 1146
+SELECT * FROM tmptbl504451f4258$1;
+connection master;
+DROP TABLE t5;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table_update-slave.opt b/mysql-test/suite/rpl/t/rpl_ignore_table_update-slave.opt
new file mode 100644
index 00000000000..177f89e0910
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table_update-slave.opt
@@ -0,0 +1 @@
+--replicate-ignore-table=test.mysqltest_foo
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table_update.test b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test
new file mode 100644
index 00000000000..fe030f90411
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test
@@ -0,0 +1,38 @@
+# This one assumes we are ignoring updates on table mysqltest_foo, but doing
+# the ones on all other tables
+
+source include/master-slave.inc;
+connection slave;
+
+#
+# For this test we must be in the test database
+#
+use test;
+
+--disable_warnings
+drop table if exists mysqltest_foo;
+drop table if exists mysqltest_bar;
+--enable_warnings
+
+create table mysqltest_foo (n int);
+insert into mysqltest_foo values(4);
+connection master;
+use test;
+create table mysqltest_foo (n int);
+insert into mysqltest_foo values(5);
+create table mysqltest_bar (m int);
+insert into mysqltest_bar values(15);
+create table t1 (k int);
+insert into t1 values(55);
+save_master_pos;
+connection slave;
+sync_with_master;
+select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1;
+connection master;
+drop table mysqltest_foo,mysqltest_bar,t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+drop table mysqltest_foo,mysqltest_bar,t1;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_incident-master.opt b/mysql-test/suite/rpl/t/rpl_incident-master.opt
new file mode 100644
index 00000000000..912801debc4
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_incident-master.opt
@@ -0,0 +1 @@
+--loose-debug=+d,incident_database_resync_on_replace
diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test
new file mode 100644
index 00000000000..507cd0e0798
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_incident.test
@@ -0,0 +1,42 @@
+--source include/master-slave.inc
+--source include/have_debug.inc
+
+--echo **** On Master ****
+CREATE TABLE t1 (a INT);
+
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM t1;
+
+# This will generate an incident log event and store it in the binary
+# log before the replace statement.
+REPLACE INTO t1 VALUES (4);
+--save_master_pos
+SELECT * FROM t1;
+
+connection slave;
+--wait_for_slave_to_stop
+
+# The 4 should not be inserted into the table, since the incident log
+# event should have stop the slave.
+--echo **** On Slave ****
+SELECT * FROM t1;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
+START SLAVE;
+--sync_with_master
+
+# Now, we should have inserted the row into the table and the slave
+# should be running. We should also have rotated to a new binary log.
+
+SELECT * FROM t1;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+connection master;
+DROP TABLE t1;
+--sync_slave_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_init_slave-slave.opt b/mysql-test/suite/rpl/t/rpl_init_slave-slave.opt
new file mode 100644
index 00000000000..337e8a60d97
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_init_slave-slave.opt
@@ -0,0 +1 @@
+--init-slave="set global max_connections=500"
diff --git a/mysql-test/suite/rpl/t/rpl_init_slave.test b/mysql-test/suite/rpl/t/rpl_init_slave.test
new file mode 100644
index 00000000000..139b4902e12
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_init_slave.test
@@ -0,0 +1,34 @@
+source include/master-slave.inc;
+
+#
+# Test of init_slave variable
+#
+
+save_master_pos;
+connection slave;
+sleep 1;
+show variables like 'init_slave';
+show variables like 'max_connections';
+sync_with_master;
+reset master;
+connection master;
+show variables like 'init_slave';
+show variables like 'max_connections';
+save_master_pos;
+connection slave;
+sync_with_master;
+# Save variable value
+set @my_global_init_connect= @@global.init_connect;
+set global init_connect="set @c=1";
+show variables like 'init_connect';
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
+# Restore changed global variable
+set global init_connect= @my_global_init_connect;
+set global max_connections= default;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_innodb.test b/mysql-test/suite/rpl/t/rpl_innodb.test
new file mode 100644
index 00000000000..b88276e2107
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_innodb.test
@@ -0,0 +1,48 @@
+# File for specialities regarding replication from or to InnoDB
+# tables.
+
+source include/master-slave.inc;
+source include/have_innodb.inc;
+
+#
+# Bug#11401: Load data infile 'REPLACE INTO' fails on slave.
+#
+connection master;
+CREATE TABLE t4 (
+ id INT(5) unsigned NOT NULL auto_increment,
+ name varchar(15) NOT NULL default '',
+ number varchar(35) NOT NULL default 'default',
+ PRIMARY KEY (id),
+ UNIQUE KEY unique_rec (name,number)
+) ENGINE=InnoDB;
+
+--disable_warnings
+LOAD DATA
+ INFILE '../std_data_ln/loaddata_pair.dat'
+ REPLACE INTO TABLE t4
+ (name,number);
+--enable_warnings
+SELECT * FROM t4;
+
+sync_slave_with_master;
+SELECT * FROM t4;
+
+connection master;
+--disable_warnings
+LOAD DATA
+ INFILE '../std_data_ln/loaddata_pair.dat'
+ REPLACE INTO TABLE t4
+ (name,number);
+--enable_warnings
+SELECT * FROM t4;
+
+sync_slave_with_master;
+SELECT * FROM t4;
+
+connection master;
+--disable_query_log
+DROP TABLE t4;
+--enable_query_log
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_insert.test b/mysql-test/suite/rpl/t/rpl_insert.test
new file mode 100644
index 00000000000..0d471a0e0a9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_insert.test
@@ -0,0 +1,44 @@
+--echo #
+--echo # Bug#20821: INSERT DELAYED fails to write some rows to binlog
+--echo #
+
+--source include/master-slave.inc
+--source include/not_embedded.inc
+--source include/not_windows.inc
+
+--disable_warnings
+CREATE SCHEMA IF NOT EXISTS mysqlslap;
+USE mysqlslap;
+--enable_warnings
+
+CREATE TABLE t1 (id INT, name VARCHAR(64));
+
+let $query = "INSERT DELAYED INTO t1 VALUES (1, 'Dr. No'), (2, 'From Russia With Love'), (3, 'Goldfinger'), (4, 'Thunderball'), (5, 'You Only Live Twice')";
+--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";"
+
+# Wait until all the 5000 inserts has been inserted into the table
+--disable_query_log
+let $counter= 300; # Max 30 seconds wait
+while (`select count(*)!=5000 from mysqlslap.t1`)
+{
+ sleep 0.1;
+ dec $counter;
+ if (!$counter)
+ {
+ Number of records in t1 didnt reach 5000;
+ }
+}
+--enable_query_log
+
+SELECT COUNT(*) FROM mysqlslap.t1;
+sync_slave_with_master;
+SELECT COUNT(*) FROM mysqlslap.t1;
+
+--echo #
+--echo # Cleanup
+--echo #
+
+connection master;
+USE test;
+DROP SCHEMA mysqlslap;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_insert_id-slave.opt b/mysql-test/suite/rpl/t/rpl_insert_id-slave.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_insert_id-slave.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_insert_id.test b/mysql-test/suite/rpl/t/rpl_insert_id.test
new file mode 100644
index 00000000000..bfd66431d3c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_insert_id.test
@@ -0,0 +1,11 @@
+#################################
+# 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;
+-- source extra/rpl_tests/rpl_insert_id.test
diff --git a/mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt b/mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_insert_id_pk.test b/mysql-test/suite/rpl/t/rpl_insert_id_pk.test
new file mode 100644
index 00000000000..01f30b78ac5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_insert_id_pk.test
@@ -0,0 +1,11 @@
+#################################
+# 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;
+-- source extra/rpl_tests/rpl_insert_id_pk.test
diff --git a/mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt b/mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_insert_ignore.test b/mysql-test/suite/rpl/t/rpl_insert_ignore.test
new file mode 100644
index 00000000000..dc8994b82f3
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_insert_ignore.test
@@ -0,0 +1,8 @@
+#####################################
+# Wrapper for rpl_insert_ignore.test#
+#####################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+let $engine_type2=myisam;
+-- source extra/rpl_tests/rpl_insert_ignore.test
diff --git a/mysql-test/suite/rpl/t/rpl_insert_select.test b/mysql-test/suite/rpl/t/rpl_insert_select.test
new file mode 100644
index 00000000000..677be526982
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_insert_select.test
@@ -0,0 +1,19 @@
+# Testcase for BUG#10456 - INSERT INTO ... SELECT violating a primary key
+# breaks replication
+
+-- source include/master-slave.inc
+connection master;
+
+create table t1 (n int not null primary key);
+insert into t1 values (1);
+create table t2 (n int);
+insert into t2 values (1);
+insert ignore into t1 select * from t2;
+insert into t1 values (2);
+sync_slave_with_master;
+connection slave;
+select * from t1;
+
+connection master;
+drop table t1,t2;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_known_bugs_detection-master.opt b/mysql-test/suite/rpl/t/rpl_known_bugs_detection-master.opt
new file mode 100644
index 00000000000..d4ba386a1a0
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_known_bugs_detection-master.opt
@@ -0,0 +1 @@
+--loose-debug=d,pretend_version_50034_in_binlog
diff --git a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
new file mode 100644
index 00000000000..b300603f454
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
@@ -0,0 +1,93 @@
+# Test to see if slave can detect certain known bugs present
+# on the master, and appropriately decides to stop
+# (assuming the bug is fixed in the slave, slave cannot of course
+# imitate the bug, so it has to stop).
+
+source include/have_debug.inc;
+source include/master-slave.inc;
+
+# Currently only statement-based-specific bugs are here
+-- source include/have_binlog_format_mixed_or_statement.inc
+
+#
+# This is to test that slave properly detects if
+# master may suffer from:
+# BUG#24432 "INSERT... ON DUPLICATE KEY UPDATE skips auto_increment values"
+# (i.e. on master, INSERT ON DUPLICATE KEY UPDATE is used and manipulates
+# an auto_increment column, and is binlogged statement-based).
+#
+
+# testcase with INSERT VALUES
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
+UNIQUE(b));
+sync_slave_with_master;
+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
+--replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
+--query_vertical show slave status;
+# show that it was not replicated
+SELECT * FROM t1;
+
+# restart replication for the next testcase
+stop slave;
+reset slave;
+connection master;
+reset master;
+drop table t1;
+connection slave;
+start slave;
+
+# testcase with INSERT SELECT
+connection master;
+CREATE TABLE t1 (
+ id bigint(20) unsigned NOT NULL auto_increment,
+ field_1 int(10) unsigned NOT NULL,
+ field_2 varchar(255) NOT NULL,
+ field_3 varchar(255) NOT NULL,
+ PRIMARY KEY (id),
+ UNIQUE KEY field_1 (field_1, field_2)
+);
+CREATE TABLE t2 (
+ field_a int(10) unsigned NOT NULL,
+ field_b varchar(255) NOT NULL,
+ field_c varchar(255) NOT NULL
+);
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (1, 'a', '1a');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (2, 'b', '2b');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (4, 'd', '4d');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (5, 'e', '5e');
+sync_slave_with_master;
+connection master;
+# Updating table t1 based on values from table t2
+INSERT INTO t1 (field_1, field_2, field_3)
+SELECT t2.field_a, t2.field_b, t2.field_c
+FROM t2
+ON DUPLICATE KEY UPDATE
+t1.field_3 = t2.field_c;
+# Inserting new record into t2
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f');
+# Updating t1 again
+INSERT INTO t1 (field_1, field_2, field_3)
+SELECT t2.field_a, t2.field_b, t2.field_c
+FROM t2
+ON DUPLICATE KEY UPDATE
+t1.field_3 = t2.field_c;
+SELECT * FROM t1;
+connection slave;
+--source include/wait_for_slave_sql_to_stop.inc
+# show the error message
+--replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
+--query_vertical show slave status;
+# show that it was not replicated
+SELECT * FROM t1;
+connection master;
+drop table t1, t2;
+connection slave;
+drop table t1, t2;
+
+# End of 5.0 tests
diff --git a/mysql-test/suite/rpl/t/rpl_load_from_master-slave.opt b/mysql-test/suite/rpl/t/rpl_load_from_master-slave.opt
new file mode 100644
index 00000000000..c015c02ba78
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_load_from_master-slave.opt
@@ -0,0 +1 @@
+--replicate-wild-do-table=mysqltest.%
diff --git a/mysql-test/suite/rpl/t/rpl_load_from_master.test b/mysql-test/suite/rpl/t/rpl_load_from_master.test
new file mode 100644
index 00000000000..9bab7d5696e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_load_from_master.test
@@ -0,0 +1,180 @@
+# This one assumes we are ignoring updates on tables in database mysqltest2,
+# but doing the ones in database mysqltest
+#################################################################
+# Change Author: JBM
+# Change Date: 2006-02-02
+# Change: Added ENGINE=MyISAM
+# Reason: LOAD from master is only supported by MyISAM
+#################################################################
+
+source include/master-slave.inc;
+--disable_warnings
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+connection slave;
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+connection master;
+create database mysqltest2;
+create database mysqltest;
+--enable_warnings
+
+save_master_pos;
+connection slave;
+sync_with_master;
+create database mysqltest2;
+create table mysqltest2.foo (n int)ENGINE=MyISAM;
+insert into mysqltest2.foo values(4);
+connection master;
+create table mysqltest2.foo (n int)ENGINE=MyISAM;
+insert into mysqltest2.foo values(5);
+create table mysqltest.bar (m int)ENGINE=MyISAM;
+insert into mysqltest.bar values(15);
+save_master_pos;
+connection slave;
+sync_with_master;
+select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
+connection master;
+drop database mysqltest;
+drop database if exists mysqltest2;
+save_master_pos;
+connection slave;
+sync_with_master;
+--error 1008
+drop database mysqltest;
+drop database mysqltest2;
+
+# Now let's test load data from master
+
+# First create some databases and tables on the master
+
+connection master;
+set sql_log_bin = 0;
+create database mysqltest2;
+create database mysqltest;
+show databases;
+create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
+create table mysqltest2.t2(n int, s text)ENGINE=MyISAM;
+insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
+insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
+
+create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
+create table mysqltest.t2(n int, s text)ENGINE=MyISAM;
+insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
+insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
+ (13, 'thirteen test');
+set sql_log_bin = 1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# This should show that the slave is empty at this point
+show databases;
+# Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM
+# MASTER will neither touch database mysqltest nor mysqltest3
+create database mysqltest2;
+create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
+insert into mysqltest2.t1 values (1, 'original foo.t1');
+create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM;
+insert into mysqltest2.t3 values (1, 'original foo.t3');
+create database mysqltest3;
+create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM;
+insert into mysqltest3.t1 values (1, 'original foo2.t1');
+
+# Create mysqltest, and mysqltest.t1, to check that it gets replaced,
+# and mysqltest.t3 to check that it is not touched (there is no
+# mysqltest.t3 on master)
+create database mysqltest;
+create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
+insert into mysqltest.t1 values (1, 'original bar.t1');
+create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM;
+insert into mysqltest.t3 values (1, 'original bar.t3');
+
+load data from master;
+
+# Now let's check if we have the right tables and the right data in them
+show databases;
+use mysqltest2;
+
+# LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which
+# databases have to be copied. So it thinks "mysqltest" has to be
+# copied. Before 4.0.16 it would first drop "mysqltest", then create
+# "mysqltest". This "drop" is a bug; in that case t3 would disappear. So
+# here the effect of this bug (BUG#1248) would be to leave an empty
+# "mysqltest" on the slave.
+
+show tables; # should be t1 & t3
+select * from t1; # should be slave's original
+use mysqltest3;
+show tables; # should be t1
+select * from t1; # should be slave's original
+use mysqltest;
+show tables; # should contain master's copied t1&t2, slave's original t3
+select * from mysqltest.t1;
+select * from mysqltest.t2;
+select * from mysqltest.t3;
+
+# Now let's see if replication works
+connection master;
+insert into mysqltest.t1 values (4, 'four test');
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from mysqltest.t1;
+
+# Check that LOAD DATA FROM MASTER is able to create master.info
+# if needed (if RESET SLAVE was used before), before writing to it (BUG#2922).
+
+stop slave;
+reset slave;
+load data from master;
+start slave;
+# see if replication coordinates were restored fine
+connection master;
+insert into mysqltest.t1 values (5, 'five bar');
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from mysqltest.t1;
+
+# Check that LOAD DATA FROM MASTER reports the error if it can't drop a
+# table to be overwritten.
+# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
+# insert into mysqltest.t1 values(10, 'should be there');
+# flush tables;
+# system chmod 500 $MYSQLTEST_VARDIR/slave-data/mysqltest/;
+# --error 6
+# load data from master; # should fail (errno 13)
+# system chmod 700 $MYSQLTEST_VARDIR/slave-data/mysqltest/;
+# select * from mysqltest.t1; # should contain the row (10, ...)
+
+
+# Check that LOAD TABLE FROM MASTER fails if the table exists on slave
+--error 1050
+load table mysqltest.t1 from master;
+drop table mysqltest.t1;
+load table mysqltest.t1 from master;
+
+# Check what happens when requestion not existing table
+#
+--error 1188
+load table bar.t1 from master;
+
+# as LOAD DATA FROM MASTER failed it did not restart slave threads
+# DISABLED FOR NOW
+# start slave;
+
+# Now time for cleanup
+connection master;
+drop database mysqltest;
+drop database mysqltest2;
+save_master_pos;
+connection slave;
+sync_with_master;
+# These have to be dropped on slave because they are not replicated
+drop database mysqltest2;
+drop database mysqltest3;
+
+# End of 4.1 tests
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
new file mode 100644
index 00000000000..b9cec3858a9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
@@ -0,0 +1,98 @@
+###########################################################
+# Change Author: JBM
+# Change Date: 2006-2-2
+# Change: Added ENGINE=$engine_type for first create table
+# Reason: Only MyISAM supports load from master no need to
+# run test case for other engines, in addition test will
+# fail if other engines are set as default engine
+###########################################################
+# Change Author: JBM
+# Change Date: 2006-2-3
+# Change: removed ENGINE=$engine_type for first create table
+# and renamed test file to rpl_load_table_from_master.test.
+# In addition added test requirements.
+# Reason: Request from review.
+############################################################
+# REQUIREMENT TEST 1:
+# LOAD TABLE FROM MASTER must work with a forced timestamp.
+############################################################
+#
+# Test forced timestamp
+#
+-- source include/master-slave.inc
+
+-- echo "******************** Test Requirment 1 *************"
+
+# Don't log table creating to the slave as we want to test LOAD TABLE
+SET SQL_LOG_BIN=0,timestamp=200006;
+eval CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM;
+INSERT INTO t1 ( a) VALUE ('F');
+select unix_timestamp(t) from t1;
+connection slave;
+load table t1 from master;
+select unix_timestamp(t) from t1;
+
+# Delete the created table on master and slave
+connection master;
+set SQL_LOG_BIN=1,timestamp=default;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+connection master;
+
+#
+# Test copying table with checksum
+#
+
+# Don't log table creating to the slave as we want to test LOAD TABLE
+set SQL_LOG_BIN=0;
+
+#######################################################
+# REQUIREMENTi TEST 2:
+#LOAD TABLE FROM MASTER must work with table checksum
+#######################################################
+-- echo "******************** Test Requirment 2 *************"
+
+eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
+INSERT INTO t1 VALUES (1);
+save_master_pos;
+connection slave;
+sync_with_master;
+load table t1 from master;
+check table t1;
+drop table t1;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+connection master;
+set SQL_LOG_BIN=0;
+create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t1;
+create table t2 (word char(20) not null)ENGINE=MyISAM;
+load data infile '../std_data_ln/words.dat' into table t2;
+create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
+connection slave;
+load table t1 from master;
+load table t2 from master;
+load table t3 from master;
+check table t1;
+select count(*) from t2;
+select count(*) from t3;
+connection master;
+set SQL_LOG_BIN=1;
+drop table if exists t1,t2,t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+create table t1(n int);
+drop table t1;
+
+
+
+
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata.test b/mysql-test/suite/rpl/t/rpl_loaddata.test
new file mode 100644
index 00000000000..6f9ee4ef80a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_loaddata.test
@@ -0,0 +1,7 @@
+########################################################
+# 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
new file mode 100644
index 00000000000..7f2389cb9f6
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
@@ -0,0 +1,33 @@
+#
+# Check LOAD DATA + character sets + replication
+#
+source include/master-slave.inc;
+
+#
+# Bug#15126 character_set_database is not replicated
+# (LOAD DATA INFILE need it)
+#
+connection master;
+create table t1 (a varchar(10) character set utf8);
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+set @@character_set_database=koi8r;
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+set @@character_set_database=DEFAULT;
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+set @@character_set_database=koi8r;
+load data infile '../std_data_ln/loaddata6.dat' into table t1;
+set @@character_set_database=DEFAULT;
+load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
+
+select hex(a) from t1;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+
+select hex(a) from t1;
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_m-master.opt b/mysql-test/suite/rpl/t/rpl_loaddata_m-master.opt
new file mode 100644
index 00000000000..9d4a8f0b95e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_m-master.opt
@@ -0,0 +1 @@
+--binlog_ignore_db=test
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_m.test b/mysql-test/suite/rpl/t/rpl_loaddata_m.test
new file mode 100644
index 00000000000..537d4c163ef
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_m.test
@@ -0,0 +1,52 @@
+# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
+# exist.
+# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
+######################################################
+# Change Author: JBM
+# Change Date: 2005-12-22
+# Change: Test rewritten to remove show binlog events
+# and to test the option better + Cleanup
+######################################################
+-- source include/master-slave.inc
+
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+
+connection master;
+# 'test' database should be ignored by the slave
+USE test;
+CREATE TABLE t1(a INT, b INT, UNIQUE(b));
+LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE test.t1;
+SELECT COUNT(*) FROM test.t1;
+
+# 'mysqltest' database should NOT be ignored by the slave
+CREATE DATABASE mysqltest;
+USE mysqltest;
+CREATE TABLE t1(a INT, b INT, UNIQUE(b));
+LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
+SELECT COUNT(*) FROM mysqltest.t1;
+
+# Now lets check the slave to see what we have :-)
+save_master_pos;
+connection slave;
+sync_with_master;
+
+SHOW DATABASES;
+
+USE test;
+SHOW TABLES;
+
+USE mysqltest;
+SHOW TABLES;
+SELECT COUNT(*) FROM mysqltest.t1;
+
+#show binlog events;
+
+# Cleanup
+connection master;
+DROP DATABASE mysqltest;
+DROP TABLE test.t1;
+sync_slave_with_master;
+
+# End of test
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_s-slave.opt b/mysql-test/suite/rpl/t/rpl_loaddata_s-slave.opt
new file mode 100644
index 00000000000..9d4a8f0b95e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_s-slave.opt
@@ -0,0 +1 @@
+--binlog_ignore_db=test
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_s.test b/mysql-test/suite/rpl/t/rpl_loaddata_s.test
new file mode 100644
index 00000000000..f397d741310
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_s.test
@@ -0,0 +1,28 @@
+# See if the slave logs (in its own binlog, with --log-slave-updates) a
+# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules.
+# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
+
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
+connection slave;
+# Not sure why we connect to slave and then try to reset master, but I will leave it [JBM]
+reset master;
+
+connection master;
+# 'test' is the current database
+create table test.t1(a int, b int, unique(b));
+load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
+
+# Test logging on slave;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+select count(*) from test.t1; # check that LOAD was replicated
+source include/show_binlog_events.inc;
+
+# Cleanup
+connection master;
+drop table test.t1;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_simple.test b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test
new file mode 100644
index 00000000000..9e908cac677
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test
@@ -0,0 +1,14 @@
+--source include/master-slave.inc
+
+CREATE TABLE t1 (word CHAR(20) NOT NULL);
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+SELECT * FROM t1 ORDER BY word;
+sync_slave_with_master;
+
+# Check
+SELECT * FROM t1 ORDER BY word;
+
+# Cleanup
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
new file mode 100644
index 00000000000..b10603e7195
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
@@ -0,0 +1,65 @@
+# See if "LOAD DATA LOCAL INFILE" is well replicated
+# (LOAD DATA LOCAL INFILE is not written to the binlog
+# the same way as LOAD DATA INFILE : Append_blocks are smaller).
+# In MySQL 4.0 <4.0.12 there were 2 bugs with LOAD DATA LOCAL INFILE :
+# - the loaded file was not written entirely to the master's binlog,
+# only the first 4KB, 8KB or 16KB usually.
+# - the loaded file's first line was not written entirely to the
+# master's binlog (1st char was absent)
+source include/master-slave.inc;
+
+create table t1(a int);
+let $1=10000;
+disable_query_log;
+set SQL_LOG_BIN=0;
+while ($1)
+{
+ insert into t1 values(1);
+ dec $1;
+}
+set SQL_LOG_BIN=1;
+enable_query_log;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
+#This will generate a 20KB file, now test LOAD DATA LOCAL
+truncate table t1;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
+save_master_pos;
+connection slave;
+sync_with_master;
+select a,count(*) from t1 group by a;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
+
+#
+# Now let us test how well we replicate LOAD DATA LOCAL in situation when
+# we met duplicates in tables to which we are adding rows.
+# (It supposed that LOAD DATA LOCAL ignores such errors)
+#
+connection master;
+create table t1(a int);
+insert into t1 values (1), (2), (2), (3);
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
+drop table t1;
+create table t1(a int primary key);
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
+SELECT * FROM t1 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM t1 ORDER BY a;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test
new file mode 100644
index 00000000000..a671bab15bb
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_loadfile.test
@@ -0,0 +1,52 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+#############################################################################
+# TEST: To test the LOAD_FILE() in rbr #
+#############################################################################
+# Change Author: JBM
+# Change Date: 2006-01-16
+# Change: Added Order by for NDB
+##########
+
+# Includes
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+--disable_warnings
+connection master;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+--enable_warnings
+
+# Section 1 test
+
+CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES(1,'test');
+UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1;
+delimiter |;
+create procedure test.p1()
+begin
+ INSERT INTO test.t1 VALUES(2,'test');
+ UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2;
+end|
+delimiter ;|
+
+CALL test.p1();
+SELECT * FROM test.t1 ORDER BY blob_column;
+save_master_pos;
+# Need to allow some time when NDB engine is used for
+# the injector thread to have time to populate binlog
+sleep 10;
+sync_slave_with_master;
+connection slave;
+SELECT * FROM test.t1 ORDER BY blob_column;
+
+# Cleanup
+connection master;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE test.t1;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_locale.test b/mysql-test/suite/rpl/t/rpl_locale.test
new file mode 100644
index 00000000000..2f2d637e1b4
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_locale.test
@@ -0,0 +1,24 @@
+# Replication of locale variables
+
+source include/master-slave.inc;
+
+#
+# Bug#22645 LC_TIME_NAMES: Statement not replicated
+#
+connection master;
+create table t1 (s1 char(10));
+set lc_time_names= 'de_DE';
+insert into t1 values (date_format('2001-01-01','%W'));
+set lc_time_names= 'en_US';
+insert into t1 values (date_format('2001-01-01','%W'));
+select * from t1;
+sync_slave_with_master;
+connection slave;
+select * from t1;
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+# End of 4.1 tests
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test
new file mode 100644
index 00000000000..2c6c1d9868d
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_log_pos.test
@@ -0,0 +1,57 @@
+##########
+# Change Author: JBM
+# Change Date: 2006-01-16
+# Change: Added Order by for NDB
+##########
+
+#
+# Testing of setting slave to wrong log position with master_log_pos
+#
+
+# Passes with rbr no problem, removed statement include [jbm]
+
+source include/master-slave.inc;
+--replace_column 3 <Binlog_Ignore_DB>
+show master status;
+sync_slave_with_master;
+
+stop slave;
+--source include/wait_for_slave_to_stop.inc
+
+change master to master_log_pos=75;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+query_vertical show slave status;
+
+start slave;
+let $slave_param= Slave_SQL_Running;
+let $slave_param_value= Yes;
+--source include/wait_for_slave_param.inc
+let $slave_param= Slave_IO_Running;
+let $slave_param_value= No;
+--source include/wait_for_slave_param.inc
+stop slave;
+--source include/wait_for_slave_to_stop.inc
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+query_vertical show slave status;
+
+connection master;
+--replace_column 3 <Binlog_Ignore_DB>
+show master status;
+create table if not exists t1 (n int);
+drop table if exists t1;
+create table t1 (n int);
+insert into t1 values (1),(2),(3);
+save_master_pos;
+connection slave;
+change master to master_log_pos=106;
+start slave;
+sync_with_master;
+select * from t1 ORDER BY n;
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/suite/rpl/t/rpl_many_optimize.test b/mysql-test/suite/rpl/t/rpl_many_optimize.test
new file mode 100644
index 00000000000..91fab0b27a8
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_many_optimize.test
@@ -0,0 +1,22 @@
+# Test for BUG#7658 "optimize crashes slave thread (1 in 1000)]"
+
+source include/master-slave.inc;
+
+create table t1 (a int not null auto_increment primary key, b int, key(b));
+INSERT INTO t1 (a) VALUES (1),(2);
+# Now many OPTIMIZE to test if we crash (BUG#7658)
+let $1=300;
+disable_query_log;
+disable_result_log;
+while ($1)
+{
+ eval OPTIMIZE TABLE t1;
+ dec $1;
+}
+enable_result_log;
+enable_query_log;
+drop table t1;
+# Bug was that slave segfaulted after ~ a hundred of OPTIMIZE (or ANALYZE)
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
new file mode 100644
index 00000000000..893c8746efc
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
@@ -0,0 +1,18 @@
+# See if master_pos_wait(,,timeout)
+# Terminates with "timeout expired" (-1)
+source include/master-slave.inc;
+save_master_pos;
+connection slave;
+sync_with_master;
+# Ask for a master log that has certainly not been reached yet
+# timeout= 2 seconds
+select master_pos_wait('master-bin.999999',0,2);
+explain extended select master_pos_wait('master-bin.999999',0,2);
+# Testcase for bug 651 (master_pos_wait() hangs if slave idle and STOP SLAVE).
+send select master_pos_wait('master-bin.999999',0);
+connection slave1;
+stop slave sql_thread;
+connection slave;
+reap;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh b/mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh
new file mode 100755
index 00000000000..8ce79797822
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh
@@ -0,0 +1 @@
+rm -f $MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile
diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions.test b/mysql-test/suite/rpl/t/rpl_misc_functions.test
new file mode 100644
index 00000000000..db9b557baad
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_misc_functions.test
@@ -0,0 +1,103 @@
+#
+# Test of replicating some difficult functions
+#
+source include/master-slave.inc;
+
+create table t1(id int, i int, r1 int, r2 int, p varchar(100));
+insert into t1 values(1, connection_id(), 0, 0, "");
+# don't put rand and password in the same query, to see if they replicate
+# independently
+# Pure rand test
+insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
+# change the rand suite on the master (we do this because otherwise password()
+# benefits from the fact that the above rand() is well replicated :
+# it picks the same sequence element, which hides a possible bug in password() replication.
+set sql_log_bin=0;
+insert into t1 values(6, 0, rand(), rand(), "");
+delete from t1 where id=6;
+set sql_log_bin=1;
+# Pure password test
+insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
+# "altogether now"
+insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
+select * into outfile 'rpl_misc_functions.outfile' from t1;
+sync_slave_with_master;
+create table t2 like t1;
+# read the values from the master table
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval load data local infile '$MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2;
+# compare them with the replica; the SELECT below should return no row
+select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
+
+connection master;
+drop table t1;
+
+# End of 4.1 tests
+
+#
+# BUG#25543 test calling rand() multiple times on the master in
+# a stored procedure.
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (col_a double default NULL);
+
+DELIMITER |;
+
+# Use a SP that calls rand() multiple times
+CREATE PROCEDURE test_replication_sp1()
+BEGIN
+ INSERT INTO t1 VALUES (rand()), (rand());
+ INSERT INTO t1 VALUES (rand());
+END|
+
+# Use a SP that calls another SP to call rand() multiple times
+CREATE PROCEDURE test_replication_sp2()
+BEGIN
+ CALL test_replication_sp1();
+ CALL test_replication_sp1();
+END|
+
+# Use a SF that calls rand() multiple times
+CREATE FUNCTION test_replication_sf() RETURNS DOUBLE DETERMINISTIC
+BEGIN
+ RETURN (rand() + rand());
+END|
+
+DELIMITER ;|
+
+# Exercise the functions and procedures then compare the results on
+# the master to those on the slave.
+CALL test_replication_sp1();
+CALL test_replication_sp2();
+INSERT INTO t1 VALUES (test_replication_sf());
+INSERT INTO t1 VALUES (test_replication_sf());
+INSERT INTO t1 VALUES (test_replication_sf());
+
+# Record the results of the query on the master
+--exec $MYSQL --port=$MASTER_MYPORT test -e "SELECT * FROM test.t1" > $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql
+
+--sync_slave_with_master
+
+# Record the results of the query on the slave
+--exec $MYSQL --port=$SLAVE_MYPORT test -e "SELECT * FROM test.t1" > $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
+
+# Compare the results from the master to the slave.
+--exec diff $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
+
+# Cleanup
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test_replication_sp1;
+DROP PROCEDURE IF EXISTS test_replication_sp2;
+DROP FUNCTION IF EXISTS test_replication_sf;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+--sync_slave_with_master
+
+# If all is good, when can cleanup our dump files.
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
diff --git a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test
new file mode 100644
index 00000000000..6a1f81abed3
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test
@@ -0,0 +1,46 @@
+# Mixed DDL-DML (CREATE ... SELECT ...) statements can only be
+# replicated properly in statement-based replication.
+# Currently statement based due to bug 12345
+--source include/have_binlog_format_mixed_or_statement.inc
+
+source include/master-slave.inc;
+
+# Test replication of auto_increment
+
+create table t1 (n int auto_increment primary key);
+set insert_id = 2000;
+insert into t1 values (NULL),(NULL),(NULL);
+sync_slave_with_master;
+select * from t1;
+connection master;
+--replace_result $SLAVE_MYPORT 9999
+show slave hosts;
+drop table t1;
+sync_slave_with_master;
+stop slave;
+connection master;
+
+# Test replication of timestamp
+
+create table t2(id int auto_increment primary key, created datetime);
+set timestamp=12345;
+insert into t2 set created=now();
+select * from t2;
+
+# Test replication of CREATE .. LIKE (Bug #2557)
+
+create table t3 like t2;
+create temporary table t4 like t2;
+create table t5 select * from t4;
+save_master_pos;
+connection slave;
+start slave;
+sync_with_master;
+select * from t2;
+show create table t3;
+show create table t5;
+connection master;
+drop table t2,t3,t5;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete-slave.opt b/mysql-test/suite/rpl/t/rpl_multi_delete-slave.opt
new file mode 100644
index 00000000000..c98fe0b0a46
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_delete-slave.opt
@@ -0,0 +1 @@
+--replicate-wild-do-table=test.%
diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete.test b/mysql-test/suite/rpl/t/rpl_multi_delete.test
new file mode 100644
index 00000000000..a251cbf8833
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_delete.test
@@ -0,0 +1,26 @@
+source include/master-slave.inc;
+create table t1 (a int primary key);
+create table t2 (a int);
+
+insert into t1 values (1);
+insert into t2 values (1);
+
+
+delete t1.* from t1, t2 where t1.a = t2.a;
+
+save_master_pos;
+select * from t1;
+select * from t2;
+
+connection slave;
+sync_with_master;
+select * from t1;
+select * from t2;
+
+connection master;
+drop table t1,t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete2-slave.opt b/mysql-test/suite/rpl/t/rpl_multi_delete2-slave.opt
new file mode 100644
index 00000000000..0febb2891b1
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_delete2-slave.opt
@@ -0,0 +1 @@
+"--replicate-rewrite-db=mysqltest_from->mysqltest_to" --replicate-do-table=mysqltest_to.a
diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete2.test b/mysql-test/suite/rpl/t/rpl_multi_delete2.test
new file mode 100644
index 00000000000..81379d4056b
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_delete2.test
@@ -0,0 +1,68 @@
+#multi delete replication bugs
+
+
+source include/master-slave.inc;
+
+#BUG#11139 - improper wild-table and table rules
+#checking for multi deletes with an alias
+
+connection master;
+set sql_log_bin=0;
+create database mysqltest_from;
+set sql_log_bin=1;
+
+connection slave;
+create database mysqltest_to;
+
+
+connection master;
+use mysqltest_from;
+--disable_warnings
+drop table if exists a;
+--enable_warnings
+CREATE TABLE a (i INT);
+INSERT INTO a VALUES(1);
+DELETE alias FROM a alias WHERE alias.i=1;
+SELECT * FROM a;
+insert into a values(2),(3);
+delete a alias FROM a alias where alias.i=2;
+select * from a;
+save_master_pos;
+connection slave;
+
+use mysqltest_to;
+sync_with_master;
+select * from a;
+
+# BUG#3461
+connection master;
+create table t1 (a int primary key);
+create table t2 (a int);
+
+insert into t1 values (1);
+insert into t2 values (1);
+
+delete t1.* from t1, t2 where t1.a = t2.a;
+
+save_master_pos;
+select * from t1;
+select * from t2;
+
+connection slave;
+# BUG#3461 would cause sync to fail
+sync_with_master;
+error 1146;
+select * from t1;
+error 1146;
+select * from t2;
+
+# cleanup
+connection master;
+set sql_log_bin=0;
+drop database mysqltest_from;
+set sql_log_bin=1;
+connection slave;
+drop database mysqltest_to;
+
+# End of 4.1 tests
+
diff --git a/mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt b/mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_multi_engine.test b/mysql-test/suite/rpl/t/rpl_multi_engine.test
new file mode 100644
index 00000000000..10780c765f7
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_engine.test
@@ -0,0 +1,108 @@
+# See if replication between MyISAM, MEMORY and InnoDB works.
+
+#This test case is not written for NDB, result files do not
+#match when NDB is the default engine
+-- source include/not_ndb_default.inc
+
+-- source include/master-slave.inc
+
+connection slave;
+-- source include/have_innodb.inc
+
+connection master;
+-- source include/have_innodb.inc
+--disable_warnings
+create database if not exists mysqltest1;
+use mysqltest1;
+drop table if exists t1;
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc
+VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT
+0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+
+sync_slave_with_master;
+use mysqltest1;
+
+# MyISAM to MyISAM then InnoDB then MEMORY
+
+connection master;
+alter table t1 engine=myisam;
+show create table t1;
+sync_slave_with_master;
+
+connection slave;
+alter table t1 engine=myisam;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=innodb;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=memory;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+# MEMORY to ...
+
+connection master;
+alter table t1 engine=memory;
+show create table t1;
+sync_slave_with_master;
+
+connection slave;
+alter table t1 engine=myisam;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=innodb;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=memory;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+# InnoDB to ...
+
+connection master;
+alter table t1 engine=innodb;
+show create table t1;
+sync_slave_with_master;
+
+connection slave;
+alter table t1 engine=myisam;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=innodb;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+connection slave;
+alter table t1 engine=memory;
+show create table t1;
+
+--source include/rpl_multi_engine.inc
+
+# cleanup
+connection master;
+DROP TABLE t1;
+# Need to drop mysqltest1 as well so other test will pass.
+DROP DATABASE mysqltest1;
+sync_slave_with_master;
+
+# End of 5.1 test case
diff --git a/mysql-test/suite/rpl/t/rpl_multi_update.test b/mysql-test/suite/rpl/t/rpl_multi_update.test
new file mode 100644
index 00000000000..a6111455d16
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_update.test
@@ -0,0 +1,7 @@
+########################################################
+# 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-slave.opt b/mysql-test/suite/rpl/t/rpl_multi_update2-slave.opt
new file mode 100644
index 00000000000..17d4171af0e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_update2-slave.opt
@@ -0,0 +1 @@
+--replicate-ignore-table=nothing.sensible
diff --git a/mysql-test/suite/rpl/t/rpl_multi_update2.test b/mysql-test/suite/rpl/t/rpl_multi_update2.test
new file mode 100644
index 00000000000..7401786501e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_update2.test
@@ -0,0 +1,9 @@
+#######################################################
+# Wrapper for rpl_multi_update2.test to allow multi #
+# Engines to reuse test code. By JBM 2006-02-15 #
+# Added comments section and to skip when ndb is #
+# Default engine. #
+#######################################################
+--source include/not_ndb_default.inc
+let $engine_type=MyISAM;
+--source extra/rpl_tests/rpl_multi_update2.test
diff --git a/mysql-test/suite/rpl/t/rpl_multi_update3.test b/mysql-test/suite/rpl/t/rpl_multi_update3.test
new file mode 100644
index 00000000000..438a644729c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_update3.test
@@ -0,0 +1,9 @@
+#######################################################
+# Wrapper for rpl_multi_update3.test to allow multi #
+# Engines to reuse test code. By JBM 2006-02-15 #
+# Added comments section and to skip when ndb is #
+# Default engine. #
+#######################################################
+--source include/not_ndb_default.inc
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_multi_update3.test
diff --git a/mysql-test/suite/rpl/t/rpl_multi_update4-slave.opt b/mysql-test/suite/rpl/t/rpl_multi_update4-slave.opt
new file mode 100644
index 00000000000..fea27db43ee
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_update4-slave.opt
@@ -0,0 +1 @@
+--replicate-wild-do-table=d1.%
diff --git a/mysql-test/suite/rpl/t/rpl_multi_update4.test b/mysql-test/suite/rpl/t/rpl_multi_update4.test
new file mode 100644
index 00000000000..4991a385f6f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_multi_update4.test
@@ -0,0 +1,45 @@
+# Let's verify that multi-update is not always skipped by slave if
+# some replicate-* rules exist.
+# (BUG#15699)
+
+source include/master-slave.inc;
+
+### Clean-up
+
+connection master;
+--disable_warnings
+drop database if exists d1;
+drop database if exists d2;
+
+connection slave;
+drop database if exists d2;
+--enable_warnings
+
+### Do on master
+
+connection master;
+create database d1; # accepted by slave
+create table d1.t0 (id int);
+create database d2; # ignored by slave
+use d2;
+create table t1 (id int);
+create table t2 (id int);
+insert into t1 values (1), (2), (3), (4), (5);
+insert into t2 select id + 3 from t1;
+# a problematic query which must be filter out by slave
+update t1 join t2 using (id) set t1.id = 0;
+insert into d1.t0 values (0); # replication works
+
+### Check on slave
+
+sync_slave_with_master;
+use d1;
+select * from t0 where id=0; # must find
+
+### Clean-up
+connection master;
+drop database d1;
+drop database d2;
+sync_slave_with_master;
+
+# End of test
diff --git a/mysql-test/suite/rpl/t/rpl_optimize.test b/mysql-test/suite/rpl/t/rpl_optimize.test
new file mode 100644
index 00000000000..80f0c052fc8
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_optimize.test
@@ -0,0 +1,54 @@
+# Test for BUG#1858 "OPTIMIZE TABLE done by a client
+# thread stops the slave SQL thread".
+# You can replace OPTIMIZE by REPAIR.
+#####################################
+# Change Author: JBM
+# Change Date: 2006-02-09
+# Change: NDB does not and will not support
+# OPTIMIZE for memory tables. If and when
+# it does support for Disk Data, a new
+# version of this test will be need.
+# Skipping this test if default engine = ndb
+#####################################
+-- source include/not_ndb_default.inc
+-- source include/master-slave.inc
+
+create table t1 (a int not null auto_increment primary key, b int, key(b));
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+save_master_pos;
+# a few updates to force OPTIMIZE to do something
+update t1 set b=(a/2*rand());
+delete from t1 order by b limit 10000;
+
+connection slave;
+sync_with_master;
+optimize table t1;
+connection master;
+save_master_pos;
+connection slave;
+# Bug was that when the INSERT terminated on slave,
+# the slave SQL thread got killed by OPTIMIZE.
+sync_with_master; # won't work if slave SQL thread stopped
+
+connection master; # cleanup
+drop table t1;
+connection slave;
+sync_with_master;
+
+# If the machine is so fast that slave syncs before OPTIMIZE
+# starts, this test wil demonstrate nothing but will pass.
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_packet-master.opt b/mysql-test/suite/rpl/t/rpl_packet-master.opt
new file mode 100644
index 00000000000..42d4f94c999
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_packet-master.opt
@@ -0,0 +1 @@
+-O max_allowed_packet=1024 -O net_buffer_length=1024
diff --git a/mysql-test/suite/rpl/t/rpl_packet-slave.opt b/mysql-test/suite/rpl/t/rpl_packet-slave.opt
new file mode 100644
index 00000000000..42d4f94c999
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_packet-slave.opt
@@ -0,0 +1 @@
+-O max_allowed_packet=1024 -O net_buffer_length=1024
diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test
new file mode 100644
index 00000000000..26fe36d8c40
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_packet.test
@@ -0,0 +1,80 @@
+#
+# Check replication protocol packet size handling
+# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
+#
+
+# max-out size db name
+source include/master-slave.inc;
+
+let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
+disable_warnings;
+eval drop database if exists $db;
+enable_warnings;
+eval create database $db;
+
+connection master;
+select @@net_buffer_length, @@max_allowed_packet;
+disconnect master;
+
+# alas, can't use eval here; if db name changed apply the change here
+connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________);
+
+connection master;
+create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
+
+INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023');
+save_master_pos;
+
+connection slave;
+sync_with_master;
+eval select count(*) from `$db`.`t1` /* must be 1 */;
+
+SHOW STATUS LIKE 'Slave_running';
+select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING';
+connection master;
+eval drop database $db;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+
+#
+# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits
+#
+# Check that a situation when the size of event on the master is greater than
+# max_allowed_packet on the slave does not lead to infinite re-transmits.
+
+connection master;
+
+# Change the max packet size on master
+
+SET @@global.max_allowed_packet=4096;
+SET @@global.net_buffer_length=4096;
+
+# Restart slave for new setting to take effect
+connection slave;
+STOP SLAVE;
+START SLAVE;
+
+# Reconnect to master for new setting to take effect
+disconnect master;
+connect (master, localhost, root);
+connection master;
+
+CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
+
+INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
+
+# The slave I/O thread must stop after trying to read the above event
+connection slave;
+sleep 2;
+SHOW STATUS LIKE 'Slave_running';
+
+# cleanup
+#connection master;
+#drop table t1;
+#connection slave;
+#drop table t1;
+
+
+# End of tests
diff --git a/mysql-test/suite/rpl/t/rpl_ps.test b/mysql-test/suite/rpl/t/rpl_ps.test
new file mode 100644
index 00000000000..b8792722192
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ps.test
@@ -0,0 +1,51 @@
+#
+# Test of replicating user variables
+#
+###########################################################
+# 2006-02-08 By JBM added order by for use w/ NDB engine
+###########################################################
+source include/master-slave.inc;
+
+#save_master_pos;
+#connection slave;
+#sync_with_master;
+#reset master;
+#connection master;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1(n char(30));
+
+prepare stmt1 from 'insert into t1 values (?)';
+set @var1= "from-master-1";
+execute stmt1 using @var1;
+set @var1= "from-master-2-'',";
+execute stmt1 using @var1;
+SELECT * FROM t1 ORDER BY n;
+
+set @var2= 'insert into t1 values (concat("from-var-", ?))';
+prepare stmt2 from @var2;
+set @var1='from-master-3';
+execute stmt2 using @var1;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM t1 ORDER BY n;
+
+connection master;
+
+drop table t1;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
+# End of 4.1 tests
+
+reset master;
+reset slave;
+disconnect master;
diff --git a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
new file mode 100644
index 00000000000..4f72996671d
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
@@ -0,0 +1,47 @@
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/not_ndb_default.inc
+-- source include/master-slave.inc
+
+# Test that the slave temporarily switches to ROW when seeing binrow
+# events when it is in STATEMENT or MIXED mode
+
+SET BINLOG_FORMAT=MIXED;
+SET GLOBAL BINLOG_FORMAT=MIXED;
+SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
+
+--echo **** On Master ****
+CREATE TABLE t1 (a INT, b LONG);
+INSERT INTO t1 VALUES (1,1), (2,2);
+INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
+let $VERSION=`select version()`;
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
+sync_slave_with_master;
+--echo **** On Slave ****
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+# Let's compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching
+
+diff_files $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql;
+
+# If all is good, we can remove the files
+
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
diff --git a/mysql-test/suite/rpl/t/rpl_read_only-slave.opt b/mysql-test/suite/rpl/t/rpl_read_only-slave.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_read_only-slave.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_read_only.test b/mysql-test/suite/rpl/t/rpl_read_only.test
new file mode 100644
index 00000000000..62864b62a28
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_read_only.test
@@ -0,0 +1,113 @@
+# Test case for BUG #11733
+-- source include/master-slave.inc
+-- source include/have_innodb.inc
+
+# Create a test and replicate it to slave
+connection master;
+create user test;
+sync_slave_with_master;
+
+# Setting the master readonly :
+# - the variable @@readonly is not replicated on the slave
+
+connect (master2,127.0.0.1,test,,test,$MASTER_MYPORT,);
+connect (slave2,127.0.0.1,test,,test,$SLAVE_MYPORT,);
+
+connection master1;
+
+create table t1(a int) engine=InnoDB;
+create table t2(a int) engine=MyISAM;
+insert into t1 values(1001);
+insert into t2 values(2001);
+
+connection master;
+set global read_only=1;
+
+connection master1;
+select @@read_only;
+select * from t1;
+select * from t2;
+
+sync_slave_with_master;
+select @@read_only;
+select * from t1;
+select * from t2;
+
+# - replication of transactions
+connection master;
+set global read_only=0;
+
+connection master1;
+BEGIN;
+insert into t1 values(1002);
+insert into t2 values(2002);
+
+connection master2;
+BEGIN;
+insert into t1 values(1003);
+insert into t2 values(2003);
+
+connection master;
+set global read_only=1;
+
+connection master1;
+## works even with read_only=1, because master1 is root
+COMMIT;
+
+connection master2;
+--error ER_OPTION_PREVENTS_STATEMENT
+COMMIT;
+
+connection master;
+set global read_only=0;
+
+connection master1;
+insert into t1 values(1004);
+insert into t2 values(2004);
+
+select * from t1;
+select * from t2;
+
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+# Setting the slave readonly : replication will pass
+#
+connection slave1;
+set global read_only=1;
+
+connection slave;
+select @@read_only;
+# Make sure the replicated table is also transactional
+show create table t1;
+# Make sure the replicated table is not transactional
+show create table t2;
+
+connection master;
+insert into t1 values(1005);
+insert into t2 values(2005);
+select * from t1;
+select * from t2;
+
+sync_slave_with_master;
+connection slave;
+select * from t1;
+select * from t2;
+
+# Non root user can not write on the slave
+connection slave2;
+--error ER_OPTION_PREVENTS_STATEMENT
+insert into t1 values(1006);
+--error ER_OPTION_PREVENTS_STATEMENT
+insert into t2 values(2006);
+
+## Cleanup
+connection master;
+drop user test;
+drop table t1;
+drop table t2;
+sync_slave_with_master;
+set global read_only=0;
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_redirect.test b/mysql-test/suite/rpl/t/rpl_redirect.test
new file mode 100644
index 00000000000..078d1048794
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_redirect.test
@@ -0,0 +1,47 @@
+#
+# Test of automatic redirection of queries to master/slave.
+#
+
+source include/master-slave.inc;
+# We disable this for now as PS doesn't handle redirection
+--disable_ps_protocol
+
+#first, make sure the slave has had enough time to register
+save_master_pos;
+connection slave;
+sync_with_master;
+
+#discover slaves
+connection master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+SHOW SLAVE STATUS;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW SLAVE HOSTS;
+rpl_probe;
+
+#turn on master/slave query direction auto-magic
+enable_rpl_parse;
+create table t1 ( n int);
+insert into t1 values (1),(2),(3),(4);
+disable_rpl_parse;
+save_master_pos;
+connection slave;
+sync_with_master;
+insert into t1 values(5);
+connection master;
+enable_rpl_parse;
+# The first of the queries will be sent to the slave, the second to the master.
+SELECT * FROM t1 ORDER BY n;
+SELECT * FROM t1 ORDER BY n;
+disable_rpl_parse;
+SELECT * FROM t1 ORDER BY n;
+connection slave;
+SELECT * FROM t1 ORDER BY n;
+
+# Cleanup
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_relay_space_innodb.test b/mysql-test/suite/rpl/t/rpl_relay_space_innodb.test
new file mode 100644
index 00000000000..156d53ef856
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_relay_space_innodb.test
@@ -0,0 +1,22 @@
+###################################
+# 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
new file mode 100644
index 00000000000..1d8563e7fd9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_relay_space_myisam.test
@@ -0,0 +1,21 @@
+###################################
+# 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-slave.opt b/mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt
new file mode 100644
index 00000000000..cf4319f2b40
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt
@@ -0,0 +1,3 @@
+-O max_relay_log_size=16384
+--loose-innodb
+--log-warnings
diff --git a/mysql-test/suite/rpl/t/rpl_relayrotate.test b/mysql-test/suite/rpl/t/rpl_relayrotate.test
new file mode 100644
index 00000000000..46d54aea1d2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_relayrotate.test
@@ -0,0 +1,10 @@
+#######################################################
+# Wrapper for rpl_relayrotate.test to allow multi #
+# Engines to reuse test code. By JBM 2006-02-15 #
+# Added comments section and to skip when ndb is #
+# Default engine. #
+#######################################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+-- source extra/rpl_tests/rpl_relayrotate.test
diff --git a/mysql-test/suite/rpl/t/rpl_relayspace-slave.opt b/mysql-test/suite/rpl/t/rpl_relayspace-slave.opt
new file mode 100644
index 00000000000..06d96aa3b9a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_relayspace-slave.opt
@@ -0,0 +1 @@
+--relay_log_space_limit=10
diff --git a/mysql-test/suite/rpl/t/rpl_relayspace.test b/mysql-test/suite/rpl/t/rpl_relayspace.test
new file mode 100644
index 00000000000..70315c14f34
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_relayspace.test
@@ -0,0 +1,34 @@
+# The slave is started with relay_log_space_limit=10 bytes,
+# to force the deadlock after one event.
+
+source include/master-slave.inc;
+connection slave;
+stop slave;
+connection master;
+# This will generate a master's binlog > 10 bytes
+create table t1 (a int);
+drop table t1;
+create table t1 (a int);
+drop table t1;
+connection slave;
+reset slave;
+start slave io_thread;
+# Give the I/O thread time to block.
+sleep 2;
+# A bug caused the I/O thread to refuse stopping.
+stop slave io_thread;
+reset slave;
+start slave;
+# The I/O thread stops filling the relay log when
+# it's >10b. And the SQL thread cannot purge this relay log
+# as purge is done only when the SQL thread switches to another
+# relay log, which does not exist here.
+# So we should have a deadlock.
+# if it is not resolved automatically we'll detect
+# it with master_pos_wait that waits for farther than 1Ob;
+# it will timeout after 10 seconds;
+# also the slave will probably not cooperate to shutdown
+# (as 2 threads are locked)
+select master_pos_wait('master-bin.001',200,6)=-1;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_replicate_do-slave.opt b/mysql-test/suite/rpl/t/rpl_replicate_do-slave.opt
new file mode 100644
index 00000000000..da345474216
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_replicate_do-slave.opt
@@ -0,0 +1 @@
+--replicate-do-table=test.t1
diff --git a/mysql-test/suite/rpl/t/rpl_replicate_do.test b/mysql-test/suite/rpl/t/rpl_replicate_do.test
new file mode 100644
index 00000000000..600840a2828
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test
@@ -0,0 +1,92 @@
+# This test assumes we are ignoring updates on table t2, but doing
+# updates on t1
+source include/master-slave.inc;
+--disable_warnings
+drop table if exists t11;
+connection slave;
+drop table if exists t11;
+--enable_warnings
+
+create table t2 (n int);
+insert into t2 values(4);
+connection master;
+create table t2 (s char(20));
+load data infile '../std_data_ln/words.dat' into table t2;
+insert into t2 values('five');
+create table t1 (m int);
+insert into t1 values(15),(16),(17);
+update t1 set m=20 where m=16;
+delete from t1 where m=17;
+create table t11 select * from t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1 ORDER BY m;
+select * from t2;
+--error 1146
+select * from t11;
+connection master;
+drop table if exists t1,t2,t11;
+save_master_pos;
+connection slave;
+sync_with_master;
+# show slave status, just to see of it prints replicate-do-table
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
+show slave status;
+
+#
+# BUG#12542
+# TEST: "SET ONE_SHOT should always be executed on slave"
+#
+# We could use any timezone different than server default in this test
+#
+connection master;
+create table t1 (ts timestamp);
+set one_shot time_zone='met';
+insert into t1 values('2005-08-12 00:00:00');
+set one_shot time_zone='met';
+select * from t1;
+sync_slave_with_master;
+
+connection slave;
+set one_shot time_zone='met';
+select * from t1;
+
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+# End of 4.1 tests
+
+#
+# Bug#24478 DROP TRIGGER is not caught by replicate-*-table filters
+#
+--echo *** master ***
+connection master;
+create table t1 (a int, b int);
+create trigger trg1 before insert on t1 for each row set new.b=2;
+create table t2 (a int, b int);
+create trigger trg2 before insert on t2 for each row set new.b=2;
+show tables;
+show triggers;
+sync_slave_with_master;
+--echo *** slave ***
+connection slave;
+show tables;
+show triggers;
+--echo *** master ***
+connection master;
+drop trigger trg1;
+drop trigger trg2;
+show triggers;
+sync_slave_with_master;
+--echo *** slave ***
+connection slave;
+show tables;
+show triggers;
+--echo *** master ***
+connection master;
+drop table t1;
+drop table t2;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_replicate_ignore_db-slave.opt b/mysql-test/suite/rpl/t/rpl_replicate_ignore_db-slave.opt
new file mode 100644
index 00000000000..6e3aed44f78
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_replicate_ignore_db-slave.opt
@@ -0,0 +1 @@
+--replicate_ignore_db=mysqltest1
diff --git a/mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test b/mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test
new file mode 100644
index 00000000000..bcfef919fad
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test
@@ -0,0 +1,30 @@
+# see if --replicate-ignore-db works
+
+--source include/master-slave.inc
+
+--disable_warnings
+drop database if exists mysqltest1;
+drop database if exists mysqltest2;
+--enable_warnings
+create database mysqltest1;
+create database mysqltest2;
+
+use mysqltest1;
+create table t1 (a int);
+insert into t1 values(1);
+sync_slave_with_master;
+--error 1146
+select * from mysqltest1.t1;
+
+connection master;
+use mysqltest2;
+create table t1 (a int);
+insert into t1 values(1);
+sync_slave_with_master;
+select * from mysqltest2.t1;
+
+# cleanup
+connection master;
+drop database mysqltest1;
+drop database mysqltest2;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt b/mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt
new file mode 100644
index 00000000000..a462ad19ba0
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt
@@ -0,0 +1 @@
+"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1->test"
diff --git a/mysql-test/suite/rpl/t/rpl_rewrt_db.test b/mysql-test/suite/rpl/t/rpl_rewrt_db.test
new file mode 100644
index 00000000000..52f04e073dd
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_rewrt_db.test
@@ -0,0 +1,84 @@
+# TBF - difference in row level logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
+--disable_warnings
+drop database if exists mysqltest1;
+--enable_warnings
+create database mysqltest1;
+
+use mysqltest1;
+create table t1 (a int);
+insert into t1 values(9);
+select * from mysqltest1.t1;
+sync_slave_with_master;
+show databases like 'mysqltest1'; # should be empty
+select * from test.t1;
+# cleanup
+connection master;
+drop table t1;
+drop database mysqltest1;
+sync_slave_with_master;
+
+#
+# BUG#6353:
+# Option --replicate-rewrite-db should work together with LOAD DATA INFILE
+#
+
+connection slave;
+--disable_warnings
+drop database if exists rewrite;
+--enable_warnings
+create database rewrite;
+
+connection master;
+use test;
+create table t1 (a date, b date, c date not null, d date);
+load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
+sync_slave_with_master;
+
+connection slave;
+select * from rewrite.t1;
+
+connection master;
+truncate table t1;
+load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+sync_slave_with_master;
+
+connection slave;
+select * from rewrite.t1;
+
+connection master;
+drop table t1;
+create table t1 (a text, b text);
+load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+sync_slave_with_master;
+
+connection slave;
+select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
+
+connection master;
+drop table t1;
+create table t1 (a int, b char(10));
+load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+sync_slave_with_master;
+
+connection slave;
+select * from rewrite.t1;
+
+connection master;
+truncate table t1;
+load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+sync_slave_with_master;
+
+connection slave;
+# The empty line last comes from the end line field in the file
+select * from rewrite.t1;
+
+drop database rewrite;
+
+connection master;
+drop table t1;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt b/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt
new file mode 100644
index 00000000000..ad2c6a647b5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt
@@ -0,0 +1 @@
+-O max_binlog_size=4096
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh
new file mode 100755
index 00000000000..81490a54b4b
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh
@@ -0,0 +1,2 @@
+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.slave-mi b/mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi
new file mode 100644
index 00000000000..80190bf6d29
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi
@@ -0,0 +1 @@
+--server-id=2
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
new file mode 100644
index 00000000000..155f9f4b6e0
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
@@ -0,0 +1,175 @@
+# This test uses chmod, can't be run with root permissions
+-- source include/not_as_root.inc
+
+-- source include/have_log_bin.inc
+
+#
+# Test is run with max_binlog_size=2048 to force automatic rotation of the
+# binary log
+# Tests done:
+# - Check that slaves reports correct failures if master.info has strange
+# modes/information
+# - Automatic binary log rotation
+# - Ensure that temporary tables works over flush logs and binary log
+# changes
+# - Test creating a duplicate key error and recover from it
+
+# Requires statement logging
+-- 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
+write_file $MYSQLTEST_VARDIR/slave-data/master.info;
+EOF
+chmod 0000 $MYSQLTEST_VARDIR/slave-data/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)
+--replace_result $MYSQL_TEST_DIR TESTDIR
+--error 1105,1105,29
+start slave;
+chmod 0600 $MYSQLTEST_VARDIR/slave-data/master.info;
+# It will fail again because the file is empty so the slave cannot get valuable
+# info about how to connect to the master from it (failure in
+# init_strvar_from_file() in init_master_info()).
+--error 1201
+start slave;
+--replace_result $MASTER_MYPORT MASTER_PORT
+
+# CHANGE MASTER will fail because it first parses master.info before changing
+# it (so when master.info is bad, people have to use RESET SLAVE first).
+--error 1201
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
+reset slave;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
+connection master;
+reset master;
+connection slave;
+start slave;
+connection master;
+
+#
+# Test FLUSH LOGS
+#
+create temporary table temp_table (a char(80) not null);
+insert into temp_table values ("testing temporary tables");
+create table t1 (s text);
+insert into t1 values('Could not break slave'),('Tried hard');
+sync_slave_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+show slave status;
+select * from t1;
+connection master;
+flush logs;
+create table t2(m int not null auto_increment primary key);
+insert into t2 values (34),(67),(123);
+flush logs;
+show binary logs;
+create table t3 select * from temp_table;
+
+sync_slave_with_master;
+
+select * from t3;
+connection master;
+drop table temp_table, t3;
+
+#
+# Now lets make some duplicate key mess and see if we can recover from it
+#
+
+# First insert a value on the slave
+connection slave;
+insert into t2 values(1234);
+
+#same value on the master
+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;
+
+connection master;
+
+#let slave catch up
+sync_slave_with_master;
+connection master;
+purge master logs to 'master-bin.000002';
+show master logs;
+# we just tests if synonyms are accepted
+purge binary logs to 'master-bin.000002';
+show binary logs;
+
+# Calculate time to use in "purge master logs before" by taking
+# last modification time of t2 and adding 1 second
+# This is donw in order to handle the case where file system
+# time differs from mysqld's time
+--disable_result_log
+select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND)
+ from information_schema.tables
+ where TABLE_SCHEMA="test" and TABLE_NAME="t2";
+--enable_result_log
+
+purge master logs before (@time_for_purge);
+show binary logs;
+insert into t2 values (65);
+sync_slave_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+show slave status;
+select * from t2;
+
+#
+# Test forcing the replication log to rotate
+#
+
+connection master;
+create temporary table temp_table (a char(80) not null);
+insert into temp_table values ("testing temporary tables part 2");
+let $1=100;
+
+create table t3 (n int);
+disable_query_log;
+while ($1)
+{
+#eval means expand $ expressions
+ eval insert into t3 values($1 + 4);
+ dec $1;
+}
+enable_query_log;
+select count(*) from t3 where n >= 4;
+create table t4 select * from temp_table;
+show binary logs;
+show master status;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t4;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+show slave status;
+# because of concurrent insert, the table may not be up to date
+# if we do not lock
+lock tables t3 read;
+select count(*) from t3 where n >= 4;
+unlock tables;
+#clean up
+connection master;
+drop table if exists t1,t2,t3,t4;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_row_001.test b/mysql-test/suite/rpl/t/rpl_row_001.test
new file mode 100644
index 00000000000..639c55362a5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_001.test
@@ -0,0 +1,7 @@
+########################################################
+# 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_001.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_4_bytes-master.opt b/mysql-test/suite/rpl/t/rpl_row_4_bytes-master.opt
new file mode 100644
index 00000000000..0e1929507f7
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_4_bytes-master.opt
@@ -0,0 +1 @@
+--loose-debug=d,"old_row_based_repl_4_byte_map_id_master"
diff --git a/mysql-test/suite/rpl/t/rpl_row_4_bytes.test b/mysql-test/suite/rpl/t/rpl_row_4_bytes.test
new file mode 100644
index 00000000000..73ef6dd2345
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_4_bytes.test
@@ -0,0 +1,33 @@
+# This test is to make sure that slaves can read a binlog containining
+# table map ids stored in 4 bytes, even though we now store them in 6
+# bytes. This is for backward-compatibility.
+# If the slave does not detect that the master stores the table map id
+# in 4 bytes, slave will read 6 bytes, and so will read the 2 bytes of
+# flags at the place where there actually is data, so the test should
+# fail.
+
+-- source include/have_binlog_format_row.inc
+-- source include/have_debug.inc
+-- source include/master-slave.inc
+
+connection master;
+--disable_warnings
+drop database if exists mysqltest1;
+create database mysqltest1;
+--enable_warnings
+use mysqltest1;
+CREATE TABLE t1 (a char(3));
+CREATE TABLE t2 (a char(3));
+insert into t1 values("ANN");
+insert into t1 values("GUI");
+insert into t2 values("LIL");
+insert into t2 values("ABE");
+insert into t2 values("ANG");
+sync_slave_with_master;
+use mysqltest1;
+select * from t1 order by a;
+select * from t2 order by a;
+
+connection master;
+DROP DATABASE mysqltest1;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_row_NOW.test b/mysql-test/suite/rpl/t/rpl_row_NOW.test
new file mode 100644
index 00000000000..c28b714277e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_NOW.test
@@ -0,0 +1,74 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+# Updated 08/30/2005 Added dumps and diff #
+#############################################################################
+#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12480 #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+create database if not exists mysqltest1;
+DROP TABLE IF EXISTS mysqltest1.t1;
+--enable_warnings
+
+
+# Begin test section 1
+CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT,
+ a TIMESTAMP DEFAULT '2005-05-05 01:01:01',
+ b TIMESTAMP DEFAULT '2005-05-05 01:01:01',
+ PRIMARY KEY(n));
+delimiter |;
+CREATE FUNCTION mysqltest1.f1() RETURNS TIMESTAMP
+BEGIN
+ DECLARE v1 INT DEFAULT 300;
+ WHILE v1 > 0 DO
+ SET v1 = v1 - 1;
+ END WHILE;
+ RETURN NOW();
+END|
+delimiter ;|
+
+INSERT INTO mysqltest1.t1 VALUES(NULL,NOW(),mysqltest1.f1());
+
+delimiter |;
+CREATE TRIGGER mysqltest1.trig1 BEFORE INSERT ON mysqltest1.t1
+FOR EACH ROW BEGIN
+ SET new.b = mysqltest1.f1();
+END|
+delimiter ;|
+
+INSERT INTO mysqltest1.t1 SET n = NULL, a = now();
+
+sync_slave_with_master;
+
+connection master;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_slave.sql
+
+# lets cleanup
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP FUNCTION mysqltest1.f1;
+DROP DATABASE mysqltest1;
+
+# Lets compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-) The failed dump
+# files will be located in $MYSQLTEST_VARDIR/tmp
+
+diff_files $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave.sql;
+
+# If all is good, when can cleanup our dump files.
+--remove_file $MYSQLTEST_VARDIR/tmp/NOW_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/NOW_slave.sql
+
+sync_slave_with_master;
+# End of 5.1 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_USER.test b/mysql-test/suite/rpl/t/rpl_row_USER.test
new file mode 100644
index 00000000000..7b13ebc50ee
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_USER.test
@@ -0,0 +1,60 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+#############################################################################
+# TEST: To test the USER() and CURRENT_USER() in rbr #
+#############################################################################
+# Change Author: JBM
+# Change Date: 2006-01-16
+# Change: Added Order by for NDB
+##########
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+CREATE DATABASE mysqltest1;
+--enable_warnings
+
+# Section 1 test
+CREATE USER tester IDENTIFIED BY 'test';
+GRANT ALL ON mysqltest1.* TO 'tester'@'%' IDENTIFIED BY 'test';
+GRANT ALL ON mysqltest1.* TO ''@'localhost%';
+FLUSH PRIVILEGES;
+connect (m_1,localhost,tester,,mysqltest1);
+
+connection m_1;
+CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a));
+INSERT INTO mysqltest1.t1 VALUES(1,USER());
+INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER());
+delimiter |;
+create procedure mysqltest1.p1()
+begin
+ INSERT INTO mysqltest1.t1 VALUES(3,USER());
+ INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER());
+end|
+delimiter ;|
+
+CALL mysqltest1.p1();
+connection master;
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+sync_slave_with_master;
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+
+connection master;
+# Lets cleanup
+#show binlog events;
+
+DROP DATABASE mysqltest1;
+REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
+REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
+DROP USER tester@'%';
+DROP USER ''@'localhost%';
+
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_UUID.test b/mysql-test/suite/rpl/t/rpl_row_UUID.test
new file mode 100644
index 00000000000..6ead7c2ee9b
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_UUID.test
@@ -0,0 +1,7 @@
+########################################################
+# 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_UUID.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt
new file mode 100644
index 00000000000..ed7656c1f99
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt
@@ -0,0 +1,2 @@
+--binlog_ignore_db=test_ignore --loose-innodb
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
new file mode 100644
index 00000000000..0109edf4264
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
@@ -0,0 +1,186 @@
+--source include/have_binlog_format_row.inc
+
+let $SERVER_VERSION=`select version()`;
+
+#This test case is not written for NDB, the result files
+#will not match when NDB is the default engine
+-- source include/not_ndb_default.inc
+
+--source include/master-slave.inc
+
+# Bug#15942 (RBR ignores --binlog_ignore_db and tries to map to table
+# on slave for writes)
+
+CREATE DATABASE test_ignore; # --binlog_ignore_db=mysqltest_ignore
+
+--echo **** On Master ****
+SHOW DATABASES;
+USE test;
+CREATE TABLE t1 (a INT, b INT);
+SHOW TABLES;
+INSERT INTO t1 VALUES (1,1), (2,2);
+USE test_ignore;
+CREATE TABLE t2 (a INT, b INT);
+SHOW TABLES;
+INSERT INTO t2 VALUES (3,3), (4,4);
+source include/show_binlog_events.inc;
+sync_slave_with_master;
+--echo **** On Slave ****
+SHOW DATABASES;
+USE test;
+SHOW TABLES;
+--error 1049
+USE test_ignore;
+
+connection master;
+DROP DATABASE test_ignore;
+sync_slave_with_master;
+
+# 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
+
+connection master;
+CREATE TABLE t1 (a INT);
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+DELETE FROM t1 WHERE a = 0;
+UPDATE t1 SET a=99 WHERE a = 0;
+--replace_result $SERVER_VERSION SERVER_VERSION
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
+
+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
+
+--echo **** On Slave ****
+connection slave;
+SET GLOBAL QUERY_CACHE_SIZE=0;
+
+--echo **** On Master ****
+connection master;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+
+--echo **** On Slave ****
+sync_slave_with_master;
+SET GLOBAL QUERY_CACHE_SIZE=16*1024*1024;
+
+--echo **** On Master ****
+connection master;
+INSERT INTO t1 VALUES (4),(5),(6);
+
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT * FROM t1;
+
+--echo **** On Master ****
+connection master;
+INSERT INTO t1 VALUES (7),(8),(9);
+
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT * FROM t1;
+
+SET GLOBAL QUERY_CACHE_SIZE=0;
+
+# Bug#22550: Replication of BIT columns failing
+--echo ================ Test for BUG#22550 ================
+--disable_query_log
+--source include/master-slave-reset.inc
+--enable_query_log
+
+connection master;
+CREATE TABLE t1 (a BIT(1), b INT) ENGINE=MYISAM;
+sync_slave_with_master;
+
+connection master;
+INSERT INTO t1 VALUES(1,2);
+SELECT HEX(a),b FROM t1;
+sync_slave_with_master;
+SELECT HEX(a),b FROM t1;
+
+connection master;
+UPDATE t1 SET a=0 WHERE b=2;
+SELECT HEX(a),b FROM t1;
+sync_slave_with_master;
+SELECT HEX(a),b FROM t1;
+
+connection master;
+DROP TABLE IF EXISTS t1;
+sync_slave_with_master;
+
+# BUG#22583: RBR between MyISAM and non-MyISAM tables containing a BIT
+# field does not work
+
+--echo ================ Test for BUG#22583 ================
+--disable_query_log
+--source include/master-slave-reset.inc
+--enable_query_log
+
+# disabling warnings temporarily for ENGINE=INNODB to work without InnoDB
+--disable_warnings
+--echo **** On Master ****
+connection master;
+CREATE TABLE t1_myisam (k INT, a BIT(1), b BIT(9)) ENGINE=MYISAM;
+CREATE TABLE t1_innodb (k INT, a BIT(1), b BIT(9)) ENGINE=INNODB;
+CREATE TABLE t2_myisam (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=MYISAM;
+CREATE TABLE t2_innodb (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=INNODB;
+--echo **** On Slave ****
+sync_slave_with_master;
+ALTER TABLE t1_myisam ENGINE=INNODB;
+ALTER TABLE t1_innodb ENGINE=MYISAM;
+ALTER TABLE t2_myisam ENGINE=INNODB;
+ALTER TABLE t2_innodb ENGINE=MYISAM;
+--enable_warnings
+
+--echo **** On Master ****
+connection master;
+INSERT INTO t1_myisam VALUES(1, b'0', 257);
+INSERT INTO t1_myisam VALUES(2, b'1', 256);
+INSERT INTO t1_innodb VALUES(1, b'0', 257);
+INSERT INTO t1_innodb VALUES(2, b'1', 256);
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+INSERT INTO t2_myisam VALUES(1, b'0', 9);
+INSERT INTO t2_myisam VALUES(2, b'1', 8);
+INSERT INTO t2_innodb VALUES(1, b'0', 9);
+INSERT INTO t2_innodb VALUES(2, b'1', 8);
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+
+--echo **** On Master ****
+connection master;
+UPDATE t1_myisam SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+UPDATE t1_innodb SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+UPDATE t2_myisam SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+UPDATE t2_innodb SET a=0 WHERE k=2;
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT k, HEX(a),HEX(b) FROM t1_myisam;
+SELECT k, HEX(a),HEX(b) FROM t1_innodb;
+SELECT k, HEX(a),HEX(b) FROM t2_myisam;
+SELECT k, HEX(a),HEX(b) FROM t2_innodb;
+
+--echo **** On Master ****
+connection master;
+DROP TABLE IF EXISTS t1_myisam, t1_innodb, t2_myisam, t2_innodb;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test b/mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test
new file mode 100644
index 00000000000..c2cef800ec8
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test
@@ -0,0 +1,3 @@
+let $type= 'MYISAM' ;
+let $extra_index= ;
+-- source extra/rpl_tests/rpl_row_basic.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
new file mode 100644
index 00000000000..89effc4b3bb
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
@@ -0,0 +1,6 @@
+-- source include/have_innodb.inc
+
+let $type= 'INNODB' ;
+let $extra_index= ;
+-- source extra/rpl_tests/rpl_row_basic.test
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_8partition.test b/mysql-test/suite/rpl/t/rpl_row_basic_8partition.test
new file mode 100644
index 00000000000..687b3bc785d
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_8partition.test
@@ -0,0 +1,210 @@
+############################################################
+# Author: MATZ #
+# Date: 2006-03-22 #
+# Purpose: See if replication of partition tables work #
+# Most of this test is copied from the rpl_xxx2yyy tests, #
+# but here we just test some simple basic replication of #
+# partition tables with same engine (MyISAM) in both ends. #
+############################################################
+
+--source include/have_binlog_format_row.inc
+--source include/have_partition.inc
+--source include/not_ndb_default.inc
+--source include/master-slave.inc
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+
+let $maybe_ro_var = @@BINLOG_FORMAT;
+let $val4var = ROW;
+--source include/safe_set_to_maybe_ro_var.inc
+
+--echo **** Partition RANGE testing ****
+
+# Create table that is partitioned by range on year i.e. year(t) and
+# replicate basice operations such at insert, update delete between 2
+# different storage engines Alter table and ensure table is handled
+# Correctly on the slave
+# Note that the storage engine should not be explicit: the default
+# storage engine is used on master and slave.
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY RANGE (YEAR(t))
+ (PARTITION p0 VALUES LESS THAN (1901),
+ PARTITION p1 VALUES LESS THAN (1946),
+ PARTITION p2 VALUES LESS THAN (1966),
+ PARTITION p3 VALUES LESS THAN (1986),
+ PARTITION p4 VALUES LESS THAN (2005),
+ PARTITION p5 VALUES LESS THAN MAXVALUE);
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave --
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+# Perform basic operation on master and ensure replicated correctly
+--source include/rpl_multi_engine3.inc
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo **** Partition LIST testing ****
+
+# Create table that is partitioned by list on id i.e. (2,4). Pretend
+# that we missed one and alter to add. Then replicate basice
+# operations such at insert, update delete between 2 different storage
+# engines Alter table and ensure table is handled Correctly on the
+# slave.
+
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY LIST(id)
+ (PARTITION p0 VALUES IN (2, 4),
+ PARTITION p1 VALUES IN (42, 142),
+ PARTITION p2 VALUES IN (412));
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+# Perform basic operation on master and ensure replicated correctly
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly ---
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+# Perform basic operation on master and ensure replicated correctly
+--source include/rpl_multi_engine3.inc
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+--echo **** Partition HASH testing ****
+
+# Create table that is partitioned by hash on year i.e. YEAR(t). Then
+# replicate basice operations such at insert, update delete between 2
+# different storage engines Alter table and ensure table is handled
+# Correctly on the slave
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE)
+ PARTITION BY HASH( YEAR(t) )
+ PARTITIONS 4;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+DROP TABLE IF EXISTS t1;
+
+########################################################
+
+# This part does not work
+--echo **** Partition by KEY ****
+
+# Create table that is partitioned by key on id with 4 parts. Then
+# replicate basice operations such at insert, update delete between 2
+# different storage engines Alter table and ensure table is handled
+# Correctly on the slave
+
+CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
+ bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
+ f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
+ y YEAR, t DATE,PRIMARY KEY(id))
+ PARTITION BY KEY()
+ PARTITIONS 4;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+connection master;
+# Check that simple Alter statements are replicated correctly
+ALTER TABLE t1 MODIFY vc TEXT;
+
+--echo --- On master ---
+SHOW CREATE TABLE t1;
+
+--echo --- On slave ---
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+
+--source include/rpl_multi_engine3.inc
+
+DROP TABLE IF EXISTS t1;
+
+# End of 5.1 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_blob_innodb.test b/mysql-test/suite/rpl/t/rpl_row_blob_innodb.test
new file mode 100644
index 00000000000..0bce657f9f9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_blob_innodb.test
@@ -0,0 +1,12 @@
+#################################
+# Wrapper for rpl_row_blob.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;
+-- source extra/rpl_tests/rpl_row_blob.test
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_blob_myisam.test b/mysql-test/suite/rpl/t/rpl_row_blob_myisam.test
new file mode 100644
index 00000000000..a470c36f9f8
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_blob_myisam.test
@@ -0,0 +1,11 @@
+#################################
+# Wrapper for rpl_row_blob.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
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_row_blob.test
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_charset.test b/mysql-test/suite/rpl/t/rpl_row_charset.test
new file mode 100644
index 00000000000..9737c52c70f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_charset.test
@@ -0,0 +1,7 @@
+########################################################
+# 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_charset.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt b/mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test
new file mode 100644
index 00000000000..be10d48b757
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test
@@ -0,0 +1,236 @@
+# Testing table creations for row-based replication.
+
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+connection slave;
+--source include/have_innodb.inc
+connection master;
+
+# Bug#18326: Do not lock table for writing during prepare of statement
+# The use of the ps protocol causes extra table maps in the binlog, so
+# we disable the ps-protocol for this statement.
+--disable_ps_protocol
+
+--disable_query_log
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+--enable_warnings
+--enable_query_log
+
+# Set the default storage engine to different values on master and
+# slave. We need to stop the slave for the server variable to take
+# effect, since the variable is only read on start-up.
+sync_slave_with_master;
+--disable_query_log
+set @storage_engine = @@global.storage_engine;
+STOP SLAVE;
+SET GLOBAL storage_engine=memory;
+START SLAVE;
+--enable_query_log
+
+connection master;
+CREATE TABLE t1 (a INT, b INT);
+CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
+CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
+CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
+--replace_column 1 # 4 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+--query_vertical SHOW BINLOG EVENTS FROM 216
+--echo **** On Master ****
+--query_vertical SHOW CREATE TABLE t1
+--query_vertical SHOW CREATE TABLE t2
+--query_vertical SHOW CREATE TABLE t3
+sync_slave_with_master;
+--echo **** On Slave ****
+--query_vertical SHOW CREATE TABLE t1
+--query_vertical SHOW CREATE TABLE t2
+--query_vertical SHOW CREATE TABLE t3
+
+connection master;
+CREATE TABLE t5 (b INT, c INT) SELECT * FROM t3;
+
+CREATE TEMPORARY TABLE tt3 (a INT, b INT);
+INSERT INTO tt3 VALUES (1,2), (2,4), (3,6), (4,2), (5,10), (6,12);
+CREATE TABLE t6 (b INT, c INT) SELECT * FROM tt3;
+--echo **** On Master ****
+--query_vertical SHOW CREATE TABLE t5
+SELECT * FROM t5 ORDER BY a,b,c;
+--query_vertical SHOW CREATE TABLE t6
+SELECT * FROM t6 ORDER BY a,b,c;
+sync_slave_with_master;
+--echo **** On Slave ****
+--query_vertical SHOW CREATE TABLE t5
+SELECT * FROM t5 ORDER BY a,b,c;
+--query_vertical SHOW CREATE TABLE t6
+SELECT * FROM t6 ORDER BY a,b,c;
+
+connection master;
+# Test for erroneous constructions
+--error ER_DUP_ENTRY
+CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
+# Shouldn't be written to the binary log
+--replace_column 1 # 4 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS FROM 1098;
+
+# Test that INSERT-SELECT works the same way as for SBR.
+CREATE TABLE t7 (a INT, b INT UNIQUE);
+--error ER_DUP_ENTRY
+INSERT INTO t7 SELECT a,b FROM tt3;
+SELECT * FROM t7 ORDER BY a,b;
+# Should be written to the binary log
+--replace_column 1 # 4 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS FROM 1098;
+sync_slave_with_master;
+SELECT * FROM t7 ORDER BY a,b;
+
+connection master;
+CREATE TEMPORARY TABLE tt4 (a INT, b INT);
+INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
+BEGIN;
+INSERT INTO t7 SELECT a,b FROM tt4;
+ROLLBACK;
+--replace_column 1 # 4 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS FROM 1294;
+SELECT * FROM t7 ORDER BY a,b;
+sync_slave_with_master;
+SELECT * FROM t7 ORDER BY a,b;
+
+connection master;
+CREATE TABLE t8 LIKE t4;
+CREATE TABLE t9 LIKE tt4;
+CREATE TEMPORARY TABLE tt5 LIKE t4;
+CREATE TEMPORARY TABLE tt6 LIKE tt4;
+CREATE TEMPORARY TABLE tt7 SELECT 1;
+--echo **** On Master ****
+--query_vertical SHOW CREATE TABLE t8
+--query_vertical SHOW CREATE TABLE t9
+--replace_column 1 # 4 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS FROM 1390;
+sync_slave_with_master;
+--echo **** On Slave ****
+--query_vertical SHOW CREATE TABLE t8
+--query_vertical SHOW CREATE TABLE t9
+
+connection master;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+sync_slave_with_master;
+# Here we reset the value of the default storage engine
+STOP SLAVE;
+SET GLOBAL storage_engine=@storage_engine;
+START SLAVE;
+--enable_ps_protocol
+
+# BUG#22864 (Rollback following CREATE ... SELECT discards 'CREATE
+# table' from log):
+--echo ================ BUG#22864 ================
+connection slave;
+STOP SLAVE;
+RESET SLAVE;
+connection master;
+RESET MASTER;
+connection slave;
+START SLAVE;
+connection master;
+SET AUTOCOMMIT=0;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+
+CREATE TABLE t2 ENGINE=INNODB SELECT * FROM t1;
+ROLLBACK;
+
+CREATE TABLE t3 ENGINE=INNODB SELECT * FROM t1;
+INSERT INTO t3 VALUES (4),(5),(6);
+ROLLBACK;
+
+CREATE TABLE t4 ENGINE=INNODB SELECT * FROM t1;
+INSERT INTO t1 VALUES (4),(5),(6);
+ROLLBACK;
+
+SHOW TABLES;
+SELECT TABLE_NAME,ENGINE
+ FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_NAME LIKE 't_'
+ORDER BY TABLE_NAME;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+SELECT * FROM t3 ORDER BY a;
+SELECT * FROM t4 ORDER BY a;
+--replace_column 1 # 4 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
+sync_slave_with_master;
+SHOW TABLES;
+SELECT TABLE_NAME,ENGINE
+ FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_NAME LIKE 't_'
+ORDER BY TABLE_NAME;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+SELECT * FROM t3 ORDER BY a;
+SELECT * FROM t4 ORDER BY a;
+
+connection master;
+DROP TABLE IF EXISTS t1,t2,t3,t4;
+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;
+
+connection master;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+
+CREATE TABLE t2 (a INT) ENGINE=INNODB;
+
+BEGIN;
+INSERT INTO t2 SELECT a*a FROM t1;
+CREATE TEMPORARY TABLE tt1
+SELECT a+1 AS a
+ FROM t1
+ WHERE a MOD 2 = 1;
+INSERT INTO t2 SELECT a+2 FROM tt1;
+COMMIT;
+
+SELECT * FROM t2 ORDER BY a;
+--replace_column 1 # 4 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
+sync_slave_with_master;
+SELECT * FROM t2 ORDER BY a;
+
+connection master;
+TRUNCATE TABLE t2;
+
+BEGIN;
+INSERT INTO t2 SELECT a*a FROM t1;
+CREATE TEMPORARY TABLE tt2
+SELECT a+1 AS a
+ FROM t1
+ WHERE a MOD 2 = 1;
+INSERT INTO t2 SELECT a+2 FROM tt2;
+ROLLBACK;
+
+SELECT * FROM t2 ORDER BY a;
+--replace_column 1 # 4 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS FROM 631;
+sync_slave_with_master;
+SELECT * FROM t2 ORDER BY a;
+
+connection master;
+DROP TABLE t1,t2;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_row_delayed_ins.test b/mysql-test/suite/rpl/t/rpl_row_delayed_ins.test
new file mode 100644
index 00000000000..a0e74567349
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_delayed_ins.test
@@ -0,0 +1,7 @@
+########################################################
+# 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
new file mode 100644
index 00000000000..20c217a7c3a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_drop.test
@@ -0,0 +1,48 @@
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Bug#12415: DROP of temporary table on master stops slave
+connection master;
+--echo **** On Master ****
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (a int);
+CREATE TEMPORARY TABLE t2 (a int, b int);
+SHOW TABLES;
+sync_slave_with_master;
+--echo **** On Slave ****
+SHOW TABLES;
+connection master;
+--echo **** On Master ****
+DROP TABLE t2; # Dropping the temporary table
+SHOW TABLES;
+sync_slave_with_master;
+--echo **** On Slave ****
+SHOW TABLES; # There should be two tables on the slave
+
+connection master;
+--echo **** On Master ****
+CREATE TEMPORARY TABLE t2 (a int, b int);
+SHOW TABLES;
+sync_slave_with_master;
+--echo **** On Slave ****
+SHOW TABLES;
+connection master;
+--echo **** On Master ****
+# Should drop the non-temporary table t1 and the temporary table t2
+DROP TABLE t1,t2;
+let $VERSION=`select version()`;
+--replace_result $VERSION VERSION
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
+SHOW TABLES;
+sync_slave_with_master;
+--echo **** On Slave ****
+SHOW TABLES;
+
+--disable_query_log
+--disable_warnings
+connection master;
+DROP TABLE IF EXISTS t2;
+sync_slave_with_master;
+--enable_warnings
+--enable_query_log
diff --git a/mysql-test/suite/rpl/t/rpl_row_err_daisychain-master.opt b/mysql-test/suite/rpl/t/rpl_row_err_daisychain-master.opt
new file mode 100644
index 00000000000..83ed8522e72
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_err_daisychain-master.opt
@@ -0,0 +1 @@
+--binlog-format=row
diff --git a/mysql-test/suite/rpl/t/rpl_row_err_daisychain-slave.opt b/mysql-test/suite/rpl/t/rpl_row_err_daisychain-slave.opt
new file mode 100644
index 00000000000..4cb7a31da81
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_err_daisychain-slave.opt
@@ -0,0 +1 @@
+--binlog-format=statement --log-slave-updates
diff --git a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
new file mode 100644
index 00000000000..a2f9e31fc5d
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
@@ -0,0 +1,17 @@
+# depends on the binlog output
+-- source include/have_binlog_format_row.inc
+
+let $rename_event_pos= 619;
+
+# Bug#18326: Do not lock table for writing during prepare of statement
+# The use of the ps protocol causes extra table maps in the binlog, so
+# we disable the ps-protocol for this statement.
+
+# Merge tables are not supported in NDB
+-- source include/not_ndb_default.inc
+
+
+--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
new file mode 100644
index 00000000000..53fb55118e6
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_func001.test
@@ -0,0 +1,57 @@
+#############################################################################
+# This test is being created to test out the non deterministic items with #
+# row based replication. #
+# Original Author: JBM #
+# Original Date: Aug/10/2005 #
+# Update: 08/29/2005 change name to initails #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+--error 0,1305
+DROP FUNCTION test.f1;
+DROP TABLE IF EXISTS test.t1;
+
+
+--enable_warnings
+
+# Section 1 test from bug #12487 Uses stored function to insert rows to see what is replicated.
+
+create table test.t1 (a int, PRIMARY KEY(a));
+
+delimiter //;
+create function test.f1(i int) returns int
+begin
+insert into test.t1 values(i);
+return 0;
+end//
+delimiter ;//
+
+select test.f1(1);
+select test.f1(2);
+select * from test.t1;
+
+save_master_pos;
+sync_slave_with_master;
+connection slave;
+#show create table test.t1;
+select * from test.t1;
+
+connection master;
+
+#Used for debugging
+#show binlog events;
+
+# Cleanup
+
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_func002.test b/mysql-test/suite/rpl/t/rpl_row_func002.test
new file mode 100644
index 00000000000..44a704bfbc5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_func002.test
@@ -0,0 +1,104 @@
+#############################################################################
+# This test is being created to test out the non deterministic items with #
+# row based replication. #
+# Original Author: JBM #
+# Original Date: Aug/10/2005 #
+# Update: 08/29/2005 Turn on diff #
+#############################################################################
+# Note: Many lines are commented out in this test case. These were used for #
+# creating the test case and debugging and are being left for #
+# debugging, but they can not be used for the regular testing as the #
+# Time changes and is not deteministic, so instead we dump both the #
+# master and slave and diff the dumps. If the dumps differ then the #
+# test case will fail. To run during diff failuers, comment out the #
+# diff. #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+--error 0,1305
+DROP FUNCTION test.f1;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+
+--enable_warnings
+
+# Section 1 test from Peter G. This test changes uses a stored function to update rows and return the timestamp. We change the value of the time stamp on the master to see what is replicated.
+
+CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
+CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
+
+delimiter //;
+create function test.f1() RETURNS TIMESTAMP
+BEGIN
+UPDATE test.t1 SET t = CURRENT_TIMESTAMP;
+RETURN CURRENT_TIMESTAMP;
+END//
+delimiter ;//
+
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+#select * from test.t1;
+#save_master_pos;
+#sync_slave_with_master;
+#connection slave;
+#select * from test.t1;
+#connection master;
+
+
+SET TIMESTAMP=2;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+#select * from test.t1;
+#save_master_pos;
+#sync_slave_with_master;
+#connection slave;
+#select * from test.t1;
+#connection master;
+
+#sleep 3;
+SET TIMESTAMP=1;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+#select * from test.t1;
+#save_master_pos;
+#sync_slave_with_master;
+#connection slave;
+#select * from test.t1;
+#connection master;
+
+
+SET TIMESTAMP=333300000;
+INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
+
+# We need a sync to ensure that the slave has caught up before
+# dumping the database.
+sync_slave_with_master;
+
+connection master;
+#Used for debugging
+#show binlog events;
+
+# time to dump the databases and so we can see if they match
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func002_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func002_slave.sql
+
+# Cleanup
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+sync_slave_with_master;
+
+# the test will show that the diff statement failed and no reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-). The files are located
+# in mysql-test/var/tmp
+
+diff_files $MYSQLTEST_VARDIR/tmp/func002_master.sql $MYSQLTEST_VARDIR/tmp/func002_slave.sql;
+
+# End of 5.0 test case
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_func003-slave.opt b/mysql-test/suite/rpl/t/rpl_row_func003-slave.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_func003-slave.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_func003.test b/mysql-test/suite/rpl/t/rpl_row_func003.test
new file mode 100644
index 00000000000..abfadfe1a1a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_func003.test
@@ -0,0 +1,11 @@
+###################################
+# Wrapper for rpl_row_func003.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;
+-- source extra/rpl_tests/rpl_row_func003.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt
new file mode 100644
index 00000000000..abd717f8222
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt
@@ -0,0 +1 @@
+--replicate-ignore-table=test.t2
diff --git a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test
new file mode 100644
index 00000000000..803c214b6c5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test
@@ -0,0 +1,35 @@
+# Test to see what slave says when master is updating a table it does
+# not have
+--source include/have_binlog_format_row.inc
+
+source include/master-slave.inc;
+
+connection master;
+create table t1 (a int not null primary key);
+insert into t1 values (1);
+create table t2 (a int);
+insert into t2 values (1);
+update t1, t2 set t1.a = 0 where t1.a = t2.a;
+
+sync_slave_with_master;
+# t2 should not have been replicated
+# t1 should have been properly updated
+show tables;
+select * from t1;
+drop table t1;
+
+connection master;
+insert into t1 values (1);
+
+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:
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 8 # 9 # 23 # 33 #
+--vertical_results
+show slave status;
+
+# cleanup
+connection master;
+drop table t1, t2;
diff --git a/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test b/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test
new file mode 100644
index 00000000000..9aeb57c4fa2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test
@@ -0,0 +1,14 @@
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+--source include/not_embedded.inc
+--source include/not_windows.inc
+
+connection master;
+set @old_global_binlog_format = @@global.binlog_format;
+
+let $binlog_format_statement=0;
+set @@global.binlog_format = row;
+--source extra/rpl_tests/rpl_insert_delayed.test
+
+connection master;
+set @@global.binlog_format = @old_global_binlog_format;
diff --git a/mysql-test/suite/rpl/t/rpl_row_log-master.opt b/mysql-test/suite/rpl/t/rpl_row_log-master.opt
new file mode 100644
index 00000000000..e0d075c3fbd
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_log-master.opt
@@ -0,0 +1 @@
+--skip-external-locking
diff --git a/mysql-test/suite/rpl/t/rpl_row_log-slave.opt b/mysql-test/suite/rpl/t/rpl_row_log-slave.opt
new file mode 100644
index 00000000000..8b137891791
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_log-slave.opt
@@ -0,0 +1 @@
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_log.test b/mysql-test/suite/rpl/t/rpl_row_log.test
new file mode 100644
index 00000000000..3253ae9ecba
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_log.test
@@ -0,0 +1,16 @@
+###################################
+# Wrapper for rpl_row_log.test #
+# Added wrapper so that MyISAM & #
+# Innodb and NDB could all use the#
+# Same test. NDB produced a diff #
+# bin-log #
+###################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/not_ndb_default.inc
+-- source include/have_binlog_format_row.inc
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_log.test
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_log_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_row_log_innodb-master.opt
new file mode 100644
index 00000000000..e0d075c3fbd
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_log_innodb-master.opt
@@ -0,0 +1 @@
+--skip-external-locking
diff --git a/mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_log_innodb.test b/mysql-test/suite/rpl/t/rpl_row_log_innodb.test
new file mode 100644
index 00000000000..5e5182e3519
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_log_innodb.test
@@ -0,0 +1,13 @@
+###################################
+# Wrapper for rpl_row_log.test #
+# Added wrapper so that MyISAM & #
+# Innodb and NDB could all use the#
+# Same test. NDB produced a diff #
+# bin-log #
+###################################
+-- source include/not_ndb_default.inc
+-- source include/have_binlog_format_row.inc
+-- source include/have_innodb.inc
+let $engine_type=InnoDB;
+-- source extra/rpl_tests/rpl_log.test
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test b/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test
new file mode 100644
index 00000000000..a0be59e44a7
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test
@@ -0,0 +1,11 @@
+# Test of options max_binlog_size and max_relay_log_size and
+# how they act (if max_relay_log_size == 0, use max_binlog_size
+# for relay logs too).
+# Test of manual relay log rotation with FLUSH LOGS.
+
+# Requires statement logging
+-- source include/not_ndb_default.inc
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL BINLOG_FORMAT=ROW;
+-- source extra/rpl_tests/rpl_max_relay_size.test
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog-master.opt b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog-master.opt
new file mode 100644
index 00000000000..07d12817f5f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog-master.opt
@@ -0,0 +1 @@
+--max-binlog-size=1040384
diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
new file mode 100644
index 00000000000..dd46d64f684
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
@@ -0,0 +1,348 @@
+##################################################################
+# Author: JBM #
+# Date: 2006-02-22 #
+# Purpose: To test changes to mysqlbinlog for row based bin logs #
+# We are using .opt file since we need small binlog size #
+##################################################################
+# Include Section
+# Make sure that we have row based bin log
+-- source include/have_binlog_format_row.inc
+# Embedded server doesn't support binlogging
+-- source include/not_embedded.inc
+-- source include/master-slave.inc
+# This test requires the cp932 charset compiled in
+-- source include/have_cp932.inc
+
+# Setup Section
+# we need this for getting fixed timestamps inside of this test
+
+--disable_query_log
+select "---Setup Section --" as "";
+--enable_query_log
+
+set timestamp=1000000000;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3;
+--enable_warnings
+
+connection master;
+CREATE TABLE t1(word VARCHAR(20));
+CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
+CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
+
+
+# Test Section
+# Lets start by putting some data into the tables.
+
+--disable_query_log
+INSERT INTO t1 VALUES ("abirvalg");
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+
+# d1 length 3000
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+
+let $count=500;
+while ($count)
+{
+ INSERT INTO t2 VALUES (NULL);
+ eval INSERT INTO t3 VALUES ($count,@d1,'20060222000000','Tested in Texas',$count*2.2);
+ dec $count;
+}
+--enable_query_log
+
+
+--disable_query_log
+select "---Test1 check table load --" as "";
+--enable_query_log
+
+# Lets Check the tables on the Master
+SELECT COUNT(*) from t1;
+SELECT COUNT(*) from t2;
+SELECT COUNT(*) from t3;
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+
+# Should have the same on the slave;
+
+sync_slave_with_master;
+SELECT COUNT(*) from t1;
+SELECT COUNT(*) from t2;
+SELECT COUNT(*) from t3;
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+
+# Okay time to get busy, back to master
+
+connection master;
+
+# simple query to show more in second binlog
+insert into t1 values ("Alas");
+flush logs;
+
+# delimiters are for easier debugging in future
+--disable_query_log
+select "--- Test 1 Dump binlog to file --" as "";
+--enable_query_log
+
+#
+# Prepare local temporary file to recreate what we have currently.
+
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql
+
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql
+
+# Now that we have our file, lets get rid of the current database.
+# Cleanup the master and the slave and try to recreate.
+--disable_query_log
+select "--- Test 1 delete tables, clean master and slave --" as "";
+--enable_query_log
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+sync_slave_with_master;
+#we expect STOP SLAVE to produce a warning as the slave is stopped
+#(the server was started with skip-slave-start)
+--disable_warnings
+stop slave;
+--enable_warnings
+--require r/slave-stopped.result
+show status like 'Slave_running';
+connection master;
+reset master;
+connection slave;
+reset slave;
+start slave;
+--require r/slave-running.result
+show status like 'Slave_running';
+connection master;
+
+# We should be clean at this point, now we will run in the file from above.
+--disable_query_log
+select "--- Test 1 Load from Dump binlog file --" as "";
+--enable_query_log
+
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/master.sql"
+
+--disable_query_log
+select "--- Test 1 Check Load Results --" as "";
+--enable_query_log
+
+# Lets Check the tables on the Master
+SELECT COUNT(*) from t1;
+SELECT COUNT(*) from t2;
+SELECT COUNT(*) from t3;
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+
+# Should have the same on the slave;
+
+sync_slave_with_master;
+SELECT COUNT(*) from t1;
+SELECT COUNT(*) from t2;
+SELECT COUNT(*) from t3;
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+connection master;
+
+# We should be gold by the time, so I will get rid of our file.
+
+--exec rm $MYSQLTEST_VARDIR/tmp/master.sql
+
+
+# this test for position option
+# By setting this position to 413, we should only get the create of t3
+--disable_query_log
+select "--- Test 2 position test --" as "";
+--enable_query_log
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 $MYSQLTEST_VARDIR/log/master-bin.000001
+
+# These are tests for remote binlog.
+# They should return the same as previous test.
+
+--disable_query_log
+select "--- Test 3 First Remote test --" as "";
+--enable_query_log
+
+# This is broken now
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+
+# This part is disabled due to bug #17654
+
+--disable_query_log
+select "--- Test 4 Second Remote test --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
+
+--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql
+
+# Now that we have our file, lets get rid of the current database.
+# Cleanup the master and the slave and try to recreate.
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+sync_slave_with_master;
+
+#we expect STOP SLAVE to produce a warning as the slave is stopped
+#(the server was started with skip-slave-start)
+
+--disable_warnings
+stop slave;
+--enable_warnings
+--require r/slave-stopped.result
+show status like 'Slave_running';
+connection master;
+reset master;
+connection slave;
+reset slave;
+start slave;
+--require r/slave-running.result
+show status like 'Slave_running';
+connection master;
+
+# We should be clean at this point, now we will run in the file from above.
+
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/remote.sql"
+
+# Lets Check the tables on the Master
+
+SELECT COUNT(*) from t1;
+SELECT COUNT(*) from t2;
+SELECT COUNT(*) from t3;
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+
+# Should have the same on the slave;
+
+sync_slave_with_master;
+SELECT COUNT(*) from t1;
+SELECT COUNT(*) from t2;
+SELECT COUNT(*) from t3;
+SELECT * FROM t1 ORDER BY word LIMIT 5;
+SELECT * FROM t2 ORDER BY id LIMIT 5;
+SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
+connection master;
+
+# We should be gold by the time, so I will get rid of our file.
+
+--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql
+################### End Bug 17654 ######################
+
+# LOAD DATA
+--disable_query_log
+select "--- Test 5 LOAD DATA --" as "";
+--enable_query_log
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
+
+# Bug#7853 (mysqlbinlog does not accept input from stdin)
+
+--disable_query_log
+select "--- Test 6 reading stdin --" as "";
+--enable_query_log
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+--exec $MYSQL_BINLOG --short-form - < $MYSQLTEST_VARDIR/log/master-bin.000001
+
+--disable_query_log
+select "--- Test 7 reading stdin w/position --" as "";
+--enable_query_log
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+--exec $MYSQL_BINLOG --short-form --position=416 - < $MYSQLTEST_VARDIR/log/master-bin.000001
+
+# Bug#16217 (mysql client did not know how not switch its internal charset)
+--disable_query_log
+select "--- Test 8 switch internal charset --" as "";
+--enable_query_log
+sync_slave_with_master;
+
+#we expect STOP SLAVE to produce a warning as the slave is stopped
+#(the server was started with skip-slave-start)
+
+--disable_warnings
+stop slave;
+--enable_warnings
+--require r/slave-stopped.result
+show status like 'Slave_running';
+connection master;
+reset master;
+connection slave;
+reset slave;
+start slave;
+--require r/slave-running.result
+show status like 'Slave_running';
+connection master;
+
+create table t4 (f text character set utf8);
+create table t5 (f text character set cp932);
+--exec $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'ソ')"
+--exec $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'ƒ\');"
+flush logs;
+rename table t4 to t04, t5 to t05;
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL --default-character-set=utf8
+# original and recovered data must be equal
+select HEX(f) from t04;
+select HEX(f) from t4;
+select HEX(f) from t05;
+select HEX(f) from t5;
+
+# slave should have same
+sync_slave_with_master;
+select HEX(f) from t04;
+select HEX(f) from t4;
+select HEX(f) from t05;
+select HEX(f) from t5;
+
+--disable_query_log
+select "--- Test cleanup --" as "";
+--enable_query_log
+# clean up
+connection master;
+sync_slave_with_master;
+
+connection master;
+
+# BUG#17654 also test mysqlbinlog to ensure it can read the binlog from a remote server
+# and ensure that the results are the same as if read from a file (the same file).
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT NOT NULL KEY, b INT);
+
+INSERT INTO t1 VALUES(1,1);
+
+SELECT * FROM t1;
+
+FLUSH LOGS;
+
+--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/local.sql
+
+--diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql
+
+--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql
+
+--exec rm $MYSQLTEST_VARDIR/tmp/local.sql
+
+DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_row_mystery22.test b/mysql-test/suite/rpl/t/rpl_row_mystery22.test
new file mode 100644
index 00000000000..9933fec22fc
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_mystery22.test
@@ -0,0 +1,45 @@
+# Originally taken from rpl_mystery22.test,
+# but this row-based-replication test has a totally different spirit:
+# slave will not stop because of dup key,
+# instead we test if it does overwrite the dup key
+# as expected.
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# first, cause a duplicate key problem on the slave
+create table t1(n int auto_increment primary key, s char(10));
+sync_slave_with_master;
+insert into t1 values (2,'old');
+connection master;
+insert into t1 values(NULL,'new');
+insert into t1 values(NULL,'new');
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1 order by n;
+delete from t1 where n = 2;
+--disable_warnings
+start slave;
+--enable_warnings
+sync_with_master;
+stop slave;
+connection master;
+create table t2(n int);
+drop table t2;
+insert into t1 values(NULL,'new');
+# what happens when we delete a row which does not exist on slave?
+set sql_log_bin=0;
+insert into t1 values(NULL,'new');
+set sql_log_bin=1;
+delete from t1 where n=4;
+save_master_pos;
+connection slave;
+--disable_warnings
+start slave;
+--enable_warnings
+sync_with_master;
+select * from t1 order by n;
+#clean up
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_row_reset_slave.test b/mysql-test/suite/rpl/t/rpl_row_reset_slave.test
new file mode 100644
index 00000000000..a970c161153
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_reset_slave.test
@@ -0,0 +1,5 @@
+# TBF - difference in row level logging
+# Temp tables are not replicated in rbr, but it is still good to hit rbr with everthing
+-- source include/have_binlog_format_row.inc
+-- source extra/rpl_tests/rpl_reset_slave.test
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp001.test b/mysql-test/suite/rpl/t/rpl_row_sp001.test
new file mode 100644
index 00000000000..c12e73b6861
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp001.test
@@ -0,0 +1,146 @@
+#############################################################################
+# This test is being created to test out the non deterministic items with #
+# row based replication. #
+# Original Author: JBM #
+# Original Date: Aug/09/2005 #
+# Updated: Aug/29/2005
+#############################################################################
+# Test: Includes two stored procedure tests. First test uses SP to insert #
+# values from RAND() and NOW() into a table. #
+# The second test uses SP with CASE structure to decide what to text #
+# to update a given table with. #
+############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+-- disable_query_log
+-- disable_result_log
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+
+-- enable_query_log
+-- enable_result_log
+
+# Begin test section 1 for non deterministic SP
+let $message=<Begin test section 1 (non deterministic SP)>;
+--source include/show_msg.inc
+
+create table test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+
+delimiter //;
+create procedure test.p1()
+begin
+ INSERT INTO test.t1 (f,d) VALUES (RAND(),NOW());
+end//
+delimiter ;//
+
+# show binlog events;
+
+-- disable_query_log
+-- disable_result_log
+let $1=10;
+while ($1)
+{
+ call test.p1();
+ sleep 1;
+ dec $1;
+}
+-- enable_result_log
+-- enable_query_log
+
+## Used for debugging
+#show binlog events;
+#select * from test.t1;
+#sync_slave_with_master;
+#select * from test.t1;
+#connection master;
+
+let $message=<End test section 1 (non deterministic SP)>;
+--source include/show_msg.inc
+
+
+CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t CHAR(4), PRIMARY KEY(a));
+
+delimiter //;
+CREATE PROCEDURE test.p2(n int)
+begin
+CASE n
+WHEN 1 THEN
+ UPDATE test.t2 set t ='Tex';
+WHEN 2 THEN
+ UPDATE test.t2 set t ='SQL';
+ELSE
+ UPDATE test.t2 set t ='NONE';
+END CASE;
+end//
+delimiter ;//
+
+INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW');
+
+SELECT * FROM t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM t2 ORDER BY a;
+
+connection master;
+call test.p2(1);
+SELECT * FROM t2 ORDER BY a;
+sync_slave_with_master;
+SELECT * FROM t2 ORDER BY a;
+
+
+connection master;
+call test.p2(2);
+SELECT * FROM t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM t2 ORDER BY a;
+
+connection master;
+call test.p2(3);
+SELECT * FROM t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM t2 ORDER BY a;
+
+##Used for debugging
+#show binlog events;
+
+# time to dump the databases and so we can see if they match
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_slave.sql
+
+# First lets cleanup
+
+connection master;
+DROP PROCEDURE test.p1;
+DROP PROCEDURE test.p2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+sync_slave_with_master;
+
+# Lets compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-) Failed dump files
+# will be located in $MYSQLTEST_VARDIR/tmp
+
+diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
+
+# If all is good, when can cleanup our dump files.
+--remove_file $MYSQLTEST_VARDIR/tmp/sp001_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test
new file mode 100644
index 00000000000..e272e34e715
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test
@@ -0,0 +1,11 @@
+#################################
+# 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;
+-- source extra/rpl_tests/rpl_row_sp002.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp003-master.opt b/mysql-test/suite/rpl/t/rpl_row_sp003-master.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp003-master.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp003.test b/mysql-test/suite/rpl/t/rpl_row_sp003.test
new file mode 100644
index 00000000000..99b30253c8a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp003.test
@@ -0,0 +1,11 @@
+#################################
+# Wrapper for rpl_row_sp003.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;
+-- source extra/rpl_tests/rpl_row_sp003.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp005.test b/mysql-test/suite/rpl/t/rpl_row_sp005.test
new file mode 100644
index 00000000000..054fa02f514
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp005.test
@@ -0,0 +1,110 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/15/2005 #
+# Updated: Aug/29/2005: Removed sleeps #
+#############################################################################
+# Test: Tests SPs with cursors, flow logic, and alter sp. In addition the #
+# tests SPs with insert and update operations. #
+#############################################################################
+# 2006-02-08 By JBM added ORDER BY for use with NDB engine
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t3;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+CREATE TABLE IF NOT EXISTS test.t1(id INT, data CHAR(16),PRIMARY KEY(id));
+CREATE TABLE IF NOT EXISTS test.t2(id2 INT,PRIMARY KEY(id2));
+CREATE TABLE IF NOT EXISTS test.t3(id3 INT,PRIMARY KEY(id3), c CHAR(16));
+
+delimiter |;
+CREATE PROCEDURE test.p1()
+BEGIN
+DECLARE done INT DEFAULT 0;
+ DECLARE spa CHAR(16);
+ DECLARE spb,spc INT;
+ DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1 ORDER BY id;
+ DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2 ORDER BY id2;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+
+ OPEN cur1;
+ OPEN cur2;
+
+ REPEAT
+ FETCH cur1 INTO spb, spa;
+ FETCH cur2 INTO spc;
+ IF NOT done THEN
+ IF spb < spc THEN
+ INSERT INTO test.t3 VALUES (spb,spa);
+ ELSE
+ INSERT INTO test.t3 VALUES (spc,spa);
+ END IF;
+ END IF;
+ UNTIL done END REPEAT;
+
+ CLOSE cur1;
+ CLOSE cur2;
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+ INSERT INTO test.t1 VALUES (4,'MySQL'),(20,'ROCKS'),(11,'Texas'),(10,'kyle');
+ INSERT INTO test.t2 VALUES (4),(2),(1),(3);
+ UPDATE test.t1 SET id=id+4 WHERE id=4;
+END|
+delimiter ;|
+
+let $message=< ---- Master selects-- >;
+--source include/show_msg.inc
+CALL test.p2();
+SELECT * FROM test.t1 ORDER BY id;
+SELECT * FROM test.t2 ORDER BY id2;
+
+let $message=< ---- Slave selects-- >;
+--source include/show_msg.inc
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1 ORDER BY id;
+SELECT * FROM test.t2 ORDER BY id2;
+
+let $message=< ---- Master selects-- >;
+--source include/show_msg.inc
+connection master;
+CALL test.p1();
+sleep 6;
+SELECT * FROM test.t3 ORDER BY id3;
+
+let $message=< ---- Slave selects-- >;
+--source include/show_msg.inc
+connection slave;
+SELECT * FROM test.t3 ORDER BY id3;
+
+connection master;
+
+ALTER PROCEDURE test.p1 MODIFIES SQL DATA;
+#show binlog events;
+
+# Cleanup
+
+connection master;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test b/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test
new file mode 100644
index 00000000000..f7e59440027
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test
@@ -0,0 +1,11 @@
+#################################
+# Wrapper for rpl_row_sp006.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;
+-- source extra/rpl_tests/rpl_row_sp006.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test b/mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test
new file mode 100644
index 00000000000..41af5a5f997
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test
@@ -0,0 +1,11 @@
+#################################
+# 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;
+-- source extra/rpl_tests/rpl_row_sp007.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp008.test b/mysql-test/suite/rpl/t/rpl_row_sp008.test
new file mode 100644
index 00000000000..b1295820c99
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp008.test
@@ -0,0 +1,57 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/15/2005 #
+# Update: 08/29/2005 Remove sleep #
+#############################################################################
+# TEST: Use SQL_CALC_FOUND_ROWS and insert results into a table inside a sp #
+#############################################################################
+
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t2;
+--enable_warnings
+# End of cleanup
+
+
+
+# Begin test section 1
+CREATE TABLE test.t1 (a INT,PRIMARY KEY(a));
+CREATE TABLE test.t2 (a INT,PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES(1),(2);
+
+delimiter |;
+CREATE PROCEDURE test.p1()
+BEGIN
+ SELECT SQL_CALC_FOUND_ROWS * FROM test.t1 LIMIT 1;
+ INSERT INTO test.t2 VALUES(FOUND_ROWS());
+END|
+delimiter ;|
+
+let $message=< ---- Master selects-- >;
+--source include/show_msg.inc
+CALL test.p1();
+SELECT * FROM test.t2;
+
+let $message=< ---- Slave selects-- >;
+--source include/show_msg.inc
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2;
+
+# Cleanup
+
+connection master;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp009.test b/mysql-test/suite/rpl/t/rpl_row_sp009.test
new file mode 100644
index 00000000000..92d47c6f50f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp009.test
@@ -0,0 +1,105 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+# Updated: 08/29/2005 removed sleeps and added master pos save and snyc #
+#############################################################################
+#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12168 #
+#############################################################################
+# 2006-02-08 By JBM : Added order by for ndb engine use
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+
+
+# Begin test section 1
+CREATE TABLE test.t1 (a INT, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES (1),(2),(3),(4);
+CREATE TABLE test.t2 (a INT, PRIMARY KEY(a));
+
+delimiter |;
+CREATE PROCEDURE test.p1 (arg1 CHAR(1))
+BEGIN
+ DECLARE b, c INT;
+ IF arg1 = 'a' THEN
+ BEGIN
+ DECLARE cur1 CURSOR FOR SELECT A FROM test.t1 WHERE a % 2;
+ DECLARE continue handler for not found set b = 1;
+ SET b = 0;
+ OPEN cur1;
+ c1_repeat: REPEAT
+ FETCH cur1 INTO c;
+ IF (b = 1) THEN
+ LEAVE c1_repeat;
+ END IF;
+
+ INSERT INTO test.t2 VALUES (c);
+ UNTIL b = 1
+ END REPEAT;
+ CLOSE cur1;
+ END;
+ END IF;
+ IF arg1 = 'b' THEN
+ BEGIN
+ DECLARE cur2 CURSOR FOR SELECT a FROM test.t1 WHERE NOT a % 2;
+ DECLARE continue handler for not found set b = 1;
+ SET b = 0;
+ OPEN cur2;
+ c2_repeat: REPEAT
+ FETCH cur2 INTO c;
+ IF (b = 1) THEN
+ LEAVE c2_repeat;
+ END IF;
+
+ INSERT INTO test.t2 VALUES (c);
+ UNTIL b = 1
+ END REPEAT;
+ CLOSE cur2;
+ END;
+ END IF;
+END|
+delimiter ;|
+
+CALL test.p1('a');
+SELECT * FROM test.t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2 ORDER BY a;
+connection master;
+truncate test.t2;
+
+# this next call fails, but should not
+call test.p1('b');
+select * from test.t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2 ORDER BY a;
+
+connection master;
+truncate test.t2;
+SELECT * FROM test.t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2 ORDER BY a;
+
+# Cleanup
+connection master;
+#show binlog events;
+DROP PROCEDURE test.p1;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp010.test b/mysql-test/suite/rpl/t/rpl_row_sp010.test
new file mode 100644
index 00000000000..28b82217517
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp010.test
@@ -0,0 +1,80 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+# Update: 08/29/2005 remove sleep added master pos save and sync #
+#############################################################################
+#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=11126 #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+
+
+# Begin test section 1
+delimiter |;
+CREATE PROCEDURE test.p1()
+BEGIN
+ INSERT INTO test.t1 VALUES(2);
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+ DROP TEMPORARY TABLE IF EXISTS test.t1;
+ CREATE TEMPORARY TABLE test.t1 (a int, PRIMARY KEY(a));
+ INSERT INTO test.t1 VALUES(1);
+ CALL test.p1();
+END|
+delimiter ;|
+CALL test.p2();
+SELECT * FROM test.t1 ORDER BY a;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+show tables;
+
+connection master;
+delimiter |;
+CREATE PROCEDURE test.p3()
+BEGIN
+ INSERT INTO test.t2 VALUES(7);
+END|
+CREATE PROCEDURE test.p4()
+BEGIN
+ DROP TABLE IF EXISTS test.t2;
+ CREATE TABLE test.t2 (a int, PRIMARY KEY(a));
+ INSERT INTO test.t2 VALUES(6);
+ CALL test.p3();
+END|
+delimiter ;|
+CALL test.p4();
+SELECT * FROM test.t2 ORDER BY a;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2 ORDER BY a;
+
+# Cleanup
+connection master;
+#show binlog events;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp011.test b/mysql-test/suite/rpl/t/rpl_row_sp011.test
new file mode 100644
index 00000000000..25c2fc9ad26
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp011.test
@@ -0,0 +1,111 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+# Updated: 08/29/2005 turned on diff and commented out debug SQL statements#
+#############################################################################
+#TEST: SP to test alter table and nested SP calls #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP PROCEDURE IF EXISTS test.p5;
+DROP PROCEDURE IF EXISTS test.p6;
+DROP PROCEDURE IF EXISTS test.p7;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+
+
+# Begin test section 1
+CREATE TABLE test.t1 (a int, PRIMARY KEY(a));
+INSERT INTO test.t1 VALUES (1);
+
+delimiter |;
+CREATE PROCEDURE test.p1()
+BEGIN
+ ALTER TABLE test.t1 ADD COLUMN b CHAR(4) AFTER a;
+ UPDATE test.t1 SET b = 'rbr' WHERE a = 1;
+ CALL test.p2();
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+ ALTER TABLE test.t1 ADD COLUMN f FLOAT AFTER b;
+ UPDATE test.t1 SET f = RAND() WHERE a = 1;
+ CALL test.p3();
+END|
+CREATE PROCEDURE test.p3()
+BEGIN
+ ALTER TABLE test.t1 RENAME test.t2;
+ CALL test.p4();
+END|
+CREATE PROCEDURE test.p4()
+BEGIN
+ ALTER TABLE test.t2 ADD INDEX (f);
+ ALTER TABLE test.t2 CHANGE a a INT UNSIGNED NOT NULL AUTO_INCREMENT;
+ INSERT INTO test.t2 VALUES (NULL,'TEST',RAND());
+ CALL test.p5();
+END|
+CREATE PROCEDURE test.p5()
+BEGIN
+ ALTER TABLE test.t2 ORDER BY f;
+ INSERT INTO test.t2 VALUES (NULL,'STM',RAND());
+ CALL test.p6();
+END|
+CREATE PROCEDURE test.p6()
+BEGIN
+ ALTER TABLE test.t2 ADD COLUMN b2 CHAR(4) FIRST;
+ ALTER TABLE test.t2 ADD COLUMN to_drop BIT(8) AFTER b2;
+ INSERT INTO test.t2 VALUES ('new',1,NULL,'STM',RAND());
+ CALL test.p7();
+END|
+CREATE PROCEDURE test.p7()
+BEGIN
+ ALTER TABLE test.t2 DROP COLUMN to_drop;
+ INSERT INTO test.t2 VALUES ('gone',NULL,'STM',RAND());
+END|
+delimiter ;|
+CALL test.p1();
+
+#SELECT * FROM test.t2;
+sync_slave_with_master;
+#SELECT * FROM test.t2;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_slave.sql
+
+# Cleanup
+connection master;
+#show binlog events;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p4;
+DROP PROCEDURE IF EXISTS test.p5;
+DROP PROCEDURE IF EXISTS test.p6;
+DROP PROCEDURE IF EXISTS test.p7;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+sync_slave_with_master;
+
+# Lets compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-) Failed test
+# Will leave dump files in $MYSQLTEST_VARDIR/tmp
+
+diff_files $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_slave.sql;
+
+# If all is good, when can cleanup our dump files.
+--remove_file $MYSQLTEST_VARDIR/tmp/sp011_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/sp011_slave.sql
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp012.test b/mysql-test/suite/rpl/t/rpl_row_sp012.test
new file mode 100644
index 00000000000..3a8d295121c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp012.test
@@ -0,0 +1,75 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/22/2005 #
+# Update: 08/29/2005 Added save pos and sync #
+#############################################################################
+#TEST: SP to test security and current_user and user #
+#############################################################################
+
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/not_embedded.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+
+
+# Begin test section 1
+# Create user user1 with no particular access rights
+grant usage on *.* to user1@localhost;
+flush privileges;
+
+SELECT CURRENT_USER();
+SELECT USER();
+CREATE PROCEDURE test.p1 () SQL SECURITY INVOKER SELECT CURRENT_USER(), USER();
+CREATE PROCEDURE test.p2 () SQL SECURITY DEFINER CALL test.p1();
+CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
+GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
+GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
+GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
+
+# Need to wait for the rights to be applied at the slave
+sync_slave_with_master;
+
+let $message=<******** Master user1 p3 & p2 calls *******>;
+--source include/show_msg.inc
+connect (muser1,localhost,user1,,);
+connection muser1;
+SELECT CURRENT_USER();
+SELECT USER();
+CALL test.p3();
+CALL test.p2();
+
+let $message=<******** Slave user1 p3 & p2 calls *******>;
+--source include/show_msg.inc
+connect (suser1,127.0.0.1,user1,,test,$SLAVE_MYPORT,);
+
+connection master;
+save_master_pos;
+connection suser1;
+sync_with_master;
+
+SELECT CURRENT_USER();
+SELECT USER();
+CALL test.p3();
+CALL test.p2();
+
+# Cleanup
+connection master;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP USER user1@localhost;
+sync_slave_with_master;
+
+# End of 5.0 test case
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle.test b/mysql-test/suite/rpl/t/rpl_row_stop_middle.test
new file mode 100644
index 00000000000..da363736100
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_stop_middle.test
@@ -0,0 +1,44 @@
+# Test for BUG#11729: see if, when STOP SLAVE occurs while the slave
+# SQL thread has processed a Table_map_log_event but has not processed
+# the last Rows_log_event associated to it, the slave thread does not
+# forget to close its tables.
+
+# Can be run with statement-based but no interest (and long test)
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+connection master;
+create table t1 (a int not null auto_increment primary key, b int, key(b));
+sync_slave_with_master;
+stop slave;
+connection master;
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+INSERT INTO t1 (a) SELECT null FROM t1;
+
+connection slave;
+start slave;
+
+# hope one second is not enough for slave to reach the last
+# Rows_log_event, so that test actually tests something.
+
+real_sleep 1;
+stop slave;
+
+# see if slave hangs on DROP TABLE
+
+drop table t1;
+
+connection master; # cleanup
+drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt
new file mode 100644
index 00000000000..b7db8f97bdd
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt
@@ -0,0 +1 @@
+--loose-binlog-row-event-max-size=256
diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt
new file mode 100644
index 00000000000..ea49a27adf4
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt
@@ -0,0 +1 @@
+--loose-debug=d,STOP_SLAVE_after_first_Rows_event
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
new file mode 100644
index 00000000000..29b3008e822
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
@@ -0,0 +1,31 @@
+-- source include/have_binlog_format_row.inc
+-- source include/have_debug.inc
+-- source include/master-slave.inc
+
+# master is asked to create small Rows events: if only one event is
+# created, stopping slave at the end of that one will show no bug, we
+# need at least two (and stop after first); in this test we use three.
+
+connection master;
+create table t1 (words varchar(20)) engine=myisam;
+
+load data infile '../std_data_ln/words.dat' into table t1 (words);
+select count(*) from t1;
+save_master_pos;
+
+connection slave;
+
+# slave will automatically tell itself to stop thanks to the .opt
+# file; it will initiate the stop request after the first
+# Rows_log_event (out of 3) but should wait until the last one is
+# executed before stopping.
+
+wait_for_slave_to_stop;
+
+# check that we inserted all rows (waited until the last Rows event)
+select count(*) from t1;
+
+connection master;
+drop table t1;
+connection slave; # slave SQL thread is stopped
+drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test b/mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test
new file mode 100644
index 00000000000..ab4914e15fa
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test
@@ -0,0 +1,8 @@
+
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+let $engine_type = 'MyISAM';
+-- source extra/rpl_tests/rpl_row_tabledefs.test
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test b/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test
new file mode 100644
index 00000000000..7824fbfb663
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test
@@ -0,0 +1,9 @@
+
+-- 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_row_tabledefs.test
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_trig001.test b/mysql-test/suite/rpl/t/rpl_row_trig001.test
new file mode 100644
index 00000000000..7b1fca2d6a1
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_trig001.test
@@ -0,0 +1,100 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/09/2005 #
+#############################################################################
+# TEST: Use after insert and before inset triggers and stored procdures to #
+# Update and insert data #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+-- disable_query_log
+-- disable_result_log
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+--error 0,1360
+DROP TRIGGER test.t2_ai;
+--error 0,1360
+DROP TRIGGER test.t3_bi_t2;
+--error 0,1360
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+
+
+# test section 1, lets add a trigger to the mix. Taken from bug #12280
+let $message=<Begin test section 1 (Tiggers & SP)>;
+--source include/show_msg.inc
+
+CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n));
+CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n));
+
+INSERT INTO test.t1 VALUES (1,NOW());
+
+delimiter //;
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1;//
+CREATE PROCEDURE test.p3()
+BEGIN
+ INSERT INTO test.t3 (d) VALUES (NOW());
+END//
+CREATE TRIGGER test.t3_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW CALL test.p3()//
+CREATE PROCEDURE test.p2()
+BEGIN
+ INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW());
+END//
+delimiter ;//
+
+-- disable_query_log
+-- disable_result_log
+let $1=10;
+while ($1)
+{
+ CALL test.p2();
+ sleep 1;
+ dec $1;
+}
+-- enable_result_log
+-- enable_query_log
+
+#show binlog events;
+#select * from test.t2;
+#select * from test.t3;
+#connection slave;
+#select * from test.t2;
+#select * from test.t3;
+
+let $message=<End test section 2 (Tiggers & SP)>;
+--source include/show_msg.inc
+
+# time to dump the databases and so we can see if they match
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_slave.sql
+
+# Cleanup
+connection master;
+DROP PROCEDURE test.p2;
+DROP PROCEDURE test.p3;
+DROP TRIGGER test.t2_ai;
+DROP TRIGGER test.t3_bi_t2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+sync_slave_with_master;
+
+# Lets compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching :-) Failed tests
+# will leave dump files in $MYSQLTEST_VARDIR/tmp
+
+diff_files $MYSQLTEST_VARDIR/tmp/trig001_master.sql $MYSQLTEST_VARDIR/tmp/trig001_slave.sql;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_trig002.test b/mysql-test/suite/rpl/t/rpl_row_trig002.test
new file mode 100644
index 00000000000..7ca8a68f060
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_trig002.test
@@ -0,0 +1,80 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/14/2005 #
+# Updated: 08/29/2005 added save master pos and sync with master #
+#############################################################################
+# TEST: Taken and modified from BUG#12048 After Insert updates replication #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+#-- disable_query_log
+#-- disable_result_log
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+--error 0,1360
+DROP TRIGGER test.t2_ai;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+--enable_warnings
+
+# test section 1, Taken from bug #12408
+
+CREATE TABLE test.t2 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
+
+CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
+
+CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
+
+delimiter |;
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL AND ms.program='spamfilter' AND ms.keey='scan_incoming'|
+delimiter ;|
+
+INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com');
+
+SELECT * FROM test.t1 ORDER BY id;
+#show binlog events;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1 ORDER BY id;
+connection master;
+
+INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming');
+INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+
+select * from test.t2;
+select * from test.t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from test.t2;
+select * from test.t3;
+connection master;
+
+DELETE FROM test.t1 WHERE id = 1;
+
+SELECT * FROM test.t1 ORDER BY id;
+connection master;
+SELECT * FROM test.t1 ORDER BY id;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1 ORDER BY id;
+
+# Cleanup
+connection master;
+#show binlog events;
+DROP TRIGGER test.t2_ai;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_trig003.test b/mysql-test/suite/rpl/t/rpl_row_trig003.test
new file mode 100644
index 00000000000..4a1bbc5ca89
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_trig003.test
@@ -0,0 +1,152 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/16/2005 #
+# Updated: 8/29/2005 Remove sleep calls add dump and diff #
+#############################################################################
+# TEST: This test includes all trigger types. BEFORE/AFTER INSERT, UPDATE & #
+# DELETE. In addition, includes cursor, bit, varchar, flow control, #
+# looping, ROUND(), NOW(), YEAR(), TIMESTAMP #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+#-- disable_query_log
+#-- disable_result_log
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+--error 0,1360
+DROP TRIGGER test.t1_bi;
+--error 0,1360
+DROP TRIGGER test.t2_ai;
+--error 0,1360
+DROP TRIGGER test.t1_bu;
+--error 0,1360
+DROP TRIGGER test.t2_au;
+--error 0,1360
+DROP TRIGGER test.t1_bd;
+--error 0,1360
+DROP TRIGGER test.t2_ad;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+--enable_warnings
+
+# test section 1
+
+CREATE TABLE test.t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+CREATE TABLE test.t2 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+CREATE TABLE test.t3 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
+
+# Note Most of these cause the slave to core or do not produce desired results. Currently commenting out the ones not working until they are fixed.
+
+delimiter |;
+CREATE TRIGGER test.t1_bi BEFORE INSERT ON test.t1 FOR EACH ROW UPDATE test.t3 SET b1=1 and y=YEAR(NOW())|
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW BEGIN
+ INSERT INTO test.t3 VALUES(NULL,0,'MySQL Replication team rocks!', 'Dark beer in prague is #1',12345.34,12.51,0,1965,NOW());
+ UPDATE test.t3 SET f = ROUND(f);
+END|
+CREATE TRIGGER test.t1_bu BEFORE UPDATE on test.t1 FOR EACH ROW BEGIN
+ UPDATE test.t3 SET y = '2000';
+ INSERT INTO test.t3 VALUES(NULL,1,'Testing MySQL databases before update ', 'Insert should work',621.43, 0105.21,0,1974,NOW());
+END|
+CREATE TRIGGER test.t2_au AFTER UPDATE on test.t2 FOR EACH ROW BEGIN
+ DECLARE done INT DEFAULT 0;
+ DECLARE a DECIMAL(10,4);
+ DECLARE b FLOAT;
+ DECLARE num MEDIUMINT;
+ DECLARE cur1 CURSOR FOR SELECT t2.id, t2.d, t2.f FROM test.t2;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+
+ OPEN cur1;
+
+ REPEAT
+ FETCH cur1 INTO num, a, b;
+ IF NOT done THEN
+ UPDATE test.t3 SET total =(a*b) WHERE ID = num;
+ END IF;
+ UNTIL done END REPEAT;
+ CLOSE cur1;
+END|
+CREATE TRIGGER test.t1_bd BEFORE DELETE on test.t1 FOR EACH ROW BEGIN
+ DECLARE done INT DEFAULT 0;
+ DECLARE a BIT(8);
+ DECLARE b VARCHAR(255);
+ DECLARE c CHAR(255);
+ DECLARE d DECIMAL(10,4);
+ DECLARE e FLOAT;
+ DECLARE f BIGINT UNSIGNED;
+ DECLARE g YEAR;
+ DECLARE h TIMESTAMP;
+ DECLARE cur1 CURSOR FOR SELECT t1.b1, t1.vc, t1.bc, t1.d, t1.f, t1.total, t1.y, t1.t FROM test.t1;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+
+ OPEN cur1;
+
+ REPEAT
+ FETCH cur1 INTO a, b, c, d, e, f, g, h;
+ IF NOT done THEN
+ INSERT INTO test.t3 VALUES(NULL, a, b, c, d, e, f, g, h);
+ END IF;
+ UNTIL done END REPEAT;
+ CLOSE cur1;
+END|
+CREATE TRIGGER test.t2_ad AFTER DELETE ON test.t2 FOR EACH ROW
+ DELETE FROM test.t1|
+delimiter ;|
+
+INSERT INTO test.t1 VALUES(NULL,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,NOW());
+INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL Customers ROCK!',654321.4321,1.24521,0,YEAR(NOW()),NOW());
+
+UPDATE test.t1 SET b1 = 0 WHERE b1 = 1;
+
+INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW());
+UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
+
+INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
+
+# To make sure BUG#14698 is gone, we sleep 2 seconds before calling trigger
+# (with the bug in, that caused differences in TIMESTAMP columns).
+# We just need to let the machine's clock advance, it's not
+# to do synchronization, so real_sleep is good.
+real_sleep 2;
+
+DELETE FROM test.t1 WHERE id = 1;
+
+DELETE FROM test.t2 WHERE id = 1;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+connection master;
+
+# time to dump the databases and so we can see if they match
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_slave.sql
+
+# cleanup
+--disable_warnings
+--error 0,1360
+DROP TRIGGER test.t1_bi;
+--error 0,1360
+DROP TRIGGER test.t2_ai;
+--error 0,1360
+DROP TRIGGER test.t1_bu;
+--error 0,1360
+DROP TRIGGER test.t2_au;
+--error 0,1360
+DROP TRIGGER test.t1_bd;
+--error 0,1360
+DROP TRIGGER test.t2_ad;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+--enable_warnings
+
+diff_files $MYSQLTEST_VARDIR/tmp/trg003_master.sql $MYSQLTEST_VARDIR/tmp/trg003_slave.sql;
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_row_trig004.test b/mysql-test/suite/rpl/t/rpl_row_trig004.test
new file mode 100644
index 00000000000..a918c602d56
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_trig004.test
@@ -0,0 +1,18 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Oct/18/2005 #
+#############################################################################
+# TEST: Use before insert triggers and has the second insert fail #
+#############################################################################
+# Change by JBM 2006-02-14 added to skip when NDB default engine #
+# This test has been wrapped to allow multipal engines to use same code #
+#############################################################################
+
+# Includes
+-- source include/not_ndb_default.inc
+-- 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_trig004.test
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test
new file mode 100644
index 00000000000..f1d21e65a4c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test
@@ -0,0 +1,87 @@
+-- source include/not_ndb_default.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Test is dependent on binlog positions
+
+# prepare version for substitutions
+let $VERSION=`select version()`;
+
+# stop slave before he will start replication also sync with master
+# for avoiding undetermenistic behaviour
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
+connection master;
+# create some events on master
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (1),(2),(3),(4);
+drop table t1;
+create table t2(n int not null auto_increment primary key);
+insert into t2 values (1),(2);
+insert into t2 values (3),(4);
+drop table t2;
+
+# try to replicate all queries until drop of t1
+connection slave;
+start slave until master_log_file='master-bin.000001', master_log_pos=311;
+sleep 2;
+wait_for_slave_to_stop;
+# here table should be still not deleted
+select * from t1;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 9 # 11 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS;
+
+# this should fail right after start
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+# again this table should be still not deleted
+select * from t1;
+sleep 2;
+wait_for_slave_to_stop;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 9 # 11 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS;
+
+# try replicate all up to and not including the second insert to t2;
+start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
+sleep 2;
+wait_for_slave_to_stop;
+select * from t2;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 9 # 11 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS;
+
+# clean up
+start slave;
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
+# this should stop immediately as we are already there
+start slave until master_log_file='master-bin.000001', master_log_pos=740;
+sleep 2;
+wait_for_slave_to_stop;
+# here the sql slave thread should be stopped
+--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
+--replace_column 1 # 9 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS;
+
+#testing various error conditions
+--error 1277
+start slave until master_log_file='master-bin', master_log_pos=561;
+--error 1277
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+--error 1277
+start slave until master_log_file='master-bin.000001';
+--error 1277
+start slave until relay_log_file='slave-relay-bin.000002';
+--error 1277
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+# Warning should be given for second command
+start slave sql_thread;
+start slave until master_log_file='master-bin.000001', master_log_pos=740;
diff --git a/mysql-test/suite/rpl/t/rpl_row_view01.test b/mysql-test/suite/rpl/t/rpl_row_view01.test
new file mode 100644
index 00000000000..634e3c30cc6
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_view01.test
@@ -0,0 +1,89 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/19/2005 #
+# Updated: 08/29/2005 Remove sleeps #
+#############################################################################
+#TEST: row based replication of views #
+#############################################################################
+# 2006-02-08 By JBM added order by and sleep for use with ndb engine
+#############################################################################
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+create database if not exists mysqltest1;
+DROP VIEW IF EXISTS mysqltest1.v1;
+DROP VIEW IF EXISTS mysqltest1.v2;
+DROP VIEW IF EXISTS mysqltest1.v3;
+DROP VIEW IF EXISTS mysqltest1.v4;
+DROP TABLE IF EXISTS mysqltest1.t3;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t4;
+
+# Begin test section 1
+CREATE TABLE mysqltest1.t1 (a INT, c CHAR(6),PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t2 (a INT, c CHAR(6),PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t3 (a INT, c CHAR(6), c2 CHAR(6), PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t4 (a INT, qty INT, price INT,PRIMARY KEY(a));
+CREATE TABLE mysqltest1.t5 (qty INT, price INT, total INT, PRIMARY KEY(qty));
+INSERT INTO mysqltest1.t1 VALUES (1,'Thank'),(2,'it'),(3,'Friday');
+INSERT INTO mysqltest1.t2 VALUES (1,'GOD'),(2,'is'),(3,'TGIF');
+INSERT INTO mysqltest1.t4 VALUES(1, 3, 50),(2, 18, 3),(4, 4, 4);
+
+
+CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4 ORDER BY qty;
+CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a ORDER BY a;
+CREATE VIEW mysqltest1.v3 AS SELECT * FROM mysqltest1.t1;
+CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL CHECK OPTION;
+
+
+SELECT * FROM mysqltest1.v2;
+SELECT * FROM mysqltest1.v1;
+# Had to add a sleep for use with NDB
+# engine. Injector thread would have not
+# populated biblog and data would not be on
+# the slave.
+sleep 10;
+sync_slave_with_master;
+SELECT * FROM mysqltest1.v2;
+SELECT * FROM mysqltest1.v1;
+connection master;
+
+INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2;
+INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1;
+
+SELECT * FROM mysqltest1.t5 ORDER BY qty;
+SELECT * FROM mysqltest1.t3 ORDER BY a;
+sync_slave_with_master;
+SELECT * FROM mysqltest1.t5 ORDER BY qty;
+SELECT * FROM mysqltest1.t3 ORDER BY a;
+connection master;
+
+INSERT INTO mysqltest1.v4 VALUES (4,'TEST');
+
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+SELECT * FROM mysqltest1.v4 ORDER BY a;
+sync_slave_with_master;
+SELECT * FROM mysqltest1.t1 ORDER BY a;
+SELECT * FROM mysqltest1.v4 ORDER BY a;
+
+connection master;
+
+# lets cleanup
+DROP VIEW IF EXISTS mysqltest1.v1;
+DROP VIEW IF EXISTS mysqltest1.v2;
+DROP VIEW IF EXISTS mysqltest1.v3;
+DROP VIEW IF EXISTS mysqltest1.v4;
+DROP TABLE IF EXISTS mysqltest1.t3;
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP TABLE IF EXISTS mysqltest1.t2;
+DROP TABLE IF EXISTS mysqltest1.t4;
+DROP DATABASE mysqltest1;
+sync_slave_with_master;
+
+# End of 5.1 test case
+
diff --git a/mysql-test/suite/rpl/t/rpl_server_id1.test b/mysql-test/suite/rpl/t/rpl_server_id1.test
new file mode 100644
index 00000000000..71310750b60
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_server_id1.test
@@ -0,0 +1,26 @@
+# 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;
+connection slave;
+create table t1 (n int);
+reset master;
+# replicate ourselves
+stop slave;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval change master to master_port=$SLAVE_MYPORT;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 16 # 18 #
+show slave status;
+start slave;
+insert into t1 values (1);
+# can't MASTER_POS_WAIT(), it does not work in this weird setup
+# (when slave is its own master without --replicate-same-server-id)
+sleep 2; # enough time for the event to be replicated (it should not)
+show status like "slave_running";
+drop table t1;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_server_id2-slave.opt b/mysql-test/suite/rpl/t/rpl_server_id2-slave.opt
new file mode 100644
index 00000000000..302889525dd
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_server_id2-slave.opt
@@ -0,0 +1 @@
+--disable-log-slave-updates --replicate-same-server-id
diff --git a/mysql-test/suite/rpl/t/rpl_server_id2.test b/mysql-test/suite/rpl/t/rpl_server_id2.test
new file mode 100644
index 00000000000..0f2eb560d18
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_server_id2.test
@@ -0,0 +1,26 @@
+# This test checks that a slave DOES execute queries originating
+# from itself, if running with --replicate-same-server-id.
+
+source include/master-slave.inc;
+connection slave;
+create table t1 (n int);
+reset master;
+# replicate ourselves
+stop slave;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval change master to master_port=$SLAVE_MYPORT;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 18 #
+show slave status;
+start slave;
+insert into t1 values (1);
+save_master_pos;
+sync_with_master;
+select * from t1; # check that indeed 2 were inserted
+# We stop the slave before cleaning up otherwise we'll get
+# 'drop table t1' executed twice, so an error in the slave.err
+# (not critical).
+stop slave;
+drop table t1;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_session_var.test b/mysql-test/suite/rpl/t/rpl_session_var.test
new file mode 100644
index 00000000000..a6f4b496a23
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_session_var.test
@@ -0,0 +1,42 @@
+# Replication of session variables.
+# FOREIGN_KEY_CHECKS is tested in rpl_insert_id.test
+
+source include/master-slave.inc;
+drop table if exists t1;
+create table t1(a varchar(100),b int);
+set @@session.sql_mode=pipes_as_concat;
+insert into t1 values('My'||'SQL', 1);
+set @@session.sql_mode=default;
+insert into t1 values('1'||'2', 2);
+select * from t1 where b<3 order by a;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1 where b<3 order by a;
+connection master;
+# if the slave does the next sync_with_master fine, then it means it accepts the
+# two lines of ANSI syntax below, which is what we want to check.
+set @@session.sql_mode=ignore_space;
+insert into t1 values(password ('MySQL'), 3);
+set @@session.sql_mode=ansi_quotes;
+create table "t2" ("a" int);
+drop table t1, t2;
+set @@session.sql_mode=default;
+create table t1(a int auto_increment primary key);
+create table t2(b int, a int);
+set @@session.sql_auto_is_null=1;
+insert into t1 values(null);
+insert into t2 select 1,a from t1 where a is null;
+set @@session.sql_auto_is_null=0;
+insert into t1 values(null);
+insert into t2 select 2,a from t1 where a is null;
+select * from t2 order by b;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t2 order by b;
+connection master;
+drop table t1,t2;
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_set_charset.test b/mysql-test/suite/rpl/t/rpl_set_charset.test
new file mode 100644
index 00000000000..c70eb2681f5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_set_charset.test
@@ -0,0 +1,35 @@
+source include/master-slave.inc;
+--disable_warnings
+drop database if exists mysqltest1;
+# 4.1 bases its conversion on the db's charset,
+# while 4.0 uses the part of "SET CHARACTER SET" after "_".
+# So for 4.1 we add a clause to CREATE DATABASE.
+create database mysqltest1 /*!40100 character set latin2 */;
+use mysqltest1;
+drop table if exists t1;
+--enable_warnings
+create table t1 (a varchar(255) character set latin2, b varchar(4));
+SET CHARACTER SET cp1250_latin2;
+INSERT INTO t1 VALUES ('ŠŒŽ','80');
+INSERT INTO t1 VALUES ('šœžŸ','90');
+INSERT INTO t1 VALUES ('£¥ª¯','A0');
+INSERT INTO t1 VALUES ('³¹º¼¾¿','B0');
+INSERT INTO t1 VALUES ('ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ','C0');
+INSERT INTO t1 VALUES ('ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß','D0');
+INSERT INTO t1 VALUES ('àáâãäåæçèéêëìíîï','E0');
+INSERT INTO t1 VALUES ('ðñòóôõö÷øùúûüýþÿ','F0');
+select "--- on master ---";
+select hex(a),b from t1 order by b;
+save_master_pos;
+connection slave;
+sync_with_master;
+use mysqltest1;
+select "--- on slave ---";
+select hex(a),b from t1 order by b;
+connection master;
+drop database mysqltest1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_sf.test b/mysql-test/suite/rpl/t/rpl_sf.test
new file mode 100644
index 00000000000..ecf91a723fa
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sf.test
@@ -0,0 +1,70 @@
+-- source include/have_log_bin.inc
+
+# Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
+
+# 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_ROW_RBR_TO_SBR
+select fn16456();
+
+
+
+# restore status
+
+drop function fn16456;
+
+--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_skip_error-slave.opt b/mysql-test/suite/rpl/t/rpl_skip_error-slave.opt
new file mode 100644
index 00000000000..982362d93a5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_skip_error-slave.opt
@@ -0,0 +1 @@
+--slave-skip-error=1053,1582
diff --git a/mysql-test/suite/rpl/t/rpl_skip_error.test b/mysql-test/suite/rpl/t/rpl_skip_error.test
new file mode 100644
index 00000000000..ff81e2f010e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_skip_error.test
@@ -0,0 +1,29 @@
+##########################################
+# 2006-02-07 By JBM: Added order by
+#########################################
+# Note that errors are ignored by opt file.
+source include/master-slave.inc;
+
+create table t1 (n int not null primary key);
+save_master_pos;
+connection slave;
+sync_with_master;
+insert into t1 values (1);
+connection master;
+# Here we expect (ignored) error, since 1 is already in slave table
+insert into t1 values (1);
+
+# These should work fine
+insert into t1 values (2),(3);
+
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1 ORDER BY n;
+
+# Cleanup
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test
new file mode 100644
index 00000000000..32320a50656
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_slave_status.test
@@ -0,0 +1,58 @@
+--source include/master-slave.inc
+
+############################################################################
+# Test case for BUG#10780
+#
+# REQUIREMENT
+# A slave without replication privileges should have Slave_IO_Running = No
+
+# 1. Create new replication user
+connection master;
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+
+connection slave;
+stop slave;
+change master to master_user='rpl',master_password='rpl';
+start slave;
+
+# 2. Do replication as new user
+connection master;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (n int);
+insert into t1 values (1);
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1;
+
+# 3. Delete new replication user
+connection master;
+delete from mysql.user where user='rpl';
+flush privileges;
+connection slave;
+
+# 4. Restart slave without privileges
+# (slave.err will contain access denied error for this START SLAVE command)
+stop slave;
+start slave;
+
+# 5. Make sure Slave_IO_Running = No
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+# Column 1 is replaced, since the output can be either
+# "Connecting to master" or "Waiting for master update"
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 #
+--vertical_results
+show slave status;
+
+# Cleanup (Note that slave IO thread is not running)
+connection slave;
+drop table t1;
+delete from mysql.user where user='rpl';
+connection master;
+drop table t1;
+
+# end of test case for BUG#10780
+
+# end of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_sp-master.opt b/mysql-test/suite/rpl/t/rpl_sp-master.opt
new file mode 100644
index 00000000000..709a224fd92
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sp-master.opt
@@ -0,0 +1 @@
+--log_bin_trust_routine_creators=0
diff --git a/mysql-test/suite/rpl/t/rpl_sp-slave.opt b/mysql-test/suite/rpl/t/rpl_sp-slave.opt
new file mode 100644
index 00000000000..709a224fd92
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sp-slave.opt
@@ -0,0 +1 @@
+--log_bin_trust_routine_creators=0
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test
new file mode 100644
index 00000000000..f363b64558a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -0,0 +1,585 @@
+# row-based and statement have expected binlog difference in result files
+
+# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
+# Modified by WL#2971.
+
+# Note that in the .opt files we still use the old variable name
+# log-bin-trust-routine-creators so that this test checks that it's
+# still accepted (this test also checks that the new name is
+# accepted). The old name could be removed in 5.1 or 6.0.
+
+source include/have_binlog_format_mixed.inc;
+source include/master-slave.inc;
+
+# we need a db != test, where we don't have automatic grants
+--disable_warnings
+drop database if exists mysqltest1;
+--enable_warnings
+create database mysqltest1;
+use mysqltest1;
+create table t1 (a varchar(100));
+sync_slave_with_master;
+use mysqltest1;
+
+# ********************** PART 1 : STORED PROCEDURES ***************
+
+# Does the same proc as on master get inserted into mysql.proc ?
+# (same definer, same properties...)
+
+connection master;
+
+delimiter |;
+
+# Stored procedures don't have the limitations that functions have
+# regarding binlogging: it's ok to create a procedure as not
+# deterministic and updating data, while it's not ok to create such a
+# function. We test this.
+
+create procedure foo()
+begin
+ declare b int;
+ set b = 8;
+ insert into t1 values (b);
+ insert into t1 values (unix_timestamp());
+end|
+delimiter ;|
+
+# we replace columns having times
+# (even with fixed timestamp displayed time may changed based on TZ)
+--replace_result localhost.localdomain localhost 127.0.0.1 localhost
+--replace_column 13 # 14 #
+select * from mysql.proc where name='foo' and db='mysqltest1';
+sync_slave_with_master;
+# You will notice in the result that the definer does not match what
+# it is on master, it is a known bug on which Alik is working
+--replace_result localhost.localdomain localhost 127.0.0.1 localhost
+--replace_column 13 # 14 #
+select * from mysql.proc where name='foo' and db='mysqltest1';
+
+connection master;
+# see if timestamp used in SP on slave is same as on master
+set timestamp=1000000000;
+call foo();
+select * from t1;
+sync_slave_with_master;
+select * from t1;
+
+# Now a SP which is not updating tables
+
+connection master;
+delete from t1;
+create procedure foo2()
+ select * from mysqltest1.t1;
+call foo2();
+
+# check that this is allowed (it's not for functions):
+alter procedure foo2 contains sql;
+
+# SP with definer's right
+
+drop table t1;
+create table t1 (a int);
+create table t2 like t1;
+
+create procedure foo3()
+ deterministic
+ insert into t1 values (15);
+
+# let's create a non-privileged user
+grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
+grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
+grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
+
+# ToDo: BUG#14931: There is a race between the last grant binlogging, and
+# the binlogging in the new connection made below, causing sporadic test
+# failures due to switched statement order in binlog. To fix this we do
+# SELECT 1 in the first connection before starting the second, ensuring
+# that binlogging is done in the expected order.
+# Please remove this SELECT 1 when BUG#14931 is fixed.
+SELECT 1;
+
+connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,);
+connection con1;
+
+# this routine will fail in the second INSERT because of privileges
+delimiter |;
+create procedure foo4()
+ deterministic
+ begin
+ insert into t2 values(3);
+ insert into t1 values (5);
+ end|
+
+delimiter ;|
+
+# I add ,0 so that it does not print the error in the test output,
+# because this error is hostname-dependent
+--error 1142,0
+call foo4(); # invoker has no INSERT grant on table t1 => failure
+
+connection master;
+call foo3(); # success (definer == root)
+show warnings;
+
+--error 1142,0
+call foo4(); # definer's rights => failure
+
+# we test replication of ALTER PROCEDURE
+alter procedure foo4 sql security invoker;
+call foo4(); # invoker's rights => success
+show warnings;
+
+# Note that half-failed procedure calls are ok with binlogging;
+# if we compare t2 on master and slave we see they are identical:
+
+select * from t1;
+select * from t2;
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+# Let's check another failing-in-the-middle procedure
+connection master;
+delete from t2;
+alter table t2 add unique (a);
+
+drop procedure foo4;
+delimiter |;
+create procedure foo4()
+ deterministic
+ begin
+ insert into t2 values(20),(20);
+ end|
+
+delimiter ;|
+
+--error ER_DUP_ENTRY
+call foo4();
+show warnings;
+
+select * from t2;
+sync_slave_with_master;
+# check that this failed-in-the-middle replicated right:
+select * from t2;
+
+# Test of DROP PROCEDURE
+
+--replace_result localhost.localdomain localhost 127.0.0.1 localhost
+--replace_column 13 # 14 #
+select * from mysql.proc where name="foo4" and db='mysqltest1';
+connection master;
+drop procedure foo4;
+select * from mysql.proc where name="foo4" and db='mysqltest1';
+sync_slave_with_master;
+select * from mysql.proc where name="foo4" and db='mysqltest1';
+
+# ********************** PART 2 : FUNCTIONS ***************
+
+connection master;
+drop procedure foo;
+drop procedure foo2;
+drop procedure foo3;
+
+delimiter |;
+# check that needs "deterministic"
+--error 1418
+create function fn1(x int)
+ returns int
+begin
+ insert into t1 values (x);
+ return x+2;
+end|
+create function fn1(x int)
+ returns int
+ deterministic
+begin
+ insert into t1 values (x);
+ return x+2;
+end|
+
+delimiter ;|
+delete t1,t2 from t1,t2;
+select fn1(20);
+insert into t2 values(fn1(21));
+select * from t1;
+select * from t2;
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+connection master;
+delimiter |;
+
+drop function fn1;
+
+create function fn1()
+ returns int
+ no sql
+begin
+ return unix_timestamp();
+end|
+
+delimiter ;|
+# check that needs "deterministic"
+--error 1418
+alter function fn1 contains sql;
+
+delete from t1;
+set timestamp=1000000000;
+insert into t1 values(fn1());
+
+connection con1;
+
+delimiter |;
+--error 1419 # only full-global-privs user can create a function
+create function fn2()
+ returns int
+ no sql
+begin
+ return unix_timestamp();
+end|
+delimiter ;|
+connection master;
+# test old variable name:
+set global log_bin_trust_routine_creators=1;
+# now use new name:
+set global log_bin_trust_function_creators=0;
+set global log_bin_trust_function_creators=1;
+# slave needs it too otherwise will not execute what master allowed:
+connection slave;
+set global log_bin_trust_function_creators=1;
+
+connection con1;
+
+delimiter |;
+create function fn2()
+ returns int
+ no sql
+begin
+ return unix_timestamp();
+end|
+delimiter ;|
+
+connection master;
+
+# Now a function which is supposed to not update tables
+# as it's "reads sql data", so should not give error even if
+# non-deterministic.
+
+delimiter |;
+create function fn3()
+ returns int
+ not deterministic
+ reads sql data
+begin
+ return 0;
+end|
+delimiter ;|
+
+select fn3();
+--replace_result localhost.localdomain localhost 127.0.0.1 localhost
+--replace_column 13 # 14 #
+select * from mysql.proc where db='mysqltest1';
+select * from t1;
+
+sync_slave_with_master;
+use mysqltest1;
+select * from t1;
+--replace_result localhost.localdomain localhost 127.0.0.1 localhost
+--replace_column 13 # 14 #
+select * from mysql.proc where db='mysqltest1';
+
+# Let's check a failing-in-the-middle function
+connection master;
+delete from t2;
+alter table t2 add unique (a);
+
+drop function fn1;
+
+delimiter |;
+create function fn1(x int)
+ returns int
+begin
+ insert into t2 values(x),(x);
+ return 10;
+end|
+
+delimiter ;|
+
+do fn1(100);
+
+--error ER_DUP_ENTRY
+select fn1(20);
+
+select * from t2;
+sync_slave_with_master;
+
+# check that this failed-in-the-middle replicated right:
+select * from t2;
+
+# ********************** PART 3 : TRIGGERS ***************
+
+connection con1;
+# now fails due to missing trigger grant (err 1142 i/o 1227) due to new
+# check in sql_trigger.cc (v1.44) by anozdrin on 2006/02/01 --azundris
+--error ER_TABLEACCESS_DENIED_ERROR
+create trigger trg before insert on t1 for each row set new.a= 10;
+
+connection master;
+delete from t1;
+# TODO: when triggers can contain an update, test that this update
+# does not go into binlog.
+# I'm not setting user vars in the trigger, because replication of user vars
+# would take care of propagating the user var's value to slave, so even if
+# the trigger was not executed on slave it would not be discovered.
+create trigger trg before insert on t1 for each row set new.a= 10;
+insert into t1 values (1);
+select * from t1;
+sync_slave_with_master;
+select * from t1;
+
+connection master;
+delete from t1;
+drop trigger trg;
+insert into t1 values (1);
+select * from t1;
+sync_slave_with_master;
+select * from t1;
+
+
+# ********************** PART 4 : RELATED FIXED BUGS ***************
+
+
+#
+# Test for bug #13969 "Routines which are replicated from master can't be
+# executed on slave".
+#
+connection master;
+create procedure foo()
+ not deterministic
+ reads sql data
+ select * from t1;
+sync_slave_with_master;
+# This should not fail
+call foo();
+connection master;
+drop procedure foo;
+sync_slave_with_master;
+
+
+# Clean up
+connection master;
+drop function fn1;
+drop database mysqltest1;
+drop user "zedjzlcsjhd"@127.0.0.1;
+use test;
+sync_slave_with_master;
+use test;
+
+#
+# Bug#14077 "Failure to replicate a stored function with a cursor":
+# verify that stored routines with cursors work on slave.
+#
+connection master;
+--disable_warnings
+drop function if exists f1;
+--enable_warnings
+delimiter |;
+create function f1() returns int reads sql data
+begin
+ declare var integer;
+ declare c cursor for select a from v1;
+ open c;
+ fetch c into var;
+ close c;
+ return var;
+end|
+delimiter ;|
+create view v1 as select 1 as a;
+create table t1 (a int);
+insert into t1 (a) values (f1());
+select * from t1;
+drop view v1;
+drop function f1;
+sync_slave_with_master;
+connection slave;
+select * from t1;
+
+#
+# Bug#16621 "INSERTs in Stored Procedures causes data corruption in the Binary
+# Log for 5.0.18"
+#
+
+# Prepare environment.
+
+connection master;
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Test case.
+
+CREATE TABLE t1(col VARCHAR(10));
+
+CREATE PROCEDURE p1(arg VARCHAR(10))
+ INSERT INTO t1 VALUES(arg);
+
+CALL p1('test');
+
+SELECT * FROM t1;
+
+sync_slave_with_master;
+SELECT * FROM t1;
+
+# Cleanup
+connection master;
+DROP PROCEDURE p1;
+
+
+#
+# BUG#20438: CREATE statements for views, stored routines and triggers can be
+# not replicable.
+#
+
+--echo
+--echo ---> Test for BUG#20438
+
+# Prepare environment.
+
+--echo
+--echo ---> Preparing environment...
+--echo ---> connection: master
+--connection master
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+--echo
+--echo ---> Synchronizing slave with master...
+
+--save_master_pos
+--connection slave
+--sync_with_master
+
+--echo
+--echo ---> connection: master
+--connection master
+
+# Test.
+
+--echo
+--echo ---> Creating procedure...
+
+/*!50003 CREATE PROCEDURE p1() SET @a = 1 */;
+
+/*!50003 CREATE FUNCTION f1() RETURNS INT RETURN 0 */;
+
+--echo
+--echo ---> Checking on master...
+
+SHOW CREATE PROCEDURE p1;
+SHOW CREATE FUNCTION f1;
+
+--echo
+--echo ---> Synchronizing slave with master...
+
+--save_master_pos
+--connection slave
+--sync_with_master
+
+--echo ---> connection: master
+
+--echo
+--echo ---> Checking on slave...
+
+SHOW CREATE PROCEDURE p1;
+SHOW CREATE FUNCTION f1;
+
+# Cleanup.
+
+--echo
+--echo ---> connection: master
+--connection master
+
+--echo
+--echo ---> Cleaning up...
+
+DROP PROCEDURE p1;
+DROP FUNCTION f1;
+
+--save_master_pos
+--connection slave
+--sync_with_master
+--connection master
+
+
+# cleanup
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+#
+# Bug22043: MySQL don't add "USE <DATABASE>" before "DROP PROCEDURE IF EXISTS"
+#
+
+connection master;
+--disable_warnings
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+--enable_warnings
+create database mysqltest;
+create database mysqltest2;
+use mysqltest2;
+create table t ( t integer );
+create procedure mysqltest.test() begin end;
+insert into t values ( 1 );
+--error ER_BAD_DB_ERROR
+create procedure `\\`.test() begin end;
+
+#
+# BUG#19725: Calls to stored function in other database are not
+# replicated correctly in some cases
+#
+
+connection master;
+delimiter |;
+create function f1 () returns int
+begin
+ insert into t values (1);
+ return 0;
+end|
+delimiter ;|
+sync_slave_with_master;
+# Let us test if we don't forget to binlog the function's database
+connection master;
+use mysqltest;
+set @a:= mysqltest2.f1();
+sync_slave_with_master;
+connection master;
+
+
+# Final inspection which verifies how all statements of this test file
+# were written to the binary log.
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events in 'master-bin.000001' from 106;
+
+
+# Restore log_bin_trust_function_creators to its original value.
+# This is a cleanup for all parts above where we tested stored
+# functions and triggers.
+set global log_bin_trust_function_creators=0;
+connection master;
+set global log_bin_trust_function_creators=0;
+
+# Clean up
+drop database mysqltest;
+drop database mysqltest2;
+
+--echo End of 5.0 tests
+--echo End of 5.1 tests
+
diff --git a/mysql-test/suite/rpl/t/rpl_sp004.test b/mysql-test/suite/rpl/t/rpl_sp004.test
new file mode 100644
index 00000000000..967e7007c15
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sp004.test
@@ -0,0 +1,97 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/14/2005 #
+#############################################################################
+# Test: This test contains two sp that create and drop tables, insert and #
+# updated data and uses the NOW() function. #
+#############################################################################
+
+
+# Includes
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t3;
+--enable_warnings
+# End of cleanup
+
+# Begin test section 1
+
+delimiter |;
+CREATE PROCEDURE test.p1()
+BEGIN
+ CREATE TABLE IF NOT EXISTS test.t1(a INT,PRIMARY KEY(a));
+ CREATE TABLE IF NOT EXISTS test.t2(a INT,PRIMARY KEY(a));
+ INSERT INTO test.t1 VALUES (4),(2),(1),(3);
+ UPDATE test.t1 SET a=a+4 WHERE a=4;
+ INSERT INTO test.t2 (a) SELECT t1.a FROM test.t1;
+ UPDATE test.t1 SET a=a+4 WHERE a=8;
+ CREATE TABLE IF NOT EXISTS test.t3(n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+ DROP TABLE IF EXISTS test.t1;
+ DROP TABLE IF EXISTS test.t2;
+ INSERT INTO test.t3 VALUES(NULL,11111111.233333,NOW());
+END|
+delimiter ;|
+
+CALL test.p1();
+SELECT * FROM test.t1 ORDER BY a;
+SELECT * FROM test.t2 ORDER BY a;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1 ORDER BY a;
+SELECT * FROM test.t2 ORDER BY a;
+
+connection master;
+CALL test.p2();
+USE test;
+SHOW TABLES;
+#SELECT * FROM test.t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+USE test;
+SHOW TABLES;
+#SELECT * FROM test.t3;
+
+connection master;
+CALL test.p1();
+SELECT * FROM test.t1 ORDER BY a;
+SELECT * FROM test.t2 ORDER BY a;
+#SELECT * FROM test.t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1 ORDER BY a;
+SELECT * FROM test.t2 ORDER BY a;
+#SELECT * FROM test.t3;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_slave.sql
+
+# Cleanup
+connection master;
+#show binlog events;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+sync_slave_with_master;
+
+# If the test fails, you will need to diff the dumps to see why.
+
+diff_files $MYSQLTEST_VARDIR/tmp/sp004_master.sql $MYSQLTEST_VARDIR/tmp/sp004_slave.sql;
+
+
+# End of 5.0 test case
diff --git a/mysql-test/suite/rpl/t/rpl_sp_effects-master.opt b/mysql-test/suite/rpl/t/rpl_sp_effects-master.opt
new file mode 100644
index 00000000000..61dd7a6ad0e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sp_effects-master.opt
@@ -0,0 +1 @@
+--log_bin_trust_routine_creators=1
diff --git a/mysql-test/suite/rpl/t/rpl_sp_effects-slave.opt b/mysql-test/suite/rpl/t/rpl_sp_effects-slave.opt
new file mode 100644
index 00000000000..61dd7a6ad0e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sp_effects-slave.opt
@@ -0,0 +1 @@
+--log_bin_trust_routine_creators=1
diff --git a/mysql-test/suite/rpl/t/rpl_sp_effects.test b/mysql-test/suite/rpl/t/rpl_sp_effects.test
new file mode 100644
index 00000000000..027bfd69f36
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sp_effects.test
@@ -0,0 +1,211 @@
+##########################################
+# Change Author: JBM
+# Change Date: 2006-05-02
+# Change: Added Order By for NDB testing
+##########################################
+
+# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
+-- source include/master-slave.inc
+
+# ****************************************************************
+connection master;
+
+# cleanup
+--disable_warnings
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop function if exists f1;
+drop table if exists t1,t2;
+drop view if exists v1;
+--enable_warnings
+create table t1 (a int);
+
+SET GLOBAL log_bin_trust_function_creators = 1;
+
+# 1. Test simple variables use.
+delimiter //;
+create procedure p1()
+begin
+ declare spv int default 0;
+ while spv < 5 do
+ insert into t1 values(spv+1);
+ set spv=spv+1;
+ end while;
+end//
+delimiter ;//
+
+call p1();
+
+sync_slave_with_master;
+connection slave;
+SELECT * FROM t1 ORDER BY a;
+connection master;
+SELECT * FROM t1 ORDER BY a;
+
+# 2. Test SP variable name
+delimiter //;
+create procedure p2()
+begin
+ declare a int default 4;
+ create table t2 as select a;
+end//
+delimiter ;//
+
+call p2();
+SELECT * FROM t2 ORDER BY a;
+sync_slave_with_master;
+connection slave;
+SELECT * FROM t2 ORDER BY a;
+
+connection master;
+drop procedure p1;
+drop procedure p2;
+drop table t2;
+
+# 3. Test FUNCTIONs in various places
+
+delimiter //;
+create function f1(x int) returns int
+begin
+ insert into t1 values(x);
+ return x+1;
+end//
+
+create procedure p1(a int, b int)
+begin
+ declare v int default f1(5);
+ if (f1(6)) then
+ select 'yes';
+ end if;
+ set v = f1(7);
+ while f1(8) < 1 do
+ select 'this cant be';
+ end while;
+
+end//
+delimiter ;//
+
+call p1(f1(1), f1(2));
+SELECT * FROM t1 ORDER BY a;
+
+create table t2(a int);
+insert into t2 values (10),(11);
+SELECT a,f1(a) FROM t2 ORDER BY a;
+
+# This shouldn't put separate 'call f1(3)' into binlog:
+insert into t2 select f1(3);
+SELECT 'master:',a FROM t1 ORDER BY a;
+
+sync_slave_with_master;
+connection slave;
+SELECT 'slave:',a FROM t1 ORDER BY a;
+
+connection master;
+drop procedure p1;
+delete from t1;
+delete from t2;
+
+# 4. VIEWs
+delete from t1;
+insert into t2 values(1),(2);
+create view v1 as select f1(a) as f from t2;
+select * from v1 order by f;
+SELECT 'master:',a FROM t1 ORDER BY a;
+
+sync_slave_with_master;
+connection slave;
+SELECT 'slave:',a FROM t1 ORDER BY a;
+
+connection master;
+drop view v1;
+delete from t1;
+
+# 5. Prepared statements.
+prepare s1 from 'select f1(?)';
+set @xx=123;
+execute s1 using @xx;
+SELECT 'master:',a FROM t1 ORDER BY a;
+
+sync_slave_with_master;
+connection slave;
+SELECT 'slave:',a FROM t1 ORDER BY a;
+
+connection master;
+delete from t1;
+
+# 5. Cursors.
+# t2 has (1),(2);
+delimiter //;
+create procedure p1(spv int)
+begin
+ declare c cursor for select f1(spv) from t2;
+ while (spv > 2) do
+ open c;
+ fetch c into spv;
+ close c;
+ set spv= spv - 10;
+ end while;
+end//
+delimiter ;//
+call p1(15);
+SELECT 'master:',a FROM t1 ORDER BY a;
+sync_slave_with_master;
+connection slave;
+SELECT 'slave:',a FROM t1 ORDER BY a;
+
+connection master;
+drop procedure p1;
+drop function f1;
+drop table t1,t2;
+
+# BUG#12637: User variables + SPs replication
+create table t1 (a int);
+delimiter //;
+create procedure p1()
+begin
+ insert into t1 values(@x);
+ set @x=@x+1;
+ insert into t1 values(@x);
+ if (f2()) then
+ insert into t1 values(1243);
+ end if;
+end//
+
+create function f2() returns int
+begin
+ insert into t1 values(@z);
+ set @z=@z+1;
+ insert into t1 values(@z);
+ return 0;
+end//
+
+create function f1() returns int
+begin
+ insert into t1 values(@y);
+ call p1();
+ return 0;
+end//
+
+delimiter ;//
+
+set @x=10;
+set @y=20;
+set @z=100;
+select f1();
+
+set @x=30;
+call p1();
+
+SELECT 'master', a FROM t1 ORDER BY a;
+sync_slave_with_master;
+connection slave;
+SELECT 'slave', a FROM t1 ORDER BY a;
+
+connection master;
+drop table t1;
+drop function f1;
+drop function f2;
+drop procedure p1;
+sync_slave_with_master;
+
+SET GLOBAL log_bin_trust_function_creators = 0;
diff --git a/mysql-test/suite/rpl/t/rpl_sporadic_master-master.opt b/mysql-test/suite/rpl/t/rpl_sporadic_master-master.opt
new file mode 100644
index 00000000000..6d5b66bed61
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sporadic_master-master.opt
@@ -0,0 +1 @@
+--sporadic-binlog-dump-fail --max-binlog-dump-events=2
diff --git a/mysql-test/suite/rpl/t/rpl_sporadic_master.test b/mysql-test/suite/rpl/t/rpl_sporadic_master.test
new file mode 100644
index 00000000000..824f7abc9f5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sporadic_master.test
@@ -0,0 +1,29 @@
+#############################################################
+# 2006-02-07 By JBM added order by
+#############################################################
+# test to see if replication can continue when master sporadically fails on
+# COM_BINLOG_DUMP and additionally limits the number of events per dump
+
+source include/master-slave.inc;
+
+create table t2(n int);
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (NULL),(NULL);
+truncate table t1;
+# We have to use 4 in the following to make this test work with all table types
+insert into t1 values (4),(NULL);
+sync_slave_with_master;
+stop slave;
+start slave;
+connection master;
+insert into t1 values (NULL),(NULL);
+flush logs;
+truncate table t1;
+insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
+sync_slave_with_master;
+select * from t1 ORDER BY n;
+connection master;
+drop table t1,t2;
+sync_slave_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_ssl.test b/mysql-test/suite/rpl/t/rpl_ssl.test
new file mode 100644
index 00000000000..a0317028557
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ssl.test
@@ -0,0 +1,71 @@
+source include/have_ssl.inc;
+source include/master-slave.inc;
+
+# create a user for replication that requires ssl encryption
+connection master;
+grant replication slave on *.* to replssl@localhost require ssl;
+create table t1 (t int auto_increment, KEY(t));
+
+sync_slave_with_master;
+
+# Set slave to use SSL for connection to master
+stop slave;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval change master to
+ master_user='replssl',
+ master_password='',
+ master_ssl=1,
+ master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem',
+ master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem',
+ master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem';
+start slave;
+
+# Switch to master and insert one record, then sync it to slave
+connection master;
+insert into t1 values(1);
+sync_slave_with_master;
+
+# The record should now be on slave
+select * from t1;
+
+# The slave is synced and waiting/reading from master
+# SHOW SLAVE STATUS will show "Waiting for master to send event"
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+query_vertical show slave status;
+
+# Stop the slave, as reported in bug#21871 it would hang
+STOP SLAVE;
+
+select * from t1;
+
+# Do the same thing a number of times
+disable_query_log;
+let $i= 100;
+while ($i)
+{
+ start slave;
+ connection master;
+ insert into t1 values (NULL);
+ connection slave;
+ stop slave;
+ dec $i;
+}
+start slave;
+enable_query_log;
+connection master;
+# INSERT one more record to make sure
+# the sync has something to do
+insert into t1 values (NULL);
+sync_slave_with_master;
+--source include/wait_for_slave_to_start.inc
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+query_vertical show slave status;
+
+connection master;
+drop user replssl@localhost;
+drop table t1;
+sync_slave_with_master;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/suite/rpl/t/rpl_ssl1.test b/mysql-test/suite/rpl/t/rpl_ssl1.test
new file mode 100644
index 00000000000..6ca1484bb17
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_ssl1.test
@@ -0,0 +1,97 @@
+source include/have_ssl.inc;
+source include/master-slave.inc;
+
+# We don't test all types of ssl auth params here since it's a bit hard
+# until problems with OpenSSL 0.9.7 are unresolved
+
+# creating replication user for whom ssl auth is required
+# preparing playground
+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;
+
+#trying to use this user without ssl
+stop slave;
+change master to master_user='replssl',master_password='';
+start slave;
+
+#showing that replication don't work
+connection master;
+insert into t1 values (1);
+#reasonable timeout for changes to propagate to slave
+sleep 3;
+connection slave;
+select * from t1;
+
+#showing that replication could work with ssl params
+stop slave;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval change master to master_ssl=1 , master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem';
+start slave;
+
+#avoiding unneeded sleeps
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+#checking that replication is ok
+select * from t1;
+
+#checking show slave status
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
+query_vertical show slave status;
+
+#checking if replication works without ssl also performing clean up
+stop slave;
+change master to master_user='root',master_password='', master_ssl=0;
+start slave;
+connection master;
+drop user replssl@localhost;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
+query_vertical show slave status;
+
+# End of 4.1 tests
+
+# Start replication with ssl_verify_server_cert turned on
+connection slave;
+stop slave;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval change master to
+ master_host="localhost",
+ master_ssl=1 ,
+ master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem',
+ master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem',
+ master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem',
+ master_ssl_verify_server_cert=1;
+start slave;
+
+connection master;
+create table t1 (t int);
+insert into t1 values (1);
+
+sync_slave_with_master;
+
+echo on slave;
+#checking that replication is ok
+select * from t1;
+
+#checking show slave status
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
+query_vertical show slave status;
+
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
new file mode 100644
index 00000000000..19988cf902a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
@@ -0,0 +1,36 @@
+source include/master-slave.inc;
+
+#
+# Bug#6148 ()
+#
+connection slave;
+stop slave;
+
+# Let the master do lots of insertions
+connection master;
+create table t1(n int);
+let $1=5000;
+disable_query_log;
+while ($1)
+{
+ eval insert into t1 values($1);
+ dec $1;
+}
+enable_query_log;
+save_master_pos;
+
+connection slave;
+start slave;
+sleep 1;
+stop slave io_thread;
+start slave io_thread;
+sync_with_master;
+
+connection master;
+drop table t1;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt b/mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt
new file mode 100644
index 00000000000..48457b17309
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_stm_000001.test b/mysql-test/suite/rpl/t/rpl_stm_000001.test
new file mode 100644
index 00000000000..aee067b2d4a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_000001.test
@@ -0,0 +1,2 @@
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_stm_000001.test
diff --git a/mysql-test/suite/rpl/t/rpl_stm_EE_err2.test b/mysql-test/suite/rpl/t/rpl_stm_EE_err2.test
new file mode 100644
index 00000000000..face651b9a1
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_EE_err2.test
@@ -0,0 +1,8 @@
+#############################
+# Author: JBM
+# Date: 2006-01-11
+# Purpose: Engine Wrapper for rpl_stm_EE_err2.test
+##############################
+-- source include/have_binlog_format_mixed_or_statement.inc
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_stm_EE_err2.test
diff --git a/mysql-test/suite/rpl/t/rpl_stm_charset.test b/mysql-test/suite/rpl/t/rpl_stm_charset.test
new file mode 100644
index 00000000000..b103a47d78c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_charset.test
@@ -0,0 +1,2 @@
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_stm_charset.test
diff --git a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
new file mode 100644
index 00000000000..a8a33d05e8b
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
@@ -0,0 +1,8 @@
+# depends on the binlog output
+--source include/have_binlog_format_mixed_or_statement.inc
+
+let $rename_event_pos= 656;
+-- 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
new file mode 100644
index 00000000000..d55e3a4da2c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test
@@ -0,0 +1,20 @@
+# we run first in statement-based then in mixed binlogging
+
+--source include/have_binlog_format_mixed_or_statement.inc
+--source include/master-slave.inc
+--source include/not_embedded.inc
+--source include/not_windows.inc
+
+connection master;
+set @old_global_binlog_format = @@global.binlog_format;
+
+let $binlog_format_statement=1;
+set @@global.binlog_format = statement;
+--source extra/rpl_tests/rpl_insert_delayed.test
+
+let $binlog_format_statement=0;
+set @@global.binlog_format = mixed;
+--source extra/rpl_tests/rpl_insert_delayed.test
+
+connection master;
+set @@global.binlog_format = @old_global_binlog_format;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_log-master.opt b/mysql-test/suite/rpl/t/rpl_stm_log-master.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_log-master.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_stm_log-slave.opt b/mysql-test/suite/rpl/t/rpl_stm_log-slave.opt
new file mode 100644
index 00000000000..8b137891791
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_log-slave.opt
@@ -0,0 +1 @@
+
diff --git a/mysql-test/suite/rpl/t/rpl_stm_log.test b/mysql-test/suite/rpl/t/rpl_stm_log.test
new file mode 100644
index 00000000000..5a1e0facc83
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_log.test
@@ -0,0 +1,8 @@
+# Requires statement logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_log.test
+
+
+# End of 4.1 tests
+# Adding comment for force manual merge 5.0 -> wl1012: Delete me
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
new file mode 100644
index 00000000000..950aa8b322a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test
@@ -0,0 +1,11 @@
+# Test of options max_binlog_size and max_relay_log_size and
+# how they act (if max_relay_log_size == 0, use max_binlog_size
+# for relay logs too).
+# Test of manual relay log rotation with FLUSH LOGS.
+
+# 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_multi_query.test b/mysql-test/suite/rpl/t/rpl_stm_multi_query.test
new file mode 100644
index 00000000000..c39d1fad015
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_multi_query.test
@@ -0,0 +1,12 @@
+# Test for BUG#8436: verify that a multi-query (i.e. one query
+# containing several queries (assuming client has
+# 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_mystery22.test b/mysql-test/suite/rpl/t/rpl_stm_mystery22.test
new file mode 100644
index 00000000000..017593fdfba
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_mystery22.test
@@ -0,0 +1,66 @@
+################################
+# Change Author: JBM
+# Change Date: 2006-01-12
+# Change: Added back have stm binlog
+# and added requirments comments
+################################
+# test case to make slave thread get ahead by 22 bytes
+################################
+#REQUIREMENT: If there is a faked slave duplicate key insert
+#error and the slave is restarted, the replication should
+#proceed in a correct way.
+################################
+#REQUIREMENT: If there is a faked slave non-existing record
+#delete error and the slave is restarted, then the replication
+#should proceed in a correct way.
+#################################
+
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
+# first, cause a duplicate key problem on the slave
+create table t1(n int auto_increment primary key, s char(10));
+sync_slave_with_master;
+insert into t1 values (2,'old');
+connection master;
+insert into t1 values(NULL,'new');
+insert into t1 values(NULL,'new');
+save_master_pos;
+connection slave;
+# wait until the slave tries to run the query, fails and aborts slave thread
+wait_for_slave_to_stop;
+select * from t1 order by n;
+delete from t1 where n = 2;
+--disable_warnings
+start slave;
+--enable_warnings
+sync_with_master;
+#now the buggy slave would be confused on the offset but it can replicate
+#in order to make it break, we need to stop/start the slave one more time
+stop slave;
+connection master;
+# to be able to really confuse the slave, we need some non-auto-increment
+# events in the log
+create table t2(n int);
+drop table t2;
+insert into t1 values(NULL,'new');
+# what happens when we delete a row which does not exist on slave?
+set sql_log_bin=0;
+insert into t1 values(NULL,'new');
+set sql_log_bin=1;
+delete from t1 where n=4;
+save_master_pos;
+connection slave;
+--disable_warnings
+start slave;
+--enable_warnings
+#now the truth comes out - if the slave is buggy, it will never sync because
+#the slave thread is not able to read events
+sync_with_master;
+select * from t1 order by n;
+#clean up
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+# 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
new file mode 100644
index 00000000000..66dc89bd712
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_no_op.test
@@ -0,0 +1,93 @@
+# It's true only in statement-based replication that a statement which
+# updates no rows (UPDATE/DELETE) is binlogged; in row-based
+# replication, as we log modified rows, nothing is binlogged in this
+# case. So this test is meaningul only in statement-based (and if it was
+# enabled in row-based, it would fail as expected).
+
+-- source include/have_binlog_format_mixed_or_statement.inc
+
+source include/master-slave.inc;
+
+# see if DROP DATABASE is binlogged even if no effect
+connection slave;
+create database mysqltest;
+connection master;
+drop database if exists mysqltest;
+sync_slave_with_master;
+# can't read dir
+--replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" \\ /
+--error 1049
+show tables from mysqltest;
+
+# see if DROP TABLE is binlogged even if no effect
+connection slave;
+create table t1 (a int);
+connection master;
+drop table if exists t1;
+sync_slave_with_master;
+# table does not exist
+--error 1146
+select * from t1;
+
+# see if single-table DELETE is binlogged even if no effect
+connection master;
+create table t1 (a int, b int);
+sync_slave_with_master;
+insert into t1 values(1,1);
+connection master;
+delete from t1;
+sync_slave_with_master;
+select * from t1;
+
+# see if single-table UPDATE is binlogged even if no effect
+insert into t1 values(1,1);
+connection master;
+insert into t1 values(2,1);
+update t1 set a=2;
+sync_slave_with_master;
+select * from t1;
+
+# End of 4.1 tests
+
+# see if multi-table UPDATE is binlogged even if no effect (BUG#13348)
+
+connection master;
+create table t2 (a int, b int);
+delete from t1;
+insert into t1 values(1,1);
+insert into t2 values(1,1);
+
+sync_slave_with_master;
+# force a difference to see if master's multi-UPDATE will correct it
+update t1 set a=2;
+
+connection master;
+UPDATE t1, t2 SET t1.a = t2.a;
+
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+# See if multi-table DELETE is binlogged even if no effect
+
+connection master;
+delete from t1;
+delete from t2;
+
+sync_slave_with_master;
+# force a difference to see if master's multi-DELETE will correct it
+insert into t1 values(1,1);
+insert into t2 values(1,1);
+
+connection master;
+DELETE t1.*, t2.* from t1, t2;
+
+sync_slave_with_master;
+select * from t1;
+select * from t2;
+
+
+# cleanup
+connection master;
+drop table t1, t2;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_reset_slave.test b/mysql-test/suite/rpl/t/rpl_stm_reset_slave.test
new file mode 100644
index 00000000000..6a99d4e1613
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_reset_slave.test
@@ -0,0 +1,6 @@
+# TBF - difference in row level logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source extra/rpl_tests/rpl_reset_slave.test
+
+# End of 4.1 tests
+#
diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test
new file mode 100644
index 00000000000..f42965c0eb0
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_until.test
@@ -0,0 +1,88 @@
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
+# Test is dependent on binlog positions
+
+# prepare version for substitutions
+let $VERSION=`select version()`;
+
+# stop slave before he will start replication also sync with master
+# for avoiding undetermenistic behaviour
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
+connection master;
+# create some events on master
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (1),(2),(3),(4);
+drop table t1;
+create table t2(n int not null auto_increment primary key);
+insert into t2 values (1),(2);
+insert into t2 values (3),(4);
+drop table t2;
+
+# try to replicate all queries until drop of t1
+connection slave;
+start slave until master_log_file='master-bin.000001', master_log_pos=323;
+sleep 2;
+wait_for_slave_to_stop;
+# here table should be still not deleted
+select * from t1;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 9 # 11 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+# this should fail right after start
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+# again this table should be still not deleted
+select * from t1;
+sleep 2;
+wait_for_slave_to_stop;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 9 # 11 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+# try replicate all up to and not including the second insert to t2;
+start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
+sleep 2;
+wait_for_slave_to_stop;
+select * from t2;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 9 # 11 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+# clean up
+start slave;
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
+# this should stop immediately as we are already there
+start slave until master_log_file='master-bin.000001', master_log_pos=776;
+sleep 2;
+wait_for_slave_to_stop;
+# here the sql slave thread should be stopped
+--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
+--replace_column 1 # 9 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+#testing various error conditions
+--error 1277
+start slave until master_log_file='master-bin', master_log_pos=561;
+--error 1277
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+--error 1277
+start slave until master_log_file='master-bin.000001';
+--error 1277
+start slave until relay_log_file='slave-relay-bin.000002';
+--error 1277
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+# Warning should be given for second command
+start slave sql_thread;
+start slave until master_log_file='master-bin.000001', master_log_pos=776;
+
+# End of 4.1 tests
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
new file mode 100644
index 00000000000..b0012827db8
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
@@ -0,0 +1,568 @@
+#
+# rpl_switch_stm_row_mixed tests covers
+#
+# - switching explicitly between STATEMENT, ROW, and MIXED binlog format
+# showing when it is possible and when not.
+# - switching from MIXED to RBR implicitly listing all use cases,
+# e.g a query invokes UUID(), thereafter to serve as the definition
+# of MIXED binlog format
+# - correctness of execution
+
+
+-- source include/not_ndb_default.inc
+-- source include/master-slave.inc
+
+connection master;
+--disable_warnings
+drop database if exists mysqltest1;
+create database mysqltest1;
+--enable_warnings
+use mysqltest1;
+
+# Save binlog format
+set @my_binlog_format= @@global.binlog_format;
+
+# play with switching
+set session binlog_format=mixed;
+show session variables like "binlog_format%";
+set session binlog_format=statement;
+show session variables like "binlog_format%";
+set session binlog_format=row;
+show session variables like "binlog_format%";
+
+set global binlog_format=DEFAULT;
+show global variables like "binlog_format%";
+set global binlog_format=MIXED;
+show global variables like "binlog_format%";
+set global binlog_format=STATEMENT;
+show global variables like "binlog_format%";
+set global binlog_format=ROW;
+show global variables like "binlog_format%";
+show session variables like "binlog_format%";
+select @@global.binlog_format, @@session.binlog_format;
+
+CREATE TABLE t1 (a varchar(100));
+
+prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+set @string="emergency_1_";
+insert into t1 values("work_2_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_3_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values(concat("for_4_",UUID()));
+insert into t1 select "yesterday_5_";
+
+# verify that temp tables prevent a switch to SBR
+create temporary table tmp(a char(100));
+insert into tmp values("see_6_");
+--error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
+set binlog_format=statement;
+insert into t1 select * from tmp;
+drop temporary table tmp;
+
+# Now we go to SBR
+set binlog_format=statement;
+show global variables like "binlog_format%";
+show session variables like "binlog_format%";
+select @@global.binlog_format, @@session.binlog_format;
+set global binlog_format=statement;
+show global variables like "binlog_format%";
+show session variables like "binlog_format%";
+select @@global.binlog_format, @@session.binlog_format;
+
+prepare stmt1 from 'insert into t1 select ?';
+set @string="emergency_7_";
+insert into t1 values("work_8_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values("work_9_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values("for_10_");
+insert into t1 select "yesterday_11_";
+
+# test statement (is not default after wl#3368)
+set binlog_format=statement;
+select @@global.binlog_format, @@session.binlog_format;
+set global binlog_format=statement;
+select @@global.binlog_format, @@session.binlog_format;
+
+prepare stmt1 from 'insert into t1 select ?';
+set @string="emergency_12_";
+insert into t1 values("work_13_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values("work_14_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values("for_15_");
+insert into t1 select "yesterday_16_";
+
+# and now the mixed mode
+
+set global binlog_format=mixed;
+select @@global.binlog_format, @@session.binlog_format;
+set binlog_format=default;
+select @@global.binlog_format, @@session.binlog_format;
+
+prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
+set @string="emergency_17_";
+insert into t1 values("work_18_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_19_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values(concat("for_20_",UUID()));
+insert into t1 select "yesterday_21_";
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(UUID(),"work_22_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values(concat("for_23_",UUID()));
+insert into t1 select "yesterday_24_";
+
+# Test of CREATE TABLE SELECT
+
+create table t2 select rpad(UUID(),100,' ');
+create table t3 select 1 union select UUID();
+create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
+create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
+# what if UUID() is first:
+insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
+
+# inside a stored procedure
+
+delimiter |;
+create procedure foo()
+begin
+insert into t1 values("work_25_");
+insert into t1 values(concat("for_26_",UUID()));
+insert into t1 select "yesterday_27_";
+end|
+create procedure foo2()
+begin
+insert into t1 values(concat("emergency_28_",UUID()));
+insert into t1 values("work_29_");
+insert into t1 values(concat("for_30_",UUID()));
+set session binlog_format=row; # accepted for stored procs
+insert into t1 values("more work_31_");
+set session binlog_format=mixed;
+end|
+create function foo3() returns bigint unsigned
+begin
+ set session binlog_format=row; # rejected for stored funcs
+ insert into t1 values("alarm");
+ return 100;
+end|
+create procedure foo4(x varchar(100))
+begin
+insert into t1 values(concat("work_250_",x));
+insert into t1 select "yesterday_270_";
+end|
+delimiter ;|
+call foo();
+call foo2();
+call foo4("hello");
+call foo4(UUID());
+call foo4("world");
+
+# test that can't SET in a stored function
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
+select foo3();
+select * from t1 where a="alarm";
+
+# Tests of stored functions/triggers/views for BUG#20930 "Mixed
+# binlogging mode does not work with stored functions, triggers,
+# views"
+
+# Function which calls procedure
+drop function foo3;
+delimiter |;
+create function foo3() returns bigint unsigned
+begin
+ insert into t1 values("foo3_32_");
+ call foo();
+ return 100;
+end|
+delimiter ;|
+insert into t2 select foo3();
+
+prepare stmt1 from 'insert into t2 select foo3()';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# Test if stored function calls stored function which calls procedure
+# which requires row-based.
+
+delimiter |;
+create function foo4() returns bigint unsigned
+begin
+ insert into t2 select foo3();
+ return 100;
+end|
+delimiter ;|
+select foo4();
+
+prepare stmt1 from 'select foo4()';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# A simple stored function
+delimiter |;
+create function foo5() returns bigint unsigned
+begin
+ insert into t2 select UUID();
+ return 100;
+end|
+delimiter ;|
+select foo5();
+
+prepare stmt1 from 'select foo5()';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# A simple stored function where UUID() is in the argument
+delimiter |;
+create function foo6(x varchar(100)) returns bigint unsigned
+begin
+ insert into t2 select x;
+ return 100;
+end|
+delimiter ;|
+select foo6("foo6_1_");
+select foo6(concat("foo6_2_",UUID()));
+
+prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+
+# Test of views using UUID()
+
+create view v1 as select uuid();
+create table t11 (data varchar(255));
+insert into t11 select * from v1;
+# Test of querying INFORMATION_SCHEMA which parses the view's body,
+# to verify that it binlogs statement-based (is not polluted by
+# the parsing of the view's body).
+insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
+prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')";
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# Test of triggers with UUID()
+delimiter |;
+create trigger t11_bi before insert on t11 for each row
+begin
+ set NEW.data = concat(NEW.data,UUID());
+end|
+delimiter ;|
+insert into t11 values("try_560_");
+
+# Test that INSERT DELAYED works in mixed mode (BUG#20649)
+insert delayed into t2 values("delay_1_");
+insert delayed into t2 values(concat("delay_2_",UUID()));
+insert delayed into t2 values("delay_6_");
+
+# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not
+# replicate fine in statement-based ; we test that in mixed mode it
+# works).
+insert delayed into t2 values(rand());
+set @a=2.345;
+insert delayed into t2 values(@a);
+
+sleep 4; # time for the delayed inserts to reach disk
+
+# If you want to do manual testing of the mixed mode regarding UDFs (not
+# testable automatically as quite platform- and compiler-dependent),
+# you just need to set the variable below to 1, and to
+# "make udf_example.so" in sql/, and to copy sql/udf_example.so to
+# MYSQL_TEST_DIR/lib/mysql.
+let $you_want_to_test_UDF=0;
+if ($you_want_to_test_UDF)
+{
+ CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
+ prepare stmt1 from 'insert into t1 select metaphon(?)';
+ set @string="emergency_133_";
+ insert into t1 values("work_134_");
+ execute stmt1 using @string;
+ deallocate prepare stmt1;
+ prepare stmt1 from 'insert into t1 select ?';
+ insert into t1 values(metaphon("work_135_"));
+ execute stmt1 using @string;
+ deallocate prepare stmt1;
+ insert into t1 values(metaphon("for_136_"));
+ insert into t1 select "yesterday_137_";
+ create table t6 select metaphon("for_138_");
+ create table t7 select 1 union select metaphon("for_139_");
+ create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3);
+ create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
+}
+
+create table t20 select * from t1; # save for comparing later
+create table t21 select * from t2;
+create table t22 select * from t3;
+drop table t1,t2,t3;
+
+# This tests the fix to
+# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog
+# We verify that under the mixed binlog mode, a stored function
+# modifying at least two tables having an auto_increment column,
+# is binlogged row-based. Indeed in statement-based binlogging,
+# only the auto_increment value generated for the first table
+# is recorded in the binlog, the value generated for the 2nd table
+# lacking.
+
+create table t1 (a int primary key auto_increment, b varchar(100));
+create table t2 (a int primary key auto_increment, b varchar(100));
+create table t3 (b varchar(100));
+delimiter |;
+create function f (x varchar(100)) returns int deterministic
+begin
+ insert into t1 values(null,x);
+ insert into t2 values(null,x);
+ return 1;
+end|
+delimiter ;|
+select f("try_41_");
+# Two operations which compensate each other except that their net
+# effect is that they advance the auto_increment counter of t2 on slave:
+sync_slave_with_master;
+use mysqltest1;
+insert into t2 values(2,null),(3,null),(4,null);
+delete from t2 where a>=2;
+
+connection master;
+# this is the call which didn't replicate well
+select f("try_42_");
+sync_slave_with_master;
+
+# now use prepared statement and test again, just to see that the RBB
+# mode isn't set at PREPARE but at EXECUTE.
+
+insert into t2 values(3,null),(4,null);
+delete from t2 where a>=3;
+
+connection master;
+prepare stmt1 from 'select f(?)';
+set @string="try_43_";
+insert into t1 values(null,"try_44_"); # should be SBB
+execute stmt1 using @string; # should be RBB
+deallocate prepare stmt1;
+sync_slave_with_master;
+
+# verify that if only one table has auto_inc, it does not trigger RBB
+# (we'll check in binlog further below)
+
+connection master;
+create table t12 select * from t1; # save for comparing later
+drop table t1;
+create table t1 (a int, b varchar(100), key(a));
+select f("try_45_");
+
+# restore table's key
+create table t13 select * from t1;
+drop table t1;
+create table t1 (a int primary key auto_increment, b varchar(100));
+
+# now test if it's two functions, each of them inserts in one table
+
+drop function f;
+# we need a unique key to have sorting of rows by mysqldump
+create table t14 (unique (a)) select * from t2;
+truncate table t2;
+delimiter |;
+create function f1 (x varchar(100)) returns int deterministic
+begin
+ insert into t1 values(null,x);
+ return 1;
+end|
+create function f2 (x varchar(100)) returns int deterministic
+begin
+ insert into t2 values(null,x);
+ return 1;
+end|
+delimiter ;|
+select f1("try_46_"),f2("try_47_");
+
+sync_slave_with_master;
+insert into t2 values(2,null),(3,null),(4,null);
+delete from t2 where a>=2;
+
+connection master;
+# Test with SELECT and INSERT
+select f1("try_48_"),f2("try_49_");
+insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
+sync_slave_with_master;
+
+# verify that if f2 does only read on an auto_inc table, this does not
+# switch to RBB
+connection master;
+drop function f2;
+delimiter |;
+create function f2 (x varchar(100)) returns int deterministic
+begin
+ declare y int;
+ insert into t1 values(null,x);
+ set y = (select count(*) from t2);
+ return y;
+end|
+delimiter ;|
+select f1("try_53_"),f2("try_54_");
+sync_slave_with_master;
+
+# And now, a normal statement with a trigger (no stored functions)
+
+connection master;
+drop function f2;
+delimiter |;
+create trigger t1_bi before insert on t1 for each row
+begin
+ insert into t2 values(null,"try_55_");
+end|
+delimiter ;|
+insert into t1 values(null,"try_56_");
+# and now remove one auto_increment and verify SBB
+alter table t1 modify a int, drop primary key;
+insert into t1 values(null,"try_57_");
+sync_slave_with_master;
+
+# Test for BUG#20499 "mixed mode with temporary table breaks binlog"
+# Slave used to have only 2 rows instead of 3.
+connection master;
+CREATE TEMPORARY TABLE t15 SELECT UUID();
+create table t16 like t15;
+INSERT INTO t16 SELECT * FROM t15;
+# we'll verify that this one is done RBB
+insert into t16 values("try_65_");
+drop table t15;
+# we'll verify that this one is done SBB
+insert into t16 values("try_66_");
+sync_slave_with_master;
+
+# and now compare:
+
+connection master;
+
+# first check that data on master is sensible
+select count(*) from t1;
+select count(*) from t2;
+select count(*) from t3;
+select count(*) from t4;
+select count(*) from t5;
+select count(*) from t11;
+select count(*) from t20;
+select count(*) from t21;
+select count(*) from t22;
+select count(*) from t12;
+select count(*) from t13;
+select count(*) from t14;
+select count(*) from t16;
+if ($you_want_to_test_UDF)
+{
+ select count(*) from t6;
+ select count(*) from t7;
+ select count(*) from t8;
+ select count(*) from t9;
+}
+
+sync_slave_with_master;
+
+#
+# Bug#20863 If binlog format is changed between update and unlock of
+# tables, wrong binlog
+#
+
+connection master;
+DROP TABLE IF EXISTS t11;
+SET SESSION BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t11 (song VARCHAR(255));
+LOCK TABLES t11 WRITE;
+SET SESSION BINLOG_FORMAT=ROW;
+INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
+SET SESSION BINLOG_FORMAT=STATEMENT;
+INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
+UNLOCK TABLES;
+
+--query_vertical SELECT * FROM t11
+sync_slave_with_master;
+USE mysqltest1;
+--query_vertical SELECT * FROM t11
+
+connection master;
+DROP TABLE IF EXISTS t12;
+SET SESSION BINLOG_FORMAT=MIXED;
+CREATE TABLE t12 (data LONG);
+LOCK TABLES t12 WRITE;
+INSERT INTO t12 VALUES(UUID());
+UNLOCK TABLES;
+
+source include/show_binlog_events.inc;
+sync_slave_with_master;
+
+# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
+
+# Let's compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching
+
+diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
+
+connection master;
+source include/show_binlog_events.inc;
+
+# Now test that mysqlbinlog works fine on a binlog generated by the
+# mixed mode
+
+# BUG#11312 "DELIMITER is not written to the binary log that causes
+# syntax error" makes that mysqlbinlog will fail if we pass it the
+# text of queries; this forces us to use --base64-output here.
+
+# BUG#20929 "BINLOG command causes invalid free plus assertion
+# failure" makes mysqld segfault when receiving --base64-output
+
+# So I can't enable this piece of test
+# SIGH
+
+if ($enable_when_11312_or_20929_fixed)
+{
+--exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
+drop database mysqltest1;
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
+# the old mysqldump output on slave is the same as what it was on
+# master before restoring on master.
+diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
+}
+
+drop database mysqltest1;
+sync_slave_with_master;
+
+connection master;
+# Restore binlog format setting
+set global binlog_format =@my_binlog_format;
diff --git a/mysql-test/suite/rpl/t/rpl_temp_table.test b/mysql-test/suite/rpl/t/rpl_temp_table.test
new file mode 100644
index 00000000000..9b73961aeea
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_temp_table.test
@@ -0,0 +1,59 @@
+# drop table t1 t2 t3 are included int master-slave.inc
+# meaningful only in statement-based:
+
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
+
+create table t2 (n int, PRIMARY KEY(n));
+create temporary table t1 (n int);
+create temporary table t3 (n int not null);
+
+insert into t1 values(1),(2),(3),(100),(25),(26),(200),(300);
+insert into t2 select * from t1;
+alter table t3 add primary key(n);
+
+flush logs;
+insert into t3 values (1010);
+insert into t2 select * from t3;
+
+drop table if exists t3;
+insert into t2 values (1012);
+
+connection master1;
+create temporary table t1 (n int);
+insert into t1 values (4),(5);
+insert into t2 select * from t1;
+
+save_master_pos;
+disconnect master;
+
+connection slave;
+#add 1 to the saved position, so we will catch drop table on disconnect
+#for sure
+sync_with_master 1;
+
+connection master1;
+insert into t2 values(61);
+
+save_master_pos;
+disconnect master1;
+
+connection slave;
+#same trick - make sure we catch drop of temporary table on disconnect
+sync_with_master 1;
+
+select * from t2;
+select count(*) from t2;
+select sum(n) from t2;
+show status like 'Slave_open_temp_tables';
+
+#
+# Clean up
+#
+connect (master2,localhost,root,,);
+connection master2;
+drop table if exists t1,t2;
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test
new file mode 100644
index 00000000000..09b8b83f25f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_temporary.test
@@ -0,0 +1,215 @@
+# Test need anonymous user when connection are made as "zedjzlcsjhd"
+source include/add_anonymous_users.inc;
+
+-- source include/master-slave.inc
+
+# Clean up old slave's binlogs.
+# The slave is started with --log-slave-updates
+# and this test does SHOW BINLOG EVENTS on the slave's
+# binlog. But previous tests can influence the current test's
+# binlog (e.g. a temporary table in the previous test has not
+# been explicitly deleted, or it has but the slave hasn't had
+# enough time to catch it before STOP SLAVE,
+# and at the beginning of the current
+# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
+# We wait for the slave to have written all he wants to the binlog
+# (otherwise RESET MASTER may come too early).
+save_master_pos;
+connection slave;
+sync_with_master;
+reset master;
+connection master;
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+# We want to connect as an unprivileged user. But if we use user="" then this
+# will pick the Unix login, which will cause problems if you're running the test
+# as root.
+connect (con3,localhost,zedjzlcsjhd,,);
+
+# We are going to use SET PSEUDO_THREAD_ID in this test;
+# check that it requires the SUPER privilege.
+
+connection con3;
+SET @save_select_limit=@@session.sql_select_limit;
+--error 1227
+SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
+SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed
+# While we are here we also test that SQL_LOG_BIN can't be set
+--error 1227
+SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
+SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed
+# Now as root, to be sure it works
+connection con2;
+SET @@session.pseudo_thread_id=100;
+SET @@session.pseudo_thread_id=connection_id();
+SET @@session.sql_log_bin=0;
+SET @@session.sql_log_bin=1;
+
+connection con3;
+let $VERSION=`select version()`;
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1(f int);
+create table t2(f int);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+connection con1;
+create temporary table t3(f int);
+insert into t3 select * from t1 where f<6;
+sleep 1;
+
+connection con2;
+create temporary table t3(f int);
+sleep 1;
+
+connection con1;
+insert into t2 select count(*) from t3;
+sleep 1;
+
+connection con2;
+insert into t3 select * from t1 where f>=4;
+sleep 1;
+
+connection con1;
+drop temporary table t3;
+sleep 1;
+
+connection con2;
+insert into t2 select count(*) from t3;
+drop temporary table t3;
+
+select * from t2 ORDER BY f;
+
+# Commented out 8/30/2005 to make compatable with both sbr and rbr
+#--replace_result $VERSION VERSION
+#--replace_column 2 # 5 #
+#show binlog events;
+
+drop table t1, t2;
+
+use test;
+SET TIMESTAMP=1040323920;
+create table t1(f int);
+SET TIMESTAMP=1040323931;
+create table t2(f int);
+SET TIMESTAMP=1040323938;
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+SET TIMESTAMP=1040323945;
+SET @@session.pseudo_thread_id=1;
+create temporary table t3(f int);
+SET TIMESTAMP=1040323952;
+SET @@session.pseudo_thread_id=1;
+insert into t3 select * from t1 where f<6;
+SET TIMESTAMP=1040324145;
+SET @@session.pseudo_thread_id=2;
+create temporary table t3(f int);
+SET TIMESTAMP=1040324186;
+SET @@session.pseudo_thread_id=1;
+insert into t2 select count(*) from t3;
+SET TIMESTAMP=1040324200;
+SET @@session.pseudo_thread_id=2;
+insert into t3 select * from t1 where f>=4;
+SET TIMESTAMP=1040324211;
+SET @@session.pseudo_thread_id=1;
+drop temporary table t3;
+SET TIMESTAMP=1040324219;
+SET @@session.pseudo_thread_id=2;
+insert into t2 select count(*) from t3;
+SET TIMESTAMP=1040324224;
+SET @@session.pseudo_thread_id=2;
+drop temporary table t3;
+
+select * from t2 ORDER BY f;
+drop table t1,t2;
+
+# Create last a temporary table that is not dropped at end to ensure that we
+# don't get any memory leaks for this
+
+create temporary table t3 (f int);
+sync_with_master;
+
+# The server will now close done
+
+#
+# Bug#17284 erroneous temp table cleanup on slave
+#
+
+connection master;
+create temporary table t4 (f int);
+create table t5 (f int);
+sync_with_master;
+# find dumper's $id
+select id from information_schema.processlist where command='Binlog Dump' into @id;
+kill @id; # to stimulate reconnection by slave w/o timeout
+insert into t5 select * from t4;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+select * from t5 /* must be 1 after reconnection */;
+
+connection master;
+drop temporary table t4;
+drop table t5;
+
+#
+# BUG#17263 incorrect generation DROP temp tables
+# Temporary tables of connection are dropped in batches
+# where a batch correspond to pseudo_thread_id
+# value was set up at the moment of temp table creation
+#
+connection con1;
+set @@session.pseudo_thread_id=100;
+create temporary table t101 (id int);
+create temporary table t102 (id int);
+set @@session.pseudo_thread_id=200;
+create temporary table t201 (id int);
+create temporary table `t``201` (id int);
+# emulate internal temp table not to come to binlog
+create temporary table `#sql_not_user_table202` (id int);
+set @@session.pseudo_thread_id=300;
+create temporary table t301 (id int);
+create temporary table t302 (id int);
+create temporary table `#sql_not_user_table303` (id int);
+disconnect con1;
+
+#now do something to show that slave is ok after DROP temp tables
+connection master;
+create table t1(f int);
+insert into t1 values (1);
+
+sync_slave_with_master;
+#connection slave;
+select * from t1 /* must be 1 */;
+
+connection master;
+drop table t1;
+
+#
+#14157: utf8 encoding in binlog without set character_set_client
+#
+--write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
+create table t1 (a int);
+set names latin1;
+create temporary table `äöüÄÖÜ` (a int);
+insert into `äöüÄÖÜ` values (1);
+insert into t1 select * from `äöüÄÖÜ`
+EOF
+--exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=latin1 test < $MYSQLTEST_VARDIR/tmp/bug14157.sql
+
+sync_slave_with_master;
+#connection slave;
+select * from t1;
+
+connection master;
+drop table t1;
+
+# Delete the anonymous users
+source include/delete_anonymous_users.inc;
+
+# End of 5.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_timezone-master.opt b/mysql-test/suite/rpl/t/rpl_timezone-master.opt
new file mode 100644
index 00000000000..8e43bfbbb7e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_timezone-master.opt
@@ -0,0 +1 @@
+--default-time-zone=Europe/Moscow
diff --git a/mysql-test/suite/rpl/t/rpl_timezone-slave.opt b/mysql-test/suite/rpl/t/rpl_timezone-slave.opt
new file mode 100644
index 00000000000..191182c329c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_timezone-slave.opt
@@ -0,0 +1 @@
+--default-time-zone=Japan
diff --git a/mysql-test/suite/rpl/t/rpl_timezone.test b/mysql-test/suite/rpl/t/rpl_timezone.test
new file mode 100644
index 00000000000..4b8c8152c82
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_timezone.test
@@ -0,0 +1,142 @@
+#######################################
+# Change Author: JBM
+# Change Date: 2006-01-17
+# Change: Added order by
+#######################################
+# Test of replication of time zones.
+######################################
+# There is currently some bug possibly in prepared statements (this
+# test fails with --ps-protocol): sys_var_thd_time_zone::value_ptr()
+# is called only at prepare time, not at execution time. So,
+# thd->time_zone_used is not equal to 1 (it is back to 0, because of
+# reset_thd_for_next_command called at execution time), so the
+# timezone used in CONVERT_TZ is not binlogged. To debug (by Guilhem
+# and possibly Konstantin).
+
+--disable_ps_protocol
+
+source include/master-slave.inc;
+
+# Save original timezone
+set @my_time_zone= @@global.time_zone;
+
+# Some preparations
+let $VERSION=`select version()`;
+set timestamp=100000000; # for fixed output of mysqlbinlog
+create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n));
+create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n));
+
+connection slave;
+select @@time_zone;
+#set time_zone='UTC';
+#select @@time_zone;
+#
+# Let us check how well replication works when we are saving datetime
+# value in TIMESTAMP field.
+#
+connection master;
+select @@time_zone;
+#set time_zone='UTC';
+#select @@time_zone;
+insert into t1 values ('20050101000000', NULL), ('20050611093902',NULL);
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
+SELECT * FROM t1 ORDER BY n;
+sync_slave_with_master;
+#set time_zone='UTC';
+SELECT * FROM t1 ORDER BY n;
+
+# Let us check also that setting of time_zone back to default also works
+# well
+connection master;
+delete from t1;
+set time_zone='Europe/Moscow';
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
+SELECT * FROM t1 ORDER BY n;
+sync_slave_with_master;
+set time_zone='Europe/Moscow';
+SELECT * FROM t1 ORDER BY n;
+connection master;
+# Change Author: JBM
+# Change Date: 2005-12-22
+# Change: Comment out the exec of the binlog so test works for both SBR and RBR
+#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+#--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
+
+# Let us check with LOAD DATA INFILE
+# (we do it after mysqlbinlog because the temp files names are not constant)
+connection master;
+delete from t1;
+set time_zone='UTC';
+load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
+SELECT * FROM t1 ORDER BY n;
+sync_slave_with_master;
+set time_zone='UTC';
+SELECT * FROM t1 ORDER BY n;
+set time_zone='Europe/Moscow';
+
+# Put back values of before the LOAD
+connection master;
+set time_zone='Europe/Moscow';
+delete from t1;
+insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
+
+#
+# Now let us check how well we replicate statments reading TIMESTAMP fields
+# (We should see the same data on master and on slave but it should differ
+# from originally inserted)
+#
+set time_zone='MET';
+insert into t2 (select * from t1);
+SELECT * FROM t1 ORDER BY n;
+sync_slave_with_master;
+SELECT * FROM t2 ORDER BY n;
+
+#
+# Now let us check how well we replicate various CURRENT_* functions
+#
+connection master;
+delete from t2;
+set timestamp=1000072000;
+insert into t2 values (current_timestamp,NULL), (current_date,NULL), (current_time,NULL);
+sync_slave_with_master;
+SELECT * FROM t2 ORDER BY n;
+
+#
+# At last let us check replication of FROM_UNIXTIME/UNIX_TIMESTAMP functions.
+#
+connection master;
+delete from t2;
+insert into t2 values (from_unixtime(1000000000),NULL),
+ (unix_timestamp('2001-09-09 03:46:40'),NULL);
+SELECT * FROM t2 ORDER BY n;
+sync_slave_with_master;
+# We should get same result on slave as on master
+SELECT * FROM t2 ORDER BY n;
+
+#
+# Let us check that we are allowing to set global time_zone with
+# replication
+#
+connection master;
+set global time_zone='MET';
+
+#
+# Let us see if CONVERT_TZ(@@time_zone) replicates
+#
+delete from t2;
+set time_zone='UTC';
+insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone),NULL);
+insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'),NULL);
+SELECT * FROM t2 ORDER BY n;
+sync_slave_with_master;
+SELECT * FROM t2 ORDER BY n;
+
+# Clean up
+connection master;
+drop table t1, t2;
+sync_slave_with_master;
+
+
+# Restore original timezone
+connection master;
+set global time_zone= @my_time_zone;
diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test
new file mode 100644
index 00000000000..9f5f6fc9b4c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_trigger.test
@@ -0,0 +1,477 @@
+#
+# Test of triggers with replication
+# Adding statement include due to Bug 12574
+# TODO: Remove statement include once 12574 is patched
+--source include/have_binlog_format_mixed_or_statement.inc
+--source include/master-slave.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+
+--enable_warnings
+
+#
+# #12482: Triggers has side effects with auto_increment values
+#
+
+create table t1 (a int auto_increment, primary key (a), b int, rand_value double not null);
+create table t2 (a int auto_increment, primary key (a), b int);
+create table t3 (a int auto_increment, primary key (a), name varchar(64) not null, old_a int, old_b int, rand_value double not null);
+
+delimiter |;
+create trigger t1 before insert on t1 for each row
+begin
+ insert into t3 values (NULL, "t1", new.a, new.b, rand());
+end|
+
+create trigger t2 after insert on t2 for each row
+begin
+ insert into t3 values (NULL, "t2", new.a, new.b, rand());
+end|
+delimiter ;|
+
+insert into t3 values(100,"log",0,0,0);
+
+# Ensure we always have same random numbers
+SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186;
+
+# Emulate that we have rows 2-9 deleted on the slave
+insert into t1 values(1,1,rand()),(NULL,2,rand());
+insert into t2 (b) values(last_insert_id());
+insert into t2 values(3,0),(NULL,0);
+insert into t2 values(NULL,0),(500,0);
+
+select a,b, truncate(rand_value,4) from t1;
+select * from t2;
+select a,name, old_a, old_b, truncate(rand_value,4) from t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+--disable_query_log
+select "--- On slave --" as "";
+--enable_query_log
+select a,b, truncate(rand_value,4) from t1;
+select * from t2;
+select a,name, old_a, old_b, truncate(rand_value,4) from t3;
+connection master;
+drop table t1,t2,t3;
+
+#
+# #12480: NOW() is not constant in a trigger
+# #12481: Using NOW() in a stored function breaks statement based replication
+#
+
+# Start by getting a lock on 'bug12480' to be able to use get_lock() as sleep()
+connect (con2,localhost,root,,);
+connection con2;
+select get_lock("bug12480",2);
+connection default;
+
+create table t1 (a datetime,b datetime, c datetime);
+--disable_warnings
+drop function if exists bug12480;
+--enable_warnings
+
+delimiter |;
+
+create function bug12480() returns datetime
+begin
+ set @a=get_lock("bug12480",2);
+ return now();
+end|
+
+create trigger t1_first before insert on t1
+for each row begin
+ set @a=get_lock("bug12480",2);
+ set new.b= now();
+ set new.c= bug12480();
+end
+|
+
+delimiter ;|
+insert into t1 set a = now();
+select a=b && a=c from t1;
+let $time=`select a from t1`;
+
+# Check that definer attribute is replicated properly:
+# - dump definers on the master;
+# - wait for the slave to synchronize with the master;
+# - dump definers on the slave;
+
+SELECT routine_name, definer
+FROM information_schema.routines;
+
+SELECT trigger_name, definer
+FROM information_schema.triggers;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+--disable_query_log
+select "--- On slave --" as "";
+--enable_query_log
+
+# XXX: Definers of stored procedures and functions are not replicated. WL#2897
+# (Complete definer support in the stored routines) addresses this issue. So,
+# the result file is expected to be changed after implementation of this WL
+# item.
+
+SELECT routine_name, definer
+FROM information_schema.routines;
+
+SELECT trigger_name, definer
+FROM information_schema.triggers;
+
+select a=b && a=c from t1;
+--disable_query_log
+eval select a='$time' as 'test' from t1;
+--enable_query_log
+
+connection master;
+disconnect con2;
+
+truncate table t1;
+drop trigger t1_first;
+
+insert into t1 values ("2003-03-03","2003-03-03","2003-03-03"),(bug12480(),bug12480(),bug12480()),(now(),now(),now());
+select a=b && a=c from t1;
+
+drop function bug12480;
+drop table t1;
+
+#
+# #14614: Replication of tables with trigger generates error message if databases is changed
+# Note. The error message is emitted by _myfree() using fprintf() to the stderr
+# and because of that does not fall into the .result file.
+#
+
+create table t1 (i int);
+create table t2 (i int);
+
+delimiter |;
+create trigger tr1 before insert on t1 for each row
+begin
+ insert into t2 values (1);
+end|
+delimiter ;|
+
+create database other;
+use other;
+insert into test.t1 values (1);
+
+save_master_pos;
+connection slave;
+sync_with_master;
+
+connection master;
+use test;
+drop table t1,t2;
+drop database other;
+
+
+#
+# Test specific triggers including SELECT into var with replication
+# BUG#13227:
+# slave performs an update to the replicatable table, t1,
+# and modifies its local data, t3, by mean of its local trigger that uses
+# another local table t2.
+# Expected values are commented into queries.
+#
+# Body of the test executes in a loop since the problem occurred randomly.
+#
+
+let $max_rows=5;
+let $rnd=10;
+
+--echo test case for BUG#13227
+while ($rnd)
+{
+ --echo -------------------
+ echo $rnd;
+ --echo -------------------
+
+### SETUP
+
+--disable_warnings
+ connection master;
+ eval drop table if exists t1$rnd;
+ connection slave;
+ eval drop table if exists t2$rnd,t3$rnd;
+--enable_warnings
+
+ connection master;
+ eval create table t1$rnd (f1 int) /* 2 replicate */;
+ let $i=$max_rows;
+ while ($i)
+ {
+ eval insert into t1$rnd values (-$i);
+ dec $i;
+ }
+
+ sync_slave_with_master;
+#connection slave;
+ eval select * from t1$rnd;
+ delimiter |;
+ eval create trigger trg1$rnd before update on t1$rnd /* slave local */
+ for each row
+ begin
+ DECLARE r integer;
+ SELECT f2 INTO r FROM t2$rnd where f1=NEW.f1;
+ INSERT INTO t3$rnd values (r);
+ end|
+ delimiter ;|
+ eval create table t2$rnd (f1 int, f2 int) /* slave local */;
+ eval create table t3$rnd (f3 int) /* slave local */;
+ let $i=$max_rows;
+ while ($i)
+ {
+ eval insert into t2$rnd values ($i, $i*100);
+ dec $i;
+ }
+
+### Test
+
+#connection slave;
+
+# trigger works as specified when updates from slave
+ eval select * from t2$rnd;
+ eval UPDATE t1$rnd SET f1=$max_rows where f1=-$max_rows;
+ eval SELECT * from t1$rnd /* must be f1 $max_rows, 1 - $max_rows 2 - $max_rows ... -1 */;
+ eval SELECT * from t3$rnd /* must be f3 $max_rows*100 */;
+
+ connection master;
+ let $i=$max_rows;
+ while ($i)
+ {
+ eval UPDATE t1$rnd SET f1=$i where f1=-$i;
+ dec $i;
+ }
+
+ sync_slave_with_master;
+#connection slave;
+ eval SELECT * from t1$rnd /* must be f1 $max_rows ... 1 */;
+ eval SELECT * from t3$rnd /* must be f3 $max_rows * 100 ... 100 */;
+
+### CLEANUP
+#connection slave;
+ eval drop trigger trg1$rnd;
+ eval drop table t2$rnd,t3$rnd;
+
+ connection master;
+ eval drop table t1$rnd;
+
+ dec $rnd;
+}
+
+
+#
+# BUG#16266: Definer is not fully qualified error during replication.
+#
+# The idea of this test is to emulate replication of a trigger from the old
+# master (master w/o "DEFINER in triggers" support) to the new slave and check
+# that:
+# 1. the trigger on the slave will be replicated w/o errors;
+# 2. the trigger on the slave will be non-SUID (will have no DEFINER);
+# 3. the trigger can be activated later on the slave w/o errors.
+#
+# In order to emulate this kind of replication, we make the slave playing the binlog,
+# recorded by 5.0.16 master. This binlog contains the following statements:
+# CREATE TABLE t1(c INT);
+# CREATE TABLE t2(s CHAR(200));
+# CREATE TRIGGER trg1 AFTER INSERT ON t1
+# FOR EACH ROW
+# INSERT INTO t2 VALUES(CURRENT_USER());
+# INSERT INTO t1 VALUES(1);
+#
+
+# 1. Check that the trigger's replication is succeeded.
+
+# Stop the slave.
+
+connection slave;
+STOP SLAVE;
+
+# Replace master's binlog.
+
+connection master;
+FLUSH LOGS;
+exec cp $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001;
+
+# Make the slave to replay the new binlog.
+
+connection slave;
+RESET SLAVE;
+START SLAVE;
+
+SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0;
+
+# Check that the replication succeeded.
+
+SHOW TABLES LIKE 't_';
+SHOW TRIGGERS;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+# 2. Check that the trigger is non-SUID on the slave;
+# 3. Check that the trigger can be activated on the slave.
+
+INSERT INTO t1 VALUES(2);
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+# That's all, cleanup.
+
+DROP TRIGGER trg1;
+DROP TABLE t1;
+DROP TABLE t2;
+
+STOP SLAVE;
+RESET SLAVE;
+
+# The master should be clean.
+
+connection master;
+SHOW TABLES LIKE 't_';
+SHOW TRIGGERS;
+
+RESET MASTER;
+
+# Restart slave.
+
+connection slave;
+START SLAVE;
+
+
+#
+# BUG#20438: CREATE statements for views, stored routines and triggers can be
+# not replicable.
+#
+
+--echo
+--echo ---> Test for BUG#20438
+
+# Prepare environment.
+
+--echo
+--echo ---> Preparing environment...
+--echo ---> connection: master
+--connection master
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+--echo
+--echo ---> Synchronizing slave with master...
+
+--save_master_pos
+--connection slave
+--sync_with_master
+
+--echo
+--echo ---> connection: master
+--connection master
+
+# Test.
+
+--echo
+--echo ---> Creating objects...
+
+CREATE TABLE t1(c INT);
+CREATE TABLE t2(c INT);
+
+/*!50003 CREATE TRIGGER t1_bi BEFORE INSERT ON t1
+ FOR EACH ROW
+ INSERT INTO t2 VALUES(NEW.c * 10) */;
+
+--echo
+--echo ---> Inserting value...
+
+INSERT INTO t1 VALUES(1);
+
+--echo
+--echo ---> Checking on master...
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+--echo
+--echo ---> Synchronizing slave with master...
+
+--save_master_pos
+--connection slave
+--sync_with_master
+
+--echo ---> connection: master
+
+--echo
+--echo ---> Checking on slave...
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+# Cleanup.
+
+--echo
+--echo ---> connection: master
+--connection master
+
+--echo
+--echo ---> Cleaning up...
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+--save_master_pos
+--connection slave
+--sync_with_master
+--connection master
+
+#
+# BUG#23703: DROP TRIGGER needs an IF EXISTS
+#
+
+connection master;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1(a int, b varchar(50));
+
+-- error ER_TRG_DOES_NOT_EXIST
+drop trigger not_a_trigger;
+
+drop trigger if exists not_a_trigger;
+
+create trigger t1_bi before insert on t1
+for each row set NEW.b := "In trigger t1_bi";
+
+insert into t1 values (1, "a");
+drop trigger if exists t1_bi;
+insert into t1 values (2, "b");
+drop trigger if exists t1_bi;
+insert into t1 values (3, "c");
+
+select * from t1;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+
+select * from t1;
+
+connection master;
+
+drop table t1;
+
+#
+# End of tests
+#
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_trunc_temp.test b/mysql-test/suite/rpl/t/rpl_trunc_temp.test
new file mode 100644
index 00000000000..28bcb0c06c3
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_trunc_temp.test
@@ -0,0 +1,35 @@
+# Requires statement logging
+-- source include/have_binlog_format_mixed_or_statement.inc
+
+source include/master-slave.inc;
+
+#
+# Bug#17137 Running "truncate table" on temporary table
+# leaves the table open on a slave
+#
+
+create temporary table t1 (n int);
+insert into t1 values(1);
+sync_slave_with_master;
+show status like 'Slave_open_temp_tables';
+
+# Perform a delete from temp table
+connection master;
+delete from t1;
+sync_slave_with_master;
+show status like 'Slave_open_temp_tables';
+
+# Perform truncate on temp table
+connection master;
+truncate t1;
+sync_slave_with_master;
+show status like 'Slave_open_temp_tables';
+
+# Disconnect the master, temp table on slave should dissapear
+disconnect master;
+--real_sleep 3 # time for DROP to be read by slave
+connection slave;
+show status like 'Slave_open_temp_tables';
+
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_truncate_2myisam.test b/mysql-test/suite/rpl/t/rpl_truncate_2myisam.test
new file mode 100644
index 00000000000..a0f0ea04f44
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_truncate_2myisam.test
@@ -0,0 +1,4 @@
+--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
new file mode 100644
index 00000000000..a31fd62a29a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_truncate_3innodb.test
@@ -0,0 +1,6 @@
+
+--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_truncate_7ndb_2-master.opt b/mysql-test/suite/rpl/t/rpl_truncate_7ndb_2-master.opt
new file mode 100644
index 00000000000..01cf3e0520f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_truncate_7ndb_2-master.opt
@@ -0,0 +1 @@
+--binlog-format=mixed
diff --git a/mysql-test/suite/rpl/t/rpl_truncate_7ndb_2.test b/mysql-test/suite/rpl/t/rpl_truncate_7ndb_2.test
new file mode 100644
index 00000000000..4ee6c98d463
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_truncate_7ndb_2.test
@@ -0,0 +1,6 @@
+# Same test as rpl_truncate_7ndb.test, but with mixed mode
+# This is marked with 'big_test' just because the rpl_truncate_7ndb test is
+# so slow...
+
+--source include/big_test.inc
+--source t/rpl_truncate_7ndb.test
diff --git a/mysql-test/suite/rpl/t/rpl_udf-master.opt b/mysql-test/suite/rpl/t/rpl_udf-master.opt
new file mode 100644
index 00000000000..7d8786c156a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_udf-master.opt
@@ -0,0 +1 @@
+$UDF_EXAMPLE_LIB_OPT
diff --git a/mysql-test/suite/rpl/t/rpl_udf-slave.opt b/mysql-test/suite/rpl/t/rpl_udf-slave.opt
new file mode 100644
index 00000000000..7d8786c156a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_udf-slave.opt
@@ -0,0 +1 @@
+$UDF_EXAMPLE_LIB_OPT
diff --git a/mysql-test/suite/rpl/t/rpl_udf.test b/mysql-test/suite/rpl/t/rpl_udf.test
new file mode 100644
index 00000000000..262ad04630c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_udf.test
@@ -0,0 +1,22 @@
+###################################################################
+# Author: Chuck Bell #
+# Date: 2006-12-21 #
+# Purpose: To test that UDFs are replicated in both row based and #
+# statement based format. This tests work completed in WL#3629. #
+###################################################################
+
+--source include/not_embedded.inc
+--source include/master-slave.inc
+
+let $engine_type= MyISAM;
+
+set binlog_format=row;
+
+# Embedded server doesn't support binlogging
+--source include/rpl_udf.inc
+
+set binlog_format=statement;
+
+# Embedded server doesn't support binlogging
+--source include/rpl_udf.inc
+
diff --git a/mysql-test/suite/rpl/t/rpl_user_variables.test b/mysql-test/suite/rpl/t/rpl_user_variables.test
new file mode 100644
index 00000000000..539f9c88e0d
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_user_variables.test
@@ -0,0 +1,362 @@
+###################################
+#
+# Test of replicating user variables
+#
+###################################
+
+-- source include/master-slave.inc
+# Disable PS as the log positions differs
+--disable_ps_protocol
+
+
+# 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
+# binlog. But previous tests can influence the current test's
+# binlog (e.g. a temporary table in the previous test has not
+# been explicitly deleted, or it has but the slave hasn't had
+# enough time to catch it before STOP SLAVE,
+# and at the beginning of the current
+# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
+# We wait for the slave to have written all he wants to the binlog
+# (otherwise RESET MASTER may come too early).
+save_master_pos;
+connection slave;
+sync_with_master;
+reset master;
+connection master;
+
+create table t1(n char(30));
+set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
+set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
+set @n1:=null;
+set @s2:='', @s3:='abc\'def', @s4:= 'abc\\def', @s5:= 'abc''def';
+insert into t1 values (@i1), (@i2), (@i3), (@i4);
+insert into t1 values (@r1), (@r2);
+insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5);
+insert into t1 values (@n1);
+insert into t1 values (@n2); # not explicitely set before
+insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
+insert into t1 values (@a+(@b:=@a+1));
+set @q:='abc';
+insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
+set @a:=5;
+insert into t1 values (@a),(@a);
+# To flush the pending event, we add the following statement. RBR can
+# concatenate the result of several statements, which SBR cannot.
+select * from t1 where n = '<nonexistant>';
+connection master1; # see if variable is reset in binlog when thread changes
+insert into t1 values (@a),(@a),(@a*5);
+SELECT * FROM t1 ORDER BY n;
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY n;
+connection master;
+insert into t1 select * FROM (select @var1 union select @var2) AS t2;
+drop table t1;
+--echo End of 4.1 tests.
+
+# BUG#20141
+# The following tests ensure that if user-defined variables are used in SF/Triggers
+# that they are replicated correctly. These tests should be run in both SBR and RBR
+# modes.
+
+# This test uses a procedure that inserts data values based on the value of a
+# user-defined variable. It also has a trigger that inserts data based on the
+# same variable. Successful test runs show that the @var is replicated
+# properly and that the procedure and trigger insert the correct data on the
+# slave.
+#
+# The test of stored procedure was included for completeness. Replication of stored
+# procedures was not directly affected by BUG#20141.
+#
+# This test was constructed for BUG#20141
+
+--disable_warnings
+DROP TABLE IF EXISTS t20;
+DROP TABLE IF EXISTS t21;
+DROP PROCEDURE IF EXISTS test.insert;
+--enable_warnings
+
+CREATE TABLE t20 (a VARCHAR(20));
+CREATE TABLE t21 (a VARCHAR(20));
+DELIMITER |;
+
+# Create a procedure that uses the @var for flow control
+
+CREATE PROCEDURE test.insert()
+BEGIN
+ IF (@VAR)
+ THEN
+ INSERT INTO test.t20 VALUES ('SP_TRUE');
+ ELSE
+ INSERT INTO test.t20 VALUES ('SP_FALSE');
+ END IF;
+END|
+
+# Create a trigger that uses the @var for flow control
+
+CREATE TRIGGER test.insert_bi BEFORE INSERT
+ ON test.t20 FOR EACH ROW
+ BEGIN
+ IF (@VAR)
+ THEN
+ INSERT INTO test.t21 VALUES ('TRIG_TRUE');
+ ELSE
+ INSERT INTO test.t21 VALUES ('TRIG_FALSE');
+ END IF;
+ END|
+DELIMITER ;|
+
+sync_slave_with_master;
+connection master;
+
+# Set @var and call the procedure, repeat with different values
+
+SET @VAR=0;
+CALL test.insert();
+SET @VAR=1;
+CALL test.insert();
+
+--echo On master: Check the tables for correct data
+
+SELECT * FROM t20;
+SELECT * FROM t21;
+
+sync_slave_with_master;
+
+--echo On slave: Check the tables for correct data and it matches master
+
+SELECT * FROM t20;
+SELECT * FROM t21;
+connection master;
+
+# Cleanup
+
+DROP TABLE t20;
+DROP TABLE t21;
+DROP PROCEDURE test.insert;
+
+# This test uses a stored function that uses user-defined variables to return data
+# This test was constructed for BUG#20141
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS test.square;
+--enable_warnings
+
+CREATE TABLE t1 (i INT);
+
+# Create function that returns a value from @var. In this case, the square function
+
+CREATE FUNCTION test.square() RETURNS INTEGER DETERMINISTIC RETURN
+(@var * @var);
+
+# Set the @var to different values and insert them into a table
+
+SET @var = 1;
+INSERT INTO t1 VALUES (square());
+SET @var = 2;
+INSERT INTO t1 VALUES (square());
+SET @var = 3;
+INSERT INTO t1 VALUES (square());
+SET @var = 4;
+INSERT INTO t1 VALUES (square());
+SET @var = 5;
+INSERT INTO t1 VALUES (square());
+
+--echo On master: Retrieve the values from the table
+
+SELECT * FROM t1;
+
+sync_slave_with_master;
+
+--echo On slave: Retrieve the values from the table and verify they are the same as on master
+
+SELECT * FROM t1;
+
+connection master;
+
+# Cleanup
+
+DROP TABLE t1;
+DROP FUNCTION test.square;
+
+# This test uses stored functions that uses user-defined variables to return data
+# based on the use of @vars inside a function body.
+# This test was constructed for BUG#14914
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+--enable_warnings
+
+CREATE TABLE t1(a int);
+DELIMITER |;
+
+# Create a function that simply returns the value of an @var.
+# Create a function that uses an @var for flow control, creates and uses another
+# @var and sets its value to a value based on another @var.
+
+CREATE FUNCTION f1() returns int deterministic BEGIN
+ return @a;
+END |
+
+CREATE FUNCTION f2() returns int deterministic BEGIN
+ IF (@b > 0) then
+ SET @c = (@a + @b);
+ else
+ SET @c = (@a - 1);
+ END if;
+ return @c;
+END |
+DELIMITER ;|
+
+sync_slave_with_master;
+connection master;
+
+# Set an @var to a value and insert data into a table using the first function.
+# Set two more @vars to some values and insert data into a table using the second function.
+
+SET @a=500;
+INSERT INTO t1 values(f1());
+SET @b = 125;
+SET @c = 1;
+INSERT INTO t1 values(f2());
+
+--echo On master: Retrieve the values from the table
+
+sync_slave_with_master;
+connection master;
+
+SELECT * from t1;
+
+connection slave;
+
+--echo On slave: Check the tables for correct data and it matches master
+
+SELECT * from t1;
+
+connection master;
+
+# Cleanup
+
+DROP TABLE t1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+
+# This test uses a function that changes a user-defined variable in its body. This test
+# will ensure the @vars are replicated when needed and not interrupt the normal execution
+# of the function on the slave. This also applies to procedures and triggers.
+
+# This test was constructed for BUG#25167
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+CREATE TABLE t1 (i int);
+CREATE TABLE t2 (k int);
+DELIMITER |;
+
+# Create a trigger that inserts data into another table, changes the @var then inserts
+# another row with the modified value.
+
+CREATE trigger t1_bi before INSERT on t1 for each row BEGIN
+ INSERT INTO t2 values (@a);
+ SET @a:=42;
+ INSERT INTO t2 values (@a);
+END |
+DELIMITER ;|
+
+sync_slave_with_master;
+connection master;
+
+# Set the @var to a value then insert data into first table.
+
+SET @a:=100;
+INSERT INTO t1 values (5);
+
+--echo On master: Check to see that data was inserted correctly in both tables
+
+SELECT * from t1;
+SELECT * from t2;
+
+sync_slave_with_master;
+
+--echo On slave: Check the tables for correct data and it matches master
+
+SELECT * from t1;
+SELECT * from t2;
+
+connection master;
+drop table t1, t2;
+
+#
+# Bug #12826: Possible to get inconsistent slave using SQL syntax Prepared Statements
+#
+connection master;
+create table t1(a int, b int);
+prepare s1 from 'insert into t1 values (@x:=@x+1, ?)';
+set @x=1; execute s1 using @x;
+select * from t1;
+sync_slave_with_master;
+connection slave;
+select * from t1;
+connection master;
+drop table t1;
+
+--echo End of 5.0 tests.
+
+# This test uses a stored function that uses user-defined variables to return data
+# The test ensures the value of the user-defined variable is replicated correctly
+# and in the correct order of assignment.
+
+# This test was constructed for BUG#20141
+
+--disable_warnings
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+--enable_warnings
+
+CREATE TABLE t1 (i INT);
+
+# Create two functions. One simply returns the user-defined variable. The other
+# returns a value based on the user-defined variable.
+
+CREATE FUNCTION f1() RETURNS INT RETURN @a; DELIMITER |; CREATE
+FUNCTION f2() RETURNS INT BEGIN
+ INSERT INTO t1 VALUES (10 + @a);
+ RETURN 0;
+END|
+DELIMITER ;|
+
+sync_slave_with_master;
+connection master;
+
+# Set the variable and execute the functions.
+
+SET @a:=123;
+SELECT f1(), f2();
+
+--echo On master: Check to see that data was inserted correctly
+
+INSERT INTO t1 VALUES(f1());
+SELECT * FROM t1;
+
+sync_slave_with_master;
+
+--echo On slave: Check the table for correct data and it matches master
+
+SELECT * FROM t1;
+
+connection master;
+
+# Cleanup
+
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP TABLE t1;
+
+sync_slave_with_master;
+stop slave;
diff --git a/mysql-test/suite/rpl/t/rpl_variables-master.opt b/mysql-test/suite/rpl/t/rpl_variables-master.opt
new file mode 100644
index 00000000000..a668c6bfbe8
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_variables-master.opt
@@ -0,0 +1 @@
+--slave-skip-errors=3,100,137,643,1752
diff --git a/mysql-test/suite/rpl/t/rpl_variables.test b/mysql-test/suite/rpl/t/rpl_variables.test
new file mode 100644
index 00000000000..84dc3acfe6e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_variables.test
@@ -0,0 +1,20 @@
+source include/master-slave.inc;
+
+# Init for rstore of variable values
+set @my_slave_net_timeout =@@global.slave_net_timeout;
+
+set global slave_net_timeout=100;
+set global sql_slave_skip_counter=100;
+
+# End of 4.1 tests
+
+# BUG #7800: Add various-slave related variables to SHOW VARIABLES
+show variables like 'slave_compressed_protocol';
+--replace_column 2 SLAVE_LOAD_TMPDIR
+show variables like 'slave_load_tmpdir';
+# We just set some arbitrary values in variables-master.opt so we can test
+# that a list of values works correctly
+show variables like 'slave_skip_errors';
+
+# Cleanup
+set global slave_net_timeout=default;
diff --git a/mysql-test/suite/rpl/t/rpl_view-slave.opt b/mysql-test/suite/rpl/t/rpl_view-slave.opt
new file mode 100644
index 00000000000..79b3bf6174b
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_view-slave.opt
@@ -0,0 +1 @@
+--replicate-ignore-table=test.foo
diff --git a/mysql-test/suite/rpl/t/rpl_view.test b/mysql-test/suite/rpl/t/rpl_view.test
new file mode 100644
index 00000000000..51ad319b212
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_view.test
@@ -0,0 +1,167 @@
+# NYI - row-based cannot use CREATE ... SELECT
+
+source include/master-slave.inc;
+--disable_warnings
+drop table if exists t1,v1;
+drop view if exists t1,v1;
+sync_slave_with_master;
+reset master;
+--enable_warnings
+
+#
+# Check that creation drop of view is replicated, also check replication of
+# updating of view
+#
+connection master;
+create table t1 (a int);
+insert into t1 values (1);
+create view v1 as select a from t1;
+insert into v1 values (2);
+select * from v1 order by a;
+sync_slave_with_master;
+# view already have to be on slave
+select * from v1 order by a;
+connection master;
+update v1 set a=3 where a=1;
+select * from v1 order by a;
+sync_slave_with_master;
+select * from v1 order by a;
+connection master;
+delete from v1 where a=2;
+select * from v1 order by a;
+sync_slave_with_master;
+select * from v1 order by a;
+connection master;
+# 'alter view' internally maped to creation, but still check that it works
+alter view v1 as select a as b from t1;
+sync_slave_with_master;
+select * from v1 order by 1;
+connection master;
+drop view v1;
+sync_slave_with_master;
+#error, because view have to be removed from slave
+-- error 1146
+select * from v1 order by a;
+connection master;
+drop table t1;
+sync_slave_with_master;
+# Change Author: JBM
+# Change Date: 2005-12-22
+# Change: Commented out binlog events to work with SBR and RBR
+#--replace_column 2 # 5 #
+# show binlog events limit 1,100;
+
+#
+# BUG#20438: CREATE statements for views, stored routines and triggers can be
+# not replicable.
+#
+
+--echo
+--echo ---> Test for BUG#20438
+
+# Prepare environment.
+
+--echo
+--echo ---> Preparing environment...
+--echo ---> connection: master
+--connection master
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+
+--echo
+--echo ---> Synchronizing slave with master...
+
+--save_master_pos
+--connection slave
+--sync_with_master
+
+--echo
+--echo ---> connection: master
+--connection master
+
+# Test.
+
+--echo
+--echo ---> Creating objects...
+
+CREATE TABLE t1(c INT);
+
+/*!50003 CREATE VIEW v1 AS SELECT * FROM t1 */;
+
+--echo
+--echo ---> Inserting value...
+
+INSERT INTO t1 VALUES(1);
+
+--echo
+--echo ---> Checking on master...
+
+SELECT * FROM t1;
+
+--echo
+--echo ---> Synchronizing slave with master...
+
+--save_master_pos
+--connection slave
+--sync_with_master
+
+--echo ---> connection: master
+
+--echo
+--echo ---> Checking on slave...
+
+SELECT * FROM t1;
+
+# Cleanup.
+
+--echo
+--echo ---> connection: master
+--connection master
+
+--echo
+--echo ---> Cleaning up...
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+--save_master_pos
+--connection slave
+--sync_with_master
+--connection master
+
+#
+# BUG#19419: "VIEW: View that the column name is different
+# by master and slave is made".
+#
+connection master;
+create table t1(a int, b int);
+insert into t1 values (1, 1), (1, 2), (1, 3);
+create view v1(a, b) as select a, sum(b) from t1 group by a;
+
+sync_slave_with_master;
+explain v1;
+show create table v1;
+select * from v1;
+
+connection master;
+drop table t1;
+drop view v1;
+
+sync_slave_with_master;
+
+#
+# BUG#28244 CREATE VIEW breaks replication when view exists
+#
+connection master;
+CREATE TABLE t1(a INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+--error ER_TABLE_EXISTS_ERROR
+CREATE VIEW v1 AS SELECT * FROM t1;
+DROP VIEW v1;
+DROP TABLE t1;
+sync_slave_with_master;
+
+--echo End of 5.0 tests