summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/binlog.test48
-rw-r--r--mysql-test/t/binlog_row_binlog-master.opt (renamed from mysql-test/t/binlog-master.opt)0
-rw-r--r--mysql-test/t/binlog_row_binlog.test5
-rw-r--r--mysql-test/t/binlog_row_blackhole.test5
-rw-r--r--mysql-test/t/binlog_row_ctype_cp932.test5
-rw-r--r--mysql-test/t/binlog_row_ctype_ucs.test6
-rw-r--r--mysql-test/t/binlog_row_drop_tmp_tbl.test5
-rw-r--r--mysql-test/t/binlog_row_innodb_stat.test5
-rw-r--r--mysql-test/t/binlog_row_insert_select.test5
-rw-r--r--mysql-test/t/binlog_row_mix_innodb_myisam.test5
-rw-r--r--mysql-test/t/binlog_stm_binlog-master.opt1
-rw-r--r--mysql-test/t/binlog_stm_binlog.test5
-rw-r--r--mysql-test/t/binlog_stm_blackhole.test5
-rw-r--r--mysql-test/t/binlog_stm_ctype_cp932.test5
-rw-r--r--mysql-test/t/binlog_stm_ctype_ucs.test6
-rw-r--r--mysql-test/t/binlog_stm_drop_tmp_tbl.test5
-rw-r--r--mysql-test/t/binlog_stm_innodb_stat-master.opt1
-rw-r--r--mysql-test/t/binlog_stm_innodb_stat.test5
-rw-r--r--mysql-test/t/binlog_stm_insert_select.test5
-rw-r--r--mysql-test/t/binlog_stm_mix_innodb_myisam.test5
-rw-r--r--mysql-test/t/blackhole.test146
-rw-r--r--mysql-test/t/create_select_tmp.test3
-rw-r--r--mysql-test/t/ctype_cp932.test436
-rw-r--r--mysql-test/t/ctype_cp932_binlog.test34
-rw-r--r--mysql-test/t/ctype_cp932_binlog_row.test5
-rw-r--r--mysql-test/t/ctype_cp932_binlog_stm.test5
-rw-r--r--mysql-test/t/ctype_ucs_binlog.test20
-rw-r--r--mysql-test/t/date_formats.test3
-rw-r--r--mysql-test/t/disabled.def18
-rw-r--r--mysql-test/t/drop_temp_table.test31
-rw-r--r--mysql-test/t/innodb.test43
-rw-r--r--mysql-test/t/innodb_concurrent-master.opt1
-rw-r--r--mysql-test/t/innodb_concurrent.test346
-rw-r--r--mysql-test/t/insert_select-binlog.test35
-rw-r--r--mysql-test/t/mix_innodb_myisam_binlog.test263
-rw-r--r--mysql-test/t/mysqlbinlog.test6
-rw-r--r--mysql-test/t/mysqlbinlog2.test19
-rw-r--r--mysql-test/t/mysqlbinlog_base64.test38
-rw-r--r--mysql-test/t/rpl000001.test130
-rw-r--r--mysql-test/t/rpl000002.test5
-rw-r--r--mysql-test/t/rpl000006.test49
-rw-r--r--mysql-test/t/rpl000013-slave.opt1
-rw-r--r--mysql-test/t/rpl000013.test10
-rw-r--r--mysql-test/t/rpl000017.test6
-rw-r--r--mysql-test/t/rpl_000012.test (renamed from mysql-test/t/rpl000012.test)36
-rwxr-xr-xmysql-test/t/rpl_000015-slave.sh (renamed from mysql-test/t/rpl000015-slave.sh)0
-rw-r--r--mysql-test/t/rpl_000015.slave-mi (renamed from mysql-test/t/rpl000015.slave-mi)0
-rw-r--r--mysql-test/t/rpl_000015.test (renamed from mysql-test/t/rpl000015.test)6
-rw-r--r--mysql-test/t/rpl_EE_error.test32
-rw-r--r--mysql-test/t/rpl_LD_INFILE.test41
-rw-r--r--mysql-test/t/rpl_auto_increment.test111
-rw-r--r--mysql-test/t/rpl_bit.test90
-rw-r--r--mysql-test/t/rpl_bit_npk.test112
-rw-r--r--mysql-test/t/rpl_change_master.test4
-rw-r--r--mysql-test/t/rpl_charset.test173
-rw-r--r--mysql-test/t/rpl_commit_after_flush.test25
-rw-r--r--mysql-test/t/rpl_create_database.test3
-rw-r--r--mysql-test/t/rpl_ddl.test510
-rw-r--r--mysql-test/t/rpl_deadlock.test113
-rw-r--r--mysql-test/t/rpl_deadlock_innodb-slave.opt (renamed from mysql-test/t/rpl_deadlock-slave.opt)0
-rw-r--r--mysql-test/t/rpl_deadlock_innodb.test6
-rw-r--r--mysql-test/t/rpl_delete_all.test43
-rw-r--r--mysql-test/t/rpl_delete_no_where.test2
-rw-r--r--mysql-test/t/rpl_do_grant.test54
-rw-r--r--mysql-test/t/rpl_drop.test2
-rw-r--r--mysql-test/t/rpl_empty_master_crash.test2
-rw-r--r--mysql-test/t/rpl_error_ignored_table.test60
-rw-r--r--mysql-test/t/rpl_failed_optimize.test26
-rw-r--r--mysql-test/t/rpl_flush_tables.test53
-rw-r--r--mysql-test/t/rpl_flushlog_loop-master.opt (renamed from mysql-test/t/rpl_flush_log_loop-master.opt)0
-rwxr-xr-xmysql-test/t/rpl_flushlog_loop-master.sh (renamed from mysql-test/t/rpl_flush_log_loop-master.sh)0
-rw-r--r--mysql-test/t/rpl_flushlog_loop-slave.opt (renamed from mysql-test/t/rpl_flush_log_loop-slave.opt)0
-rwxr-xr-xmysql-test/t/rpl_flushlog_loop-slave.sh (renamed from mysql-test/t/rpl_flush_log_loop-slave.sh)0
-rw-r--r--mysql-test/t/rpl_flushlog_loop.test (renamed from mysql-test/t/rpl_flush_log_loop.test)14
-rw-r--r--mysql-test/t/rpl_foreign_key_innodb.test6
-rw-r--r--mysql-test/t/rpl_heap.test5
-rw-r--r--mysql-test/t/rpl_insert_id.test83
-rw-r--r--mysql-test/t/rpl_insert_ignore.test78
-rw-r--r--mysql-test/t/rpl_loaddata.test155
-rw-r--r--mysql-test/t/rpl_loaddata2.test8
-rw-r--r--mysql-test/t/rpl_loaddata_rule_m.test30
-rw-r--r--mysql-test/t/rpl_loaddata_s-slave.opt (renamed from mysql-test/t/rpl_loaddata_rule_m-master.opt)0
-rw-r--r--mysql-test/t/rpl_loaddata_s.test (renamed from mysql-test/t/rpl_loaddata_rule_s.test)14
-rw-r--r--mysql-test/t/rpl_loadfile.test47
-rw-r--r--mysql-test/t/rpl_log.test113
-rw-r--r--mysql-test/t/rpl_log_pos.test13
-rw-r--r--mysql-test/t/rpl_max_relay_size.test96
-rw-r--r--mysql-test/t/rpl_multi_delete.test26
-rw-r--r--mysql-test/t/rpl_multi_engine-slave.opt (renamed from mysql-test/t/rpl000001-slave.opt)0
-rw-r--r--mysql-test/t/rpl_multi_engine.test99
-rw-r--r--mysql-test/t/rpl_multi_query.test32
-rw-r--r--mysql-test/t/rpl_multi_update.test51
-rw-r--r--mysql-test/t/rpl_multi_update2.test64
-rw-r--r--mysql-test/t/rpl_multi_update3.test222
-rw-r--r--mysql-test/t/rpl_openssl.test4
-rw-r--r--mysql-test/t/rpl_redirect.test2
-rw-r--r--mysql-test/t/rpl_relayrotate.test78
-rw-r--r--mysql-test/t/rpl_replicate_do.test3
-rw-r--r--mysql-test/t/rpl_replicate_ignore_db-slave.opt1
-rw-r--r--mysql-test/t/rpl_replicate_ignore_db.test30
-rw-r--r--mysql-test/t/rpl_reset_slave.test51
-rw-r--r--mysql-test/t/rpl_rotate_logs.test9
-rw-r--r--mysql-test/t/rpl_row_001.test2
-rw-r--r--mysql-test/t/rpl_row_4_bytes-master.opt1
-rw-r--r--mysql-test/t/rpl_row_4_bytes.test33
-rw-r--r--mysql-test/t/rpl_row_EE_err.test2
-rw-r--r--mysql-test/t/rpl_row_NOW.test73
-rw-r--r--mysql-test/t/rpl_row_USER.test54
-rw-r--r--mysql-test/t/rpl_row_UUID.test2
-rw-r--r--mysql-test/t/rpl_row_basic_2myisam.test3
-rw-r--r--mysql-test/t/rpl_row_basic_3innodb-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_basic_3innodb.test6
-rw-r--r--mysql-test/t/rpl_row_charset.test2
-rw-r--r--mysql-test/t/rpl_row_create_table.test108
-rw-r--r--mysql-test/t/rpl_row_ddl.test35
-rw-r--r--mysql-test/t/rpl_row_delayed_ins.test2
-rw-r--r--mysql-test/t/rpl_row_drop.test47
-rw-r--r--mysql-test/t/rpl_row_err_daisychain-master.opt1
-rw-r--r--mysql-test/t/rpl_row_err_daisychain-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_flsh_tbls.test6
-rw-r--r--mysql-test/t/rpl_row_func001.test56
-rw-r--r--mysql-test/t/rpl_row_func002.test104
-rw-r--r--mysql-test/t/rpl_row_func003.test6
-rw-r--r--mysql-test/t/rpl_row_inexist_tbl.test27
-rw-r--r--mysql-test/t/rpl_row_log-master.opt (renamed from mysql-test/t/rpl_log-master.opt)0
-rw-r--r--mysql-test/t/rpl_row_log-slave.opt (renamed from mysql-test/t/rpl_log-slave.opt)0
-rw-r--r--mysql-test/t/rpl_row_log.test4
-rw-r--r--mysql-test/t/rpl_row_max_relay_size.test9
-rw-r--r--mysql-test/t/rpl_row_multi_update3.test2
-rw-r--r--mysql-test/t/rpl_row_mystery22.test45
-rw-r--r--mysql-test/t/rpl_row_reset_slave.test5
-rw-r--r--mysql-test/t/rpl_row_rewrt_db-slave.opt (renamed from mysql-test/t/rpl_rewrite_db-slave.opt)0
-rw-r--r--mysql-test/t/rpl_row_rewrt_db.test (renamed from mysql-test/t/rpl_rewrite_db.test)6
-rw-r--r--mysql-test/t/rpl_row_sp000-master.opt (renamed from mysql-test/t/rpl_sp-master.opt)0
-rw-r--r--mysql-test/t/rpl_row_sp000-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_sp000.test323
-rw-r--r--mysql-test/t/rpl_row_sp001.test144
-rw-r--r--mysql-test/t/rpl_row_sp002_innodb-master.opt1
-rw-r--r--mysql-test/t/rpl_row_sp002_innodb-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_sp002_innodb.test6
-rw-r--r--mysql-test/t/rpl_row_sp003-master.opt1
-rw-r--r--mysql-test/t/rpl_row_sp003-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_sp003.test6
-rw-r--r--mysql-test/t/rpl_row_sp005.test105
-rw-r--r--mysql-test/t/rpl_row_sp006_InnoDB-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_sp006_InnoDB.test6
-rw-r--r--mysql-test/t/rpl_row_sp007_innodb.test6
-rw-r--r--mysql-test/t/rpl_row_sp008.test58
-rw-r--r--mysql-test/t/rpl_row_sp009.test105
-rw-r--r--mysql-test/t/rpl_row_sp010.test81
-rw-r--r--mysql-test/t/rpl_row_sp011.test115
-rw-r--r--mysql-test/t/rpl_row_sp012.test74
-rw-r--r--mysql-test/t/rpl_row_stop_middle.test44
-rw-r--r--mysql-test/t/rpl_row_stop_middle_update-master.opt1
-rw-r--r--mysql-test/t/rpl_row_stop_middle_update-slave.opt1
-rw-r--r--mysql-test/t/rpl_row_stop_middle_update.test31
-rw-r--r--mysql-test/t/rpl_row_timezone-master.opt (renamed from mysql-test/t/rpl_timezone-master.opt)0
-rw-r--r--mysql-test/t/rpl_row_timezone-slave.opt2
-rw-r--r--mysql-test/t/rpl_row_timezone.test129
-rw-r--r--mysql-test/t/rpl_row_trig001.test98
-rw-r--r--mysql-test/t/rpl_row_trig002.test79
-rw-r--r--mysql-test/t/rpl_row_trig003.test152
-rw-r--r--mysql-test/t/rpl_row_trig004.test14
-rw-r--r--mysql-test/t/rpl_row_until.test86
-rw-r--r--mysql-test/t/rpl_row_user_variables.test4
-rw-r--r--mysql-test/t/rpl_row_view.test (renamed from mysql-test/t/rpl_view.test)6
-rw-r--r--mysql-test/t/rpl_row_view01.test82
-rw-r--r--mysql-test/t/rpl_server_id1.test2
-rw-r--r--mysql-test/t/rpl_sp004.test97
-rw-r--r--mysql-test/t/rpl_sp_effects.test7
-rw-r--r--mysql-test/t/rpl_stm_000001-slave.opt1
-rw-r--r--mysql-test/t/rpl_stm_000001.test2
-rw-r--r--mysql-test/t/rpl_stm_EE_err.test2
-rw-r--r--mysql-test/t/rpl_stm_charset.test2
-rw-r--r--mysql-test/t/rpl_stm_ddl.test35
-rw-r--r--mysql-test/t/rpl_stm_err_ignoredtable-slave.opt (renamed from mysql-test/t/rpl_error_ignored_table-slave.opt)0
-rw-r--r--mysql-test/t/rpl_stm_err_ignoredtable.test8
-rw-r--r--mysql-test/t/rpl_stm_flsh_tbls.test8
-rw-r--r--mysql-test/t/rpl_stm_loaddata_m-master.opt (renamed from mysql-test/t/rpl_loaddata_rule_s-slave.opt)0
-rw-r--r--mysql-test/t/rpl_stm_loaddata_m.test10
-rw-r--r--mysql-test/t/rpl_stm_log-master.opt1
-rw-r--r--mysql-test/t/rpl_stm_log-slave.opt1
-rw-r--r--mysql-test/t/rpl_stm_log.test7
-rw-r--r--mysql-test/t/rpl_stm_max_relay_size.test11
-rw-r--r--mysql-test/t/rpl_stm_multi_query.test12
-rw-r--r--mysql-test/t/rpl_stm_mystery22.test (renamed from mysql-test/t/rpl_mystery22.test)30
-rw-r--r--mysql-test/t/rpl_stm_no_op.test93
-rw-r--r--mysql-test/t/rpl_stm_reset_slave.test6
-rw-r--r--mysql-test/t/rpl_stm_rewrt_db-slave.opt1
-rw-r--r--mysql-test/t/rpl_stm_rewrt_db.test84
-rw-r--r--mysql-test/t/rpl_stm_sp-master.opt1
-rw-r--r--mysql-test/t/rpl_stm_sp-slave.opt (renamed from mysql-test/t/rpl_sp-slave.opt)0
-rw-r--r--mysql-test/t/rpl_stm_sp.test (renamed from mysql-test/t/rpl_sp.test)5
-rw-r--r--mysql-test/t/rpl_stm_timezone-master.opt1
-rw-r--r--mysql-test/t/rpl_stm_timezone-slave.opt (renamed from mysql-test/t/rpl_timezone-slave.opt)0
-rw-r--r--mysql-test/t/rpl_stm_timezone.test (renamed from mysql-test/t/rpl_timezone.test)3
-rw-r--r--mysql-test/t/rpl_stm_until.test (renamed from mysql-test/t/rpl_until.test)11
-rw-r--r--mysql-test/t/rpl_stm_user_variables.test5
-rw-r--r--mysql-test/t/rpl_stm_view.test50
-rw-r--r--mysql-test/t/rpl_temporary.test11
-rw-r--r--mysql-test/t/rpl_trigger.test5
-rw-r--r--mysql-test/t/rpl_user_variables.test58
-rw-r--r--mysql-test/t/sp.test4
-rw-r--r--mysql-test/t/user_var-binlog.test6
204 files changed, 4044 insertions, 3566 deletions
diff --git a/mysql-test/t/binlog.test b/mysql-test/t/binlog.test
deleted file mode 100644
index 2310e800df7..00000000000
--- a/mysql-test/t/binlog.test
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# misc binlogging tests that do not require a slave running
-#
--- source include/have_bdb.inc
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-reset master;
-
-create table t1 (a int) engine=bdb;
-create table t2 (a int) engine=innodb;
-begin;
-insert t1 values (5);
-commit;
-begin;
-insert t2 values (5);
-commit;
-# first COMMIT must be Query_log_event, second - Xid_log_event
---replace_result "xid=18" "xid=11"
---replace_column 2 # 5 #
-show binlog events from 98;
-drop table t1,t2;
-
-#
-# binlog rotation after one big transaction
-#
-reset master;
-let $1=100;
-
-create table t1 (n int) engine=innodb;
-begin;
---disable_query_log
-while ($1)
-{
- eval insert into t1 values($1 + 4);
- dec $1;
-}
---enable_query_log
-commit;
-drop table t1;
---replace_result "xid=29" "xid=18"
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 98;
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000002' from 98;
-
diff --git a/mysql-test/t/binlog-master.opt b/mysql-test/t/binlog_row_binlog-master.opt
index ad2c6a647b5..ad2c6a647b5 100644
--- a/mysql-test/t/binlog-master.opt
+++ b/mysql-test/t/binlog_row_binlog-master.opt
diff --git a/mysql-test/t/binlog_row_binlog.test b/mysql-test/t/binlog_row_binlog.test
new file mode 100644
index 00000000000..8adc8eee5c1
--- /dev/null
+++ b/mysql-test/t/binlog_row_binlog.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_row.inc
+-- source extra/binlog_tests/binlog.test
diff --git a/mysql-test/t/binlog_row_blackhole.test b/mysql-test/t/binlog_row_blackhole.test
new file mode 100644
index 00000000000..5bf1efb1ecb
--- /dev/null
+++ b/mysql-test/t/binlog_row_blackhole.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_row.inc
+-- source extra/binlog_tests/blackhole.test
diff --git a/mysql-test/t/binlog_row_ctype_cp932.test b/mysql-test/t/binlog_row_ctype_cp932.test
new file mode 100644
index 00000000000..595af5a3114
--- /dev/null
+++ b/mysql-test/t/binlog_row_ctype_cp932.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_row.inc
+-- source extra/binlog_tests/ctype_cp932.test
diff --git a/mysql-test/t/binlog_row_ctype_ucs.test b/mysql-test/t/binlog_row_ctype_ucs.test
new file mode 100644
index 00000000000..96e14ed8882
--- /dev/null
+++ b/mysql-test/t/binlog_row_ctype_ucs.test
@@ -0,0 +1,6 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_row.inc
+-- source extra/binlog_tests/ctype_ucs_binlog.test
+
diff --git a/mysql-test/t/binlog_row_drop_tmp_tbl.test b/mysql-test/t/binlog_row_drop_tmp_tbl.test
new file mode 100644
index 00000000000..5b503b78d85
--- /dev/null
+++ b/mysql-test/t/binlog_row_drop_tmp_tbl.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_row.inc
+-- source extra/binlog_tests/drop_temp_table.test
diff --git a/mysql-test/t/binlog_row_innodb_stat.test b/mysql-test/t/binlog_row_innodb_stat.test
new file mode 100644
index 00000000000..e4e6762226b
--- /dev/null
+++ b/mysql-test/t/binlog_row_innodb_stat.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_row.inc
+-- source extra/binlog_tests/innodb_stat.test
diff --git a/mysql-test/t/binlog_row_insert_select.test b/mysql-test/t/binlog_row_insert_select.test
new file mode 100644
index 00000000000..780dfb75293
--- /dev/null
+++ b/mysql-test/t/binlog_row_insert_select.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_row.inc
+-- source extra/binlog_tests/insert_select-binlog.test
diff --git a/mysql-test/t/binlog_row_mix_innodb_myisam.test b/mysql-test/t/binlog_row_mix_innodb_myisam.test
new file mode 100644
index 00000000000..7986467e5e5
--- /dev/null
+++ b/mysql-test/t/binlog_row_mix_innodb_myisam.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_row.inc
+-- source extra/binlog_tests/mix_innodb_myisam_binlog.test
diff --git a/mysql-test/t/binlog_stm_binlog-master.opt b/mysql-test/t/binlog_stm_binlog-master.opt
new file mode 100644
index 00000000000..ad2c6a647b5
--- /dev/null
+++ b/mysql-test/t/binlog_stm_binlog-master.opt
@@ -0,0 +1 @@
+-O max_binlog_size=4096
diff --git a/mysql-test/t/binlog_stm_binlog.test b/mysql-test/t/binlog_stm_binlog.test
new file mode 100644
index 00000000000..da93d86c7ce
--- /dev/null
+++ b/mysql-test/t/binlog_stm_binlog.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_statement.inc
+-- source extra/binlog_tests/binlog.test
diff --git a/mysql-test/t/binlog_stm_blackhole.test b/mysql-test/t/binlog_stm_blackhole.test
new file mode 100644
index 00000000000..3c0096fa3f6
--- /dev/null
+++ b/mysql-test/t/binlog_stm_blackhole.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_statement.inc
+-- source extra/binlog_tests/blackhole.test
diff --git a/mysql-test/t/binlog_stm_ctype_cp932.test b/mysql-test/t/binlog_stm_ctype_cp932.test
new file mode 100644
index 00000000000..cef179e0028
--- /dev/null
+++ b/mysql-test/t/binlog_stm_ctype_cp932.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_statement.inc
+-- source extra/binlog_tests/ctype_cp932.test
diff --git a/mysql-test/t/binlog_stm_ctype_ucs.test b/mysql-test/t/binlog_stm_ctype_ucs.test
new file mode 100644
index 00000000000..a32ac3155c7
--- /dev/null
+++ b/mysql-test/t/binlog_stm_ctype_ucs.test
@@ -0,0 +1,6 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_statement.inc
+-- source extra/binlog_tests/ctype_ucs_binlog.test
+
diff --git a/mysql-test/t/binlog_stm_drop_tmp_tbl.test b/mysql-test/t/binlog_stm_drop_tmp_tbl.test
new file mode 100644
index 00000000000..e8acd00c779
--- /dev/null
+++ b/mysql-test/t/binlog_stm_drop_tmp_tbl.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_statement.inc
+-- source extra/binlog_tests/drop_temp_table.test
diff --git a/mysql-test/t/binlog_stm_innodb_stat-master.opt b/mysql-test/t/binlog_stm_innodb_stat-master.opt
new file mode 100644
index 00000000000..4cb927540bf
--- /dev/null
+++ b/mysql-test/t/binlog_stm_innodb_stat-master.opt
@@ -0,0 +1 @@
+--binlog_cache_size=32768
diff --git a/mysql-test/t/binlog_stm_innodb_stat.test b/mysql-test/t/binlog_stm_innodb_stat.test
new file mode 100644
index 00000000000..c6017246e6d
--- /dev/null
+++ b/mysql-test/t/binlog_stm_innodb_stat.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_statement.inc
+-- source extra/binlog_tests/innodb_stat.test
diff --git a/mysql-test/t/binlog_stm_insert_select.test b/mysql-test/t/binlog_stm_insert_select.test
new file mode 100644
index 00000000000..06792990a55
--- /dev/null
+++ b/mysql-test/t/binlog_stm_insert_select.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_statement.inc
+-- source extra/binlog_tests/insert_select-binlog.test
diff --git a/mysql-test/t/binlog_stm_mix_innodb_myisam.test b/mysql-test/t/binlog_stm_mix_innodb_myisam.test
new file mode 100644
index 00000000000..2e096aebe1e
--- /dev/null
+++ b/mysql-test/t/binlog_stm_mix_innodb_myisam.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 9/19/2005 [jbm]
+
+-- source include/have_binlog_format_statement.inc
+-- source extra/binlog_tests/mix_innodb_myisam_binlog.test
diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test
deleted file mode 100644
index 1b5a9beb887..00000000000
--- a/mysql-test/t/blackhole.test
+++ /dev/null
@@ -1,146 +0,0 @@
-#
-# Simple test for blackhole example
-# Taken from the select test
-#
--- source include/have_blackhole.inc
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-CREATE TABLE t1 (
- Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
- Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
-) ENGINE=blackhole;
-
-INSERT INTO t1 VALUES (9410,9412);
-
-select period from t1;
-select * from t1;
-select t1.* from t1;
-
-#
-# Create test table
-#
-
-CREATE TABLE t2 (
- auto int NOT NULL auto_increment,
- fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
- companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
- fld3 char(30) DEFAULT '' NOT NULL,
- fld4 char(35) DEFAULT '' NOT NULL,
- fld5 char(35) DEFAULT '' NOT NULL,
- fld6 char(4) DEFAULT '' NOT NULL,
- primary key (auto)
-) ENGINE=blackhole;
-
-INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
-INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
---enable_query_log
-
-#
-# Search with a key
-#
-
-select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
-select fld3 from t2 where fld3 like "%cultivation" ;
-
-#
-# Search with a key using sorting and limit the same time
-#
-
-select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
-select fld3,companynr from t2 where companynr = 58 order by fld3;
-
-select fld3 from t2 order by fld3 desc limit 10;
-select fld3 from t2 order by fld3 desc limit 5;
-select fld3 from t2 order by fld3 desc limit 5,5;
-
-#
-# Search with a key having a constant with each unique key.
-# The table is read directly with read-next on fld3
-#
-
-select t2.fld3 from t2 where fld3 = 'honeysuckle';
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
-select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
-select t2.fld3 from t2 where fld3 LIKE 'h%le';
-
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
-select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
-
-#
-# Test sorting with a used key (there is no need for sorting)
-#
-
-select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
-select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
-
-
-# Test for fulltext
-DROP TABLE t1;
-CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
-INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
- ('Full-text indexes', 'are called collections'),
- ('Only MyISAM tables','support collections'),
- ('Function MATCH ... AGAINST()','is used to do a search'),
- ('Full-text search in MySQL', 'implements vector space model');
-SHOW INDEX FROM t1;
-
-# nl search
-
-select * from t1 where MATCH(a,b) AGAINST ("collections");
-explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
-select * from t1 where MATCH(a,b) AGAINST ("indexes");
-select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
-select * from t1 where MATCH(a,b) AGAINST ("only");
-
-# Test that every DML (except SELECT) and DDL gets into binlog
-# so that blackhole can be used as "binlog propagator"
-
-reset master;
-drop table t1,t2;
-create table t1 (a int) engine=blackhole;
-delete from t1 where a=10;
-update t1 set a=11 where a=15;
-insert into t1 values(1);
-insert ignore into t1 values(1);
-replace into t1 values(100);
-create table t2 (a varchar(200)) engine=blackhole;
-load data infile '../../std_data/words.dat' into table t2;
-alter table t1 add b int;
-alter table t1 drop b;
-create table t3 like t1;
-insert into t1 select * from t3;
-replace into t1 select * from t3;
-# Just to verify
-select * from t1;
-select * from t2;
-select * from t3;
-
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-show binlog events;
-
-drop table t1,t2,t3;
-
-# End of 4.1 tests
-
-# Test that a transaction which is rolled back does not go into binlog
-# and that a transaction which is committed does
-
-reset master;
-create table t1 (a int) engine=blackhole;
-set autocommit=0;
-start transaction;
-insert into t1 values(1);
-commit;
-start transaction;
-insert into t1 values(2);
-rollback;
-set autocommit=1;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-show binlog events;
diff --git a/mysql-test/t/create_select_tmp.test b/mysql-test/t/create_select_tmp.test
index 1661a115f72..dad83942806 100644
--- a/mysql-test/t/create_select_tmp.test
+++ b/mysql-test/t/create_select_tmp.test
@@ -5,6 +5,9 @@
# binlog if it was a transactional table, it resulted in an
# inconsistency between binlog and the internal list of temp tables.
+# This does not work for RBR yet.
+--source include/have_binlog_format_statement.inc
+
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1, t2;
diff --git a/mysql-test/t/ctype_cp932.test b/mysql-test/t/ctype_cp932.test
deleted file mode 100644
index 082786e38af..00000000000
--- a/mysql-test/t/ctype_cp932.test
+++ /dev/null
@@ -1,436 +0,0 @@
--- source include/have_cp932.inc
-
---character_set cp932
---disable_warnings
-drop table if exists t1;
-drop table if exists t2;
-drop table if exists t3;
-drop table if exists t4;
---enable_warnings
-
-set names cp932;
-set character_set_database = cp932;
-
-CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = cp932;
-
-#Characters which are converted to Unicode ambiguously
-INSERT INTO t1 VALUES
-(0x05),(0x7E),(0x815C),(0x815F),(0x8160),(0x8161),(0x817C),(0x8191),(0x8192),(0x81CA);
-
-#NEC ROW 13 characters (0x8740 - 0x879C)
-INSERT INTO t1 VALUES
-(0x8740),(0x8741),(0x8742),(0x8743),(0x8744),(0x8745),(0x8746),(0x8747),
-(0x8748),(0x8749),(0x874A),(0x874B),(0x874C),(0x874D),(0x874E),(0x874F),
-(0x8750),(0x8751),(0x8752),(0x8753),(0x8754),(0x8755),(0x8756),(0x8757),
-(0x8758),(0x8759),(0x875A),(0x875B),(0x875C),(0x875D),(0x875F),
-(0x8760),(0x8761),(0x8762),(0x8763),(0x8764),(0x8765),(0x8766),(0x8767),
-(0x8768),(0x8769),(0x876A),(0x876B),(0x876C),(0x876D),(0x876E),(0x876F),
-(0x8770),(0x8771),(0x8772),(0x8773),(0x8774),(0x8775),(0x877E),
-(0x8780),(0x8781),(0x8782),(0x8783),(0x8784),(0x8785),(0x8786),(0x8787),
-(0x8788),(0x8789),(0x878A),(0x878B),(0x878C),(0x878D),(0x878E),(0x878F),
-(0x8790),(0x8791),(0x8792),(0x8793),(0x8794),(0x8795),(0x8796),(0x8797),
-(0x8798),(0x8799),(0x879A),(0x879B),(0x879C);
-
-#IBM selected characters kanji & non-kanji, NEC implementation (0xED40 - 0xEEFC)
-INSERT INTO t1 VALUES
-(0xED40),(0xED41),(0xED42),(0xED43),(0xED44),(0xED45),(0xED46),(0xED47),
-(0xED48),(0xED49),(0xED4A),(0xED4B),(0xED4C),(0xED4D),(0xED4E),(0xED4F),
-(0xED50),(0xED51),(0xED52),(0xED53),(0xED54),(0xED55),(0xED56),(0xED57),
-(0xED58),(0xED59),(0xED5A),(0xED5B),(0xED5C),(0xED5D),(0xED5E),(0xED5F),
-(0xED60),(0xED61),(0xED62),(0xED63),(0xED64),(0xED65),(0xED66),(0xED67),
-(0xED68),(0xED69),(0xED6A),(0xED6B),(0xED6C),(0xED6D),(0xED6E),(0xED6F),
-(0xED70),(0xED71),(0xED72),(0xED73),(0xED74),(0xED75),(0xED76),(0xED77),
-(0xED78),(0xED79),(0xED7A),(0xED7B),(0xED7C),(0xED7D),(0xED7E),
-(0xED80),(0xED81),(0xED82),(0xED83),(0xED84),(0xED85),(0xED86),(0xED87),
-(0xED88),(0xED89),(0xED8A),(0xED8B),(0xED8C),(0xED8D),(0xED8E),(0xED8F),
-(0xED90),(0xED91),(0xED92),(0xED93),(0xED94),(0xED95),(0xED96),(0xED97),
-(0xED98),(0xED99),(0xED9A),(0xED9B),(0xED9C),(0xED9D),(0xED9E),(0xED9F),
-(0xEDA0),(0xEDA1),(0xEDA2),(0xEDA3),(0xEDA4),(0xEDA5),(0xEDA6),(0xEDA7),
-(0xEDA8),(0xEDA9),(0xEDAA),(0xEDAB),(0xEDAC),(0xEDAD),(0xEDAE),(0xEDAF),
-(0xEDB0),(0xEDB1),(0xEDB2),(0xEDB3),(0xEDB4),(0xEDB5),(0xEDB6),(0xEDB7),
-(0xEDB8),(0xEDB9),(0xEDBA),(0xEDBB),(0xEDBC),(0xEDBD),(0xEDBE),(0xEDBF),
-(0xEDC0),(0xEDC1),(0xEDC2),(0xEDC3),(0xEDC4),(0xEDC5),(0xEDC6),(0xEDC7),
-(0xEDC8),(0xEDC9),(0xEDCA),(0xEDCB),(0xEDCC),(0xEDCD),(0xEDCE),(0xEDCF),
-(0xEDD0),(0xEDD1),(0xEDD2),(0xEDD3),(0xEDD4),(0xEDD5),(0xEDD6),(0xEDD7),
-(0xEDD8),(0xEDD9),(0xEDDA),(0xEDDB),(0xEDDC),(0xEDDD),(0xEDDE),(0xEDDF),
-(0xEDE0),(0xEDE1),(0xEDE2),(0xEDE3),(0xEDE4),(0xEDE5),(0xEDE6),(0xEDE7),
-(0xEDE8),(0xEDE9),(0xEDEA),(0xEDEB),(0xEDEC),(0xEDED),(0xEDEE),(0xEDEF),
-(0xEDF0),(0xEDF1),(0xEDF2),(0xEDF3),(0xEDF4),(0xEDF5),(0xEDF6),(0xEDF7),
-(0xEDF8),(0xEDF9),(0xEDFA),(0xEDFB),(0xEDFC),
-(0xEE40),(0xEE41),(0xEE42),(0xEE43),(0xEE44),(0xEE45),(0xEE46),(0xEE47),
-(0xEE48),(0xEE49),(0xEE4A),(0xEE4B),(0xEE4C),(0xEE4D),(0xEE4E),(0xEE4F),
-(0xEE50),(0xEE51),(0xEE52),(0xEE53),(0xEE54),(0xEE55),(0xEE56),(0xEE57),
-(0xEE58),(0xEE59),(0xEE5A),(0xEE5B),(0xEE5C),(0xEE5D),(0xEE5E),(0xEE5F),
-(0xEE60),(0xEE61),(0xEE62),(0xEE63),(0xEE64),(0xEE65),(0xEE66),(0xEE67),
-(0xEE68),(0xEE69),(0xEE6A),(0xEE6B),(0xEE6C),(0xEE6D),(0xEE6E),(0xEE6F),
-(0xEE70),(0xEE71),(0xEE72),(0xEE73),(0xEE74),(0xEE75),(0xEE76),(0xEE77),
-(0xEE78),(0xEE79),(0xEE7A),(0xEE7B),(0xEE7C),(0xEE7D),(0xEE7E),
-(0xEE80),(0xEE81),(0xEE82),(0xEE83),(0xEE84),(0xEE85),(0xEE86),(0xEE87),
-(0xEE88),(0xEE89),(0xEE8A),(0xEE8B),(0xEE8C),(0xEE8D),(0xEE8E),(0xEE8F),
-(0xEE90),(0xEE91),(0xEE92),(0xEE93),(0xEE94),(0xEE95),(0xEE96),(0xEE97),
-(0xEE98),(0xEE99),(0xEE9A),(0xEE9B),(0xEE9C),(0xEE9D),(0xEE9E),(0xEE9F),
-(0xEEA0),(0xEEA1),(0xEEA2),(0xEEA3),(0xEEA4),(0xEEA5),(0xEEA6),(0xEEA7),
-(0xEEA8),(0xEEA9),(0xEEAA),(0xEEAB),(0xEEAC),(0xEEAD),(0xEEAE),(0xEEAF),
-(0xEEB0),(0xEEB1),(0xEEB2),(0xEEB3),(0xEEB4),(0xEEB5),(0xEEB6),(0xEEB7),
-(0xEEB8),(0xEEB9),(0xEEBA),(0xEEBB),(0xEEBC),(0xEEBD),(0xEEBE),(0xEEBF),
-(0xEEC0),(0xEEC1),(0xEEC2),(0xEEC3),(0xEEC4),(0xEEC5),(0xEEC6),(0xEEC7),
-(0xEEC8),(0xEEC9),(0xEECA),(0xEECB),(0xEECC),(0xEECD),(0xEECE),(0xEECF),
-(0xEED0),(0xEED1),(0xEED2),(0xEED3),(0xEED4),(0xEED5),(0xEED6),(0xEED7),
-(0xEED8),(0xEED9),(0xEEDA),(0xEEDB),(0xEEDC),(0xEEDD),(0xEEDE),(0xEEDF),
-(0xEEE0),(0xEEE1),(0xEEE2),(0xEEE3),(0xEEE4),(0xEEE5),(0xEEE6),(0xEEE7),
-(0xEEE8),(0xEEE9),(0xEEEA),(0xEEEB),(0xEEEC),(0xEEEF),
-(0xEEF0),(0xEEF1),(0xEEF2),(0xEEF3),(0xEEF4),(0xEEF5),(0xEEF6),(0xEEF7),
-(0xEEF8),(0xEEF9),(0xEEFA),(0xEEFB),(0xEEFC);
-
-#IBM selected kanji & non-kanji (0xFA40 - 0xFC4B)
-INSERT INTO t1 VALUES
-(0xFA40),(0xFA41),(0xFA42),(0xFA43),(0xFA44),(0xFA45),(0xFA46),(0xFA47),
-(0xFA48),(0xFA49),(0xFA4A),(0xFA4B),(0xFA4C),(0xFA4D),(0xFA4E),(0xFA4F),
-(0xFA50),(0xFA51),(0xFA52),(0xFA53),(0xFA54),(0xFA55),(0xFA56),(0xFA57),
-(0xFA58),(0xFA59),(0xFA5A),(0xFA5B),(0xFA5C),(0xFA5D),(0xFA5E),(0xFA5F),
-(0xFA60),(0xFA61),(0xFA62),(0xFA63),(0xFA64),(0xFA65),(0xFA66),(0xFA67),
-(0xFA68),(0xFA69),(0xFA6A),(0xFA6B),(0xFA6C),(0xFA6D),(0xFA6E),(0xFA6F),
-(0xFA70),(0xFA71),(0xFA72),(0xFA73),(0xFA74),(0xFA75),(0xFA76),(0xFA77),
-(0xFA78),(0xFA79),(0xFA7A),(0xFA7B),(0xFA7C),(0xFA7D),(0xFA7E),
-(0xFA80),(0xFA81),(0xFA82),(0xFA83),(0xFA84),(0xFA85),(0xFA86),(0xFA87),
-(0xFA88),(0xFA89),(0xFA8A),(0xFA8B),(0xFA8C),(0xFA8D),(0xFA8E),(0xFA8F),
-(0xFA90),(0xFA91),(0xFA92),(0xFA93),(0xFA94),(0xFA95),(0xFA96),(0xFA97),
-(0xFA98),(0xFA99),(0xFA9A),(0xFA9B),(0xFA9C),(0xFA9D),(0xFA9E),(0xFA9F),
-(0xFAA0),(0xFAA1),(0xFAA2),(0xFAA3),(0xFAA4),(0xFAA5),(0xFAA6),(0xFAA7),
-(0xFAA8),(0xFAA9),(0xFAAA),(0xFAAB),(0xFAAC),(0xFAAD),(0xFAAE),(0xFAAF),
-(0xFAB0),(0xFAB1),(0xFAB2),(0xFAB3),(0xFAB4),(0xFAB5),(0xFAB6),(0xFAB7),
-(0xFAB8),(0xFAB9),(0xFABA),(0xFABB),(0xFABC),(0xFABD),(0xFABE),(0xFABF),
-(0xFAC0),(0xFAC1),(0xFAC2),(0xFAC3),(0xFAC4),(0xFAC5),(0xFAC6),(0xFAC7),
-(0xFAC8),(0xFAC9),(0xFACA),(0xFACB),(0xFACC),(0xFACD),(0xFACE),(0xFACF),
-(0xFAD0),(0xFAD1),(0xFAD2),(0xFAD3),(0xFAD4),(0xFAD5),(0xFAD6),(0xFAD7),
-(0xFAD8),(0xFAD9),(0xFADA),(0xFADB),(0xFADC),(0xFADD),(0xFADE),(0xFADF),
-(0xFAE0),(0xFAE1),(0xFAE2),(0xFAE3),(0xFAE4),(0xFAE5),(0xFAE6),(0xFAE7),
-(0xFAE8),(0xFAE9),(0xFAEA),(0xFAEB),(0xFAEC),(0xFAED),(0xFAEE),(0xFAEF),
-(0xFAF0),(0xFAF1),(0xFAF2),(0xFAF3),(0xFAF4),(0xFAF5),(0xFAF6),(0xFAF7),
-(0xFAF8),(0xFAF9),(0xFAFA),(0xFAFB),(0xFAFC),
-(0xFB40),(0xFB41),(0xFB42),(0xFB43),(0xFB44),(0xFB45),(0xFB46),(0xFB47),
-(0xFB48),(0xFB49),(0xFB4A),(0xFB4B),(0xFB4C),(0xFB4D),(0xFB4E),(0xFB4F),
-(0xFB50),(0xFB51),(0xFB52),(0xFB53),(0xFB54),(0xFB55),(0xFB56),(0xFB57),
-(0xFB58),(0xFB59),(0xFB5A),(0xFB5B),(0xFB5C),(0xFB5D),(0xFB5E),(0xFB5F),
-(0xFB60),(0xFB61),(0xFB62),(0xFB63),(0xFB64),(0xFB65),(0xFB66),(0xFB67),
-(0xFB68),(0xFB69),(0xFB6A),(0xFB6B),(0xFB6C),(0xFB6D),(0xFB6E),(0xFB6F),
-(0xFB70),(0xFB71),(0xFB72),(0xFB73),(0xFB74),(0xFB75),(0xFB76),(0xFB77),
-(0xFB78),(0xFB79),(0xFB7A),(0xFB7B),(0xFB7C),(0xFB7D),(0xFB7E),
-(0xFB80),(0xFB81),(0xFB82),(0xFB83),(0xFB84),(0xFB85),(0xFB86),(0xFB87),
-(0xFB88),(0xFB89),(0xFB8A),(0xFB8B),(0xFB8C),(0xFB8D),(0xFB8E),(0xFB8F),
-(0xFB90),(0xFB91),(0xFB92),(0xFB93),(0xFB94),(0xFB95),(0xFB96),(0xFB97),
-(0xFB98),(0xFB99),(0xFB9A),(0xFB9B),(0xFB9C),(0xFB9D),(0xFB9E),(0xFB9F),
-(0xFBA0),(0xFBA1),(0xFBA2),(0xFBA3),(0xFBA4),(0xFBA5),(0xFBA6),(0xFBA7),
-(0xFBA8),(0xFBA9),(0xFBAA),(0xFBAB),(0xFBAC),(0xFBAD),(0xFBAE),(0xFBAF),
-(0xFBB0),(0xFBB1),(0xFBB2),(0xFBB3),(0xFBB4),(0xFBB5),(0xFBB6),(0xFBB7),
-(0xFBB8),(0xFBB9),(0xFBBA),(0xFBBB),(0xFBBC),(0xFBBD),(0xFBBE),(0xFBBF),
-(0xFBC0),(0xFBC1),(0xFBC2),(0xFBC3),(0xFBC4),(0xFBC5),(0xFBC6),(0xFBC7),
-(0xFBC8),(0xFBC9),(0xFBCA),(0xFBCB),(0xFBCC),(0xFBCD),(0xFBCE),(0xFBCF),
-(0xFBD0),(0xFBD1),(0xFBD2),(0xFBD3),(0xFBD4),(0xFBD5),(0xFBD6),(0xFBD7),
-(0xFBD8),(0xFBD9),(0xFBDA),(0xFBDB),(0xFBDC),(0xFBDD),(0xFBDE),(0xFBDF),
-(0xFBE0),(0xFBE1),(0xFBE2),(0xFBE3),(0xFBE4),(0xFBE5),(0xFBE6),(0xFBE7),
-(0xFBE8),(0xFBE9),(0xFBEA),(0xFBEB),(0xFBEC),(0xFBED),(0xFBEE),(0xFBEF),
-(0xFBF0),(0xFBF1),(0xFBF2),(0xFBF3),(0xFBF4),(0xFBF5),(0xFBF6),(0xFBF7),
-(0xFBF8),(0xFBF9),(0xFBFA),(0xFBFB),(0xFBFC),
-(0xFC40),(0xFC41),(0xFC42),(0xFC43),(0xFC44),(0xFC45),(0xFC46),(0xFC47),
-(0xFC48),(0xFC49),(0xFC4A),(0xFC4B);
-
-#User defined characters (0xF040-0xF9FC)
-INSERT INTO t1 VALUES
-(0xF040),(0xF041),(0xF042),(0xF043),(0xF044),(0xF045),(0xF046),(0xF047),
-(0xF048),(0xF049),(0xF04A),(0xF04B),(0xF04C),(0xF04D),(0xF04E),(0xF04F),
-(0xF050),(0xF051),(0xF052),(0xF053),(0xF054),(0xF055),(0xF056),(0xF057),
-(0xF058),(0xF059),(0xF05A),(0xF05B),(0xF05C),(0xF05D),(0xF05E),(0xF05F),
-(0xF060),(0xF061),(0xF062),(0xF063),(0xF064),(0xF065),(0xF066),(0xF067),
-(0xF068),(0xF069),(0xF06A),(0xF06B),(0xF06C),(0xF06D),(0xF06E),(0xF06F),
-(0xF070),(0xF071),(0xF072),(0xF073),(0xF074),(0xF075),(0xF076),(0xF077),
-(0xF078),(0xF079),(0xF07A),(0xF07B),(0xF07C),(0xF07D),(0xF07E),
-(0xF080),(0xF081),(0xF082),(0xF083),(0xF084),(0xF085),(0xF086),(0xF087),
-(0xF088),(0xF089),(0xF08A),(0xF08B),(0xF08C),(0xF08D),(0xF08E),(0xF08F),
-(0xF090),(0xF091),(0xF092),(0xF093),(0xF094),(0xF095),(0xF096),(0xF097),
-(0xF098),(0xF099),(0xF09A),(0xF09B),(0xF09C),(0xF09D),(0xF09E),(0xF09F),
-(0xF0A0),(0xF0A1),(0xF0A2),(0xF0A3),(0xF0A4),(0xF0A5),(0xF0A6),(0xF0A7),
-(0xF0A8),(0xF0A9),(0xF0AA),(0xF0AB),(0xF0AC),(0xF0AD),(0xF0AE),(0xF0AF),
-(0xF0B0),(0xF0B1),(0xF0B2),(0xF0B3),(0xF0B4),(0xF0B5),(0xF0B6),(0xF0B7),
-(0xF0B8),(0xF0B9),(0xF0BA),(0xF0BB),(0xF0BC),(0xF0BD),(0xF0BE),(0xF0BF),
-(0xF0C0),(0xF0C1),(0xF0C2),(0xF0C3),(0xF0C4),(0xF0C5),(0xF0C6),(0xF0C7),
-(0xF0C8),(0xF0C9),(0xF0CA),(0xF0CB),(0xF0CC),(0xF0CD),(0xF0CE),(0xF0CF),
-(0xF0D0),(0xF0D1),(0xF0D2),(0xF0D3),(0xF0D4),(0xF0D5),(0xF0D6),(0xF0D7),
-(0xF0D8),(0xF0D9),(0xF0DA),(0xF0DB),(0xF0DC),(0xF0DD),(0xF0DE),(0xF0DF),
-(0xF0E0),(0xF0E1),(0xF0E2),(0xF0E3),(0xF0E4),(0xF0E5),(0xF0E6),(0xF0E7),
-(0xF0E8),(0xF0E9),(0xF0EA),(0xF0EB),(0xF0EC),(0xF0ED),(0xF0EE),(0xF0EF),
-(0xF0F0),(0xF0F1),(0xF0F2),(0xF0F3),(0xF0F4),(0xF0F5),(0xF0F6),(0xF0F7),
-(0xF0F8),(0xF0F9),(0xF0FA),(0xF0FB),(0xF0FC),
-(0xF140),(0xF141),(0xF142),(0xF143),(0xF144),(0xF145),(0xF146),(0xF147),
-(0xF148),(0xF149),(0xF14A),(0xF14B),(0xF14C),(0xF14D),(0xF14E),(0xF14F),
-(0xF150),(0xF151),(0xF152),(0xF153),(0xF154),(0xF155),(0xF156),(0xF157),
-(0xF158),(0xF159),(0xF15A),(0xF15B),(0xF15C),(0xF15D),(0xF15E),(0xF15F),
-(0xF160),(0xF161),(0xF162),(0xF163),(0xF164),(0xF165),(0xF166),(0xF167),
-(0xF168),(0xF169),(0xF16A),(0xF16B),(0xF16C),(0xF16D),(0xF16E),(0xF16F),
-(0xF170),(0xF171),(0xF172),(0xF173),(0xF174),(0xF175),(0xF176),(0xF177),
-(0xF178),(0xF179),(0xF17A),(0xF17B),(0xF17C),(0xF17D),(0xF17E),
-(0xF180),(0xF181),(0xF182),(0xF183),(0xF184),(0xF185),(0xF186),(0xF187),
-(0xF188),(0xF189),(0xF18A),(0xF18B),(0xF18C),(0xF18D),(0xF18E),(0xF18F),
-(0xF190),(0xF191),(0xF192),(0xF193),(0xF194),(0xF195),(0xF196),(0xF197),
-(0xF198),(0xF199),(0xF19A),(0xF19B),(0xF19C),(0xF19D),(0xF19E),(0xF19F),
-(0xF1A0),(0xF1A1),(0xF1A2),(0xF1A3),(0xF1A4),(0xF1A5),(0xF1A6),(0xF1A7),
-(0xF1A8),(0xF1A9),(0xF1AA),(0xF1AB),(0xF1AC),(0xF1AD),(0xF1AE),(0xF1AF),
-(0xF1B0),(0xF1B1),(0xF1B2),(0xF1B3),(0xF1B4),(0xF1B5),(0xF1B6),(0xF1B7),
-(0xF1B8),(0xF1B9),(0xF1BA),(0xF1BB),(0xF1BC),(0xF1BD),(0xF1BE),(0xF1BF),
-(0xF1C0),(0xF1C1),(0xF1C2),(0xF1C3),(0xF1C4),(0xF1C5),(0xF1C6),(0xF1C7),
-(0xF1C8),(0xF1C9),(0xF1CA),(0xF1CB),(0xF1CC),(0xF1CD),(0xF1CE),(0xF1CF),
-(0xF1D0),(0xF1D1),(0xF1D2),(0xF1D3),(0xF1D4),(0xF1D5),(0xF1D6),(0xF1D7),
-(0xF1D8),(0xF1D9),(0xF1DA),(0xF1DB),(0xF1DC),(0xF1DD),(0xF1DE),(0xF1DF),
-(0xF1E0),(0xF1E1),(0xF1E2),(0xF1E3),(0xF1E4),(0xF1E5),(0xF1E6),(0xF1E7),
-(0xF1E8),(0xF1E9),(0xF1EA),(0xF1EB),(0xF1EC),(0xF1ED),(0xF1EE),(0xF1EF),
-(0xF1F0),(0xF1F1),(0xF1F2),(0xF1F3),(0xF1F4),(0xF1F5),(0xF1F6),(0xF1F7),
-(0xF1F8),(0xF1F9),(0xF1FA),(0xF1FB),(0xF1FC),
-(0xF240),(0xF241),(0xF242),(0xF243),(0xF244),(0xF245),(0xF246),(0xF247),
-(0xF248),(0xF249),(0xF24A),(0xF24B),(0xF24C),(0xF24D),(0xF24E),(0xF24F),
-(0xF250),(0xF251),(0xF252),(0xF253),(0xF254),(0xF255),(0xF256),(0xF257),
-(0xF258),(0xF259),(0xF25A),(0xF25B),(0xF25C),(0xF25D),(0xF25E),(0xF25F),
-(0xF260),(0xF261),(0xF262),(0xF263),(0xF264),(0xF265),(0xF266),(0xF267),
-(0xF268),(0xF269),(0xF26A),(0xF26B),(0xF26C),(0xF26D),(0xF26E),(0xF26F),
-(0xF270),(0xF271),(0xF272),(0xF273),(0xF274),(0xF275),(0xF276),(0xF277),
-(0xF278),(0xF279),(0xF27A),(0xF27B),(0xF27C),(0xF27D),(0xF27E),
-(0xF280),(0xF281),(0xF282),(0xF283),(0xF284),(0xF285),(0xF286),(0xF287),
-(0xF288),(0xF289),(0xF28A),(0xF28B),(0xF28C),(0xF28D),(0xF28E),(0xF28F),
-(0xF290),(0xF291),(0xF292),(0xF293),(0xF294),(0xF295),(0xF296),(0xF297),
-(0xF298),(0xF299),(0xF29A),(0xF29B),(0xF29C),(0xF29D),(0xF29E),(0xF29F),
-(0xF2A0),(0xF2A1),(0xF2A2),(0xF2A3),(0xF2A4),(0xF2A5),(0xF2A6),(0xF2A7),
-(0xF2A8),(0xF2A9),(0xF2AA),(0xF2AB),(0xF2AC),(0xF2AD),(0xF2AE),(0xF2AF),
-(0xF2B0),(0xF2B1),(0xF2B2),(0xF2B3),(0xF2B4),(0xF2B5),(0xF2B6),(0xF2B7),
-(0xF2B8),(0xF2B9),(0xF2BA),(0xF2BB),(0xF2BC),(0xF2BD),(0xF2BE),(0xF2BF),
-(0xF2C0),(0xF2C1),(0xF2C2),(0xF2C3),(0xF2C4),(0xF2C5),(0xF2C6),(0xF2C7),
-(0xF2C8),(0xF2C9),(0xF2CA),(0xF2CB),(0xF2CC),(0xF2CD),(0xF2CE),(0xF2CF),
-(0xF2D0),(0xF2D1),(0xF2D2),(0xF2D3),(0xF2D4),(0xF2D5),(0xF2D6),(0xF2D7),
-(0xF2D8),(0xF2D9),(0xF2DA),(0xF2DB),(0xF2DC),(0xF2DD),(0xF2DE),(0xF2DF),
-(0xF2E0),(0xF2E1),(0xF2E2),(0xF2E3),(0xF2E4),(0xF2E5),(0xF2E6),(0xF2E7),
-(0xF2E8),(0xF2E9),(0xF2EA),(0xF2EB),(0xF2EC),(0xF2ED),(0xF2EE),(0xF2EF),
-(0xF2F0),(0xF2F1),(0xF2F2),(0xF2F3),(0xF2F4),(0xF2F5),(0xF2F6),(0xF2F7),
-(0xF2F8),(0xF2F9),(0xF2FA),(0xF2FB),(0xF2FC),
-(0xF340),(0xF341),(0xF342),(0xF343),(0xF344),(0xF345),(0xF346),(0xF347),
-(0xF348),(0xF349),(0xF34A),(0xF34B),(0xF34C),(0xF34D),(0xF34E),(0xF34F),
-(0xF350),(0xF351),(0xF352),(0xF353),(0xF354),(0xF355),(0xF356),(0xF357),
-(0xF358),(0xF359),(0xF35A),(0xF35B),(0xF35C),(0xF35D),(0xF35E),(0xF35F),
-(0xF360),(0xF361),(0xF362),(0xF363),(0xF364),(0xF365),(0xF366),(0xF367),
-(0xF368),(0xF369),(0xF36A),(0xF36B),(0xF36C),(0xF36D),(0xF36E),(0xF36F),
-(0xF370),(0xF371),(0xF372),(0xF373),(0xF374),(0xF375),(0xF376),(0xF377),
-(0xF378),(0xF379),(0xF37A),(0xF37B),(0xF37C),(0xF37D),(0xF37E),
-(0xF380),(0xF381),(0xF382),(0xF383),(0xF384),(0xF385),(0xF386),(0xF387),
-(0xF388),(0xF389),(0xF38A),(0xF38B),(0xF38C),(0xF38D),(0xF38E),(0xF38F),
-(0xF390),(0xF391),(0xF392),(0xF393),(0xF394),(0xF395),(0xF396),(0xF397),
-(0xF398),(0xF399),(0xF39A),(0xF39B),(0xF39C),(0xF39D),(0xF39E),(0xF39F),
-(0xF3A0),(0xF3A1),(0xF3A2),(0xF3A3),(0xF3A4),(0xF3A5),(0xF3A6),(0xF3A7),
-(0xF3A8),(0xF3A9),(0xF3AA),(0xF3AB),(0xF3AC),(0xF3AD),(0xF3AE),(0xF3AF),
-(0xF3B0),(0xF3B1),(0xF3B2),(0xF3B3),(0xF3B4),(0xF3B5),(0xF3B6),(0xF3B7),
-(0xF3B8),(0xF3B9),(0xF3BA),(0xF3BB),(0xF3BC),(0xF3BD),(0xF3BE),(0xF3BF),
-(0xF3C0),(0xF3C1),(0xF3C2),(0xF3C3),(0xF3C4),(0xF3C5),(0xF3C6),(0xF3C7),
-(0xF3C8),(0xF3C9),(0xF3CA),(0xF3CB),(0xF3CC),(0xF3CD),(0xF3CE),(0xF3CF),
-(0xF3D0),(0xF3D1),(0xF3D2),(0xF3D3),(0xF3D4),(0xF3D5),(0xF3D6),(0xF3D7),
-(0xF3D8),(0xF3D9),(0xF3DA),(0xF3DB),(0xF3DC),(0xF3DD),(0xF3DE),(0xF3DF),
-(0xF3E0),(0xF3E1),(0xF3E2),(0xF3E3),(0xF3E4),(0xF3E5),(0xF3E6),(0xF3E7),
-(0xF3E8),(0xF3E9),(0xF3EA),(0xF3EB),(0xF3EC),(0xF3ED),(0xF3EE),(0xF3EF),
-(0xF3F0),(0xF3F1),(0xF3F2),(0xF3F3),(0xF3F4),(0xF3F5),(0xF3F6),(0xF3F7),
-(0xF3F8),(0xF3F9),(0xF3FA),(0xF3FB),(0xF3FC),
-(0xF440),(0xF441),(0xF442),(0xF443),(0xF444),(0xF445),(0xF446),(0xF447),
-(0xF448),(0xF449),(0xF44A),(0xF44B),(0xF44C),(0xF44D),(0xF44E),(0xF44F),
-(0xF450),(0xF451),(0xF452),(0xF453),(0xF454),(0xF455),(0xF456),(0xF457),
-(0xF458),(0xF459),(0xF45A),(0xF45B),(0xF45C),(0xF45D),(0xF45E),(0xF45F),
-(0xF460),(0xF461),(0xF462),(0xF463),(0xF464),(0xF465),(0xF466),(0xF467),
-(0xF468),(0xF469),(0xF46A),(0xF46B),(0xF46C),(0xF46D),(0xF46E),(0xF46F),
-(0xF470),(0xF471),(0xF472),(0xF473),(0xF474),(0xF475),(0xF476),(0xF477),
-(0xF478),(0xF479),(0xF47A),(0xF47B),(0xF47C),(0xF47D),(0xF47E),
-(0xF480),(0xF481),(0xF482),(0xF483),(0xF484),(0xF485),(0xF486),(0xF487),
-(0xF488),(0xF489),(0xF48A),(0xF48B),(0xF48C),(0xF48D),(0xF48E),(0xF48F),
-(0xF490),(0xF491),(0xF492),(0xF493),(0xF494),(0xF495),(0xF496),(0xF497),
-(0xF498),(0xF499),(0xF49A),(0xF49B),(0xF49C),(0xF49D),(0xF49E),(0xF49F),
-(0xF4A0),(0xF4A1),(0xF4A2),(0xF4A3),(0xF4A4),(0xF4A5),(0xF4A6),(0xF4A7),
-(0xF4A8),(0xF4A9),(0xF4AA),(0xF4AB),(0xF4AC),(0xF4AD),(0xF4AE),(0xF4AF),
-(0xF4B0),(0xF4B1),(0xF4B2),(0xF4B3),(0xF4B4),(0xF4B5),(0xF4B6),(0xF4B7),
-(0xF4B8),(0xF4B9),(0xF4BA),(0xF4BB),(0xF4BC),(0xF4BD),(0xF4BE),(0xF4BF),
-(0xF4C0),(0xF4C1),(0xF4C2),(0xF4C3),(0xF4C4),(0xF4C5),(0xF4C6),(0xF4C7),
-(0xF4C8),(0xF4C9),(0xF4CA),(0xF4CB),(0xF4CC),(0xF4CD),(0xF4CE),(0xF4CF),
-(0xF4D0),(0xF4D1),(0xF4D2),(0xF4D3),(0xF4D4),(0xF4D5),(0xF4D6),(0xF4D7),
-(0xF4D8),(0xF4D9),(0xF4DA),(0xF4DB),(0xF4DC),(0xF4DD),(0xF4DE),(0xF4DF),
-(0xF4E0),(0xF4E1),(0xF4E2),(0xF4E3),(0xF4E4),(0xF4E5),(0xF4E6),(0xF4E7),
-(0xF4E8),(0xF4E9),(0xF4EA),(0xF4EB),(0xF4EC),(0xF4ED),(0xF4EE),(0xF4EF),
-(0xF4F0),(0xF4F1),(0xF4F2),(0xF4F3),(0xF4F4),(0xF4F5),(0xF4F6),(0xF4F7),
-(0xF4F8),(0xF4F9),(0xF4FA),(0xF4FB),(0xF4FC),
-(0xF540),(0xF541),(0xF542),(0xF543),(0xF544),(0xF545),(0xF546),(0xF547),
-(0xF548),(0xF549),(0xF54A),(0xF54B),(0xF54C),(0xF54D),(0xF54E),(0xF54F),
-(0xF550),(0xF551),(0xF552),(0xF553),(0xF554),(0xF555),(0xF556),(0xF557),
-(0xF558),(0xF559),(0xF55A),(0xF55B),(0xF55C),(0xF55D),(0xF55E),(0xF55F),
-(0xF560),(0xF561),(0xF562),(0xF563),(0xF564),(0xF565),(0xF566),(0xF567),
-(0xF568),(0xF569),(0xF56A),(0xF56B),(0xF56C),(0xF56D),(0xF56E),(0xF56F),
-(0xF570),(0xF571),(0xF572),(0xF573),(0xF574),(0xF575),(0xF576),(0xF577),
-(0xF578),(0xF579),(0xF57A),(0xF57B),(0xF57C),(0xF57D),(0xF57E),
-(0xF580),(0xF581),(0xF582),(0xF583),(0xF584),(0xF585),(0xF586),(0xF587),
-(0xF588),(0xF589),(0xF58A),(0xF58B),(0xF58C),(0xF58D),(0xF58E),(0xF58F),
-(0xF590),(0xF591),(0xF592),(0xF593),(0xF594),(0xF595),(0xF596),(0xF597),
-(0xF598),(0xF599),(0xF59A),(0xF59B),(0xF59C),(0xF59D),(0xF59E),(0xF59F),
-(0xF5A0),(0xF5A1),(0xF5A2),(0xF5A3),(0xF5A4),(0xF5A5),(0xF5A6),(0xF5A7),
-(0xF5A8),(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE),(0xF5AF),
-(0xF5B0),(0xF5B1),(0xF5B2),(0xF5B3),(0xF5B4),(0xF5B5),(0xF5B6),(0xF5B7),
-(0xF5B8),(0xF5B9),(0xF5BA),(0xF5BB),(0xF5BC),(0xF5BD),(0xF5BE),(0xF5BF),
-(0xF5C0),(0xF5C1),(0xF5C2),(0xF5C3),(0xF5C4),(0xF5C5),(0xF5C6),(0xF5C7),
-(0xF5C8),(0xF5C9),(0xF5CA),(0xF5CB),(0xF5CC),(0xF5CD),(0xF5CE),(0xF5CF),
-(0xF5D0),(0xF5D1),(0xF5D2),(0xF5D3),(0xF5D4),(0xF5D5),(0xF5D6),(0xF5D7),
-(0xF5D8),(0xF5D9),(0xF5DA),(0xF5DB),(0xF5DC),(0xF5DD),(0xF5DE),(0xF5DF),
-(0xF5E0),(0xF5E1),(0xF5E2),(0xF5E3),(0xF5E4),(0xF5E5),(0xF5E6),(0xF5E7),
-(0xF5E8),(0xF5E9),(0xF5EA),(0xF5EB),(0xF5EC),(0xF5ED),(0xF5EE),(0xF5EF),
-(0xF5F0),(0xF5F1),(0xF5F2),(0xF5F3),(0xF5F4),(0xF5F5),(0xF5F6),(0xF5F7),
-(0xF5F8),(0xF5F9),(0xF5FA),(0xF5FB),(0xF5FC),
-(0xF640),(0xF641),(0xF642),(0xF643),(0xF644),(0xF645),(0xF646),(0xF647),
-(0xF648),(0xF649),(0xF64A),(0xF64B),(0xF64C),(0xF64D),(0xF64E),(0xF64F),
-(0xF650),(0xF651),(0xF652),(0xF653),(0xF654),(0xF655),(0xF656),(0xF657),
-(0xF658),(0xF659),(0xF65A),(0xF65B),(0xF65C),(0xF65D),(0xF65E),(0xF65F),
-(0xF660),(0xF661),(0xF662),(0xF663),(0xF664),(0xF665),(0xF666),(0xF667),
-(0xF668),(0xF669),(0xF66A),(0xF66B),(0xF66C),(0xF66D),(0xF66E),(0xF66F),
-(0xF670),(0xF671),(0xF672),(0xF673),(0xF674),(0xF675),(0xF676),(0xF677),
-(0xF678),(0xF679),(0xF67A),(0xF67B),(0xF67C),(0xF67D),(0xF67E),
-(0xF680),(0xF681),(0xF682),(0xF683),(0xF684),(0xF685),(0xF686),(0xF687),
-(0xF688),(0xF689),(0xF68A),(0xF68B),(0xF68C),(0xF68D),(0xF68E),(0xF68F),
-(0xF690),(0xF691),(0xF692),(0xF693),(0xF694),(0xF695),(0xF696),(0xF697),
-(0xF698),(0xF699),(0xF69A),(0xF69B),(0xF69C),(0xF69D),(0xF69E),(0xF69F),
-(0xF6A0),(0xF6A1),(0xF6A2),(0xF6A3),(0xF6A4),(0xF6A5),(0xF6A6),(0xF6A7),
-(0xF6A8),(0xF6A9),(0xF6AA),(0xF6AB),(0xF6AC),(0xF6AD),(0xF6AE),(0xF6AF),
-(0xF6B0),(0xF6B1),(0xF6B2),(0xF6B3),(0xF6B4),(0xF6B5),(0xF6B6),(0xF6B7),
-(0xF6B8),(0xF6B9),(0xF6BA),(0xF6BB),(0xF6BC),(0xF6BD),(0xF6BE),(0xF6BF),
-(0xF6C0),(0xF6C1),(0xF6C2),(0xF6C3),(0xF6C4),(0xF6C5),(0xF6C6),(0xF6C7),
-(0xF6C8),(0xF6C9),(0xF6CA),(0xF6CB),(0xF6CC),(0xF6CD),(0xF6CE),(0xF6CF),
-(0xF6D0),(0xF6D1),(0xF6D2),(0xF6D3),(0xF6D4),(0xF6D5),(0xF6D6),(0xF6D7),
-(0xF6D8),(0xF6D9),(0xF6DA),(0xF6DB),(0xF6DC),(0xF6DD),(0xF6DE),(0xF6DF),
-(0xF6E0),(0xF6E1),(0xF6E2),(0xF6E3),(0xF6E4),(0xF6E5),(0xF6E6),(0xF6E7),
-(0xF6E8),(0xF6E9),(0xF6EA),(0xF6EB),(0xF6EC),(0xF6ED),(0xF6EE),(0xF6EF),
-(0xF6F0),(0xF6F1),(0xF6F2),(0xF6F3),(0xF6F4),(0xF6F5),(0xF6F6),(0xF6F7),
-(0xF6F8),(0xF6F9),(0xF6FA),(0xF6FB),(0xF6FC),
-(0xF740),(0xF741),(0xF742),(0xF743),(0xF744),(0xF745),(0xF746),(0xF747),
-(0xF748),(0xF749),(0xF74A),(0xF74B),(0xF74C),(0xF74D),(0xF74E),(0xF74F),
-(0xF750),(0xF751),(0xF752),(0xF753),(0xF754),(0xF755),(0xF756),(0xF757),
-(0xF758),(0xF759),(0xF75A),(0xF75B),(0xF75C),(0xF75D),(0xF75E),(0xF75F),
-(0xF760),(0xF761),(0xF762),(0xF763),(0xF764),(0xF765),(0xF766),(0xF767),
-(0xF768),(0xF769),(0xF76A),(0xF76B),(0xF76C),(0xF76D),(0xF76E),(0xF76F),
-(0xF770),(0xF771),(0xF772),(0xF773),(0xF774),(0xF775),(0xF776),(0xF777),
-(0xF778),(0xF779),(0xF77A),(0xF77B),(0xF77C),(0xF77D),(0xF77E),
-(0xF780),(0xF781),(0xF782),(0xF783),(0xF784),(0xF785),(0xF786),(0xF787),
-(0xF788),(0xF789),(0xF78A),(0xF78B),(0xF78C),(0xF78D),(0xF78E),(0xF78F),
-(0xF790),(0xF791),(0xF792),(0xF793),(0xF794),(0xF795),(0xF796),(0xF797),
-(0xF798),(0xF799),(0xF79A),(0xF79B),(0xF79C),(0xF79D),(0xF79E),(0xF79F),
-(0xF7A0),(0xF7A1),(0xF7A2),(0xF7A3),(0xF7A4),(0xF7A5),(0xF7A6),(0xF7A7),
-(0xF7A8),(0xF7A9),(0xF7AA),(0xF7AB),(0xF7AC),(0xF7AD),(0xF7AE),(0xF7AF),
-(0xF7B0),(0xF7B1),(0xF7B2),(0xF7B3),(0xF7B4),(0xF7B5),(0xF7B6),(0xF7B7),
-(0xF7B8),(0xF7B9),(0xF7BA),(0xF7BB),(0xF7BC),(0xF7BD),(0xF7BE),(0xF7BF),
-(0xF7C0),(0xF7C1),(0xF7C2),(0xF7C3),(0xF7C4),(0xF7C5),(0xF7C6),(0xF7C7),
-(0xF7C8),(0xF7C9),(0xF7CA),(0xF7CB),(0xF7CC),(0xF7CD),(0xF7CE),(0xF7CF),
-(0xF7D0),(0xF7D1),(0xF7D2),(0xF7D3),(0xF7D4),(0xF7D5),(0xF7D6),(0xF7D7),
-(0xF7D8),(0xF7D9),(0xF7DA),(0xF7DB),(0xF7DC),(0xF7DD),(0xF7DE),(0xF7DF),
-(0xF7E0),(0xF7E1),(0xF7E2),(0xF7E3),(0xF7E4),(0xF7E5),(0xF7E6),(0xF7E7),
-(0xF7E8),(0xF7E9),(0xF7EA),(0xF7EB),(0xF7EC),(0xF7ED),(0xF7EE),(0xF7EF),
-(0xF7F0),(0xF7F1),(0xF7F2),(0xF7F3),(0xF7F4),(0xF7F5),(0xF7F6),(0xF7F7),
-(0xF7F8),(0xF7F9),(0xF7FA),(0xF7FB),(0xF7FC),
-(0xF840),(0xF841),(0xF842),(0xF843),(0xF844),(0xF845),(0xF846),(0xF847),
-(0xF848),(0xF849),(0xF84A),(0xF84B),(0xF84C),(0xF84D),(0xF84E),(0xF84F),
-(0xF850),(0xF851),(0xF852),(0xF853),(0xF854),(0xF855),(0xF856),(0xF857),
-(0xF858),(0xF859),(0xF85A),(0xF85B),(0xF85C),(0xF85D),(0xF85E),(0xF85F),
-(0xF860),(0xF861),(0xF862),(0xF863),(0xF864),(0xF865),(0xF866),(0xF867),
-(0xF868),(0xF869),(0xF86A),(0xF86B),(0xF86C),(0xF86D),(0xF86E),(0xF86F),
-(0xF870),(0xF871),(0xF872),(0xF873),(0xF874),(0xF875),(0xF876),(0xF877),
-(0xF878),(0xF879),(0xF87A),(0xF87B),(0xF87C),(0xF87D),(0xF87E),
-(0xF880),(0xF881),(0xF882),(0xF883),(0xF884),(0xF885),(0xF886),(0xF887),
-(0xF888),(0xF889),(0xF88A),(0xF88B),(0xF88C),(0xF88D),(0xF88E),(0xF88F),
-(0xF890),(0xF891),(0xF892),(0xF893),(0xF894),(0xF895),(0xF896),(0xF897),
-(0xF898),(0xF899),(0xF89A),(0xF89B),(0xF89C),(0xF89D),(0xF89E),(0xF89F),
-(0xF8A0),(0xF8A1),(0xF8A2),(0xF8A3),(0xF8A4),(0xF8A5),(0xF8A6),(0xF8A7),
-(0xF8A8),(0xF8A9),(0xF8AA),(0xF8AB),(0xF8AC),(0xF8AD),(0xF8AE),(0xF8AF),
-(0xF8B0),(0xF8B1),(0xF8B2),(0xF8B3),(0xF8B4),(0xF8B5),(0xF8B6),(0xF8B7),
-(0xF8B8),(0xF8B9),(0xF8BA),(0xF8BB),(0xF8BC),(0xF8BD),(0xF8BE),(0xF8BF),
-(0xF8C0),(0xF8C1),(0xF8C2),(0xF8C3),(0xF8C4),(0xF8C5),(0xF8C6),(0xF8C7),
-(0xF8C8),(0xF8C9),(0xF8CA),(0xF8CB),(0xF8CC),(0xF8CD),(0xF8CE),(0xF8CF),
-(0xF8D0),(0xF8D1),(0xF8D2),(0xF8D3),(0xF8D4),(0xF8D5),(0xF8D6),(0xF8D7),
-(0xF8D8),(0xF8D9),(0xF8DA),(0xF8DB),(0xF8DC),(0xF8DD),(0xF8DE),(0xF8DF),
-(0xF8E0),(0xF8E1),(0xF8E2),(0xF8E3),(0xF8E4),(0xF8E5),(0xF8E6),(0xF8E7),
-(0xF8E8),(0xF8E9),(0xF8EA),(0xF8EB),(0xF8EC),(0xF8ED),(0xF8EE),(0xF8EF),
-(0xF8F0),(0xF8F1),(0xF8F2),(0xF8F3),(0xF8F4),(0xF8F5),(0xF8F6),(0xF8F7),
-(0xF8F8),(0xF8F9),(0xF8FA),(0xF8FB),(0xF8FC),
-(0xF940),(0xF941),(0xF942),(0xF943),(0xF944),(0xF945),(0xF946),(0xF947),
-(0xF948),(0xF949),(0xF94A),(0xF94B),(0xF94C),(0xF94D),(0xF94E),(0xF94F),
-(0xF950),(0xF951),(0xF952),(0xF953),(0xF954),(0xF955),(0xF956),(0xF957),
-(0xF958),(0xF959),(0xF95A),(0xF95B),(0xF95C),(0xF95D),(0xF95E),(0xF95F),
-(0xF960),(0xF961),(0xF962),(0xF963),(0xF964),(0xF965),(0xF966),(0xF967),
-(0xF968),(0xF969),(0xF96A),(0xF96B),(0xF96C),(0xF96D),(0xF96E),(0xF96F),
-(0xF970),(0xF971),(0xF972),(0xF973),(0xF974),(0xF975),(0xF976),(0xF977),
-(0xF978),(0xF979),(0xF97A),(0xF97B),(0xF97C),(0xF97D),(0xF97E),
-(0xF980),(0xF981),(0xF982),(0xF983),(0xF984),(0xF985),(0xF986),(0xF987),
-(0xF988),(0xF989),(0xF98A),(0xF98B),(0xF98C),(0xF98D),(0xF98E),(0xF98F),
-(0xF990),(0xF991),(0xF992),(0xF993),(0xF994),(0xF995),(0xF996),(0xF997),
-(0xF998),(0xF999),(0xF99A),(0xF99B),(0xF99C),(0xF99D),(0xF99E),(0xF99F),
-(0xF9A0),(0xF9A1),(0xF9A2),(0xF9A3),(0xF9A4),(0xF9A5),(0xF9A6),(0xF9A7),
-(0xF9A8),(0xF9A9),(0xF9AA),(0xF9AB),(0xF9AC),(0xF9AD),(0xF9AE),(0xF9AF),
-(0xF9B0),(0xF9B1),(0xF9B2),(0xF9B3),(0xF9B4),(0xF9B5),(0xF9B6),(0xF9B7),
-(0xF9B8),(0xF9B9),(0xF9BA),(0xF9BB),(0xF9BC),(0xF9BD),(0xF9BE),(0xF9BF),
-(0xF9C0),(0xF9C1),(0xF9C2),(0xF9C3),(0xF9C4),(0xF9C5),(0xF9C6),(0xF9C7),
-(0xF9C8),(0xF9C9),(0xF9CA),(0xF9CB),(0xF9CC),(0xF9CD),(0xF9CE),(0xF9CF),
-(0xF9D0),(0xF9D1),(0xF9D2),(0xF9D3),(0xF9D4),(0xF9D5),(0xF9D6),(0xF9D7),
-(0xF9D8),(0xF9D9),(0xF9DA),(0xF9DB),(0xF9DC),(0xF9DD),(0xF9DE),(0xF9DF),
-(0xF9E0),(0xF9E1),(0xF9E2),(0xF9E3),(0xF9E4),(0xF9E5),(0xF9E6),(0xF9E7),
-(0xF9E8),(0xF9E9),(0xF9EA),(0xF9EB),(0xF9EC),(0xF9ED),(0xF9EE),(0xF9EF),
-(0xF9F0),(0xF9F1),(0xF9F2),(0xF9F3),(0xF9F4),(0xF9F5),(0xF9F6),(0xF9F7),
-(0xF9F8),(0xF9F9),(0xF9FA),(0xF9FB),(0xF9FC);
-
-#Test that all the characters are stored correctly
-SELECT HEX(c1) FROM t1;
-
-#Test conversion to ucs2
-CREATE TABLE t2 SELECT CONVERT(c1 USING ucs2) AS c1 FROM t1;
-SELECT HEX(c1) FROM t2;
-
-#Test round trip conversion
-CREATE TABLE t3 SELECT CONVERT(c1 USING cp932) AS c1 FROM t2;
-SELECT HEX(c1) FROM t3;
-
-#Test conversion to eucjpms
-CREATE TABLE t4 SELECT CONVERT(c1 USING eucjpms) AS c1 FROM t1;
-SELECT HEX(c1) FROM t4;
-
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-DROP TABLE t4;
-
-# Test prepared statement with 0x8300 sequence in parameter while
-# running with cp932 client character set.
-RESET MASTER;
-CREATE TABLE t1(f1 blob);
-PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
-SET @var1= x'8300';
-# TODO: Note that this doesn't actually test the code which was added for
-# bug#11338 because this syntax for prepared statements causes the PS to
-# be replicated differently than if we executed the PS from C or Java.
-# Using this syntax, variable names are inserted into the binlog instead
-# of values. The real goal of this test is to check the code that was
-# added to Item_param::query_val_str() in order to do hex encoding of
-# PS parameters when the client character set is cp932;
-# Bug#11338 has an example java program which can be used to verify this
-# code (and I have used it to test the fix) until there is some way to
-# exercise this code from mysql-test-run.
-EXECUTE stmt1 USING @var1;
-SHOW BINLOG EVENTS FROM 98;
-SELECT HEX(f1) FROM t1;
-DROP table t1;
-# end test for bug#11338
-
-SET collation_connection='cp932_japanese_ci';
--- source include/ctype_filesort.inc
-SET collation_connection='cp932_bin';
--- source include/ctype_filesort.inc
-
-#
-# Bug#12547: Inserting long string into varchar causes table crash in cp932
-#
-create table t1 (col1 varchar(1)) character set cp932;
-insert into t1 values ('a');
-insert into t1 values ('ab');
-select * from t1;
-insert into t1 values ('abc');
-select * from t1;
diff --git a/mysql-test/t/ctype_cp932_binlog.test b/mysql-test/t/ctype_cp932_binlog.test
deleted file mode 100644
index 270e27cf27f..00000000000
--- a/mysql-test/t/ctype_cp932_binlog.test
+++ /dev/null
@@ -1,34 +0,0 @@
--- source include/not_embedded.inc
--- source include/have_cp932.inc
-
---character_set cp932
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-set names cp932;
-set character_set_database = cp932;
-
-# Test prepared statement with 0x8300 sequence in parameter while
-# running with cp932 client character set.
-RESET MASTER;
-CREATE TABLE t1(f1 blob);
-PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
-SET @var1= x'8300';
-# TODO: Note that this doesn't actually test the code which was added for
-# bug#11338 because this syntax for prepared statements causes the PS to
-# be replicated differently than if we executed the PS from C or Java.
-# Using this syntax, variable names are inserted into the binlog instead
-# of values. The real goal of this test is to check the code that was
-# added to Item_param::query_val_str() in order to do hex encoding of
-# PS parameters when the client character set is cp932;
-# Bug#11338 has an example java program which can be used to verify this
-# code (and I have used it to test the fix) until there is some way to
-# exercise this code from mysql-test-run.
-EXECUTE stmt1 USING @var1;
-SHOW BINLOG EVENTS FROM 98;
-SELECT HEX(f1) FROM t1;
-DROP table t1;
-# end test for bug#11338
-
-# End of 4.1 tests
diff --git a/mysql-test/t/ctype_cp932_binlog_row.test b/mysql-test/t/ctype_cp932_binlog_row.test
new file mode 100644
index 00000000000..38614ea45c0
--- /dev/null
+++ b/mysql-test/t/ctype_cp932_binlog_row.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 11/07/2005 [jbm]
+
+-- source include/have_binlog_format_row.inc
+-- source extra/binlog_tests/ctype_cp932_binlog.test
diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test
new file mode 100644
index 00000000000..83a9ec59000
--- /dev/null
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
@@ -0,0 +1,5 @@
+# This is a wrapper for binlog.test so that the same test case can be used
+# For both statement and row based bin logs 11/07/2005 [jbm]
+
+-- source include/have_binlog_format_statement.inc
+-- source extra/binlog_tests/ctype_cp932_binlog.test
diff --git a/mysql-test/t/ctype_ucs_binlog.test b/mysql-test/t/ctype_ucs_binlog.test
deleted file mode 100644
index 1ce55edd469..00000000000
--- a/mysql-test/t/ctype_ucs_binlog.test
+++ /dev/null
@@ -1,20 +0,0 @@
---source include/not_embedded.inc
---source include/have_ucs2.inc
-
-#
-# Check correct binlogging of UCS2 user variables (BUG#3875)
-#
-SET TIMESTAMP=10000;
-create table t2 (c char(30)) charset=ucs2;
-set @v=convert('abc' using ucs2);
-reset master;
-insert into t2 values (@v);
-show binlog events from 98;
-# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
-# absolutely need variables names to be quoted and strings to be
-# escaped).
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
-drop table t2;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index c007c2f5205..88106ae6956 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -6,7 +6,9 @@
drop table if exists t1;
--enable_warnings
+--replace_result ROW <format> STATEMENT <format>
SHOW GLOBAL VARIABLES LIKE "%_format%";
+--replace_result ROW <format> STATEMENT <format>
SHOW SESSION VARIABLES LIKE "%_format%";
#
@@ -34,6 +36,7 @@ set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
+--replace_result ROW <format> STATEMENT <format>
SHOW SESSION VARIABLES LIKE "%format";
--error 1231
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 9cfb69ecd8f..f32ed667864 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -6,16 +6,22 @@
#
# <testcasename> : Comment test
#
-# Don't use any TAB characters for whitespace.
+# Do not use any TAB characters for whitespace.
#
##############################################################################
sp-goto : GOTO is currently is disabled - will be fixed in the future
kill : Unstable test case, bug#9712
-ndb_cache2 : Bug#15004
-ndb_cache_multi2: Bug#15004
-func_group : Bug#15448
-func_math : Bug#15448
-group_min_max : Bug#15448
+rpl_bit_npk : Bug #13418
+ndb_cache2 : Bug #15004
+ndb_cache_multi2: Bug #15004
+func_group : Bug #15448
+func_math : Bug #15448
+group_min_max : Bug #15448
+#mysqlslap : Bug #15483
+innodb_concurrent : Results are not deterministic, Elliot will fix (BUG#3300)
subselect : Bug#15706
type_time : Bug#15805
+rpl000002 : Bug#15920 Temporary tables are not binlogged in SBR
+ps_7ndb : Bug#15923 Core dump in RBR mode when executing test suite
+sp_trans : Bug#15924 Code dump in RBR mode when executing test suite
diff --git a/mysql-test/t/drop_temp_table.test b/mysql-test/t/drop_temp_table.test
deleted file mode 100644
index bc06de4096c..00000000000
--- a/mysql-test/t/drop_temp_table.test
+++ /dev/null
@@ -1,31 +0,0 @@
-# Embedded server doesn't support binlog
--- source include/not_embedded.inc
-
---disable_warnings
-drop database if exists `drop-temp+table-test`;
---enable_warnings
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connection con1;
-reset master;
-create database `drop-temp+table-test`;
-use `drop-temp+table-test`;
-create temporary table shortn1 (a int);
-create temporary table `table:name` (a int);
-create temporary table shortn2 (a int);
-select get_lock("a",10);
-disconnect con1;
-
-connection con2;
-# We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
-# guarantee that logging of the terminated con1 has been done yet.
-# To be sure that logging has been done, we use a user lock.
-select get_lock("a",10);
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-show binlog events;
-drop database `drop-temp+table-test`;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 4b97f27ebe6..71b92c419ca 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1142,40 +1142,6 @@ drop table t2, t1;
#
-# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
-# Actually this test has nothing to do with innodb per se, it just requires
-# transactional table.
-#
-show status like "binlog_cache_use";
-show status like "binlog_cache_disk_use";
-
-create table t1 (a int) engine=innodb;
-
-# Now we are going to create transaction which is long enough so its
-# transaction binlog will be flushed to disk...
-let $1=2000;
-disable_query_log;
-begin;
-while ($1)
-{
- eval insert into t1 values( $1 );
- dec $1;
-}
-commit;
-enable_query_log;
-show status like "binlog_cache_use";
-show status like "binlog_cache_disk_use";
-
-# Transaction which should not be flushed to disk and so should not
-# increase binlog_cache_disk_use.
-begin;
-delete from t1;
-commit;
-show status like "binlog_cache_use";
-show status like "binlog_cache_disk_use";
-drop table t1;
-
-#
# Bug #6126: Duplicate columns in keys gives misleading error message
#
--error 1060
@@ -1289,15 +1255,6 @@ select * from t1 where x > -16;
select count(*) from t1 where x = 18446744073709551601;
drop table t1;
-
-# Test for testable InnoDB status variables. This test
-# uses previous ones(pages_created, rows_deleted, ...).
-show status like "Innodb_buffer_pool_pages_total";
-show status like "Innodb_page_size";
-show status like "Innodb_rows_deleted";
-show status like "Innodb_rows_inserted";
-show status like "Innodb_rows_updated";
-
# Test for row locks InnoDB status variables.
show status like "Innodb_row_lock_waits";
show status like "Innodb_row_lock_current_waits";
diff --git a/mysql-test/t/innodb_concurrent-master.opt b/mysql-test/t/innodb_concurrent-master.opt
new file mode 100644
index 00000000000..f76bada5208
--- /dev/null
+++ b/mysql-test/t/innodb_concurrent-master.opt
@@ -0,0 +1 @@
+--innodb_locks_unsafe_for_binlog
diff --git a/mysql-test/t/innodb_concurrent.test b/mysql-test/t/innodb_concurrent.test
new file mode 100644
index 00000000000..1595fcd2467
--- /dev/null
+++ b/mysql-test/t/innodb_concurrent.test
@@ -0,0 +1,346 @@
+#
+# Concurrent InnoDB tests, mainly in UPDATE's
+# Bug#3300
+# Designed and tested by Sinisa Milivojevic, sinisa@mysql.com
+#
+# two non-interfering UPDATE's not changing result set
+#
+
+# test takes circa 5 minutes to run, so it's big
+-- source include/big_test.inc
+
+connection default;
+drop table if exists t1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+connect (thread1, localhost, mysqltest,,);
+connection thread1;
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",1);
+connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send update t1 set eta=1+get_lock("hello",1)*0 where tipo=11;
+sleep 1;
+connection thread1;
+begin;
+update t1 set eta=2 where tipo=22;
+select release_lock("hello");
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+select * from t1;
+commit;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+#
+# two UPDATE's running and one changing result set
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
+sleep 1;
+connection thread1;
+begin;
+update t1 set tipo=1 where tipo=2;
+select release_lock("hello");
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+select * from t1;
+commit;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+
+#
+# One UPDATE and one INSERT .... Monty's test
+#
+
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1 (a int not null, b int not null) engine=innodb;
+insert into t1 values (1,1),(2,1),(3,1),(4,1);
+select get_lock("hello2",1000);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send update t1 set b=10+get_lock(concat("hello",a),1000)*0 where
+a=2;
+sleep 1;
+connection thread1;
+insert into t1 values (1,1);
+select release_lock("hello2");
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+sleep 1;
+connection thread2;
+reap;
+connection default;
+drop table t1;
+
+#
+# one UPDATE changing result set and SELECT ... FOR UPDATE
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send select * from t1 where tipo=2 FOR UPDATE;
+sleep 1;
+connection thread1;
+begin;
+select release_lock("hello");
+--error 1205
+update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+commit;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+#
+# one UPDATE not changing result set and SELECT ... FOR UPDATE
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send select * from t1 where tipo=2 FOR UPDATE;
+sleep 1;
+connection thread1;
+begin;
+select release_lock("hello");
+--error 1205
+update t1 set tipo=11+get_lock("hello",10)*0 where tipo=22;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+commit;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+#
+# two SELECT ... FOR UPDATE
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send select * from t1 where tipo=2 FOR UPDATE;
+sleep 1;
+connection thread1;
+begin;
+select release_lock("hello");
+--error 1205
+select * from t1 where tipo=1 FOR UPDATE;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+commit;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+
+#
+# one UPDATE changing result set and DELETE
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send delete from t1 where tipo=2;
+sleep 1;
+connection thread1;
+begin;
+select release_lock("hello");
+--error 1205
+update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+commit;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+drop table t1;
+
+
+#
+# one UPDATE not changing result set and DELETE
+#
+#connect (thread1, localhost, mysqltest,,);
+connection thread1;
+create table t1(eta int(11) not null, tipo int(11), c varchar(255)) type=innodb;
+insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
+insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
+insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
+insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
+insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
+insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
+insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
+insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+select get_lock("hello",10);
+#connect (thread2, localhost, mysqltest,,);
+connection thread2;
+begin;
+send delete from t1 where tipo=2;
+sleep 1;
+connection thread1;
+begin;
+select release_lock("hello");
+update t1 set tipo=1+get_lock("hello",10)*0 where tipo=22;
+select * from t1;
+connection thread2;
+reap;
+select * from t1;
+send commit;
+connection thread1;
+commit;
+connection thread2;
+reap;
+select * from t1;
+connection thread1;
+select * from t1;
+connection default;
+sleep 1;
+drop table t1;
+disconnect thread1;
+disconnect thread2;
diff --git a/mysql-test/t/insert_select-binlog.test b/mysql-test/t/insert_select-binlog.test
deleted file mode 100644
index d4041f86ab5..00000000000
--- a/mysql-test/t/insert_select-binlog.test
+++ /dev/null
@@ -1,35 +0,0 @@
-# Embedded server doesn't support binlog
--- source include/not_embedded.inc
-
-# Check if a partly-completed INSERT SELECT in a MyISAM table goes into the
-# binlog
-
-create table t1(a int, unique(a));
-insert into t1 values(2);
-create table t2(a int);
-insert into t2 values(1),(2);
-reset master;
---error 1062
-insert into t1 select * from t2;
-# The above should produce an error, but still be in the binlog;
-# verify the binlog :
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
-show binlog events;
-select * from t1;
-drop table t1, t2;
-
-# Verify that a partly-completed CREATE TABLE .. SELECT does not
-# get into the binlog (Bug #6682)
-create table t1(a int);
-insert into t1 values(1),(1);
-reset master;
---error 1062
-create table t2(unique(a)) select a from t1;
-# The above should produce an error, *and* not appear in the binlog
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
-show binlog events;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test
deleted file mode 100644
index 658584b625e..00000000000
--- a/mysql-test/t/mix_innodb_myisam_binlog.test
+++ /dev/null
@@ -1,263 +0,0 @@
-# Check that binlog is ok when a transaction mixes updates to InnoDB and
-# MyISAM.
-# It would be nice to make this a replication test, but in 4.0 the
-# slave is always with --skip-innodb in the testsuite. I (Guilhem) however
-# did some tests manually on a slave; tables are replicated fine and
-# Exec_Master_Log_Pos advances as expected.
-
-# Embedded server doesn't support binlogging
--- source include/not_embedded.inc
-
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
-connection con1;
-create table t1 (a int) engine=innodb;
-create table t2 (a int) engine=myisam;
-
-reset master;
-
-begin;
-insert into t1 values(1);
-insert into t2 select * from t1;
-commit;
-
---replace_column 5 #
---replace_result "xid=15" "xid=8"
-show binlog events from 98;
-
-delete from t1;
-delete from t2;
-reset master;
-
-begin;
-insert into t1 values(2);
-insert into t2 select * from t1;
-# should say some changes to non-transact1onal tables couldn't be rolled back
-rollback;
-
---replace_column 5 #
-show binlog events from 98;
-
-delete from t1;
-delete from t2;
-reset master;
-
-begin;
-insert into t1 values(3);
-savepoint my_savepoint;
-insert into t1 values(4);
-insert into t2 select * from t1;
-rollback to savepoint my_savepoint;
-commit;
-
---replace_column 5 #
---replace_result "xid=48" "xid=25"
-show binlog events from 98;
-
-delete from t1;
-delete from t2;
-reset master;
-
-begin;
-insert into t1 values(5);
-savepoint my_savepoint;
-insert into t1 values(6);
-insert into t2 select * from t1;
-rollback to savepoint my_savepoint;
-insert into t1 values(7);
-commit;
-select a from t1 order by a; # check that savepoints work :)
-
---replace_column 5 #
---replace_result "xid=70" "xid=37"
-show binlog events from 98;
-
-# and when ROLLBACK is not explicit?
-delete from t1;
-delete from t2;
-reset master;
-
-select get_lock("a",10);
-begin;
-insert into t1 values(8);
-insert into t2 select * from t1;
-disconnect con1;
-
-connection con2;
-# We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
-# guarantee that logging of the terminated con1 has been done yet (it may not
-# even be started, so con1 may have not even attempted to lock the binlog yet;
-# so SHOW BINLOG EVENTS may come before con1 does the loggin. To be sure that
-# logging has been done, we use a user lock.
-select get_lock("a",10);
---replace_column 5 #
-show binlog events from 98;
-
-# and when not in a transact1on?
-delete from t1;
-delete from t2;
-reset master;
-
-insert into t1 values(9);
-insert into t2 select * from t1;
-
---replace_column 5 #
---replace_result "xid=119" "xid=60"
-show binlog events from 98;
-
-# Check that when the query updat1ng the MyISAM table is the first in the
-# transaction, we log it immediately.
-delete from t1;
-delete from t2;
-reset master;
-
-insert into t1 values(10); # first make t1 non-empty
-begin;
-insert into t2 select * from t1;
---replace_column 5 #
---replace_result "xid=133" "xid=66"
-show binlog events from 98;
-insert into t1 values(11);
-commit;
-
---replace_column 5 #
---replace_result "xid=133" "xid=66" "xid=136" "xid=68"
-show binlog events from 98;
-
-
-# Check that things work like before this BEGIN/ROLLBACK code was added,
-# when t2 is INNODB
-
-alter table t2 engine=INNODB;
-
-delete from t1;
-delete from t2;
-reset master;
-
-begin;
-insert into t1 values(12);
-insert into t2 select * from t1;
-commit;
-
---replace_column 5 #
---replace_result "xid=155" "xid=78"
-show binlog events from 98;
-
-delete from t1;
-delete from t2;
-reset master;
-
-begin;
-insert into t1 values(13);
-insert into t2 select * from t1;
-rollback;
-
---replace_column 5 #
-show binlog events from 98;
-
-delete from t1;
-delete from t2;
-reset master;
-
-begin;
-insert into t1 values(14);
-savepoint my_savepoint;
-insert into t1 values(15);
-insert into t2 select * from t1;
-rollback to savepoint my_savepoint;
-commit;
-
---replace_column 5 #
---replace_result "xid=187" "xid=94"
-show binlog events from 98;
-
-delete from t1;
-delete from t2;
-reset master;
-
-begin;
-insert into t1 values(16);
-savepoint my_savepoint;
-insert into t1 values(17);
-insert into t2 select * from t1;
-rollback to savepoint my_savepoint;
-insert into t1 values(18);
-commit;
-select a from t1 order by a; # check that savepoints work :)
-
---replace_column 5 #
---replace_result "xid=208" "xid=105"
-show binlog events from 98;
-
-# Test for BUG#5714, where a MyISAM update in the transaction used to
-# release row-level locks in InnoDB
-
-connect (con3,localhost,root,,);
-
-connection con3;
-delete from t1;
-delete from t2;
---disable_warnings
-alter table t2 type=MyISAM;
---enable_warnings
-insert into t1 values (1);
-begin;
-select * from t1 for update;
-
-connection con2;
-select (@before:=unix_timestamp())*0; # always give repeatable output
-begin;
-send select * from t1 for update;
-
-connection con3;
-insert into t2 values (20);
-
-connection con2;
---error 1205
-reap;
-select (@after:=unix_timestamp())*0; # always give repeatable output
-# verify that innodb_lock_wait_timeout was exceeded. When there was
-# the bug, the reap would return immediately after the insert into t2.
-select (@after-@before) >= 2;
-
-drop table t1,t2;
-commit;
-
-# test for BUG#7947 - DO RELEASE_LOCK() not written to binlog on rollback in the middle
-# of a transaction
-
-connection con2;
-begin;
-create temporary table ti (a int) engine=innodb;
-rollback;
-insert into ti values(1);
-set autocommit=0;
-create temporary table t1 (a int) engine=myisam;
-commit;
-insert t1 values (1);
-rollback;
-create table t0 (n int);
-insert t0 select * from t1;
-set autocommit=1;
-insert into t0 select GET_LOCK("lock1",null);
-set autocommit=0;
-create table t2 (n int) engine=innodb;
-insert into t2 values (3);
-disconnect con2;
-connection con3;
-select get_lock("lock1",60);
---replace_column 5 #
---replace_result "xid=208" "xid=105" "xid=227" "xid=114" "xid=230" "xid=115" "xid=234" "xid=117" "xid=261" "xid=132"
-show binlog events from 98;
-do release_lock("lock1");
-drop table t0,t2;
-
-
-# End of 4.1 tests
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 61d7d9994ba..30af9fd8126 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -1,4 +1,6 @@
# We are using .opt file since we need small binlog size
+# TODO: Need to look at making a row based version once the new row based client is completed. [jbm]
+-- source include/have_binlog_format_statement.inc
# Embedded server doesn't support binlogging
-- source include/not_embedded.inc
@@ -63,7 +65,7 @@ select "--- --database --" as "";
select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=231 $MYSQL_TEST_DIR/var/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=235 $MYSQL_TEST_DIR/var/log/master-bin.000002
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -95,7 +97,7 @@ select "--- --database --" as "";
select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=231 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=235 --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
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
index a2f1aba05b0..89af8e33a03 100644
--- a/mysql-test/t/mysqlbinlog2.test
+++ b/mysql-test/t/mysqlbinlog2.test
@@ -1,6 +1,9 @@
# Test for the new options --start-datetime, stop-datetime,
# and a few others.
+# TODO: Need to look at making row based version once new binlog client is complete.
+-- source include/have_binlog_format_statement.inc
+
# Embedded server doesn't support binlogging
-- source include/not_embedded.inc
@@ -49,11 +52,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=600 $MYSQL_TEST_DIR/var/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=604 $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=600 $MYSQL_TEST_DIR/var/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=604 $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -78,11 +81,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=600 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=604 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=126 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=130 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -105,11 +108,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=600 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=600 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -132,11 +135,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=600 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=126 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=130 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
diff --git a/mysql-test/t/mysqlbinlog_base64.test b/mysql-test/t/mysqlbinlog_base64.test
new file mode 100644
index 00000000000..3aab767f9fa
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog_base64.test
@@ -0,0 +1,38 @@
+-- source include/have_binlog_format_row.inc
+#
+# Write different events to binlog
+#
+create table t1 (a int);
+insert into t1 values (1);
+insert into t1 values (2);
+insert into t1 values (3);
+update t1 set a=a+2 where a=2;
+update t1 set a=a+2 where a=3;
+
+create table t2 (word varchar(20));
+load data infile '../../std_data/words.dat' into table t2;
+
+#
+# Save binlog
+#
+--exec $MYSQL_BINLOG --hexdump $MYSQL_TEST_DIR/var/log/master-bin.000001 > $MYSQL_TEST_DIR/var/tmp/mysqlbinlog_base64.sql
+
+#
+# Clear database and restore from binlog
+#
+drop table t1;
+drop table t2;
+--exec $MYSQL test < $MYSQL_TEST_DIR/var/tmp/mysqlbinlog_base64.sql
+
+#
+# Verify that all binlog events have been executed
+#
+select * from t1;
+select * from t2;
+
+#
+# Test cleanup
+#
+--exec rm $MYSQL_TEST_DIR/var/tmp/mysqlbinlog_base64.sql
+drop table t1;
+drop table t2;
diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test
deleted file mode 100644
index 45d621b730f..00000000000
--- a/mysql-test/t/rpl000001.test
+++ /dev/null
@@ -1,130 +0,0 @@
-source include/master-slave.inc;
-
-create table t1 (word char(20) not null);
-load data infile '../../std_data/words.dat' into table t1;
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
-eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
-select * from t1 limit 10;
-
-#
-# Test slave with wrong password
-#
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
-connection master;
-set password for root@"localhost" = password('foo');
-connection slave;
-start slave;
-connection master;
-#
-# Give slave time to do at last one failed connect retry
-# This one must be short so that the slave will not stop retrying
-real_sleep 2;
-set password for root@"localhost" = password('');
-# Give slave time to connect (will retry every second)
-sleep 2;
-
-create table t3(n int);
-insert into t3 values(1),(2);
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t3;
-select sum(length(word)) from t1;
-connection master;
-drop table t1,t3;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# Test if the slave SQL thread can be more than 16K behind the slave
-# I/O thread (> IO_SIZE)
-
-connection master;
-# we'll use table-level locking to delay slave SQL thread
-create table t1 (n int) engine=myisam;
-sync_slave_with_master;
-connection master;
-reset master;
-connection slave;
-stop slave;
-reset slave;
-
-connection master;
-let $1=5000;
-# Generate 16K of relay log
-disable_query_log;
-while ($1)
-{
- eval insert into t1 values($1);
- dec $1;
-}
-enable_query_log;
-
-# Try to cause a large relay log lag on the slave by locking t1
-connection slave;
-lock tables t1 read;
-start slave;
-#hope this is long enough for I/O thread to fetch over 16K relay log data
-sleep 3;
-unlock tables;
-
-#test handling of aborted connection in the middle of update
-
-connection master;
-create table t2(id int);
-insert into t2 values(connection_id());
-save_master_pos;
-
-connection master1;
-# Avoid generating result
-create temporary table t3(n int);
-insert into t3 select get_lock('crash_lock%20C', 1) from t2;
-
-connection master;
-send update t1 set n = n + get_lock('crash_lock%20C', 2);
-connection master1;
-sleep 3;
-select (@id := id) - id from t2;
-kill @id;
-# We don't drop t3 as this is a temporary table
-drop table t2;
-connection master;
---error 1053,2013
-reap;
-connection slave;
-# The SQL slave thread should now have stopped because the query was killed on
-# the master (so it has a non-zero error code in the binlog).
-wait_for_slave_to_stop;
-
-# The following test can't be done because the result of Pos will differ
-# on different computers
-# --replace_result $MASTER_MYPORT MASTER_PORT
-# show slave status;
-
-set global sql_slave_skip_counter=1;
-start slave;
-select count(*) from t1;
-connection master1;
-drop table t1;
-create table t1 (n int);
-insert into t1 values(3456);
-insert into mysql.user (Host, User, Password)
- VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-save_master_pos;
-connection slave;
-sync_with_master;
-select n from t1;
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-connection master1;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl000002.test b/mysql-test/t/rpl000002.test
index bafd8a30159..5b9ed6898b8 100644
--- a/mysql-test/t/rpl000002.test
+++ b/mysql-test/t/rpl000002.test
@@ -1,3 +1,8 @@
+# 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_statement.inc
+
source include/master-slave.inc;
# Test replication of auto_increment
diff --git a/mysql-test/t/rpl000006.test b/mysql-test/t/rpl000006.test
index 334ed575835..bca97391f8e 100644
--- a/mysql-test/t/rpl000006.test
+++ b/mysql-test/t/rpl000006.test
@@ -1,47 +1,2 @@
-#
-# Test forced timestamp
-#
-source include/master-slave.inc;
-
-# Don't log table creating to the slave as we want to test LOAD TABLE
-set SQL_LOG_BIN=0,timestamp=200006;
-create table t1(t timestamp not null,a char(1));
-insert into t1 ( a) values ('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;
-
-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;
-
-# End of 4.1 tests
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl000006.test
diff --git a/mysql-test/t/rpl000013-slave.opt b/mysql-test/t/rpl000013-slave.opt
deleted file mode 100644
index 2662c695b41..00000000000
--- a/mysql-test/t/rpl000013-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---abort-slave-event-count=1
diff --git a/mysql-test/t/rpl000013.test b/mysql-test/t/rpl000013.test
index eca4803c6bc..c681e76cf51 100644
--- a/mysql-test/t/rpl000013.test
+++ b/mysql-test/t/rpl000013.test
@@ -1,3 +1,13 @@
+# 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_statement.inc
source include/master-slave.inc;
save_master_pos;
connection slave;
diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test
index 3b4574e9547..792801dd3d2 100644
--- a/mysql-test/t/rpl000017.test
+++ b/mysql-test/t/rpl000017.test
@@ -1,7 +1,7 @@
-connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
+source include/master-slave.inc;
+connection slave;
+stop slave;
connection master;
-reset 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;
diff --git a/mysql-test/t/rpl000012.test b/mysql-test/t/rpl_000012.test
index 2c1c65e4202..17f1d38dbae 100644
--- a/mysql-test/t/rpl000012.test
+++ b/mysql-test/t/rpl_000012.test
@@ -1,37 +1,53 @@
-source include/master-slave.inc;
-connection master;
+# drop table t1 t2 t3 are included int master-slave.inc
+# Like rpl000013, meaningful only in statement-based:
+-- source include/have_binlog_format_statement.inc
+# Should work on both stm and row
+-- source include/master-slave.inc
-create table t2 (n int);
+
+create table t2 (n int, PRIMARY KEY(n));
create temporary table t1 (n int);
-insert into t1 values(1),(2),(3);
-insert into t2 select * from t1;
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 (100);
+insert into t3 values (1010);
insert into t2 select * from t3;
+
drop table if exists t3;
-insert into t2 values (101);
+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;
+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(6);
+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
#
@@ -41,5 +57,3 @@ drop table if exists t1,t2;
save_master_pos;
connection slave;
sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl000015-slave.sh b/mysql-test/t/rpl_000015-slave.sh
index 62748605af1..62748605af1 100755
--- a/mysql-test/t/rpl000015-slave.sh
+++ b/mysql-test/t/rpl_000015-slave.sh
diff --git a/mysql-test/t/rpl000015.slave-mi b/mysql-test/t/rpl_000015.slave-mi
index 28bc753dd56..28bc753dd56 100644
--- a/mysql-test/t/rpl000015.slave-mi
+++ b/mysql-test/t/rpl_000015.slave-mi
diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl_000015.test
index a53049386af..a19bae1bed0 100644
--- a/mysql-test/t/rpl000015.test
+++ b/mysql-test/t/rpl_000015.test
@@ -30,12 +30,12 @@ connection master;
--disable_warnings
drop table if exists t1;
--enable_warnings
-create table t1 (n int);
+create table t1 (n int, PRIMARY KEY(n));
insert into t1 values (10),(45),(90);
sync_slave_with_master;
+connection slave;
select * from t1;
connection master;
+select * from t1;
drop table t1;
sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_EE_error.test b/mysql-test/t/rpl_EE_error.test
deleted file mode 100644
index 72df0c20ef8..00000000000
--- a/mysql-test/t/rpl_EE_error.test
+++ /dev/null
@@ -1,32 +0,0 @@
-# See if an EE_ error in one event of the master's binlog stops replication
-# (it should not: in this configuration the EE_ error is probably not
-# critical). Example: you do a DROP TABLE on a table which has no MYI file
-# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
-# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
-
-source include/master-slave.inc;
-
-create table t1 (a int) engine=myisam;
-flush tables;
-system rm ./var/master-data/test/t1.MYI ;
-drop table if exists t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# Now a real error.
-
-connection master;
-create table t1 (a int, unique(a)) engine=myisam;
-set sql_log_bin=0;
-insert into t1 values(2);
-set sql_log_bin=1;
-save_master_pos;
---error 1062
-insert into t1 values(1),(2);
-drop table t1;
-save_master_pos;
-connection slave;
-wait_for_slave_to_stop;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_LD_INFILE.test b/mysql-test/t/rpl_LD_INFILE.test
new file mode 100644
index 00000000000..769462b5898
--- /dev/null
+++ b/mysql-test/t/rpl_LD_INFILE.test
@@ -0,0 +1,41 @@
+#############################################################################
+# 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 PROCEDURE IF EXISTS test.p1;
+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/words2.dat' INTO TABLE test.t1;
+DELETE FROM test.t1 WHERE a = 'abashed';
+DELETE FROM test.t1;
+LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
+
+
+connection master;
+SELECT * FROM test.t1;
+save_master_pos;
+sync_slave_with_master;
+connection slave;
+SELECT * FROM test.t1;
+
+connection master;
+# Lets cleanup
+#show binlog events;
+
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE test.t1;
+
+# End of 5.0 test case
+
diff --git a/mysql-test/t/rpl_auto_increment.test b/mysql-test/t/rpl_auto_increment.test
index 71032404307..fe0f1689471 100644
--- a/mysql-test/t/rpl_auto_increment.test
+++ b/mysql-test/t/rpl_auto_increment.test
@@ -1,104 +1,7 @@
-#
-# Test of auto_increment with offset
-#
-source include/have_innodb.inc;
-source include/master-slave.inc;
-
-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;
-
-sync_slave_with_master;
-select * from t1;
-connection master;
-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;
-
-sync_slave_with_master;
-select * from t1;
-connection master;
-
-drop table t1;
-
-set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
-show variables like "%auto_inc%";
-
-create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
-# Insert with 2 insert statements to get better testing of logging
-insert into t1 values (NULL),(5),(NULL);
-insert into t1 values (250),(NULL);
-select * from t1;
-insert into t1 values (1000);
-set @@insert_id=400;
-insert into t1 values(NULL),(NULL);
-select * from t1;
-
-sync_slave_with_master;
-select * from t1;
-connection master;
-drop table t1;
-
-#
-# Same test with innodb (as the innodb code is a bit different)
-#
-create table t1 (a int not null auto_increment, primary key (a)) engine=innodb;
-# Insert with 2 insert statements to get better testing of logging
-insert into t1 values (NULL),(5),(NULL);
-insert into t1 values (250),(NULL);
-select * from t1;
-insert into t1 values (1000);
-set @@insert_id=400;
-insert into t1 values(NULL),(NULL);
-select * from t1;
-
-sync_slave_with_master;
-select * from t1;
-connection master;
-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 with 2 insert statements to get better testing of logging
-insert into t1 values (NULL),(5),(NULL),(NULL);
-insert into t1 values (500),(NULL),(502),(NULL),(NULL);
-select * from t1;
-set @@insert_id=600;
---error 1062
-insert into t1 values(600),(NULL),(NULL);
-set @@insert_id=600;
-insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
-select * from t1;
-
-sync_slave_with_master;
-select * from t1;
-connection master;
-drop table t1;
-
-#
-# Test that auto-increment works when slave has rows in the table
-#
-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;
-
-sync_slave_with_master;
-insert into t1 values(2),(12),(22),(32),(42);
-connection master;
-
-insert into t1 values (NULL),(NULL);
-insert into t1 values (3),(NULL),(NULL);
-select * from t1;
-
-sync_slave_with_master;
-select * from t1;
-connection master;
-
-drop table t1;
-
-# End cleanup
-sync_slave_with_master;
+#####################################
+# Wrapper for rpl_auto_increment.test#
+#####################################
+-- 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/t/rpl_bit.test b/mysql-test/t/rpl_bit.test
new file mode 100644
index 00000000000..5211f375274
--- /dev/null
+++ b/mysql-test/t/rpl_bit.test
@@ -0,0 +1,90 @@
+#############################################################################
+# 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,
+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;
+SELECT hex(bit2) from test.t1;
+SELECT hex(bit3) from test.t1;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
+SELECT hex(bit1) from test.t1;
+SELECT hex(bit2) from test.t1;
+SELECT hex(bit3) from test.t1;
+
+connection master;
+DROP TABLE IF EXISTS test.t1;
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_bit_npk.test b/mysql-test/t/rpl_bit_npk.test
new file mode 100644
index 00000000000..07fc42b09ef
--- /dev/null
+++ b/mysql-test/t/rpl_bit_npk.test
@@ -0,0 +1,112 @@
+#############################################################################
+# 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;
+SELECT hex(bit1) from test.t1;
+SELECT hex(bit2) from test.t1;
+SELECT hex(bit3) from test.t1;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
+SELECT hex(bit1) from test.t1;
+SELECT hex(bit2) from test.t1;
+SELECT hex(bit3) from test.t1;
+
+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;
+SELECT * FROM test.t3;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+SELECT a, hex(b) FROM test.t2;
+SELECT * FROM test.t3;
+
+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/t/rpl_change_master.test b/mysql-test/t/rpl_change_master.test
index 6c055a81ceb..c031464c95e 100644
--- a/mysql-test/t/rpl_change_master.test
+++ b/mysql-test/t/rpl_change_master.test
@@ -19,11 +19,11 @@ 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 # 8 # 9 # 23 # 33 #
+--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 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 23 # 33 #
show slave status;
start slave;
sync_with_master;
diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test
deleted file mode 100644
index e5ddf084461..00000000000
--- a/mysql-test/t/rpl_charset.test
+++ /dev/null
@@ -1,173 +0,0 @@
-# Replication of character sets.
-# This test will fail if the server/client does not support enough charsets.
-
-source include/master-slave.inc;
---disable_warnings
-set timestamp=1000000000;
-drop database if exists mysqltest2;
-drop database if exists mysqltest3;
---enable_warnings
-
-create database mysqltest2 character set latin2;
-set @@character_set_server=latin5;
-create database mysqltest3;
---disable_query_log
-select "--- --master--" as "";
---enable_query_log
-show create database mysqltest2;
-show create database mysqltest3;
-sync_slave_with_master;
---disable_query_log
-select "--- --slave--" as "";
---enable_query_log
-show create database mysqltest2;
-show create database mysqltest3;
-
-connection master;
-set @@collation_server=armscii8_bin;
-drop database mysqltest3;
-create database mysqltest3;
---disable_query_log
-select "--- --master--" as "";
---enable_query_log
-show create database mysqltest3;
-sync_slave_with_master;
---disable_query_log
-select "--- --slave--" as "";
---enable_query_log
-show create database mysqltest3;
-
-connection master;
-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);
-# character_set_database and collation_database are not tested as they
-# needn't be replicated (Bar said in Jan 2005).
-insert into t1 (b) values(@@character_set_client);
-# collation_client does not exist
-insert into t1 (b) values(@@character_set_connection);
-insert into t1 (b) values(@@collation_connection);
---disable_query_log
-select "--- --master--" as "";
---enable_query_log
-select * from t1 order by a;
-sync_slave_with_master;
---disable_query_log
-select "--- --slave--" as "";
---enable_query_log
-select * from mysqltest2.t1 order by a;
-
-connection master;
-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"));
---disable_query_log
-select "--- --master--" as "";
---enable_query_log
-select * from t1 order by a;
-sync_slave_with_master;
---disable_query_log
-select "--- --slave--" as "";
---enable_query_log
-select * from mysqltest2.t1 order by a;
-
-# Presently charset info is not logged with LOAD DATA but it will
-# change in Jan 2005 when Dmitri pushes his new LOAD DATA,
-# before 5.0.3 goes out. When done, LOAD DATA INFILE should be tested
-# here.
-
-# See if user var is prefixed with collation in binlog and replicated well.
-# Note: replication of user variables is broken as far as derivation is
-# concerned. That's because when we store a user variable in the binlog,
-# we lose its derivation. So later on the slave, it's impossible to
-# know if the collation was explicit or not, so we use DERIVATION_NONE,
-# which provokes error messages (like 'Illegal mix of collation') when
-# we replay the master's INSERT/etc statements.
-connection master;
-set @a= _cp850 'Müller' collate cp850_general_ci;
-truncate table t1;
-insert into t1 (b) values(collation(@a));
---disable_query_log
-select "--- --master--" as "";
---enable_query_log
-select * from t1 order by a;
-sync_slave_with_master;
---disable_query_log
-select "--- --slave--" as "";
---enable_query_log
-select * from mysqltest2.t1 order by a;
-
-connection master;
-drop database mysqltest2;
-drop database mysqltest3;
---replace_column 2 # 5 #
-show binlog events from 98;
-sync_slave_with_master;
-
-# Check that we can change global.collation_server (since 5.0.3)
-
-set global character_set_server=latin2;
-set global character_set_server=latin1; # back
-connection master;
-set global character_set_server=latin2;
-set global character_set_server=latin1; # back
-
-# Check that SET ONE_SHOT is really one shot
-
-set one_shot @@character_set_server=latin5;
-set @@max_join_size=1000;
-select @@character_set_server;
-select @@character_set_server;
-set @@character_set_server=latin5;
-select @@character_set_server;
-select @@character_set_server;
-
-# ONE_SHOT on not charset/collation stuff is not allowed
--- error 1382
-set one_shot max_join_size=10;
-
-# Test of wrong character set numbers;
-error 1115;
-set character_set_client=9999999;
-error 1273;
-set collation_server=9999998;
-
-# This one was contributed by Sergey Petrunia (BUG#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;
-sync_slave_with_master;
-select hex(c1), hex(c2) from t1;
-
-connection master;
-# Let's have a look at generated SETs.
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
-drop table t1;
-sync_slave_with_master;
-
-#
-# BUG#6676: Derivation of variables must be correct on slave
-#
-connection master;
-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;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_commit_after_flush.test b/mysql-test/t/rpl_commit_after_flush.test
index 6129e5485a6..9f6d4591f96 100644
--- a/mysql-test/t/rpl_commit_after_flush.test
+++ b/mysql-test/t/rpl_commit_after_flush.test
@@ -1,19 +1,6 @@
-source include/master-slave.inc;
-source include/have_innodb.inc;
-create table t1 (a int) engine=innodb;
-begin;
-insert into t1 values(1);
-flush tables with read lock;
-commit;
-save_master_pos;
-connection slave;
-sync_with_master;
-# cleanup
-connection master;
-unlock tables;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
+#####################################
+# Wrapper for rpl_commit_after_flush#
+#####################################
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+-- source extra/rpl_tests/rpl_commit_after_flush.test
diff --git a/mysql-test/t/rpl_create_database.test b/mysql-test/t/rpl_create_database.test
index cfccc4567b5..7ec73132113 100644
--- a/mysql-test/t/rpl_create_database.test
+++ b/mysql-test/t/rpl_create_database.test
@@ -55,9 +55,6 @@ CREATE DATABASE mysqltest_sisyfos;
USE mysqltest_sisyfos;
CREATE TABLE t2 (a INT);
let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-SHOW BINLOG EVENTS;
SHOW DATABASES;
sync_slave_with_master;
SHOW DATABASES;
diff --git a/mysql-test/t/rpl_ddl.test b/mysql-test/t/rpl_ddl.test
deleted file mode 100644
index d2a41a305b6..00000000000
--- a/mysql-test/t/rpl_ddl.test
+++ /dev/null
@@ -1,510 +0,0 @@
-######################## 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..
-#
-# 3. The assignment of the DDL command to be tested to $my_stmt can
-# be a bit difficult. "'" must be avoided, because the test
-# routine "include/rpl_stmt_seq.inc" performs a
-# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
-#
-
---source include/have_innodb.inc
---source include/master-slave.inc
-
-###############################################################
-# Some preparations
-###############################################################
-# The sync_slave_with_master is needed to make the xids deterministic.
-sync_slave_with_master;
-connection master;
-
-SET AUTOCOMMIT = 1;
-#
-# 1. DROP all objects, which probably already exist, but must be created here
-#
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-DROP DATABASE IF EXISTS mysqltest2;
-DROP DATABASE IF EXISTS mysqltest3;
---enable_warnings
-#
-# 2. CREATE all objects needed
-# working database is mysqltest1
-# working (transactional!) is mysqltest1.t1
-#
-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);
-
-#
-# 3. master sessions: never do AUTOCOMMIT
-# slave sessions: never do AUTOCOMMIT
-#
-SET AUTOCOMMIT = 0;
-use mysqltest1;
-sync_slave_with_master;
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SET AUTOCOMMIT = 0;
-use mysqltest1;
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-
-# We don't want to abort the whole test if one statement sent
-# to the server gets an error, because the following test
-# sequences are nearly independend of the previous statements.
---disable_abort_on_error
-
-###############################################################
-# Banal case: (explicit) COMMIT and ROLLBACK
-# Just for checking if the test sequence is usable
-###############################################################
-
-let $my_stmt= COMMIT;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-let $my_stmt= ROLLBACK;
-let $my_master_commit= false;
-let $my_slave_commit= false;
---source include/rpl_stmt_seq.inc
-
-###############################################################
-# Cases with commands very similar to COMMIT
-###############################################################
-
-let $my_stmt= SET AUTOCOMMIT=1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SET AUTOCOMMIT=0;
-
-let $my_stmt= START TRANSACTION;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-let $my_stmt= BEGIN;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-###############################################################
-# Cases with (BASE) TABLES and (UPDATABLE) VIEWs
-###############################################################
-
-let $my_stmt= DROP TABLE mysqltest1.t2;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW TABLES LIKE 't2';
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW TABLES LIKE 't2';
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-# Note: Since this test is executed with a skip-innodb slave, the
-# slave incorrectly commits the insert. One can *not* have InnoDB on
-# master and MyISAM on slave and expect that a transactional rollback
-# after a CREATE TEMPORARY TABLE should work correctly on the slave.
-# For this to work properly the handler on the slave must be able to
-# handle transactions (e.g. InnoDB or NDB).
-let $my_stmt= DROP TEMPORARY TABLE mysqltest1.t23;
-let $my_master_commit= false;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW TABLES LIKE 't23';
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW TABLES LIKE 't23';
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-let $my_stmt= RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW TABLES LIKE 't20';
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW TABLES LIKE 't20';
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-let $my_stmt= ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-describe mysqltest1.t4;
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-describe mysqltest1.t4;
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "InnoDB";
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-# Note: Since this test is executed with a skip-innodb slave, the
-# slave incorrectly commits the insert. One can *not* have InnoDB on
-# master and MyISAM on slave and expect that a transactional rollback
-# after a CREATE TEMPORARY TABLE should work correctly on the slave.
-# For this to work properly the handler on the slave must be able to
-# handle transactions (e.g. InnoDB or NDB).
-let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT);
-let $my_master_commit= false;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-let $my_stmt= TRUNCATE TABLE mysqltest1.t7;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SELECT * FROM mysqltest1.t7;
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SELECT * FROM mysqltest1.t7;
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-###############################################################
-# Cases with LOCK/UNLOCK
-###############################################################
-
-# MySQL insists in locking mysqltest1.t1, because rpl_stmt_seq performs an
-# INSERT into this table.
-let $my_stmt= LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-UNLOCK TABLES;
-
-# No prior locking
-let $my_stmt= UNLOCK TABLES;
-let $my_master_commit= false;
-let $my_slave_commit= false;
---source include/rpl_stmt_seq.inc
-
-# With prior read locking
-# Note that this test generate an error since the rpl_stmt_seq.inc
-# tries to insert into t1.
-LOCK TABLES mysqltest1.t1 READ;
-let $my_stmt= UNLOCK TABLES;
-let $my_master_commit= false;
-let $my_slave_commit= false;
---source include/rpl_stmt_seq.inc
-
-# With prior write locking
-LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
-let $my_stmt= UNLOCK TABLES;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-
-###############################################################
-# Cases with INDEXES
-###############################################################
-
-let $my_stmt= DROP INDEX my_idx6 ON mysqltest1.t6;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW INDEX FROM mysqltest1.t6;
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW INDEX FROM mysqltest1.t6;
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-let $my_stmt= CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW INDEX FROM mysqltest1.t5;
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW INDEX FROM mysqltest1.t5;
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-###############################################################
-# Cases with DATABASE
-###############################################################
-
-let $my_stmt= DROP DATABASE mysqltest2;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW DATABASES LIKE "mysqltest2";
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW DATABASES LIKE "mysqltest2";
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-let $my_stmt= CREATE DATABASE mysqltest3;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW DATABASES LIKE "mysqltest3";
-connection slave;
---disable_query_log
-SELECT '-------- switch to slave --------' as "";
---enable_query_log
-SHOW DATABASES LIKE "mysqltest3";
-connection master;
---disable_query_log
-SELECT '-------- switch to master -------' as "";
---enable_query_log
-
-# End of 4.1 tests
-
-###############################################################
-# Cases with stored procedures
-###############################################################
-let $my_stmt= CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
---vertical_results
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS LIKE 'p1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS LIKE 'p1';
-connection master;
---horizontal_results
-
-let $my_stmt= ALTER PROCEDURE p1 COMMENT "I have been altered";
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
---vertical_results
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS LIKE 'p1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS LIKE 'p1';
-connection master;
---horizontal_results
-
-let $my_stmt= DROP PROCEDURE p1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
---vertical_results
-SHOW PROCEDURE STATUS LIKE 'p1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SHOW PROCEDURE STATUS LIKE 'p1';
-connection master;
---horizontal_results
-
-###############################################################
-# Cases with VIEWs
-###############################################################
-let $my_stmt= CREATE OR REPLACE VIEW v1 as select * from t1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW CREATE VIEW v1;
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SHOW CREATE VIEW v1;
-connection master;
-
-let $my_stmt= ALTER VIEW v1 AS select f1 from t1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW CREATE VIEW v1;
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SHOW CREATE VIEW v1;
-connection master;
-
-let $my_stmt= DROP VIEW IF EXISTS v1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
---error 1146
-SHOW CREATE VIEW v1;
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
---error 1146
-SHOW CREATE VIEW v1;
-connection master;
-
-###############################################################
-# Cases with TRIGGERs
-###############################################################
-let $my_stmt= CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW TRIGGERS;
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SHOW TRIGGERS;
-connection master;
-
-let $my_stmt= DROP TRIGGER trg1;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SHOW TRIGGERS;
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SHOW TRIGGERS;
-connection master;
-
-###############################################################
-# Cases with USERs
-###############################################################
-let $my_stmt= CREATE USER user1@localhost;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SELECT user FROM mysql.user WHERE user = 'user1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SELECT user FROM mysql.user WHERE user = 'user1';
-connection master;
-
-let $my_stmt= RENAME USER user1@localhost TO rename1@localhost;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SELECT user FROM mysql.user WHERE user = 'rename1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SELECT user FROM mysql.user WHERE user = 'rename1';
-connection master;
-
-let $my_stmt= DROP USER rename1@localhost;
-let $my_master_commit= true;
-let $my_slave_commit= true;
---source include/rpl_stmt_seq.inc
-SELECT user FROM mysql.user WHERE user = 'rename1';
---disable_query_log
-SELECT '-------- switch to slave -------' as "";
---enable_query_log
-connection slave;
-SELECT user FROM mysql.user WHERE user = 'rename1';
-connection master;
-
-###############################################################
-# Cleanup
-###############################################################
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-DROP DATABASE IF EXISTS mysqltest2;
-DROP DATABASE IF EXISTS mysqltest3;
---enable_warnings
-
-
diff --git a/mysql-test/t/rpl_deadlock.test b/mysql-test/t/rpl_deadlock.test
deleted file mode 100644
index c74ed989ece..00000000000
--- a/mysql-test/t/rpl_deadlock.test
+++ /dev/null
@@ -1,113 +0,0 @@
-# See if slave restarts the transaction after failing on an InnoDB deadlock error.
-
-# Note: testing what happens when too many retries is possible, but
-# needs large waits when running with --debug, so we don't do it.
-# The same way, this test may not test what is expected when run
-# under Valgrind, timings are too short then (with --valgrind I
-# (Guilhem) have seen the test manage to provoke lock wait timeout
-# error but not deadlock error; that is ok as code deals with the two
-# errors in exactly the same way.
-# We don't 'show status like 'slave_retried_transactions'' because this
-# is not repeatable (depends on sleeps).
-
-source include/have_innodb.inc;
-source include/master-slave.inc;
-
-connection master;
-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) engine=innodb;
-create table t4 (a int) engine=innodb;
-show variables like 'slave_transaction_retries';
-sync_slave_with_master;
-
-show create table t1;
-show create table t2;
-show variables like 'slave_transaction_retries';
-stop slave;
-
-# 1) Test deadlock
-
-connection master;
-begin;
-# Let's keep BEGIN and the locked statement in two different relay logs.
-let $1=200;
-disable_query_log;
-while ($1)
-{
- eval insert into t3 values( $1 );
- dec $1;
-}
-enable_query_log;
-insert into t3 select * from t2 for update;
-insert into t1 values(1);
-commit;
-save_master_pos;
-
-connection slave;
-begin;
-# Let's make our transaction large so that it's slave who is chosen as
-# victim
-let $1=1000;
-disable_query_log;
-while ($1)
-{
- eval insert into t4 values( $1 );
- dec $1;
-}
-enable_query_log;
-select * from t1 for update;
-start slave;
---real_sleep 3 # hope that slave is blocked now
-insert into t2 values(22); # provoke deadlock, slave should be victim
-commit;
-sync_with_master;
-select * from t1; # check that slave succeeded finally
-select * from t2;
-# check that no error is reported
---replace_column 1 # 8 # 9 # 23 # 33 #
---replace_result $MASTER_MYPORT MASTER_MYPORT
-show slave status;
-
-# 2) Test lock wait timeout
-
-stop slave;
-change master to master_log_pos=532; # the BEGIN log event
-begin;
-select * from t2 for update; # hold lock
-start slave;
---real_sleep 10 # slave should have blocked, and be retrying
-commit;
-sync_with_master;
-select * from t1; # check that slave succeeded finally
-select * from t2;
-# check that no error is reported
---replace_column 1 # 8 # 9 # 23 # 33 #
---replace_result $MASTER_MYPORT MASTER_MYPORT
-show slave status;
-
-# Now we repeat 2), but with BEGIN in the same relay log as
-# COMMIT (to see if seeking into hot log is ok).
-
-set global max_relay_log_size=0;
-
-# This is really copy-paste of 2) of above
-stop slave;
-change master to master_log_pos=532;
-begin;
-select * from t2 for update;
-start slave;
---real_sleep 10
-commit;
-sync_with_master;
-select * from t1;
-select * from t2;
---replace_column 1 # 8 # 9 # 11 # 23 # 33 #
---replace_result $MASTER_MYPORT MASTER_MYPORT
-show slave status;
-
-connection master;
-drop table t1,t2,t3,t4;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_deadlock-slave.opt b/mysql-test/t/rpl_deadlock_innodb-slave.opt
index f4a8c640458..f4a8c640458 100644
--- a/mysql-test/t/rpl_deadlock-slave.opt
+++ b/mysql-test/t/rpl_deadlock_innodb-slave.opt
diff --git a/mysql-test/t/rpl_deadlock_innodb.test b/mysql-test/t/rpl_deadlock_innodb.test
new file mode 100644
index 00000000000..155bb9fdf34
--- /dev/null
+++ b/mysql-test/t/rpl_deadlock_innodb.test
@@ -0,0 +1,6 @@
+################################
+# Wrapper for rpl_deadlock.test#
+################################
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+-- source extra/rpl_tests/rpl_deadlock.test
diff --git a/mysql-test/t/rpl_delete_all.test b/mysql-test/t/rpl_delete_all.test
deleted file mode 100644
index e0c0757bbc2..00000000000
--- a/mysql-test/t/rpl_delete_all.test
+++ /dev/null
@@ -1,43 +0,0 @@
-source include/master-slave.inc;
-
-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;
-
-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;
-
-connection master;
-create table t1 (a int);
-sync_slave_with_master;
-insert into t1 values(1);
-connection master;
-delete from t1;
-sync_slave_with_master;
-select * from t1;
-
-insert into t1 values(1);
-connection master;
-insert into t1 values(2);
-update t1 set a=2;
-sync_slave_with_master;
-select * from t1;
-
-# cleanup
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_delete_no_where.test b/mysql-test/t/rpl_delete_no_where.test
new file mode 100644
index 00000000000..b4cbda64ea3
--- /dev/null
+++ b/mysql-test/t/rpl_delete_no_where.test
@@ -0,0 +1,2 @@
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_delete_no_where.test
diff --git a/mysql-test/t/rpl_do_grant.test b/mysql-test/t/rpl_do_grant.test
index 54287a67657..8d6f99e4bf1 100644
--- a/mysql-test/t/rpl_do_grant.test
+++ b/mysql-test/t/rpl_do_grant.test
@@ -1,6 +1,7 @@
-# Test that GRANT and SET PASSWORD are replicated to the slave
+# 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;
+-- source include/master-slave.inc
# do not be influenced by other tests.
connection master;
@@ -46,3 +47,52 @@ sync_with_master;
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/t/rpl_drop.test b/mysql-test/t/rpl_drop.test
index ebb33c92a20..b38007a755f 100644
--- a/mysql-test/t/rpl_drop.test
+++ b/mysql-test/t/rpl_drop.test
@@ -12,3 +12,5 @@ connection slave;
sync_with_master;
# End of 4.1 tests
+
+
diff --git a/mysql-test/t/rpl_empty_master_crash.test b/mysql-test/t/rpl_empty_master_crash.test
index 5f26bedc9fe..707d1eca8c2 100644
--- a/mysql-test/t/rpl_empty_master_crash.test
+++ b/mysql-test/t/rpl_empty_master_crash.test
@@ -1,6 +1,6 @@
source include/master-slave.inc;
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
#
diff --git a/mysql-test/t/rpl_error_ignored_table.test b/mysql-test/t/rpl_error_ignored_table.test
deleted file mode 100644
index 339d966dbb3..00000000000
--- a/mysql-test/t/rpl_error_ignored_table.test
+++ /dev/null
@@ -1,60 +0,0 @@
-# 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.
-
-source include/master-slave.inc;
-connection master;
-create table t1 (a int primary key);
-# generate an error that goes to the binlog
---error 1062
-insert into t1 values (1),(1);
-save_master_pos;
-connection slave;
-# as the t1 table is ignored on the slave, the slave should be able to sync
-sync_with_master;
-# The port number is different when doing the release build with
-# Do-compile, hence we have to replace the port number here accordingly
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-# check that the table has been ignored, because otherwise the test is nonsense
-show tables like 't1';
-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;
-connection master;
---error 0,1053,2013
-reap;
-connection master1;
---replace_column 2 # 5 #
-show binlog events from 98;
-save_master_pos;
-connection slave;
-# SQL slave thread should not have stopped (because table of the killed
-# query is in the ignore list).
-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/t/rpl_failed_optimize.test b/mysql-test/t/rpl_failed_optimize.test
index 57afaa89e83..4b329208fef 100644
--- a/mysql-test/t/rpl_failed_optimize.test
+++ b/mysql-test/t/rpl_failed_optimize.test
@@ -1,20 +1,6 @@
-source include/have_innodb.inc;
-source include/master-slave.inc;
-
-#
-# BUG#5551 "Failed OPTIMIZE TABLE is logged to binary log"
-# Replication should work when OPTIMIZE TABLE timeouts, and
-# when OPTIMIZE TABLE is executed on a non-existing table
-#
-
-CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
-BEGIN;
-INSERT INTO t1 VALUES (1);
-
-connection master1;
-OPTIMIZE TABLE t1;
-
-OPTIMIZE TABLE non_existing;
-sync_slave_with_master;
-
-# End of 4.1 tests
+#######################################
+# Wrapper for rpl_failed_optimize.test#
+#######################################
+-- source include/have_innodb.inc
+let $engine_type=InnoDB;
+-- source extra/rpl_tests/rpl_failed_optimize.test
diff --git a/mysql-test/t/rpl_flush_tables.test b/mysql-test/t/rpl_flush_tables.test
deleted file mode 100644
index 92aef9c85d0..00000000000
--- a/mysql-test/t/rpl_flush_tables.test
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Test of replicating FLUSH TABLES to make
-# RENAME TABLE work with MERGE tables on the slave.
-# Test of FLUSH NO_WRITE_TO_BINLOG by the way.
-#
---source include/master-slave.inc
-# Skipped on Windows because it can't handle a table underlying an open
-# merge table getting renamed.
---source include/not_windows.inc
-
-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);
-# We force the slave to open t3 (because we want to try confusing him) with this :
-insert into t4 select * from t3;
-rename table t1 to t5, t2 to t1;
-# RENAME may have confused the master (this is a known bug): so FLUSH tables,
-# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
-flush no_write_to_binlog tables;
-# Check that it's not in the binlog.
---replace_result $SERVER_VERSION SERVER_VERSION
---replace_column 2 # 5 #
-show binlog events;
-# Check that the master is not confused.
-select * from t3;
-# This FLUSH should go into the binlog to not confuse the slave.
-flush tables;
-# Check that it's in the binlog.
---replace_result $SERVER_VERSION SERVER_VERSION
---replace_column 2 # 5 #
-show binlog events;
-save_master_pos;
-connection slave;
-sync_with_master;
-# Check that the slave is not confused.
-select * from t3;
-# Note that all this confusion may cause warnings 'table xx is open on rename'
-# in the .err files; these are not fatal and are not reported by mysql-test-run.
-
-stop slave;
-connection master;
-drop table t1;
-connection slave;
-flush tables with read lock;
-start slave;
-sleep 1;
---error 1192
-stop slave;
-
-# End of 4.1 tests
-# Adding comment for force manual merge 5.0 -> wl1012. Delete me if needed.
diff --git a/mysql-test/t/rpl_flush_log_loop-master.opt b/mysql-test/t/rpl_flushlog_loop-master.opt
index 4f6e0f3d00c..4f6e0f3d00c 100644
--- a/mysql-test/t/rpl_flush_log_loop-master.opt
+++ b/mysql-test/t/rpl_flushlog_loop-master.opt
diff --git a/mysql-test/t/rpl_flush_log_loop-master.sh b/mysql-test/t/rpl_flushlog_loop-master.sh
index 9e56af99f5c..9e56af99f5c 100755
--- a/mysql-test/t/rpl_flush_log_loop-master.sh
+++ b/mysql-test/t/rpl_flushlog_loop-master.sh
diff --git a/mysql-test/t/rpl_flush_log_loop-slave.opt b/mysql-test/t/rpl_flushlog_loop-slave.opt
index d1373f139b1..d1373f139b1 100644
--- a/mysql-test/t/rpl_flush_log_loop-slave.opt
+++ b/mysql-test/t/rpl_flushlog_loop-slave.opt
diff --git a/mysql-test/t/rpl_flush_log_loop-slave.sh b/mysql-test/t/rpl_flushlog_loop-slave.sh
index b8814e059a9..b8814e059a9 100755
--- a/mysql-test/t/rpl_flush_log_loop-slave.sh
+++ b/mysql-test/t/rpl_flushlog_loop-slave.sh
diff --git a/mysql-test/t/rpl_flush_log_loop.test b/mysql-test/t/rpl_flushlog_loop.test
index 6e45047bd30..46f41e9a5e3 100644
--- a/mysql-test/t/rpl_flush_log_loop.test
+++ b/mysql-test/t/rpl_flushlog_loop.test
@@ -1,15 +1,23 @@
# Testing if "flush logs" command bouncing resulting in logs created in a loop
# in case of bi-directional replication
+-- source include/master-slave.inc
-source include/master-slave.inc;
+# This test is dependent on the actual events written to the binary
+# log. To not break statement-based testing, we only run this test
+# under statement-based logging.
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;
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;
@@ -18,7 +26,5 @@ sleep 5;
flush logs;
sleep 5;
--replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_foreign_key_innodb.test b/mysql-test/t/rpl_foreign_key_innodb.test
new file mode 100644
index 00000000000..8615a008739
--- /dev/null
+++ b/mysql-test/t/rpl_foreign_key_innodb.test
@@ -0,0 +1,6 @@
+###################################
+# Wrapper for rpl_foreign_key.test#
+###################################
+-- source include/have_innodb.inc
+let $engine_type=INNODB;
+-- source extra/rpl_tests/rpl_foreign_key.test
diff --git a/mysql-test/t/rpl_heap.test b/mysql-test/t/rpl_heap.test
index 3ee335fe58d..03c9070678b 100644
--- a/mysql-test/t/rpl_heap.test
+++ b/mysql-test/t/rpl_heap.test
@@ -1,3 +1,6 @@
+# Requires statement logging
+-- source include/have_binlog_format_statement.inc
+
# You must run this test with --manager.
require_manager;
@@ -18,6 +21,7 @@ drop table if exists t1;
create table t1 type=HEAP select 10 as a;
insert into t1 values(11);
save_master_pos;
+--replace_column 2 # 5 #
show binlog events from 79;
connection slave;
reset slave;
@@ -35,6 +39,7 @@ select * from t1;
# (the LIMIT is to not use the query cache)
select * from t1 limit 10;
save_master_pos;
+--replace_column 2 # 5 #
show binlog events in 'master-bin.002' from 79;
connection slave;
diff --git a/mysql-test/t/rpl_insert_id.test b/mysql-test/t/rpl_insert_id.test
index 49d3a03640c..62a9fdb4d56 100644
--- a/mysql-test/t/rpl_insert_id.test
+++ b/mysql-test/t/rpl_insert_id.test
@@ -1,77 +1,6 @@
-# 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
-
-source include/master-slave.inc;
-source include/have_innodb.inc;
-connection master;
-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());
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
-select * from t2;
-connection master;
-#check if multi-line inserts,
-#which set last_insert_id to the first id inserted,
-#are replicated the same way
-drop table t1;
-drop table t2;
---disable_warnings
-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;
---enable_warnings
-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;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
-select * from t2;
-connection master;
-
-# 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;
-select * from t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
-select * from t2;
-connection master;
-drop table t1;
-drop table t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-#
-# Bug#8412: Error codes reported in binary log for CHARACTER SET,
-# FOREIGN_KEY_CHECKS
-#
-connection master;
-SET TIMESTAMP=1000000000;
-CREATE TABLE t1 ( a INT UNIQUE );
-SET FOREIGN_KEY_CHECKS=0;
---error 1062
-INSERT INTO t1 VALUES (1),(1);
-sync_slave_with_master;
-
-# End of 4.1 tests
+#################################
+# Wrapper for rpl_insert_id.test#
+#################################
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+-- source extra/rpl_tests/rpl_insert_id.test
diff --git a/mysql-test/t/rpl_insert_ignore.test b/mysql-test/t/rpl_insert_ignore.test
index a6cc69b1df8..61222b542ac 100644
--- a/mysql-test/t/rpl_insert_ignore.test
+++ b/mysql-test/t/rpl_insert_ignore.test
@@ -1,73 +1,7 @@
-# Testcase for BUG#6287 "Slave skips auto_increment values in Replication with InnoDB"
-# The bug was that if on master, INSERT IGNORE ignored some
-# rows, and the table was InnoDB with auto_inc column, then on slave
-# some rows received an auto_inc bigger than on master.
-# Slave needs to be started with --innodb to store table in InnoDB.
-# Same test for MyISAM (which had no bug).
-
+#####################################
+# Wrapper for rpl_insert_ignore.test#
+#####################################
-- source include/have_innodb.inc
-
--- source include/master-slave.inc
-
-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);
-
-# An alternation of values which will conflict in t1 and will not.
-
-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;
-
-# Compare results
-
-SELECT * FROM t1 ORDER BY a;
-
-sync_slave_with_master;
-SELECT * FROM t1 ORDER BY a;
-
-# Now do the same for MyISAM
-
-connection master;
-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;
-
-sync_slave_with_master;
-SELECT * FROM t1 ORDER BY a;
-
-connection master;
-drop table t1, t2;
-sync_slave_with_master;
-
-# End of 4.1 tests
+let $engine_type=innodb;
+let $engine_type2=myisam;
+-- source extra/rpl_tests/rpl_insert_ignore.test
diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test
index 00121092bbf..72914717a12 100644
--- a/mysql-test/t/rpl_loaddata.test
+++ b/mysql-test/t/rpl_loaddata.test
@@ -1,153 +1,2 @@
-# See if replication of a "LOAD DATA in an autoincrement column"
-# Honours autoincrement values
-# i.e. if the master and slave have the same sequence
-#
-# check replication of load data for temporary tables with additional
-# parameters
-#
-# check if duplicate entries trigger an error (they should unless IGNORE or
-# REPLACE was used on the master) (bug 571).
-#
-# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
-# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
-
-source include/master-slave.inc;
-
-connection slave;
-reset master;
-connection master;
-
-create table t1(a int not null auto_increment, b int, primary key(a) );
-load data infile '../../std_data/rpl_loaddata.dat' into table t1;
-
-create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
-load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
-
-create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
-insert into t3 select * from t2;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-
-select * from t1;
-select * from t3;
-# We want to be sure that LOAD DATA is in the slave's binlog.
-# But we can't simply read this binlog, because as the slave has not been
-# restarted for this test, the file_id is uncertain (would cause test
-# failures). So instead, we test if the binlog looks long enough to
-# contain LOAD DATA. Since 5.0.3 we assume that binlog of 1292 is ok.
-# If LOAD DATA was not logged, the binlog would be shorter.
-show master status;
-
-connection master;
-
-drop table t1;
-drop table t2;
-drop table t3;
-create table t1(a int, b int, unique(b));
-
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# See if slave stops when there's a duplicate entry for key error in LOAD DATA
-
-insert into t1 values(1,10);
-
-connection master;
-load data infile '../../std_data/rpl_loaddata.dat' into table t1;
-
-save_master_pos;
-connection slave;
-# The SQL slave thread should be stopped now.
-wait_for_slave_to_stop;
-
-# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START
-# SLAVE, even though we are not executing any event (as sql_slave_skip_counter
-# takes us directly to the end of the relay log).
-
-set global sql_slave_skip_counter=1;
-start slave;
-sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-
-# Trigger error again to test CHANGE MASTER
-
-connection master;
-set sql_log_bin=0;
-delete from t1;
-set sql_log_bin=1;
-load data infile '../../std_data/rpl_loaddata.dat' into table t1;
-save_master_pos;
-connection slave;
-# The SQL slave thread should be stopped now.
-# Exec_Master_Log_Pos should point to the start of Execute event
-# for last load data.
-wait_for_slave_to_stop;
-
-# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS.
-stop slave;
-change master to master_user='test';
-change master to master_user='root';
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-
-# Trigger error again to test RESET SLAVE
-
-set global sql_slave_skip_counter=1;
-start slave;
-sync_with_master;
-connection master;
-set sql_log_bin=0;
-delete from t1;
-set sql_log_bin=1;
-load data infile '../../std_data/rpl_loaddata.dat' into table t1;
-save_master_pos;
-connection slave;
-# The SQL slave thread should be stopped now.
-wait_for_slave_to_stop;
-
-# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
-stop slave;
-reset slave;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-
-# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
-
-connection master;
-reset master;
-create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
-unique(day)) engine=MyISAM; # no transactions
---error 1062
-load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
-terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
-'\n##\n' starting by '>' ignore 1 lines;
-select * from t2;
-save_master_pos;
-connection slave;
-start slave;
-sync_with_master;
-select * from t2;
-
-# verify that if no error on slave, this is an error
-
-alter table t2 drop key day;
-connection master;
-delete from t2;
---error 1062
-load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
-terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
-'\n##\n' starting by '>' ignore 1 lines;
-connection slave;
-wait_for_slave_to_stop;
-drop table t2;
-connection master;
-drop table t2;
-
-# End of 4.1 tests
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_loaddata.test
diff --git a/mysql-test/t/rpl_loaddata2.test b/mysql-test/t/rpl_loaddata2.test
new file mode 100644
index 00000000000..22429666d5f
--- /dev/null
+++ b/mysql-test/t/rpl_loaddata2.test
@@ -0,0 +1,8 @@
+--source include/master-slave.inc
+
+CREATE TABLE t1 (word CHAR(20) NOT NULL);
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
+SELECT * FROM t1;
+sync_slave_with_master;
+SELECT * FROM t1;
+
diff --git a/mysql-test/t/rpl_loaddata_rule_m.test b/mysql-test/t/rpl_loaddata_rule_m.test
deleted file mode 100644
index c956f2c7720..00000000000
--- a/mysql-test/t/rpl_loaddata_rule_m.test
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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).
-
-source include/master-slave.inc;
-
---disable_warnings
-drop database if exists mysqltest;
---enable_warnings
-
-connection slave;
-stop slave; # don't need slave for this test
-
-# Test logging on master
-
-connection master;
-# 'test' is the current database
-create database mysqltest;
-create table t1(a int, b int, unique(b));
-use mysqltest;
-load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
-# Starting from 5.0.3 LOAD DATA is replicated much in the same way as ordinary
-# query so "show binlog ..." should show two events (before 5.0.3 no events
-# were returned).
---replace_column 2 # 5 #
-show binlog events from 98;
-drop database mysqltest;
-
-# End of 4.1 tests
-# Adding comment for force manual merge 5.0 -> wl1012: Delete me
diff --git a/mysql-test/t/rpl_loaddata_rule_m-master.opt b/mysql-test/t/rpl_loaddata_s-slave.opt
index 9d4a8f0b95e..9d4a8f0b95e 100644
--- a/mysql-test/t/rpl_loaddata_rule_m-master.opt
+++ b/mysql-test/t/rpl_loaddata_s-slave.opt
diff --git a/mysql-test/t/rpl_loaddata_rule_s.test b/mysql-test/t/rpl_loaddata_s.test
index 98fad3cc06f..c49fe461d7b 100644
--- a/mysql-test/t/rpl_loaddata_rule_s.test
+++ b/mysql-test/t/rpl_loaddata_s.test
@@ -2,13 +2,16 @@
# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules.
# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
-source include/master-slave.inc;
+-- source include/have_binlog_format_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 t1(a int, b int, unique(b));
+create table test.t1(a int, b int, unique(b));
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
# Test logging on slave;
@@ -16,7 +19,6 @@ load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
save_master_pos;
connection slave;
sync_with_master;
-select count(*) from t1; # check that LOAD was replicated
-show binlog events from 98; # should be nothing
-
-# End of 4.1 tests
+select count(*) from test.t1; # check that LOAD was replicated
+--replace_column 2 # 5 #
+show binlog events from 102; # should be nothing
diff --git a/mysql-test/t/rpl_loadfile.test b/mysql-test/t/rpl_loadfile.test
new file mode 100644
index 00000000000..58d5717b7e8
--- /dev/null
+++ b/mysql-test/t/rpl_loadfile.test
@@ -0,0 +1,47 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+#############################################################################
+# TEST: To test the LOAD_FILE() in rbr #
+#############################################################################
+
+# 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/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/words2.dat') WHERE a=2;
+end|
+delimiter ;|
+
+CALL test.p1();
+SELECT * FROM test.t1;
+save_master_pos;
+sync_slave_with_master;
+connection slave;
+SHOW CREATE TABLE test.t1;
+SELECT * FROM test.t1;
+
+connection master;
+# Lets cleanup
+#show binlog events;
+
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE test.t1;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test
deleted file mode 100644
index 1f71d2981c5..00000000000
--- a/mysql-test/t/rpl_log.test
+++ /dev/null
@@ -1,113 +0,0 @@
-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, 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;
-stop slave;
-reset master;
-reset slave;
-# We are going to read the slave's binlog which contains file_id (for some LOAD
-# DATA INFILE); to make it repeatable (not influenced by other tests), we need
-# to stop and start the slave, to be sure file_id will start from 1.
-# This can be done with 'server_stop slave', but
-# this would require the manager, so most of the time the test will be skipped
-# :(
-# To workaround this, I (Guilhem) add a (empty) rpl_log-slave.opt (because when
-# mysql-test-run finds such a file it restarts the slave before doing the
-# test). That's not very elegant but I could find no better way, sorry.
-
-let $VERSION=`select version()`;
-
-connection master;
-reset master;
-create table t1(n int not null auto_increment primary key);
-insert into t1 values (NULL);
-drop table t1;
-create table t1 (word char(20) not null);
-load data infile '../../std_data/words.dat' into table t1 ignore 1 lines;
-select count(*) from t1;
-drop table t1;
---replace_result $VERSION VERSION
-show binlog events;
-show binlog events from 98 limit 1;
-show binlog events from 98 limit 2;
-show binlog events from 98 limit 2,1;
-flush logs;
-
-# We need an extra update before doing save_master_pos.
-# Otherwise, an unlikely scenario may occur:
-# * When the master's binlog_dump thread reads the end of master-bin.001,
-# it send the rotate event which is at this end, plus a fake rotate event
-# because it's starting to read a new binlog.
-# save_master_pos will record the position of the first of the two rotate
-# (because the fake one is not in the master's binlog anyway).
-# * Later the slave waits for the position of the first rotate event,
-# and it may quickly stop (in 'slave stop') without having received the fake
-# one.
-# So, depending on a few milliseconds, we end up with 2 rotate events in the
-# relay log or one, which influences the output of SHOW SLAVE STATUS, making
-# it not predictable and causing random test failures.
-# To make it predictable, we do a useless update now, but which has the
-# interest of making the slave catch both rotate events.
-
-create table t5 (a int);
-drop table t5;
-
-# Sync slave and force it to start on another binary log
-
-save_master_pos;
-connection slave;
-# Note that the above 'slave start' will cause a 3rd rotate event (a fake one)
-# to go into the relay log (the master always sends a fake one when replication
-# starts).
-start slave;
-sync_with_master;
-flush logs;
-stop slave;
-connection master;
-
-# Create some entries for second log
-
-create table t1 (n int);
-insert into t1 values (1);
-drop table t1;
---replace_result $VERSION VERSION
-show binlog events;
---replace_result $VERSION VERSION
-show binlog events in 'master-bin.000002';
-show binary logs;
-save_master_pos;
-connection slave;
-start slave;
-sync_with_master;
-show binary logs;
---replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
-show binlog events in 'slave-bin.000001' from 4;
---replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
-show binlog events in 'slave-bin.000002' from 4;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-
-# Need to recode the following
-
-#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=4 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=79 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=311 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=4 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=122 and master_server_id=1;
-
---error 1220
-show binlog events in 'slave-bin.000005' from 4;
-
-# End of 4.1 tests
-# Adding comment for force manual merge 5.0 -> wl1012: Delete me
diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test
index 979b146bb22..44c00f80e6d 100644
--- a/mysql-test/t/rpl_log_pos.test
+++ b/mysql-test/t/rpl_log_pos.test
@@ -1,19 +1,23 @@
#
# 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;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
stop slave;
-change master to master_log_pos=73;
+change master to master_log_pos=74;
start slave;
sleep 5;
stop slave;
-change master to master_log_pos=73;
+change master to master_log_pos=74;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
@@ -23,13 +27,14 @@ sleep 5;
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
stop slave;
-change master to master_log_pos=173;
+change master to master_log_pos=177;
start slave;
sleep 2;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
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;
@@ -38,7 +43,7 @@ insert into t1 values (1),(2),(3);
save_master_pos;
connection slave;
stop slave;
-change master to master_log_pos=98;
+change master to master_log_pos=102;
start slave;
sync_with_master;
select * from t1;
diff --git a/mysql-test/t/rpl_max_relay_size.test b/mysql-test/t/rpl_max_relay_size.test
deleted file mode 100644
index 9b6b06e0b14..00000000000
--- a/mysql-test/t/rpl_max_relay_size.test
+++ /dev/null
@@ -1,96 +0,0 @@
-# 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.
-
-source include/master-slave.inc;
-connection slave;
-stop slave;
-connection master;
-# Generate a big enough master's binlog to cause relay log rotations
-create table t1 (a int);
-let $1=800;
-disable_query_log;
-begin;
-while ($1)
-{
-# eval means expand $ expressions
- eval insert into t1 values( $1 );
- dec $1;
-}
-enable_query_log;
-drop table t1;
-save_master_pos;
-connection slave;
-reset slave;
-set global max_binlog_size=8192;
-set global max_relay_log_size=8192-1; # mapped to 4096
-select @@global.max_relay_log_size;
-start slave;
-sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-stop slave;
-reset slave;
-set global max_relay_log_size=(5*4096);
-select @@global.max_relay_log_size;
-start slave;
-sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-stop slave;
-reset slave;
-set global max_relay_log_size=0;
-select @@global.max_relay_log_size;
-start slave;
-sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-
-# Tests below are mainly to ensure that we have not coded with wrong assumptions
-
-stop slave;
-reset slave;
-# test of relay log rotation when the slave is stopped
-# (to make sure it does not crash).
-flush logs;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-
-reset slave;
-start slave;
-sync_with_master;
-# test of relay log rotation when the slave is started
-flush logs;
-# We have now easy way to be sure that the SQL thread has now deleted the
-# log we just closed. But a trick to achieve this is do an update on the master.
-connection master;
-create table t1 (a int);
-save_master_pos;
-connection slave;
-sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-# one more rotation, to be sure Relay_Log_Space is correctly updated
-flush logs;
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-
-connection master;
-# test that the absence of relay logs does not make a master crash
-flush logs;
-show master status;
-
-# End of 4.1 tests
-#
diff --git a/mysql-test/t/rpl_multi_delete.test b/mysql-test/t/rpl_multi_delete.test
index 4a8c0ab6912..2fd7b820b1a 100644
--- a/mysql-test/t/rpl_multi_delete.test
+++ b/mysql-test/t/rpl_multi_delete.test
@@ -16,26 +16,10 @@ sync_with_master;
select * from t1;
select * from t2;
-# End of 4.1 tests
-
-# Check if deleting 0 rows is binlogged (BUG#13348)
-
-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);
-insert into t2 values(1);
-
-connection master;
-DELETE t1.*, t2.* from t1, t2;
-
-sync_slave_with_master;
-select * from t1;
-select * from t2;
-
connection master;
drop table t1,t2;
-sync_slave_with_master;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+# End of 4.1 tests
diff --git a/mysql-test/t/rpl000001-slave.opt b/mysql-test/t/rpl_multi_engine-slave.opt
index 627becdbfb5..627becdbfb5 100644
--- a/mysql-test/t/rpl000001-slave.opt
+++ b/mysql-test/t/rpl_multi_engine-slave.opt
diff --git a/mysql-test/t/rpl_multi_engine.test b/mysql-test/t/rpl_multi_engine.test
new file mode 100644
index 00000000000..b0879757468
--- /dev/null
+++ b/mysql-test/t/rpl_multi_engine.test
@@ -0,0 +1,99 @@
+# See if replication between MyISAM, MEMORY and InnoDB works.
+
+-- 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;
+
+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;
+
+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;
+
+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;
+sync_slave_with_master;
+
+# End of 5.1 test case
diff --git a/mysql-test/t/rpl_multi_query.test b/mysql-test/t/rpl_multi_query.test
deleted file mode 100644
index b4cd88f756e..00000000000
--- a/mysql-test/t/rpl_multi_query.test
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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)
-
-# PS doesn't support multi-statements
---disable_ps_protocol
-
-source include/master-slave.inc;
---disable_warnings
-drop database if exists mysqltest;
---enable_warnings
-create database mysqltest;
-
-delimiter /;
-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)/
-delimiter ;/
-sync_slave_with_master;
-select * from mysqltest.t1;
-connection master;
---replace_column 2 # 5 #
-show binlog events from 98;
-drop database mysqltest;
-sync_slave_with_master;
-
-# End of 4.1 tests
-#
diff --git a/mysql-test/t/rpl_multi_update.test b/mysql-test/t/rpl_multi_update.test
index f6a960434ad..cc147eb3263 100644
--- a/mysql-test/t/rpl_multi_update.test
+++ b/mysql-test/t/rpl_multi_update.test
@@ -1,49 +1,2 @@
-source include/master-slave.inc;
-
-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;
-SELECT * FROM t2 ORDER BY a;
-
-UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
-
-# Check if updating 0 rows is binlogged (BUG#13348)
-
-connection master;
-delete from t1;
-delete from t2;
-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;
-
-connection master;
-drop table t1, t2;
-sync_slave_with_master;
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_multi_update.test
diff --git a/mysql-test/t/rpl_multi_update2.test b/mysql-test/t/rpl_multi_update2.test
index a78b1901f51..484d8dd7633 100644
--- a/mysql-test/t/rpl_multi_update2.test
+++ b/mysql-test/t/rpl_multi_update2.test
@@ -1,62 +1,2 @@
-# Let's verify that multi-update is not always skipped by slave if
-# some replicate-* rules exist.
-# (BUG#7011)
-
-source include/master-slave.inc;
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-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;
-SELECT * FROM t2 ORDER BY a;
-
-UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-connection master;
-drop table t1,t2;
-sync_slave_with_master;
-
-#
-# BUG#13236 multi-update with subquery & --replicate-ignore-table
-#
-reset master;
-
-connection 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;
-sync_slave_with_master;
-
-connection slave;
-select * from t1;
-
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
+let $engine_type=MyISAM;
+--source extra/rpl_tests/rpl_multi_update2.test
diff --git a/mysql-test/t/rpl_multi_update3.test b/mysql-test/t/rpl_multi_update3.test
index 36ac7a59cb3..d03f03e5638 100644
--- a/mysql-test/t/rpl_multi_update3.test
+++ b/mysql-test/t/rpl_multi_update3.test
@@ -1,220 +1,2 @@
-source include/master-slave.inc;
-
-##############################################################################
-#
-# Let's verify that multi-update with a subselect does not cause the slave to crash
-# (BUG#10442)
-#
---disable_query_log
-SELECT '-------- Test for BUG#9361 --------' as "";
---enable_query_log
-
-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;
-SELECT * FROM t2 ORDER BY a;
-
-UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-sync_slave_with_master;
-connection slave;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-connection master;
-drop table t1,t2;
-
-##############################################################################
-#
-# Test for BUG#9361:
-# Subselects should work inside multi-updates
-#
---disable_query_log
-SELECT '-------- Test 1 for BUG#9361 --------' as "";
---enable_query_log
-
-connection master;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
-
-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 one row per table
-INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
-INSERT INTO t2 VALUES (1, 'baz');
-
-# This should update the row in t1
-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';
-
-sync_slave_with_master;
-connection slave;
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-connection master;
-DROP TABLE t1, t2;
-
-##############################################################################
-#
-# Second test for BUG#9361
-#
-
---disable_query_log
-SELECT '-------- Test 2 for BUG#9361 --------' as "";
---enable_query_log
-
-connection master;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP TABLE IF EXISTS t3;
---enable_warnings
-
-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;
-
-sync_slave_with_master;
-connection slave;
-
-SELECT * FROM t1;
-
-connection master;
-DROP TABLE t1, t2, t3;
-
-##############################################################################
-#
-# BUG#12618
-#
-# TEST: Replication of a statement containing a join in a multi-update.
-
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS 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);
-
-# This update sets t2 to the minimal prices for each product
-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 "";
-select * from t1;
-select * from t2;
-
-sync_slave_with_master;
-
-select "-- SLAVE AFTER JOIN --" as "";
-select * from t1;
-select * from t2;
-
-# End of 4.1 tests
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_multi_update3.test
diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_openssl.test
index e15eb9b179a..8a85443e71f 100644
--- a/mysql-test/t/rpl_openssl.test
+++ b/mysql-test/t/rpl_openssl.test
@@ -45,7 +45,7 @@ select * from t1;
#checking show slave status
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
show slave status;
#checking if replication works without ssl also performing clean up
@@ -58,7 +58,7 @@ save_master_pos;
connection slave;
sync_with_master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
show slave status;
# End of 4.1 tests
diff --git a/mysql-test/t/rpl_redirect.test b/mysql-test/t/rpl_redirect.test
index beb18348b40..c001d85d2f8 100644
--- a/mysql-test/t/rpl_redirect.test
+++ b/mysql-test/t/rpl_redirect.test
@@ -14,7 +14,7 @@ sync_with_master;
#discover slaves
connection master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
SHOW SLAVE STATUS;
--replace_result $SLAVE_MYPORT SLAVE_PORT
SHOW SLAVE HOSTS;
diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test
index 04f03367e20..99fd870e68f 100644
--- a/mysql-test/t/rpl_relayrotate.test
+++ b/mysql-test/t/rpl_relayrotate.test
@@ -1,75 +1,3 @@
-# When the relay log gets rotated while the I/O thread
-# is reading a transaction, the transaction spans on two or more
-# relay logs. If STOP SLAVE occurs while the SQL thread is
-# executing a part of the transaction in the non-first relay logs,
-# we test if START SLAVE will resume in the beginning of the
-# transaction (i.e., step back to the first relay log)
-
-# The slave is started with max_binlog_size=16384 bytes,
-# to force many rotations (approximately 30 rotations)
-
-source include/have_innodb.inc;
-source include/master-slave.inc;
-connection slave;
-stop slave;
-connection master;
---disable_warnings
-create table t1 (a int) engine=innodb;
---enable_warnings
-let $1=8000;
-disable_query_log;
-begin;
-while ($1)
-{
-# eval means expand $ expressions
- eval insert into t1 values( $1 );
- dec $1;
-}
-commit;
-# This will generate a 500kB master's binlog,
-# which corresponds to 30 slave's relay logs.
-enable_query_log;
-save_master_pos;
-connection slave;
-reset slave;
-start slave;
-# We wait 1 sec for the SQL thread to be somewhere in
-# the middle of the transaction, hopefully not in
-# the first relay log, and hopefully before the COMMIT.
-# Usually it stops when the SQL thread is around the 15th relay log.
-# We cannot use MASTER_POS_WAIT() as master's position
-# increases only when the slave executes the COMMIT.
-# Note that except when using Valgrind, 1 second is enough for the I/O slave
-# thread to fetch the whole master's binlog.
-sleep 1;
-stop slave;
-# We suppose the SQL thread stopped before COMMIT.
-# If so the transaction was rolled back
-# and the table is now empty.
-# Now restart
-start slave;
-# And see if the table contains '8000'
-# which proves that the transaction restarted at
-# the right place.
-# We must wait for the transaction to commit before
-# reading:
-sync_with_master;
-select max(a) from t1;
-connection master;
-
-# The following DROP is a very important cleaning task:
-# imagine the next test is run with --skip-innodb: it will do
-# DROP TABLE IF EXISTS t1; but this will delete the frm and leave
-# some data in the InnoDB datafile (because at that time mysqld
-# does not know about InnoDB : --skip-innodb). So if later in the
-# test suite a test wants to create an InnoDB table called t1, it
-# will fail with
-# InnoDB: Error: table t1 already exists in InnoDB internal
-# InnoDB: data dictionary. Have you deleted the .frm file etc
-drop table t1;
-# wait until this drop is executed on slave
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
+-- source include/have_innodb.inc
+let $engine_type=innodb;
+-- source extra/rpl_tests/rpl_relayrotate.test
diff --git a/mysql-test/t/rpl_replicate_do.test b/mysql-test/t/rpl_replicate_do.test
index b8559af2394..5a2cb50d53a 100644
--- a/mysql-test/t/rpl_replicate_do.test
+++ b/mysql-test/t/rpl_replicate_do.test
@@ -1,6 +1,5 @@
# 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;
@@ -33,7 +32,7 @@ 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 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
show slave status;
#
diff --git a/mysql-test/t/rpl_replicate_ignore_db-slave.opt b/mysql-test/t/rpl_replicate_ignore_db-slave.opt
new file mode 100644
index 00000000000..6e3aed44f78
--- /dev/null
+++ b/mysql-test/t/rpl_replicate_ignore_db-slave.opt
@@ -0,0 +1 @@
+--replicate_ignore_db=mysqltest1
diff --git a/mysql-test/t/rpl_replicate_ignore_db.test b/mysql-test/t/rpl_replicate_ignore_db.test
new file mode 100644
index 00000000000..bcfef919fad
--- /dev/null
+++ b/mysql-test/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/t/rpl_reset_slave.test b/mysql-test/t/rpl_reset_slave.test
deleted file mode 100644
index 00b1cf68294..00000000000
--- a/mysql-test/t/rpl_reset_slave.test
+++ /dev/null
@@ -1,51 +0,0 @@
-# See SHOW SLAVE STATUS displays well after RESET SLAVE (it should display the
-# --master-* options from mysqld, as this is what is going to be used next time
-# slave threads will be started). In bug 985, it displayed old values (of before
-# RESET SLAVE).
-# See if slave crashes when doing a CREATE TEMPORARY TABLE twice, separated by
-# RESET SLAVE.
-
-source include/master-slave.inc;
-connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-
-stop slave;
-change master to master_user='test';
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-
-reset slave;
---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;
-
-# test of crash with temp tables & RESET SLAVE
-# (test to see if RESET SLAVE clears temp tables in memory and disk)
-stop slave;
-reset slave;
-start slave;
-connection master;
-create temporary table t1 (a int);
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
-reset slave;
-start slave;
-sync_with_master;
-show status like 'slave_open_temp_tables';
-
-# End of 4.1 tests
-#
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index b125408d89e..1f5f4ebbed2 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -9,6 +9,9 @@
# changes
# - Test creating a duplicate key error and recover from it
+# Requires statement logging
+-- source include/have_binlog_format_statement.inc
+
connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
--disable_warnings
drop table if exists t1, t2, t3, t4;
@@ -56,7 +59,7 @@ 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 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
select * from t1;
connection master;
@@ -109,7 +112,7 @@ show binary logs;
insert into t2 values (65);
sync_slave_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
show slave status;
select * from t2;
@@ -141,7 +144,7 @@ sync_with_master;
select * from t4;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--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
diff --git a/mysql-test/t/rpl_row_001.test b/mysql-test/t/rpl_row_001.test
new file mode 100644
index 00000000000..923ed16e8b3
--- /dev/null
+++ b/mysql-test/t/rpl_row_001.test
@@ -0,0 +1,2 @@
+let $engine_type=MYISAM;
+-- source extra/rpl_tests/rpl_row_001.test
diff --git a/mysql-test/t/rpl_row_4_bytes-master.opt b/mysql-test/t/rpl_row_4_bytes-master.opt
new file mode 100644
index 00000000000..0e1929507f7
--- /dev/null
+++ b/mysql-test/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/t/rpl_row_4_bytes.test b/mysql-test/t/rpl_row_4_bytes.test
new file mode 100644
index 00000000000..26a4e2f5bfe
--- /dev/null
+++ b/mysql-test/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 TABLE t1,t2;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_row_EE_err.test b/mysql-test/t/rpl_row_EE_err.test
new file mode 100644
index 00000000000..7895a66adfd
--- /dev/null
+++ b/mysql-test/t/rpl_row_EE_err.test
@@ -0,0 +1,2 @@
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_row_EE_err.test
diff --git a/mysql-test/t/rpl_row_NOW.test b/mysql-test/t/rpl_row_NOW.test
new file mode 100644
index 00000000000..dba6fb16bb2
--- /dev/null
+++ b/mysql-test/t/rpl_row_NOW.test
@@ -0,0 +1,73 @@
+#############################################################################
+# 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 > ./var/tmp/NOW_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > ./var/tmp/NOW_slave.sql
+
+# lets cleanup
+DROP TABLE IF EXISTS mysqltest1.t1;
+DROP FUNCTION mysqltest1.f1;
+
+# 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 mysql-test/var/tmp
+
+exec diff ./var/tmp/NOW_master.sql ./var/tmp/NOW_slave.sql;
+
+# If all is good, when can cleanup our dump files.
+system rm ./var/tmp/NOW_master.sql;
+system rm ./var/tmp/NOW_slave.sql;
+
+sync_slave_with_master;
+# End of 5.1 test case
diff --git a/mysql-test/t/rpl_row_USER.test b/mysql-test/t/rpl_row_USER.test
new file mode 100644
index 00000000000..85eaf571d4a
--- /dev/null
+++ b/mysql-test/t/rpl_row_USER.test
@@ -0,0 +1,54 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+#############################################################################
+# TEST: To test the UUID() in rbr #
+#############################################################################
+
+# 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;
+sync_slave_with_master;
+SELECT * FROM mysqltest1.t1;
+
+connection master;
+# Lets cleanup
+#show binlog events;
+
+DROP DATABASE mysqltest1;
+REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
+REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
+
+sync_slave_with_master;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_UUID.test b/mysql-test/t/rpl_row_UUID.test
new file mode 100644
index 00000000000..477cb31c504
--- /dev/null
+++ b/mysql-test/t/rpl_row_UUID.test
@@ -0,0 +1,2 @@
+let $engine_type=myisam;
+--source extra/rpl_tests/rpl_row_UUID.test
diff --git a/mysql-test/t/rpl_row_basic_2myisam.test b/mysql-test/t/rpl_row_basic_2myisam.test
new file mode 100644
index 00000000000..471f4d6dbc5
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_2myisam.test
@@ -0,0 +1,3 @@
+let $type= 'MYISAM' ;
+let $extra_index= ;
+-- source include/rpl_row_basic.inc
diff --git a/mysql-test/t/rpl_row_basic_3innodb-slave.opt b/mysql-test/t/rpl_row_basic_3innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_3innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_basic_3innodb.test b/mysql-test/t/rpl_row_basic_3innodb.test
new file mode 100644
index 00000000000..b97f1543cc3
--- /dev/null
+++ b/mysql-test/t/rpl_row_basic_3innodb.test
@@ -0,0 +1,6 @@
+-- source include/have_innodb.inc
+
+let $type= 'INNODB' ;
+let $extra_index= ;
+-- source include/rpl_row_basic.inc
+
diff --git a/mysql-test/t/rpl_row_charset.test b/mysql-test/t/rpl_row_charset.test
new file mode 100644
index 00000000000..81658fab041
--- /dev/null
+++ b/mysql-test/t/rpl_row_charset.test
@@ -0,0 +1,2 @@
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_row_charset.test
diff --git a/mysql-test/t/rpl_row_create_table.test b/mysql-test/t/rpl_row_create_table.test
new file mode 100644
index 00000000000..faabf489bba
--- /dev/null
+++ b/mysql-test/t/rpl_row_create_table.test
@@ -0,0 +1,108 @@
+# Testing table creations for row-based replication.
+
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+--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.
+connection slave;
+--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 # 5 #
+--query_vertical SHOW BINLOG EVENTS FROM 212
+--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 1062
+CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
+# Shouldn't be written to the binary log
+SHOW BINLOG EVENTS FROM 1256;
+
+# Test that INSERT-SELECT works the same way as for SBR.
+CREATE TABLE t7 (a INT, b INT UNIQUE);
+--error 1062
+INSERT INTO t7 SELECT a,b FROM tt3;
+SELECT * FROM t7 ORDER BY a,b;
+# Should be written to the binary log
+SHOW BINLOG EVENTS FROM 1256;
+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;
+SHOW BINLOG EVENTS FROM 1452;
+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;
+--echo **** On Master ****
+--query_vertical SHOW CREATE TABLE t8
+--query_vertical SHOW CREATE TABLE t9
+SHOW BINLOG EVENTS FROM 1548;
+sync_slave_with_master;
+--echo **** On Slave ****
+--query_vertical SHOW CREATE TABLE t8
+--query_vertical SHOW CREATE TABLE t9
+
+connection master;
+--disable_query_log
+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_query_log
diff --git a/mysql-test/t/rpl_row_ddl.test b/mysql-test/t/rpl_row_ddl.test
new file mode 100644
index 00000000000..2433d6a83a7
--- /dev/null
+++ b/mysql-test/t/rpl_row_ddl.test
@@ -0,0 +1,35 @@
+######################## 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..
+#
+# 3. The assignment of the DDL command to be tested to $my_stmt can
+# be a bit difficult. "'" must be avoided, because the test
+# routine "include/rpl_stmt_seq.inc" performs a
+# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
+#
+
+--source include/have_innodb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+let $engine_type= "InnoDB";
+-- source extra/rpl_tests/rpl_ddl.test
diff --git a/mysql-test/t/rpl_row_delayed_ins.test b/mysql-test/t/rpl_row_delayed_ins.test
new file mode 100644
index 00000000000..b898a9a120a
--- /dev/null
+++ b/mysql-test/t/rpl_row_delayed_ins.test
@@ -0,0 +1,2 @@
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_row_delayed_ins.test
diff --git a/mysql-test/t/rpl_row_drop.test b/mysql-test/t/rpl_row_drop.test
new file mode 100644
index 00000000000..816bd108b88
--- /dev/null
+++ b/mysql-test/t/rpl_row_drop.test
@@ -0,0 +1,47 @@
+-- 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
+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/t/rpl_row_err_daisychain-master.opt b/mysql-test/t/rpl_row_err_daisychain-master.opt
new file mode 100644
index 00000000000..83ed8522e72
--- /dev/null
+++ b/mysql-test/t/rpl_row_err_daisychain-master.opt
@@ -0,0 +1 @@
+--binlog-format=row
diff --git a/mysql-test/t/rpl_row_err_daisychain-slave.opt b/mysql-test/t/rpl_row_err_daisychain-slave.opt
new file mode 100644
index 00000000000..4cb7a31da81
--- /dev/null
+++ b/mysql-test/t/rpl_row_err_daisychain-slave.opt
@@ -0,0 +1 @@
+--binlog-format=statement --log-slave-updates
diff --git a/mysql-test/t/rpl_row_flsh_tbls.test b/mysql-test/t/rpl_row_flsh_tbls.test
new file mode 100644
index 00000000000..72babb4e21f
--- /dev/null
+++ b/mysql-test/t/rpl_row_flsh_tbls.test
@@ -0,0 +1,6 @@
+# depends on the binlog output
+-- source include/have_binlog_format_row.inc
+
+let $rename_event_pos= 615;
+-- source extra/rpl_tests/rpl_flsh_tbls.test
+
diff --git a/mysql-test/t/rpl_row_func001.test b/mysql-test/t/rpl_row_func001.test
new file mode 100644
index 00000000000..6c538017911
--- /dev/null
+++ b/mysql-test/t/rpl_row_func001.test
@@ -0,0 +1,56 @@
+#############################################################################
+# 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;
+
+# Lets cleanup
+
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_func002.test b/mysql-test/t/rpl_row_func002.test
new file mode 100644
index 00000000000..3812eac201c
--- /dev/null
+++ b/mysql-test/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 > ./var/tmp/func002_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func002_slave.sql
+
+# First lets cleanupi
+DROP FUNCTION test.f1;
+DROP TABLE test.t1;
+
+
+# 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
+
+exec diff ./var/tmp/func002_master.sql ./var/tmp/func002_slave.sql;
+
+
+# End of 5.0 test case
+
diff --git a/mysql-test/t/rpl_row_func003.test b/mysql-test/t/rpl_row_func003.test
new file mode 100644
index 00000000000..bac13698620
--- /dev/null
+++ b/mysql-test/t/rpl_row_func003.test
@@ -0,0 +1,6 @@
+###################################
+# Wrapper for rpl_row_func003.test#
+###################################
+-- source include/have_innodb.inc
+let $engine_type=INNODB;
+-- source extra/rpl_tests/rpl_row_func003.test
diff --git a/mysql-test/t/rpl_row_inexist_tbl.test b/mysql-test/t/rpl_row_inexist_tbl.test
new file mode 100644
index 00000000000..e77ea216571
--- /dev/null
+++ b/mysql-test/t/rpl_row_inexist_tbl.test
@@ -0,0 +1,27 @@
+# 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);
+sync_slave_with_master;
+drop table t1;
+
+connection master;
+insert into t1 values (1);
+insert into t1 values (2);
+
+connection slave;
+# slave should have stopped because can't find table
+wait_for_slave_to_stop;
+# 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;
diff --git a/mysql-test/t/rpl_log-master.opt b/mysql-test/t/rpl_row_log-master.opt
index e0d075c3fbd..e0d075c3fbd 100644
--- a/mysql-test/t/rpl_log-master.opt
+++ b/mysql-test/t/rpl_row_log-master.opt
diff --git a/mysql-test/t/rpl_log-slave.opt b/mysql-test/t/rpl_row_log-slave.opt
index 8b137891791..8b137891791 100644
--- a/mysql-test/t/rpl_log-slave.opt
+++ b/mysql-test/t/rpl_row_log-slave.opt
diff --git a/mysql-test/t/rpl_row_log.test b/mysql-test/t/rpl_row_log.test
new file mode 100644
index 00000000000..290a08ff75a
--- /dev/null
+++ b/mysql-test/t/rpl_row_log.test
@@ -0,0 +1,4 @@
+# Requires statement logging
+-- source include/have_binlog_format_row.inc
+-- source extra/rpl_tests/rpl_log.test
+
diff --git a/mysql-test/t/rpl_row_max_relay_size.test b/mysql-test/t/rpl_row_max_relay_size.test
new file mode 100644
index 00000000000..a4b762059b3
--- /dev/null
+++ b/mysql-test/t/rpl_row_max_relay_size.test
@@ -0,0 +1,9 @@
+# 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_row.inc
+-- source extra/rpl_tests/rpl_max_relay_size.test
+
diff --git a/mysql-test/t/rpl_row_multi_update3.test b/mysql-test/t/rpl_row_multi_update3.test
new file mode 100644
index 00000000000..fc606b2f134
--- /dev/null
+++ b/mysql-test/t/rpl_row_multi_update3.test
@@ -0,0 +1,2 @@
+let $engine_type=MyISAM;
+-- source extra/rpl_tests/rpl_row_multi_update3.test
diff --git a/mysql-test/t/rpl_row_mystery22.test b/mysql-test/t/rpl_row_mystery22.test
new file mode 100644
index 00000000000..9933fec22fc
--- /dev/null
+++ b/mysql-test/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/t/rpl_row_reset_slave.test b/mysql-test/t/rpl_row_reset_slave.test
new file mode 100644
index 00000000000..a970c161153
--- /dev/null
+++ b/mysql-test/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/t/rpl_rewrite_db-slave.opt b/mysql-test/t/rpl_row_rewrt_db-slave.opt
index a462ad19ba0..a462ad19ba0 100644
--- a/mysql-test/t/rpl_rewrite_db-slave.opt
+++ b/mysql-test/t/rpl_row_rewrt_db-slave.opt
diff --git a/mysql-test/t/rpl_rewrite_db.test b/mysql-test/t/rpl_row_rewrt_db.test
index 1e8e5a992d8..8781b361d87 100644
--- a/mysql-test/t/rpl_rewrite_db.test
+++ b/mysql-test/t/rpl_row_rewrt_db.test
@@ -1,4 +1,7 @@
-source include/master-slave.inc;
+# TBF - difference in row level logging
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
--disable_warnings
drop database if exists mysqltest1;
--enable_warnings
@@ -78,4 +81,3 @@ drop database rewrite;
connection master;
drop table t1;
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_sp-master.opt b/mysql-test/t/rpl_row_sp000-master.opt
index 709a224fd92..709a224fd92 100644
--- a/mysql-test/t/rpl_sp-master.opt
+++ b/mysql-test/t/rpl_row_sp000-master.opt
diff --git a/mysql-test/t/rpl_row_sp000-slave.opt b/mysql-test/t/rpl_row_sp000-slave.opt
new file mode 100644
index 00000000000..709a224fd92
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp000-slave.opt
@@ -0,0 +1 @@
+--log_bin_trust_routine_creators=0
diff --git a/mysql-test/t/rpl_row_sp000.test b/mysql-test/t/rpl_row_sp000.test
new file mode 100644
index 00000000000..e591cb054fc
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp000.test
@@ -0,0 +1,323 @@
+# row-based and statement have expected binlog difference in result files
+-- source include/have_binlog_format_row.inc
+
+# Test of replication of stored procedures in row-based replication.
+# Initially copied from the statement-based version rpl_stm_sp.test.
+
+# 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/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 ?
+# (all same properties)
+
+connection master;
+
+delimiter |;
+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;
+--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()
+ not deterministic
+ select * from mysqltest1.t1;
+call foo2();
+
+alter procedure foo2 contains sql;
+
+# SP with definer's right
+
+drop table t1;
+create table t1 (a int);
+create table t2 (a int);
+
+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;
+
+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 1062
+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';
+
+# Test of a procedure and function containing UUID() is done in
+# rpl_row_UUID.
+
+
+# ********************** PART 2 : FUNCTIONS ***************
+
+connection master;
+drop procedure foo;
+drop procedure foo2;
+drop procedure foo3;
+
+delimiter |;
+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
+begin
+ return unix_timestamp();
+end|
+
+delimiter ;|
+# Just to test ALTER FUNCTION
+alter function fn1 no sql;
+delete from t1;
+set timestamp=1000000000;
+insert into t1 values(fn1());
+
+connection con1;
+
+delimiter |;
+create function fn2()
+ returns int
+ no sql
+begin
+ return unix_timestamp();
+end|
+delimiter ;|
+
+connection master;
+
+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()
+ returns int
+begin
+ insert into t2 values(20),(20);
+ return 10;
+end|
+
+delimiter ;|
+
+--error 1062
+select fn1();
+
+select * from t2;
+sync_slave_with_master;
+
+# check that this failed-in-the-middle replicated right:
+select * from t2;
+
+# ********************** PART 3 : TRIGGERS ***************
+
+connection con1;
+--error 1227
+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;
+--replace_column 2 # 5 #
+show binlog events in 'master-bin.000001' from 102;
+sync_slave_with_master;
+select * from t1;
+
+
+#
+# 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;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_row_sp001.test b/mysql-test/t/rpl_row_sp001.test
new file mode 100644
index 00000000000..f6ac18dc78b
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp001.test
@@ -0,0 +1,144 @@
+#############################################################################
+# 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 test.t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from test.t2;
+
+connection master;
+call test.p2(1);
+select * from test.t2;
+sync_slave_with_master;
+select * from test.t2;
+
+
+connection master;
+call test.p2(2);
+select * from test.t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from test.t2;
+
+connection master;
+call test.p2(3);
+select * from test.t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from test.t2;
+
+##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 > ./var/tmp/sp001_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp001_slave.sql
+
+# First lets cleanup
+
+DROP PROCEDURE test.p1;
+DROP PROCEDURE test.p2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+
+# 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 mysql-test/var/tmp
+
+--exec diff ./var/tmp/sp001_master.sql ./var/tmp/sp001_slave.sql;
+
+# If all is good, when can cleanup our dump files.
+system rm ./var/tmp/sp001_master.sql;
+system rm ./var/tmp/sp001_slave.sql;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp002_innodb-master.opt b/mysql-test/t/rpl_row_sp002_innodb-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp002_innodb-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_sp002_innodb-slave.opt b/mysql-test/t/rpl_row_sp002_innodb-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp002_innodb-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_sp002_innodb.test b/mysql-test/t/rpl_row_sp002_innodb.test
new file mode 100644
index 00000000000..a00d9ae2327
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp002_innodb.test
@@ -0,0 +1,6 @@
+#################################
+# Wrapper for rpl_row_sp002.test#
+#################################
+-- source include/have_innodb.inc
+let $engine_type=INNODB;
+-- source extra/rpl_tests/rpl_row_sp002.test
diff --git a/mysql-test/t/rpl_row_sp003-master.opt b/mysql-test/t/rpl_row_sp003-master.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp003-master.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_sp003-slave.opt b/mysql-test/t/rpl_row_sp003-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp003-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_sp003.test b/mysql-test/t/rpl_row_sp003.test
new file mode 100644
index 00000000000..34774a227bb
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp003.test
@@ -0,0 +1,6 @@
+#################################
+# Wrapper for rpl_row_sp003.test#
+#################################
+-- source include/have_innodb.inc
+let $engine_type=INNODB;
+-- source extra/rpl_tests/rpl_row_sp003.test
diff --git a/mysql-test/t/rpl_row_sp005.test b/mysql-test/t/rpl_row_sp005.test
new file mode 100644
index 00000000000..c2cdd820eeb
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp005.test
@@ -0,0 +1,105 @@
+#############################################################################
+# 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. #
+#############################################################################
+
+
+# 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;
+ DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2;
+ 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;
+SELECT * FROM test.t2;
+
+let $message=< ---- Slave selects-- >;
+--source include/show_msg.inc
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1;
+SELECT * FROM test.t2;
+
+let $message=< ---- Master selects-- >;
+--source include/show_msg.inc
+connection master;
+CALL test.p1();
+sleep 6;
+SELECT * FROM test.t3;
+
+let $message=< ---- Slave selects-- >;
+--source include/show_msg.inc
+connection slave;
+SELECT * FROM test.t3;
+
+connection master;
+
+ALTER PROCEDURE test.p1 MODIFIES SQL DATA;
+#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;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp006_InnoDB-slave.opt b/mysql-test/t/rpl_row_sp006_InnoDB-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp006_InnoDB-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_row_sp006_InnoDB.test b/mysql-test/t/rpl_row_sp006_InnoDB.test
new file mode 100644
index 00000000000..4afa3c41aeb
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp006_InnoDB.test
@@ -0,0 +1,6 @@
+#################################
+# Wrapper for rpl_row_sp006.test#
+#################################
+-- source include/have_innodb.inc
+let $engine_type=InnoDB;
+-- source extra/rpl_tests/rpl_row_sp006.test
diff --git a/mysql-test/t/rpl_row_sp007_innodb.test b/mysql-test/t/rpl_row_sp007_innodb.test
new file mode 100644
index 00000000000..9b257e14320
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp007_innodb.test
@@ -0,0 +1,6 @@
+#################################
+# Wrapper for rpl_row_sp007.test#
+#################################
+-- source include/have_innodb.inc
+let $engine_type=INNODB;
+-- source extra/rpl_tests/rpl_row_sp007.test
diff --git a/mysql-test/t/rpl_row_sp008.test b/mysql-test/t/rpl_row_sp008.test
new file mode 100644
index 00000000000..c30339b8c7c
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp008.test
@@ -0,0 +1,58 @@
+#############################################################################
+# 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;
+
+connection master;
+let $VERSION=`select version()`;
+--replace_result $VERSION VERSION
+show binlog events;
+
+
+DROP PROCEDURE IF EXISTS test.p1;
+DROP TABLE IF EXISTS test.t1;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp009.test b/mysql-test/t/rpl_row_sp009.test
new file mode 100644
index 00000000000..b06267df783
--- /dev/null
+++ b/mysql-test/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 #
+#############################################################################
+
+# 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;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2;
+connection master;
+truncate test.t2;
+
+# this next call fails, but should not
+call test.p1('b');
+select * from test.t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2;
+
+connection master;
+truncate test.t2;
+SELECT * FROM test.t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2;
+
+
+connection master;
+#show binlog events;
+# lets cleanup
+
+DROP PROCEDURE test.p1;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp010.test b/mysql-test/t/rpl_row_sp010.test
new file mode 100644
index 00000000000..8d11ca10087
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp010.test
@@ -0,0 +1,81 @@
+#############################################################################
+# 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;
+
+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;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t2;
+
+connection master;
+#show binlog events;
+# lets cleanup
+
+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;
+
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp011.test b/mysql-test/t/rpl_row_sp011.test
new file mode 100644
index 00000000000..8d843510b6b
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp011.test
@@ -0,0 +1,115 @@
+#############################################################################
+# 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;
+connection master;
+
+#show binlog events;
+# lets cleanup
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp011_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp011_slave.sql
+
+
+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;
+
+
+# First lets cleanup
+
+# 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 mysql-test/var/tmp
+
+exec diff ./var/tmp/sp011_master.sql ./var/tmp/sp011_slave.sql;
+
+# If all is good, when can cleanup our dump files.
+system rm ./var/tmp/sp011_master.sql;
+system rm ./var/tmp/sp011_slave.sql;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp012.test b/mysql-test/t/rpl_row_sp012.test
new file mode 100644
index 00000000000..2b9c07895f0
--- /dev/null
+++ b/mysql-test/t/rpl_row_sp012.test
@@ -0,0 +1,74 @@
+#############################################################################
+# 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();
+
+connection master;
+
+# lets cleanup
+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;
+
+# End of 5.0 test case
+
diff --git a/mysql-test/t/rpl_row_stop_middle.test b/mysql-test/t/rpl_row_stop_middle.test
new file mode 100644
index 00000000000..553a026e5e7
--- /dev/null
+++ b/mysql-test/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/t/rpl_row_stop_middle_update-master.opt b/mysql-test/t/rpl_row_stop_middle_update-master.opt
new file mode 100644
index 00000000000..b7db8f97bdd
--- /dev/null
+++ b/mysql-test/t/rpl_row_stop_middle_update-master.opt
@@ -0,0 +1 @@
+--loose-binlog-row-event-max-size=256
diff --git a/mysql-test/t/rpl_row_stop_middle_update-slave.opt b/mysql-test/t/rpl_row_stop_middle_update-slave.opt
new file mode 100644
index 00000000000..ea49a27adf4
--- /dev/null
+++ b/mysql-test/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/t/rpl_row_stop_middle_update.test b/mysql-test/t/rpl_row_stop_middle_update.test
new file mode 100644
index 00000000000..82c4b1a9936
--- /dev/null
+++ b/mysql-test/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/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/t/rpl_timezone-master.opt b/mysql-test/t/rpl_row_timezone-master.opt
index 8e43bfbbb7e..8e43bfbbb7e 100644
--- a/mysql-test/t/rpl_timezone-master.opt
+++ b/mysql-test/t/rpl_row_timezone-master.opt
diff --git a/mysql-test/t/rpl_row_timezone-slave.opt b/mysql-test/t/rpl_row_timezone-slave.opt
new file mode 100644
index 00000000000..c383fd9f17d
--- /dev/null
+++ b/mysql-test/t/rpl_row_timezone-slave.opt
@@ -0,0 +1,2 @@
+--default-time-zone=Europe/Moscow
+
diff --git a/mysql-test/t/rpl_row_timezone.test b/mysql-test/t/rpl_row_timezone.test
new file mode 100644
index 00000000000..047a458f09f
--- /dev/null
+++ b/mysql-test/t/rpl_row_timezone.test
@@ -0,0 +1,129 @@
+# TBF - difference in row level logging
+-- source include/have_binlog_format_row.inc
+
+# 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;
+
+# 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;
+sync_slave_with_master;
+#set time_zone='UTC';
+select * from t1;
+
+# 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;
+sync_slave_with_master;
+set time_zone='Europe/Moscow';
+select * from t1;
+connection master;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/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/rpl_timezone2.dat' into table t1;
+select * from t1;
+sync_slave_with_master;
+set time_zone='UTC';
+select * from t1;
+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;
+sync_slave_with_master;
+select * from t2;
+
+#
+# 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;
+
+#
+# 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;
+sync_slave_with_master;
+# We should get same result on slave as on master
+select * from t2;
+
+#
+# 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;
+sync_slave_with_master;
+select * from t2;
+
+# Clean up
+connection master;
+drop table t1, t2;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_row_trig001.test b/mysql-test/t/rpl_row_trig001.test
new file mode 100644
index 00000000000..e2f10ecf1fa
--- /dev/null
+++ b/mysql-test/t/rpl_row_trig001.test
@@ -0,0 +1,98 @@
+#############################################################################
+# 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 > ./var/tmp/trig001_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/trig001_slave.sql
+
+# First lets cleanup
+
+DROP PROCEDURE test.p2;
+DROP TRIGGER test.t2_ai;
+DROP TRIGGER test.t3_bi_t2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+
+# 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 mysql-test/var/tmp
+
+exec diff ./var/tmp/trig001_master.sql ./var/tmp/trig001_slave.sql;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_trig002.test b/mysql-test/t/rpl_row_trig002.test
new file mode 100644
index 00000000000..2cd84009b2b
--- /dev/null
+++ b/mysql-test/t/rpl_row_trig002.test
@@ -0,0 +1,79 @@
+#############################################################################
+# 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;
+#show binlog events;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from test.t1;
+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;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from test.t1;
+connection master;
+
+#show binlog events;
+
+# cleanup
+
+DROP TRIGGER test.t2_ai;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_trig003.test b/mysql-test/t/rpl_row_trig003.test
new file mode 100644
index 00000000000..799c2d6c9c7
--- /dev/null
+++ b/mysql-test/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 > ./var/tmp/trg003_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/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
+
+exec diff ./var/tmp/trg003_master.sql ./var/tmp/trg003_slave.sql;
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_trig004.test b/mysql-test/t/rpl_row_trig004.test
new file mode 100644
index 00000000000..2ad0b46211b
--- /dev/null
+++ b/mysql-test/t/rpl_row_trig004.test
@@ -0,0 +1,14 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Oct/18/2005 #
+#############################################################################
+# TEST: Use before insert triggers and has the second insert fail #
+#############################################################################
+
+# Includes
+-- 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/t/rpl_row_until.test b/mysql-test/t/rpl_row_until.test
new file mode 100644
index 00000000000..5ddeea911a8
--- /dev/null
+++ b/mysql-test/t/rpl_row_until.test
@@ -0,0 +1,86 @@
+-- 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 #
+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 #
+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 #
+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 #
+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/t/rpl_row_user_variables.test b/mysql-test/t/rpl_row_user_variables.test
new file mode 100644
index 00000000000..2ebb668b1a8
--- /dev/null
+++ b/mysql-test/t/rpl_row_user_variables.test
@@ -0,0 +1,4 @@
+# row-based and statement binlog difference in result files
+-- source include/have_binlog_format_row.inc
+-- source extra/rpl_tests/rpl_user_variables.test
+
diff --git a/mysql-test/t/rpl_view.test b/mysql-test/t/rpl_row_view.test
index 0a0c6a6dddb..6d460d58df6 100644
--- a/mysql-test/t/rpl_view.test
+++ b/mysql-test/t/rpl_row_view.test
@@ -1,9 +1,11 @@
+# NYI - row-based cannot use CREATE ... SELECT
+--source include/have_binlog_format_row.inc
+
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
#
@@ -43,5 +45,3 @@ select * from v1 order by a;
connection master;
drop table t1;
sync_slave_with_master;
---replace_column 2 # 5 #
-show binlog events limit 1,100;
diff --git a/mysql-test/t/rpl_row_view01.test b/mysql-test/t/rpl_row_view01.test
new file mode 100644
index 00000000000..85137e03dbf
--- /dev/null
+++ b/mysql-test/t/rpl_row_view01.test
@@ -0,0 +1,82 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/19/2005 #
+# Updated: 08/29/2005 Remove sleeps #
+#############################################################################
+#TEST: row based replication of views #
+#############################################################################
+
+# 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;
+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;
+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;
+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;
+SELECT * FROM mysqltest1.t3;
+sync_slave_with_master;
+SELECT * FROM mysqltest1.t5;
+SELECT * FROM mysqltest1.t3;
+connection master;
+
+INSERT INTO mysqltest1.v4 VALUES (4,'TEST');
+
+SELECT * FROM mysqltest1.t1;
+SELECT * FROM mysqltest1.v4;
+sync_slave_with_master;
+SELECT * FROM mysqltest1.t1;
+SELECT * FROM mysqltest1.v4;
+
+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;
+sync_slave_with_master;
+
+# End of 5.1 test case
+
diff --git a/mysql-test/t/rpl_server_id1.test b/mysql-test/t/rpl_server_id1.test
index 3583f05284c..71310750b60 100644
--- a/mysql-test/t/rpl_server_id1.test
+++ b/mysql-test/t/rpl_server_id1.test
@@ -13,7 +13,7 @@ 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 #
+--replace_column 16 # 18 #
show slave status;
start slave;
insert into t1 values (1);
diff --git a/mysql-test/t/rpl_sp004.test b/mysql-test/t/rpl_sp004.test
new file mode 100644
index 00000000000..6f6bd79ae82
--- /dev/null
+++ b/mysql-test/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;
+SELECT * FROM test.t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1;
+SELECT * FROM test.t2;
+
+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;
+SELECT * FROM test.t2;
+#SELECT * FROM test.t3;
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM test.t1;
+SELECT * FROM test.t2;
+#SELECT * FROM test.t3;
+connection master;
+#show binlog events;
+
+
+# If the test fails, you will need to diff the dumps to see why.
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp004_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp004_slave.sql
+
+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;
+
+-- exec diff ./var/tmp/sp004_master.sql ./var/tmp/sp004_slave.sql
+
+
+# End of 5.0 test case
diff --git a/mysql-test/t/rpl_sp_effects.test b/mysql-test/t/rpl_sp_effects.test
index 9da5723b993..1c23f956082 100644
--- a/mysql-test/t/rpl_sp_effects.test
+++ b/mysql-test/t/rpl_sp_effects.test
@@ -1,6 +1,8 @@
# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
-
-source include/master-slave.inc;
+# Make this statement only until bug 13115 is corrected [jbm]
+# TODO: Remove statement include once bug 13115 is patched.
+-- source include/have_binlog_format_statement.inc
+-- source include/master-slave.inc
# ****************************************************************
connection master;
@@ -140,7 +142,6 @@ begin
end while;
end//
delimiter ;//
-
call p1(15);
select 'master:',a from t1;
sync_slave_with_master;
diff --git a/mysql-test/t/rpl_stm_000001-slave.opt b/mysql-test/t/rpl_stm_000001-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_stm_000001-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_stm_000001.test b/mysql-test/t/rpl_stm_000001.test
new file mode 100644
index 00000000000..aee067b2d4a
--- /dev/null
+++ b/mysql-test/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/t/rpl_stm_EE_err.test b/mysql-test/t/rpl_stm_EE_err.test
new file mode 100644
index 00000000000..e883a6ce616
--- /dev/null
+++ b/mysql-test/t/rpl_stm_EE_err.test
@@ -0,0 +1,2 @@
+let $engine_type=myisam;
+-- source extra/rpl_tests/rpl_stm_EE_err.test
diff --git a/mysql-test/t/rpl_stm_charset.test b/mysql-test/t/rpl_stm_charset.test
new file mode 100644
index 00000000000..b103a47d78c
--- /dev/null
+++ b/mysql-test/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/t/rpl_stm_ddl.test b/mysql-test/t/rpl_stm_ddl.test
new file mode 100644
index 00000000000..54548114f86
--- /dev/null
+++ b/mysql-test/t/rpl_stm_ddl.test
@@ -0,0 +1,35 @@
+######################## 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..
+#
+# 3. The assignment of the DDL command to be tested to $my_stmt can
+# be a bit difficult. "'" must be avoided, because the test
+# routine "include/rpl_stmt_seq.inc" performs a
+# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
+#
+
+--source include/have_innodb.inc
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+let $engine_type= "InnoDB";
+-- source extra/rpl_tests/rpl_ddl.test
diff --git a/mysql-test/t/rpl_error_ignored_table-slave.opt b/mysql-test/t/rpl_stm_err_ignoredtable-slave.opt
index cb49119bfcb..cb49119bfcb 100644
--- a/mysql-test/t/rpl_error_ignored_table-slave.opt
+++ b/mysql-test/t/rpl_stm_err_ignoredtable-slave.opt
diff --git a/mysql-test/t/rpl_stm_err_ignoredtable.test b/mysql-test/t/rpl_stm_err_ignoredtable.test
new file mode 100644
index 00000000000..a426be27b59
--- /dev/null
+++ b/mysql-test/t/rpl_stm_err_ignoredtable.test
@@ -0,0 +1,8 @@
+# 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.
+
+# Requires statement logging
+-- source include/have_binlog_format_statement.inc
+-- source extra/rpl_tests/rpl_err_ignoredtable.test
+
diff --git a/mysql-test/t/rpl_stm_flsh_tbls.test b/mysql-test/t/rpl_stm_flsh_tbls.test
new file mode 100644
index 00000000000..3a6102de279
--- /dev/null
+++ b/mysql-test/t/rpl_stm_flsh_tbls.test
@@ -0,0 +1,8 @@
+# depends on the binlog output
+--source include/have_binlog_format_statement.inc
+
+let $rename_event_pos= 652;
+-- 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/t/rpl_loaddata_rule_s-slave.opt b/mysql-test/t/rpl_stm_loaddata_m-master.opt
index 9d4a8f0b95e..9d4a8f0b95e 100644
--- a/mysql-test/t/rpl_loaddata_rule_s-slave.opt
+++ b/mysql-test/t/rpl_stm_loaddata_m-master.opt
diff --git a/mysql-test/t/rpl_stm_loaddata_m.test b/mysql-test/t/rpl_stm_loaddata_m.test
new file mode 100644
index 00000000000..ac52a8dfb9e
--- /dev/null
+++ b/mysql-test/t/rpl_stm_loaddata_m.test
@@ -0,0 +1,10 @@
+# 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).
+
+# Requires statement logging
+-- source include/have_binlog_format_statement.inc
+-- source extra/rpl_tests/rpl_loaddata_m.test
+
+# End of 4.1 tests
+# Adding comment for force manual merge 5.0 -> wl1012: Delete me
diff --git a/mysql-test/t/rpl_stm_log-master.opt b/mysql-test/t/rpl_stm_log-master.opt
new file mode 100644
index 00000000000..e0d075c3fbd
--- /dev/null
+++ b/mysql-test/t/rpl_stm_log-master.opt
@@ -0,0 +1 @@
+--skip-external-locking
diff --git a/mysql-test/t/rpl_stm_log-slave.opt b/mysql-test/t/rpl_stm_log-slave.opt
new file mode 100644
index 00000000000..8b137891791
--- /dev/null
+++ b/mysql-test/t/rpl_stm_log-slave.opt
@@ -0,0 +1 @@
+
diff --git a/mysql-test/t/rpl_stm_log.test b/mysql-test/t/rpl_stm_log.test
new file mode 100644
index 00000000000..f5b0a7eead8
--- /dev/null
+++ b/mysql-test/t/rpl_stm_log.test
@@ -0,0 +1,7 @@
+# Requires statement logging
+-- source include/have_binlog_format_statement.inc
+-- 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/t/rpl_stm_max_relay_size.test b/mysql-test/t/rpl_stm_max_relay_size.test
new file mode 100644
index 00000000000..50008533388
--- /dev/null
+++ b/mysql-test/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_statement.inc
+-- source extra/rpl_tests/rpl_max_relay_size.test
+
+# End of 4.1 tests
+#
diff --git a/mysql-test/t/rpl_stm_multi_query.test b/mysql-test/t/rpl_stm_multi_query.test
new file mode 100644
index 00000000000..97c322ac780
--- /dev/null
+++ b/mysql-test/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_statement.inc
+-- source extra/rpl_tests/rpl_multi_query.test
+
+
+# End of 4.1 tests
+#
diff --git a/mysql-test/t/rpl_mystery22.test b/mysql-test/t/rpl_stm_mystery22.test
index f190968a03c..bb810ffb4ac 100644
--- a/mysql-test/t/rpl_mystery22.test
+++ b/mysql-test/t/rpl_stm_mystery22.test
@@ -1,20 +1,25 @@
+-- source include/have_binlog_format_statement.inc
+
# test case to make slave thread get ahead by 22 bytes
-source include/master-slave.inc;
+-- source include/master-slave.inc
# first, cause a duplicate key problem on the slave
-create table t1(n int auto_increment primary key);
+create table t1(n int auto_increment primary key, s char(10));
sync_slave_with_master;
-insert into t1 values (2);
+insert into t1 values (2,'old');
connection master;
-insert into t1 values(NULL);
-insert into t1 values(NULL);
+insert into t1 values(NULL,'new');
+insert into t1 values(NULL,'new');
save_master_pos;
connection slave;
-sleep 3; # there is no way around this sleep - we have to wait until
-# the slave tries to run the query, fails and aborts slave thread
+# 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
@@ -24,14 +29,21 @@ connection master;
# events in the log
create table t2(n int);
drop table t2;
-insert into t1 values(NULL);
+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;
+select * from t1 order by n;
#clean up
connection master;
drop table t1;
diff --git a/mysql-test/t/rpl_stm_no_op.test b/mysql-test/t/rpl_stm_no_op.test
new file mode 100644
index 00000000000..d1e0b49abe9
--- /dev/null
+++ b/mysql-test/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_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;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_stm_reset_slave.test b/mysql-test/t/rpl_stm_reset_slave.test
new file mode 100644
index 00000000000..282033bf6d1
--- /dev/null
+++ b/mysql-test/t/rpl_stm_reset_slave.test
@@ -0,0 +1,6 @@
+# TBF - difference in row level logging
+-- source include/have_binlog_format_statement.inc
+-- source extra/rpl_tests/rpl_reset_slave.test
+
+# End of 4.1 tests
+#
diff --git a/mysql-test/t/rpl_stm_rewrt_db-slave.opt b/mysql-test/t/rpl_stm_rewrt_db-slave.opt
new file mode 100644
index 00000000000..a462ad19ba0
--- /dev/null
+++ b/mysql-test/t/rpl_stm_rewrt_db-slave.opt
@@ -0,0 +1 @@
+"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1->test"
diff --git a/mysql-test/t/rpl_stm_rewrt_db.test b/mysql-test/t/rpl_stm_rewrt_db.test
new file mode 100644
index 00000000000..c66ced46717
--- /dev/null
+++ b/mysql-test/t/rpl_stm_rewrt_db.test
@@ -0,0 +1,84 @@
+# TBF - difference in row level logging
+-- source include/have_binlog_format_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/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/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/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/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/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/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/t/rpl_stm_sp-master.opt b/mysql-test/t/rpl_stm_sp-master.opt
new file mode 100644
index 00000000000..709a224fd92
--- /dev/null
+++ b/mysql-test/t/rpl_stm_sp-master.opt
@@ -0,0 +1 @@
+--log_bin_trust_routine_creators=0
diff --git a/mysql-test/t/rpl_sp-slave.opt b/mysql-test/t/rpl_stm_sp-slave.opt
index 611ee1f33be..611ee1f33be 100644
--- a/mysql-test/t/rpl_sp-slave.opt
+++ b/mysql-test/t/rpl_stm_sp-slave.opt
diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_stm_sp.test
index 386582f8f1b..95c4543c952 100644
--- a/mysql-test/t/rpl_sp.test
+++ b/mysql-test/t/rpl_stm_sp.test
@@ -1,3 +1,6 @@
+# row-based and statement have expected binlog difference in result files
+-- source include/have_binlog_format_statement.inc
+
# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
# Modified by WL#2971.
@@ -333,7 +336,7 @@ drop trigger trg;
insert into t1 values (1);
select * from t1;
--replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 98;
+show binlog events in 'master-bin.000001' from 102;
sync_slave_with_master;
select * from t1;
diff --git a/mysql-test/t/rpl_stm_timezone-master.opt b/mysql-test/t/rpl_stm_timezone-master.opt
new file mode 100644
index 00000000000..8e43bfbbb7e
--- /dev/null
+++ b/mysql-test/t/rpl_stm_timezone-master.opt
@@ -0,0 +1 @@
+--default-time-zone=Europe/Moscow
diff --git a/mysql-test/t/rpl_timezone-slave.opt b/mysql-test/t/rpl_stm_timezone-slave.opt
index 191182c329c..191182c329c 100644
--- a/mysql-test/t/rpl_timezone-slave.opt
+++ b/mysql-test/t/rpl_stm_timezone-slave.opt
diff --git a/mysql-test/t/rpl_timezone.test b/mysql-test/t/rpl_stm_timezone.test
index 2e9883141d8..0cd6dbf5d89 100644
--- a/mysql-test/t/rpl_timezone.test
+++ b/mysql-test/t/rpl_stm_timezone.test
@@ -1,3 +1,6 @@
+# TBF - difference in row level logging
+-- source include/have_binlog_format_statement.inc
+
# Test of replication of time zones.
# There is currently some bug possibly in prepared statements (this
diff --git a/mysql-test/t/rpl_until.test b/mysql-test/t/rpl_stm_until.test
index e0ecf981fea..1bd87db88cb 100644
--- a/mysql-test/t/rpl_until.test
+++ b/mysql-test/t/rpl_stm_until.test
@@ -1,4 +1,7 @@
-source include/master-slave.inc;
+-- source include/have_binlog_format_statement.inc
+-- source include/master-slave.inc
+
+# Test is dependent on binlog positions
# prepare version for substitutions
let $VERSION=`select version()`;
@@ -19,12 +22,10 @@ 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;
---replace_result $VERSION VERSION
-show binlog events;
# try to replicate all queries until drop of t1
connection slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=319;
+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
@@ -43,7 +44,7 @@ wait_for_slave_to_stop;
--replace_column 1 # 9 # 11 # 23 # 33 #
show slave status;
-# try replicate all until second insert to t2;
+# 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;
diff --git a/mysql-test/t/rpl_stm_user_variables.test b/mysql-test/t/rpl_stm_user_variables.test
new file mode 100644
index 00000000000..af4e46cdace
--- /dev/null
+++ b/mysql-test/t/rpl_stm_user_variables.test
@@ -0,0 +1,5 @@
+# row-based and statement binlog difference in result files
+-- source include/have_binlog_format_statement.inc
+-- source extra/rpl_tests/rpl_user_variables.test
+
+# End of 4.1 tests
diff --git a/mysql-test/t/rpl_stm_view.test b/mysql-test/t/rpl_stm_view.test
new file mode 100644
index 00000000000..39f39705f77
--- /dev/null
+++ b/mysql-test/t/rpl_stm_view.test
@@ -0,0 +1,50 @@
+# NYI - row-based cannot use CREATE ... SELECT
+--source include/have_binlog_format_statement.inc
+
+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 createion 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;
+--replace_column 2 # 5 #
+show binlog events limit 1,100;
diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test
index fcb2391a9d8..0eb5d4074d8 100644
--- a/mysql-test/t/rpl_temporary.test
+++ b/mysql-test/t/rpl_temporary.test
@@ -1,4 +1,4 @@
-source include/master-slave.inc;
+-- source include/master-slave.inc
# Clean up old slave's binlogs.
# The slave is started with --log-slave-updates
@@ -81,9 +81,10 @@ drop temporary table t3;
select * from t2;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-show binlog events;
+# 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;
@@ -130,5 +131,3 @@ create temporary table t3 (f int);
sync_with_master;
# The server will now close done
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_trigger.test b/mysql-test/t/rpl_trigger.test
index fa6054372c7..0eca7308adc 100644
--- a/mysql-test/t/rpl_trigger.test
+++ b/mysql-test/t/rpl_trigger.test
@@ -1,7 +1,8 @@
#
# 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_statement.inc
source include/master-slave.inc;
#
diff --git a/mysql-test/t/rpl_user_variables.test b/mysql-test/t/rpl_user_variables.test
deleted file mode 100644
index e8985397703..00000000000
--- a/mysql-test/t/rpl_user_variables.test
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# 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);
-connection master1; # see if variable is reset in binlog when thread changes
-insert into t1 values (@a),(@a),(@a*5);
-select * from t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
---replace_column 2 # 5 #
-show binlog events from 98;
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index f73288f04ba..91973da6c22 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -4132,9 +4132,13 @@ end|
--error 1062
select bug12379()|
select 1|
+# statement-based binlogging will show warning which row-based won't;
+# so we hide it (this warning is already tested in rpl_stm_sp.test)
+--disable_warnings
call bug12379_1()|
select 2|
call bug12379_2()|
+--enable_warnings
select 3|
--error 1062
call bug12379_3()|
diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test
index 004154339b2..a3128064c91 100644
--- a/mysql-test/t/user_var-binlog.test
+++ b/mysql-test/t/user_var-binlog.test
@@ -1,3 +1,6 @@
+# Requires statement logging
+-- source include/have_binlog_format_statement.inc
+# TODO: Create row based version once $MYSQL_BINLOG has new RB version
# Embedded server does not support binlogging
--source include/not_embedded.inc
@@ -10,7 +13,8 @@ INSERT INTO t1 VALUES(@`a b`);
set @var1= "';aaa";
SET @var2=char(ascii('a'));
insert into t1 values (@var1),(@var2);
-show binlog events from 98;
+--replace_column 2 # 5 #
+show binlog events from 102;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).