summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-03-19 11:42:44 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-03-19 11:42:44 +0200
commit44d70c01f0aef419bc1325f0cba6a46085042646 (patch)
treed12df15e2f47fbc884591bfec0e14fcb613fd7d3
parent126725421e56293d7c8b816e066271606b59dcd5 (diff)
parent867724fd304caf714d3cd2aa825f2c8b3b724017 (diff)
downloadmariadb-git-44d70c01f0aef419bc1325f0cba6a46085042646.tar.gz
Merge 10.3 into 10.4
-rw-r--r--CREDITS13
-rw-r--r--cmake/install_macros.cmake2
-rw-r--r--include/mysql/service_wsrep.h3
-rw-r--r--include/service_versions.h4
m---------libmariadb0
-rw-r--r--mysql-test/main/brackets.result4
-rw-r--r--mysql-test/main/contributors.result13
-rw-r--r--mysql-test/main/cte_nonrecursive.result42
-rw-r--r--mysql-test/main/cte_nonrecursive.test31
-rw-r--r--mysql-test/main/join_cache.result58
-rw-r--r--mysql-test/main/join_cache.test36
-rw-r--r--mysql-test/main/status2.result10
-rw-r--r--mysql-test/main/status2.test11
-rw-r--r--mysql-test/main/subselect.result38
-rw-r--r--mysql-test/main/subselect.test35
-rw-r--r--mysql-test/main/subselect4.result27
-rw-r--r--mysql-test/main/subselect4.test24
-rw-r--r--mysql-test/main/subselect_no_exists_to_in.result38
-rw-r--r--mysql-test/main/subselect_no_mat.result38
-rw-r--r--mysql-test/main/subselect_no_opts.result38
-rw-r--r--mysql-test/main/subselect_no_scache.result38
-rw-r--r--mysql-test/main/subselect_no_semijoin.result38
-rw-r--r--mysql-test/suite/engines/funcs/disabled.def95
-rw-r--r--mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result5
-rw-r--r--mysql-test/suite/engines/funcs/r/ix_unique_lob.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl000011.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl000017.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_000010.result (renamed from mysql-test/suite/engines/funcs/r/rpl000010.result)12
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_000011.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_000013.result (renamed from mysql-test/suite/engines/funcs/r/rpl000013.result)19
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_000015.result81
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_000017.result (renamed from mysql-test/suite/engines/funcs/t/rpl000017.test)17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result41
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_alter,innodb.rdiff72
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_alter.result125
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_alter_db.result19
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_bit.result13
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_bit_npk.result15
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_change_master.result29
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_create_database.result48
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_do_grant.result310
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_drop.result13
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_drop_db.result25
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result22
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result21
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result41
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_free_items.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_get_lock.result15
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result24
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result26
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_init_slave.result20
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_insert.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_insert_select.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_loaddata2.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result15
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_loadfile.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_log_pos.result51
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_many_optimize.result10
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_master_pos_wait.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_misc_functions.result61
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_multi_delete.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_multi_update4.result15
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_ps.result40
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result55
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_relayspace.result23
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_NOW.result13
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_USER.result21
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_drop.result39
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_func001.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result60
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result35
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result49
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp001.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp005.result30
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp008.result19
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp009.result17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp010.result15
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp011.result13
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp012.result28
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result19
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_trig001.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_trig002.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_trig003.result19
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_until.result37
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_view01.result17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_server_id1.result24
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_server_id2.result35
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_session_var.result29
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_sf.result9
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_skip_error.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_slave_status.result107
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff477
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_sp.result1029
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_sp004.result17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_sp_effects.result96
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result23
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result35
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result22
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result33
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result49
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result116
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_temp_table.result29
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_temporary.result157
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_trigger.result186
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_user_variables.result243
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_variables.result9
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_view.result66
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl000010-slave.opt1
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl000010.test19
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl000011.test17
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl000013.test61
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl000017-slave.opt1
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_000010.test2
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_000011.test18
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_000013.test2
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_000015.test11
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_000017.test2
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test38
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test47
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_alter.test24
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_alter_db.test12
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_bit.test93
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_bit_npk.test116
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_change_master.test37
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_create_database.test72
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_do_grant.test98
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_drop.test16
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_drop_db.test61
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test17
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test15
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test68
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test24
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_free_items.test22
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_get_lock.test49
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test59
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test51
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test38
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_init_slave.test34
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_insert.test44
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_insert_select.test7
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_loaddata2.test5
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test52
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test30
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test19
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_loadfile.test6
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_log_pos.test58
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_many_optimize.test22
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_master_pos_wait.test18
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_misc_functions.test46
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_multi_delete.test26
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test68
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_multi_update4.test45
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_ps.test49
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test47
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_relayspace.test34
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test30
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_NOW.test74
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_USER.test57
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_drop.test48
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_func001.test57
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test21
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test4
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp001.test146
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp005.test108
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp008.test57
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp009.test102
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp010.test80
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp011.test111
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp012.test75
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test8
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_trig001.test100
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_trig002.test82
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_trig003.test152
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_until.test126
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_view01.test82
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_server_id1.test22
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_server_id2.test26
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_session_var.test42
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_sf.test3
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_skip_error.test13
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_slave_status.test58
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_sp.test496
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_sp004.test97
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_sp_effects.test208
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test23
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test20
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test93
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test565
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_temp_table.test69
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_temporary.test235
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_trigger.test107
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test35
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_user_variables.test57
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_variables.test3
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_view-slave.opt1
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_view.test155
-rw-r--r--mysql-test/suite/galera/disabled.def1
-rw-r--r--mysql-test/suite/galera/r/galera_fulltext.result28
-rw-r--r--mysql-test/suite/galera/t/galera_fulltext.test23
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_grant.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_master_pos_wait.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_USER.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result18
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_grant.test24
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table_update.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_master_pos_wait.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_USER.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig002.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp.test5
-rw-r--r--scripts/mysqld_multi.sh15
-rw-r--r--sql/contributors.h13
-rw-r--r--sql/item.cc31
-rw-r--r--sql/item.h10
-rw-r--r--sql/item_cmpfunc.cc2
-rw-r--r--sql/item_subselect.cc49
-rw-r--r--sql/item_subselect.h6
-rw-r--r--sql/mysqld.cc3
-rw-r--r--sql/sql_class.h19
-rw-r--r--sql/sql_cte.cc1
-rw-r--r--sql/sql_join_cache.cc88
-rw-r--r--sql/sql_join_cache.h11
-rw-r--r--sql/sql_parse.cc8
-rw-r--r--sql/sql_plugin_services.ic1
-rw-r--r--sql/sql_show.cc11
-rw-r--r--sql/wsrep_dummy.cc10
-rw-r--r--sql/wsrep_thd.cc19
-rw-r--r--storage/innobase/.clang-format-old (renamed from storage/innobase/.clang-format)0
-rw-r--r--storage/innobase/btr/btr0cur.cc1
-rw-r--r--storage/innobase/fil/fil0fil.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc384
-rw-r--r--storage/innobase/include/os0file.h3
-rw-r--r--storage/innobase/os/os0file.cc3
-rw-r--r--storage/innobase/trx/trx0i_s.cc11
-rw-r--r--support-files/mariadb.pc.in5
-rw-r--r--vio/viossl.c15
244 files changed, 5073 insertions, 6847 deletions
diff --git a/CREDITS b/CREDITS
index 9f03f7fc24e..f5e87e18752 100644
--- a/CREDITS
+++ b/CREDITS
@@ -4,24 +4,19 @@ organization registered in the USA.
The current main sponsors of the MariaDB Foundation are:
Alibaba Cloud https://www.alibabacloud.com/ (2017)
-Booking.com https://www.booking.com (2013)
MariaDB Corporation https://www.mariadb.com (2013)
Microsoft https://microsoft.com/ (2017)
+ServiceNow https://servicenow.com (2019)
Tencent Cloud https://cloud.tencent.com (2017)
Development Bank of Singapore https://dbs.com (2016)
IBM https://www.ibm.com (2017)
-Tencent Games http://game.qq.com/ (2018)
Visma https://visma.com (2015)
-Acronis https://acronis.com (2016)
-Nexedi https://www.nexedi.com (2016)
+Automattic https://automattic.com (2019)
+Galera Cluster https://galeracluster.com (2020)
Percona https://www.percona.com (2018)
-Tencent Game DBA http://tencentdba.com/about (2016)
-Tencent TDSQL http://tdsql.org (2016)
-Verkkokauppa.com https://www.verkkokauppa.com (2015)
-Virtuozzo https://virtuozzo.com (2016)
For a full list of sponsors, see
-https://mariadb.org/about/supporters/
+https://mariadb.org/about/#sponsors
and for individual contributors, see
https://mariadb.org/donate/individual-sponsors/
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake
index dd1729bec42..8c24d2484ea 100644
--- a/cmake/install_macros.cmake
+++ b/cmake/install_macros.cmake
@@ -181,7 +181,7 @@ IF(WIN32)
MARK_AS_ADVANCED(SIGNCODE)
IF(SIGNCODE)
SET(SIGNTOOL_PARAMETERS
- /a /t http://timestamp.globalsign.com/scripts/timstamp.dll
+ /a /t http://timestamp.globalsign.com/?signature=sha2
CACHE STRING "parameters for signtool (list)")
FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool
PATHS "$ENV{ProgramFiles}/Microsoft SDKs/Windows/v7.0A/bin"
diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h
index 3ddec13b719..10c70c790e9 100644
--- a/include/mysql/service_wsrep.h
+++ b/include/mysql/service_wsrep.h
@@ -62,7 +62,6 @@ extern struct wsrep_service_st {
int (*wsrep_thd_retry_counter_func)(const MYSQL_THD thd);
bool (*wsrep_thd_ignore_table_func)(MYSQL_THD thd);
long long (*wsrep_thd_trx_seqno_func)(const MYSQL_THD thd);
- void (*wsrep_thd_auto_increment_variables_func)(THD *thd, unsigned long long *offset, unsigned long long *increment);
my_bool (*wsrep_thd_is_aborting_func)(const MYSQL_THD thd);
void (*wsrep_set_data_home_dir_func)(const char *data_dir);
my_bool (*wsrep_thd_is_BF_func)(const MYSQL_THD thd, my_bool sync);
@@ -112,7 +111,6 @@ extern struct wsrep_service_st {
#define wsrep_thd_retry_counter(T) wsrep_service->wsrep_thd_retry_counter_func(T)
#define wsrep_thd_ignore_table(T) wsrep_service->wsrep_thd_ignore_table_func(T)
#define wsrep_thd_trx_seqno(T) wsrep_service->wsrep_thd_trx_seqno_func(T)
-#define wsrep_thd_auto_increment_variables(T,O,I) wsrep_service->wsrep_thd_auto_increment_variables_func(T,O,I)
#define wsrep_set_data_home_dir(A) wsrep_service->wsrep_set_data_home_dir_func(A)
#define wsrep_thd_is_BF(T,S) wsrep_service->wsrep_thd_is_BF_func(T,S)
#define wsrep_thd_is_aborting(T) wsrep_service->wsrep_thd_is_aborting_func(T)
@@ -152,7 +150,6 @@ extern "C" long long wsrep_xid_seqno(const struct xid_t* xid);
const unsigned char* wsrep_xid_uuid(const struct xid_t* xid);
extern "C" long long wsrep_thd_trx_seqno(const MYSQL_THD thd);
my_bool get_wsrep_recovery();
-void wsrep_thd_auto_increment_variables(THD *thd, unsigned long long *offset, unsigned long long *increment);
bool wsrep_thd_ignore_table(MYSQL_THD thd);
void wsrep_set_data_home_dir(const char *data_dir);
diff --git a/include/service_versions.h b/include/service_versions.h
index 125d53b6cd3..fb7e715f858 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2009, 2010, Oracle and/or its affiliates.
- Copyright (c) 2012, 2017, MariaDB
+ Copyright (c) 2012, 2021, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -41,5 +41,5 @@
#define VERSION_thd_specifics 0x0100
#define VERSION_thd_timezone 0x0100
#define VERSION_thd_wait 0x0100
-#define VERSION_wsrep 0x0203
+#define VERSION_wsrep 0x0400
#define VERSION_json 0x0100
diff --git a/libmariadb b/libmariadb
-Subproject e62ff462c58ce154596a0f1da9e79cd4395396e
+Subproject a746c3af449a8754e78ad7971e59e79af7957cd
diff --git a/mysql-test/main/brackets.result b/mysql-test/main/brackets.result
index 99e84f979b4..c221d64fd17 100644
--- a/mysql-test/main/brackets.result
+++ b/mysql-test/main/brackets.result
@@ -4444,7 +4444,7 @@ order by a desc limit 3 )
(select a from t where a=4 union select a from t where a=7 order by a desc);
show create view v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as ((select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3) union (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3) order by `a` desc limit 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 4 union select `t`.`a` AS `a` from ((select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3) union (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3) order by `a` desc limit 3) `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as ((select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3) union (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3) order by `a` desc limit 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 4 union select `t`.`a` AS `a` from `t` where `t`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
select * from v1;
a
7
@@ -4508,7 +4508,7 @@ s as (select * from t where a > 3)
select a from t where a=1 union select a from s where a=7 order by a desc;
show create view v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3), s as (select `t`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3) `t` where `t`.`a` > 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 1 union select `s`.`a` AS `a` from `s` where `s`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3), s as (select `t`.`a` AS `a` from `t` where `t`.`a` > 3)select `t`.`a` AS `a` from `t` where `t`.`a` = 1 union select `s`.`a` AS `a` from `s` where `s`.`a` = 7 order by `a` desc latin1 latin1_swedish_ci
select * from v1;
a
1
diff --git a/mysql-test/main/contributors.result b/mysql-test/main/contributors.result
index 3e4bf5f0d43..0c7ca03a2c5 100644
--- a/mysql-test/main/contributors.result
+++ b/mysql-test/main/contributors.result
@@ -1,21 +1,16 @@
SHOW CONTRIBUTORS;
Name Location Comment
-Booking.com https://www.booking.com Founding member, Platinum Sponsor of the MariaDB Foundation
Alibaba Cloud https://www.alibabacloud.com/ Platinum Sponsor of the MariaDB Foundation
Tencent Cloud https://cloud.tencent.com Platinum Sponsor of the MariaDB Foundation
Microsoft https://microsoft.com/ Platinum Sponsor of the MariaDB Foundation
MariaDB Corporation https://mariadb.com Founding member, Platinum Sponsor of the MariaDB Foundation
+ServiceNow https://servicenow.com Platinum Sponsor of the MariaDB Foundation
Visma https://visma.com Gold Sponsor of the MariaDB Foundation
DBS https://dbs.com Gold Sponsor of the MariaDB Foundation
IBM https://www.ibm.com Gold Sponsor of the MariaDB Foundation
-Tencent Games http://game.qq.com/ Gold Sponsor of the MariaDB Foundation
-Nexedi https://www.nexedi.com Silver Sponsor of the MariaDB Foundation
-Acronis https://www.acronis.com Silver Sponsor of the MariaDB Foundation
-Verkkokauppa.com https://www.verkkokauppa.com Bronze Sponsor of the MariaDB Foundation
-Virtuozzo https://virtuozzo.com Bronze Sponsor of the MariaDB Foundation
-Tencent Game DBA http://tencentdba.com/about Bronze Sponsor of the MariaDB Foundation
-Tencent TDSQL http://tdsql.org Bronze Sponsor of the MariaDB Foundation
-Percona https://www.percona.com/ Bronze Sponsor of the MariaDB Foundation
+Automattic https://automattic.com Silver Sponsor of the MariaDB Foundation
+Percona https://www.percona.com/ Sponsor of the MariaDB Foundation
+Galera Cluster https://galeracluster.com Sponsor of the MariaDB Foundation
Google USA Sponsoring encryption, parallel replication and GTID
Facebook USA Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc
Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction
diff --git a/mysql-test/main/cte_nonrecursive.result b/mysql-test/main/cte_nonrecursive.result
index ee2320ce0ea..f50ac50ded9 100644
--- a/mysql-test/main/cte_nonrecursive.result
+++ b/mysql-test/main/cte_nonrecursive.result
@@ -618,7 +618,7 @@ with t(c) as (select a from t1 where b >= 'c')
select * from t r1, t r2 where r1.c=r2.c and r2.c=4;
show create view v4;
View Create View character_set_client collation_connection
-v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t(c) as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c') `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci
+v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t(c) as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join `t` `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci
select * from v4;
c d
4 4
@@ -1126,7 +1126,7 @@ NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union11,12> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 with cte_e as (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union select `cte_e2`.`a` AS `a` from (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7) `cte_e2`
+Note 1003 with cte_e as (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2`
drop table t1;
#
# MDEV-13753: embedded CTE in a VIEW created in prepared statement
@@ -1725,6 +1725,44 @@ drop table db1.t1;
drop database db1;
create database test;
use test;
+#
+# MDEV-24597: CTE with union used multiple times in query
+#
+with cte(a) as
+(select 1 as d union select 2 as d)
+select a from cte as r1
+union
+select a from cte as r2;
+a
+1
+2
+create table t1 (a int, b int) engine=myisam;
+insert into t1 values
+(3,30), (7,70), (1,10), (7,71), (2,20), (7,72), (3,33), (4,44),
+(5,50), (4,40), (3,33), (4,42), (4,43), (5,51);
+with cte(c) as
+(select a from t1 where b < 30 union select a from t1 where b > 40)
+select * from cte as r1, cte as r2 where r1.c = r2.c;
+c c
+1 1
+2 2
+7 7
+4 4
+5 5
+with cte(a,c) as
+(
+select a, count(*) from t1 group by a having count(*) = 1
+union
+select a, count(*) from t1 group by a having count(*) = 3
+)
+select a, c from cte as r1 where a < 3
+union
+select a, c from cte as r2 where a > 4;
+a c
+1 1
+2 1
+7 3
+drop table t1;
# End of 10.2 tests
#
# MDEV-21673: several references to CTE that uses
diff --git a/mysql-test/main/cte_nonrecursive.test b/mysql-test/main/cte_nonrecursive.test
index 2242dce3769..49df2bb9ec0 100644
--- a/mysql-test/main/cte_nonrecursive.test
+++ b/mysql-test/main/cte_nonrecursive.test
@@ -1230,6 +1230,37 @@ drop database db1;
create database test;
use test;
+--echo #
+--echo # MDEV-24597: CTE with union used multiple times in query
+--echo #
+
+with cte(a) as
+(select 1 as d union select 2 as d)
+select a from cte as r1
+union
+select a from cte as r2;
+
+create table t1 (a int, b int) engine=myisam;
+insert into t1 values
+(3,30), (7,70), (1,10), (7,71), (2,20), (7,72), (3,33), (4,44),
+(5,50), (4,40), (3,33), (4,42), (4,43), (5,51);
+
+with cte(c) as
+(select a from t1 where b < 30 union select a from t1 where b > 40)
+select * from cte as r1, cte as r2 where r1.c = r2.c;
+
+with cte(a,c) as
+(
+ select a, count(*) from t1 group by a having count(*) = 1
+ union
+ select a, count(*) from t1 group by a having count(*) = 3
+)
+select a, c from cte as r1 where a < 3
+union
+select a, c from cte as r2 where a > 4;
+
+drop table t1;
+
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result
index 290aa492a98..2b8048a3120 100644
--- a/mysql-test/main/join_cache.result
+++ b/mysql-test/main/join_cache.result
@@ -6069,6 +6069,63 @@ f2
drop table t1, t2;
set join_buffer_size=@save_join_buffer_size;
#
+# MDEV-21104: BNLH used for multi-join query with embedded outer join
+# and possible 'not exists' optimization
+#
+set join_cache_level=4;
+CREATE TABLE t1 (a int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b int, c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,2),(2,4);
+CREATE TABLE t3 (d int, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (1),(2);
+CREATE TABLE t4 (e int primary key) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (1),(2);
+ANALYZE TABLE t1,t2,t3,t4;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
+test.t3 analyze status OK
+test.t4 analyze status Engine-independent statistics collected
+test.t4 analyze status OK
+SELECT * FROM t2 LEFT JOIN t3 ON c = d;
+b c d
+1 2 2
+2 4 NULL
+SELECT * FROM (t2 LEFT JOIN t3 ON c = d ) JOIN t4;
+b c d e
+1 2 2 1
+2 4 NULL 1
+1 2 2 2
+2 4 NULL 2
+EXPLAIN SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join)
+1 SIMPLE t4 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using index; Using join buffer (incremental, BNLH join)
+SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e;
+a b c d e
+1 1 2 2 1
+2 1 2 2 1
+1 2 4 NULL 2
+2 2 4 NULL 2
+EXPLAIN SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e
+WHERE e IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join)
+1 SIMPLE t4 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using where; Using index; Not exists; Using join buffer (incremental, BNLH join)
+SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e
+WHERE e IS NULL;
+a b c d e
+DROP TABLE t1,t2,t3,t4;
+set join_cache_level=@save_join_cache_level;
+#
# MDEV-21243: Join buffer: condition is checked in wrong place for range access
#
create table t1(a int primary key);
@@ -6141,6 +6198,7 @@ EXPLAIN
}
}
drop table t1,t2,t3;
+# End of 10.3 tests
set @@optimizer_switch=@save_optimizer_switch;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
diff --git a/mysql-test/main/join_cache.test b/mysql-test/main/join_cache.test
index ce84ccb56fc..506e613887b 100644
--- a/mysql-test/main/join_cache.test
+++ b/mysql-test/main/join_cache.test
@@ -4071,6 +4071,41 @@ set join_buffer_size=@save_join_buffer_size;
--echo #
+--echo # MDEV-21104: BNLH used for multi-join query with embedded outer join
+--echo # and possible 'not exists' optimization
+--echo #
+
+set join_cache_level=4;
+
+CREATE TABLE t1 (a int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b int, c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,2),(2,4);
+CREATE TABLE t3 (d int, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (1),(2);
+CREATE TABLE t4 (e int primary key) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (1),(2);
+ANALYZE TABLE t1,t2,t3,t4;
+
+SELECT * FROM t2 LEFT JOIN t3 ON c = d;
+SELECT * FROM (t2 LEFT JOIN t3 ON c = d ) JOIN t4;
+
+let $q1=
+SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e;
+eval EXPLAIN $q1;
+eval $q1;
+
+let $q2=
+SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e
+ WHERE e IS NULL;
+eval EXPLAIN $q2;
+eval $q2;
+
+DROP TABLE t1,t2,t3,t4;
+
+set join_cache_level=@save_join_cache_level;
+
+--echo #
--echo # MDEV-21243: Join buffer: condition is checked in wrong place for range access
--echo #
create table t1(a int primary key);
@@ -4109,6 +4144,7 @@ where
drop table t1,t2,t3;
+--echo # End of 10.3 tests
# The following command must be the last one in the file
set @@optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/main/status2.result b/mysql-test/main/status2.result
index fa0fc4e1061..60309e14fe3 100644
--- a/mysql-test/main/status2.result
+++ b/mysql-test/main/status2.result
@@ -74,4 +74,12 @@ DROP TRIGGER trigg1;
DROP FUNCTION testQuestion;
DROP EVENT ev1;
DROP TABLE t1,t2;
-End of 6.0 tests
+#
+# End of 5.5 tests
+#
+select variable_value < 1024*1024*1024 from information_schema.global_status where variable_name='memory_used';
+variable_value < 1024*1024*1024
+1
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/status2.test b/mysql-test/main/status2.test
index fa3b718efaa..ea674c2ed7c 100644
--- a/mysql-test/main/status2.test
+++ b/mysql-test/main/status2.test
@@ -64,5 +64,14 @@ DROP TRIGGER trigg1;
DROP FUNCTION testQuestion;
DROP EVENT ev1;
DROP TABLE t1,t2;
---echo End of 6.0 tests
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
+select variable_value < 1024*1024*1024 from information_schema.global_status where variable_name='memory_used';
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result
index 349e7dca129..15ebaa33474 100644
--- a/mysql-test/main/subselect.result
+++ b/mysql-test/main/subselect.result
@@ -7344,6 +7344,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
#
# Start of 10.4 tests
diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test
index be17254202e..d87aba57567 100644
--- a/mysql-test/main/subselect.test
+++ b/mysql-test/main/subselect.test
@@ -6171,6 +6171,41 @@ SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
DROP TABLE t;
+--echo #
+--echo # MDEV-25002: Outer reference in ON clause of subselect
+--echo #
+
+create table t1 (
+ pk int primary key,
+ a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+
+create table t2 (
+ pk int primary key,
+ b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+
+create table t3 (a int);
+insert into t3 values (1),(2);
+
+select a,
+ (select count(*) from t1, t2
+ where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+select a,
+ (select count(*) from t1 join t2 on t2.pk=t3.a
+ where t1.pk=1) as sq
+from t3;
+
+select a from t3
+ where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+select a from t3
+ where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+
+drop table t1,t2,t3;
+
--echo # End of 10.2 tests
diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result
index 813d9ff5564..df21b90b18b 100644
--- a/mysql-test/main/subselect4.result
+++ b/mysql-test/main/subselect4.result
@@ -2694,6 +2694,33 @@ INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id);
ERROR 42S22: Unknown column 's.id' in 'group statement'
DROP TABLE t1;
+#
+# MDEV-24519: Server crashes in Charset::set_charset upon SELECT
+#
+CREATE TABLE t1 (a VARBINARY(8));
+INSERT INTO t1 VALUES ('foo'),('bar');
+CREATE TABLE t2 (b VARBINARY(8));
+EXPLAIN
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2);
+a
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b VARBINARY(8));
+EXPLAIN
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2);
+a
+DROP TABLE t1,t2;
# End of 10.2 tests
#
# MDEV-18335: Assertion `!error || error == 137' failed in subselect_rowid_merge_engine::init
diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test
index 3a6ea922c4d..c173289eb19 100644
--- a/mysql-test/main/subselect4.test
+++ b/mysql-test/main/subselect4.test
@@ -2212,6 +2212,30 @@ INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id);
DROP TABLE t1;
+--echo #
+--echo # MDEV-24519: Server crashes in Charset::set_charset upon SELECT
+--echo #
+
+CREATE TABLE t1 (a VARBINARY(8));
+INSERT INTO t1 VALUES ('foo'),('bar');
+CREATE TABLE t2 (b VARBINARY(8));
+
+EXPLAIN
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2);
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2);
+
+DROP TABLE t1,t2;
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b VARBINARY(8));
+
+EXPLAIN
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2);
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2);
+
+DROP TABLE t1,t2;
+
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result
index 84c415d1ce1..b1432cf0979 100644
--- a/mysql-test/main/subselect_no_exists_to_in.result
+++ b/mysql-test/main/subselect_no_exists_to_in.result
@@ -7344,6 +7344,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
#
# Start of 10.4 tests
diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result
index 93035e235f7..da60f98bf00 100644
--- a/mysql-test/main/subselect_no_mat.result
+++ b/mysql-test/main/subselect_no_mat.result
@@ -7337,6 +7337,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
#
# Start of 10.4 tests
diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result
index 09f664d3c28..fb99e237a1c 100644
--- a/mysql-test/main/subselect_no_opts.result
+++ b/mysql-test/main/subselect_no_opts.result
@@ -7335,6 +7335,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
#
# Start of 10.4 tests
diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result
index 765bb15a3df..4b910009248 100644
--- a/mysql-test/main/subselect_no_scache.result
+++ b/mysql-test/main/subselect_no_scache.result
@@ -7350,6 +7350,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
#
# Start of 10.4 tests
diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result
index 97d2f3b058f..f2230718754 100644
--- a/mysql-test/main/subselect_no_semijoin.result
+++ b/mysql-test/main/subselect_no_semijoin.result
@@ -7335,6 +7335,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
#
# Start of 10.4 tests
diff --git a/mysql-test/suite/engines/funcs/disabled.def b/mysql-test/suite/engines/funcs/disabled.def
index c43b0c92bc9..e1e2491b4a8 100644
--- a/mysql-test/suite/engines/funcs/disabled.def
+++ b/mysql-test/suite/engines/funcs/disabled.def
@@ -1,97 +1,4 @@
# List of disabled tests
# test name : comment
-rpl_redirect : Fails due to bug#49978
-crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb
-ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value
-ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value
-rpl_empty_master_crash : Test not applicable in 5.5+
-rpl_REDIRECT : Test not applicable in 5.5+
-rpl_create_database : Result Difference Due To Change In .inc file
-rpl_loaddata_m : Result Difference Due To Change In .inc file
-rpl_sp_effects : Result Difference Due To Change In .inc file
-rpl_variables : Result Difference Due To Change In .inc file
-rpl_loaddata_s : Result Difference Due To Change In .inc file
-rpl_dual_pos_advance : Result Difference Due To Change In .inc file
-rpl000011 : Result Difference Due To Change In .inc file
-rpl000013 : Result Difference Due To Change In .inc file
-rpl_000015 : Result Difference Due To Change In .inc file
-rpl_LD_INFILE : Result Difference Due To Change In .inc file
-rpl_alter : Result Difference Due To Change In .inc file
-rpl_alter_db : Result Difference Due To Change In .inc file
-rpl_alter_db : Result Difference Due To Change In .inc file
-rpl_bit : Result Difference Due To Change In .inc file
-rpl_bit_npk : Result Difference Due To Change In .inc file
-rpl_change_master : Result Difference Due To Change In .inc file
-rpl_do_grant : Result Difference Due To Change In .inc file
-rpl_drop : Result Difference Due To Change In .inc file
-rpl_drop_db : Result Difference Due To Change In .inc file
-rpl_flushlog_loop : Result Difference Due To Change In .inc file
-rpl_get_lock : Result Difference Due To Change In .inc file
-rpl_get_lock : Result Difference Due To Change In .inc file
-rpl_insert : Result Difference Due To Change In .inc file
-rpl_insert_select : Result Difference Due To Change In .inc file
-rpl_loaddata2 : Result Difference Due To Change In .inc file
-rpl_loaddatalocal : Result Difference Due To Change In .inc file
-rpl_loadfile : Result Difference Due To Change In .inc file
-rpl_log_pos : Result Difference Due To Change In .inc file
-rpl_many_optimize : Result Difference Due To Change In .inc file
-rpl_master_pos_wait : Result Difference Due To Change In .inc file
-rpl_misc_functions : Result Difference Due To Change In .inc file
-rpl_ps : Result Difference Due To Change In .inc file
-rpl_server_id1 : Result Difference Due To Change In .inc file
-rpl_session_var : Result Difference Due To Change In .inc file
-rpl_sf : Result Difference Due To Change In .inc file
-rpl_slave_status : Result Difference Due To Change In .inc file
-rpl_sp004 : Result Difference Due To Change In .inc file
-rpl_start_stop_slave : Result Difference Due To Change In .inc file
-rpl_stm_max_relay_size : Result Difference Due To Change In .inc file
-rpl_stm_mystery22 : Result Difference Due To Change In .inc file
-rpl_stm_no_op : Result Difference Due To Change In .inc file
-rpl_stm_reset_slave : Result Difference Due To Change In .inc file
-rpl_temp_table : Result Difference Due To Change In .inc file
-rpl_temporary : Result Difference Due To Change In .inc file
-rpl_trigger : Result Difference Due To Change In .inc file
-rpl_trunc_temp : Result Difference Due To Change In .inc file
-rpl_user_variables : Result Difference Due To Change In .inc file
-rpl_server_id2 : Result Difference Due To Change In .inc file
-rpl000010 : Result Difference Due To Change In .inc file
-rpl_init_slave : Result Difference Due To Change In .inc file
-rpl_multi_delete2 : Result Difference Due To Change In .inc file
-rpl_view : Result Difference Due To Change In .inc file
-rpl_ignore_table_update : Result Difference Due To Change In .inc file
-rpl_err_ignoredtable : Result Difference Due To Change In .inc file
-rpl_multi_update4 : Result Difference Due To Change In .inc file
-rpl_multi_delete : Result Difference Due To Change In .inc file
-rpl_ignore_grant : Result Difference Due To Change In .inc file
-rpl_ignore_revoke : Result Difference Due To Change In .inc file
-rpl_free_items : Result Difference Due To Change In .inc file
-rpl_replicate_ignore_db : Result Difference Due To Change In .inc file
-rpl000017 : Result Difference Due To Change In .inc file
-rpl_skip_error : Result Difference Due To Change In .inc file
-
-rpl_loaddata_s : Test Present in rpl suite as well . Test Fails due to bin log truncation.
-rpl_log_pos : Test Present in rpl suite as well . Test Fails due to bin log truncation.
-rpl_row_NOW : Result Difference Due To Change In .inc file
-rpl_row_USER : Result Difference Due To Change In .inc file
-rpl_row_drop : Result Difference Due To Change In .inc file
-rpl_row_func001 : Result Difference Due To Change In .inc file
-rpl_row_max_relay_size : Result Difference Due To Change In .inc file
-rpl_row_reset_slave : Result Difference Due To Change In .inc file
-rpl_row_sp001 : Result Difference Due To Change In .inc file
-rpl_row_sp005 : Result Difference Due To Change In .inc file
-rpl_row_sp008 : Result Difference Due To Change In .inc file
-rpl_row_sp009 : Result Difference Due To Change In .inc file
-rpl_row_sp010 : Result Difference Due To Change In .inc file
-rpl_row_sp011 : Result Difference Due To Change In .inc file
-rpl_row_sp012 : Result Difference Due To Change In .inc file
-rpl_row_stop_middle : Result Difference Due To Change In .inc file
-rpl_row_trig001 : Result Difference Due To Change In .inc file
-rpl_row_trig002 : Result Difference Due To Change In .inc file
-rpl_row_trig003 : Result Difference Due To Change In .inc file
-rpl_row_view01 : Result Difference Due To Change In .inc file
-rpl_switch_stm_row_mixed : Result Difference Due To Change In .inc file
-rpl_relayspace : Result Difference Due To Change In .inc file
-rpl_row_inexist_tbl : Result Difference Due To Change In .inc file
-rpl_sp : Result Difference Due To Change In .inc file
-rpl_rbr_to_sbr : Result Difference Due To Change In .inc file
+crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb [ERROR] InnoDB: Cannot add field `c726` in table `test`.`t1` because after adding it, the row size is 8135 which is greater than maximum allowed size (8126 bytes) for a record on index leaf page
diff --git a/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result b/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result
index 47079e34b38..6a2acb7ec86 100644
--- a/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result
+++ b/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result
@@ -1,5 +1,8 @@
-DROP TABLE IF EXISTS t1;
+SET SESSION innodb_strict_mode=off;
+call mtr.add_suppression("Row size too large (> 8126)*");
CREATE TABLE t1 (c1 VARCHAR(10),c2 VARCHAR(10),c3 VARCHAR(10),c4 VARCHAR(10),c5 VARCHAR(10),c6 VARCHAR(10),c7 VARCHAR(10),c8 VARCHAR(10),c9 VARCHAR(10),c10 VARCHAR(10),c11 VARCHAR(10),c12 VARCHAR(10),c13 VARCHAR(10),c14 VARCHAR(10),c15 VARCHAR(10),c16 VARCHAR(10),c17 VARCHAR(10),c18 VARCHAR(10),c19 VARCHAR(10),c20 VARCHAR(10),c21 VARCHAR(10),c22 VARCHAR(10),c23 VARCHAR(10),c24 VARCHAR(10),c25 VARCHAR(10),c26 VARCHAR(10),c27 VARCHAR(10),c28 VARCHAR(10),c29 VARCHAR(10),c30 VARCHAR(10),c31 VARCHAR(10),c32 VARCHAR(10),c33 VARCHAR(10),c34 VARCHAR(10),c35 VARCHAR(10),c36 VARCHAR(10),c37 VARCHAR(10),c38 VARCHAR(10),c39 VARCHAR(10),c40 VARCHAR(10),c41 VARCHAR(10),c42 VARCHAR(10),c43 VARCHAR(10),c44 VARCHAR(10),c45 VARCHAR(10),c46 VARCHAR(10),c47 VARCHAR(10),c48 VARCHAR(10),c49 VARCHAR(10),c50 VARCHAR(10),c51 VARCHAR(10),c52 VARCHAR(10),c53 VARCHAR(10),c54 VARCHAR(10),c55 VARCHAR(10),c56 VARCHAR(10),c57 VARCHAR(10),c58 VARCHAR(10),c59 VARCHAR(10),c60 VARCHAR(10),c61 VARCHAR(10),c62 VARCHAR(10),c63 VARCHAR(10),c64 VARCHAR(10),c65 VARCHAR(10),c66 VARCHAR(10),c67 VARCHAR(10),c68 VARCHAR(10),c69 VARCHAR(10),c70 VARCHAR(10),c71 VARCHAR(10),c72 VARCHAR(10),c73 VARCHAR(10),c74 VARCHAR(10),c75 VARCHAR(10),c76 VARCHAR(10),c77 VARCHAR(10),c78 VARCHAR(10),c79 VARCHAR(10),c80 VARCHAR(10),c81 VARCHAR(10),c82 VARCHAR(10),c83 VARCHAR(10),c84 VARCHAR(10),c85 VARCHAR(10),c86 VARCHAR(10),c87 VARCHAR(10),c88 VARCHAR(10),c89 VARCHAR(10),c90 VARCHAR(10),c91 VARCHAR(10),c92 VARCHAR(10),c93 VARCHAR(10),c94 VARCHAR(10),c95 VARCHAR(10),c96 VARCHAR(10),c97 VARCHAR(10),c98 VARCHAR(10),c99 VARCHAR(10),c100 VARCHAR(10),c101 VARCHAR(10),c102 VARCHAR(10),c103 VARCHAR(10),c104 VARCHAR(10),c105 VARCHAR(10),c106 VARCHAR(10),c107 VARCHAR(10),c108 VARCHAR(10),c109 VARCHAR(10),c110 VARCHAR(10),c111 VARCHAR(10),c112 VARCHAR(10),c113 VARCHAR(10),c114 VARCHAR(10),c115 VARCHAR(10),c116 VARCHAR(10),c117 VARCHAR(10),c118 VARCHAR(10),c119 VARCHAR(10),c120 VARCHAR(10),c121 VARCHAR(10),c122 VARCHAR(10),c123 VARCHAR(10),c124 VARCHAR(10),c125 VARCHAR(10),c126 VARCHAR(10),c127 VARCHAR(10),c128 VARCHAR(10),c129 VARCHAR(10),c130 VARCHAR(10),c131 VARCHAR(10),c132 VARCHAR(10),c133 VARCHAR(10),c134 VARCHAR(10),c135 VARCHAR(10),c136 VARCHAR(10),c137 VARCHAR(10),c138 VARCHAR(10),c139 VARCHAR(10),c140 VARCHAR(10),c141 VARCHAR(10),c142 VARCHAR(10),c143 VARCHAR(10),c144 VARCHAR(10),c145 VARCHAR(10),c146 VARCHAR(10),c147 VARCHAR(10),c148 VARCHAR(10),c149 VARCHAR(10),c150 VARCHAR(10),c151 VARCHAR(10),c152 VARCHAR(10),c153 VARCHAR(10),c154 VARCHAR(10),c155 VARCHAR(10),c156 VARCHAR(10),c157 VARCHAR(10),c158 VARCHAR(10),c159 VARCHAR(10),c160 VARCHAR(10),c161 VARCHAR(10),c162 VARCHAR(10),c163 VARCHAR(10),c164 VARCHAR(10),c165 VARCHAR(10),c166 VARCHAR(10),c167 VARCHAR(10),c168 VARCHAR(10),c169 VARCHAR(10),c170 VARCHAR(10),c171 VARCHAR(10),c172 VARCHAR(10),c173 VARCHAR(10),c174 VARCHAR(10),c175 VARCHAR(10),c176 VARCHAR(10),c177 VARCHAR(10),c178 VARCHAR(10),c179 VARCHAR(10),c180 VARCHAR(10),c181 VARCHAR(10),c182 VARCHAR(10),c183 VARCHAR(10),c184 VARCHAR(10),c185 VARCHAR(10),c186 VARCHAR(10),c187 VARCHAR(10),c188 VARCHAR(10),c189 VARCHAR(10),c190 VARCHAR(10),c191 VARCHAR(10),c192 VARCHAR(10),c193 VARCHAR(10),c194 VARCHAR(10),c195 VARCHAR(10),c196 VARCHAR(10),c197 VARCHAR(10),c198 VARCHAR(10),c199 VARCHAR(10),c200 VARCHAR(10),c201 VARCHAR(10),c202 VARCHAR(10),c203 VARCHAR(10),c204 VARCHAR(10),c205 VARCHAR(10),c206 VARCHAR(10),c207 VARCHAR(10),c208 VARCHAR(10),c209 VARCHAR(10),c210 VARCHAR(10),c211 VARCHAR(10),c212 VARCHAR(10),c213 VARCHAR(10),c214 VARCHAR(10),c215 VARCHAR(10),c216 VARCHAR(10),c217 VARCHAR(10),c218 VARCHAR(10),c219 VARCHAR(10),c220 VARCHAR(10),c221 VARCHAR(10),c222 VARCHAR(10),c223 VARCHAR(10),c224 VARCHAR(10),c225 VARCHAR(10),c226 VARCHAR(10),c227 VARCHAR(10),c228 VARCHAR(10),c229 VARCHAR(10),c230 VARCHAR(10),c231 VARCHAR(10),c232 VARCHAR(10),c233 VARCHAR(10),c234 VARCHAR(10),c235 VARCHAR(10),c236 VARCHAR(10),c237 VARCHAR(10),c238 VARCHAR(10),c239 VARCHAR(10),c240 VARCHAR(10),c241 VARCHAR(10),c242 VARCHAR(10),c243 VARCHAR(10),c244 VARCHAR(10),c245 VARCHAR(10),c246 VARCHAR(10),c247 VARCHAR(10),c248 VARCHAR(10),c249 VARCHAR(10),c250 VARCHAR(10),c251 VARCHAR(10),c252 VARCHAR(10),c253 VARCHAR(10),c254 VARCHAR(10),c255 VARCHAR(10),c256 VARCHAR(10),c257 VARCHAR(10),c258 VARCHAR(10),c259 VARCHAR(10),c260 VARCHAR(10),c261 VARCHAR(10),c262 VARCHAR(10),c263 VARCHAR(10),c264 VARCHAR(10),c265 VARCHAR(10),c266 VARCHAR(10),c267 VARCHAR(10),c268 VARCHAR(10),c269 VARCHAR(10),c270 VARCHAR(10),c271 VARCHAR(10),c272 VARCHAR(10),c273 VARCHAR(10),c274 VARCHAR(10),c275 VARCHAR(10),c276 VARCHAR(10),c277 VARCHAR(10),c278 VARCHAR(10),c279 VARCHAR(10),c280 VARCHAR(10),c281 VARCHAR(10),c282 VARCHAR(10),c283 VARCHAR(10),c284 VARCHAR(10),c285 VARCHAR(10),c286 VARCHAR(10),c287 VARCHAR(10),c288 VARCHAR(10),c289 VARCHAR(10),c290 VARCHAR(10),c291 VARCHAR(10),c292 VARCHAR(10),c293 VARCHAR(10),c294 VARCHAR(10),c295 VARCHAR(10),c296 VARCHAR(10),c297 VARCHAR(10),c298 VARCHAR(10),c299 VARCHAR(10),c300 VARCHAR(10),c301 VARCHAR(10),c302 VARCHAR(10),c303 VARCHAR(10),c304 VARCHAR(10),c305 VARCHAR(10),c306 VARCHAR(10),c307 VARCHAR(10),c308 VARCHAR(10),c309 VARCHAR(10),c310 VARCHAR(10),c311 VARCHAR(10),c312 VARCHAR(10),c313 VARCHAR(10),c314 VARCHAR(10),c315 VARCHAR(10),c316 VARCHAR(10),c317 VARCHAR(10),c318 VARCHAR(10),c319 VARCHAR(10),c320 VARCHAR(10),c321 VARCHAR(10),c322 VARCHAR(10),c323 VARCHAR(10),c324 VARCHAR(10),c325 VARCHAR(10),c326 VARCHAR(10),c327 VARCHAR(10),c328 VARCHAR(10),c329 VARCHAR(10),c330 VARCHAR(10),c331 VARCHAR(10),c332 VARCHAR(10),c333 VARCHAR(10),c334 VARCHAR(10),c335 VARCHAR(10),c336 VARCHAR(10),c337 VARCHAR(10),c338 VARCHAR(10),c339 VARCHAR(10),c340 VARCHAR(10),c341 VARCHAR(10),c342 VARCHAR(10),c343 VARCHAR(10),c344 VARCHAR(10),c345 VARCHAR(10),c346 VARCHAR(10),c347 VARCHAR(10),c348 VARCHAR(10),c349 VARCHAR(10),c350 VARCHAR(10),c351 VARCHAR(10),c352 VARCHAR(10),c353 VARCHAR(10),c354 VARCHAR(10),c355 VARCHAR(10),c356 VARCHAR(10),c357 VARCHAR(10),c358 VARCHAR(10),c359 VARCHAR(10),c360 VARCHAR(10),c361 VARCHAR(10),c362 VARCHAR(10),c363 VARCHAR(10),c364 VARCHAR(10),c365 VARCHAR(10),c366 VARCHAR(10),c367 VARCHAR(10),c368 VARCHAR(10),c369 VARCHAR(10),c370 VARCHAR(10),c371 VARCHAR(10),c372 VARCHAR(10),c373 VARCHAR(10),c374 VARCHAR(10),c375 VARCHAR(10),c376 VARCHAR(10),c377 VARCHAR(10),c378 VARCHAR(10),c379 VARCHAR(10),c380 VARCHAR(10),c381 VARCHAR(10),c382 VARCHAR(10),c383 VARCHAR(10),c384 VARCHAR(10),c385 VARCHAR(10),c386 VARCHAR(10),c387 VARCHAR(10),c388 VARCHAR(10),c389 VARCHAR(10),c390 VARCHAR(10),c391 VARCHAR(10),c392 VARCHAR(10),c393 VARCHAR(10),c394 VARCHAR(10),c395 VARCHAR(10),c396 VARCHAR(10),c397 VARCHAR(10),c398 VARCHAR(10),c399 VARCHAR(10),c400 VARCHAR(10),c401 VARCHAR(10),c402 VARCHAR(10),c403 VARCHAR(10),c404 VARCHAR(10),c405 VARCHAR(10),c406 VARCHAR(10),c407 VARCHAR(10),c408 VARCHAR(10),c409 VARCHAR(10),c410 VARCHAR(10),c411 VARCHAR(10),c412 VARCHAR(10),c413 VARCHAR(10),c414 VARCHAR(10),c415 VARCHAR(10),c416 VARCHAR(10),c417 VARCHAR(10),c418 VARCHAR(10),c419 VARCHAR(10),c420 VARCHAR(10),c421 VARCHAR(10),c422 VARCHAR(10),c423 VARCHAR(10),c424 VARCHAR(10),c425 VARCHAR(10),c426 VARCHAR(10),c427 VARCHAR(10),c428 VARCHAR(10),c429 VARCHAR(10),c430 VARCHAR(10),c431 VARCHAR(10),c432 VARCHAR(10),c433 VARCHAR(10),c434 VARCHAR(10),c435 VARCHAR(10),c436 VARCHAR(10),c437 VARCHAR(10),c438 VARCHAR(10),c439 VARCHAR(10),c440 VARCHAR(10),c441 VARCHAR(10),c442 VARCHAR(10),c443 VARCHAR(10),c444 VARCHAR(10),c445 VARCHAR(10),c446 VARCHAR(10),c447 VARCHAR(10),c448 VARCHAR(10),c449 VARCHAR(10),c450 VARCHAR(10),c451 VARCHAR(10),c452 VARCHAR(10),c453 VARCHAR(10),c454 VARCHAR(10),c455 VARCHAR(10),c456 VARCHAR(10),c457 VARCHAR(10),c458 VARCHAR(10),c459 VARCHAR(10),c460 VARCHAR(10),c461 VARCHAR(10),c462 VARCHAR(10),c463 VARCHAR(10),c464 VARCHAR(10),c465 VARCHAR(10),c466 VARCHAR(10),c467 VARCHAR(10),c468 VARCHAR(10),c469 VARCHAR(10),c470 VARCHAR(10),c471 VARCHAR(10),c472 VARCHAR(10),c473 VARCHAR(10),c474 VARCHAR(10),c475 VARCHAR(10),c476 VARCHAR(10),c477 VARCHAR(10),c478 VARCHAR(10),c479 VARCHAR(10),c480 VARCHAR(10),c481 VARCHAR(10),c482 VARCHAR(10),c483 VARCHAR(10),c484 VARCHAR(10),c485 VARCHAR(10),c486 VARCHAR(10),c487 VARCHAR(10),c488 VARCHAR(10),c489 VARCHAR(10),c490 VARCHAR(10),c491 VARCHAR(10),c492 VARCHAR(10),c493 VARCHAR(10),c494 VARCHAR(10),c495 VARCHAR(10),c496 VARCHAR(10),c497 VARCHAR(10),c498 VARCHAR(10),c499 VARCHAR(10),c500 VARCHAR(10),c501 VARCHAR(10),c502 VARCHAR(10),c503 VARCHAR(10),c504 VARCHAR(10),c505 VARCHAR(10),c506 VARCHAR(10),c507 VARCHAR(10),c508 VARCHAR(10),c509 VARCHAR(10),c510 VARCHAR(10),c511 VARCHAR(10),c512 VARCHAR(10),c513 VARCHAR(10),c514 VARCHAR(10),c515 VARCHAR(10),c516 VARCHAR(10),c517 VARCHAR(10),c518 VARCHAR(10),c519 VARCHAR(10),c520 VARCHAR(10),c521 VARCHAR(10),c522 VARCHAR(10),c523 VARCHAR(10),c524 VARCHAR(10),c525 VARCHAR(10),c526 VARCHAR(10),c527 VARCHAR(10),c528 VARCHAR(10),c529 VARCHAR(10),c530 VARCHAR(10),c531 VARCHAR(10),c532 VARCHAR(10),c533 VARCHAR(10),c534 VARCHAR(10),c535 VARCHAR(10),c536 VARCHAR(10),c537 VARCHAR(10),c538 VARCHAR(10),c539 VARCHAR(10),c540 VARCHAR(10),c541 VARCHAR(10),c542 VARCHAR(10),c543 VARCHAR(10),c544 VARCHAR(10),c545 VARCHAR(10),c546 VARCHAR(10),c547 VARCHAR(10),c548 VARCHAR(10),c549 VARCHAR(10),c550 VARCHAR(10),c551 VARCHAR(10),c552 VARCHAR(10),c553 VARCHAR(10),c554 VARCHAR(10),c555 VARCHAR(10),c556 VARCHAR(10),c557 VARCHAR(10),c558 VARCHAR(10),c559 VARCHAR(10),c560 VARCHAR(10),c561 VARCHAR(10),c562 VARCHAR(10),c563 VARCHAR(10),c564 VARCHAR(10),c565 VARCHAR(10),c566 VARCHAR(10),c567 VARCHAR(10),c568 VARCHAR(10),c569 VARCHAR(10),c570 VARCHAR(10),c571 VARCHAR(10),c572 VARCHAR(10),c573 VARCHAR(10),c574 VARCHAR(10),c575 VARCHAR(10),c576 VARCHAR(10),c577 VARCHAR(10),c578 VARCHAR(10),c579 VARCHAR(10),c580 VARCHAR(10),c581 VARCHAR(10),c582 VARCHAR(10),c583 VARCHAR(10),c584 VARCHAR(10),c585 VARCHAR(10),c586 VARCHAR(10),c587 VARCHAR(10),c588 VARCHAR(10),c589 VARCHAR(10),c590 VARCHAR(10),c591 VARCHAR(10),c592 VARCHAR(10),c593 VARCHAR(10),c594 VARCHAR(10),c595 VARCHAR(10),c596 VARCHAR(10),c597 VARCHAR(10),c598 VARCHAR(10),c599 VARCHAR(10),c600 VARCHAR(10),c601 VARCHAR(10),c602 VARCHAR(10),c603 VARCHAR(10),c604 VARCHAR(10),c605 VARCHAR(10),c606 VARCHAR(10),c607 VARCHAR(10),c608 VARCHAR(10),c609 VARCHAR(10),c610 VARCHAR(10),c611 VARCHAR(10),c612 VARCHAR(10),c613 VARCHAR(10),c614 VARCHAR(10),c615 VARCHAR(10),c616 VARCHAR(10),c617 VARCHAR(10),c618 VARCHAR(10),c619 VARCHAR(10),c620 VARCHAR(10),c621 VARCHAR(10),c622 VARCHAR(10),c623 VARCHAR(10),c624 VARCHAR(10),c625 VARCHAR(10),c626 VARCHAR(10),c627 VARCHAR(10),c628 VARCHAR(10),c629 VARCHAR(10),c630 VARCHAR(10),c631 VARCHAR(10),c632 VARCHAR(10),c633 VARCHAR(10),c634 VARCHAR(10),c635 VARCHAR(10),c636 VARCHAR(10),c637 VARCHAR(10),c638 VARCHAR(10),c639 VARCHAR(10),c640 VARCHAR(10),c641 VARCHAR(10),c642 VARCHAR(10),c643 VARCHAR(10),c644 VARCHAR(10),c645 VARCHAR(10),c646 VARCHAR(10),c647 VARCHAR(10),c648 VARCHAR(10),c649 VARCHAR(10),c650 VARCHAR(10),c651 VARCHAR(10),c652 VARCHAR(10),c653 VARCHAR(10),c654 VARCHAR(10),c655 VARCHAR(10),c656 VARCHAR(10),c657 VARCHAR(10),c658 VARCHAR(10),c659 VARCHAR(10),c660 VARCHAR(10),c661 VARCHAR(10),c662 VARCHAR(10),c663 VARCHAR(10),c664 VARCHAR(10),c665 VARCHAR(10),c666 VARCHAR(10),c667 VARCHAR(10),c668 VARCHAR(10),c669 VARCHAR(10),c670 VARCHAR(10),c671 VARCHAR(10),c672 VARCHAR(10),c673 VARCHAR(10),c674 VARCHAR(10),c675 VARCHAR(10),c676 VARCHAR(10),c677 VARCHAR(10),c678 VARCHAR(10),c679 VARCHAR(10),c680 VARCHAR(10),c681 VARCHAR(10),c682 VARCHAR(10),c683 VARCHAR(10),c684 VARCHAR(10),c685 VARCHAR(10),c686 VARCHAR(10),c687 VARCHAR(10),c688 VARCHAR(10),c689 VARCHAR(10),c690 VARCHAR(10),c691 VARCHAR(10),c692 VARCHAR(10),c693 VARCHAR(10),c694 VARCHAR(10),c695 VARCHAR(10),c696 VARCHAR(10),c697 VARCHAR(10),c698 VARCHAR(10),c699 VARCHAR(10),c700 VARCHAR(10),c701 VARCHAR(10),c702 VARCHAR(10),c703 VARCHAR(10),c704 VARCHAR(10),c705 VARCHAR(10),c706 VARCHAR(10),c707 VARCHAR(10),c708 VARCHAR(10),c709 VARCHAR(10),c710 VARCHAR(10),c711 VARCHAR(10),c712 VARCHAR(10),c713 VARCHAR(10),c714 VARCHAR(10),c715 VARCHAR(10),c716 VARCHAR(10),c717 VARCHAR(10),c718 VARCHAR(10),c719 VARCHAR(10),c720 VARCHAR(10),c721 VARCHAR(10),c722 VARCHAR(10),c723 VARCHAR(10),c724 VARCHAR(10),c725 VARCHAR(10),c726 VARCHAR(10),c727 VARCHAR(10),c728 VARCHAR(10),c729 VARCHAR(10),c730 VARCHAR(10),c731 VARCHAR(10),c732 VARCHAR(10),c733 VARCHAR(10),c734 VARCHAR(10),c735 VARCHAR(10),c736 VARCHAR(10),c737 VARCHAR(10),c738 VARCHAR(10),c739 VARCHAR(10),c740 VARCHAR(10),c741 VARCHAR(10),c742 VARCHAR(10),c743 VARCHAR(10),c744 VARCHAR(10),c745 VARCHAR(10),c746 VARCHAR(10),c747 VARCHAR(10),c748 VARCHAR(10),c749 VARCHAR(10),c750 VARCHAR(10),c751 VARCHAR(10),c752 VARCHAR(10),c753 VARCHAR(10),c754 VARCHAR(10),c755 VARCHAR(10),c756 VARCHAR(10),c757 VARCHAR(10),c758 VARCHAR(10),c759 VARCHAR(10),c760 VARCHAR(10),c761 VARCHAR(10),c762 VARCHAR(10),c763 VARCHAR(10),c764 VARCHAR(10),c765 VARCHAR(10),c766 VARCHAR(10),c767 VARCHAR(10),c768 VARCHAR(10),c769 VARCHAR(10),c770 VARCHAR(10),c771 VARCHAR(10),c772 VARCHAR(10),c773 VARCHAR(10),c774 VARCHAR(10),c775 VARCHAR(10),c776 VARCHAR(10),c777 VARCHAR(10),c778 VARCHAR(10),c779 VARCHAR(10),c780 VARCHAR(10),c781 VARCHAR(10),c782 VARCHAR(10),c783 VARCHAR(10),c784 VARCHAR(10),c785 VARCHAR(10),c786 VARCHAR(10),c787 VARCHAR(10),c788 VARCHAR(10),c789 VARCHAR(10),c790 VARCHAR(10),c791 VARCHAR(10),c792 VARCHAR(10),c793 VARCHAR(10),c794 VARCHAR(10),c795 VARCHAR(10),c796 VARCHAR(10),c797 VARCHAR(10),c798 VARCHAR(10),c799 VARCHAR(10),c800 VARCHAR(10),c801 VARCHAR(10),c802 VARCHAR(10),c803 VARCHAR(10),c804 VARCHAR(10),c805 VARCHAR(10),c806 VARCHAR(10),c807 VARCHAR(10),c808 VARCHAR(10),c809 VARCHAR(10),c810 VARCHAR(10),c811 VARCHAR(10),c812 VARCHAR(10),c813 VARCHAR(10),c814 VARCHAR(10),c815 VARCHAR(10),c816 VARCHAR(10),c817 VARCHAR(10),c818 VARCHAR(10),c819 VARCHAR(10),c820 VARCHAR(10),c821 VARCHAR(10),c822 VARCHAR(10),c823 VARCHAR(10),c824 VARCHAR(10),c825 VARCHAR(10),c826 VARCHAR(10),c827 VARCHAR(10),c828 VARCHAR(10),c829 VARCHAR(10),c830 VARCHAR(10),c831 VARCHAR(10),c832 VARCHAR(10),c833 VARCHAR(10),c834 VARCHAR(10),c835 VARCHAR(10),c836 VARCHAR(10),c837 VARCHAR(10),c838 VARCHAR(10),c839 VARCHAR(10),c840 VARCHAR(10),c841 VARCHAR(10),c842 VARCHAR(10),c843 VARCHAR(10),c844 VARCHAR(10),c845 VARCHAR(10),c846 VARCHAR(10),c847 VARCHAR(10),c848 VARCHAR(10),c849 VARCHAR(10),c850 VARCHAR(10),c851 VARCHAR(10),c852 VARCHAR(10),c853 VARCHAR(10),c854 VARCHAR(10),c855 VARCHAR(10),c856 VARCHAR(10),c857 VARCHAR(10),c858 VARCHAR(10),c859 VARCHAR(10),c860 VARCHAR(10),c861 VARCHAR(10),c862 VARCHAR(10),c863 VARCHAR(10),c864 VARCHAR(10),c865 VARCHAR(10),c866 VARCHAR(10),c867 VARCHAR(10),c868 VARCHAR(10),c869 VARCHAR(10),c870 VARCHAR(10),c871 VARCHAR(10),c872 VARCHAR(10),c873 VARCHAR(10),c874 VARCHAR(10),c875 VARCHAR(10),c876 VARCHAR(10),c877 VARCHAR(10),c878 VARCHAR(10),c879 VARCHAR(10),c880 VARCHAR(10),c881 VARCHAR(10),c882 VARCHAR(10),c883 VARCHAR(10),c884 VARCHAR(10),c885 VARCHAR(10),c886 VARCHAR(10),c887 VARCHAR(10),c888 VARCHAR(10),c889 VARCHAR(10),c890 VARCHAR(10),c891 VARCHAR(10),c892 VARCHAR(10),c893 VARCHAR(10),c894 VARCHAR(10),c895 VARCHAR(10),c896 VARCHAR(10),c897 VARCHAR(10),c898 VARCHAR(10),c899 VARCHAR(10),c900 VARCHAR(10),c901 VARCHAR(10),c902 VARCHAR(10),c903 VARCHAR(10),c904 VARCHAR(10),c905 VARCHAR(10),c906 VARCHAR(10),c907 VARCHAR(10),c908 VARCHAR(10),c909 VARCHAR(10),c910 VARCHAR(10),c911 VARCHAR(10),c912 VARCHAR(10),c913 VARCHAR(10),c914 VARCHAR(10),c915 VARCHAR(10),c916 VARCHAR(10),c917 VARCHAR(10),c918 VARCHAR(10),c919 VARCHAR(10),c920 VARCHAR(10),c921 VARCHAR(10),c922 VARCHAR(10),c923 VARCHAR(10),c924 VARCHAR(10),c925 VARCHAR(10),c926 VARCHAR(10),c927 VARCHAR(10),c928 VARCHAR(10),c929 VARCHAR(10),c930 VARCHAR(10),c931 VARCHAR(10),c932 VARCHAR(10),c933 VARCHAR(10),c934 VARCHAR(10),c935 VARCHAR(10),c936 VARCHAR(10),c937 VARCHAR(10),c938 VARCHAR(10),c939 VARCHAR(10),c940 VARCHAR(10),c941 VARCHAR(10),c942 VARCHAR(10),c943 VARCHAR(10),c944 VARCHAR(10),c945 VARCHAR(10),c946 VARCHAR(10),c947 VARCHAR(10),c948 VARCHAR(10),c949 VARCHAR(10),c950 VARCHAR(10),c951 VARCHAR(10),c952 VARCHAR(10),c953 VARCHAR(10),c954 VARCHAR(10),c955 VARCHAR(10),c956 VARCHAR(10),c957 VARCHAR(10),c958 VARCHAR(10),c959 VARCHAR(10),c960 VARCHAR(10),c961 VARCHAR(10),c962 VARCHAR(10),c963 VARCHAR(10),c964 VARCHAR(10),c965 VARCHAR(10),c966 VARCHAR(10),c967 VARCHAR(10),c968 VARCHAR(10),c969 VARCHAR(10),c970 VARCHAR(10),c971 VARCHAR(10),c972 VARCHAR(10),c973 VARCHAR(10),c974 VARCHAR(10),c975 VARCHAR(10),c976 VARCHAR(10),c977 VARCHAR(10),c978 VARCHAR(10),c979 VARCHAR(10),c980 VARCHAR(10),c981 VARCHAR(10),c982 VARCHAR(10),c983 VARCHAR(10),c984 VARCHAR(10),c985 VARCHAR(10),c986 VARCHAR(10),c987 VARCHAR(10),c988 VARCHAR(10),c989 VARCHAR(10),c990 VARCHAR(10),c991 VARCHAR(10),c992 VARCHAR(10),c993 VARCHAR(10),c994 VARCHAR(10),c995 VARCHAR(10),c996 VARCHAR(10),c997 VARCHAR(10),c998 VARCHAR(10),c999 VARCHAR(10),c1000 VARCHAR(10) ) ;
+Warnings:
+Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
INSERT INTO t1(c1) VALUES('abc');
SELECT * FROM t1;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 c33 c34 c35 c36 c37 c38 c39 c40 c41 c42 c43 c44 c45 c46 c47 c48 c49 c50 c51 c52 c53 c54 c55 c56 c57 c58 c59 c60 c61 c62 c63 c64 c65 c66 c67 c68 c69 c70 c71 c72 c73 c74 c75 c76 c77 c78 c79 c80 c81 c82 c83 c84 c85 c86 c87 c88 c89 c90 c91 c92 c93 c94 c95 c96 c97 c98 c99 c100 c101 c102 c103 c104 c105 c106 c107 c108 c109 c110 c111 c112 c113 c114 c115 c116 c117 c118 c119 c120 c121 c122 c123 c124 c125 c126 c127 c128 c129 c130 c131 c132 c133 c134 c135 c136 c137 c138 c139 c140 c141 c142 c143 c144 c145 c146 c147 c148 c149 c150 c151 c152 c153 c154 c155 c156 c157 c158 c159 c160 c161 c162 c163 c164 c165 c166 c167 c168 c169 c170 c171 c172 c173 c174 c175 c176 c177 c178 c179 c180 c181 c182 c183 c184 c185 c186 c187 c188 c189 c190 c191 c192 c193 c194 c195 c196 c197 c198 c199 c200 c201 c202 c203 c204 c205 c206 c207 c208 c209 c210 c211 c212 c213 c214 c215 c216 c217 c218 c219 c220 c221 c222 c223 c224 c225 c226 c227 c228 c229 c230 c231 c232 c233 c234 c235 c236 c237 c238 c239 c240 c241 c242 c243 c244 c245 c246 c247 c248 c249 c250 c251 c252 c253 c254 c255 c256 c257 c258 c259 c260 c261 c262 c263 c264 c265 c266 c267 c268 c269 c270 c271 c272 c273 c274 c275 c276 c277 c278 c279 c280 c281 c282 c283 c284 c285 c286 c287 c288 c289 c290 c291 c292 c293 c294 c295 c296 c297 c298 c299 c300 c301 c302 c303 c304 c305 c306 c307 c308 c309 c310 c311 c312 c313 c314 c315 c316 c317 c318 c319 c320 c321 c322 c323 c324 c325 c326 c327 c328 c329 c330 c331 c332 c333 c334 c335 c336 c337 c338 c339 c340 c341 c342 c343 c344 c345 c346 c347 c348 c349 c350 c351 c352 c353 c354 c355 c356 c357 c358 c359 c360 c361 c362 c363 c364 c365 c366 c367 c368 c369 c370 c371 c372 c373 c374 c375 c376 c377 c378 c379 c380 c381 c382 c383 c384 c385 c386 c387 c388 c389 c390 c391 c392 c393 c394 c395 c396 c397 c398 c399 c400 c401 c402 c403 c404 c405 c406 c407 c408 c409 c410 c411 c412 c413 c414 c415 c416 c417 c418 c419 c420 c421 c422 c423 c424 c425 c426 c427 c428 c429 c430 c431 c432 c433 c434 c435 c436 c437 c438 c439 c440 c441 c442 c443 c444 c445 c446 c447 c448 c449 c450 c451 c452 c453 c454 c455 c456 c457 c458 c459 c460 c461 c462 c463 c464 c465 c466 c467 c468 c469 c470 c471 c472 c473 c474 c475 c476 c477 c478 c479 c480 c481 c482 c483 c484 c485 c486 c487 c488 c489 c490 c491 c492 c493 c494 c495 c496 c497 c498 c499 c500 c501 c502 c503 c504 c505 c506 c507 c508 c509 c510 c511 c512 c513 c514 c515 c516 c517 c518 c519 c520 c521 c522 c523 c524 c525 c526 c527 c528 c529 c530 c531 c532 c533 c534 c535 c536 c537 c538 c539 c540 c541 c542 c543 c544 c545 c546 c547 c548 c549 c550 c551 c552 c553 c554 c555 c556 c557 c558 c559 c560 c561 c562 c563 c564 c565 c566 c567 c568 c569 c570 c571 c572 c573 c574 c575 c576 c577 c578 c579 c580 c581 c582 c583 c584 c585 c586 c587 c588 c589 c590 c591 c592 c593 c594 c595 c596 c597 c598 c599 c600 c601 c602 c603 c604 c605 c606 c607 c608 c609 c610 c611 c612 c613 c614 c615 c616 c617 c618 c619 c620 c621 c622 c623 c624 c625 c626 c627 c628 c629 c630 c631 c632 c633 c634 c635 c636 c637 c638 c639 c640 c641 c642 c643 c644 c645 c646 c647 c648 c649 c650 c651 c652 c653 c654 c655 c656 c657 c658 c659 c660 c661 c662 c663 c664 c665 c666 c667 c668 c669 c670 c671 c672 c673 c674 c675 c676 c677 c678 c679 c680 c681 c682 c683 c684 c685 c686 c687 c688 c689 c690 c691 c692 c693 c694 c695 c696 c697 c698 c699 c700 c701 c702 c703 c704 c705 c706 c707 c708 c709 c710 c711 c712 c713 c714 c715 c716 c717 c718 c719 c720 c721 c722 c723 c724 c725 c726 c727 c728 c729 c730 c731 c732 c733 c734 c735 c736 c737 c738 c739 c740 c741 c742 c743 c744 c745 c746 c747 c748 c749 c750 c751 c752 c753 c754 c755 c756 c757 c758 c759 c760 c761 c762 c763 c764 c765 c766 c767 c768 c769 c770 c771 c772 c773 c774 c775 c776 c777 c778 c779 c780 c781 c782 c783 c784 c785 c786 c787 c788 c789 c790 c791 c792 c793 c794 c795 c796 c797 c798 c799 c800 c801 c802 c803 c804 c805 c806 c807 c808 c809 c810 c811 c812 c813 c814 c815 c816 c817 c818 c819 c820 c821 c822 c823 c824 c825 c826 c827 c828 c829 c830 c831 c832 c833 c834 c835 c836 c837 c838 c839 c840 c841 c842 c843 c844 c845 c846 c847 c848 c849 c850 c851 c852 c853 c854 c855 c856 c857 c858 c859 c860 c861 c862 c863 c864 c865 c866 c867 c868 c869 c870 c871 c872 c873 c874 c875 c876 c877 c878 c879 c880 c881 c882 c883 c884 c885 c886 c887 c888 c889 c890 c891 c892 c893 c894 c895 c896 c897 c898 c899 c900 c901 c902 c903 c904 c905 c906 c907 c908 c909 c910 c911 c912 c913 c914 c915 c916 c917 c918 c919 c920 c921 c922 c923 c924 c925 c926 c927 c928 c929 c930 c931 c932 c933 c934 c935 c936 c937 c938 c939 c940 c941 c942 c943 c944 c945 c946 c947 c948 c949 c950 c951 c952 c953 c954 c955 c956 c957 c958 c959 c960 c961 c962 c963 c964 c965 c966 c967 c968 c969 c970 c971 c972 c973 c974 c975 c976 c977 c978 c979 c980 c981 c982 c983 c984 c985 c986 c987 c988 c989 c990 c991 c992 c993 c994 c995 c996 c997 c998 c999 c1000
diff --git a/mysql-test/suite/engines/funcs/r/ix_unique_lob.result b/mysql-test/suite/engines/funcs/r/ix_unique_lob.result
index 4554a912906..1b03012a96f 100644
--- a/mysql-test/suite/engines/funcs/r/ix_unique_lob.result
+++ b/mysql-test/suite/engines/funcs/r/ix_unique_lob.result
@@ -7,7 +7,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` tinyblob,
+ `c1` tinyblob DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -21,7 +21,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` blob,
+ `c1` blob DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -35,7 +35,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` mediumblob,
+ `c1` mediumblob DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -49,7 +49,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` longblob,
+ `c1` longblob DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -63,7 +63,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` tinytext,
+ `c1` tinytext DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -77,7 +77,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` text,
+ `c1` text DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -91,7 +91,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` mediumtext,
+ `c1` mediumtext DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -105,7 +105,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` longtext,
+ `c1` longtext DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
diff --git a/mysql-test/suite/engines/funcs/r/rpl000011.result b/mysql-test/suite/engines/funcs/r/rpl000011.result
deleted file mode 100644
index dd0fa2fbe74..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl000011.result
+++ /dev/null
@@ -1,16 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-create table t1 (n int);
-insert into t1 values(1);
-stop slave;
-start slave;
-insert into t1 values(2);
-select * from t1;
-n
-1
-2
-drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl000017.result b/mysql-test/suite/engines/funcs/r/rpl000017.result
deleted file mode 100644
index 1c611357e64..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl000017.result
+++ /dev/null
@@ -1,18 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
-grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
-grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
-start slave;
-drop table if exists t1;
-create table t1(n int);
-insert into t1 values(24);
-select * from t1;
-n
-24
-drop table t1;
-delete from mysql.user where user="replicate";
diff --git a/mysql-test/suite/engines/funcs/r/rpl000010.result b/mysql-test/suite/engines/funcs/r/rpl_000010.result
index 65191ea411f..ae989f25e1b 100644
--- a/mysql-test/suite/engines/funcs/r/rpl000010.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_000010.result
@@ -1,14 +1,14 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1 (n int not null auto_increment primary key);
insert into t1 values(NULL);
insert into t1 values(2);
+connection slave;
select n from t1;
n
1
2
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_000011.result b/mysql-test/suite/engines/funcs/r/rpl_000011.result
new file mode 100644
index 00000000000..83bc0c207ce
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/r/rpl_000011.result
@@ -0,0 +1,18 @@
+include/master-slave.inc
+[connection master]
+create table t1 (n int);
+insert into t1 values(1);
+connection slave;
+include/stop_slave.inc
+include/start_slave.inc
+connection master;
+insert into t1 values(2);
+connection slave;
+select * from t1;
+n
+1
+2
+connection master;
+drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl000013.result b/mysql-test/suite/engines/funcs/r/rpl_000013.result
index 37838bb88e0..87103d7821f 100644
--- a/mysql-test/suite/engines/funcs/r/rpl000013.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_000013.result
@@ -1,17 +1,19 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t2(n int);
create temporary table t1 (n int);
insert into t1 values(1),(2),(3);
insert into t2 select * from t1;
+connection master1;
create temporary table t1 (n int);
insert into t1 values (4),(5);
insert into t2 select * from t1 as t10;
+disconnect master;
+connection slave;
+connection master1;
insert into t2 values(6);
+disconnect master1;
+connection slave;
select * from t2;
n
1
@@ -23,6 +25,9 @@ n
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
+connect master2,localhost,root,,;
+connection master2;
drop table if exists t1,t2;
Warnings:
-Note 1051 Unknown table 't1'
+Note 1051 Unknown table 'test.t1'
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_000015.result b/mysql-test/suite/engines/funcs/r/rpl_000015.result
index bb3620ebc84..4ee1026ba00 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_000015.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_000015.result
@@ -1,14 +1,11 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
reset master;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 107
-stop slave;
+master-bin.000001 329
+connection slave;
+include/stop_slave.inc
reset slave;
show slave status;
Slave_IO_State #
@@ -51,6 +48,19 @@ Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 1
+Master_SSL_Crl
+Master_SSL_Crlpath
+Using_Gtid No
+Gtid_IO_Pos
+Replicate_Do_Domain_Ids
+Replicate_Ignore_Domain_Ids
+Parallel_Mode conservative
+SQL_Delay 0
+SQL_Remaining_Delay NULL
+Slave_SQL_Running_State
+Slave_DDL_Groups 2
+Slave_Non_Transactional_Groups 0
+Slave_Transactional_Groups 2
change master to master_host='127.0.0.1';
show slave status;
Slave_IO_State #
@@ -93,6 +103,19 @@ Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 1
+Master_SSL_Crl
+Master_SSL_Crlpath
+Using_Gtid No
+Gtid_IO_Pos
+Replicate_Do_Domain_Ids
+Replicate_Ignore_Domain_Ids
+Parallel_Mode conservative
+SQL_Delay 0
+SQL_Remaining_Delay NULL
+Slave_SQL_Running_State
+Slave_DDL_Groups 2
+Slave_Non_Transactional_Groups 0
+Slave_Transactional_Groups 2
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
show slave status;
@@ -136,7 +159,20 @@ Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 1
-start slave;
+Master_SSL_Crl
+Master_SSL_Crlpath
+Using_Gtid No
+Gtid_IO_Pos
+Replicate_Do_Domain_Ids
+Replicate_Ignore_Domain_Ids
+Parallel_Mode conservative
+SQL_Delay 0
+SQL_Remaining_Delay NULL
+Slave_SQL_Running_State
+Slave_DDL_Groups 2
+Slave_Non_Transactional_Groups 0
+Slave_Transactional_Groups 2
+include/start_slave.inc
show slave status;
Slave_IO_State Waiting for master to send event
Master_Host 127.0.0.1
@@ -144,9 +180,9 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 107
+Read_Master_Log_Pos 329
Relay_Log_File slave-relay-bin.000002
-Relay_Log_Pos 254
+Relay_Log_Pos 629
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
@@ -159,8 +195,8 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 107
-Relay_Log_Space 410
+Exec_Master_Log_Pos 329
+Relay_Log_Space 938
Until_Condition None
Until_Log_File
Until_Log_Pos 0
@@ -178,15 +214,34 @@ Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 1
+Master_SSL_Crl
+Master_SSL_Crlpath
+Using_Gtid No
+Gtid_IO_Pos
+Replicate_Do_Domain_Ids
+Replicate_Ignore_Domain_Ids
+Parallel_Mode conservative
+SQL_Delay 0
+SQL_Remaining_Delay NULL
+Slave_SQL_Running_State Slave has read all relay log; waiting for the slave I/O thread to update it
+Slave_DDL_Groups 2
+Slave_Non_Transactional_Groups 0
+Slave_Transactional_Groups 2
+connection master;
drop table if exists t1;
create table t1 (n int, PRIMARY KEY(n));
insert into t1 values (10),(45),(90);
+connection slave;
+connection slave;
SELECT * FROM t1 ORDER BY n;
n 10
n 45
n 90
+connection master;
SELECT * FROM t1 ORDER BY n;
n 10
n 45
n 90
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl000017.test b/mysql-test/suite/engines/funcs/r/rpl_000017.result
index 2ba321cd8c3..d1c453208c7 100644
--- a/mysql-test/suite/engines/funcs/t/rpl000017.test
+++ b/mysql-test/suite/engines/funcs/r/rpl_000017.result
@@ -1,22 +1,19 @@
-source include/master-slave.inc;
+include/master-slave.inc
+[connection master]
connection slave;
-stop slave;
connection master;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
connection slave;
-start slave;
+include/start_slave.inc
connection master;
---disable_warnings
-drop table if exists t1;
---enable_warnings
create table t1(n int);
insert into t1 values(24);
-sync_slave_with_master;
+connection slave;
select * from t1;
+n
+24
connection master;
drop table t1;
delete from mysql.user where user="replicate";
-sync_slave_with_master;
-
-# End of 4.1 tests
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result b/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result
index b092dd9e088..7204122b669 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
@@ -62,6 +59,8 @@ abasements
abasement
abased
abase
+connection slave;
+connection slave;
SELECT * FROM test.t1 ORDER BY a DESC;
a
aberration
@@ -114,4 +113,7 @@ abasements
abasement
abased
abase
+connection master;
DROP TABLE test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result b/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result
deleted file mode 100644
index 7a901b65810..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result
+++ /dev/null
@@ -1,41 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-SHOW SLAVE HOSTS;
-Server_id Host Port Rpl_recovery_rank Master_id
-2 127.0.0.1 SLAVE_PORT 0 1
-create table t1 ( n int);
-insert into t1 values (1),(2),(3),(4);
-insert into t1 values(5);
-SELECT * FROM t1 ORDER BY n;
-n
-1
-2
-3
-4
-5
-SELECT * FROM t1 ORDER BY n;
-n
-1
-2
-3
-4
-SELECT * FROM t1 ORDER BY n;
-n
-1
-2
-3
-4
-SELECT * FROM t1 ORDER BY n;
-n
-1
-2
-3
-4
-5
-drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_alter,innodb.rdiff b/mysql-test/suite/engines/funcs/r/rpl_alter,innodb.rdiff
new file mode 100644
index 00000000000..0c70e2c0cfc
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/r/rpl_alter,innodb.rdiff
@@ -0,0 +1,72 @@
+@@ -29,7 +29,7 @@
+ `a` int(10) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ insert into t1 (a) values (1),((1<<32)-1);
+ select * from t1;
+ a b
+@@ -42,7 +42,7 @@
+ `a` bigint(20) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ select * from t1;
+ a b
+ 1 NULL
+@@ -54,7 +54,7 @@
+ `a` int(10) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ select * from t1;
+ a b
+ 1 NULL
+@@ -66,7 +66,7 @@
+ `a` bigint(20) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ select * from t1;
+ a b
+ 1 NULL
+@@ -83,7 +83,7 @@
+ `a` bigint(20) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ connection master;
+ create table t2 (a int unsigned auto_increment primary key, b int);
+ show create table t2;
+@@ -92,7 +92,7 @@
+ `a` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ alter table t2 modify a bigint;
+ show create table t2;
+ Table Create Table
+@@ -100,7 +100,7 @@
+ `a` bigint(20) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ alter table t2 modify a bigint auto_increment;
+ show create table t2;
+ Table Create Table
+@@ -108,7 +108,7 @@
+ `a` bigint(20) NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ drop table t1,t2;
+ #
+ # MDEV-8432: Slave cannot replicate signed integer-type values
diff --git a/mysql-test/suite/engines/funcs/r/rpl_alter.result b/mysql-test/suite/engines/funcs/r/rpl_alter.result
index 6ef5ce3462a..4f709db9624 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_alter.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_alter.result
@@ -1,10 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-drop database if exists mysqltest;
+include/master-slave.inc
+[connection master]
create database mysqltest;
create table mysqltest.t1 ( n int);
alter table mysqltest.t1 add m int;
@@ -12,10 +7,126 @@ insert into mysqltest.t1 values (1,2);
create table mysqltest.t2 (n int);
insert into mysqltest.t2 values (45);
rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
+connection slave;
select * from mysqltest.t2;
n m
1 2
select * from mysqltest.t3;
n
45
+connection master;
drop database mysqltest;
+connection slave;
+connection master;
+use test;
+#
+# Test bug where ALTER TABLE MODIFY didn't replicate properly
+#
+create table t1 (a int unsigned primary key, b int);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(10) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 (a) values (1),((1<<32)-1);
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+alter table t1 modify a bigint;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+alter table t1 modify a int unsigned;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(10) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+alter table t1 modify a bigint unsigned;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+connection slave;
+use test;
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+connection master;
+create table t2 (a int unsigned auto_increment primary key, b int);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t2 modify a bigint;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` bigint(20) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t2 modify a bigint auto_increment;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` bigint(20) NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2;
+#
+# MDEV-8432: Slave cannot replicate signed integer-type values
+# with high bit set to 1
+# Test replication when we have int on master and bigint on slave
+#
+create table t1 (a int unsigned primary key, b int);
+connection slave;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+alter table t1 modify a bigint unsigned;
+connection master;
+insert into t1 (a) values (1),((1<<32)-1);
+connection slave;
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
+connection master;
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_alter_db.result b/mysql-test/suite/engines/funcs/r/rpl_alter_db.result
index 80b1a0e983f..56e82712bec 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_alter_db.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_alter_db.result
@@ -1,9 +1,12 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-use mysql;
+include/master-slave.inc
+[connection master]
+==== Verify that alter database does not stop replication ====
+create database temp_db;
+use temp_db;
alter database collate latin1_bin;
-alter database collate latin1_swedish_ci;
+connection slave;
+==== Clean up ====
+connection master;
+drop database temp_db;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_bit.result b/mysql-test/suite/engines/funcs/r/rpl_bit.result
index 924de8a65f8..b83faa4a28a 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_bit.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_bit.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (
dummyKey INTEGER NOT NULL,
@@ -95,6 +92,7 @@ hex(bit3)
15
24
35
+connection slave;
SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
oSupp sSuppD GSuppDf VNotSupp x034
5 5 3 2 1
@@ -135,4 +133,7 @@ hex(bit3)
15
24
35
+connection master;
DROP TABLE IF EXISTS test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result b/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result
index 9599660f18f..5c7e6fc55b6 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (
dummyKey INTEGER NOT NULL,
@@ -98,6 +95,7 @@ hex(bit3)
15
24
35
+connection slave;
SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
FROM test.t1
ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
@@ -140,6 +138,7 @@ hex(bit3)
15
24
35
+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');
@@ -156,6 +155,7 @@ SELECT * FROM test.t3 ORDER BY a,b;
a b
1 NULL
2 0
+connection slave;
SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
a hex(b)
1 0
@@ -164,6 +164,9 @@ SELECT * FROM test.t3 ORDER BY a,b;
a b
1 NULL
2 0
+connection master;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_change_master.result b/mysql-test/suite/engines/funcs/r/rpl_change_master.result
index c187f16cc83..48cec72d917 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_change_master.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_change_master.result
@@ -1,26 +1,29 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum");
+connection master;
create table t1(n int);
+connection slave;
select * from t1;
n
stop slave sql_thread;
+connection master;
insert into t1 values(1);
insert into t1 values(2);
-stop slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 192 # None 0 No # No 0 0 1
+connection slave;
+include/wait_for_slave_param.inc [Read_Master_Log_Pos]
+include/stop_slave.inc
change master to master_user='root';
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 192 # None 0 No # No 0 0 1
start slave;
select * from t1;
n
1
2
+connection master;
drop table t1;
+connection slave;
+connection master;
+CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='',
+MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH='';
+CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_create_database.result b/mysql-test/suite/engines/funcs/r/rpl_create_database.result
index 15bb939eb57..28c11525d00 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_create_database.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_create_database.result
@@ -1,13 +1,11 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
DROP DATABASE IF EXISTS mysqltest_prometheus;
DROP DATABASE IF EXISTS mysqltest_sisyfos;
DROP DATABASE IF EXISTS mysqltest_bob;
+connection slave;
DROP DATABASE IF EXISTS mysqltest_bob;
+connection master;
CREATE DATABASE mysqltest_prometheus;
CREATE DATABASE mysqltest_sisyfos;
CREATE DATABASE mysqltest_bob;
@@ -20,25 +18,19 @@ INSERT INTO t2 VALUES(2);
ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
USE mysqltest_sisyfos;
ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
-SHOW DATABASES;
-Database
-information_schema
-mtr
+SHOW DATABASES LIKE 'mysql%';
+Database (mysql%)
mysql
mysqltest_bob
mysqltest_prometheus
mysqltest_sisyfos
-performance_schema
-test
-SHOW DATABASES;
-Database
-information_schema
-mtr
+connection slave;
+SHOW DATABASES LIKE 'mysql%';
+Database (mysql%)
mysql
mysqltest_prometheus
mysqltest_sisyfos
-performance_schema
-test
+connection master;
DROP DATABASE IF EXISTS mysqltest_sisyfos;
USE mysqltest_prometheus;
CREATE TABLE t1 (a INT);
@@ -46,25 +38,18 @@ INSERT INTO t1 VALUES (1);
CREATE DATABASE mysqltest_sisyfos;
USE mysqltest_sisyfos;
CREATE TABLE t2 (a INT);
-SHOW DATABASES;
-Database
-information_schema
-mtr
+SHOW DATABASES LIKE 'mysql%';
+Database (mysql%)
mysql
mysqltest_bob
mysqltest_prometheus
mysqltest_sisyfos
-performance_schema
-test
-SHOW DATABASES;
-Database
-information_schema
-mtr
+connection slave;
+SHOW DATABASES LIKE 'mysql%';
+Database (mysql%)
mysql
mysqltest_prometheus
mysqltest_sisyfos
-performance_schema
-test
USE mysqltest_prometheus;
SHOW TABLES;
Tables_in_mysqltest_prometheus
@@ -73,6 +58,9 @@ USE mysqltest_sisyfos;
SHOW TABLES;
Tables_in_mysqltest_sisyfos
t2
+connection master;
DROP DATABASE IF EXISTS mysqltest_prometheus;
DROP DATABASE IF EXISTS mysqltest_sisyfos;
DROP DATABASE IF EXISTS mysqltest_bob;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_do_grant.result b/mysql-test/suite/engines/funcs/r/rpl_do_grant.result
index 50d181be0ca..e4b08800287 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_do_grant.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_do_grant.result
@@ -1,80 +1,320 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
+include/master-slave.inc
+[connection master]
+connection master;
+create user rpl_do_grant@localhost;
grant select on *.* to rpl_do_grant@localhost;
grant drop on test.* to rpl_do_grant@localhost;
+connection slave;
show grants for rpl_do_grant@localhost;
Grants for rpl_do_grant@localhost
-GRANT SELECT ON *.* TO 'rpl_do_grant'@'localhost'
-GRANT DROP ON `test`.* TO 'rpl_do_grant'@'localhost'
+GRANT SELECT ON *.* TO `rpl_do_grant`@`localhost`
+GRANT DROP ON `test`.* TO `rpl_do_grant`@`localhost`
+connection master;
set password for rpl_do_grant@localhost=password("does it work?");
-select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
-password<>_binary''
+connection slave;
+select authentication_string<>'' from mysql.user where user='rpl_do_grant';
+authentication_string<>''
1
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
+connection master;
+update mysql.global_priv set priv=json_remove(priv, '$.authentication_string') where user='rpl_do_grant';
flush privileges;
+select authentication_string<>'' from mysql.user where user='rpl_do_grant';
+authentication_string<>''
+0
+set sql_mode='ANSI_QUOTES';
+set password for rpl_do_grant@localhost=password('does it work?');
+set sql_mode='';
+connection slave;
+select authentication_string<>'' from mysql.user where user='rpl_do_grant';
+authentication_string<>''
+1
+connection master;
+drop user rpl_do_grant@localhost;
+connection slave;
+connection master;
show grants for rpl_do_grant@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost'
+connection slave;
show grants for rpl_do_grant@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost'
+connection master;
create user rpl_do_grant@localhost;
show grants for rpl_do_grant@localhost;
Grants for rpl_do_grant@localhost
-GRANT USAGE ON *.* TO 'rpl_do_grant'@'localhost'
+GRANT USAGE ON *.* TO `rpl_do_grant`@`localhost`
show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+connection slave;
show grants for rpl_do_grant@localhost;
Grants for rpl_do_grant@localhost
-GRANT USAGE ON *.* TO 'rpl_do_grant'@'localhost'
+GRANT USAGE ON *.* TO `rpl_do_grant`@`localhost`
show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+connection master;
rename user rpl_do_grant@localhost to rpl_do_grant2@localhost;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
-GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT USAGE ON *.* TO `rpl_do_grant2`@`localhost`
+connection slave;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
-GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT USAGE ON *.* TO `rpl_do_grant2`@`localhost`
+connection master;
grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
-GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
-GRANT INSERT, DELETE ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+GRANT USAGE ON *.* TO `rpl_do_grant2`@`localhost`
+GRANT INSERT, DELETE ON `mysqltest1`.* TO `rpl_do_grant2`@`localhost`
+connection slave;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
-GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
-GRANT INSERT, DELETE ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+GRANT USAGE ON *.* TO `rpl_do_grant2`@`localhost`
+GRANT INSERT, DELETE ON `mysqltest1`.* TO `rpl_do_grant2`@`localhost`
+connection master;
revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
-GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
-GRANT INSERT ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+GRANT USAGE ON *.* TO `rpl_do_grant2`@`localhost`
+GRANT INSERT ON `mysqltest1`.* TO `rpl_do_grant2`@`localhost`
+connection slave;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
-GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
-GRANT INSERT ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+GRANT USAGE ON *.* TO `rpl_do_grant2`@`localhost`
+GRANT INSERT ON `mysqltest1`.* TO `rpl_do_grant2`@`localhost`
+connection master;
revoke all privileges, grant option from rpl_do_grant2@localhost;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
-GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT USAGE ON *.* TO `rpl_do_grant2`@`localhost`
+connection slave;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
-GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+GRANT USAGE ON *.* TO `rpl_do_grant2`@`localhost`
+connection master;
drop user rpl_do_grant2@localhost;
show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+connection slave;
show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+connection master;
+call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' error.* 1396");
+connection slave;
+connection master;
+DROP DATABASE IF EXISTS bug42217_db;
+CREATE DATABASE bug42217_db;
+GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost'
+ IDENTIFIED BY 'create_rout_db' WITH GRANT OPTION;
+connection slave;
+connection master;
+connect create_rout_db_master, localhost, create_rout_db, create_rout_db, bug42217_db,$MASTER_MYPORT,;
+connect create_rout_db_slave, localhost, create_rout_db, create_rout_db, bug42217_db, $SLAVE_MYPORT,;
+connection create_rout_db_master;
+USE bug42217_db;
+CREATE FUNCTION upgrade_del_func() RETURNS CHAR(30)
+BEGIN
+RETURN "INSIDE upgrade_del_func()";
+END//
+connection master;
+USE bug42217_db;
+SELECT * FROM mysql.procs_priv;
+Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp
+localhost bug42217_db create_rout_db upgrade_del_func FUNCTION create_rout_db@localhost Execute,Alter Routine #
+SELECT upgrade_del_func();
+upgrade_del_func()
+INSIDE upgrade_del_func()
+connection slave;
+SELECT * FROM mysql.procs_priv;
+Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp
+localhost bug42217_db create_rout_db upgrade_del_func FUNCTION create_rout_db@localhost Execute,Alter Routine #
+SHOW GRANTS FOR 'create_rout_db'@'localhost';
+Grants for create_rout_db@localhost
+GRANT USAGE ON *.* TO `create_rout_db`@`localhost` IDENTIFIED BY PASSWORD '*08792480350CBA057BDE781B9DF183B263934601'
+GRANT CREATE ROUTINE ON `bug42217_db`.* TO `create_rout_db`@`localhost` WITH GRANT OPTION
+GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `bug42217_db`.`upgrade_del_func` TO `create_rout_db`@`localhost`
+USE bug42217_db;
+SHOW CREATE FUNCTION upgrade_del_func;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+upgrade_del_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1
+BEGIN
+RETURN "INSIDE upgrade_del_func()";
+END latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT upgrade_del_func();
+upgrade_del_func()
+INSIDE upgrade_del_func()
+"Check whether the definer user will be able to execute the replicated routine on slave"
+connection create_rout_db_slave;
+USE bug42217_db;
+SHOW CREATE FUNCTION upgrade_del_func;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+upgrade_del_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1
+BEGIN
+RETURN "INSIDE upgrade_del_func()";
+END latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT upgrade_del_func();
+upgrade_del_func()
+INSIDE upgrade_del_func()
+connection slave;
+DELETE FROM mysql.procs_priv;
+FLUSH PRIVILEGES;
+USE bug42217_db;
+"Can't execute the replicated routine on slave like before after procs privilege is deleted "
+SELECT upgrade_del_func();
+ERROR 42000: execute command denied to user 'create_rout_db'@'localhost' for routine 'bug42217_db.upgrade_del_func'
+"Test the user who creates a function on master doesn't exist on slave."
+"Hence SQL thread ACL_GLOBAL privilege jumps in and no mysql.procs_priv is inserted"
+DROP USER 'create_rout_db'@'localhost';
+connection create_rout_db_master;
+CREATE FUNCTION upgrade_alter_func() RETURNS CHAR(30)
+BEGIN
+RETURN "INSIDE upgrade_alter_func()";
+END//
+connection master;
+SELECT upgrade_alter_func();
+upgrade_alter_func()
+INSIDE upgrade_alter_func()
+connection slave;
+SHOW CREATE FUNCTION upgrade_alter_func;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+upgrade_alter_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_alter_func`() RETURNS char(30) CHARSET latin1
+BEGIN
+RETURN "INSIDE upgrade_alter_func()";
+END latin1 latin1_swedish_ci latin1_swedish_ci
+"Should no privilege record for upgrade_alter_func in mysql.procs_priv"
+SELECT * FROM mysql.procs_priv;
+Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp
+SELECT upgrade_alter_func();
+ERROR HY000: The user specified as a definer ('create_rout_db'@'localhost') does not exist
+disconnect create_rout_db_master;
+disconnect create_rout_db_slave;
+connection master;
+USE bug42217_db;
+DROP FUNCTION upgrade_del_func;
+DROP FUNCTION upgrade_alter_func;
+DROP DATABASE bug42217_db;
+connection slave;
+connection master;
+SET SQL_LOG_BIN= 0;
+DROP USER 'create_rout_db'@'localhost';
+SET SQL_LOG_BIN= 1;
+include/rpl_reset.inc
+USE test;
+######## BUG#49119 #######
+### i) test case from the 'how to repeat section'
+connection master;
+CREATE TABLE t1(c1 INT);
+CREATE PROCEDURE p1() SELECT * FROM t1 |
+REVOKE EXECUTE ON PROCEDURE p1 FROM 'root'@'localhost';
+ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' on routine 'p1'
+connection slave;
+connection master;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+connection slave;
+### ii) Test case in which REVOKE partially succeeds
+connection master;
+include/rpl_reset.inc
+connection master;
+CREATE TABLE t1(c1 INT);
+CREATE PROCEDURE p1() SELECT * FROM t1 |
+CREATE USER 'user49119'@'localhost';
+GRANT EXECUTE ON PROCEDURE p1 TO 'user49119'@'localhost';
+##############################################################
+### Showing grants for both users: root and user49119 (master)
+SHOW GRANTS FOR 'user49119'@'localhost';
+Grants for user49119@localhost
+GRANT USAGE ON *.* TO `user49119`@`localhost`
+GRANT EXECUTE ON PROCEDURE `test`.`p1` TO `user49119`@`localhost`
+SHOW GRANTS FOR CURRENT_USER;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+##############################################################
+connection slave;
+##############################################################
+### Showing grants for both users: root and user49119 (master)
+SHOW GRANTS FOR 'user49119'@'localhost';
+Grants for user49119@localhost
+GRANT USAGE ON *.* TO `user49119`@`localhost`
+GRANT EXECUTE ON PROCEDURE `test`.`p1` TO `user49119`@`localhost`
+SHOW GRANTS FOR CURRENT_USER;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+##############################################################
+connection master;
+## This statement will make the revoke fail because root has no
+## execute grant. However, it will still revoke the grant for
+## user49119.
+REVOKE EXECUTE ON PROCEDURE p1 FROM 'user49119'@'localhost', 'root'@'localhost';
+ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' on routine 'p1'
+##############################################################
+### Showing grants for both users: root and user49119 (master)
+### after revoke statement failure
+SHOW GRANTS FOR 'user49119'@'localhost';
+Grants for user49119@localhost
+GRANT USAGE ON *.* TO `user49119`@`localhost`
+SHOW GRANTS FOR CURRENT_USER;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+##############################################################
+connection slave;
+#############################################################
+### Showing grants for both users: root and user49119 (slave)
+### after revoke statement failure (should match
+SHOW GRANTS FOR 'user49119'@'localhost';
+Grants for user49119@localhost
+GRANT USAGE ON *.* TO `user49119`@`localhost`
+SHOW GRANTS FOR CURRENT_USER;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+##############################################################
+connection master;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+DROP USER 'user49119'@'localhost';
+connection slave;
+include/rpl_reset.inc
+connection master;
+grant all on *.* to foo@"1.2.3.4";
+revoke all privileges, grant option from "foo";
+ERROR HY000: Can't revoke all privileges for one or more of the requested users
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; grant all on *.* to foo@"1.2.3.4"
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; revoke all privileges, grant option from "foo"
+connection slave;
+include/check_slave_no_error.inc
+connection master;
+DROP USER foo@"1.2.3.4";
+connection slave;
+
+# Bug#27606 GRANT statement should be replicated with DEFINER information
+include/rpl_reset.inc
+connection master;
+GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+connection slave;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+connection master;
+REVOKE SELECT ON mysql.user FROM user_bug27606@localhost;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+connection slave;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+connection master;
+DROP USER user_bug27606@localhost;
+select priv into @root_priv from mysql.global_priv where user='root' and host='127.0.0.1';
+update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_drop.result b/mysql-test/suite/engines/funcs/r/rpl_drop.result
index b83594c9bb1..74514fe7f61 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_drop.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_drop.result
@@ -1,10 +1,7 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-drop table if exists t1, t2;
+include/master-slave.inc
+[connection master]
create table t1 (a int);
drop table t1, t2;
-ERROR 42S02: Unknown table 't2'
+ERROR 42S02: Unknown table 'test.t2'
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_drop_db.result b/mysql-test/suite/engines/funcs/r/rpl_drop_db.result
index b2d56af34bc..3712527afe4 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_drop_db.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_drop_db.result
@@ -1,29 +1,30 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
drop database if exists mysqltest1;
create database mysqltest1;
create table mysqltest1.t1 (n int);
insert into mysqltest1.t1 values (1);
select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt';
+Warnings:
+Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
create table mysqltest1.t2 (n int);
create table mysqltest1.t3 (n int);
drop database mysqltest1;
-ERROR HY000: Error dropping database (can't rmdir './mysqltest1/', errno: 17)
+ERROR HY000: Error dropping database (can't rmdir './mysqltest1', errno: 39 "Directory not empty")
use mysqltest1;
show tables;
Tables_in_mysqltest1
drop database mysqltest1;
-ERROR HY000: Error dropping database (can't rmdir './mysqltest1/', errno: 17)
+ERROR HY000: Error dropping database (can't rmdir './mysqltest1', errno: 39 "Directory not empty")
use mysqltest1;
show tables;
Tables_in_mysqltest1
use test;
create table t1 (n int);
insert into t1 values (1234);
+connection slave;
+connection slave;
use mysqltest1;
show tables;
Tables_in_mysqltest1
@@ -31,9 +32,9 @@ use test;
select * from t1;
n
1234
-drop table t1;
-stop slave;
-drop database mysqltest1;
-drop database mysqltest1;
+connection master;
use test;
drop table t1;
+drop database mysqltest1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result b/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result
index 257baa81b74..ed9060f8307 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result
@@ -1,22 +1,28 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
reset master;
+connection master;
change master to master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root";
-start slave;
+include/start_slave.inc
+connection slave;
create table t1 (n int);
+connection master;
+connection master;
create table t4 (n int);
create table t5 (n int);
create table t6 (n int);
+connection slave;
+connection slave;
+connection master;
show tables;
Tables_in_test
t1
t4
t5
t6
-stop slave;
+include/stop_slave.inc
reset slave;
drop table t1,t4,t5,t6;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result b/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result
deleted file mode 100644
index b5e14d3adac..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result
+++ /dev/null
@@ -1,12 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-load table t1 from master;
-ERROR 08S01: Error connecting to master: Master is not configured
-load table t1 from master;
-ERROR HY000: Error from master: 'Table 'test.t1' doesn't exist'
diff --git a/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result b/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result
index f211d5d9a2f..2017252f5d1 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result
@@ -1,14 +1,12 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create table t1 (a int primary key);
create table t4 (a int primary key);
insert into t1 values (1),(1);
Got one of the listed errors
insert into t4 values (1),(2);
+connection slave;
show tables like 't1';
Tables_in_test (t1)
show tables like 't4';
@@ -18,25 +16,36 @@ SELECT * FROM test.t4 ORDER BY a;
a
1
2
+connection master;
drop table t1;
+connection slave;
+connection master1;
select get_lock('crash_lock%20C', 10);
get_lock('crash_lock%20C', 10)
1
+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());
update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
+connection master1;
select (@id := id) - id from t3;
(@id := id) - id
0
kill @id;
drop table t2,t3;
insert into t4 values (3),(4);
+connection master;
+connection master1;
+connection slave;
SELECT * FROM test.t4 ORDER BY a;
a
1
2
3
4
+connection master1;
DROP TABLE test.t4;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
index 53a521aaf85..d05401bc446 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
@@ -1,21 +1,14 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
-start slave;
-stop slave;
+include/start_slave.inc
+connection master;
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=SLAVE_PORT;
-start slave;
-
-let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%' ;
-
---source include/wait_slave_status.inc
+include/start_slave.inc
flush logs;
SHOW SLAVE STATUS;
Slave_IO_State #
@@ -24,7 +17,7 @@ Master_User root
Master_Port SLAVE_PORT
Connect_Retry 60
Master_Log_File slave-bin.000001
-Read_Master_Log_Pos 107
+Read_Master_Log_Pos 328
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File slave-bin.000001
@@ -39,7 +32,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 107
+Exec_Master_Log_Pos 328
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -58,4 +51,18 @@ Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 2
-STOP SLAVE;
+Master_SSL_Crl
+Master_SSL_Crlpath
+Using_Gtid No
+Gtid_IO_Pos
+Replicate_Do_Domain_Ids
+Replicate_Ignore_Domain_Ids
+Parallel_Mode conservative
+SQL_Delay 0
+SQL_Remaining_Delay NULL
+Slave_SQL_Running_State Slave has read all relay log; waiting for the slave I/O thread to update it
+Slave_DDL_Groups 0
+Slave_Non_Transactional_Groups 0
+Slave_Transactional_Groups 0
+stop slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_free_items.result b/mysql-test/suite/engines/funcs/r/rpl_free_items.result
index 91c1e2aa6e5..af7a267266f 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_free_items.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_free_items.result
@@ -1,10 +1,10 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1 (a int);
create table t2 (a int);
+connection slave;
+connection master;
drop table t1;
drop table t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_get_lock.result b/mysql-test/suite/engines/funcs/r/rpl_get_lock.result
index f7c9541bd9f..b852546e1bf 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_get_lock.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_get_lock.result
@@ -1,17 +1,17 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
create table t1(n int);
insert into t1 values(get_lock("lock",2));
+disconnect master;
+connection master1;
select get_lock("lock",2);
get_lock("lock",2)
1
select release_lock("lock");
release_lock("lock")
1
+connection slave;
select get_lock("lock",3);
get_lock("lock",3)
1
@@ -32,4 +32,7 @@ is_free_lock("lock2")
select is_free_lock(NULL);
is_free_lock(NULL)
NULL
+connection master1;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result b/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result
index 5169cc8e888..0a5564ac6c0 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result
@@ -1,21 +1,23 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
+set sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+connection slave;
+set sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+connection master;
grant select on *.* to rpl_ignore_grant@localhost;
grant drop on test.* to rpl_ignore_grant@localhost;
show grants for rpl_ignore_grant@localhost;
Grants for rpl_ignore_grant@localhost
-GRANT SELECT ON *.* TO 'rpl_ignore_grant'@'localhost'
-GRANT DROP ON `test`.* TO 'rpl_ignore_grant'@'localhost'
+GRANT SELECT ON *.* TO `rpl_ignore_grant`@`localhost`
+GRANT DROP ON `test`.* TO `rpl_ignore_grant`@`localhost`
+connection slave;
show grants for rpl_ignore_grant@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost'
select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
@@ -25,13 +27,19 @@ select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
count(*)
0
grant select on *.* to rpl_ignore_grant@localhost;
+connection master;
set password for rpl_ignore_grant@localhost=password("does it work?");
+connection slave;
select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
password<>_binary''
0
+connection master;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+connection slave;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+connection master;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result b/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result
index b1ccd2f0442..cc65d9dacfd 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result
@@ -1,30 +1,34 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
-select_priv
+Select_priv
N
+connection slave;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
-select_priv
+Select_priv
N
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
-select_priv
+Select_priv
Y
+connection master;
revoke select on *.* from 'user_foo';
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
-select_priv
+Select_priv
N
+connection slave;
select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
-select_priv
+Select_priv
Y
+connection slave;
revoke select on *.* FROM 'user_foo';
+connection master;
delete from mysql.user where user="user_foo";
+connection slave;
delete from mysql.user where user="user_foo";
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result b/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result
index a88a3c690ed..d4efa2dc42e 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result
@@ -1,14 +1,12 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
use test;
drop table if exists mysqltest_foo;
drop table if exists mysqltest_bar;
create table mysqltest_foo (n int);
insert into mysqltest_foo values(4);
+connection master;
use test;
create table mysqltest_foo (n int);
insert into mysqltest_foo values(5);
@@ -16,8 +14,12 @@ create table mysqltest_bar (m int);
insert into mysqltest_bar values(15);
create table t1 (k int);
insert into t1 values(55);
+connection slave;
select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1;
n m k
4 15 55
+connection master;
drop table mysqltest_foo,mysqltest_bar,t1;
+connection slave;
drop table mysqltest_foo,mysqltest_bar,t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_init_slave.result b/mysql-test/suite/engines/funcs/r/rpl_init_slave.result
index 740c918976c..a90de76f139 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_init_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_init_slave.result
@@ -1,9 +1,11 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+set global max_connections=151;
+connection slave;
+include/stop_slave.inc
+include/start_slave.inc
+connection master;
+connection slave;
show variables like 'init_slave';
Variable_name Value
init_slave set global max_connections=500
@@ -11,17 +13,21 @@ show variables like 'max_connections';
Variable_name Value
max_connections 500
reset master;
+connection master;
show variables like 'init_slave';
Variable_name Value
init_slave
show variables like 'max_connections';
Variable_name Value
max_connections 151
+connection slave;
set @my_global_init_connect= @@global.init_connect;
set global init_connect="set @c=1";
show variables like 'init_connect';
Variable_name Value
init_connect set @c=1
-stop slave;
+connection master;
+connection slave;
set global init_connect= @my_global_init_connect;
set global max_connections= default;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_insert.result b/mysql-test/suite/engines/funcs/r/rpl_insert.result
index b6a97926f73..1e790387e71 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_insert.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_insert.result
@@ -1,23 +1,25 @@
#
# Bug#20821: INSERT DELAYED fails to write some rows to binlog
#
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
CREATE SCHEMA IF NOT EXISTS mysqlslap;
USE mysqlslap;
-CREATE TABLE t1 (id INT, name VARCHAR(64));
+CREATE TABLE t1 (id INT, name VARCHAR(64)) ENGINE=MyISAM;
+connection slave;
+connection master;
SELECT COUNT(*) FROM mysqlslap.t1;
COUNT(*)
5000
+connection slave;
SELECT COUNT(*) FROM mysqlslap.t1;
COUNT(*)
5000
#
# Cleanup
#
+connection master;
USE test;
DROP SCHEMA mysqlslap;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_insert_select.result b/mysql-test/suite/engines/funcs/r/rpl_insert_select.result
index 1aff39e0026..3c9b31ded56 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_insert_select.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_insert_select.result
@@ -1,17 +1,21 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create table t1 (n int not null primary key);
insert into t1 values (1);
create table t2 (n int);
insert into t2 values (1);
insert ignore into t1 select * from t2;
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
insert into t1 values (2);
+connection slave;
+connection slave;
select * from t1;
n
1
2
+connection master;
drop table t1,t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result
index 5e3923616ed..d7a9a5981dc 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word;
@@ -78,6 +74,7 @@ Aberdeen
Abernathy
aberrant
aberration
+connection slave;
SELECT * FROM t1 ORDER BY word;
word
Aarhus
@@ -150,4 +147,7 @@ Aberdeen
Abernathy
aberrant
aberration
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result
index 4639c717cea..8e2bc2f0b1c 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result
@@ -1,10 +1,7 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
drop database if exists mysqltest;
+connection master;
USE test;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
@@ -18,6 +15,7 @@ LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
COUNT(*)
2
+connection slave;
SHOW DATABASES;
Database
information_schema
@@ -36,5 +34,8 @@ t1
SELECT COUNT(*) FROM mysqltest.t1;
COUNT(*)
2
+connection master;
DROP DATABASE mysqltest;
-DROP TABLE test.t1;
+DROP TABLE IF EXISTS test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
index 8b2da7ff9a1..1eb37dd4899 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
@@ -1,15 +1,16 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
reset master;
+connection master;
create table test.t1(a int, b int, unique(b));
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
+connection slave;
select count(*) from test.t1;
count(*)
2
-show binlog events from 107;
-Log_name Pos Event_type Server_id End_log_pos Info
+include/show_binlog_events.inc
+connection master;
drop table test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result b/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result
index 4dd4289b657..f7034cb7968 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result
@@ -1,31 +1,37 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1(a int);
select * into outfile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' from t1;
truncate table t1;
load data local infile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1;
+connection slave;
select a,count(*) from t1 group by a;
a count(*)
1 10000
+connection master;
drop table t1;
+connection slave;
+connection master;
create table t1(a int);
insert into t1 values (1), (2), (2), (3);
select * into outfile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int primary key);
load data local infile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1;
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY a;
a
1
2
3
+connection slave;
SELECT * FROM t1 ORDER BY a;
a
1
2
3
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loadfile.result b/mysql-test/suite/engines/funcs/r/rpl_loadfile.result
index 7a5a7bc50c9..fb40cbf3220 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loadfile.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loadfile.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
@@ -119,6 +116,8 @@ Abernathy
aberrant
aberration
+connection slave;
+connection slave;
SELECT * FROM test.t1 ORDER BY blob_column;
a blob_column
1 abase
@@ -223,5 +222,8 @@ Abernathy
aberrant
aberration
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
index df4512fa0ea..7f5f34bf831 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
@@ -1,46 +1,37 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+create table if not exists t1 (n int);
+drop table t1;
+call mtr.add_suppression ("Slave I/O: Got fatal error 1236 from master when reading data from binary");
+call mtr.add_suppression ("Error in Log_event::read_log_event");
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 107 <Binlog_Ignore_DB>
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 Yes Yes 0 0 107 # None 0 No # No 0 0 1
-stop slave;
-change master to master_log_pos=107;
-start slave;
-stop slave;
-change master to master_log_pos=107;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 No No 0 0 107 # None 0 No # No 0 0 1
-start slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 Yes Yes 0 0 107 # None 0 No # No 0 0 1
-stop slave;
-change master to master_log_pos=178;
+master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
+connection slave;
+include/stop_slave.inc
+change master to master_log_pos=MASTER_LOG_POS;
start slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 No Yes 0 0 178 # None 0 No # No 1236 Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position' 0 1
+include/wait_for_slave_io_error.inc [errno=1236]
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
+include/stop_slave_sql.inc
+connection master;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 107 <Binlog_Ignore_DB>
+master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
create table if not exists t1 (n int);
drop table if exists t1;
create table t1 (n int);
insert into t1 values (1),(2),(3);
-stop slave;
-change master to master_log_pos=207;
+connection slave;
+change master to master_log_pos=MASTER_LOG_POS;
start slave;
select * from t1 ORDER BY n;
n
1
2
3
+connection master;
drop table t1;
+connection slave;
+End of 5.0 tests
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result b/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result
index b2148892591..82b1f685ea8 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result
@@ -1,9 +1,7 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1 (a int not null auto_increment primary key, b int, key(b));
INSERT INTO t1 (a) VALUES (1),(2);
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_master_pos_wait.result b/mysql-test/suite/engines/funcs/r/rpl_master_pos_wait.result
deleted file mode 100644
index ab9b8cdad9d..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl_master_pos_wait.result
+++ /dev/null
@@ -1,18 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-select master_pos_wait('master-bin.999999',0,2);
-master_pos_wait('master-bin.999999',0,2)
--1
-explain extended select master_pos_wait('master-bin.999999',0,2);
-id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
-Warnings:
-Note 1003 select master_pos_wait('master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
-select master_pos_wait('master-bin.999999',0);
-stop slave sql_thread;
-master_pos_wait('master-bin.999999',0)
-NULL
diff --git a/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result b/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result
index 5003a3e7d65..302cf2351c2 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+CALL mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT');
create table t1(id int, i int, r1 int, r2 int, p varchar(100));
insert into t1 values(1, connection_id(), 0, 0, "");
insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
@@ -13,12 +10,52 @@ delete from t1 where id=6;
set sql_log_bin=1;
insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
-select * into outfile '../../tmp/rpl_misc_functions.outfile' from t1;
-create table t2 like t1;
-load data local infile 'MYSQLTEST_VARDIR/tmp/rpl_misc_functions.outfile' into table t2;
+select * into outfile 'rpl_misc_functions.outfile' from t1;
+connection slave;
+create temporary table t2 like t1;
+load data local infile 'MYSQLD_DATADIR/test/rpl_misc_functions.outfile' into table t2;
select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
id i r1 r2 p id i r1 r2 p
-stop slave;
-drop table t1;
-drop table t2;
+connection master;
drop table t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+col_a DOUBLE DEFAULT NULL);
+CREATE PROCEDURE test_replication_sp1()
+BEGIN
+INSERT INTO t1 (col_a) VALUES (rand()), (rand());
+INSERT INTO t1 (col_a) VALUES (rand());
+END|
+CREATE PROCEDURE test_replication_sp2()
+BEGIN
+CALL test_replication_sp1();
+CALL test_replication_sp1();
+END|
+CREATE FUNCTION test_replication_sf() RETURNS DOUBLE DETERMINISTIC
+BEGIN
+RETURN (rand() + rand());
+END|
+CALL test_replication_sp1();
+CALL test_replication_sp2();
+INSERT INTO t1 (col_a) VALUES (test_replication_sf());
+INSERT INTO t1 (col_a) VALUES (test_replication_sf());
+INSERT INTO t1 (col_a) VALUES (test_replication_sf());
+connection slave;
+select * from t1 into outfile "../../tmp/t1_slave.txt";
+Warnings:
+Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
+connection master;
+create temporary table t1_slave select * from t1 where 1=0;
+load data infile '../../tmp/t1_slave.txt' into table t1_slave;
+select count(*) into @aux from t1 join t1_slave using (id)
+where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ;
+SELECT @aux;
+@aux
+12
+connection master;
+DROP TABLE t1, t1_slave;
+DROP PROCEDURE test_replication_sp1;
+DROP PROCEDURE test_replication_sp2;
+DROP FUNCTION test_replication_sf;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result b/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result
index 4831502eb88..62a0d74225d 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
@@ -14,9 +10,13 @@ a
select * from t2;
a
1
+connection slave;
select * from t1;
a
select * from t2;
a
1
+connection master;
drop table t1,t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result b/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result
index 8e6a6a3d4d0..0a316ec3452 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result
@@ -1,13 +1,12 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
set sql_log_bin=0;
create database mysqltest_from;
set sql_log_bin=1;
+connection slave;
create database mysqltest_to;
+connection master;
use mysqltest_from;
drop table if exists a;
CREATE TABLE a (i INT);
@@ -20,10 +19,12 @@ delete alias FROM a alias where alias.i=2;
select * from a;
i
3
+connection slave;
use mysqltest_to;
select * from a;
i
3
+connection master;
create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
@@ -34,11 +35,15 @@ a
select * from t2;
a
1
+connection slave;
select * from t1;
ERROR 42S02: Table 'mysqltest_to.t1' doesn't exist
select * from t2;
ERROR 42S02: Table 'mysqltest_to.t2' doesn't exist
+connection master;
set sql_log_bin=0;
drop database mysqltest_from;
set sql_log_bin=1;
+connection slave;
drop database mysqltest_to;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result b/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result
index f6dde65a35d..256c1c503ab 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result
@@ -1,12 +1,11 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
drop database if exists d1;
drop database if exists d2;
+connection slave;
drop database if exists d2;
+connection master;
create database d1;
create table d1.t0 (id int);
create database d2;
@@ -17,9 +16,13 @@ insert into t1 values (1), (2), (3), (4), (5);
insert into t2 select id + 3 from t1;
update t1 join t2 using (id) set t1.id = 0;
insert into d1.t0 values (0);
+connection slave;
use d1;
select * from t0 where id=0;
id
0
+connection master;
drop database d1;
drop database d2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_ps.result b/mysql-test/suite/engines/funcs/r/rpl_ps.result
index 73c36af4862..57c2db05811 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_ps.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_ps.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
drop table if exists t1;
create table t1(n char(30));
prepare stmt1 from 'insert into t1 values (?)';
@@ -19,12 +15,40 @@ set @var2= 'insert into t1 values (concat("from-var-", ?))';
prepare stmt2 from @var2;
set @var1='from-master-3';
execute stmt2 using @var1;
+connection slave;
SELECT * FROM t1 ORDER BY n;
n
from-master-1
from-master-2-'',
from-var-from-master-3
+connection master;
drop table t1;
+connection slave;
stop slave;
-reset master;
-reset slave;
+include/wait_for_slave_to_stop.inc
+
+########################################################################
+#
+# BUG#25843: Changing default database between PREPARE and EXECUTE of
+# statement breaks binlog.
+#
+########################################################################
+connection slave;
+START SLAVE;
+connection master;
+CREATE DATABASE mysqltest1;
+CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32));
+PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)';
+EXECUTE stmt_d_1;
+use mysqltest1;
+EXECUTE stmt_d_1;
+connection slave;
+SELECT * FROM t1;
+db_name db_col_name
+test latin1_swedish_ci
+test latin1_swedish_ci
+connection master;
+DROP DATABASE mysqltest1;
+use test;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
deleted file mode 100644
index 13f7fbfbdeb..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
+++ /dev/null
@@ -1,55 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-**** On Master ****
-CREATE TABLE t1 (a INT, b LONG);
-INSERT INTO t1 VALUES (1,1), (2,2);
-INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-SHOW BINLOG EVENTS;
-**** On Slave ****
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
-Replicate_Ignore_Server_Ids
-Master_Server_Id 1
-SHOW BINLOG EVENTS;
-DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_relayspace.result b/mysql-test/suite/engines/funcs/r/rpl_relayspace.result
index 1f2a739d3e3..90bf18aaa88 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_relayspace.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_relayspace.result
@@ -1,19 +1,18 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
+connection master;
create table t1 (a int);
drop table t1;
create table t1 (a int);
drop table t1;
+connection slave;
reset slave;
start slave io_thread;
-stop slave io_thread;
+include/wait_for_slave_param.inc [Slave_IO_State]
+include/stop_slave_io.inc
reset slave;
-start slave;
-select master_pos_wait('master-bin.001',200,6)=-1;
-master_pos_wait('master-bin.001',200,6)=-1
-0
+include/start_slave.inc
+include/assert.inc [Assert that master_pos_wait does not timeout nor it returns NULL]
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result b/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result
index 0135804c02d..1192f9860f2 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
drop database if exists mysqltest1;
drop database if exists mysqltest2;
create database mysqltest1;
@@ -11,13 +7,19 @@ create database mysqltest2;
use mysqltest1;
create table t1 (a int);
insert into t1 values(1);
+connection slave;
select * from mysqltest1.t1;
ERROR 42S02: Table 'mysqltest1.t1' doesn't exist
+connection master;
use mysqltest2;
create table t1 (a int);
insert into t1 values(1);
+connection slave;
select * from mysqltest2.t1;
a
1
+connection master;
drop database mysqltest1;
drop database mysqltest2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result b/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result
index 23f95878608..480ad34ce69 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create database if not exists mysqltest1;
DROP TABLE IF EXISTS mysqltest1.t1;
CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT,
@@ -24,6 +21,10 @@ FOR EACH ROW BEGIN
SET new.b = mysqltest1.f1();
END|
INSERT INTO mysqltest1.t1 SET n = NULL, a = now();
+connection slave;
+connection master;
DROP TABLE IF EXISTS mysqltest1.t1;
DROP FUNCTION mysqltest1.f1;
DROP DATABASE mysqltest1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_USER.result b/mysql-test/suite/engines/funcs/r/rpl_row_USER.result
index c4774665307..2771c674f44 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_USER.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_USER.result
@@ -1,15 +1,15 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+set local sql_mode="";
+connection master;
DROP DATABASE IF EXISTS mysqltest1;
CREATE DATABASE mysqltest1;
CREATE USER tester IDENTIFIED BY 'test';
GRANT ALL ON mysqltest1.* TO 'tester'@'%' IDENTIFIED BY 'test';
GRANT ALL ON mysqltest1.* TO ''@'localhost%';
FLUSH PRIVILEGES;
+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());
@@ -19,21 +19,26 @@ INSERT INTO mysqltest1.t1 VALUES(3,USER());
INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER());
end|
CALL mysqltest1.p1();
+connection master;
SELECT * FROM mysqltest1.t1 ORDER BY a;
a users
1 tester@localhost
2 @localhost%
3 tester@localhost
4 @localhost%
+connection slave;
SELECT * FROM mysqltest1.t1 ORDER BY a;
a users
1 tester@localhost
2 @localhost%
3 tester@localhost
4 @localhost%
+connection master;
+DROP DATABASE mysqltest1;
REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
-DROP DATABASE mysqltest1;
-DROP USER 'tester';
+DROP USER tester@'%';
DROP USER ''@'localhost%';
FLUSH PRIVILEGES;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
index d45bbadf7df..8753764e81e 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
@@ -1,10 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-**** On Master ****
+include/master-slave.inc
+[connection master]
+connection master;
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
CREATE TEMPORARY TABLE t2 (a int, b int);
@@ -12,47 +8,48 @@ SHOW TABLES;
Tables_in_test
t1
t2
-**** On Slave ****
+connection slave;
SHOW TABLES;
Tables_in_test
t1
t2
-**** On Master ****
+connection master;
DROP TABLE t2;
SHOW TABLES;
Tables_in_test
t1
t2
-**** On Slave ****
+connection slave;
SHOW TABLES;
Tables_in_test
t1
t2
-**** On Master ****
+connection master;
CREATE TEMPORARY TABLE t2 (a int, b int);
SHOW TABLES;
Tables_in_test
t1
t2
-**** On Slave ****
+connection slave;
SHOW TABLES;
Tables_in_test
t1
t2
-**** On Master ****
+connection master;
DROP TABLE t1,t2;
-SHOW BINLOG EVENTS;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 107 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 107 Query 1 193 use `test`; CREATE TABLE t1 (a int)
-master-bin.000001 193 Query 1 279 use `test`; CREATE TABLE t2 (a int)
-master-bin.000001 279 Query 1 403 use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
-master-bin.000001 403 Query 1 527 use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
-master-bin.000001 527 Query 1 631 use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
SHOW TABLES;
Tables_in_test
t2
-**** On Slave ****
+connection slave;
SHOW TABLES;
Tables_in_test
t2
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_func001.result b/mysql-test/suite/engines/funcs/r/rpl_row_func001.result
index b20f3f724d0..ae05b5cf3c0 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_func001.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_func001.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP FUNCTION test.f1;
DROP TABLE IF EXISTS test.t1;
create table test.t1 (a int, PRIMARY KEY(a));
@@ -22,9 +19,14 @@ select * from test.t1;
a
1
2
+connection slave;
+connection slave;
select * from test.t1;
a
1
2
+connection master;
DROP FUNCTION test.f1;
DROP TABLE test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
index aff54e01b95..e2bd199ecab 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
@@ -1,14 +1,12 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create table t1 (a int not null primary key);
insert into t1 values (1);
create table t2 (a int);
insert into t2 values (1);
update t1, t2 set t1.a = 0 where t1.a = t2.a;
+connection slave;
show tables;
Tables_in_test
t1
@@ -16,46 +14,14 @@ select * from t1;
a
0
drop table t1;
+connection master;
insert into t1 values (1);
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table test.t2
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1146
-Last_Error Error executing row event: 'Table 'test.t1' doesn't exist'
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 1146
-Last_SQL_Error Error executing row event: 'Table 'test.t1' doesn't exist'
-Replicate_Ignore_Server_Ids
-Master_Server_Id 1
+connection slave;
+call mtr.add_suppression("Slave SQL.*Error executing row event: .Table .test.t1. doesn.t exist., error.* 1146");
+include/wait_for_slave_sql_error.inc [errno=1146]
+==== Clean up ====
+include/stop_slave_io.inc
+RESET SLAVE;
+connection master;
drop table t1, t2;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result b/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
index 547dd8e1541..41d18d7f9fe 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
@@ -1,20 +1,19 @@
+include/master-slave.inc
+[connection master]
+connection slave;
stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
+connection master;
#
# Generate a big enough master's binlog to cause relay log rotations
#
create table t1 (a int);
drop table t1;
+connection slave;
reset slave;
#
# Test 1
#
-set @my_max_binlog_size= @@global.max_binlog_size;
+set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size;
set global max_binlog_size=8192;
set global max_relay_log_size=8192-1;
Warnings:
@@ -23,7 +22,7 @@ select @@global.max_relay_log_size;
@@global.max_relay_log_size
4096
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 2
#
@@ -33,17 +32,19 @@ set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size;
@@global.max_relay_log_size 20480
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 3: max_relay_log_size = 0
#
stop slave;
reset slave;
set global max_relay_log_size=0;
+Warnings:
+Warning 1292 Truncated incorrect max_relay_log_size value: '0'
select @@global.max_relay_log_size;
-@@global.max_relay_log_size 0
+@@global.max_relay_log_size 4096
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
@@ -56,19 +57,27 @@ flush logs;
reset slave;
start slave;
flush logs;
+connection master;
create table t1 (a int);
-Checking that both slave threads are running.
+connection slave;
+include/check_slave_is_running.inc
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs;
+connection master;
drop table t1;
-Checking that both slave threads are running.
+connection slave;
+include/check_slave_is_running.inc
+connection master;
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB>
+connection slave;
set global max_binlog_size= @my_max_binlog_size;
+set global max_relay_log_size= @my_max_relay_log_size;
#
# End of 4.1 tests
#
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
index 5499d41bc1f..b9e98d5a97d 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
@@ -1,41 +1,58 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-Master_User root
-Master_Host 127.0.0.1
+include/master-slave.inc
+[connection master]
+connection slave;
+Master_User = 'root'
+Master_Host = '127.0.0.1'
include/stop_slave.inc
change master to master_user='test';
-Master_User test
-Master_Host 127.0.0.1
+Master_User = 'test'
+Master_Host = '127.0.0.1'
reset slave;
-Master_User test
-Master_Host 127.0.0.1
+Master_User = 'test'
+Master_Host = '127.0.0.1'
change master to master_user='root';
include/start_slave.inc
-Master_User root
-Master_Host 127.0.0.1
+Master_User = 'root'
+Master_Host = '127.0.0.1'
include/stop_slave.inc
reset slave;
include/start_slave.inc
+connection master;
create temporary table t1 (a int);
+connection slave;
include/stop_slave.inc
reset slave;
include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
+connection master;
+drop temporary table if exists t1;
+connection slave;
include/stop_slave.inc
reset slave;
+include/check_slave_no_error.inc
change master to master_user='impossible_user_name';
start slave;
-stop slave;
+include/wait_for_slave_io_error.inc [errno=1045]
+include/stop_slave_sql.inc
change master to master_user='root';
include/start_slave.inc
+include/check_slave_no_error.inc
stop slave;
change master to master_user='impossible_user_name';
start slave;
-stop slave;
+include/wait_for_slave_io_error.inc [errno=1045]
+include/stop_slave_sql.inc
reset slave;
+include/check_slave_no_error.inc
+change master to master_user='root';
+reset slave;
+include/start_slave.inc
+include/stop_slave.inc
+reset slave all;
+start slave;
+ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO
+CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
+include/start_slave.inc
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result
index 8c26c061376..d37425c43a8 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
<Begin test section 1 (non deterministic SP)>
---------------------------------------------
@@ -34,12 +30,14 @@ a t
2 NEW
3 NEW
4 NEW
+connection slave;
SELECT * FROM t2 ORDER BY a;
a t
1 NEW
2 NEW
3 NEW
4 NEW
+connection master;
call test.p2(1);
SELECT * FROM t2 ORDER BY a;
a t
@@ -47,12 +45,14 @@ a t
2 Tex
3 Tex
4 Tex
+connection slave;
SELECT * FROM t2 ORDER BY a;
a t
1 Tex
2 Tex
3 Tex
4 Tex
+connection master;
call test.p2(2);
SELECT * FROM t2 ORDER BY a;
a t
@@ -60,12 +60,14 @@ a t
2 SQL
3 SQL
4 SQL
+connection slave;
SELECT * FROM t2 ORDER BY a;
a t
1 SQL
2 SQL
3 SQL
4 SQL
+connection master;
call test.p2(3);
SELECT * FROM t2 ORDER BY a;
a t
@@ -73,13 +75,17 @@ a t
2 NONE
3 NONE
4 NONE
+connection slave;
SELECT * FROM t2 ORDER BY a;
a t
1 NONE
2 NONE
3 NONE
4 NONE
+connection master;
DROP PROCEDURE test.p1;
DROP PROCEDURE test.p2;
DROP TABLE test.t1;
DROP TABLE test.t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result
index 58c53b394b2..8acc2e20202 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t2;
@@ -42,9 +39,6 @@ INSERT INTO test.t1 VALUES (4,'MySQL'),(20,'ROCKS'),(11,'Texas'),(10,'kyle');
INSERT INTO test.t2 VALUES (4),(2),(1),(3);
UPDATE test.t1 SET id=id+4 WHERE id=4;
END|
-
-< ---- Master selects-- >
--------------------------
CALL test.p2();
SELECT * FROM test.t1 ORDER BY id;
id data
@@ -58,9 +52,7 @@ id2
2
3
4
-
-< ---- Slave selects-- >
-------------------------
+connection slave;
SELECT * FROM test.t1 ORDER BY id;
id data
8 MySQL
@@ -73,30 +65,28 @@ id2
2
3
4
-
-< ---- Master selects-- >
--------------------------
+connection master;
CALL test.p1();
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
SELECT * FROM test.t3 ORDER BY id3;
id3 c
1 MySQL
2 kyle
3 Texas
4 ROCKS
-
-< ---- Slave selects-- >
-------------------------
+connection slave;
SELECT * FROM test.t3 ORDER BY id3;
id3 c
1 MySQL
2 kyle
3 Texas
4 ROCKS
+connection master;
ALTER PROCEDURE test.p1 MODIFIES SQL DATA;
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result
index 23197964a24..481c9b3f6cc 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t2;
CREATE TABLE test.t1 (a INT,PRIMARY KEY(a));
@@ -14,21 +11,19 @@ BEGIN
SELECT SQL_CALC_FOUND_ROWS * FROM test.t1 LIMIT 1;
INSERT INTO test.t2 VALUES(FOUND_ROWS());
END|
-
-< ---- Master selects-- >
--------------------------
CALL test.p1();
a
1
SELECT * FROM test.t2;
a
2
-
-< ---- Slave selects-- >
-------------------------
+connection slave;
SELECT * FROM test.t2;
a
2
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result
index 35ce0d7b420..d4bcfe9fcb6 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
@@ -53,25 +50,33 @@ SELECT * FROM test.t2 ORDER BY a;
a
1
3
+connection slave;
SELECT * FROM test.t2 ORDER BY a;
a
1
3
+connection master;
truncate test.t2;
call test.p1('b');
select * from test.t2 ORDER BY a;
a
2
4
+connection slave;
SELECT * FROM test.t2 ORDER BY a;
a
2
4
+connection master;
truncate test.t2;
SELECT * FROM test.t2 ORDER BY a;
a
+connection slave;
SELECT * FROM test.t2 ORDER BY a;
a
+connection master;
DROP PROCEDURE test.p1;
DROP TABLE test.t1;
DROP TABLE test.t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result
index 02567465428..6a15298eddf 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
@@ -26,8 +23,10 @@ SELECT * FROM test.t1 ORDER BY a;
a
1
2
+connection slave;
show tables;
Tables_in_test
+connection master;
CREATE PROCEDURE test.p3()
BEGIN
INSERT INTO test.t2 VALUES(7);
@@ -44,13 +43,17 @@ SELECT * FROM test.t2 ORDER BY a;
a
6
7
+connection slave;
SELECT * FROM test.t2 ORDER BY a;
a
6
7
+connection master;
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;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result
index e35c9f21adb..53a9a964b53 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
@@ -58,6 +55,8 @@ ALTER TABLE test.t2 DROP COLUMN to_drop;
INSERT INTO test.t2 VALUES ('gone',NULL,'STM',RAND());
END|
CALL test.p1();
+connection slave;
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
@@ -67,3 +66,5 @@ DROP PROCEDURE IF EXISTS test.p6;
DROP PROCEDURE IF EXISTS test.p7;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result
index 4aa16cbf6bd..65cc566256a 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result
@@ -1,12 +1,10 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
+create user user1@localhost;
grant usage on *.* to user1@localhost;
flush privileges;
SELECT CURRENT_USER();
@@ -21,9 +19,10 @@ CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
-
-<******** Master user1 p3 & p2 calls *******>
-----------------------------------------------
+set sql_mode=default;
+connection slave;
+connect muser1,localhost,user1,,;
+connection muser1;
SELECT CURRENT_USER();
CURRENT_USER()
user1@localhost
@@ -36,9 +35,9 @@ user1@localhost user1@localhost
CALL test.p2();
CURRENT_USER() USER()
root@localhost user1@localhost
-
-<******** Slave user1 p3 & p2 calls *******>
----------------------------------------------
+connect suser1,127.0.0.1,user1,,test,$SLAVE_MYPORT,;
+connection master;
+connection suser1;
SELECT CURRENT_USER();
CURRENT_USER()
user1@localhost
@@ -51,9 +50,12 @@ user1@localhost user1@localhost
CALL test.p2();
CURRENT_USER() USER()
root@localhost user1@localhost
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p3;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
-DROP USER 'user1'@'localhost';
+DROP USER user1@localhost;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result b/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result
index 46ca5748174..07be1bfebfe 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result
@@ -1,11 +1,10 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create table t1 (a int not null auto_increment primary key, b int, key(b));
-stop slave;
+connection slave;
+include/stop_slave.inc
+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;
@@ -20,7 +19,9 @@ INSERT INTO t1 (a) SELECT null FROM t1;
INSERT INTO t1 (a) SELECT null FROM t1;
INSERT INTO t1 (a) SELECT null FROM t1;
INSERT INTO t1 (a) SELECT null FROM t1;
-start slave;
-stop slave;
+connection slave;
+include/start_slave.inc
+include/stop_slave.inc
drop table t1;
+connection master;
drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result b/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result
index 6665dc6d555..142c6c61865 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result
@@ -1,14 +1,10 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n));
CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n));
INSERT INTO test.t1 VALUES (1,NOW());
-CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1;//
+CREATE 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());
@@ -18,9 +14,15 @@ CREATE PROCEDURE test.p2()
BEGIN
INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW());
END//
+connection slave;
+connection master;
+connection master;
+INSERT INTO test.t1 VALUES (1+1, NOW());
+connection slave;
<End test section 2 (Tiggers & SP)>
-----------------------------------
+connection master;
DROP PROCEDURE test.p2;
DROP PROCEDURE test.p3;
DROP TRIGGER test.t2_ai;
@@ -28,3 +30,5 @@ DROP TRIGGER test.t3_bi_t2;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result b/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result
index 794104db750..8259edd56df 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP TRIGGER test.t2_ai;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
@@ -20,6 +17,7 @@ id domain
3 earthmotherwear.com
4 yahoo.com
5 example.com
+connection slave;
SELECT * FROM test.t1 ORDER BY id;
id domain
1 example.com
@@ -27,6 +25,7 @@ id domain
3 earthmotherwear.com
4 yahoo.com
5 example.com
+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');
@@ -37,6 +36,7 @@ select * from test.t3;
value domain_id mailaccount_id program keey
No 5 NULL spamfilter scan_incoming
Yes 1 NULL spamfilter scan_incoming
+connection slave;
select * from test.t2;
value domain_id mailaccount_id program keey
Yes 1 NULL spamfilter scan_incoming
@@ -44,6 +44,7 @@ select * from test.t3;
value domain_id mailaccount_id program keey
No 5 NULL spamfilter scan_incoming
Yes 1 NULL spamfilter scan_incoming
+connection master;
DELETE FROM test.t1 WHERE id = 1;
SELECT * FROM test.t1 ORDER BY id;
id domain
@@ -51,19 +52,24 @@ id domain
3 earthmotherwear.com
4 yahoo.com
5 example.com
+connection master;
SELECT * FROM test.t1 ORDER BY id;
id domain
2 mysql.com
3 earthmotherwear.com
4 yahoo.com
5 example.com
+connection slave;
SELECT * FROM test.t1 ORDER BY id;
id domain
2 mysql.com
3 earthmotherwear.com
4 yahoo.com
5 example.com
+connection master;
DROP TRIGGER test.t2_ai;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result b/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result
index 131af933b41..239d5917bc5 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP TRIGGER test.t1_bi;
DROP TRIGGER test.t2_ai;
DROP TRIGGER test.t1_bu;
@@ -69,15 +66,11 @@ INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL C
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;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
DELETE FROM test.t1 WHERE id = 1;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
DELETE FROM test.t2 WHERE id = 1;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
+connection slave;
+connection master;
DROP TRIGGER test.t1_bi;
DROP TRIGGER test.t2_ai;
DROP TRIGGER test.t1_bu;
@@ -87,3 +80,5 @@ DROP TRIGGER test.t2_ad;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_until.result b/mysql-test/suite/engines/funcs/r/rpl_row_until.result
index 457d83496bc..82268ce72eb 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_until.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_until.result
@@ -6,15 +6,14 @@ 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);
-connection slave;
-connection master;
INSERT INTO t2 VALUES (3),(4);
DROP TABLE t2;
connection slave;
include/stop_slave.inc
RESET SLAVE;
+CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT;
connection slave;
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1;
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t1;
n
@@ -23,7 +22,7 @@ n
3
4
include/check_slave_param.inc [Exec_Master_Log_Pos]
-START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
+START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t1;
n
@@ -32,19 +31,12 @@ n
3
4
include/check_slave_param.inc [Exec_Master_Log_Pos]
-START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2
-include/wait_for_slave_sql_to_stop.inc
-SELECT * FROM t2;
-n
-1
-2
-include/check_slave_param.inc [Exec_Master_Log_Pos]
START SLAVE;
include/wait_for_slave_to_start.inc
connection master;
connection slave;
include/stop_slave.inc
-START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2
+START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2;
include/wait_for_slave_param.inc [Until_Log_Pos]
include/wait_for_slave_sql_to_stop.inc
include/check_slave_param.inc [Exec_Master_Log_Pos]
@@ -58,10 +50,25 @@ START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-START SLAVE;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
-Warnings:
-Note 1254 Slave is already running
include/stop_slave.inc
RESET SLAVE;
+include/start_slave.inc
+include/rpl_reset.inc
+connection master;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+connection slave;
+include/stop_slave_sql.inc
+connection master;
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+include/sync_slave_io_with_master.inc
+start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=relay_log_pos;
+include/wait_for_slave_sql_to_stop.inc
+include/assert.inc [table t1 should have two rows.]
+include/start_slave.inc
+connection master;
+DROP TABLE t1;
+connection slave;
include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_view01.result b/mysql-test/suite/engines/funcs/r/rpl_row_view01.result
index a4b8d0a05e3..5c9944e75e0 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_view01.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_view01.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create database if not exists mysqltest1;
DROP VIEW IF EXISTS mysqltest1.v1;
DROP VIEW IF EXISTS mysqltest1.v2;
@@ -35,6 +32,7 @@ a c c2
1 Thank GOD
2 it is
3 Friday TGIF
+connection slave;
SELECT * FROM mysqltest1.v2;
qty price value
3 50 150
@@ -45,6 +43,7 @@ a c c2
1 Thank GOD
2 it is
3 Friday TGIF
+connection master;
INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2;
INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1;
SELECT * FROM mysqltest1.t5 ORDER BY qty;
@@ -57,6 +56,7 @@ a c c2
1 Thank GOD
2 it is
3 Friday TGIF
+connection slave;
SELECT * FROM mysqltest1.t5 ORDER BY qty;
qty price total
3 50 150
@@ -67,6 +67,7 @@ a c c2
1 Thank GOD
2 it is
3 Friday TGIF
+connection master;
INSERT INTO mysqltest1.v4 VALUES (4,'TEST');
SELECT * FROM mysqltest1.t1 ORDER BY a;
a c
@@ -79,6 +80,7 @@ a c
2 it
3 Friday
4 TEST
+connection slave;
SELECT * FROM mysqltest1.t1 ORDER BY a;
a c
1 Thank
@@ -90,6 +92,7 @@ a c
2 it
3 Friday
4 TEST
+connection master;
DROP VIEW IF EXISTS mysqltest1.v1;
DROP VIEW IF EXISTS mysqltest1.v2;
DROP VIEW IF EXISTS mysqltest1.v3;
@@ -99,3 +102,5 @@ DROP TABLE IF EXISTS mysqltest1.t1;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP TABLE IF EXISTS mysqltest1.t4;
DROP DATABASE mysqltest1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
index 700bc270f07..6450ea21d3d 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
@@ -1,19 +1,19 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
create table t1 (n int);
reset master;
-stop slave;
+include/stop_slave.inc
change master to master_port=SLAVE_PORT;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
- 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 107 None 0 No NULL No 0 0 1
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 256 None 0 No NULL No 0 0 1 No conservative 0 NULL 0 0 0
start slave;
insert into t1 values (1);
-show status like "slave_running";
-Variable_name Value
-Slave_running OFF
+include/wait_for_slave_param.inc [Last_IO_Errno]
+Last_IO_Errno = '1593'
+Last_IO_Error = 'Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).'
+include/stop_slave.inc
+reset slave;
+reset master;
drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
index f8d24f70776..74145645920 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
@@ -1,21 +1,38 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
create table t1 (n int);
reset master;
stop slave;
+include/wait_for_slave_to_stop.inc
change master to master_port=SLAVE_PORT;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
- 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 107 None 0 No NULL No 0 0 1
start slave;
+include/wait_for_slave_to_start.inc
insert into t1 values (1);
select * from t1;
n
1
1
stop slave;
+include/wait_for_slave_to_stop.inc
+drop table t1;
+connection master;
+reset master;
+create table t1(n int);
+create table t2(n int);
+connection slave;
+change master to master_port=MASTER_PORT;
+start slave until master_log_file='master-bin.000001', master_log_pos=UNTIL_POS;
+include/wait_for_slave_io_to_start.inc
+include/wait_for_slave_sql_to_stop.inc
+*** checking until position execution: must be only t1 in the list ***
+show tables;
+Tables_in_test
+t1
+connection slave;
+start slave sql_thread;
+connection master;
drop table t1;
+drop table t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_session_var.result b/mysql-test/suite/engines/funcs/r/rpl_session_var.result
index b5b4b815ade..67863583f8d 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_session_var.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_session_var.result
@@ -1,12 +1,8 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
drop table if exists t1;
Warnings:
-Note 1051 Unknown table 't1'
+Note 1051 Unknown table 'test.t1'
create table t1(a varchar(100),b int);
set @@session.sql_mode=pipes_as_concat;
insert into t1 values('My'||'SQL', 1);
@@ -16,10 +12,12 @@ select * from t1 where b<3 order by a;
a b
1 2
MySQL 1
+connection slave;
select * from t1 where b<3 order by a;
a b
1 2
MySQL 1
+connection master;
set @@session.sql_mode=ignore_space;
insert into t1 values(password ('MySQL'), 3);
set @@session.sql_mode=ansi_quotes;
@@ -37,7 +35,24 @@ insert into t2 select 2,a from t1 where a is null;
select * from t2 order by b;
b a
1 1
+connection slave;
select * from t2 order by b;
b a
1 1
+connection master;
drop table t1,t2;
+connection slave;
+connection master;
+CREATE TABLE t1 (
+`id` int(11) NOT NULL auto_increment,
+`data` varchar(100),
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM;
+INSERT INTO t1(data) VALUES(SESSION_USER());
+connection slave;
+SELECT length(data) < 100 FROM t1;
+length(data) < 100
+1
+connection master;
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_sf.result b/mysql-test/suite/engines/funcs/r/rpl_sf.result
index 9cb9c9e8354..e692e31f908 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_sf.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_sf.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
set global log_bin_trust_function_creators=0;
set binlog_format=STATEMENT;
create function fn16456()
@@ -27,3 +23,4 @@ set binlog_format=STATEMENT;
select fn16456();
ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
drop function fn16456;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_skip_error.result b/mysql-test/suite/engines/funcs/r/rpl_skip_error.result
index 248ce5b52c3..98c165e7db0 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_skip_error.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_skip_error.result
@@ -1,16 +1,18 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1 (n int not null primary key);
+connection slave;
insert into t1 values (1);
+connection master;
insert into t1 values (1);
insert into t1 values (2),(3);
+connection slave;
select * from t1 ORDER BY n;
n
1
2
3
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
index 0e438d294fd..1c81cec2577 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
@@ -1,63 +1,48 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
-stop slave;
-change master to master_user='rpl',master_password='rpl';
-start slave;
-drop table if exists t1;
-create table t1 (n int);
-insert into t1 values (1);
-select * from t1;
+include/master-slave.inc
+[connection master]
+==== Create new replication user ====
+connection master;
+GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
+connection slave;
+include/stop_slave.inc
+set @save_relay_log_purge=@@global.relay_log_purge;
+set @@global.relay_log_purge=0;
+CHANGE MASTER TO master_user='rpl', master_password='rpl';
+select @@global.relay_log_purge;
+@@global.relay_log_purge
+0
+set @@global.relay_log_purge=1;
+CHANGE MASTER TO master_user='rpl', master_password='rpl';
+select @@global.relay_log_purge;
+@@global.relay_log_purge
+1
+set @@global.relay_log_purge=@save_relay_log_purge;
+CHANGE MASTER TO master_user='rpl', master_password='rpl';
+include/start_slave.inc
+==== Do replication as new user ====
+connection master;
+CREATE TABLE t1 (n INT);
+INSERT INTO t1 VALUES (1);
+connection slave;
+SELECT * FROM t1;
n
1
-drop user rpl@127.0.0.1;
-flush privileges;
-stop slave;
-start slave;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User rpl
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Connecting
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master NULL
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-Replicate_Ignore_Server_Ids
-Master_Server_Id 1
-drop table t1;
-drop table t1;
+==== Delete new replication user ====
+connection master;
+DROP USER rpl@127.0.0.1;
+FLUSH PRIVILEGES;
+connection slave;
+==== Restart slave without privileges =====
+include/stop_slave.inc
+START SLAVE;
+include/wait_for_slave_sql_to_start.inc
+include/wait_for_slave_io_to_stop.inc
+==== Verify that Slave IO thread stopped with error ====
+include/wait_for_slave_io_error.inc [errno=1045]
+==== Cleanup (Note that slave IO thread is not running) ====
+include/stop_slave_sql.inc
+CHANGE MASTER TO MASTER_USER = 'root', MASTER_PASSWORD = '';
+include/rpl_reset.inc
+connection master;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff b/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff
new file mode 100644
index 00000000000..47901f63a51
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff
@@ -0,0 +1,477 @@
+@@ -126,12 +126,15 @@
+ show warnings;
+ Level Code Message
+ Error 1062 Duplicate entry '20' for key 'a'
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ Note 4094 At line 4 in mysqltest1.foo4
+ select * from t2;
+ a
++20
+ connection slave;
+ select * from t2;
+ a
++20
+ select * from mysql.proc where name="foo4" and db='mysqltest1';
+ db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
+ mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin
+@@ -171,20 +174,16 @@
+ insert into t2 values(fn1(21));
+ select * from t1;
+ a
+-15
+ 20
+ 21
+-5
+ select * from t2;
+ a
+ 23
+ connection slave;
+ select * from t1;
+ a
+-15
+ 20
+ 21
+-5
+ select * from t2;
+ a
+ 23
+@@ -292,13 +291,18 @@
+ Warnings:
+ Error 1062 Duplicate entry '100' for key 'a'
+ Note 4094 At line 3 in mysqltest1.fn1
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ select fn1(20);
+ ERROR 23000: Duplicate entry '20' for key 'a'
+ select * from t2;
+ a
++20
++100
+ connection slave;
+ select * from t2;
+ a
++20
++100
+ connection con1;
+ create trigger trg before insert on t1 for each row set new.a= 10;
+ ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table 't1'
+@@ -472,13 +476,13 @@
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8))
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (unix_timestamp())
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
+ select * from mysqltest1.t1
+@@ -509,24 +513,24 @@
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (15)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo4 sql security invoker
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (5)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t2
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a)
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -537,6 +541,9 @@
+ begin
+ insert into t2 values(20),(20);
+ end
++master-bin.000001 # Gtid # # BEGIN GTID #-#-#
++master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(20),(20)
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -557,10 +564,10 @@
+ master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(fn1(21))
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; drop function fn1
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -571,10 +578,10 @@
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(fn1())
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11)
+ NO SQL
+@@ -589,7 +596,7 @@
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t2
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a)
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -601,21 +608,27 @@
+ return 10;
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
++master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100)
++master-bin.000001 # Query # # COMMIT
++master-bin.000001 # Gtid # # BEGIN GTID #-#-#
++master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
++master-bin.000001 # Query # # COMMIT
++master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; drop trigger trg
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+ READS SQL DATA
+@@ -647,7 +660,7 @@
+ master-bin.000001 # Query # # use `test`; create table t1 (a int)
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `test`; insert into t1 (a) values (f1())
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `test`; drop view v1
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -663,7 +676,7 @@
+ INSERT INTO t1 VALUES(arg)
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -697,7 +710,7 @@
+ begin end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest2`; insert into t values ( 1 )
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ begin
+@@ -706,7 +719,7 @@
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`()
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ connection slave;
+ set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
+ connection master;
+@@ -801,19 +814,25 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values ( NAME_CONST('b',8))
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ START TRANSACTION
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values (unix_timestamp())
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ START TRANSACTION
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ delete from t1
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
+ select * from mysqltest1.t1
+@@ -858,21 +877,27 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t2 values(3)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ START TRANSACTION
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ SET @@session.sql_mode=0/*!*/;
+ insert into t1 values (15)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ START TRANSACTION
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ SET @@session.sql_mode=1411383296/*!*/;
+ insert into t2 values(3)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ SET @@session.sql_mode=0/*!*/;
+ alter procedure foo4 sql security invoker
+@@ -883,20 +908,26 @@
+ SET @@session.sql_mode=1411383296/*!*/;
+ insert into t2 values(3)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ START TRANSACTION
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values (5)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ START TRANSACTION
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ SET @@session.sql_mode=0/*!*/;
+ delete from t2
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ alter table t2 add unique (a)
+ /*!*/;
+@@ -910,6 +941,14 @@
+ insert into t2 values(20),(20);
+ end
+ /*!*/;
++START TRANSACTION
++/*!*/;
++SET TIMESTAMP=t/*!*/;
++insert into t2 values(20),(20)
++/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ drop procedure foo4
+ /*!*/;
+@@ -943,13 +982,17 @@
+ SET TIMESTAMP=t/*!*/;
+ SELECT `mysqltest1`.`fn1`(20)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ START TRANSACTION
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ insert into t2 values(fn1(21))
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ drop function fn1
+ /*!*/;
+@@ -965,13 +1008,17 @@
+ SET TIMESTAMP=t/*!*/;
+ delete from t1
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ START TRANSACTION
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values(fn1())
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ SET @@session.sql_mode=1411383296/*!*/;
+ CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11)
+@@ -993,7 +1040,9 @@
+ SET TIMESTAMP=t/*!*/;
+ delete from t2
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ alter table t2 add unique (a)
+ /*!*/;
+@@ -1010,9 +1059,27 @@
+ START TRANSACTION
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
++SELECT `mysqltest1`.`fn1`(100)
++/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
++START TRANSACTION
++/*!*/;
++SET TIMESTAMP=t/*!*/;
++SELECT `mysqltest1`.`fn1`(20)
++/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
++START TRANSACTION
++/*!*/;
++SET TIMESTAMP=t/*!*/;
+ delete from t1
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
+ /*!*/;
+@@ -1021,13 +1088,17 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values (1)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ START TRANSACTION
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ delete from t1
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ drop trigger trg
+ /*!*/;
+@@ -1036,7 +1107,9 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values (1)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+ READS SQL DATA
+@@ -1081,7 +1154,9 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 (a) values (f1())
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ drop view v1
+ /*!*/;
+@@ -1106,7 +1181,9 @@
+ SET TIMESTAMP=t/*!*/;
+ INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ DROP PROCEDURE p1
+ /*!*/;
+@@ -1158,7 +1235,9 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t values ( 1 )
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ begin
+@@ -1172,7 +1251,9 @@
+ SET TIMESTAMP=t/*!*/;
+ SELECT `mysqltest2`.`f1`()
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ drop database mysqltest
+ /*!*/;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp.result b/mysql-test/suite/engines/funcs/r/rpl_sp.result
index 873ee6b03c5..0e5929bcbd7 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_sp.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_sp.result
@@ -1,14 +1,13 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+set local sql_mode='';
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
create table t1 (a varchar(100));
+connection slave;
use mysqltest1;
+connection master;
create procedure foo()
begin
declare b int;
@@ -17,7 +16,7 @@ insert into t1 values (b);
insert into t1 values (unix_timestamp());
end|
select * from mysql.proc where name='foo' and db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin
declare b int;
set b = 8;
@@ -28,9 +27,10 @@ declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
-end
+end NONE
+connection slave;
select * from mysql.proc where name='foo' and db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin
declare b int;
set b = 8;
@@ -41,17 +41,20 @@ declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
-end
+end NONE
+connection master;
set timestamp=1000000000;
call foo();
select * from t1;
a
8
1000000000
+connection slave;
select * from t1;
a
8
1000000000
+connection master;
delete from t1;
create procedure foo2()
select * from mysqltest1.t1;
@@ -70,6 +73,8 @@ grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
SELECT 1;
1
1
+connect con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,;
+connection con1;
create procedure foo4()
deterministic
begin
@@ -78,6 +83,7 @@ insert into t1 values (5);
end|
call foo4();
Got one of the listed errors
+connection master;
call foo3();
show warnings;
Level Code Message
@@ -96,6 +102,7 @@ a
3
3
3
+connection slave;
select * from t1;
a
15
@@ -105,20 +112,41 @@ a
3
3
3
+connection master;
+delete from t2;
+alter table t2 add unique (a);
+drop procedure foo4;
+create procedure foo4()
+deterministic
+begin
+insert into t2 values(20),(20);
+end|
+call foo4();
+ERROR 23000: Duplicate entry '20' for key 'a'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry '20' for key 'a'
+Note 4094 At line 4 in mysqltest1.foo4
+select * from t2;
+a
+connection slave;
+select * from t2;
+a
select * from mysql.proc where name="foo4" and db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
-mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES INVOKER begin
-insert into t2 values(3);
-insert into t1 values (5);
-end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
-insert into t2 values(3);
-insert into t1 values (5);
-end
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
+mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin
+insert into t2 values(20),(20);
+end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
+insert into t2 values(20),(20);
+end NONE
+connection master;
drop procedure foo4;
select * from mysql.proc where name="foo4" and db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
+connection slave;
select * from mysql.proc where name="foo4" and db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
+connection master;
drop procedure foo;
drop procedure foo2;
drop procedure foo3;
@@ -143,18 +171,24 @@ fn1(20)
insert into t2 values(fn1(21));
select * from t1;
a
+15
20
21
+5
select * from t2;
a
23
+connection slave;
select * from t1;
a
+15
20
21
+5
select * from t2;
a
23
+connection master;
drop function fn1;
create function fn1()
returns int
@@ -167,6 +201,7 @@ ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA
delete from t1;
set timestamp=1000000000;
insert into t1 values(fn1());
+connection con1;
create function fn2()
returns int
no sql
@@ -174,15 +209,21 @@ begin
return unix_timestamp();
end|
ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
+connection master;
+set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=1;
+connection slave;
+set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_function_creators=1;
+connection con1;
create function fn2()
returns int
no sql
begin
return unix_timestamp();
end|
+connection master;
create function fn3()
returns int
not deterministic
@@ -194,79 +235,115 @@ select fn3();
fn3()
0
select * from mysql.proc where db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
-end
+end NONE
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
-end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
+end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
-end
+end NONE
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
return 0;
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return 0;
-end
+end NONE
select * from t1;
a
1000000000
+connection slave;
use mysqltest1;
select * from t1;
a
1000000000
select * from mysql.proc where db='mysqltest1';
-db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 aggregate
mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
-end
+end NONE
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
-end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
+end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
-end
+end NONE
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
return 0;
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return 0;
-end
+end NONE
+connection master;
+delete from t2;
+alter table t2 add unique (a);
+Warnings:
+Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release
+drop function fn1;
+create function fn1(x int)
+returns int
+begin
+insert into t2 values(x),(x);
+return 10;
+end|
+do fn1(100);
+Warnings:
+Error 1062 Duplicate entry '100' for key 'a'
+Note 4094 At line 3 in mysqltest1.fn1
+select fn1(20);
+ERROR 23000: Duplicate entry '20' for key 'a'
+select * from t2;
+a
+connection slave;
+select * from t2;
+a
+connection con1;
create trigger trg before insert on t1 for each row set new.a= 10;
ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table 't1'
+connection master;
delete from t1;
create trigger trg before insert on t1 for each row set new.a= 10;
insert into t1 values (1);
select * from t1;
a
10
+connection slave;
select * from t1;
a
10
+connection master;
delete from t1;
drop trigger trg;
insert into t1 values (1);
select * from t1;
a
1
+connection slave;
select * from t1;
a
1
+connection master;
create procedure foo()
not deterministic
reads sql data
select * from t1;
+connection slave;
call foo();
a
1
+connection master;
drop procedure foo;
+connection slave;
+connection master;
drop function fn1;
drop database mysqltest1;
drop user "zedjzlcsjhd"@127.0.0.1;
use test;
+connection slave;
use test;
+connection master;
drop function if exists f1;
create function f1() returns int reads sql data
begin
@@ -285,9 +362,12 @@ a
1
drop view v1;
drop function f1;
+connection slave;
+connection slave;
select * from t1;
a
1
+connection master;
DROP PROCEDURE IF EXISTS p1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(col VARCHAR(10));
@@ -297,21 +377,23 @@ CALL p1('test');
SELECT * FROM t1;
col
test
+connection slave;
SELECT * FROM t1;
col
test
+connection master;
DROP PROCEDURE p1;
---> Test for BUG#20438
---> Preparing environment...
----> connection: master
+connection master;
DROP PROCEDURE IF EXISTS p1;
DROP FUNCTION IF EXISTS f1;
---> Synchronizing slave with master...
-
----> connection: master
+connection slave;
+connection master;
---> Creating procedure...
/*!50003 CREATE PROCEDURE p1() SET @a = 1 */;
@@ -328,7 +410,7 @@ f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 0 latin1 latin1_swedish_ci latin1_swedish_ci
---> Synchronizing slave with master...
----> connection: master
+connection slave;
---> Checking on slave...
SHOW CREATE PROCEDURE p1;
@@ -339,17 +421,17 @@ SHOW CREATE FUNCTION f1;
Function sql_mode Create Function character_set_client collation_connection Database Collation
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 0 latin1 latin1_swedish_ci latin1_swedish_ci
-
----> connection: master
+connection master;
---> Cleaning up...
DROP PROCEDURE p1;
DROP FUNCTION f1;
+connection slave;
+connection master;
+connection master;
drop table t1;
-set global log_bin_trust_function_creators=0;
-set global log_bin_trust_function_creators=0;
-End of 5.0 tests
-reset master;
+connection slave;
+connection master;
drop database if exists mysqltest;
drop database if exists mysqltest2;
create database mysqltest;
@@ -360,6 +442,871 @@ create procedure mysqltest.test() begin end;
insert into t values ( 1 );
create procedure `\\`.test() begin end;
ERROR 42000: Unknown database '\\'
+connection master;
+create function f1 () returns int
+begin
+insert into t values (1);
+return 0;
+end|
+connection slave;
+connection master;
+use mysqltest;
+set @a:= mysqltest2.f1();
+connection slave;
+connection master;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # drop database if exists mysqltest1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # create database mysqltest1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a varchar(100))
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+begin
+declare b int;
+set b = 8;
+insert into t1 values (b);
+insert into t1 values (unix_timestamp());
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (unix_timestamp())
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
+select * from mysqltest1.t1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo2 contains sql
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; create table t2 like t1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`()
+ DETERMINISTIC
+insert into t1 values (15)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`()
+ DETERMINISTIC
+begin
+insert into t2 values(3);
+insert into t1 values (5);
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (15)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo4 sql security invoker
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (5)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`()
+ DETERMINISTIC
+begin
+insert into t2 values(20),(20);
+end
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo2
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo3
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11)
+ DETERMINISTIC
+begin
+insert into t1 values (x);
+return x+2;
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete t1,t2 from t1,t2
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(fn1(21))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop function fn1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`() RETURNS int(11)
+ NO SQL
+begin
+return unix_timestamp();
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(fn1())
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11)
+ NO SQL
+begin
+return unix_timestamp();
+end
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11)
+ READS SQL DATA
+begin
+return 0;
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop function fn1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11)
+begin
+insert into t2 values(x),(x);
+return 10;
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop trigger trg
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+ READS SQL DATA
+select * from t1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop function fn1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # drop database mysqltest1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # drop user "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; drop function if exists f1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ READS SQL DATA
+begin
+declare var integer;
+declare c cursor for select a from v1;
+open c;
+fetch c into var;
+close c;
+return var;
+end
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1 (a int)
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; insert into t1 (a) values (f1())
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; drop view v1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; drop function f1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS p1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1(col VARCHAR(10))
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
+INSERT INTO t1 VALUES(arg)
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS p1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS f1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @a = 1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 0
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP FUNCTION f1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # drop database if exists mysqltest
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # drop database if exists mysqltest2
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # create database mysqltest
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # create database mysqltest2
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest2`; create table t ( t integer )
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`()
+begin end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest2`; insert into t values ( 1 )
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+begin
+insert into t values (1);
+return 0;
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`()
+master-bin.000001 # Xid # # COMMIT /* XID */
+connection slave;
+set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
+connection master;
+set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
drop database mysqltest;
drop database mysqltest2;
-End of 5.1 tests
+connection slave;
+connection master;
+use test;
+/*!50001 create procedure `mysqltestbug36570_p1`() */
+begin
+select 1;
+end|
+use mysql|
+create procedure test.` mysqltestbug36570_p2`(/*!50001 a int*/)`label`:
+begin
+select a;
+end|
+/*!50001 create function test.mysqltestbug36570_f1() */
+returns int
+/*!50001 deterministic */
+begin
+return 3;
+end|
+use test|
+show procedure status like '%mysqltestbug36570%';
+Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
+test mysqltestbug36570_p2 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+test mysqltestbug36570_p1 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+show create procedure ` mysqltestbug36570_p2`;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+ mysqltestbug36570_p2 CREATE DEFINER=`root`@`localhost` PROCEDURE ` mysqltestbug36570_p2`( a int)
+`label`:
+begin
+select a;
+end latin1 latin1_swedish_ci latin1_swedish_ci
+connection slave;
+connection slave;
+show procedure status like '%mysqltestbug36570%';
+Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
+test mysqltestbug36570_p2 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+test mysqltestbug36570_p1 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+show create procedure ` mysqltestbug36570_p2`;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+ mysqltestbug36570_p2 CREATE DEFINER=`root`@`localhost` PROCEDURE ` mysqltestbug36570_p2`( a int)
+`label`:
+begin
+select a;
+end latin1 latin1_swedish_ci latin1_swedish_ci
+call ` mysqltestbug36570_p2`(42);
+a
+42
+show function status like '%mysqltestbug36570%';
+Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
+test mysqltestbug36570_f1 FUNCTION root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+connection master;
+flush logs;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+drop database if exists mysqltest1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create database mysqltest1
+/*!*/;
+use `mysqltest1`/*!*/;
+SET TIMESTAMP=t/*!*/;
+create table t1 (a varchar(100))
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+begin
+declare b int;
+set b = 8;
+insert into t1 values (b);
+insert into t1 values (unix_timestamp());
+end
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values ( NAME_CONST('b',8))
+/*!*/;
+COMMIT/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values (unix_timestamp())
+/*!*/;
+COMMIT/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete from t1
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
+select * from mysqltest1.t1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+alter procedure foo2 contains sql
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP TABLE `t1` /* generated by server */
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create table t1 (a int)
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create table t2 like t1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`()
+ DETERMINISTIC
+insert into t1 values (15)
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`()
+ DETERMINISTIC
+begin
+insert into t2 values(3);
+insert into t1 values (5);
+end
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t2 values(3)
+/*!*/;
+COMMIT/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
+insert into t1 values (15)
+/*!*/;
+COMMIT/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+insert into t2 values(3)
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
+alter procedure foo4 sql security invoker
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+insert into t2 values(3)
+/*!*/;
+COMMIT/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values (5)
+/*!*/;
+COMMIT/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
+delete from t2
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+alter table t2 add unique (a)
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo4
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`()
+ DETERMINISTIC
+begin
+insert into t2 values(20),(20);
+end
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo4
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo2
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo3
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11)
+ DETERMINISTIC
+begin
+insert into t1 values (x);
+return x+2;
+end
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete t1,t2 from t1,t2
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+COMMIT
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SELECT `mysqltest1`.`fn1`(20)
+/*!*/;
+COMMIT/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t2 values(fn1(21))
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop function fn1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`() RETURNS int(11)
+ NO SQL
+begin
+return unix_timestamp();
+end
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete from t1
+/*!*/;
+COMMIT/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values(fn1())
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11)
+ NO SQL
+begin
+return unix_timestamp();
+end
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11)
+ READS SQL DATA
+begin
+return 0;
+end
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete from t2
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+alter table t2 add unique (a)
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop function fn1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11)
+begin
+insert into t2 values(x),(x);
+return 10;
+end
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete from t1
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values (1)
+/*!*/;
+COMMIT/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete from t1
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop trigger trg
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values (1)
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+ READS SQL DATA
+select * from t1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop function fn1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop database mysqltest1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop user "zedjzlcsjhd"@127.0.0.1
+/*!*/;
+use `test`/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop function if exists f1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ READS SQL DATA
+begin
+declare var integer;
+declare c cursor for select a from v1;
+open c;
+fetch c into var;
+close c;
+return var;
+end
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create table t1 (a int)
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 (a) values (f1())
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop view v1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop function f1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP PROCEDURE IF EXISTS p1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP TABLE IF EXISTS `t1` /* generated by server */
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE TABLE t1(col VARCHAR(10))
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
+INSERT INTO t1 VALUES(arg)
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP PROCEDURE p1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP PROCEDURE IF EXISTS p1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP FUNCTION IF EXISTS f1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @a = 1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 0
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP PROCEDURE p1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP FUNCTION f1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP TABLE `t1` /* generated by server */
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop database if exists mysqltest
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop database if exists mysqltest2
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create database mysqltest
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create database mysqltest2
+/*!*/;
+use `mysqltest2`/*!*/;
+SET TIMESTAMP=t/*!*/;
+create table t ( t integer )
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`()
+begin end
+/*!*/;
+START TRANSACTION
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t values ( 1 )
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+begin
+insert into t values (1);
+return 0;
+end
+/*!*/;
+START TRANSACTION
+/*!*/;
+use `mysqltest`/*!*/;
+SET TIMESTAMP=t/*!*/;
+SELECT `mysqltest2`.`f1`()
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop database mysqltest
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop database mysqltest2
+/*!*/;
+use `test`/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltestbug36570_p1`()
+begin
+select 1;
+end
+/*!*/;
+use `mysql`/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `test`.` mysqltestbug36570_p2`( a int)
+`label`:
+begin
+select a;
+end
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `test`.`mysqltestbug36570_f1`() RETURNS int(11)
+ DETERMINISTIC
+begin
+return 3;
+end
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+use test;
+drop procedure mysqltestbug36570_p1;
+drop procedure ` mysqltestbug36570_p2`;
+drop function mysqltestbug36570_f1;
+End of 5.0 tests
+# End of 5.1 tests
+#
+# Test Bug#30977 Concurrent statement using stored
+# function and DROP FUNCTION breaks SBR.
+#
+# Demonstrate that stored function DDL can not go through,
+# or, worse yet, make its way into the binary log, while
+# the stored function is in use.
+# For that, try to insert a result of a stored function
+# into a table. Block the insert in the beginning, waiting
+# on a table lock. While insert is blocked, attempt to
+# drop the routine. Verify that this attempt
+# blocks and waits for INSERT to complete. Commit and
+# reap the chain of events. Master and slave must contain
+# identical data. Statements in the binrary log must be
+# consistent with data in the table.
+#
+connection default;
+drop table if exists t1, t2;
+drop function if exists t1;
+create table t1 (a int);
+create table t2 (a int) as select 1 as a;
+create function f1() returns int deterministic return (select max(a) from t2);
+lock table t2 write;
+connection master;
+# Sending 'insert into t1 (a) values (f1())'...
+insert into t1 (a) values (f1());
+connection master1;
+# Waitng for 'insert into t1 ...' to get blocked on table lock...
+# Sending 'drop function f1'. It will wait till insert finishes.
+drop function f1;;
+connection default;
+# Check that 'drop function f1' gets blocked.
+# Now let's let 'insert' go through...
+unlock tables;
+connection master;
+# Reaping 'insert into t1 (a) values (f1())'...
+connection master1;
+# Reaping 'drop function f1'
+connection master;
+select * from t1;
+a
+1
+connection slave;
+connection slave;
+select * from t1;
+a
+1
+connection master;
+drop table t1, t2;
+drop function f1;
+ERROR 42000: FUNCTION test.f1 does not exist
+#
+# Bug #11918 Can't use a declared variable in LIMIT clause
+#
+include/rpl_reset.inc
+create table t1 (c1 int);
+insert into t1 (c1) values
+(1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+create procedure p1(p1 integer)
+delete from t1 limit p1;
+set @save_binlog_format=@@session.binlog_format;
+set @@session.binlog_format=STATEMENT;
+call p1(NULL);
+call p1(0);
+call p1(1);
+call p1(2);
+call p1(3);
+select * from t1;
+c1
+7
+8
+9
+10
+connection slave;
+connection slave;
+select * from t1;
+c1
+7
+8
+9
+10
+connection master;
+call p1(-1);
+select * from t1;
+c1
+connection slave;
+connection slave;
+select * from t1;
+c1
+connection master;
+# Cleanup
+set @@session.binlog_format=@save_binlog_format;
+drop table t1;
+drop procedure p1;
+# End of 5.5 tests.
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp004.result b/mysql-test/suite/engines/funcs/r/rpl_sp004.result
index 1c0ed3cc50a..72f0428ce0f 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_sp004.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_sp004.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t2;
@@ -38,6 +35,7 @@ a
2
3
8
+connection slave;
SELECT * FROM test.t1 ORDER BY a;
a
1
@@ -50,15 +48,18 @@ a
2
3
8
+connection master;
CALL test.p2();
USE test;
SHOW TABLES;
Tables_in_test
t3
+connection slave;
USE test;
SHOW TABLES;
Tables_in_test
t3
+connection master;
CALL test.p1();
Warnings:
Note 1050 Table 't3' already exists
@@ -74,6 +75,7 @@ a
2
3
8
+connection slave;
SELECT * FROM test.t1 ORDER BY a;
a
1
@@ -86,8 +88,11 @@ a
2
3
8
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result b/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result
index 97cc0a78a23..d6890f22b02 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result
@@ -1,9 +1,7 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
drop procedure if exists p1;
drop procedure if exists p2;
drop function if exists f1;
@@ -20,6 +18,8 @@ set spv=spv+1;
end while;
end//
call p1();
+connection slave;
+connection slave;
SELECT * FROM t1 ORDER BY a;
a
1
@@ -27,6 +27,7 @@ a
3
4
5
+connection master;
SELECT * FROM t1 ORDER BY a;
a
1
@@ -43,9 +44,12 @@ call p2();
SELECT * FROM t2 ORDER BY a;
a
4
+connection slave;
+connection slave;
SELECT * FROM t2 ORDER BY a;
a
4
+connection master;
drop procedure p1;
drop procedure p2;
drop table t2;
@@ -104,6 +108,8 @@ master: 7
master: 8
master: 10
master: 11
+connection slave;
+connection slave;
SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
slave: 1
@@ -120,6 +126,7 @@ slave: 7
slave: 8
slave: 10
slave: 11
+connection master;
drop procedure p1;
delete from t1;
delete from t2;
@@ -134,10 +141,13 @@ SELECT 'master:',a FROM t1 ORDER BY a;
master: a
master: 1
master: 2
+connection slave;
+connection slave;
SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
slave: 1
slave: 2
+connection master;
drop view v1;
delete from t1;
prepare s1 from 'select f1(?)';
@@ -148,9 +158,12 @@ f1(?)
SELECT 'master:',a FROM t1 ORDER BY a;
master: a
master: 123
+connection slave;
+connection slave;
SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
slave: 123
+connection master;
delete from t1;
create procedure p1(spv int)
begin
@@ -169,12 +182,15 @@ master: 6
master: 6
master: 15
master: 15
+connection slave;
+connection slave;
SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
slave: 6
slave: 6
slave: 15
slave: 15
+connection master;
drop procedure p1;
drop function f1;
drop table t1,t2;
@@ -220,6 +236,8 @@ master 100
master 101
master 101
master 102
+connection slave;
+connection slave;
SELECT 'slave', a FROM t1 ORDER BY a;
slave a
slave 10
@@ -231,7 +249,73 @@ slave 100
slave 101
slave 101
slave 102
+connection master;
drop table t1;
drop function f1;
drop function f2;
drop procedure p1;
+connection slave;
+connection master;
+create table t2 (b BIT(7));
+create procedure sp_bug26199(bitvalue BIT(7))
+begin
+insert into t2 set b = bitvalue;
+end //
+create function sf_bug26199(b BIT(7)) returns int
+begin
+insert into t2 values(b);
+return 0;
+end//
+call sp_bug26199(b'1110');
+call sp_bug26199('\0');
+select sf_bug26199(b'1111111');
+sf_bug26199(b'1111111')
+0
+SET STATEMENT sql_mode = '' FOR
+select sf_bug26199(b'101111111');
+sf_bug26199(b'101111111')
+0
+Warnings:
+Warning 1264 Out of range value for column 'b' at row 1
+select sf_bug26199('\'');
+sf_bug26199('\'')
+0
+select hex(b) from t2;
+hex(b)
+E
+0
+7F
+7F
+27
+connection slave;
+select hex(b) from t2;
+hex(b)
+E
+0
+7F
+7F
+27
+connection master;
+drop table t2;
+drop procedure sp_bug26199;
+drop function sf_bug26199;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
+connection slave;
+set names utf8;
+CREATE FUNCTION f() RETURNS timestamp DETERMINISTIC
+BEGIN RETURN '2012-12-21 12:12:12'; END |
+CREATE PROCEDURE p(t timestamp)
+BEGIN
+SET @t = t;
+PREPARE stmt FROM "
+ UPDATE t1 SET a = @t WHERE '2012-12-31 08:00:00' < f() ";
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+END |
+create table t1 (a timestamp);
+call p('2012-12-31 08:00:00');
+drop table t1;
+drop procedure p;
+drop function f;
+end of the tests
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result b/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result
index 1fcb586d1fb..48c5e548fd2 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result
@@ -1,12 +1,17 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
+connection master;
create table t1(n int);
-start slave;
-stop slave io_thread;
+connection slave;
+include/start_slave.inc
+include/stop_slave_io.inc
start slave io_thread;
+include/wait_for_slave_io_to_start.inc
+connection master;
+connection slave;
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result b/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
index 547dd8e1541..41d18d7f9fe 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
@@ -1,20 +1,19 @@
+include/master-slave.inc
+[connection master]
+connection slave;
stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
+connection master;
#
# Generate a big enough master's binlog to cause relay log rotations
#
create table t1 (a int);
drop table t1;
+connection slave;
reset slave;
#
# Test 1
#
-set @my_max_binlog_size= @@global.max_binlog_size;
+set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size;
set global max_binlog_size=8192;
set global max_relay_log_size=8192-1;
Warnings:
@@ -23,7 +22,7 @@ select @@global.max_relay_log_size;
@@global.max_relay_log_size
4096
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 2
#
@@ -33,17 +32,19 @@ set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size;
@@global.max_relay_log_size 20480
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 3: max_relay_log_size = 0
#
stop slave;
reset slave;
set global max_relay_log_size=0;
+Warnings:
+Warning 1292 Truncated incorrect max_relay_log_size value: '0'
select @@global.max_relay_log_size;
-@@global.max_relay_log_size 0
+@@global.max_relay_log_size 4096
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
@@ -56,19 +57,27 @@ flush logs;
reset slave;
start slave;
flush logs;
+connection master;
create table t1 (a int);
-Checking that both slave threads are running.
+connection slave;
+include/check_slave_is_running.inc
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs;
+connection master;
drop table t1;
-Checking that both slave threads are running.
+connection slave;
+include/check_slave_is_running.inc
+connection master;
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB>
+connection slave;
set global max_binlog_size= @my_max_binlog_size;
+set global max_relay_log_size= @my_max_relay_log_size;
#
# End of 4.1 tests
#
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result b/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result
index ea34b308ec2..0d99235e45c 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result
@@ -1,20 +1,20 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1(n int auto_increment primary key, s char(10));
+connection slave;
insert into t1 values (2,'old');
+connection master;
insert into t1 values(NULL,'new');
insert into t1 values(NULL,'new');
+connection slave;
select * from t1 order by n;
n s
1 new
2 old
delete from t1 where n = 2;
-start slave;
-stop slave;
+include/start_slave.inc
+include/stop_slave.inc
+connection master;
create table t2(n int);
drop table t2;
insert into t1 values(NULL,'new');
@@ -22,10 +22,14 @@ set sql_log_bin=0;
insert into t1 values(NULL,'new');
set sql_log_bin=1;
delete from t1 where n=4;
-start slave;
+connection slave;
+include/start_slave.inc
select * from t1 order by n;
n s
1 new
2 new
3 new
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result b/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result
index 5a253d61fcb..2505660f863 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result
@@ -1,52 +1,71 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
create database mysqltest;
+connection master;
drop database if exists mysqltest;
Warnings:
Note 1008 Can't drop database 'mysqltest'; database doesn't exist
+connection slave;
show tables from mysqltest;
ERROR 42000: Unknown database 'mysqltest'
+connection slave;
create table t1 (a int);
+connection master;
drop table if exists t1;
Warnings:
-Note 1051 Unknown table 't1'
+Note 1051 Unknown table 'test.t1'
+connection slave;
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
+connection master;
create table t1 (a int, b int);
+connection slave;
insert into t1 values(1,1);
+connection master;
delete from t1;
+connection slave;
select * from t1;
a b
insert into t1 values(1,1);
+connection master;
insert into t1 values(2,1);
update t1 set a=2;
+connection slave;
select * from t1;
a b
2 1
2 1
+connection master;
create table t2 (a int, b int);
delete from t1;
insert into t1 values(1,1);
insert into t2 values(1,1);
+connection slave;
update t1 set a=2;
+connection master;
UPDATE t1, t2 SET t1.a = t2.a;
+connection slave;
select * from t1;
a b
1 1
select * from t2;
a b
1 1
+connection master;
delete from t1;
delete from t2;
+connection slave;
insert into t1 values(1,1);
insert into t2 values(1,1);
+connection master;
DELETE t1.*, t2.* from t1, t2;
+connection slave;
select * from t1;
a b
select * from t2;
a b
+connection master;
drop table t1, t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result b/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
index c6c2c525098..1ba2d1b624b 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
@@ -1,41 +1,58 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-Master_User root
-Master_Host 127.0.0.1
+include/master-slave.inc
+[connection master]
+connection slave;
+Master_User = 'root'
+Master_Host = '127.0.0.1'
include/stop_slave.inc
change master to master_user='test';
-Master_User test
-Master_Host 127.0.0.1
+Master_User = 'test'
+Master_Host = '127.0.0.1'
reset slave;
-Master_User test
-Master_Host 127.0.0.1
+Master_User = 'test'
+Master_Host = '127.0.0.1'
change master to master_user='root';
include/start_slave.inc
-Master_User root
-Master_Host 127.0.0.1
+Master_User = 'root'
+Master_Host = '127.0.0.1'
include/stop_slave.inc
reset slave;
include/start_slave.inc
+connection master;
create temporary table t1 (a int);
+connection slave;
include/stop_slave.inc
reset slave;
include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
+connection master;
+drop temporary table if exists t1;
+connection slave;
include/stop_slave.inc
reset slave;
+include/check_slave_no_error.inc
change master to master_user='impossible_user_name';
start slave;
-stop slave;
+include/wait_for_slave_io_error.inc [errno=1045]
+include/stop_slave_sql.inc
change master to master_user='root';
include/start_slave.inc
+include/check_slave_no_error.inc
stop slave;
change master to master_user='impossible_user_name';
start slave;
-stop slave;
+include/wait_for_slave_io_error.inc [errno=1045]
+include/stop_slave_sql.inc
reset slave;
+include/check_slave_no_error.inc
+change master to master_user='root';
+reset slave;
+include/start_slave.inc
+include/stop_slave.inc
+reset slave all;
+start slave;
+ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO
+CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
+include/start_slave.inc
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
index b0d92f3ca3f..936f604be2e 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
@@ -1,15 +1,36 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-set @saved_binlog_format = @@global.binlog_format;
+include/master-slave.inc
+[connection master]
+connection slave;
+connection master;
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
+set @my_binlog_format= @@global.binlog_format;
+set session binlog_format=mixed;
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format MIXED
+set session binlog_format=statement;
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
set session binlog_format=row;
-set global binlog_format=row;
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format ROW
+set global binlog_format=DEFAULT;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format MIXED
+set global binlog_format=MIXED;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format MIXED
+set global binlog_format=STATEMENT;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
+set global binlog_format=ROW;
show global variables like "binlog_format%";
Variable_name Value
binlog_format ROW
@@ -68,11 +89,11 @@ execute stmt1 using @string;
deallocate prepare stmt1;
insert into t1 values("for_10_");
insert into t1 select "yesterday_11_";
-set binlog_format=default;
+set binlog_format=statement;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
STATEMENT STATEMENT
-set global binlog_format=default;
+set global binlog_format=statement;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
STATEMENT STATEMENT
@@ -87,11 +108,11 @@ execute stmt1 using @string;
deallocate prepare stmt1;
insert into t1 values("for_15_");
insert into t1 select "yesterday_16_";
-set binlog_format=mixed;
+set global binlog_format=mixed;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
-STATEMENT MIXED
-set global binlog_format=mixed;
+MIXED STATEMENT
+set binlog_format=default;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
MIXED MIXED
@@ -112,11 +133,15 @@ execute stmt1 using @string;
deallocate prepare stmt1;
insert into t1 values(concat("for_23_",UUID()));
insert into t1 select "yesterday_24_";
-create table t2 select rpad(UUID(),100,' ');
+create table t2 ENGINE=MyISAM select rpad(UUID(),100,' ');
create table t3 select 1 union select UUID();
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
-insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '3'
+insert ignore into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
create procedure foo()
begin
insert into t1 values("work_25_");
@@ -228,6 +253,14 @@ begin
set NEW.data = concat(NEW.data,UUID());
end|
insert into t11 values("try_560_");
+insert delayed into t2 values("delay_1_");
+insert delayed into t2 values(concat("delay_2_",UUID()));
+insert delayed into t2 values("delay_6_");
+insert delayed into t2 values(rand());
+set @a=2.345;
+insert delayed into t2 values(@a);
+connection slave;
+connection master;
create table t20 select * from t1;
create table t21 select * from t2;
create table t22 select * from t3;
@@ -244,14 +277,18 @@ end|
select f("try_41_");
f("try_41_")
1
+connection slave;
use mysqltest1;
insert into t2 values(2,null),(3,null),(4,null);
delete from t2 where a>=2;
+connection master;
select f("try_42_");
f("try_42_")
1
+connection slave;
insert into t2 values(3,null),(4,null);
delete from t2 where a>=3;
+connection master;
prepare stmt1 from 'select f(?)';
set @string="try_43_";
insert into t1 values(null,"try_44_");
@@ -259,6 +296,8 @@ execute stmt1 using @string;
f(?)
1
deallocate prepare stmt1;
+connection slave;
+connection master;
create table t12 select * from t1;
drop table t1;
create table t1 (a int, b varchar(100), key(a));
@@ -284,12 +323,16 @@ end|
select f1("try_46_"),f2("try_47_");
f1("try_46_") f2("try_47_")
1 1
+connection slave;
insert into t2 values(2,null),(3,null),(4,null);
delete from t2 where a>=2;
+connection master;
select f1("try_48_"),f2("try_49_");
f1("try_48_") f2("try_49_")
1 1
insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
+connection slave;
+connection master;
drop function f2;
create function f2 (x varchar(100)) returns int deterministic
begin
@@ -301,6 +344,8 @@ end|
select f1("try_53_"),f2("try_54_");
f1("try_53_") f2("try_54_")
1 3
+connection slave;
+connection master;
drop function f2;
create trigger t1_bi before insert on t1 for each row
begin
@@ -309,12 +354,16 @@ end|
insert into t1 values(null,"try_56_");
alter table t1 modify a int, drop primary key;
insert into t1 values(null,"try_57_");
+connection slave;
+connection master;
CREATE TEMPORARY TABLE t15 SELECT UUID();
create table t16 like t15;
INSERT INTO t16 SELECT * FROM t15;
insert into t16 values("try_65_");
drop table t15;
insert into t16 values("try_66_");
+connection slave;
+connection master;
select count(*) from t1;
count(*)
7
@@ -338,7 +387,7 @@ count(*)
66
select count(*) from t21;
count(*)
-14
+19
select count(*) from t22;
count(*)
2
@@ -354,6 +403,8 @@ count(*)
select count(*) from t16;
count(*)
3
+connection slave;
+connection master;
DROP TABLE IF EXISTS t11;
SET SESSION BINLOG_FORMAT=STATEMENT;
CREATE TABLE t11 (song VARCHAR(255));
@@ -366,17 +417,44 @@ UNLOCK TABLES;
SELECT * FROM t11;
song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
song Careful With That Axe, Eugene
+connection slave;
USE mysqltest1;
SELECT * FROM t11;
song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
song Careful With That Axe, Eugene
+connection master;
DROP TABLE IF EXISTS t12;
SET SESSION BINLOG_FORMAT=MIXED;
CREATE TABLE t12 (data LONG);
LOCK TABLES t12 WRITE;
INSERT INTO t12 VALUES(UUID());
UNLOCK TABLES;
-show binlog events;
-show binlog events;
+connection slave;
+connection master;
+CREATE FUNCTION my_user()
+RETURNS CHAR(64)
+BEGIN
+DECLARE user CHAR(64);
+SELECT USER() INTO user;
+RETURN user;
+END $$
+CREATE FUNCTION my_current_user()
+RETURNS CHAR(64)
+BEGIN
+DECLARE user CHAR(64);
+SELECT CURRENT_USER() INTO user;
+RETURN user;
+END $$
+DROP TABLE IF EXISTS t13;
+CREATE TABLE t13 (data CHAR(64));
+INSERT INTO t13 VALUES (USER());
+INSERT INTO t13 VALUES (my_user());
+INSERT INTO t13 VALUES (CURRENT_USER());
+INSERT INTO t13 VALUES (my_current_user());
+connection slave;
+connection master;
drop database mysqltest1;
-set global binlog_format= @saved_binlog_format;
+connection slave;
+connection master;
+set global binlog_format =@my_binlog_format;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_temp_table.result b/mysql-test/suite/engines/funcs/r/rpl_temp_table.result
index e4ca31d8908..ff3e52f77b5 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_temp_table.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_temp_table.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t2 (n int, PRIMARY KEY(n));
create temporary table t1 (n int);
create temporary table t3 (n int not null);
@@ -15,10 +11,16 @@ insert into t3 values (1010);
insert into t2 select * from t3;
drop table if exists t3;
insert into t2 values (1012);
+connection master1;
create temporary table t1 (n int);
insert into t1 values (4),(5);
insert into t2 select * from t1;
+disconnect master;
+connection slave;
+connection master1;
insert into t2 values(61);
+disconnect master1;
+connection slave;
select * from t2;
n
1
@@ -43,6 +45,19 @@ sum(n)
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
+*** MDEV-8016: Replication aborts on DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ***
+connect master2,localhost,root,,;
+INSERT INTO t2 VALUES (2000), (2001);
+CREATE FUNCTION f() RETURNS INTEGER RETURN 1;
+CREATE TEMPORARY TABLE t3 AS SELECT f() AS col FROM t2;
+disconnect master2;
+connection default;
+connection slave;
+connect master2,localhost,root,,;
+connection master2;
drop table if exists t1,t2;
Warnings:
-Note 1051 Unknown table 't1'
+Note 1051 Unknown table 'test.t1'
+drop function f;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_temporary.result b/mysql-test/suite/engines/funcs/r/rpl_temporary.result
index 27def773a30..e2999cdd225 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_temporary.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_temporary.result
@@ -1,11 +1,43 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+SET sql_log_bin = 0;
+SET sql_log_bin = 1;
+include/master-slave.inc
+[connection master]
+connection slave;
reset master;
-CREATE USER ''@localhost;
+connection master;
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE t1 (a char(1));
+INSERT INTO t1 VALUES ('a');
+connection slave;
+include/stop_slave.inc
+include/start_slave.inc
+connection master;
+INSERT INTO t1 VALUES ('b');
+connection slave;
+connection master;
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE `t1`(`a` tinyint,`b` char(1))engine=myisam;
+INSERT IGNORE INTO `t1` set `a`=128,`b`='128';
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+connection slave;
+include/stop_slave.inc
+include/start_slave.inc
+connection master;
+INSERT IGNORE INTO `t1` set `a`=128,`b`='128';
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+connection slave;
+connection master;
+DROP TABLE t1;
+connection slave;
+connection master;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connect con3,localhost,zedjzlcsjhd,,;
+connection con3;
SET @save_select_limit=@@session.sql_select_limit;
SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
@@ -17,20 +49,33 @@ ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) fo
SELECT @@session.sql_select_limit = @save_select_limit;
@@session.sql_select_limit = @save_select_limit
1
+connection con2;
+SET @save_conn_id= connection_id();
SET @@session.pseudo_thread_id=100;
SET @@session.pseudo_thread_id=connection_id();
+SET @@session.pseudo_thread_id=@save_conn_id;
SET @@session.sql_log_bin=0;
SET @@session.sql_log_bin=1;
+connection con3;
drop table if exists t1,t2;
create table t1(f int);
create table t2(f int);
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+connection con1;
create temporary table t3(f int);
insert into t3 select * from t1 where f<6;
+connection con2;
create temporary table t3(f int);
+connection con1;
insert into t2 select count(*) from t3;
+connection con2;
insert into t3 select * from t1 where f>=4;
+connection con1;
drop temporary table t3;
+connection con2;
insert into t2 select count(*) from t3;
drop temporary table t3;
select * from t2 ORDER BY f;
@@ -75,15 +120,22 @@ f
7
drop table t1,t2;
create temporary table t3 (f int);
+connection slave;
+connection master;
create temporary table t4 (f int);
create table t5 (f int);
-select id from information_schema.processlist where command='Binlog Dump' into @id;
-kill @id;
+connection slave;
+stop slave;
+connection master;
insert into t5 select * from t4;
+connection slave;
+start slave;
select * from t5 /* must be 1 after reconnection */;
f
+connection master;
drop temporary table t4;
drop table t5;
+connection con1;
set @@session.pseudo_thread_id=100;
create temporary table t101 (id int);
create temporary table t102 (id int);
@@ -95,14 +147,99 @@ set @@session.pseudo_thread_id=300;
create temporary table t301 (id int);
create temporary table t302 (id int);
create temporary table `#sql_not_user_table303` (id int);
-DROP USER ''@localhost;
+disconnect con1;
+connection master;
create table t1(f int);
insert into t1 values (1);
+connection slave;
select * from t1 /* must be 1 */;
f
1
+connection master;
drop table t1;
+connection slave;
select * from t1;
a
1
+connection master;
drop table t1;
+connection slave;
+include/stop_slave.inc
+connection master;
+include/rpl_reset.inc
+-- Bug#43748
+-- make a user on the slave that can list but not kill system threads.
+connection slave;
+FLUSH PRIVILEGES;
+GRANT USAGE ON *.* TO user43748@127.0.0.1 IDENTIFIED BY 'meow';
+GRANT PROCESS ON *.* TO user43748@127.0.0.1;
+-- try to KILL system-thread as that non-privileged user (on slave).
+connect cont43748,127.0.0.1,user43748,meow,test,$SLAVE_MYPORT,;
+connection cont43748;
+SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1;
+KILL @id;
+Got one of the listed errors
+disconnect cont43748;
+-- throw out test-user on slave.
+connection slave;
+DROP USER user43748@127.0.0.1;
+#
+# MDEV-10216: Assertion `strcmp(share->unique_file_name,filename) ||
+# share->last_version' failed in myisam/mi_open.c:67: test_if_reopen
+#
+connection master;
+CREATE TEMPORARY TABLE t1(i INT PRIMARY KEY) ENGINE=MYISAM;
+INSERT INTO t1 VALUES(1);
+SELECT COUNT(*)=1 FROM t1;
+COUNT(*)=1
+1
+ALTER TABLE t1 RENAME t2;
+SELECT COUNT(*)=1 FROM t2;
+COUNT(*)=1
+1
+ALTER TABLE t2 RENAME t1;
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1 RENAME t2;
+SELECT COUNT(*)=1 FROM t2;
+COUNT(*)=1
+1
+ALTER TABLE t2 RENAME t1;
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+UNLOCK TABLES;
+LOCK TABLES t1 READ;
+ALTER TABLE t1 RENAME t2;
+SELECT COUNT(*)=1 FROM t2;
+COUNT(*)=1
+1
+ALTER TABLE t2 RENAME t1;
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+UNLOCK TABLES;
+FLUSH TABLES WITH READ LOCK;
+ALTER TABLE t1 RENAME t2;
+SELECT COUNT(*)=1 FROM t2;
+COUNT(*)=1
+1
+ALTER TABLE t2 RENAME t1;
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+UNLOCK TABLES;
+ALTER TABLE t1 RENAME t2, LOCK SHARED;
+ALTER TABLE t2 RENAME t1, LOCK EXCLUSIVE;
+DROP TABLE t1;
+#
+# MDEV-10320: NO-OP ALTER TABLE on temporary tables getting logged
+# under row binlog format
+#
+connection master;
+CREATE TEMPORARY TABLE t1(i INT PRIMARY KEY) ENGINE=MYISAM;
+ALTER TABLE t1;
+ALTER TABLE t1 ADD COLUMN IF NOT EXISTS I INT;
+Warnings:
+Note 1060 Duplicate column name 'I'
+DROP TABLE t1;
+End of 5.1 tests
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_trigger.result b/mysql-test/suite/engines/funcs/r/rpl_trigger.result
index 7c7cda1f581..b5b88670fc6 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_trigger.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_trigger.result
@@ -1,12 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP TABLE IF EXISTS t3;
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
create table t1 (a int auto_increment, primary key (a), b int, rand_value double not null);
create table t2 (a int auto_increment, primary key (a), b int);
create table t3 (a int auto_increment, primary key (a), name varchar(64) not null, old_a int, old_b int, rand_value double not null);
@@ -22,8 +16,10 @@ insert into t3 values(100,"log",0,0,0);
SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186;
insert into t1 values(1,1,rand()),(NULL,2,rand());
insert into t2 (b) values(last_insert_id());
-insert into t2 values(3,0),(NULL,0);
-insert into t2 values(NULL,0),(500,0);
+insert into t2 values(3,0);
+insert into t2 values(NULL,0);
+insert into t2 values(NULL,0);
+insert into t2 values(500,0);
select a,b, truncate(rand_value,4) from t1;
a b truncate(rand_value,4)
1 1 0.4320
@@ -39,14 +35,13 @@ select a,name, old_a, old_b, truncate(rand_value,4) from t3;
a name old_a old_b truncate(rand_value,4)
100 log 0 0 0.0000
101 t1 1 1 0.3203
-102 t1 0 2 0.5666
+102 t1 NULL 2 0.5666
103 t2 1 2 0.9164
104 t2 3 0 0.8826
105 t2 4 0 0.6635
106 t2 5 0 0.6699
107 t2 500 0 0.3593
-
---- On slave --
+connection slave;
select a,b, truncate(rand_value,4) from t1;
a b truncate(rand_value,4)
1 1 0.4320
@@ -62,16 +57,20 @@ select a,name, old_a, old_b, truncate(rand_value,4) from t3;
a name old_a old_b truncate(rand_value,4)
100 log 0 0 0.0000
101 t1 1 1 0.3203
-102 t1 0 2 0.5666
+102 t1 NULL 2 0.5666
103 t2 1 2 0.9164
104 t2 3 0 0.8826
105 t2 4 0 0.6635
106 t2 5 0 0.6699
107 t2 500 0 0.3593
+connection master;
drop table t1,t2,t3;
+connect con2,localhost,root,,;
+connection con2;
select get_lock("bug12480",2);
get_lock("bug12480",2)
1
+connection default;
create table t1 (a datetime,b datetime, c datetime);
drop function if exists bug12480;
create function bug12480() returns datetime
@@ -91,40 +90,33 @@ select a=b && a=c from t1;
a=b && a=c
1
SELECT routine_name, definer
-FROM information_schema.routines;
+FROM information_schema.routines
+WHERE routine_name = 'bug12480';
routine_name definer
-add_suppression root@localhost
-check_testcase root@localhost
-check_warnings root@localhost
-force_restart root@localhost
bug12480 root@localhost
SELECT trigger_name, definer
-FROM information_schema.triggers;
+FROM information_schema.triggers
+WHERE trigger_name = 't1_first';
trigger_name definer
-gs_insert root@localhost
-ts_insert root@localhost
t1_first root@localhost
-
---- On slave --
+connection slave;
SELECT routine_name, definer
-FROM information_schema.routines;
+FROM information_schema.routines
+WHERE routine_name = 'bug12480';
routine_name definer
-add_suppression root@localhost
-check_testcase root@localhost
-check_warnings root@localhost
-force_restart root@localhost
bug12480 root@localhost
SELECT trigger_name, definer
-FROM information_schema.triggers;
+FROM information_schema.triggers
+WHERE trigger_name = 't1_first';
trigger_name definer
-gs_insert root@localhost
-ts_insert root@localhost
t1_first root@localhost
select a=b && a=c from t1;
a=b && a=c
1
test
1
+connection master;
+disconnect con2;
truncate table t1;
drop trigger t1_first;
insert into t1 values ("2003-03-03","2003-03-03","2003-03-03"),(bug12480(),bug12480(),bug12480()),(now(),now(),now());
@@ -144,6 +136,8 @@ end|
create database other;
use other;
insert into test.t1 values (1);
+connection slave;
+connection master;
use test;
drop table t1,t2;
drop database other;
@@ -151,14 +145,18 @@ test case for BUG#13227
-------------------
10
-------------------
+connection master;
drop table if exists t110;
+connection slave;
drop table if exists t210,t310;
+connection master;
create table t110 (f1 int) /* 2 replicate */;
insert into t110 values (-5);
insert into t110 values (-4);
insert into t110 values (-3);
insert into t110 values (-2);
insert into t110 values (-1);
+connection slave;
select * from t110;
f1
-5
@@ -198,11 +196,13 @@ f1
SELECT * from t310 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t110 SET f1=5 where f1=-5;
UPDATE t110 SET f1=4 where f1=-4;
UPDATE t110 SET f1=3 where f1=-3;
UPDATE t110 SET f1=2 where f1=-2;
UPDATE t110 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t110 /* must be f1 5 ... 1 */;
f1
5
@@ -219,18 +219,25 @@ f3
100
drop trigger trg110;
drop table t210,t310;
+connection master;
drop table t110;
+connection slave;
+connection master;
-------------------
9
-------------------
+connection master;
drop table if exists t19;
+connection slave;
drop table if exists t29,t39;
+connection master;
create table t19 (f1 int) /* 2 replicate */;
insert into t19 values (-5);
insert into t19 values (-4);
insert into t19 values (-3);
insert into t19 values (-2);
insert into t19 values (-1);
+connection slave;
select * from t19;
f1
-5
@@ -270,11 +277,13 @@ f1
SELECT * from t39 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t19 SET f1=5 where f1=-5;
UPDATE t19 SET f1=4 where f1=-4;
UPDATE t19 SET f1=3 where f1=-3;
UPDATE t19 SET f1=2 where f1=-2;
UPDATE t19 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t19 /* must be f1 5 ... 1 */;
f1
5
@@ -291,18 +300,25 @@ f3
100
drop trigger trg19;
drop table t29,t39;
+connection master;
drop table t19;
+connection slave;
+connection master;
-------------------
8
-------------------
+connection master;
drop table if exists t18;
+connection slave;
drop table if exists t28,t38;
+connection master;
create table t18 (f1 int) /* 2 replicate */;
insert into t18 values (-5);
insert into t18 values (-4);
insert into t18 values (-3);
insert into t18 values (-2);
insert into t18 values (-1);
+connection slave;
select * from t18;
f1
-5
@@ -342,11 +358,13 @@ f1
SELECT * from t38 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t18 SET f1=5 where f1=-5;
UPDATE t18 SET f1=4 where f1=-4;
UPDATE t18 SET f1=3 where f1=-3;
UPDATE t18 SET f1=2 where f1=-2;
UPDATE t18 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t18 /* must be f1 5 ... 1 */;
f1
5
@@ -363,18 +381,25 @@ f3
100
drop trigger trg18;
drop table t28,t38;
+connection master;
drop table t18;
+connection slave;
+connection master;
-------------------
7
-------------------
+connection master;
drop table if exists t17;
+connection slave;
drop table if exists t27,t37;
+connection master;
create table t17 (f1 int) /* 2 replicate */;
insert into t17 values (-5);
insert into t17 values (-4);
insert into t17 values (-3);
insert into t17 values (-2);
insert into t17 values (-1);
+connection slave;
select * from t17;
f1
-5
@@ -414,11 +439,13 @@ f1
SELECT * from t37 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t17 SET f1=5 where f1=-5;
UPDATE t17 SET f1=4 where f1=-4;
UPDATE t17 SET f1=3 where f1=-3;
UPDATE t17 SET f1=2 where f1=-2;
UPDATE t17 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t17 /* must be f1 5 ... 1 */;
f1
5
@@ -435,18 +462,25 @@ f3
100
drop trigger trg17;
drop table t27,t37;
+connection master;
drop table t17;
+connection slave;
+connection master;
-------------------
6
-------------------
+connection master;
drop table if exists t16;
+connection slave;
drop table if exists t26,t36;
+connection master;
create table t16 (f1 int) /* 2 replicate */;
insert into t16 values (-5);
insert into t16 values (-4);
insert into t16 values (-3);
insert into t16 values (-2);
insert into t16 values (-1);
+connection slave;
select * from t16;
f1
-5
@@ -486,11 +520,13 @@ f1
SELECT * from t36 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t16 SET f1=5 where f1=-5;
UPDATE t16 SET f1=4 where f1=-4;
UPDATE t16 SET f1=3 where f1=-3;
UPDATE t16 SET f1=2 where f1=-2;
UPDATE t16 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t16 /* must be f1 5 ... 1 */;
f1
5
@@ -507,18 +543,25 @@ f3
100
drop trigger trg16;
drop table t26,t36;
+connection master;
drop table t16;
+connection slave;
+connection master;
-------------------
5
-------------------
+connection master;
drop table if exists t15;
+connection slave;
drop table if exists t25,t35;
+connection master;
create table t15 (f1 int) /* 2 replicate */;
insert into t15 values (-5);
insert into t15 values (-4);
insert into t15 values (-3);
insert into t15 values (-2);
insert into t15 values (-1);
+connection slave;
select * from t15;
f1
-5
@@ -558,11 +601,13 @@ f1
SELECT * from t35 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t15 SET f1=5 where f1=-5;
UPDATE t15 SET f1=4 where f1=-4;
UPDATE t15 SET f1=3 where f1=-3;
UPDATE t15 SET f1=2 where f1=-2;
UPDATE t15 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t15 /* must be f1 5 ... 1 */;
f1
5
@@ -579,18 +624,25 @@ f3
100
drop trigger trg15;
drop table t25,t35;
+connection master;
drop table t15;
+connection slave;
+connection master;
-------------------
4
-------------------
+connection master;
drop table if exists t14;
+connection slave;
drop table if exists t24,t34;
+connection master;
create table t14 (f1 int) /* 2 replicate */;
insert into t14 values (-5);
insert into t14 values (-4);
insert into t14 values (-3);
insert into t14 values (-2);
insert into t14 values (-1);
+connection slave;
select * from t14;
f1
-5
@@ -630,11 +682,13 @@ f1
SELECT * from t34 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t14 SET f1=5 where f1=-5;
UPDATE t14 SET f1=4 where f1=-4;
UPDATE t14 SET f1=3 where f1=-3;
UPDATE t14 SET f1=2 where f1=-2;
UPDATE t14 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t14 /* must be f1 5 ... 1 */;
f1
5
@@ -651,18 +705,25 @@ f3
100
drop trigger trg14;
drop table t24,t34;
+connection master;
drop table t14;
+connection slave;
+connection master;
-------------------
3
-------------------
+connection master;
drop table if exists t13;
+connection slave;
drop table if exists t23,t33;
+connection master;
create table t13 (f1 int) /* 2 replicate */;
insert into t13 values (-5);
insert into t13 values (-4);
insert into t13 values (-3);
insert into t13 values (-2);
insert into t13 values (-1);
+connection slave;
select * from t13;
f1
-5
@@ -702,11 +763,13 @@ f1
SELECT * from t33 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t13 SET f1=5 where f1=-5;
UPDATE t13 SET f1=4 where f1=-4;
UPDATE t13 SET f1=3 where f1=-3;
UPDATE t13 SET f1=2 where f1=-2;
UPDATE t13 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t13 /* must be f1 5 ... 1 */;
f1
5
@@ -723,18 +786,25 @@ f3
100
drop trigger trg13;
drop table t23,t33;
+connection master;
drop table t13;
+connection slave;
+connection master;
-------------------
2
-------------------
+connection master;
drop table if exists t12;
+connection slave;
drop table if exists t22,t32;
+connection master;
create table t12 (f1 int) /* 2 replicate */;
insert into t12 values (-5);
insert into t12 values (-4);
insert into t12 values (-3);
insert into t12 values (-2);
insert into t12 values (-1);
+connection slave;
select * from t12;
f1
-5
@@ -774,11 +844,13 @@ f1
SELECT * from t32 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t12 SET f1=5 where f1=-5;
UPDATE t12 SET f1=4 where f1=-4;
UPDATE t12 SET f1=3 where f1=-3;
UPDATE t12 SET f1=2 where f1=-2;
UPDATE t12 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t12 /* must be f1 5 ... 1 */;
f1
5
@@ -795,18 +867,25 @@ f3
100
drop trigger trg12;
drop table t22,t32;
+connection master;
drop table t12;
+connection slave;
+connection master;
-------------------
1
-------------------
+connection master;
drop table if exists t11;
+connection slave;
drop table if exists t21,t31;
+connection master;
create table t11 (f1 int) /* 2 replicate */;
insert into t11 values (-5);
insert into t11 values (-4);
insert into t11 values (-3);
insert into t11 values (-2);
insert into t11 values (-1);
+connection slave;
select * from t11;
f1
-5
@@ -846,11 +925,13 @@ f1
SELECT * from t31 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t11 SET f1=5 where f1=-5;
UPDATE t11 SET f1=4 where f1=-4;
UPDATE t11 SET f1=3 where f1=-3;
UPDATE t11 SET f1=2 where f1=-2;
UPDATE t11 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t11 /* must be f1 5 ... 1 */;
f1
5
@@ -867,11 +948,20 @@ f3
100
drop trigger trg11;
drop table t21,t31;
+connection master;
drop table t11;
-STOP SLAVE;
+connection slave;
+connection master;
+connection slave;
+include/stop_slave.inc
+connection master;
FLUSH LOGS;
+include/rpl_stop_server.inc [server_number=1]
+include/rpl_start_server.inc [server_number=1]
+--> Master binlog: Server ver: 5.0.16-debug-log, Binlog ver: 4
+connection slave;
RESET SLAVE;
-START SLAVE;
+include/start_slave.inc
SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0;
MASTER_POS_WAIT('master-bin.000001', 513) >= 0
1
@@ -881,7 +971,7 @@ t1
t2
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-trg1 INSERT t1 INSERT INTO t2 VALUES(CURRENT_USER()) AFTER NULL latin1 latin1_swedish_ci latin1_swedish_ci
+trg1 INSERT t1 INSERT INTO t2 VALUES(CURRENT_USER()) AFTER # latin1 latin1_swedish_ci latin1_swedish_ci
SELECT * FROM t1;
c
1
@@ -900,25 +990,28 @@ root@localhost
DROP TRIGGER trg1;
DROP TABLE t1;
DROP TABLE t2;
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
+connection master;
SHOW TABLES LIKE 't_';
Tables_in_test (t_)
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
RESET MASTER;
-START SLAVE;
+connection slave;
+include/start_slave.inc
---> Test for BUG#20438
---> Preparing environment...
----> connection: master
+connection master;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
---> Synchronizing slave with master...
+connection slave;
----> connection: master
+connection master;
---> Creating objects...
CREATE TABLE t1(c INT);
@@ -939,7 +1032,7 @@ c
10
---> Synchronizing slave with master...
----> connection: master
+connection slave;
---> Checking on slave...
SELECT * FROM t1;
@@ -949,11 +1042,14 @@ SELECT * FROM t2;
c
10
----> connection: master
+connection master;
---> Cleaning up...
DROP TABLE t1;
DROP TABLE t2;
+connection slave;
+connection master;
+connection master;
drop table if exists t1;
create table t1(a int, b varchar(50));
drop trigger not_a_trigger;
@@ -975,11 +1071,15 @@ a b
1 In trigger t1_bi
2 b
3 c
+connection slave;
select * from t1;
a b
1 In trigger t1_bi
2 b
3 c
+connection master;
drop table if exists t1,t11;
Warnings:
-Note 1051 Unknown table 't11'
+Note 1051 Unknown table 'test.t11'
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result b/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result
index 44624a38875..35cd91d795b 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result
@@ -1,22 +1,26 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create temporary table t1 (n int);
insert into t1 values(1);
+connection slave;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
+connection master;
delete from t1;
+connection slave;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
+connection master;
truncate t1;
+connection slave;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
+disconnect master;
+connection slave;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_user_variables.result b/mysql-test/suite/engines/funcs/r/rpl_user_variables.result
index ed0d2782394..0efdbff5522 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_user_variables.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_user_variables.result
@@ -1,10 +1,8 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
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;
@@ -23,6 +21,7 @@ set @a:=5;
insert into t1 values (@a),(@a);
select * from t1 where n = '<nonexistant>';
n
+connection master1;
insert into t1 values (@a),(@a),(@a*5);
SELECT * FROM t1 ORDER BY n;
n
@@ -51,6 +50,7 @@ abcn1
abcn1n2
abc\def
This is a test
+connection slave;
SELECT * FROM t1 ORDER BY n;
n
NULL
@@ -78,6 +78,235 @@ abcn1
abcn1n2
abc\def
This is a test
+connection master;
insert into t1 select * FROM (select @var1 union select @var2) AS t2;
drop table t1;
-stop slave;
+End of 4.1 tests.
+DROP TABLE IF EXISTS t20;
+DROP TABLE IF EXISTS t21;
+DROP PROCEDURE IF EXISTS test.insert;
+CREATE TABLE t20 (a VARCHAR(20));
+CREATE TABLE t21 (a VARCHAR(20));
+CREATE PROCEDURE test.insert()
+BEGIN
+IF (@VAR)
+THEN
+INSERT INTO test.t20 VALUES ('SP_TRUE');
+ELSE
+INSERT INTO test.t20 VALUES ('SP_FALSE');
+END IF;
+END|
+CREATE TRIGGER test.insert_bi BEFORE INSERT
+ON test.t20 FOR EACH ROW
+BEGIN
+IF (@VAR)
+THEN
+INSERT INTO test.t21 VALUES ('TRIG_TRUE');
+ELSE
+INSERT INTO test.t21 VALUES ('TRIG_FALSE');
+END IF;
+END|
+connection slave;
+connection master;
+SET @VAR=0;
+CALL test.insert();
+SET @VAR=1;
+CALL test.insert();
+Check the tables for correct data
+SELECT * FROM t20;
+a
+SP_FALSE
+SP_TRUE
+SELECT * FROM t21;
+a
+TRIG_FALSE
+TRIG_TRUE
+connection slave;
+Check the tables for correct data and it matches master
+SELECT * FROM t20;
+a
+SP_FALSE
+SP_TRUE
+SELECT * FROM t21;
+a
+TRIG_FALSE
+TRIG_TRUE
+connection master;
+DROP TABLE t20;
+DROP TABLE t21;
+DROP PROCEDURE test.insert;
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS test.square;
+CREATE TABLE t1 (i INT);
+CREATE FUNCTION test.square() RETURNS INTEGER DETERMINISTIC RETURN
+(@var * @var);
+SET @var = 1;
+INSERT INTO t1 VALUES (square());
+SET @var = 2;
+INSERT INTO t1 VALUES (square());
+SET @var = 3;
+INSERT INTO t1 VALUES (square());
+SET @var = 4;
+INSERT INTO t1 VALUES (square());
+SET @var = 5;
+INSERT INTO t1 VALUES (square());
+Retrieve the values from the table
+SELECT * FROM t1;
+i
+1
+4
+9
+16
+25
+connection slave;
+Retrieve the values from the table and verify they are the same as on master
+SELECT * FROM t1;
+i
+1
+4
+9
+16
+25
+connection master;
+DROP TABLE t1;
+DROP FUNCTION test.square;
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+CREATE TABLE t1(a int);
+CREATE FUNCTION f1() returns int deterministic BEGIN
+return @a;
+END |
+CREATE FUNCTION f2() returns int deterministic BEGIN
+IF (@b > 0) then
+SET @c = (@a + @b);
+else
+SET @c = (@a - 1);
+END if;
+return @c;
+END |
+connection slave;
+connection master;
+SET @a=500;
+INSERT INTO t1 values(f1());
+SET @b = 125;
+SET @c = 1;
+INSERT INTO t1 values(f2());
+Retrieve the values from the table
+connection slave;
+connection master;
+SELECT * from t1;
+a
+500
+625
+connection slave;
+Check the tables for correct data and it matches master
+SELECT * from t1;
+a
+500
+625
+connection master;
+DROP TABLE t1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (i int);
+CREATE TABLE t2 (k int);
+CREATE trigger t1_bi before INSERT on t1 for each row BEGIN
+INSERT INTO t2 values (@a);
+SET @a:=42;
+INSERT INTO t2 values (@a);
+END |
+connection slave;
+connection master;
+SET @a:=100;
+INSERT INTO t1 values (5);
+Check to see that data was inserted correctly in both tables
+SELECT * from t1;
+i
+5
+SELECT * from t2;
+k
+100
+42
+connection slave;
+Check the tables for correct data and it matches master
+SELECT * from t1;
+i
+5
+SELECT * from t2;
+k
+100
+42
+connection master;
+drop table t1, t2;
+connection master;
+create table t1(a int, b int);
+prepare s1 from 'insert into t1 values (@x:=@x+1, ?)';
+set @x=1;
+execute s1 using @x;
+select * from t1;
+a b
+2 1
+connection slave;
+connection slave;
+select * from t1;
+a b
+2 1
+connection master;
+drop table t1;
+connection master;
+create table t1(a int);
+insert into t1 values (1),(2);
+prepare s1 from 'insert into t1 select a from t1 limit ?';
+set @x='1.1';
+execute s1 using @x;
+select * from t1;
+a
+1
+2
+1
+connection slave;
+connection slave;
+select * from t1;
+a
+1
+2
+1
+connection master;
+drop table t1;
+End of 5.0 tests.
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+CREATE TABLE t1 (i INT);
+CREATE FUNCTION f1() RETURNS INT RETURN @a;
+CREATE
+FUNCTION f2() RETURNS INT BEGIN
+INSERT INTO t1 VALUES (10 + @a);
+RETURN 0;
+END|
+connection slave;
+connection master;
+SET @a:=123;
+SELECT f1(), f2();
+f1() f2()
+123 0
+Check to see that data was inserted correctly
+INSERT INTO t1 VALUES(f1());
+SELECT * FROM t1;
+i
+133
+123
+connection slave;
+Check the table for correct data and it matches master
+SELECT * FROM t1;
+i
+133
+123
+connection master;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP TABLE t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_variables.result b/mysql-test/suite/engines/funcs/r/rpl_variables.result
index 6a9af27179e..547c324fdf8 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_variables.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_variables.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
set @my_slave_net_timeout =@@global.slave_net_timeout;
set @my_sql_slave_skip_counter =@@global.sql_slave_skip_counter;
set global slave_net_timeout=100;
@@ -19,3 +15,4 @@ Variable_name Value
slave_skip_errors 3,100,137,643,1752
set global slave_net_timeout=@my_slave_net_timeout;
set global sql_slave_skip_counter=@my_sql_slave_skip_counter;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_view.result b/mysql-test/suite/engines/funcs/r/rpl_view.result
index 00d9bfbf380..68a149720b0 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_view.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_view.result
@@ -1,12 +1,10 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
drop table if exists t1,v1;
drop view if exists t1,v1;
+connection slave;
reset master;
+connection master;
create table t1 (a int);
insert into t1 values (1);
create view v1 as select a from t1;
@@ -15,45 +13,57 @@ select * from v1 order by a;
a
1
2
+connection slave;
select * from v1 order by a;
a
1
2
+connection master;
update v1 set a=3 where a=1;
select * from v1 order by a;
a
2
3
+connection slave;
select * from v1 order by a;
a
2
3
+connection master;
delete from v1 where a=2;
select * from v1 order by a;
a
3
+connection slave;
select * from v1 order by a;
a
3
+connection master;
alter view v1 as select a as b from t1;
+connection slave;
select * from v1 order by 1;
b
3
+connection master;
drop view v1;
+connection slave;
select * from v1 order by a;
ERROR 42S02: Table 'test.v1' doesn't exist
+connection master;
drop table t1;
+connection slave;
---> Test for BUG#20438
---> Preparing environment...
----> connection: master
+connection master;
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
---> Synchronizing slave with master...
+connection slave;
----> connection: master
+connection master;
---> Creating objects...
CREATE TABLE t1(c INT);
@@ -68,21 +78,22 @@ c
1
---> Synchronizing slave with master...
----> connection: master
-
----> Checking on slave...
+connection slave;
SELECT * FROM t1;
c
1
-
----> connection: master
+connection master;
---> Cleaning up...
DROP VIEW v1;
DROP TABLE t1;
+connection slave;
+connection master;
+connection master;
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
+connection slave;
explain v1;
Field Type Null Key Default Extra
a int(11) YES NULL
@@ -93,6 +104,35 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
select * from v1;
a b
1 6
+connection master;
drop table t1;
drop view v1;
+connection slave;
+connection master;
+CREATE TABLE t1(a INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v1 AS SELECT * FROM t1;
+ERROR 42S01: Table 'v1' already exists
+DROP VIEW v1;
+DROP TABLE t1;
+connection slave;
+connection master;
+CREATE TABLE t1 (a INT);
+# create view as output from mysqldump 10.11 (5.0.62)
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) */
+/*!50002 WITH CASCADED CHECK OPTION */;
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3 WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci
+connection slave;
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3 WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci
+connection master;
+DROP VIEW v1;
+DROP TABLE t1;
+connection slave;
End of 5.0 tests
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl000010-slave.opt b/mysql-test/suite/engines/funcs/t/rpl000010-slave.opt
deleted file mode 100644
index 0dbfb311e33..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl000010-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---disconnect-slave-event-count=2
diff --git a/mysql-test/suite/engines/funcs/t/rpl000010.test b/mysql-test/suite/engines/funcs/t/rpl000010.test
deleted file mode 100644
index 261b9148774..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl000010.test
+++ /dev/null
@@ -1,19 +0,0 @@
-# This tests the offset off by 22 mystery bug
-# Must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1
-
-source include/master-slave.inc;
-
-create table t1 (n int not null auto_increment primary key);
-insert into t1 values(NULL);
-insert into t1 values(2);
-save_master_pos;
-connection slave;
-sync_with_master;
-select n from t1;
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl000011.test b/mysql-test/suite/engines/funcs/t/rpl000011.test
deleted file mode 100644
index 32f6227f7c5..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl000011.test
+++ /dev/null
@@ -1,17 +0,0 @@
-source include/master-slave.inc;
-
-create table t1 (n int);
-insert into t1 values(1);
-sync_slave_with_master;
-stop slave;
-start slave;
-connection master;
-insert into t1 values(2);
-#let slave catch up
-sync_slave_with_master;
-select * from t1;
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl000013.test b/mysql-test/suite/engines/funcs/t/rpl000013.test
deleted file mode 100644
index 2c727107563..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl000013.test
+++ /dev/null
@@ -1,61 +0,0 @@
-# This test is to verify that DROP TEMPORARY TABLE
-# is automatically binlogged and sent to slave
-# when a temp table is dropped by disconnection
-# of a master's conection.
-# So it does not apply to row-based, where we neither need
-# nor do this automatic binlogging. And if we run this test
-# in row-based, it hangs waiting for an offset which is never
-# reached (the "sync_with_master 1"), logically.
-
---source include/have_binlog_format_mixed_or_statement.inc
-source include/master-slave.inc;
-save_master_pos;
-connection slave;
-sync_with_master;
-connection master;
-
---disable_query_log
-CALL mtr.add_suppression(" Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-create table t2(n int);
-create temporary table t1 (n int);
-insert into t1 values(1),(2),(3);
---disable_warnings
-insert into t2 select * from t1;
---enable_warnings
-connection master1;
-create temporary table t1 (n int);
-insert into t1 values (4),(5);
---disable_warnings
-insert into t2 select * from t1 as t10;
---enable_warnings
-save_master_pos;
-disconnect master;
-connection slave;
-#add 1 to catch drop table
-sync_with_master 1;
-connection master1;
-insert into t2 values(6);
-save_master_pos;
-disconnect master1;
-connection slave;
-# same trick to go one more event
-sync_with_master 1;
-select * from t2;
-show status like 'Slave_open_temp_tables';
-#
-# Clean up
-#
-connect (master2,localhost,root,,);
-connection master2;
-
-# We will get a warning for t1 as this is a temporary table that doesn't
-# exist in this connection.
-
-drop table if exists t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl000017-slave.opt b/mysql-test/suite/engines/funcs/t/rpl000017-slave.opt
deleted file mode 100644
index 58a964c90d0..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl000017-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-slave-start
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000010.test b/mysql-test/suite/engines/funcs/t/rpl_000010.test
new file mode 100644
index 00000000000..155b54572e3
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/t/rpl_000010.test
@@ -0,0 +1,2 @@
+--source suite/rpl/t/rpl_000010.test
+
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000011.test b/mysql-test/suite/engines/funcs/t/rpl_000011.test
new file mode 100644
index 00000000000..f7fc0f4a310
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/t/rpl_000011.test
@@ -0,0 +1,18 @@
+--source include/master-slave.inc
+
+create table t1 (n int);
+insert into t1 values(1);
+--sync_slave_with_master
+--source include/stop_slave.inc
+--source include/start_slave.inc
+connection master;
+insert into t1 values(2);
+#let slave catch up
+--sync_slave_with_master
+select * from t1;
+connection master;
+drop table t1;
+--sync_slave_with_master
+
+# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000013.test b/mysql-test/suite/engines/funcs/t/rpl_000013.test
new file mode 100644
index 00000000000..c2f6c114ad6
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/t/rpl_000013.test
@@ -0,0 +1,2 @@
+--source suite/rpl/t/rpl_000013.test
+
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000015.test b/mysql-test/suite/engines/funcs/t/rpl_000015.test
index 817ed6f407c..8d76fc674e5 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_000015.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_000015.test
@@ -3,13 +3,13 @@
# Change Date: 2006-01-17
# Change: added order by in select
#####################
-source include/master-slave.inc;
+--source include/master-slave.inc
reset master;
show master status;
save_master_pos;
connection slave;
-stop slave;
+--source include/stop_slave.inc
reset slave;
--vertical_results
--replace_result $MASTER_MYPORT MASTER_PORT
@@ -29,7 +29,7 @@ eval change master to master_host='127.0.0.1',master_user='root',
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 5 # 8 # 9 # 23 # 33 #
show slave status;
-start slave;
+--source include/start_slave.inc
sync_with_master;
--vertical_results
--replace_result $MASTER_MYPORT MASTER_PORT
@@ -42,10 +42,11 @@ drop table if exists t1;
--enable_warnings
create table t1 (n int, PRIMARY KEY(n));
insert into t1 values (10),(45),(90);
-sync_slave_with_master;
+--sync_slave_with_master
connection slave;
SELECT * FROM t1 ORDER BY n;
connection master;
SELECT * FROM t1 ORDER BY n;
drop table t1;
-sync_slave_with_master;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000017.test b/mysql-test/suite/engines/funcs/t/rpl_000017.test
new file mode 100644
index 00000000000..f498ce10a58
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/t/rpl_000017.test
@@ -0,0 +1,2 @@
+--source suite/rpl/t/rpl_000017.test
+
diff --git a/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test b/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test
index ae647ed6648..e896d62a0ab 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test
@@ -1,38 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/18/2005 #
-#############################################################################
-# TEST: To test the LOAD DATA INFILE in rbr #
-#############################################################################
-
-# Includes
--- source include/master-slave.inc
-
-# Begin clean up test section
---disable_warnings
-connection master;
-DROP TABLE IF EXISTS test.t1;
---enable_warnings
-
-# Section 1 test
-CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
-LOAD DATA INFILE '../../std_data/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;
-
-
-SELECT * FROM test.t1 ORDER BY a DESC;
-save_master_pos;
-sync_slave_with_master;
-connection slave;
-SELECT * FROM test.t1 ORDER BY a DESC;
-
-# Cleanup
-#show binlog events;
-connection master;
-DROP TABLE test.t1;
-sync_slave_with_master;
-
-# End of 5.0 test case
+--source suite/rpl/t/rpl_LD_INFILE.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test b/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
deleted file mode 100644
index 078d1048794..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Test of automatic redirection of queries to master/slave.
-#
-
-source include/master-slave.inc;
-# We disable this for now as PS doesn't handle redirection
---disable_ps_protocol
-
-#first, make sure the slave has had enough time to register
-save_master_pos;
-connection slave;
-sync_with_master;
-
-#discover slaves
-connection master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-SHOW SLAVE STATUS;
---replace_result $SLAVE_MYPORT SLAVE_PORT
-SHOW SLAVE HOSTS;
-rpl_probe;
-
-#turn on master/slave query direction auto-magic
-enable_rpl_parse;
-create table t1 ( n int);
-insert into t1 values (1),(2),(3),(4);
-disable_rpl_parse;
-save_master_pos;
-connection slave;
-sync_with_master;
-insert into t1 values(5);
-connection master;
-enable_rpl_parse;
-# The first of the queries will be sent to the slave, the second to the master.
-SELECT * FROM t1 ORDER BY n;
-SELECT * FROM t1 ORDER BY n;
-disable_rpl_parse;
-SELECT * FROM t1 ORDER BY n;
-connection slave;
-SELECT * FROM t1 ORDER BY n;
-
-# Cleanup
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_alter.test b/mysql-test/suite/engines/funcs/t/rpl_alter.test
index 576376a0264..12360f5a3e8 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_alter.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_alter.test
@@ -1,24 +1,2 @@
-source include/master-slave.inc;
---disable_warnings
-drop database if exists mysqltest;
---enable_warnings
-create database mysqltest;
+--source suite/rpl/t/rpl_alter.test
-create table mysqltest.t1 ( n int);
-alter table mysqltest.t1 add m int;
-insert into mysqltest.t1 values (1,2);
-create table mysqltest.t2 (n int);
-insert into mysqltest.t2 values (45);
-rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from mysqltest.t2;
-select * from mysqltest.t3;
-connection master;
-drop database mysqltest;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_alter_db.test b/mysql-test/suite/engines/funcs/t/rpl_alter_db.test
index 17ba06ce063..097eaf9071b 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_alter_db.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_alter_db.test
@@ -1,12 +1,2 @@
-source include/master-slave.inc;
-connection master;
-use mysql; # to be different from initial `test' db of mysqltest client
-alter database collate latin1_bin;
-save_master_pos;
+--source suite/rpl/t/rpl_alter_db.test
-connection slave;
-sync_with_master;
-
-# Restoring to the original state
-connection master;
-alter database collate latin1_swedish_ci;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_bit.test b/mysql-test/suite/engines/funcs/t/rpl_bit.test
index 7f85313ae4c..822fae57f68 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_bit.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_bit.test
@@ -1,93 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Sept/15/2005 #
-#############################################################################
-# Test: To test the replication of the bit field #
-#############################################################################
-# Change Author: JBM
-# Change Date: 2006-01-16
-##########
+--source suite/rpl/t/rpl_bit.test
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP TABLE IF EXISTS test.t1;
---enable_warnings
-# End of cleanup
-
-# Begin test section 1
-
-CREATE TABLE test.t1 (
- dummyKey INTEGER NOT NULL,
- f01 TINYINT,
- f10 TINYINT,
- f12 TINYINT,
- f15 TINYINT,
- f16 TINYINT,
- f7 TINYINT,
- f9 TINYINT,
- f29 TINYINT,
- f0 TINYINT,
- fA1 TINYINT,
- C32 TINYINT,
- A42 TINYINT,
- CA3 TINYINT,
- A044 TINYINT,
- f001 TINYINT,
- A3002 TINYINT,
- fC003 TINYINT,
- CA300 TINYINT,
- A305 TINYINT,
- CA321 TINYINT,
- r001 TINYINT,
- bit1 BIT(6),
- bit2 BIT(6),
- bit3 BIT(6),
- State1 TINYINT,
- State2 TINYINT,
- State3 TINYINT,
- State4 TINYINT,
- SubState TINYINT,
- gState TINYINT,
- oSupp TINYINT,
- tSupp TINYINT,
- sSuppD TINYINT,
- mSuppf TINYINT,
- GSuppDf TINYINT,
- VNotSupp TINYINT,
- x034 TINYINT,
-PRIMARY KEY USING HASH (dummyKey) );
-
-LOCK TABLES test.t1 WRITE;
-INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-UNLOCK TABLES;
-
-
-SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
-SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
-SELECT hex(bit2) from test.t1 ORDER BY bit2;
-SELECT hex(bit3) from test.t1 ORDER BY bit3;
-save_master_pos;
-
-connection slave;
-sync_with_master;
-SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
-SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
-SELECT hex(bit2) from test.t1 ORDER BY bit2;
-SELECT hex(bit3) from test.t1 ORDER BY bit3;
-
-connection master;
-DROP TABLE IF EXISTS test.t1;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test b/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test
index 12b587919f9..d2214ada074 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test
@@ -1,116 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Sept/15/2005 #
-#############################################################################
-# Test: To test the replication of the bit field #
-#############################################################################
+--source suite/rpl/t/rpl_bit_npk.test
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP TABLE IF EXISTS test.t1;
---enable_warnings
-# End of cleanup
-
-# Begin test section 1
-
-CREATE TABLE test.t1 (
- dummyKey INTEGER NOT NULL,
- f01 TINYINT,
- f10 TINYINT,
- f12 TINYINT,
- f15 TINYINT,
- f16 TINYINT,
- f7 TINYINT,
- f9 TINYINT,
- f29 TINYINT,
- f0 TINYINT,
- fA1 TINYINT,
- C32 TINYINT,
- A42 TINYINT,
- CA3 TINYINT,
- A044 TINYINT,
- f001 TINYINT,
- A3002 TINYINT,
- fC003 TINYINT,
- CA300 TINYINT,
- A305 TINYINT,
- CA321 TINYINT,
- r001 TINYINT,
- bit1 BIT(6),
- bit2 BIT(6),
- bit3 BIT(6),
- State1 TINYINT,
- State2 TINYINT,
- State3 TINYINT,
- State4 TINYINT,
- SubState TINYINT,
- gState TINYINT,
- oSupp TINYINT,
- tSupp TINYINT,
- sSuppD TINYINT,
- mSuppf TINYINT,
- GSuppDf TINYINT,
- VNotSupp TINYINT,
- x034 TINYINT);
-
-LOCK TABLES test.t1 WRITE;
-INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,NULL,1);
-INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'0',1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-UNLOCK TABLES;
-
-UPDATE test.t1 set x034 = 50 where bit3 = b'000000';
-UPDATE test.t1 set VNotSupp = 33 where bit1 = b'0';
-SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
- FROM test.t1
- ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
-SELECT hex(bit1) from test.t1 ORDER BY bit1;
-SELECT hex(bit2) from test.t1 ORDER BY bit2;
-SELECT hex(bit3) from test.t1 ORDER BY bit3;
-save_master_pos;
-
-connection slave;
-sync_with_master;
-SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
- FROM test.t1
- ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
-SELECT hex(bit1) from test.t1 ORDER BY bit1;
-SELECT hex(bit2) from test.t1 ORDER BY bit2;
-SELECT hex(bit3) from test.t1 ORDER BY bit3;
-
-connection master;
-CREATE TABLE test.t2 (a INT, b BIT(1));
-INSERT INTO test.t2 VALUES (1, b'0');
-INSERT INTO test.t2 VALUES (1, b'1');
-UPDATE test.t2 SET a = 2 WHERE b = b'1';
-
-CREATE TABLE test.t3 (a INT, b INT);
-INSERT INTO test.t3 VALUES (1, NULL);
-INSERT INTO test.t3 VALUES (1, 0);
-UPDATE test.t3 SET a = 2 WHERE b = 0;
-
-SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
-SELECT * FROM test.t3 ORDER BY a,b;
-save_master_pos;
-
-connection slave;
-sync_with_master;
-SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
-SELECT * FROM test.t3 ORDER BY a,b;
-
-connection master;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_change_master.test b/mysql-test/suite/engines/funcs/t/rpl_change_master.test
index c031464c95e..e7e70bd2ac6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_change_master.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_change_master.test
@@ -1,37 +1,2 @@
-# Verify that after CHANGE MASTER, replication (I/O thread and SQL
-# thread) restart from where SQL thread left, not from where
-# I/O thread left (some old bug fixed in 4.0.17)
+--source suite/rpl/t/rpl_change_master.test
-source include/master-slave.inc;
-
-connection master;
-# Make SQL slave thread advance a bit
-create table t1(n int);
-sync_slave_with_master;
-select * from t1;
-# Now stop it and make I/O slave thread be ahead
-stop slave sql_thread;
-connection master;
-insert into t1 values(1);
-insert into t1 values(2);
-save_master_pos;
-connection slave;
---real_sleep 3 # wait for I/O thread to have read updates
-stop slave;
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 23 # 33 #
-show slave status;
-change master to master_user='root';
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 23 # 33 #
-show slave status;
-start slave;
-sync_with_master;
-select * from t1;
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_create_database.test b/mysql-test/suite/engines/funcs/t/rpl_create_database.test
index 70cff8daca2..8690de2a604 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_create_database.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_create_database.test
@@ -1,72 +1,2 @@
-#
-# Tests for replication of statements that manipulate databases.
-#
-# For this test file, we have a number of databases. All databases
-# with "greek" names will be replicated on the slave, while other names
-# (e.g., american) will not be replicated.
-#
+--source suite/rpl/t/rpl_create_database.test
-source include/master-slave.inc;
-
-# Bug#6391 (binlog-do-db rules ignored)
-# In this case, 'mysqltest_bob' should not be replicated to the slave.
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_prometheus;
-DROP DATABASE IF EXISTS mysqltest_sisyfos;
-DROP DATABASE IF EXISTS mysqltest_bob;
-sync_slave_with_master;
-# This database is not replicated
-DROP DATABASE IF EXISTS mysqltest_bob;
---enable_warnings
-
-connection master;
-CREATE DATABASE mysqltest_prometheus;
-CREATE DATABASE mysqltest_sisyfos;
-CREATE DATABASE mysqltest_bob;
-
-USE mysqltest_sisyfos;
-# These should be replicated
-CREATE TABLE t1 (b int);
-INSERT INTO t1 VALUES(1);
-
-USE mysqltest_bob;
-# These should *not* be replicated
-CREATE TABLE t2 (b int);
-INSERT INTO t2 VALUES(2);
-
-# Current database is now 'mysqltest_bob'
-# The following should be replicated
-ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
-
-USE mysqltest_sisyfos;
-# The following should *not* be replicated
-ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
-
-SHOW DATABASES;
-sync_slave_with_master;
-SHOW DATABASES;
-
-connection master;
-DROP DATABASE IF EXISTS mysqltest_sisyfos;
-USE mysqltest_prometheus;
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1);
-CREATE DATABASE mysqltest_sisyfos;
-USE mysqltest_sisyfos;
-CREATE TABLE t2 (a INT);
-let $VERSION=`select version()`;
-SHOW DATABASES;
-sync_slave_with_master;
-SHOW DATABASES;
-USE mysqltest_prometheus;
-SHOW TABLES;
-USE mysqltest_sisyfos;
-SHOW TABLES;
-
-connection master;
-DROP DATABASE IF EXISTS mysqltest_prometheus;
-DROP DATABASE IF EXISTS mysqltest_sisyfos;
-DROP DATABASE IF EXISTS mysqltest_bob;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_do_grant.test b/mysql-test/suite/engines/funcs/t/rpl_do_grant.test
index 4e398114269..95e90ce1bc3 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_do_grant.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_do_grant.test
@@ -1,98 +1,2 @@
-# Works in statement-based and row-based binlogging.
-# Test that GRANT and other user management commands are replicated to the slave
+--source suite/rpl/t/rpl_do_grant.test
--- source include/master-slave.inc
-
-# do not be influenced by other tests.
-connection master;
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
-save_master_pos;
-connection slave;
-sync_with_master;
-# if these DELETE did nothing on the master, we need to do them manually on the
-# slave.
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-
-# test replication of GRANT
-connection master;
-grant select on *.* to rpl_do_grant@localhost;
-grant drop on test.* to rpl_do_grant@localhost;
-save_master_pos;
-connection slave;
-sync_with_master;
-show grants for rpl_do_grant@localhost;
-
-# test replication of SET PASSWORD
-connection master;
-set password for rpl_do_grant@localhost=password("does it work?");
-save_master_pos;
-connection slave;
-sync_with_master;
-select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
-
-# clear what we have done, to not influence other tests.
-connection master;
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
-sync_slave_with_master;
-# The mysql database is not replicated, so we have to do the deletes
-# manually on the slave as well.
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
-
-# End of 4.1 tests
-
-connection master;
---error 1141
-show grants for rpl_do_grant@localhost;
-connection slave;
---error 1141
-show grants for rpl_do_grant@localhost;
-
-connection master;
-create user rpl_do_grant@localhost;
-show grants for rpl_do_grant@localhost;
---error 1141
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
-show grants for rpl_do_grant@localhost;
---error 1141
-show grants for rpl_do_grant2@localhost;
-
-connection master;
-rename user rpl_do_grant@localhost to rpl_do_grant2@localhost;
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
-show grants for rpl_do_grant2@localhost;
-
-connection master;
-grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost;
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
-show grants for rpl_do_grant2@localhost;
-
-connection master;
-revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost;
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
-show grants for rpl_do_grant2@localhost;
-
-connection master;
-revoke all privileges, grant option from rpl_do_grant2@localhost;
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
-show grants for rpl_do_grant2@localhost;
-
-connection master;
-drop user rpl_do_grant2@localhost;
---error 1141
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
---error 1141
-show grants for rpl_do_grant2@localhost;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_drop.test b/mysql-test/suite/engines/funcs/t/rpl_drop.test
index b38007a755f..7dda6987502 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_drop.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_drop.test
@@ -1,16 +1,2 @@
-# Testcase for BUG#4552 (DROP on two tables, one of which does not
-# exist, must be binlogged with a non-zero error code)
-source include/master-slave.inc;
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int);
---error 1051
-drop table t1, t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
-
+--source suite/rpl/t/rpl_drop.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_drop_db.test b/mysql-test/suite/engines/funcs/t/rpl_drop_db.test
index fb26cc20f8a..54d5300be14 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_drop_db.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_drop_db.test
@@ -1,61 +1,2 @@
-# test case for BUG#4680 -- if there are extra files in the db directory
-# dropping the db on the master causes replication problems
+--source suite/rpl/t/rpl_drop_db.test
--- source include/master-slave.inc
-connection master;
-
---disable_warnings
-drop database if exists mysqltest1;
---enable_warnings
-create database mysqltest1;
-create table mysqltest1.t1 (n int);
-insert into mysqltest1.t1 values (1);
-select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt';
-create table mysqltest1.t2 (n int);
-create table mysqltest1.t3 (n int);
---replace_result \\ /
---error 1010
-drop database mysqltest1;
-use mysqltest1;
-show tables;
-
-# test the branch of the code that deals with the query buffer overflow
-
---disable_query_log
-let $1=50;
-while ($1)
-{
- eval create table mysqltest1.mysqltest_long_table_name$1 (n int);
- dec $1;
-}
---enable_query_log
-
---replace_result \\ /
---error 1010
-drop database mysqltest1;
-use mysqltest1;
-show tables;
-use test;
-create table t1 (n int);
-insert into t1 values (1234);
-sync_slave_with_master;
-
-connection slave;
-use mysqltest1;
-show tables;
-use test;
-select * from t1;
-drop table t1;
-
-#cleanup
-connection slave;
-stop slave;
-drop database mysqltest1;
-
-connection master;
-# Remove the "extra" file created above
---remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest1/f1.txt
-drop database mysqltest1;
-
-use test;
-drop table t1;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test b/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test
index 518fa9df885..bf5e84152bc 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test
@@ -6,7 +6,7 @@
# of their server id).
# It also will test BUG#13861.
-source include/master-slave.inc;
+--source include/master-slave.inc
# set up "dual head"
@@ -18,7 +18,7 @@ connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root";
-start slave;
+--source include/start_slave.inc
# now we test it
@@ -68,7 +68,7 @@ sync_with_master;
# show tables;
-# start slave;
+# --source include/start_slave.inc
# BUG#13023 is that Exec_master_log_pos may stay too low "forever":
@@ -78,9 +78,7 @@ create table t4 (n int); # create 3 ignored events
create table t5 (n int);
create table t6 (n int);
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
connection slave;
@@ -97,12 +95,11 @@ show tables;
# cleanup
-stop slave;
+--source include/stop_slave.inc
reset slave;
drop table t1,t4,t5,t6; # add t2 and t3 later
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test b/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test
deleted file mode 100644
index 707d1eca8c2..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test
+++ /dev/null
@@ -1,15 +0,0 @@
-source include/master-slave.inc;
-
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
-
-#
-# Load table should not succeed on the master as this is not a slave
-#
---error 1218
-load table t1 from master;
-connection slave;
---error 1188
-load table t1 from master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test b/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test
index adf1526a657..1459b24799e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test
@@ -1,68 +1,2 @@
-# 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 suite/rpl/t/rpl_err_ignoredtable.test
--- source include/master-slave.inc
-
---disable_query_log
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-connection master;
-create table t1 (a int primary key);
-create table t4 (a int primary key);
-# generate an error that goes to the binlog
---error 1022, 1062, 1582
-insert into t1 values (1),(1);
-insert into t4 values (1),(2);
-save_master_pos;
-connection slave;
-# as the t1 table is ignored on the slave, the slave should be able to sync
-sync_with_master;
-# check that the table has been ignored, because otherwise the test is nonsense
-show tables like 't1';
-show tables like 't4';
-SELECT * FROM test.t4 ORDER BY a;
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# Now test that even critical errors (connection killed)
-# are ignored if rules allow it.
-# The "kill" idea was copied from rpl000001.test.
-
-connection master1;
-select get_lock('crash_lock%20C', 10);
-
-connection master;
-create table t2 (a int primary key);
-insert into t2 values(1);
-create table t3 (id int);
-insert into t3 values(connection_id());
-send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
-
-connection master1;
-real_sleep 2;
-select (@id := id) - id from t3;
-kill @id;
-drop table t2,t3;
-insert into t4 values (3),(4);
-connection master;
---error 0,1053,2013,1317
-reap;
-connection master1;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t4 ORDER BY a;
-
-connection master1;
-DROP TABLE test.t4;
-save_master_pos;
-connection slave;
-sync_with_master;
-# End of 4.1 tests
-# Adding comment for force manual merge 5.0 -> wl1012. delete me if needed
diff --git a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
index 2e481f5e5e7..93207dfddf7 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
@@ -6,31 +6,22 @@
# Start replication master -> slave
#
connection slave;
---disable_warnings
-stop slave;
---enable_warnings
+
+--source include/stop_slave.inc
+
--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
-start slave;
-
+--source include/start_slave.inc
#
# Start replication slave -> master
#
connection master;
---disable_warnings
-stop slave;
---enable_warnings
+
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT;
-start slave;
-
-#
-# Wait for start of slave IO and SQL threads
-#
-let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%';
--- source $MYSQL_TEST_DIR/suite/engines/funcs/t/wait_slave_status.inc
+--source include/start_slave.inc
#
# Flush logs of slave
@@ -45,4 +36,5 @@ sleep 5;
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
SHOW SLAVE STATUS;
-STOP SLAVE;
+stop slave;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_free_items.test b/mysql-test/suite/engines/funcs/t/rpl_free_items.test
index 043e84160b8..31d65396d36 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_free_items.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_free_items.test
@@ -1,22 +1,2 @@
-source include/master-slave.inc;
-create table t1 (a int);
-create table t2 (a int);
-disable_query_log;
-SET @query="INSERT INTO t2 SELECT * FROM t1 WHERE a REGEXP \"0\"";
-let $1 = 2000;
-while ($1)
-{
- eval SET @query=concat(@query, " OR a REGEXP '$1'");
- dec $1;
-}
-let $1=`select @query`;
-eval $1;
-enable_query_log;
-# I have seen the slave crash either now or at shutdown
-sync_slave_with_master;
-connection master;
-drop table t1;
-drop table t2;
-sync_slave_with_master;
+--source suite/rpl/t/rpl_free_items.test
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_get_lock.test b/mysql-test/suite/engines/funcs/t/rpl_get_lock.test
index c57e9313899..a9265c7f864 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_get_lock.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_get_lock.test
@@ -1,49 +1,2 @@
-source include/master-slave.inc;
+--source suite/rpl/t/rpl_get_lock.test
---disable_query_log
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-create table t1(n int);
---disable_warnings
-insert into t1 values(get_lock("lock",2));
---enable_warnings
-dirty_close master;
-connection master1;
-select get_lock("lock",2);
-
-select release_lock("lock");
-#ignore
-disable_query_log;
-let $1=2000;
-while ($1)
-{
- do get_lock("lock",2);
- do release_lock("lock");
- dec $1;
-}
-enable_query_log;
-save_master_pos;
-connection slave;
-sync_with_master;
-select get_lock("lock",3);
-select * from t1;
-# There is no point in testing REPLICATIION of the IS_*_LOCK
-# functions; slave does not run with the same concurrency context as
-# master (generally in slave we can't know that on master this lock
-# was already held by another connection and so that the the
-# get_lock() we're replicating timed out on master hence returned 0,
-# or that the is_free_lock() we're playing returned 0 etc.
-# But here all we do is test these functions outside of replication.
-select is_free_lock("lock"), is_used_lock("lock") = connection_id();
-explain extended select is_free_lock("lock"), is_used_lock("lock");
-# Check lock functions
-select is_free_lock("lock2");
-select is_free_lock(NULL);
-connection master1;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test b/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test
index 2e6e2ce9a31..234fec3361e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test
@@ -1,59 +1,2 @@
-# Test that GRANT is not replicated to the slave
-# when --replicate-wild-ignore-table=mysql.%
-# In BUG#980, this test would _randomly_ fail.
+--source suite/rpl/t/rpl_ignore_grant.test
-source include/master-slave.inc;
-
-# do not be influenced by other tests.
-connection master;
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-save_master_pos;
-connection slave;
-sync_with_master;
-# as these DELETE were not replicated, we need to do them manually on the
-# slave.
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-
-# test non-replication of GRANT
-connection master;
-grant select on *.* to rpl_ignore_grant@localhost;
-grant drop on test.* to rpl_ignore_grant@localhost;
-show grants for rpl_ignore_grant@localhost;
-save_master_pos;
-connection slave;
-sync_with_master;
---error 1141 #("no such grant for user")
-show grants for rpl_ignore_grant@localhost;
-# check it another way
-select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
-select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
-
-# test non-replication of SET PASSWORD
-# first force creation of the user on slave (because as the user does not exist
-# on slave, the SET PASSWORD may be replicated but silently do nothing; this is
-# not what we want; we want it to be not-replicated).
-grant select on *.* to rpl_ignore_grant@localhost;
-connection master;
-set password for rpl_ignore_grant@localhost=password("does it work?");
-save_master_pos;
-connection slave;
-sync_with_master;
-select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
-
-# clear what we have done, to not influence other tests.
-connection master;
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-save_master_pos;
-connection slave;
-sync_with_master;
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test b/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test
index 00171605a92..1a981652645 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test
@@ -1,51 +1,2 @@
-# test verifies that REVOKE must not be replicated when
-# slave server starts with --replicate-wild-ignore-table=mysql.%
-# the option is set in rpl_ignore_revoke-slave.opt
-# The first part of BUG#9483 for GRANT is checked by
-# existed specific rpl_ignore_grant test case (BUG#980)
+--source suite/rpl/t/rpl_ignore_revoke.test
-
-source include/master-slave.inc;
-
-### CLEAN-UP: create an account and manually duplicate it on the slave
-
-connection master;
-grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
-revoke select on *.* from 'user_foo'@'%';
-select select_priv from mysql.user where user='user_foo' /* master:must be N */;
-
-sync_slave_with_master;
-#connection slave;
-grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
-revoke select on *.* from 'user_foo'@'%';
-select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
-
-
-### TEST
-
-#connection slave;
-grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
-select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
-
-connection master;
-revoke select on *.* from 'user_foo';
-select select_priv from mysql.user where user='user_foo' /* master:must be N */;
-
-sync_slave_with_master;
-#connection slave;
-select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
-
-### CLEAN-UP
-
-connection slave;
---disable_abort_on_error
-revoke select on *.* FROM 'user_foo';
---enable_abort_on_error
-
-connection master;
-delete from mysql.user where user="user_foo";
-sync_slave_with_master;
-
-# Since changes to mysql.* are ignored, the revoke need to
-# be done on slave as well
-delete from mysql.user where user="user_foo";
diff --git a/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test b/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test
index fe030f90411..9ace16dd247 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test
@@ -1,38 +1,2 @@
-# This one assumes we are ignoring updates on table mysqltest_foo, but doing
-# the ones on all other tables
+--source suite/rpl/t/rpl_ignore_table_update.test
-source include/master-slave.inc;
-connection slave;
-
-#
-# For this test we must be in the test database
-#
-use test;
-
---disable_warnings
-drop table if exists mysqltest_foo;
-drop table if exists mysqltest_bar;
---enable_warnings
-
-create table mysqltest_foo (n int);
-insert into mysqltest_foo values(4);
-connection master;
-use test;
-create table mysqltest_foo (n int);
-insert into mysqltest_foo values(5);
-create table mysqltest_bar (m int);
-insert into mysqltest_bar values(15);
-create table t1 (k int);
-insert into t1 values(55);
-save_master_pos;
-connection slave;
-sync_with_master;
-select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1;
-connection master;
-drop table mysqltest_foo,mysqltest_bar,t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-drop table mysqltest_foo,mysqltest_bar,t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_init_slave.test b/mysql-test/suite/engines/funcs/t/rpl_init_slave.test
index 139b4902e12..85869ffbb99 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_init_slave.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_init_slave.test
@@ -1,34 +1,2 @@
-source include/master-slave.inc;
+--source suite/rpl/t/rpl_init_slave.test
-#
-# Test of init_slave variable
-#
-
-save_master_pos;
-connection slave;
-sleep 1;
-show variables like 'init_slave';
-show variables like 'max_connections';
-sync_with_master;
-reset master;
-connection master;
-show variables like 'init_slave';
-show variables like 'max_connections';
-save_master_pos;
-connection slave;
-sync_with_master;
-# Save variable value
-set @my_global_init_connect= @@global.init_connect;
-set global init_connect="set @c=1";
-show variables like 'init_connect';
-connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
-
-# Restore changed global variable
-set global init_connect= @my_global_init_connect;
-set global max_connections= default;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_insert.test b/mysql-test/suite/engines/funcs/t/rpl_insert.test
index f57a6e226d1..1a5d5ecba54 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_insert.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_insert.test
@@ -1,44 +1,2 @@
---echo #
---echo # Bug#20821: INSERT DELAYED fails to write some rows to binlog
---echo #
+--source suite/rpl/t/rpl_insert.test
---source include/not_embedded.inc
---source include/not_windows.inc
---source include/master-slave.inc
-
---disable_warnings
-CREATE SCHEMA IF NOT EXISTS mysqlslap;
-USE mysqlslap;
---enable_warnings
-
-CREATE TABLE t1 (id INT, name VARCHAR(64));
-
-let $query = "INSERT INTO t1 VALUES (1, 'Dr. No'), (2, 'From Russia With Love'), (3, 'Goldfinger'), (4, 'Thunderball'), (5, 'You Only Live Twice')";
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";"
-
-# Wait until all the 5000 inserts has been inserted into the table
---disable_query_log
-let $counter= 300; # Max 30 seconds wait
-while (`select count(*)!=5000 from mysqlslap.t1`)
-{
- sleep 0.1;
- dec $counter;
- if (!$counter)
- {
- Number of records in t1 didnt reach 5000;
- }
-}
---enable_query_log
-
-SELECT COUNT(*) FROM mysqlslap.t1;
-sync_slave_with_master;
-SELECT COUNT(*) FROM mysqlslap.t1;
-
---echo #
---echo # Cleanup
---echo #
-
-connection master;
-USE test;
-DROP SCHEMA mysqlslap;
-sync_slave_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_insert_select.test b/mysql-test/suite/engines/funcs/t/rpl_insert_select.test
index 677be526982..bc9ec9da636 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_insert_select.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_insert_select.test
@@ -1,6 +1,6 @@
# Testcase for BUG#10456 - INSERT INTO ... SELECT violating a primary key
# breaks replication
-
+-- source include/have_binlog_format_mixed_or_row.inc
-- source include/master-slave.inc
connection master;
@@ -10,10 +10,11 @@ create table t2 (n int);
insert into t2 values (1);
insert ignore into t1 select * from t2;
insert into t1 values (2);
-sync_slave_with_master;
+--sync_slave_with_master
connection slave;
select * from t1;
connection master;
drop table t1,t2;
-sync_slave_with_master;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test
index 439c2b48ca5..b357054b4db 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test
@@ -3,7 +3,7 @@
CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word;
-sync_slave_with_master;
+--sync_slave_with_master
# Check
SELECT * FROM t1 ORDER BY word;
@@ -11,4 +11,5 @@ SELECT * FROM t1 ORDER BY word;
# Cleanup
connection master;
drop table t1;
-sync_slave_with_master;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test
index 42c3ad99f33..901c40b5079 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test
@@ -1,52 +1,2 @@
-# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
-# exist.
-# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
-######################################################
-# Change Author: JBM
-# Change Date: 2005-12-22
-# Change: Test rewritten to remove show binlog events
-# and to test the option better + Cleanup
-######################################################
--- source include/master-slave.inc
+--source suite/rpl/t/rpl_loaddata_m.test
---disable_warnings
-drop database if exists mysqltest;
---enable_warnings
-
-connection master;
-# 'test' database should be ignored by the slave
-USE test;
-CREATE TABLE t1(a INT, b INT, UNIQUE(b));
-LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
-SELECT COUNT(*) FROM test.t1;
-
-# 'mysqltest' database should NOT be ignored by the slave
-CREATE DATABASE mysqltest;
-USE mysqltest;
-CREATE TABLE t1(a INT, b INT, UNIQUE(b));
-LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
-SELECT COUNT(*) FROM mysqltest.t1;
-
-# Now lets check the slave to see what we have :-)
-save_master_pos;
-connection slave;
-sync_with_master;
-
-SHOW DATABASES;
-
-USE test;
-SHOW TABLES;
-
-USE mysqltest;
-SHOW TABLES;
-SELECT COUNT(*) FROM mysqltest.t1;
-
-#show binlog events;
-
-# Cleanup
-connection master;
-DROP DATABASE mysqltest;
-DROP TABLE test.t1;
-sync_slave_with_master;
-
-# End of test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
index a06df3bbfc9..7521f62403e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
@@ -1,30 +1,2 @@
-# See if the slave logs (in its own binlog, with --log-slave-updates) a
-# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules.
-# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
+--source suite/rpl/t/rpl_loaddata_s.test
--- source include/have_binlog_format_mixed_or_statement.inc
--- source include/master-slave.inc
-
-connection slave;
-# Not sure why we connect to slave and then try to reset master, but I will leave it [JBM]
-reset master;
-
-connection master;
-# 'test' is the current database
-create table test.t1(a int, b int, unique(b));
-load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
-
-# Test logging on slave;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-select count(*) from test.t1; # check that LOAD was replicated
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events from 107; # should be nothing
-
-# Cleanup
-connection master;
-drop table test.t1;
-sync_slave_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test b/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test
index e272be3c13b..36e863c4573 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test
@@ -6,7 +6,7 @@
# only the first 4KB, 8KB or 16KB usually.
# - the loaded file's first line was not written entirely to the
# master's binlog (1st char was absent)
-source include/master-slave.inc;
+--source include/master-slave.inc
create table t1(a int);
let $1=10000;
@@ -26,15 +26,11 @@ truncate table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1;
remove_file $MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
select a,count(*) from t1 group by a;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
# End of 4.1 tests
@@ -54,12 +50,9 @@ create table t1(a int primary key);
eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1;
remove_file $MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile;
SELECT * FROM t1 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
SELECT * FROM t1 ORDER BY a;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loadfile.test b/mysql-test/suite/engines/funcs/t/rpl_loadfile.test
index 26235d89016..26829b265f1 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loadfile.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loadfile.test
@@ -41,7 +41,7 @@ CALL test.p1();
--enable_warnings
SELECT * FROM test.t1 ORDER BY blob_column;
save_master_pos;
-sync_slave_with_master;
+--sync_slave_with_master
connection slave;
SELECT * FROM test.t1 ORDER BY blob_column;
@@ -49,6 +49,6 @@ SELECT * FROM test.t1 ORDER BY blob_column;
connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE test.t1;
-sync_slave_with_master;
-
+--sync_slave_with_master
+--source include/rpl_end.inc
# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
index 22deee6b5f3..53b38d9a2de 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
@@ -1,58 +1,2 @@
-##########
-# Change Author: JBM
-# Change Date: 2006-01-16
-##########
+--source suite/rpl/t/rpl_log_pos.test
-#
-# 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=107;
-start slave;
-sleep 5;
-stop slave;
-change master to master_log_pos=107;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-start slave;
-sleep 5;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-stop slave;
-change master to master_log_pos=178;
-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;
-create table t1 (n int);
-insert into t1 values (1),(2),(3);
-save_master_pos;
-connection slave;
-stop slave;
-change master to master_log_pos=207;
-start slave;
-sync_with_master;
-select * from t1 ORDER BY n;
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test b/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test
index 91fab0b27a8..337cc1b36be 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test
@@ -1,22 +1,2 @@
-# Test for BUG#7658 "optimize crashes slave thread (1 in 1000)]"
+--source suite/rpl/t/rpl_many_optimize.test
-source include/master-slave.inc;
-
-create table t1 (a int not null auto_increment primary key, b int, key(b));
-INSERT INTO t1 (a) VALUES (1),(2);
-# Now many OPTIMIZE to test if we crash (BUG#7658)
-let $1=300;
-disable_query_log;
-disable_result_log;
-while ($1)
-{
- eval OPTIMIZE TABLE t1;
- dec $1;
-}
-enable_result_log;
-enable_query_log;
-drop table t1;
-# Bug was that slave segfaulted after ~ a hundred of OPTIMIZE (or ANALYZE)
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_master_pos_wait.test b/mysql-test/suite/engines/funcs/t/rpl_master_pos_wait.test
deleted file mode 100644
index 893c8746efc..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl_master_pos_wait.test
+++ /dev/null
@@ -1,18 +0,0 @@
-# See if master_pos_wait(,,timeout)
-# Terminates with "timeout expired" (-1)
-source include/master-slave.inc;
-save_master_pos;
-connection slave;
-sync_with_master;
-# Ask for a master log that has certainly not been reached yet
-# timeout= 2 seconds
-select master_pos_wait('master-bin.999999',0,2);
-explain extended select master_pos_wait('master-bin.999999',0,2);
-# Testcase for bug 651 (master_pos_wait() hangs if slave idle and STOP SLAVE).
-send select master_pos_wait('master-bin.999999',0);
-connection slave1;
-stop slave sql_thread;
-connection slave;
-reap;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test b/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test
index 6e4bedf7371..2f0786a9271 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test
@@ -1,46 +1,2 @@
-#
-# Test of replicating some difficult functions
-#
-source include/master-slave.inc;
+--source suite/rpl/t/rpl_misc_functions.test
---disable_query_log
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-create table t1(id int, i int, r1 int, r2 int, p varchar(100));
-insert into t1 values(1, connection_id(), 0, 0, "");
-# don't put rand and password in the same query, to see if they replicate
-# independently
-# Pure rand test
---disable_warnings
-insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
---enable_warnings
-# change the rand suite on the master (we do this because otherwise password()
-# benefits from the fact that the above rand() is well replicated :
-# it picks the same sequence element, which hides a possible bug in password() replication.
-set sql_log_bin=0;
-insert into t1 values(6, 0, rand(), rand(), "");
-delete from t1 where id=6;
-set sql_log_bin=1;
-# Pure password test
-insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
-# "altogether now"
---disable_warnings
-insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
---enable_warnings
-select * into outfile '../../tmp/rpl_misc_functions.outfile' from t1;
-sync_slave_with_master;
-create table t2 like t1;
-# read the values from the master table
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_misc_functions.outfile' into table t2;
-# compare them with the replica; the SELECT below should return no row
-select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
-stop slave;
-drop table t1;
-drop table t2;
-
-connection master;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test b/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test
index a251cbf8833..53347fbf127 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test
@@ -1,26 +1,2 @@
-source include/master-slave.inc;
-create table t1 (a int primary key);
-create table t2 (a int);
+--source suite/rpl/t/rpl_multi_delete.test
-insert into t1 values (1);
-insert into t2 values (1);
-
-
-delete t1.* from t1, t2 where t1.a = t2.a;
-
-save_master_pos;
-select * from t1;
-select * from t2;
-
-connection slave;
-sync_with_master;
-select * from t1;
-select * from t2;
-
-connection master;
-drop table t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test b/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test
index e91fad1872a..17df048f930 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test
@@ -1,68 +1,2 @@
-#multi delete replication bugs
-
-
-source include/master-slave.inc;
-
-#BUG#11139 - improper wild-table and table rules
-#checking for multi deletes with an alias
-
-connection master;
-set sql_log_bin=0;
-create database mysqltest_from;
-set sql_log_bin=1;
-
-connection slave;
-create database mysqltest_to;
-
-
-connection master;
-use mysqltest_from;
---disable_warnings
-drop table if exists a;
---enable_warnings
-CREATE TABLE a (i INT);
-INSERT INTO a VALUES(1);
-DELETE alias FROM a alias WHERE alias.i=1;
-SELECT * FROM a;
-insert into a values(2),(3);
-delete alias FROM a alias where alias.i=2;
-select * from a;
-save_master_pos;
-connection slave;
-
-use mysqltest_to;
-sync_with_master;
-select * from a;
-
-# BUG#3461
-connection master;
-create table t1 (a int primary key);
-create table t2 (a int);
-
-insert into t1 values (1);
-insert into t2 values (1);
-
-delete t1.* from t1, t2 where t1.a = t2.a;
-
-save_master_pos;
-select * from t1;
-select * from t2;
-
-connection slave;
-# BUG#3461 would cause sync to fail
-sync_with_master;
-error 1146;
-select * from t1;
-error 1146;
-select * from t2;
-
-# cleanup
-connection master;
-set sql_log_bin=0;
-drop database mysqltest_from;
-set sql_log_bin=1;
-connection slave;
-drop database mysqltest_to;
-
-# End of 4.1 tests
+--source suite/rpl/t/rpl_multi_delete2.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test b/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test
index 4991a385f6f..5538e6cba77 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test
@@ -1,45 +1,2 @@
-# Let's verify that multi-update is not always skipped by slave if
-# some replicate-* rules exist.
-# (BUG#15699)
+--source suite/rpl/t/rpl_multi_update4.test
-source include/master-slave.inc;
-
-### Clean-up
-
-connection master;
---disable_warnings
-drop database if exists d1;
-drop database if exists d2;
-
-connection slave;
-drop database if exists d2;
---enable_warnings
-
-### Do on master
-
-connection master;
-create database d1; # accepted by slave
-create table d1.t0 (id int);
-create database d2; # ignored by slave
-use d2;
-create table t1 (id int);
-create table t2 (id int);
-insert into t1 values (1), (2), (3), (4), (5);
-insert into t2 select id + 3 from t1;
-# a problematic query which must be filter out by slave
-update t1 join t2 using (id) set t1.id = 0;
-insert into d1.t0 values (0); # replication works
-
-### Check on slave
-
-sync_slave_with_master;
-use d1;
-select * from t0 where id=0; # must find
-
-### Clean-up
-connection master;
-drop database d1;
-drop database d2;
-sync_slave_with_master;
-
-# End of test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_ps.test b/mysql-test/suite/engines/funcs/t/rpl_ps.test
index 09c7b779f65..d40c5737912 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_ps.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_ps.test
@@ -1,49 +1,2 @@
-#
-# Test of replicating user variables
-#
-###########################################################
-source include/master-slave.inc;
+--source suite/rpl/t/rpl_ps.test
-#save_master_pos;
-#connection slave;
-#sync_with_master;
-#reset master;
-#connection master;
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1(n char(30));
-
-prepare stmt1 from 'insert into t1 values (?)';
-set @var1= "from-master-1";
-execute stmt1 using @var1;
-set @var1= "from-master-2-'',";
-execute stmt1 using @var1;
-SELECT * FROM t1 ORDER BY n;
-
-set @var2= 'insert into t1 values (concat("from-var-", ?))';
-prepare stmt2 from @var2;
-set @var1='from-master-3';
-execute stmt2 using @var1;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM t1 ORDER BY n;
-
-connection master;
-
-drop table t1;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
-
-# End of 4.1 tests
-
-reset master;
-reset slave;
-disconnect master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
deleted file mode 100644
index f4e6239c679..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
+++ /dev/null
@@ -1,47 +0,0 @@
--- source include/have_binlog_format_mixed.inc
--- source include/master-slave.inc
-
-# Test that the slave temporarily switches to ROW when seeing row
-# events when it is in MIXED mode
-
---echo **** On Master ****
-CREATE TABLE t1 (a INT, b LONG);
-INSERT INTO t1 VALUES (1,1), (2,2);
-INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-# Different number of binlog events are generated by different engines
---disable_result_log
-SHOW BINLOG EVENTS;
---enable_result_log
-sync_slave_with_master;
---echo **** On Slave ****
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-# Different number of binlog events are generated by different engines
---disable_result_log
-SHOW BINLOG EVENTS;
---enable_result_log
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
-
-connection master;
-DROP TABLE IF EXISTS t1;
-
-# Let's compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching
-
-diff_files $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql;
-
-# If all is good, we can remove the files
-
-remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql;
-remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_relayspace.test b/mysql-test/suite/engines/funcs/t/rpl_relayspace.test
index 70315c14f34..5c60f57b496 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_relayspace.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_relayspace.test
@@ -1,34 +1,2 @@
-# The slave is started with relay_log_space_limit=10 bytes,
-# to force the deadlock after one event.
+--source suite/rpl/t/rpl_relayspace.test
-source include/master-slave.inc;
-connection slave;
-stop slave;
-connection master;
-# This will generate a master's binlog > 10 bytes
-create table t1 (a int);
-drop table t1;
-create table t1 (a int);
-drop table t1;
-connection slave;
-reset slave;
-start slave io_thread;
-# Give the I/O thread time to block.
-sleep 2;
-# A bug caused the I/O thread to refuse stopping.
-stop slave io_thread;
-reset slave;
-start slave;
-# The I/O thread stops filling the relay log when
-# it's >10b. And the SQL thread cannot purge this relay log
-# as purge is done only when the SQL thread switches to another
-# relay log, which does not exist here.
-# So we should have a deadlock.
-# if it is not resolved automatically we'll detect
-# it with master_pos_wait that waits for farther than 1Ob;
-# it will timeout after 10 seconds;
-# also the slave will probably not cooperate to shutdown
-# (as 2 threads are locked)
-select master_pos_wait('master-bin.001',200,6)=-1;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test b/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test
index bcfef919fad..edadb14a3ee 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test
@@ -1,30 +1,2 @@
-# see if --replicate-ignore-db works
+--source suite/rpl/t/rpl_replicate_ignore_db.test
---source include/master-slave.inc
-
---disable_warnings
-drop database if exists mysqltest1;
-drop database if exists mysqltest2;
---enable_warnings
-create database mysqltest1;
-create database mysqltest2;
-
-use mysqltest1;
-create table t1 (a int);
-insert into t1 values(1);
-sync_slave_with_master;
---error 1146
-select * from mysqltest1.t1;
-
-connection master;
-use mysqltest2;
-create table t1 (a int);
-insert into t1 values(1);
-sync_slave_with_master;
-select * from mysqltest2.t1;
-
-# cleanup
-connection master;
-drop database mysqltest1;
-drop database mysqltest2;
-sync_slave_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test b/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test
index bf9576ae11b..b909062b8cc 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test
@@ -1,74 +1,2 @@
-#############################################################################
-# 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 #
-#############################################################################
+--source suite/rpl/t/rpl_row_NOW.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-create database if not exists mysqltest1;
-DROP TABLE IF EXISTS mysqltest1.t1;
---enable_warnings
-
-
-# Begin test section 1
-CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT,
- a TIMESTAMP DEFAULT '2005-05-05 01:01:01',
- b TIMESTAMP DEFAULT '2005-05-05 01:01:01',
- PRIMARY KEY(n));
-delimiter |;
-CREATE FUNCTION mysqltest1.f1() RETURNS TIMESTAMP
-BEGIN
- DECLARE v1 INT DEFAULT 300;
- WHILE v1 > 0 DO
- SET v1 = v1 - 1;
- END WHILE;
- RETURN NOW();
-END|
-delimiter ;|
-
-INSERT INTO mysqltest1.t1 VALUES(NULL,NOW(),mysqltest1.f1());
-
-delimiter |;
-CREATE TRIGGER mysqltest1.trig1 BEFORE INSERT ON mysqltest1.t1
-FOR EACH ROW BEGIN
- SET new.b = mysqltest1.f1();
-END|
-delimiter ;|
-
-INSERT INTO mysqltest1.t1 SET n = NULL, a = now();
-
-sync_slave_with_master;
-
-connection master;
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_slave.sql
-
-# lets cleanup
-DROP TABLE IF EXISTS mysqltest1.t1;
-DROP FUNCTION mysqltest1.f1;
-
-# Lets compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching :-) The failed dump
-# files will be located in $MYSQLTEST_VARDIR/tmp
-
-diff_files $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave.sql;
-
-# If all is good, when can cleanup our dump files.
-remove_file $MYSQLTEST_VARDIR/tmp/NOW_master.sql;
-remove_file $MYSQLTEST_VARDIR/tmp/NOW_slave.sql;
-
-DROP DATABASE mysqltest1;
-sync_slave_with_master;
-# End of 5.1 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_USER.test b/mysql-test/suite/engines/funcs/t/rpl_row_USER.test
index c3639d05c48..e48b25293fa 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_USER.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_USER.test
@@ -1,57 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/18/2005 #
-#############################################################################
-# TEST: To test the UUID() in rbr #
-#############################################################################
-# Change Author: JBM
-# Change Date: 2006-01-16
-##########
+--source suite/rpl/t/rpl_row_USER.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-CREATE DATABASE mysqltest1;
---enable_warnings
-
-# Section 1 test
-CREATE USER tester IDENTIFIED BY 'test';
-GRANT ALL ON mysqltest1.* TO 'tester'@'%' IDENTIFIED BY 'test';
-GRANT ALL ON mysqltest1.* TO ''@'localhost%';
-FLUSH PRIVILEGES;
-connect (m_1,localhost,tester,,mysqltest1);
-
-connection m_1;
-CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a));
-INSERT INTO mysqltest1.t1 VALUES(1,USER());
-INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER());
-delimiter |;
-create procedure mysqltest1.p1()
-begin
- INSERT INTO mysqltest1.t1 VALUES(3,USER());
- INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER());
-end|
-delimiter ;|
-
-CALL mysqltest1.p1();
-connection master;
-SELECT * FROM mysqltest1.t1 ORDER BY a;
-sync_slave_with_master;
-SELECT * FROM mysqltest1.t1 ORDER BY a;
-
-connection master;
-# Lets cleanup
-
-REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
-REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
-DROP DATABASE mysqltest1;
-DROP USER 'tester';
-DROP USER ''@'localhost%';
-FLUSH PRIVILEGES;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
index 20c217a7c3a..35090d7f32f 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
@@ -1,48 +1,2 @@
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
+--source suite/rpl/t/rpl_row_drop.test
-# Bug#12415: DROP of temporary table on master stops slave
-connection master;
---echo **** On Master ****
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int);
-CREATE TEMPORARY TABLE t2 (a int, b int);
-SHOW TABLES;
-sync_slave_with_master;
---echo **** On Slave ****
-SHOW TABLES;
-connection master;
---echo **** On Master ****
-DROP TABLE t2; # Dropping the temporary table
-SHOW TABLES;
-sync_slave_with_master;
---echo **** On Slave ****
-SHOW TABLES; # There should be two tables on the slave
-
-connection master;
---echo **** On Master ****
-CREATE TEMPORARY TABLE t2 (a int, b int);
-SHOW TABLES;
-sync_slave_with_master;
---echo **** On Slave ****
-SHOW TABLES;
-connection master;
---echo **** On Master ****
-# Should drop the non-temporary table t1 and the temporary table t2
-DROP TABLE t1,t2;
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
-SHOW TABLES;
-sync_slave_with_master;
---echo **** On Slave ****
-SHOW TABLES;
-
---disable_query_log
---disable_warnings
-connection master;
-DROP TABLE IF EXISTS t2;
-sync_slave_with_master;
---enable_warnings
---enable_query_log
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_func001.test b/mysql-test/suite/engines/funcs/t/rpl_row_func001.test
index 53fb55118e6..7671d9947c1 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_func001.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_func001.test
@@ -1,57 +1,2 @@
-#############################################################################
-# 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 #
-#############################################################################
+--source suite/rpl/t/rpl_row_func001.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
---error 0,1305
-DROP FUNCTION test.f1;
-DROP TABLE IF EXISTS test.t1;
-
-
---enable_warnings
-
-# Section 1 test from bug #12487 Uses stored function to insert rows to see what is replicated.
-
-create table test.t1 (a int, PRIMARY KEY(a));
-
-delimiter //;
-create function test.f1(i int) returns int
-begin
-insert into test.t1 values(i);
-return 0;
-end//
-delimiter ;//
-
-select test.f1(1);
-select test.f1(2);
-select * from test.t1;
-
-save_master_pos;
-sync_slave_with_master;
-connection slave;
-#show create table test.t1;
-select * from test.t1;
-
-connection master;
-
-#Used for debugging
-#show binlog events;
-
-# Cleanup
-
-DROP FUNCTION test.f1;
-DROP TABLE test.t1;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
index 736071a8ece..793b94e63a6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
@@ -2,7 +2,7 @@
# not have
--source include/have_binlog_format_row.inc
-source include/master-slave.inc;
+--source include/master-slave.inc
connection master;
create table t1 (a int not null primary key);
@@ -11,7 +11,7 @@ create table t2 (a int);
insert into t2 values (1);
update t1, t2 set t1.a = 0 where t1.a = t2.a;
-sync_slave_with_master;
+--sync_slave_with_master
# t2 should not have been replicated
# t1 should have been properly updated
show tables;
@@ -23,13 +23,16 @@ insert into t1 values (1);
connection slave;
# slave should have stopped because can't find table t1
-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 # 22 # 23 # 33 #
---vertical_results
-show slave status;
+# 1146 = ER_NO_SUCH_TABLE
+call mtr.add_suppression("Slave SQL.*Error executing row event: .Table .test.t1. doesn.t exist., error.* 1146");
+--let $slave_sql_errno= 1146
+--source include/wait_for_slave_sql_error.inc
+
+--echo ==== Clean up ====
+--source include/stop_slave_io.inc
+RESET SLAVE;
-# cleanup
connection master;
drop table t1, t2;
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test b/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test
index 6df58122051..f7098d0d7bf 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test
@@ -4,6 +4,6 @@
# Test of manual relay log rotation with FLUSH LOGS.
# Requires statement logging
-source include/have_binlog_format_row.inc;
+--source include/have_binlog_format_row.inc
-source suite/rpl/include/rpl_max_relay_size.test;
+--source suite/rpl/include/rpl_max_relay_size.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test
index ae6116bea4e..0610ef0274a 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test
@@ -1,146 +1,2 @@
-#############################################################################
-# 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. #
-############################################################################
+--source suite/rpl/t/rpl_row_sp001.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
--- disable_query_log
--- disable_result_log
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-
--- enable_query_log
--- enable_result_log
-
-# Begin test section 1 for non deterministic SP
-let $message=<Begin test section 1 (non deterministic SP)>;
---source include/show_msg.inc
-
-create table test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
-
-delimiter //;
-create procedure test.p1()
-begin
- INSERT INTO test.t1 (f,d) VALUES (RAND(),NOW());
-end//
-delimiter ;//
-
-# show binlog events;
-
--- disable_query_log
--- disable_result_log
-let $1=10;
-while ($1)
-{
- call test.p1();
- sleep 1;
- dec $1;
-}
--- enable_result_log
--- enable_query_log
-
-## Used for debugging
-#show binlog events;
-#select * from test.t1;
-#sync_slave_with_master;
-#select * from test.t1;
-#connection master;
-
-let $message=<End test section 1 (non deterministic SP)>;
---source include/show_msg.inc
-
-
-CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t CHAR(4), PRIMARY KEY(a));
-
-delimiter //;
-CREATE PROCEDURE test.p2(n int)
-begin
-CASE n
-WHEN 1 THEN
- UPDATE test.t2 set t ='Tex';
-WHEN 2 THEN
- UPDATE test.t2 set t ='SQL';
-ELSE
- UPDATE test.t2 set t ='NONE';
-END CASE;
-end//
-delimiter ;//
-
-INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW');
-
-SELECT * FROM t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM t2 ORDER BY a;
-
-connection master;
-call test.p2(1);
-SELECT * FROM t2 ORDER BY a;
-sync_slave_with_master;
-SELECT * FROM t2 ORDER BY a;
-
-
-connection master;
-call test.p2(2);
-SELECT * FROM t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM t2 ORDER BY a;
-
-connection master;
-call test.p2(3);
-SELECT * FROM t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM t2 ORDER BY a;
-
-##Used for debugging
-#show binlog events;
-
-# time to dump the databases and so we can see if they match
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_slave.sql
-
-# First lets cleanup
-
-connection master;
-DROP PROCEDURE test.p1;
-DROP PROCEDURE test.p2;
-DROP TABLE test.t1;
-DROP TABLE test.t2;
-sync_slave_with_master;
-
-# Lets compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching :-) Failed dump files
-# will be located in $MYSQLTEST_VARDIR/tmp
-
-diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
-
-# If all is good, when can cleanup our dump files.
-remove_file $MYSQLTEST_VARDIR/tmp/sp001_master.sql;
-remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test
index d8a5aacc5e6..a304dbe009b 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test
@@ -1,108 +1,2 @@
-#############################################################################
-# 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. #
-#############################################################################
+--source suite/rpl/t/rpl_row_sp005.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t3;
---enable_warnings
-# End of cleanup
-
-# Begin test section 1
-CREATE TABLE IF NOT EXISTS test.t1(id INT, data CHAR(16),PRIMARY KEY(id));
-CREATE TABLE IF NOT EXISTS test.t2(id2 INT,PRIMARY KEY(id2));
-CREATE TABLE IF NOT EXISTS test.t3(id3 INT,PRIMARY KEY(id3), c CHAR(16));
-
-delimiter |;
-CREATE PROCEDURE test.p1()
-BEGIN
-DECLARE done INT DEFAULT 0;
- DECLARE spa CHAR(16);
- DECLARE spb,spc INT;
- DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1 ORDER BY id;
- DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2 ORDER BY id2;
- DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
-
- OPEN cur1;
- OPEN cur2;
-
- REPEAT
- FETCH cur1 INTO spb, spa;
- FETCH cur2 INTO spc;
- IF NOT done THEN
- IF spb < spc THEN
- INSERT INTO test.t3 VALUES (spb,spa);
- ELSE
- INSERT INTO test.t3 VALUES (spc,spa);
- END IF;
- END IF;
- UNTIL done END REPEAT;
-
- CLOSE cur1;
- CLOSE cur2;
-END|
-CREATE PROCEDURE test.p2()
-BEGIN
- INSERT INTO test.t1 VALUES (4,'MySQL'),(20,'ROCKS'),(11,'Texas'),(10,'kyle');
- INSERT INTO test.t2 VALUES (4),(2),(1),(3);
- UPDATE test.t1 SET id=id+4 WHERE id=4;
-END|
-delimiter ;|
-
-let $message=< ---- Master selects-- >;
---source include/show_msg.inc
-CALL test.p2();
-SELECT * FROM test.t1 ORDER BY id;
-SELECT * FROM test.t2 ORDER BY id2;
-
-let $message=< ---- Slave selects-- >;
---source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t1 ORDER BY id;
-SELECT * FROM test.t2 ORDER BY id2;
-
-let $message=< ---- Master selects-- >;
---source include/show_msg.inc
-connection master;
-CALL test.p1();
-sleep 6;
-SELECT * FROM test.t3 ORDER BY id3;
-
-let $message=< ---- Slave selects-- >;
---source include/show_msg.inc
-connection slave;
-SELECT * FROM test.t3 ORDER BY id3;
-
-connection master;
-
-ALTER PROCEDURE test.p1 MODIFIES SQL DATA;
-#show binlog events;
-
-# Cleanup
-
-connection master;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test
index b1295820c99..3cc0ed26ea2 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test
@@ -1,57 +1,2 @@
-#############################################################################
-# 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 #
-#############################################################################
+--source suite/rpl/t/rpl_row_sp008.test
-
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP TABLE IF EXISTS test.t2;
---enable_warnings
-# End of cleanup
-
-
-
-# Begin test section 1
-CREATE TABLE test.t1 (a INT,PRIMARY KEY(a));
-CREATE TABLE test.t2 (a INT,PRIMARY KEY(a));
-INSERT INTO test.t1 VALUES(1),(2);
-
-delimiter |;
-CREATE PROCEDURE test.p1()
-BEGIN
- SELECT SQL_CALC_FOUND_ROWS * FROM test.t1 LIMIT 1;
- INSERT INTO test.t2 VALUES(FOUND_ROWS());
-END|
-delimiter ;|
-
-let $message=< ---- Master selects-- >;
---source include/show_msg.inc
-CALL test.p1();
-SELECT * FROM test.t2;
-
-let $message=< ---- Slave selects-- >;
---source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t2;
-
-# Cleanup
-
-connection master;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test
index 505ed582ba9..56b42a0953d 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test
@@ -1,102 +1,2 @@
-#############################################################################
-# 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 #
-#############################################################################
+--source suite/rpl/t/rpl_row_sp009.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-
-
-# Begin test section 1
-CREATE TABLE test.t1 (a INT, PRIMARY KEY(a));
-INSERT INTO test.t1 VALUES (1),(2),(3),(4);
-CREATE TABLE test.t2 (a INT, PRIMARY KEY(a));
-
-delimiter |;
-CREATE PROCEDURE test.p1 (arg1 CHAR(1))
-BEGIN
- DECLARE b, c INT;
- IF arg1 = 'a' THEN
- BEGIN
- DECLARE cur1 CURSOR FOR SELECT A FROM test.t1 WHERE a % 2;
- DECLARE continue handler for not found set b = 1;
- SET b = 0;
- OPEN cur1;
- c1_repeat: REPEAT
- FETCH cur1 INTO c;
- IF (b = 1) THEN
- LEAVE c1_repeat;
- END IF;
-
- INSERT INTO test.t2 VALUES (c);
- UNTIL b = 1
- END REPEAT;
- CLOSE cur1;
- END;
- END IF;
- IF arg1 = 'b' THEN
- BEGIN
- DECLARE cur2 CURSOR FOR SELECT a FROM test.t1 WHERE NOT a % 2;
- DECLARE continue handler for not found set b = 1;
- SET b = 0;
- OPEN cur2;
- c2_repeat: REPEAT
- FETCH cur2 INTO c;
- IF (b = 1) THEN
- LEAVE c2_repeat;
- END IF;
-
- INSERT INTO test.t2 VALUES (c);
- UNTIL b = 1
- END REPEAT;
- CLOSE cur2;
- END;
- END IF;
-END|
-delimiter ;|
-
-CALL test.p1('a');
-SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t2 ORDER BY a;
-connection master;
-truncate test.t2;
-
-# this next call fails, but should not
-call test.p1('b');
-select * from test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t2 ORDER BY a;
-
-connection master;
-truncate test.t2;
-SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t2 ORDER BY a;
-
-# Cleanup
-connection master;
-DROP PROCEDURE test.p1;
-DROP TABLE test.t1;
-DROP TABLE test.t2;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test
index 28b82217517..a52fc311315 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test
@@ -1,80 +1,2 @@
-#############################################################################
-# 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 #
-#############################################################################
+--source suite/rpl/t/rpl_row_sp010.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP PROCEDURE IF EXISTS test.p4;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-
-
-# Begin test section 1
-delimiter |;
-CREATE PROCEDURE test.p1()
-BEGIN
- INSERT INTO test.t1 VALUES(2);
-END|
-CREATE PROCEDURE test.p2()
-BEGIN
- DROP TEMPORARY TABLE IF EXISTS test.t1;
- CREATE TEMPORARY TABLE test.t1 (a int, PRIMARY KEY(a));
- INSERT INTO test.t1 VALUES(1);
- CALL test.p1();
-END|
-delimiter ;|
-CALL test.p2();
-SELECT * FROM test.t1 ORDER BY a;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-show tables;
-
-connection master;
-delimiter |;
-CREATE PROCEDURE test.p3()
-BEGIN
- INSERT INTO test.t2 VALUES(7);
-END|
-CREATE PROCEDURE test.p4()
-BEGIN
- DROP TABLE IF EXISTS test.t2;
- CREATE TABLE test.t2 (a int, PRIMARY KEY(a));
- INSERT INTO test.t2 VALUES(6);
- CALL test.p3();
-END|
-delimiter ;|
-CALL test.p4();
-SELECT * FROM test.t2 ORDER BY a;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t2 ORDER BY a;
-
-# Cleanup
-connection master;
-#show binlog events;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP PROCEDURE IF EXISTS test.p4;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test
index 1c24904dd5a..c24282c8f16 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test
@@ -1,111 +1,2 @@
-#############################################################################
-# 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 #
-#############################################################################
+--source suite/rpl/t/rpl_row_sp011.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP PROCEDURE IF EXISTS test.p4;
-DROP PROCEDURE IF EXISTS test.p5;
-DROP PROCEDURE IF EXISTS test.p6;
-DROP PROCEDURE IF EXISTS test.p7;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-
-
-# Begin test section 1
-CREATE TABLE test.t1 (a int, PRIMARY KEY(a));
-INSERT INTO test.t1 VALUES (1);
-
-delimiter |;
-CREATE PROCEDURE test.p1()
-BEGIN
- ALTER TABLE test.t1 ADD COLUMN b CHAR(4) AFTER a;
- UPDATE test.t1 SET b = 'rbr' WHERE a = 1;
- CALL test.p2();
-END|
-CREATE PROCEDURE test.p2()
-BEGIN
- ALTER TABLE test.t1 ADD COLUMN f FLOAT AFTER b;
- UPDATE test.t1 SET f = RAND() WHERE a = 1;
- CALL test.p3();
-END|
-CREATE PROCEDURE test.p3()
-BEGIN
- ALTER TABLE test.t1 RENAME test.t2;
- CALL test.p4();
-END|
-CREATE PROCEDURE test.p4()
-BEGIN
- ALTER TABLE test.t2 ADD INDEX (f);
- ALTER TABLE test.t2 CHANGE a a INT UNSIGNED NOT NULL AUTO_INCREMENT;
- INSERT INTO test.t2 VALUES (NULL,'TEST',RAND());
- CALL test.p5();
-END|
-CREATE PROCEDURE test.p5()
-BEGIN
- ALTER TABLE test.t2 ORDER BY f;
- INSERT INTO test.t2 VALUES (NULL,'STM',RAND());
- CALL test.p6();
-END|
-CREATE PROCEDURE test.p6()
-BEGIN
- ALTER TABLE test.t2 ADD COLUMN b2 CHAR(4) FIRST;
- ALTER TABLE test.t2 ADD COLUMN to_drop BIT(8) AFTER b2;
- INSERT INTO test.t2 VALUES ('new',1,NULL,'STM',RAND());
- CALL test.p7();
-END|
-CREATE PROCEDURE test.p7()
-BEGIN
- ALTER TABLE test.t2 DROP COLUMN to_drop;
- INSERT INTO test.t2 VALUES ('gone',NULL,'STM',RAND());
-END|
-delimiter ;|
-CALL test.p1();
-
-#SELECT * FROM test.t2;
-sync_slave_with_master;
-#SELECT * FROM test.t2;
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_slave.sql
-
-# Cleanup
-connection master;
-#show binlog events;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP PROCEDURE IF EXISTS test.p4;
-DROP PROCEDURE IF EXISTS test.p5;
-DROP PROCEDURE IF EXISTS test.p6;
-DROP PROCEDURE IF EXISTS test.p7;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-sync_slave_with_master;
-
-# Lets compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching :-) Failed test
-# Will leave dump files in $MYSQLTEST_VARDIR/tmp
-
-diff_files $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_slave.sql;
-
-# If all is good, when can cleanup our dump files.
-remove_file $MYSQLTEST_VARDIR/tmp/sp011_master.sql;
-remove_file $MYSQLTEST_VARDIR/tmp/sp011_slave.sql;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test
index f3963c7537a..f23e5c905a6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test
@@ -1,75 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/22/2005 #
-# Update: 08/29/2005 Added save pos and sync #
-#############################################################################
-#TEST: SP to test security and current_user and user #
-#############################################################################
-
-
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/not_embedded.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
-
-
-# Begin test section 1
-# Create user user1 with no particular access rights
-grant usage on *.* to user1@localhost;
-flush privileges;
-
-SELECT CURRENT_USER();
-SELECT USER();
-CREATE PROCEDURE test.p1 () SQL SECURITY INVOKER SELECT CURRENT_USER(), USER();
-CREATE PROCEDURE test.p2 () SQL SECURITY DEFINER CALL test.p1();
-CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
-GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
-GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
-GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
-
-# Need to wait for the rights to be applied at the slave
-sync_slave_with_master;
-
-let $message=<******** Master user1 p3 & p2 calls *******>;
---source include/show_msg.inc
-connect (muser1,localhost,user1,,);
-connection muser1;
-SELECT CURRENT_USER();
-SELECT USER();
-CALL test.p3();
-CALL test.p2();
-
-let $message=<******** Slave user1 p3 & p2 calls *******>;
---source include/show_msg.inc
-connect (suser1,127.0.0.1,user1,,test,$SLAVE_MYPORT,);
-
-connection master;
-save_master_pos;
-connection suser1;
-sync_with_master;
-
-SELECT CURRENT_USER();
-SELECT USER();
-CALL test.p3();
-CALL test.p2();
-
-# Cleanup
-connection master;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP USER 'user1'@'localhost';
-sync_slave_with_master;
-
-# End of 5.0 test case
+--source suite/rpl/t/rpl_row_sp012.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test b/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test
index da363736100..397bc9a1d61 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test
@@ -9,8 +9,8 @@
connection master;
create table t1 (a int not null auto_increment primary key, b int, key(b));
-sync_slave_with_master;
-stop slave;
+--sync_slave_with_master
+--source include/stop_slave.inc
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;
@@ -28,13 +28,13 @@ INSERT INTO t1 (a) SELECT null FROM t1;
INSERT INTO t1 (a) SELECT null FROM t1;
connection slave;
-start slave;
+--source include/start_slave.inc
# 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;
+--source include/stop_slave.inc
# see if slave hangs on DROP TABLE
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test b/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test
index 7b1fca2d6a1..77fd9fbf90e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test
@@ -1,100 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/09/2005 #
-#############################################################################
-# TEST: Use after insert and before inset triggers and stored procdures to #
-# Update and insert data #
-#############################################################################
+--source suite/rpl/t/rpl_row_trig001.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
--- disable_query_log
--- disable_result_log
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
---error 0,1360
-DROP TRIGGER test.t2_ai;
---error 0,1360
-DROP TRIGGER test.t3_bi_t2;
---error 0,1360
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
-
-
-# test section 1, lets add a trigger to the mix. Taken from bug #12280
-let $message=<Begin test section 1 (Tiggers & SP)>;
---source include/show_msg.inc
-
-CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n));
-CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
-CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n));
-
-INSERT INTO test.t1 VALUES (1,NOW());
-
-delimiter //;
-CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1;//
-CREATE PROCEDURE test.p3()
-BEGIN
- INSERT INTO test.t3 (d) VALUES (NOW());
-END//
-CREATE TRIGGER test.t3_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW CALL test.p3()//
-CREATE PROCEDURE test.p2()
-BEGIN
- INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW());
-END//
-delimiter ;//
-
--- disable_query_log
--- disable_result_log
-let $1=10;
-while ($1)
-{
- CALL test.p2();
- sleep 1;
- dec $1;
-}
--- enable_result_log
--- enable_query_log
-
-#show binlog events;
-#select * from test.t2;
-#select * from test.t3;
-#connection slave;
-#select * from test.t2;
-#select * from test.t3;
-
-let $message=<End test section 2 (Tiggers & SP)>;
---source include/show_msg.inc
-
-# time to dump the databases and so we can see if they match
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_slave.sql
-
-# Cleanup
-connection master;
-DROP PROCEDURE test.p2;
-DROP PROCEDURE test.p3;
-DROP TRIGGER test.t2_ai;
-DROP TRIGGER test.t3_bi_t2;
-DROP TABLE test.t1;
-DROP TABLE test.t2;
-DROP TABLE test.t3;
-sync_slave_with_master;
-
-# Lets compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching :-) Failed tests
-# will leave dump files in $MYSQLTEST_VARDIR/tmp
-
-diff_files $MYSQLTEST_VARDIR/tmp/trig001_master.sql $MYSQLTEST_VARDIR/tmp/trig001_slave.sql;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test b/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test
index 44b7d8b1dc2..8b7342c32a1 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test
@@ -1,82 +1,2 @@
-#############################################################################
-# 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 #
-#############################################################################
+--source suite/rpl/t/rpl_row_trig002.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-#-- disable_query_log
-#-- disable_result_log
-
-# Begin clean up test section
-connection master;
---disable_warnings
---error 0,1360
-DROP TRIGGER test.t2_ai;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
---enable_warnings
-
-# test section 1, Taken from bug #12408
-
-CREATE TABLE test.t2 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
-
-CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
-
-CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
-
-delimiter |;
-CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL AND ms.program='spamfilter' AND ms.keey='scan_incoming'|
-delimiter ;|
-
-INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com');
-
-SELECT * FROM test.t1 ORDER BY id;
-#show binlog events;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t1 ORDER BY id;
-connection master;
-
-INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming');
-INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
-INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
-
-select * from test.t2;
---sorted_result
-select * from test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from test.t2;
---sorted_result
-select * from test.t3;
-connection master;
-
-DELETE FROM test.t1 WHERE id = 1;
-
-SELECT * FROM test.t1 ORDER BY id;
-connection master;
-SELECT * FROM test.t1 ORDER BY id;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t1 ORDER BY id;
-
-# Cleanup
-connection master;
-#show binlog events;
-DROP TRIGGER test.t2_ai;
-DROP TABLE test.t1;
-DROP TABLE test.t2;
-DROP TABLE test.t3;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test b/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test
index 4a1bbc5ca89..2bb581995d0 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test
@@ -1,152 +1,2 @@
-#############################################################################
-# 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 #
-#############################################################################
+--source suite/rpl/t/rpl_row_trig003.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-#-- disable_query_log
-#-- disable_result_log
-
-# Begin clean up test section
-connection master;
---disable_warnings
---error 0,1360
-DROP TRIGGER test.t1_bi;
---error 0,1360
-DROP TRIGGER test.t2_ai;
---error 0,1360
-DROP TRIGGER test.t1_bu;
---error 0,1360
-DROP TRIGGER test.t2_au;
---error 0,1360
-DROP TRIGGER test.t1_bd;
---error 0,1360
-DROP TRIGGER test.t2_ad;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
---enable_warnings
-
-# test section 1
-
-CREATE TABLE test.t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
-CREATE TABLE test.t2 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
-CREATE TABLE test.t3 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
-
-# Note Most of these cause the slave to core or do not produce desired results. Currently commenting out the ones not working until they are fixed.
-
-delimiter |;
-CREATE TRIGGER test.t1_bi BEFORE INSERT ON test.t1 FOR EACH ROW UPDATE test.t3 SET b1=1 and y=YEAR(NOW())|
-CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW BEGIN
- INSERT INTO test.t3 VALUES(NULL,0,'MySQL Replication team rocks!', 'Dark beer in prague is #1',12345.34,12.51,0,1965,NOW());
- UPDATE test.t3 SET f = ROUND(f);
-END|
-CREATE TRIGGER test.t1_bu BEFORE UPDATE on test.t1 FOR EACH ROW BEGIN
- UPDATE test.t3 SET y = '2000';
- INSERT INTO test.t3 VALUES(NULL,1,'Testing MySQL databases before update ', 'Insert should work',621.43, 0105.21,0,1974,NOW());
-END|
-CREATE TRIGGER test.t2_au AFTER UPDATE on test.t2 FOR EACH ROW BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE a DECIMAL(10,4);
- DECLARE b FLOAT;
- DECLARE num MEDIUMINT;
- DECLARE cur1 CURSOR FOR SELECT t2.id, t2.d, t2.f FROM test.t2;
- DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
-
- OPEN cur1;
-
- REPEAT
- FETCH cur1 INTO num, a, b;
- IF NOT done THEN
- UPDATE test.t3 SET total =(a*b) WHERE ID = num;
- END IF;
- UNTIL done END REPEAT;
- CLOSE cur1;
-END|
-CREATE TRIGGER test.t1_bd BEFORE DELETE on test.t1 FOR EACH ROW BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE a BIT(8);
- DECLARE b VARCHAR(255);
- DECLARE c CHAR(255);
- DECLARE d DECIMAL(10,4);
- DECLARE e FLOAT;
- DECLARE f BIGINT UNSIGNED;
- DECLARE g YEAR;
- DECLARE h TIMESTAMP;
- DECLARE cur1 CURSOR FOR SELECT t1.b1, t1.vc, t1.bc, t1.d, t1.f, t1.total, t1.y, t1.t FROM test.t1;
- DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
-
- OPEN cur1;
-
- REPEAT
- FETCH cur1 INTO a, b, c, d, e, f, g, h;
- IF NOT done THEN
- INSERT INTO test.t3 VALUES(NULL, a, b, c, d, e, f, g, h);
- END IF;
- UNTIL done END REPEAT;
- CLOSE cur1;
-END|
-CREATE TRIGGER test.t2_ad AFTER DELETE ON test.t2 FOR EACH ROW
- DELETE FROM test.t1|
-delimiter ;|
-
-INSERT INTO test.t1 VALUES(NULL,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,NOW());
-INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL Customers ROCK!',654321.4321,1.24521,0,YEAR(NOW()),NOW());
-
-UPDATE test.t1 SET b1 = 0 WHERE b1 = 1;
-
-INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW());
-UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
-
-INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
-
-# To make sure BUG#14698 is gone, we sleep 2 seconds before calling trigger
-# (with the bug in, that caused differences in TIMESTAMP columns).
-# We just need to let the machine's clock advance, it's not
-# to do synchronization, so real_sleep is good.
-real_sleep 2;
-
-DELETE FROM test.t1 WHERE id = 1;
-
-DELETE FROM test.t2 WHERE id = 1;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-connection master;
-
-# time to dump the databases and so we can see if they match
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_slave.sql
-
-# cleanup
---disable_warnings
---error 0,1360
-DROP TRIGGER test.t1_bi;
---error 0,1360
-DROP TRIGGER test.t2_ai;
---error 0,1360
-DROP TRIGGER test.t1_bu;
---error 0,1360
-DROP TRIGGER test.t2_au;
---error 0,1360
-DROP TRIGGER test.t1_bd;
---error 0,1360
-DROP TRIGGER test.t2_ad;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
---enable_warnings
-
-diff_files $MYSQLTEST_VARDIR/tmp/trg003_master.sql $MYSQLTEST_VARDIR/tmp/trg003_slave.sql;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_until.test b/mysql-test/suite/engines/funcs/t/rpl_row_until.test
index 7f8b0000042..d919bf7773b 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_until.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_until.test
@@ -1,126 +1,2 @@
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
+--source suite/rpl/t/rpl_row_until.test
-# Note: The test is dependent on binlog positions
-
-# Create some events on master
-connection master;
-CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-DROP TABLE t1;
-# Save master log position for query DROP TABLE t1
-save_master_pos;
-let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 11);
-let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 11);
-
-CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
-# Save master log position for query CREATE TABLE t2
-save_master_pos;
-let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 12);
-
-INSERT INTO t2 VALUES (1),(2);
-save_master_pos;
-# Save master log position for query INSERT INTO t2 VALUES (1),(2);
-let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 19);
-sync_slave_with_master;
-
-# Save relay log position for query INSERT INTO t2 VALUES (1),(2);
-let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1);
-
-connection master;
-INSERT INTO t2 VALUES (3),(4);
-DROP TABLE t2;
-# Save master log position for query DROP TABLE t2;
-let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 26);
-sync_slave_with_master;
-
---source include/stop_slave.inc
-# Reset slave.
-RESET SLAVE;
---disable_query_log
-eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
---enable_query_log
-
-# Try to replicate all queries until drop of t1
-connection slave;
-echo START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_drop_t1;
---disable_query_log
-eval START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_drop_t1;
---enable_query_log
---source include/wait_for_slave_sql_to_stop.inc
-
-# Here table should be still not deleted
-SELECT * FROM t1;
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_pos_drop_t1
---source include/check_slave_param.inc
-
-# This should fail right after start
---replace_result 291 MASTER_LOG_POS
-START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
---source include/wait_for_slave_sql_to_stop.inc
-# again this table should be still not deleted
-SELECT * FROM t1;
-
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_pos_drop_t1
---source include/check_slave_param.inc
-
-# Try replicate all up to and not including the second insert to t2;
-echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2;
---disable_query_log
-eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$relay_pos_insert1_t2;
---enable_query_log
---source include/wait_for_slave_sql_to_stop.inc
-SELECT * FROM t2;
-
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_pos_insert1_t2
---source include/check_slave_param.inc
-
-# clean up
-START SLAVE;
---source include/wait_for_slave_to_start.inc
-connection master;
-sync_slave_with_master;
---source include/stop_slave.inc
-
-# This should stop immediately as we are already there
-echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_create_t2;
---disable_query_log
-eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_create_t2;
---enable_query_log
-let $slave_param= Until_Log_Pos;
-let $slave_param_value= $master_pos_create_t2;
---source include/wait_for_slave_param.inc
---source include/wait_for_slave_sql_to_stop.inc
-# here the sql slave thread should be stopped
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_pos_drop_t2
---source include/check_slave_param.inc
-
-#testing various error conditions
---replace_result 561 MASTER_LOG_POS
---error 1277
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
---replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
---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.000009';
---replace_result 561 MASTER_LOG_POS
---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;
---replace_result 740 MASTER_LOG_POS
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
-
---source include/stop_slave.inc
-# Clear slave IO error.
-RESET SLAVE;
-
---let $rpl_only_running_threads= 1
---source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_view01.test b/mysql-test/suite/engines/funcs/t/rpl_row_view01.test
index 1ccfcb4eb27..6d58666f883 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_view01.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_view01.test
@@ -1,82 +1,2 @@
-#############################################################################
-# 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 ORDER BY qty;
-CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a ORDER BY a;
-CREATE VIEW mysqltest1.v3 AS SELECT * FROM mysqltest1.t1;
-CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL CHECK OPTION;
-
-
-SELECT * FROM mysqltest1.v2;
-SELECT * FROM mysqltest1.v1;
-sync_slave_with_master;
-SELECT * FROM mysqltest1.v2;
-SELECT * FROM mysqltest1.v1;
-connection master;
-
-INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2;
-INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1;
-
-SELECT * FROM mysqltest1.t5 ORDER BY qty;
-SELECT * FROM mysqltest1.t3 ORDER BY a;
-sync_slave_with_master;
-SELECT * FROM mysqltest1.t5 ORDER BY qty;
-SELECT * FROM mysqltest1.t3 ORDER BY a;
-connection master;
-
-INSERT INTO mysqltest1.v4 VALUES (4,'TEST');
-
-SELECT * FROM mysqltest1.t1 ORDER BY a;
-SELECT * FROM mysqltest1.v4 ORDER BY a;
-sync_slave_with_master;
-SELECT * FROM mysqltest1.t1 ORDER BY a;
-SELECT * FROM mysqltest1.v4 ORDER BY a;
-
-connection master;
-
-# lets cleanup
-DROP VIEW IF EXISTS mysqltest1.v1;
-DROP VIEW IF EXISTS mysqltest1.v2;
-DROP VIEW IF EXISTS mysqltest1.v3;
-DROP VIEW IF EXISTS mysqltest1.v4;
-DROP TABLE IF EXISTS mysqltest1.t3;
-DROP TABLE IF EXISTS mysqltest1.t1;
-DROP TABLE IF EXISTS mysqltest1.t2;
-DROP TABLE IF EXISTS mysqltest1.t4;
-DROP DATABASE mysqltest1;
-sync_slave_with_master;
-
-# End of 5.1 test case
+--source suite/rpl/t/rpl_row_view01.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
index 71310750b60..a1425531b2c 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
@@ -4,12 +4,12 @@
# ignored, which has caught our customers), unless
# --replicate-same-server-id.
-source include/master-slave.inc;
+--source include/master-slave.inc
connection slave;
create table t1 (n int);
reset master;
# replicate ourselves
-stop slave;
+--source include/stop_slave.inc
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
--replace_result $SLAVE_MYPORT SLAVE_PORT
@@ -17,10 +17,16 @@ eval change master to master_port=$SLAVE_MYPORT;
show slave status;
start slave;
insert into t1 values (1);
-# can't MASTER_POS_WAIT(), it does not work in this weird setup
-# (when slave is its own master without --replicate-same-server-id)
-sleep 2; # enough time for the event to be replicated (it should not)
-show status like "slave_running";
-drop table t1;
-# End of 4.1 tests
+--let $slave_param=Last_IO_Errno
+--let $slave_param_value=1593
+--source include/wait_for_slave_param.inc
+
+--let $slave_field_result_replace= / at [0-9]*/ at XXX/
+--let $status_items= Last_IO_Errno, Last_IO_Error
+--source include/show_slave_status.inc
+
+--source include/stop_slave.inc
+reset slave;
+reset master;
+drop table t1;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
index 0f2eb560d18..8d48746ba5e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
@@ -1,26 +1,2 @@
-# This test checks that a slave DOES execute queries originating
-# from itself, if running with --replicate-same-server-id.
+--source suite/rpl/t/rpl_server_id2.test
-source include/master-slave.inc;
-connection slave;
-create table t1 (n int);
-reset master;
-# replicate ourselves
-stop slave;
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval change master to master_port=$SLAVE_MYPORT;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 18 #
-show slave status;
-start slave;
-insert into t1 values (1);
-save_master_pos;
-sync_with_master;
-select * from t1; # check that indeed 2 were inserted
-# We stop the slave before cleaning up otherwise we'll get
-# 'drop table t1' executed twice, so an error in the slave.err
-# (not critical).
-stop slave;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_session_var.test b/mysql-test/suite/engines/funcs/t/rpl_session_var.test
index a6f4b496a23..f1686e107b6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_session_var.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_session_var.test
@@ -1,42 +1,2 @@
-# Replication of session variables.
-# FOREIGN_KEY_CHECKS is tested in rpl_insert_id.test
+--source suite/rpl/t/rpl_session_var.test
-source include/master-slave.inc;
-drop table if exists t1;
-create table t1(a varchar(100),b int);
-set @@session.sql_mode=pipes_as_concat;
-insert into t1 values('My'||'SQL', 1);
-set @@session.sql_mode=default;
-insert into t1 values('1'||'2', 2);
-select * from t1 where b<3 order by a;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1 where b<3 order by a;
-connection master;
-# if the slave does the next sync_with_master fine, then it means it accepts the
-# two lines of ANSI syntax below, which is what we want to check.
-set @@session.sql_mode=ignore_space;
-insert into t1 values(password ('MySQL'), 3);
-set @@session.sql_mode=ansi_quotes;
-create table "t2" ("a" int);
-drop table t1, t2;
-set @@session.sql_mode=default;
-create table t1(a int auto_increment primary key);
-create table t2(b int, a int);
-set @@session.sql_auto_is_null=1;
-insert into t1 values(null);
-insert into t2 select 1,a from t1 where a is null;
-set @@session.sql_auto_is_null=0;
-insert into t1 values(null);
-insert into t2 select 2,a from t1 where a is null;
-select * from t2 order by b;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t2 order by b;
-connection master;
-drop table t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_sf.test b/mysql-test/suite/engines/funcs/t/rpl_sf.test
index 6a741d80172..7ce6dc002ae 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_sf.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_sf.test
@@ -1,5 +1,5 @@
# Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
-source include/master-slave.inc;
+--source include/master-slave.inc
# save status
let $oblf=`select @@SESSION.BINLOG_FORMAT`;
@@ -66,3 +66,4 @@ drop function fn16456;
eval set binlog_format=$oblf;
eval set global log_bin_trust_function_creators=$otfc;
--enable_query_log
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_skip_error.test b/mysql-test/suite/engines/funcs/t/rpl_skip_error.test
index ff81e2f010e..083dfaa2075 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_skip_error.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_skip_error.test
@@ -2,12 +2,10 @@
# 2006-02-07 By JBM: Added order by
#########################################
# Note that errors are ignored by opt file.
-source include/master-slave.inc;
+--source include/master-slave.inc
create table t1 (n int not null primary key);
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
insert into t1 values (1);
connection master;
# Here we expect (ignored) error, since 1 is already in slave table
@@ -16,14 +14,13 @@ insert into t1 values (1);
# These should work fine
insert into t1 values (2),(3);
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
select * from t1 ORDER BY n;
# Cleanup
connection master;
drop table t1;
-sync_slave_with_master;
+--sync_slave_with_master
# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
index b3d6e49e215..677d95117fc 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
@@ -1,58 +1,2 @@
---source include/master-slave.inc
+--source suite/rpl/t/rpl_slave_status.test
-############################################################################
-# Test case for BUG#10780
-#
-# REQUIREMENT
-# A slave without replication privileges should have Slave_IO_Running = No
-
-# 1. Create new replication user
-connection master;
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
-
-connection slave;
-stop slave;
-change master to master_user='rpl',master_password='rpl';
-start slave;
-
-# 2. Do replication as new user
-connection master;
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (n int);
-insert into t1 values (1);
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
-
-# 3. Delete new replication user
-connection master;
-drop user rpl@127.0.0.1;
-sleep 1;
-flush privileges;
-connection slave;
-
-# 4. Restart slave without privileges
-# (slave.err will contain access denied error for this START SLAVE command)
-stop slave;
-start slave;
-
-# 5. Make sure Slave_IO_Running = No
---replace_result $MASTER_MYPORT MASTER_MYPORT
-# Column 1 is replaced, since the output can be either
-# "Connecting to master" or "Waiting for master update"
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 #
---vertical_results
-show slave status;
-
-# Cleanup (Note that slave IO thread is not running)
-connection slave;
-drop table t1;
-connection master;
-drop table t1;
-
-# end of test case for BUG#10780
-
-# end of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_sp.test b/mysql-test/suite/engines/funcs/t/rpl_sp.test
index ad2cc29375b..773062275c9 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_sp.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_sp.test
@@ -1,496 +1,2 @@
-# row-based and statement have expected binlog difference in result files
-
-# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
-# Modified by WL#2971.
-
-source include/have_binlog_format_mixed.inc;
-source include/master-slave.inc;
-
-# we need a db != test, where we don't have automatic grants
---disable_warnings
-drop database if exists mysqltest1;
---enable_warnings
-create database mysqltest1;
-use mysqltest1;
-create table t1 (a varchar(100));
-sync_slave_with_master;
-use mysqltest1;
-
-# ********************** PART 1 : STORED PROCEDURES ***************
-
-# Does the same proc as on master get inserted into mysql.proc ?
-# (same definer, same properties...)
-
-connection master;
-
-delimiter |;
-
-# Stored procedures don't have the limitations that functions have
-# regarding binlogging: it's ok to create a procedure as not
-# deterministic and updating data, while it's not ok to create such a
-# function. We test this.
-
-create procedure foo()
-begin
- declare b int;
- set b = 8;
- insert into t1 values (b);
- insert into t1 values (unix_timestamp());
-end|
-delimiter ;|
-
-# we replace columns having times
-# (even with fixed timestamp displayed time may changed based on TZ)
---replace_result localhost.localdomain localhost 127.0.0.1 localhost
---replace_column 13 # 14 #
-select * from mysql.proc where name='foo' and db='mysqltest1';
-sync_slave_with_master;
-# You will notice in the result that the definer does not match what
-# it is on master, it is a known bug on which Alik is working
---replace_result localhost.localdomain localhost 127.0.0.1 localhost
---replace_column 13 # 14 #
-select * from mysql.proc where name='foo' and db='mysqltest1';
-
-connection master;
-# see if timestamp used in SP on slave is same as on master
-set timestamp=1000000000;
-call foo();
-select * from t1;
-sync_slave_with_master;
-select * from t1;
-
-# Now a SP which is not updating tables
-
-connection master;
-delete from t1;
-create procedure foo2()
- select * from mysqltest1.t1;
-call foo2();
-
-# check that this is allowed (it's not for functions):
-alter procedure foo2 contains sql;
-
-# SP with definer's right
-
-drop table t1;
-create table t1 (a int);
-create table t2 like t1;
-
-create procedure foo3()
- deterministic
- insert into t1 values (15);
-
-# let's create a non-privileged user
-grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
-grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
-grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
-
-# ToDo: BUG#14931: There is a race between the last grant binlogging, and
-# the binlogging in the new connection made below, causing sporadic test
-# failures due to switched statement order in binlog. To fix this we do
-# SELECT 1 in the first connection before starting the second, ensuring
-# that binlogging is done in the expected order.
-# Please remove this SELECT 1 when BUG#14931 is fixed.
-SELECT 1;
-
-connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,);
-connection con1;
-
-# this routine will fail in the second INSERT because of privileges
-delimiter |;
-create procedure foo4()
- deterministic
- begin
- insert into t2 values(3);
- insert into t1 values (5);
- end|
-
-delimiter ;|
-
-# I add ,0 so that it does not print the error in the test output,
-# because this error is hostname-dependent
---error 1142,0
-call foo4(); # invoker has no INSERT grant on table t1 => failure
-
-connection master;
-call foo3(); # success (definer == root)
-show warnings;
-
---error 1142,0
-call foo4(); # definer's rights => failure
-
-# we test replication of ALTER PROCEDURE
-alter procedure foo4 sql security invoker;
-call foo4(); # invoker's rights => success
-show warnings;
-
-# Note that half-failed procedure calls are ok with binlogging;
-# if we compare t2 on master and slave we see they are identical:
-
-select * from t1;
-select * from t2;
-sync_slave_with_master;
-select * from t1;
-select * from t2;
-
-# Test of DROP PROCEDURE
-
---replace_result localhost.localdomain localhost 127.0.0.1 localhost
---replace_column 13 # 14 #
-select * from mysql.proc where name="foo4" and db='mysqltest1';
-connection master;
-drop procedure foo4;
-select * from mysql.proc where name="foo4" and db='mysqltest1';
-sync_slave_with_master;
-select * from mysql.proc where name="foo4" and db='mysqltest1';
-
-# ********************** PART 2 : FUNCTIONS ***************
-
-connection master;
-drop procedure foo;
-drop procedure foo2;
-drop procedure foo3;
-
-delimiter |;
-# check that needs "deterministic"
---error 1418
-create function fn1(x int)
- returns int
-begin
- insert into t1 values (x);
- return x+2;
-end|
-create function fn1(x int)
- returns int
- deterministic
-begin
- insert into t1 values (x);
- return x+2;
-end|
-
-delimiter ;|
-delete t1,t2 from t1,t2;
-select fn1(20);
-insert into t2 values(fn1(21));
---sorted_result
-select * from t1;
-select * from t2;
-sync_slave_with_master;
---sorted_result
-select * from t1;
-select * from t2;
-
-connection master;
-delimiter |;
-
-drop function fn1;
-
-create function fn1()
- returns int
- no sql
-begin
- return unix_timestamp();
-end|
-
-delimiter ;|
-# check that needs "deterministic"
---error 1418
-alter function fn1 contains sql;
-
-delete from t1;
-set timestamp=1000000000;
-insert into t1 values(fn1());
-
-connection con1;
-
-delimiter |;
---error 1419 # only full-global-privs user can create a function
-create function fn2()
- returns int
- no sql
-begin
- return unix_timestamp();
-end|
-delimiter ;|
-connection master;
-set global log_bin_trust_function_creators=0;
-set global log_bin_trust_function_creators=1;
-# slave needs it too otherwise will not execute what master allowed:
-connection slave;
-set global log_bin_trust_function_creators=1;
-
-connection con1;
-
-delimiter |;
-create function fn2()
- returns int
- no sql
-begin
- return unix_timestamp();
-end|
-delimiter ;|
-
-connection master;
-
-# Now a function which is supposed to not update tables
-# as it's "reads sql data", so should not give error even if
-# non-deterministic.
-
-delimiter |;
-create function fn3()
- returns int
- not deterministic
- reads sql data
-begin
- return 0;
-end|
-delimiter ;|
-
-select fn3();
---replace_result localhost.localdomain localhost 127.0.0.1 localhost
---replace_column 13 # 14 #
-select * from mysql.proc where db='mysqltest1';
-select * from t1;
-
-sync_slave_with_master;
-use mysqltest1;
-select * from t1;
---replace_result localhost.localdomain localhost 127.0.0.1 localhost
---replace_column 13 # 14 #
-select * from mysql.proc where db='mysqltest1';
-
-# ********************** PART 3 : TRIGGERS ***************
-
-connection con1;
-# now fails due to missing trigger grant (err 1142 i/o 1227) due to new
-# check in sql_trigger.cc (v1.44) by anozdrin on 2006/02/01 --azundris
---error ER_TABLEACCESS_DENIED_ERROR
-create trigger trg before insert on t1 for each row set new.a= 10;
-
-connection master;
-delete from t1;
-# TODO: when triggers can contain an update, test that this update
-# does not go into binlog.
-# I'm not setting user vars in the trigger, because replication of user vars
-# would take care of propagating the user var's value to slave, so even if
-# the trigger was not executed on slave it would not be discovered.
-create trigger trg before insert on t1 for each row set new.a= 10;
-insert into t1 values (1);
-select * from t1;
-sync_slave_with_master;
-select * from t1;
-
-connection master;
-delete from t1;
-drop trigger trg;
-insert into t1 values (1);
-select * from t1;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-#show binlog events in 'master-bin.000001' from 106;
-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;
-use test;
-sync_slave_with_master;
-use test;
-
-#
-# Bug#14077 "Failure to replicate a stored function with a cursor":
-# verify that stored routines with cursors work on slave.
-#
-connection master;
---disable_warnings
-drop function if exists f1;
---enable_warnings
-delimiter |;
-create function f1() returns int reads sql data
-begin
- declare var integer;
- declare c cursor for select a from v1;
- open c;
- fetch c into var;
- close c;
- return var;
-end|
-delimiter ;|
-create view v1 as select 1 as a;
-create table t1 (a int);
-insert into t1 (a) values (f1());
-select * from t1;
-drop view v1;
-drop function f1;
-sync_slave_with_master;
-connection slave;
-select * from t1;
-
-#
-# Bug#16621 "INSERTs in Stored Procedures causes data corruption in the Binary
-# Log for 5.0.18"
-#
-
-# Prepare environment.
-
-connection master;
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-# Test case.
-
-CREATE TABLE t1(col VARCHAR(10));
-
-CREATE PROCEDURE p1(arg VARCHAR(10))
- INSERT INTO t1 VALUES(arg);
-
-CALL p1('test');
-
-SELECT * FROM t1;
-
-sync_slave_with_master;
-SELECT * FROM t1;
-
-# Cleanup
-connection master;
-DROP PROCEDURE p1;
-
-
-#
-# BUG#20438: CREATE statements for views, stored routines and triggers can be
-# not replicable.
-#
-
---echo
---echo ---> Test for BUG#20438
-
-# Prepare environment.
-
---echo
---echo ---> Preparing environment...
---echo ---> connection: master
---connection master
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
---echo
---echo ---> Synchronizing slave with master...
-
---save_master_pos
---connection slave
---sync_with_master
-
---echo
---echo ---> connection: master
---connection master
-
-# Test.
-
---echo
---echo ---> Creating procedure...
-
-/*!50003 CREATE PROCEDURE p1() SET @a = 1 */;
-
-/*!50003 CREATE FUNCTION f1() RETURNS INT RETURN 0 */;
-
---echo
---echo ---> Checking on master...
-
-SHOW CREATE PROCEDURE p1;
-SHOW CREATE FUNCTION f1;
-
---echo
---echo ---> Synchronizing slave with master...
-
---save_master_pos
---connection slave
---sync_with_master
-
---echo ---> connection: master
-
---echo
---echo ---> Checking on slave...
-
-SHOW CREATE PROCEDURE p1;
-SHOW CREATE FUNCTION f1;
-
-# Cleanup.
-
---echo
---echo ---> connection: master
---connection master
-
---echo
---echo ---> Cleaning up...
-
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-
---save_master_pos
---connection slave
---sync_with_master
---connection master
-
-
-# cleanup
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# Restore log_bin_trust_function_creators to original value
-set global log_bin_trust_function_creators=0;
-connection master;
-set global log_bin_trust_function_creators=0;
---echo End of 5.0 tests
-
-#
-# Bug22043: MySQL don't add "USE <DATABASE>" before "DROP PROCEDURE IF EXISTS"
-#
-connection master;
-reset master;
---disable_warnings
-drop database if exists mysqltest;
-drop database if exists mysqltest2;
---enable_warnings
-create database mysqltest;
-create database mysqltest2;
-use mysqltest2;
-create table t ( t integer );
-create procedure mysqltest.test() begin end;
-insert into t values ( 1 );
-#show binlog events in 'master-bin.000001' from 106;
---error ER_BAD_DB_ERROR
-create procedure `\\`.test() begin end;
-# Clean up
-drop database mysqltest;
-drop database mysqltest2;
-
---echo End of 5.1 tests
+--source suite/rpl/t/rpl_sp.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_sp004.test b/mysql-test/suite/engines/funcs/t/rpl_sp004.test
index 967e7007c15..ca5c802b279 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_sp004.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_sp004.test
@@ -1,97 +1,2 @@
-#############################################################################
-# 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. #
-#############################################################################
+--source suite/rpl/t/rpl_sp004.test
-
-# Includes
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t3;
---enable_warnings
-# End of cleanup
-
-# Begin test section 1
-
-delimiter |;
-CREATE PROCEDURE test.p1()
-BEGIN
- CREATE TABLE IF NOT EXISTS test.t1(a INT,PRIMARY KEY(a));
- CREATE TABLE IF NOT EXISTS test.t2(a INT,PRIMARY KEY(a));
- INSERT INTO test.t1 VALUES (4),(2),(1),(3);
- UPDATE test.t1 SET a=a+4 WHERE a=4;
- INSERT INTO test.t2 (a) SELECT t1.a FROM test.t1;
- UPDATE test.t1 SET a=a+4 WHERE a=8;
- CREATE TABLE IF NOT EXISTS test.t3(n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
-END|
-CREATE PROCEDURE test.p2()
-BEGIN
- DROP TABLE IF EXISTS test.t1;
- DROP TABLE IF EXISTS test.t2;
- INSERT INTO test.t3 VALUES(NULL,11111111.233333,NOW());
-END|
-delimiter ;|
-
-CALL test.p1();
-SELECT * FROM test.t1 ORDER BY a;
-SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t1 ORDER BY a;
-SELECT * FROM test.t2 ORDER BY a;
-
-connection master;
-CALL test.p2();
-USE test;
-SHOW TABLES;
-#SELECT * FROM test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
-USE test;
-SHOW TABLES;
-#SELECT * FROM test.t3;
-
-connection master;
-CALL test.p1();
-SELECT * FROM test.t1 ORDER BY a;
-SELECT * FROM test.t2 ORDER BY a;
-#SELECT * FROM test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t1 ORDER BY a;
-SELECT * FROM test.t2 ORDER BY a;
-#SELECT * FROM test.t3;
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_slave.sql
-
-# Cleanup
-connection master;
-#show binlog events;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
-sync_slave_with_master;
-
-# If the test fails, you will need to diff the dumps to see why.
-
-diff_files $MYSQLTEST_VARDIR/tmp/sp004_master.sql $MYSQLTEST_VARDIR/tmp/sp004_slave.sql;
-
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test b/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test
index 94ce539291d..29b27c728e4 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test
@@ -1,208 +1,2 @@
-##########################################
-# Change Author: JBM
-# Change Date: 2006-05-02
-##########################################
+--source suite/rpl/t/rpl_sp_effects.test
-# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
--- source include/master-slave.inc
-
-# ****************************************************************
-connection master;
-
-# cleanup
---disable_warnings
-drop procedure if exists p1;
-drop procedure if exists p2;
-drop function if exists f1;
-drop table if exists t1,t2;
-drop view if exists v1;
---enable_warnings
-create table t1 (a int);
-
-SET GLOBAL log_bin_trust_function_creators = 1;
-
-# 1. Test simple variables use.
-delimiter //;
-create procedure p1()
-begin
- declare spv int default 0;
- while spv < 5 do
- insert into t1 values(spv+1);
- set spv=spv+1;
- end while;
-end//
-delimiter ;//
-
-call p1();
-
-sync_slave_with_master;
-connection slave;
-SELECT * FROM t1 ORDER BY a;
-connection master;
-SELECT * FROM t1 ORDER BY a;
-
-# 2. Test SP variable name
-delimiter //;
-create procedure p2()
-begin
- declare a int default 4;
- create table t2 as select a;
-end//
-delimiter ;//
-
-call p2();
-SELECT * FROM t2 ORDER BY a;
-sync_slave_with_master;
-connection slave;
-SELECT * FROM t2 ORDER BY a;
-
-connection master;
-drop procedure p1;
-drop procedure p2;
-drop table t2;
-
-# 3. Test FUNCTIONs in various places
-
-delimiter //;
-create function f1(x int) returns int
-begin
- insert into t1 values(x);
- return x+1;
-end//
-
-create procedure p1(a int, b int)
-begin
- declare v int default f1(5);
- if (f1(6)) then
- select 'yes';
- end if;
- set v = f1(7);
- while f1(8) < 1 do
- select 'this cant be';
- end while;
-
-end//
-delimiter ;//
-
-call p1(f1(1), f1(2));
-SELECT * FROM t1 ORDER BY a;
-
-create table t2(a int);
-insert into t2 values (10),(11);
-SELECT a,f1(a) FROM t2 ORDER BY a;
-
-# This shouldn't put separate 'call f1(3)' into binlog:
-insert into t2 select f1(3);
-SELECT 'master:',a FROM t1 ORDER BY a;
-
-sync_slave_with_master;
-connection slave;
-SELECT 'slave:',a FROM t1 ORDER BY a;
-
-connection master;
-drop procedure p1;
-delete from t1;
-delete from t2;
-
-# 4. VIEWs
-delete from t1;
-insert into t2 values(1),(2);
-create view v1 as select f1(a) as f from t2;
-select * from v1 order by f;
-SELECT 'master:',a FROM t1 ORDER BY a;
-
-sync_slave_with_master;
-connection slave;
-SELECT 'slave:',a FROM t1 ORDER BY a;
-
-connection master;
-drop view v1;
-delete from t1;
-
-# 5. Prepared statements.
-prepare s1 from 'select f1(?)';
-set @xx=123;
-execute s1 using @xx;
-SELECT 'master:',a FROM t1 ORDER BY a;
-
-sync_slave_with_master;
-connection slave;
-SELECT 'slave:',a FROM t1 ORDER BY a;
-
-connection master;
-delete from t1;
-
-# 5. Cursors.
-# t2 has (1),(2);
-delimiter //;
-create procedure p1(spv int)
-begin
- declare c cursor for select f1(spv) from t2;
- while (spv > 2) do
- open c;
- fetch c into spv;
- close c;
- set spv= spv - 10;
- end while;
-end//
-delimiter ;//
-call p1(15);
-SELECT 'master:',a FROM t1 ORDER BY a;
-sync_slave_with_master;
-connection slave;
-SELECT 'slave:',a FROM t1 ORDER BY a;
-
-connection master;
-drop procedure p1;
-drop function f1;
-drop table t1,t2;
-
-# BUG#12637: User variables + SPs replication
-create table t1 (a int);
-delimiter //;
-create procedure p1()
-begin
- insert into t1 values(@x);
- set @x=@x+1;
- insert into t1 values(@x);
- if (f2()) then
- insert into t1 values(1243);
- end if;
-end//
-
-create function f2() returns int
-begin
- insert into t1 values(@z);
- set @z=@z+1;
- insert into t1 values(@z);
- return 0;
-end//
-
-create function f1() returns int
-begin
- insert into t1 values(@y);
- call p1();
- return 0;
-end//
-
-delimiter ;//
-
-set @x=10;
-set @y=20;
-set @z=100;
-select f1();
-
-set @x=30;
-call p1();
-
-SELECT 'master', a FROM t1 ORDER BY a;
-sync_slave_with_master;
-connection slave;
-SELECT 'slave', a FROM t1 ORDER BY a;
-
-connection master;
-drop table t1;
-drop function f1;
-drop function f2;
-drop procedure p1;
-sync_slave_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test b/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test
index 19988cf902a..632a1a0232c 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test
@@ -1,10 +1,10 @@
-source include/master-slave.inc;
+--source include/master-slave.inc
#
# Bug#6148 ()
#
connection slave;
-stop slave;
+--source include/stop_slave.inc
# Let the master do lots of insertions
connection master;
@@ -17,20 +17,19 @@ while ($1)
dec $1;
}
enable_query_log;
-save_master_pos;
connection slave;
-start slave;
-sleep 1;
-stop slave io_thread;
+--source include/start_slave.inc
+--source include/stop_slave_io.inc
start slave io_thread;
-sync_with_master;
+--source include/wait_for_slave_io_to_start.inc
connection master;
-drop table t1;
-save_master_pos;
+--sync_slave_with_master
-connection slave;
-sync_with_master;
+connection master;
+drop table t1;
+--sync_slave_with_master
-# End of 4.1 tests
+# End of test
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test b/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test
index 017593fdfba..ca1b14201d3 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test
@@ -20,7 +20,7 @@
# 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;
+--sync_slave_with_master
insert into t1 values (2,'old');
connection master;
insert into t1 values(NULL,'new');
@@ -31,13 +31,13 @@ connection slave;
wait_for_slave_to_stop;
select * from t1 order by n;
delete from t1 where n = 2;
---disable_warnings
-start slave;
---enable_warnings
+
+--source include/start_slave.inc
+
sync_with_master;
#now the buggy slave would be confused on the offset but it can replicate
#in order to make it break, we need to stop/start the slave one more time
-stop slave;
+--source include/stop_slave.inc
connection master;
# to be able to really confuse the slave, we need some non-auto-increment
# events in the log
@@ -51,9 +51,9 @@ set sql_log_bin=1;
delete from t1 where n=4;
save_master_pos;
connection slave;
---disable_warnings
-start slave;
---enable_warnings
+
+--source include/start_slave.inc
+
#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;
@@ -61,6 +61,6 @@ select * from t1 order by n;
#clean up
connection master;
drop table t1;
-sync_slave_with_master;
-
+--sync_slave_with_master
+--source include/rpl_end.inc
# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test b/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test
index 66dc89bd712..e1f920b0928 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test
@@ -1,93 +1,2 @@
-# 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 suite/rpl/t/rpl_stm_no_op.test
--- source include/have_binlog_format_mixed_or_statement.inc
-
-source include/master-slave.inc;
-
-# see if DROP DATABASE is binlogged even if no effect
-connection slave;
-create database mysqltest;
-connection master;
-drop database if exists mysqltest;
-sync_slave_with_master;
-# can't read dir
---replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" \\ /
---error 1049
-show tables from mysqltest;
-
-# see if DROP TABLE is binlogged even if no effect
-connection slave;
-create table t1 (a int);
-connection master;
-drop table if exists t1;
-sync_slave_with_master;
-# table does not exist
---error 1146
-select * from t1;
-
-# see if single-table DELETE is binlogged even if no effect
-connection master;
-create table t1 (a int, b int);
-sync_slave_with_master;
-insert into t1 values(1,1);
-connection master;
-delete from t1;
-sync_slave_with_master;
-select * from t1;
-
-# see if single-table UPDATE is binlogged even if no effect
-insert into t1 values(1,1);
-connection master;
-insert into t1 values(2,1);
-update t1 set a=2;
-sync_slave_with_master;
-select * from t1;
-
-# End of 4.1 tests
-
-# see if multi-table UPDATE is binlogged even if no effect (BUG#13348)
-
-connection master;
-create table t2 (a int, b int);
-delete from t1;
-insert into t1 values(1,1);
-insert into t2 values(1,1);
-
-sync_slave_with_master;
-# force a difference to see if master's multi-UPDATE will correct it
-update t1 set a=2;
-
-connection master;
-UPDATE t1, t2 SET t1.a = t2.a;
-
-sync_slave_with_master;
-select * from t1;
-select * from t2;
-
-# See if multi-table DELETE is binlogged even if no effect
-
-connection master;
-delete from t1;
-delete from t2;
-
-sync_slave_with_master;
-# force a difference to see if master's multi-DELETE will correct it
-insert into t1 values(1,1);
-insert into t2 values(1,1);
-
-connection master;
-DELETE t1.*, t2.* from t1, t2;
-
-sync_slave_with_master;
-select * from t1;
-select * from t2;
-
-
-# cleanup
-connection master;
-drop table t1, t2;
-sync_slave_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
index 396ba4073e4..2a16d90f9ad 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
@@ -1,564 +1 @@
--- source include/master-slave.inc
-
-connection default;
-set @saved_binlog_format = @@global.binlog_format;
-
-# Since this test generates row-based events in the binary log, the
-# slave SQL thread cannot be in STATEMENT mode to execute this test,
-# so we only execute it for MIXED and ROW as default value of
-# BINLOG_FORMAT.
-
-connection slave;
--- source include/have_binlog_format_mixed_or_row.inc
-
-connection master;
---disable_warnings
-drop database if exists mysqltest1;
-create database mysqltest1;
---enable_warnings
-use mysqltest1;
-set session binlog_format=row;
-set global binlog_format=row;
-
-show global variables like "binlog_format%";
-show session variables like "binlog_format%";
-select @@global.binlog_format, @@session.binlog_format;
-
-CREATE TABLE t1 (a varchar(100));
-
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
-set @string="emergency_1_";
-insert into t1 values("work_2_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_3_"));
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values(concat("for_4_",UUID()));
-insert into t1 select "yesterday_5_";
-
-# verify that temp tables prevent a switch to SBR
-create temporary table tmp(a char(100));
-insert into tmp values("see_6_");
---error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
-set binlog_format=statement;
-insert into t1 select * from tmp;
-drop temporary table tmp;
-
-# Now we go to SBR
-set binlog_format=statement;
-show global variables like "binlog_format%";
-show session variables like "binlog_format%";
-select @@global.binlog_format, @@session.binlog_format;
-set global binlog_format=statement;
-show global variables like "binlog_format%";
-show session variables like "binlog_format%";
-select @@global.binlog_format, @@session.binlog_format;
-
-prepare stmt1 from 'insert into t1 select ?';
-set @string="emergency_7_";
-insert into t1 values("work_8_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values("work_9_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values("for_10_");
-insert into t1 select "yesterday_11_";
-
-# test SET DEFAULT (=statement at this point of test)
-set binlog_format=default;
-select @@global.binlog_format, @@session.binlog_format;
-# due to cluster it's hard to set back to default
-#--error ER_NO_DEFAULT
-set global binlog_format=default;
-select @@global.binlog_format, @@session.binlog_format;
-
-prepare stmt1 from 'insert into t1 select ?';
-set @string="emergency_12_";
-insert into t1 values("work_13_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values("work_14_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values("for_15_");
-insert into t1 select "yesterday_16_";
-
-# and now the mixed mode
-
-set binlog_format=mixed;
-select @@global.binlog_format, @@session.binlog_format;
-set global binlog_format=mixed;
-select @@global.binlog_format, @@session.binlog_format;
-
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
-set @string="emergency_17_";
-insert into t1 values("work_18_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_19_"));
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values(concat("for_20_",UUID()));
-insert into t1 select "yesterday_21_";
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_22_"));
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values(concat("for_23_",UUID()));
-insert into t1 select "yesterday_24_";
-
-# Test of CREATE TABLE SELECT
-
-create table t2 select rpad(UUID(),100,' ');
-create table t3 select 1 union select UUID();
-create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
-create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
-# what if UUID() is first:
---disable_warnings
-insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
---enable_warnings
-
-# inside a stored procedure
-
-delimiter |;
-create procedure foo()
-begin
-insert into t1 values("work_25_");
-insert into t1 values(concat("for_26_",UUID()));
-insert into t1 select "yesterday_27_";
-end|
-create procedure foo2()
-begin
-insert into t1 values(concat("emergency_28_",UUID()));
-insert into t1 values("work_29_");
-insert into t1 values(concat("for_30_",UUID()));
-set session binlog_format=row; # accepted for stored procs
-insert into t1 values("more work_31_");
-set session binlog_format=mixed;
-end|
-create function foo3() returns bigint unsigned
-begin
- set session binlog_format=row; # rejected for stored funcs
- insert into t1 values("alarm");
- return 100;
-end|
-create procedure foo4(x varchar(100))
-begin
-insert into t1 values(concat("work_250_",x));
-insert into t1 select "yesterday_270_";
-end|
-delimiter ;|
-call foo();
-call foo2();
-call foo4("hello");
-call foo4(UUID());
-call foo4("world");
-
-# test that can't SET in a stored function
---error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
-select foo3();
-select * from t1 where a="alarm";
-
-# Tests of stored functions/triggers/views for BUG#20930 "Mixed
-# binlogging mode does not work with stored functions, triggers,
-# views"
-
-# Function which calls procedure
-drop function foo3;
-delimiter |;
-create function foo3() returns bigint unsigned
-begin
- insert into t1 values("foo3_32_");
- call foo();
- return 100;
-end|
-delimiter ;|
-insert into t2 select foo3();
-
-prepare stmt1 from 'insert into t2 select foo3()';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# Test if stored function calls stored function which calls procedure
-# which requires row-based.
-
-delimiter |;
-create function foo4() returns bigint unsigned
-begin
- insert into t2 select foo3();
- return 100;
-end|
-delimiter ;|
-select foo4();
-
-prepare stmt1 from 'select foo4()';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# A simple stored function
-delimiter |;
-create function foo5() returns bigint unsigned
-begin
- insert into t2 select UUID();
- return 100;
-end|
-delimiter ;|
-select foo5();
-
-prepare stmt1 from 'select foo5()';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# A simple stored function where UUID() is in the argument
-delimiter |;
-create function foo6(x varchar(100)) returns bigint unsigned
-begin
- insert into t2 select x;
- return 100;
-end|
-delimiter ;|
-select foo6("foo6_1_");
-select foo6(concat("foo6_2_",UUID()));
-
-prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-
-# Test of views using UUID()
-
-create view v1 as select uuid();
-create table t11 (data varchar(255));
-insert into t11 select * from v1;
-# Test of querying INFORMATION_SCHEMA which parses the view's body,
-# to verify that it binlogs statement-based (is not polluted by
-# the parsing of the view's body).
-insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
-prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# Test of triggers with UUID()
-delimiter |;
-create trigger t11_bi before insert on t11 for each row
-begin
- set NEW.data = concat(NEW.data,UUID());
-end|
-delimiter ;|
-insert into t11 values("try_560_");
-
-# DELAYED option not supported by table created
-# using innodb.
-# Test that INSERT DELAYED works in mixed mode (BUG#20649)
-#insert delayed into t2 values("delay_1_");
-#insert delayed into t2 values(concat("delay_2_",UUID()));
-#insert delayed into t2 values("delay_6_");
-
-# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not
-# replicate fine in statement-based ; we test that in mixed mode it
-# works).
-#insert delayed into t2 values(rand());
-#set @a=2.345;
-#insert delayed into t2 values(@a);
-
-sleep 4; # time for the delayed inserts to reach disk
-
-# If you want to do manual testing of the mixed mode regarding UDFs (not
-# testable automatically as quite platform- and compiler-dependent),
-# you just need to set the variable below to 1, and to
-# "make udf_example.so" in sql/, and to copy sql/udf_example.so to
-# MYSQL_TEST_DIR/lib/mysql.
-let $you_want_to_test_UDF=0;
-if ($you_want_to_test_UDF)
-{
- CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
- prepare stmt1 from 'insert into t1 select metaphon(?)';
- set @string="emergency_133_";
- insert into t1 values("work_134_");
- execute stmt1 using @string;
- deallocate prepare stmt1;
- prepare stmt1 from 'insert into t1 select ?';
- insert into t1 values(metaphon("work_135_"));
- execute stmt1 using @string;
- deallocate prepare stmt1;
- insert into t1 values(metaphon("for_136_"));
- insert into t1 select "yesterday_137_";
- create table t6 select metaphon("for_138_");
- create table t7 select 1 union select metaphon("for_139_");
- create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3);
- create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
-}
-
-create table t20 select * from t1; # save for comparing later
-create table t21 select * from t2;
-create table t22 select * from t3;
-drop table t1,t2,t3;
-
-# This tests the fix to
-# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog
-# We verify that under the mixed binlog mode, a stored function
-# modifying at least two tables having an auto_increment column,
-# is binlogged row-based. Indeed in statement-based binlogging,
-# only the auto_increment value generated for the first table
-# is recorded in the binlog, the value generated for the 2nd table
-# lacking.
-
-create table t1 (a int primary key auto_increment, b varchar(100));
-create table t2 (a int primary key auto_increment, b varchar(100));
-create table t3 (b varchar(100));
-delimiter |;
-create function f (x varchar(100)) returns int deterministic
-begin
- insert into t1 values(null,x);
- insert into t2 values(null,x);
- return 1;
-end|
-delimiter ;|
-select f("try_41_");
-# Two operations which compensate each other except that their net
-# effect is that they advance the auto_increment counter of t2 on slave:
-sync_slave_with_master;
-use mysqltest1;
-insert into t2 values(2,null),(3,null),(4,null);
-delete from t2 where a>=2;
-
-connection master;
-# this is the call which didn't replicate well
-select f("try_42_");
-sync_slave_with_master;
-
-# now use prepared statement and test again, just to see that the RBB
-# mode isn't set at PREPARE but at EXECUTE.
-
-insert into t2 values(3,null),(4,null);
-delete from t2 where a>=3;
-
-connection master;
-prepare stmt1 from 'select f(?)';
-set @string="try_43_";
-insert into t1 values(null,"try_44_"); # should be SBB
-execute stmt1 using @string; # should be RBB
-deallocate prepare stmt1;
-sync_slave_with_master;
-
-# verify that if only one table has auto_inc, it does not trigger RBB
-# (we'll check in binlog further below)
-
-connection master;
-create table t12 select * from t1; # save for comparing later
-drop table t1;
-create table t1 (a int, b varchar(100), key(a));
-select f("try_45_");
-
-# restore table's key
-create table t13 select * from t1;
-drop table t1;
-create table t1 (a int primary key auto_increment, b varchar(100));
-
-# now test if it's two functions, each of them inserts in one table
-
-drop function f;
-# we need a unique key to have sorting of rows by mysqldump
-create table t14 (unique (a)) select * from t2;
-truncate table t2;
-delimiter |;
-create function f1 (x varchar(100)) returns int deterministic
-begin
- insert into t1 values(null,x);
- return 1;
-end|
-create function f2 (x varchar(100)) returns int deterministic
-begin
- insert into t2 values(null,x);
- return 1;
-end|
-delimiter ;|
-select f1("try_46_"),f2("try_47_");
-
-sync_slave_with_master;
-insert into t2 values(2,null),(3,null),(4,null);
-delete from t2 where a>=2;
-
-connection master;
-# Test with SELECT and INSERT
-select f1("try_48_"),f2("try_49_");
-insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
-sync_slave_with_master;
-
-# verify that if f2 does only read on an auto_inc table, this does not
-# switch to RBB
-connection master;
-drop function f2;
-delimiter |;
-create function f2 (x varchar(100)) returns int deterministic
-begin
- declare y int;
- insert into t1 values(null,x);
- set y = (select count(*) from t2);
- return y;
-end|
-delimiter ;|
-select f1("try_53_"),f2("try_54_");
-sync_slave_with_master;
-
-# And now, a normal statement with a trigger (no stored functions)
-
-connection master;
-drop function f2;
-delimiter |;
-create trigger t1_bi before insert on t1 for each row
-begin
- insert into t2 values(null,"try_55_");
-end|
-delimiter ;|
-insert into t1 values(null,"try_56_");
-# and now remove one auto_increment and verify SBB
-alter table t1 modify a int, drop primary key;
-insert into t1 values(null,"try_57_");
-sync_slave_with_master;
-
-# Test for BUG#20499 "mixed mode with temporary table breaks binlog"
-# Slave used to have only 2 rows instead of 3.
-connection master;
-CREATE TEMPORARY TABLE t15 SELECT UUID();
-create table t16 like t15;
-INSERT INTO t16 SELECT * FROM t15;
-# we'll verify that this one is done RBB
-insert into t16 values("try_65_");
-drop table t15;
-# we'll verify that this one is done SBB
-insert into t16 values("try_66_");
-sync_slave_with_master;
-
-# and now compare:
-
-connection master;
-
-# first check that data on master is sensible
-select count(*) from t1;
-select count(*) from t2;
-select count(*) from t3;
-select count(*) from t4;
-select count(*) from t5;
-select count(*) from t11;
-select count(*) from t20;
-select count(*) from t21;
-select count(*) from t22;
-select count(*) from t12;
-select count(*) from t13;
-select count(*) from t14;
-select count(*) from t16;
-if ($you_want_to_test_UDF)
-{
- select count(*) from t6;
- select count(*) from t7;
- select count(*) from t8;
- select count(*) from t9;
-}
-
-sync_slave_with_master;
-
-#
-# Bug#20863 If binlog format is changed between update and unlock of
-# tables, wrong binlog
-#
-
-connection master;
-DROP TABLE IF EXISTS t11;
-SET SESSION BINLOG_FORMAT=STATEMENT;
-CREATE TABLE t11 (song VARCHAR(255));
-LOCK TABLES t11 WRITE;
-SET SESSION BINLOG_FORMAT=ROW;
-INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
-SET SESSION BINLOG_FORMAT=STATEMENT;
-INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
-UNLOCK TABLES;
-
---query_vertical SELECT * FROM t11
-sync_slave_with_master;
-USE mysqltest1;
---query_vertical SELECT * FROM t11
-
-connection master;
-DROP TABLE IF EXISTS t12;
-SET SESSION BINLOG_FORMAT=MIXED;
-CREATE TABLE t12 (data LONG);
-LOCK TABLES t12 WRITE;
-INSERT INTO t12 VALUES(UUID());
-UNLOCK TABLES;
-
---disable_result_log
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events;
---enable_result_log
-sync_slave_with_master;
-
-# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
-
-# Let's compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching
-
-diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
-
-connection master;
---disable_result_log
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events;
---enable_result_log
-
-# Now test that mysqlbinlog works fine on a binlog generated by the
-# mixed mode
-
-# BUG#11312 "DELIMITER is not written to the binary log that causes
-# syntax error" makes that mysqlbinlog will fail if we pass it the
-# text of queries; this forces us to use --base64-output here.
-
-# BUG#20929 "BINLOG command causes invalid free plus assertion
-# failure" makes mysqld segfault when receiving --base64-output
-
-# So I can't enable this piece of test
-# SIGH
-
-if ($enable_when_11312_or_20929_fixed)
-{
---exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
-drop database mysqltest1;
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
-# the old mysqldump output on slave is the same as what it was on
-# master before restoring on master.
-diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
-}
-
-drop database mysqltest1;
-sync_slave_with_master;
-
-connection default;
-set global binlog_format= @saved_binlog_format;
+--source suite/rpl/include/rpl_switch_stm_row_mixed.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_temp_table.test b/mysql-test/suite/engines/funcs/t/rpl_temp_table.test
index c13470f20b6..43b5ce49129 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_temp_table.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_temp_table.test
@@ -1,69 +1,2 @@
-# drop table t1 t2 t3 are included int master-slave.inc
-# meaningful only in statement-based:
+--source suite/rpl/t/rpl_temp_table.test
--- source include/have_binlog_format_mixed_or_statement.inc
--- source include/master-slave.inc
-
---disable_query_log
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-
-create table t2 (n int, PRIMARY KEY(n));
-create temporary table t1 (n int);
-create temporary table t3 (n int not null);
-
-insert into t1 values(1),(2),(3),(100),(25),(26),(200),(300);
---disable_warnings
-insert into t2 select * from t1;
---enable_warnings
-alter table t3 add primary key(n);
-
-flush logs;
-insert into t3 values (1010);
---disable_warnings
-insert into t2 select * from t3;
---enable_warnings
-
-drop table if exists t3;
-insert into t2 values (1012);
-
-connection master1;
-create temporary table t1 (n int);
-insert into t1 values (4),(5);
---disable_warnings
-insert into t2 select * from t1;
---enable_warnings
-
-save_master_pos;
-disconnect master;
-
-connection slave;
-#add 1 to the saved position, so we will catch drop table on disconnect
-#for sure
-sync_with_master 1;
-
-connection master1;
-insert into t2 values(61);
-
-save_master_pos;
-disconnect master1;
-
-connection slave;
-#same trick - make sure we catch drop of temporary table on disconnect
-sync_with_master 1;
-
-select * from t2;
-select count(*) from t2;
-select sum(n) from t2;
-show status like 'Slave_open_temp_tables';
-
-#
-# Clean up
-#
-connect (master2,localhost,root,,);
-connection master2;
-drop table if exists t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_temporary.test b/mysql-test/suite/engines/funcs/t/rpl_temporary.test
index aa90a5153bf..460ea55a675 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_temporary.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_temporary.test
@@ -1,235 +1,2 @@
+--source suite/rpl/t/rpl_temporary.test
--- source include/master-slave.inc
-
-# Clean up old slave's binlogs.
-# The slave is started with --log-slave-updates
-# and this test does SHOW BINLOG EVENTS on the slave's
-# binlog. But previous tests can influence the current test's
-# binlog (e.g. a temporary table in the previous test has not
-# been explicitly deleted, or it has but the slave hasn't had
-# enough time to catch it before STOP SLAVE,
-# and at the beginning of the current
-# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
-# We wait for the slave to have written all he wants to the binlog
-# (otherwise RESET MASTER may come too early).
-save_master_pos;
-connection slave;
-sync_with_master;
-reset master;
-connection master;
-
---disable_query_log
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-connect (con1,localhost,root,,);
-
-#added on 2007/5/18
-connection con1;
-CREATE USER ''@localhost;
-
-connect (con2,localhost,root,,);
-# We want to connect as an unprivileged user. But if we use user="" then this
-# will pick the Unix login, which will cause problems if you're running the test
-# as root.
-connect (con3,localhost,zedjzlcsjhd,,);
-
-# We are going to use SET PSEUDO_THREAD_ID in this test;
-# check that it requires the SUPER privilege.
-
-connection con3;
-SET @save_select_limit=@@session.sql_select_limit;
---error 1227
-SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
-SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed
-# While we are here we also test that SQL_LOG_BIN can't be set
---error 1227
-SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
-SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed
-# Now as root, to be sure it works
-connection con2;
-SET @@session.pseudo_thread_id=100;
-SET @@session.pseudo_thread_id=connection_id();
-SET @@session.sql_log_bin=0;
-SET @@session.sql_log_bin=1;
-
-connection con3;
-let $VERSION=`select version()`;
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1(f int);
-create table t2(f int);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-
-connection con1;
-create temporary table t3(f int);
---disable_warnings
-insert into t3 select * from t1 where f<6;
---enable_warnings
-sleep 1;
-
-connection con2;
-create temporary table t3(f int);
-sleep 1;
-
-connection con1;
---disable_warnings
-insert into t2 select count(*) from t3;
---enable_warnings
-sleep 1;
-
-connection con2;
---disable_warnings
-insert into t3 select * from t1 where f>=4;
---enable_warnings
-sleep 1;
-
-connection con1;
-drop temporary table t3;
-sleep 1;
-
-connection con2;
---disable_warnings
-insert into t2 select count(*) from t3;
---enable_warnings
-drop temporary table t3;
-
-select * from t2 ORDER BY f;
-
-# Commented out 8/30/2005 to make compatable with both sbr and rbr
-#--replace_result $VERSION VERSION
-#--replace_column 2 # 5 #
-#show binlog events;
-
-drop table t1, t2;
-
-use test;
-SET TIMESTAMP=1040323920;
-create table t1(f int);
-SET TIMESTAMP=1040323931;
-create table t2(f int);
-SET TIMESTAMP=1040323938;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-
-SET TIMESTAMP=1040323945;
-SET @@session.pseudo_thread_id=1;
-create temporary table t3(f int);
-SET TIMESTAMP=1040323952;
-SET @@session.pseudo_thread_id=1;
---disable_warnings
-insert into t3 select * from t1 where f<6;
---enable_warnings
-SET TIMESTAMP=1040324145;
-SET @@session.pseudo_thread_id=2;
-create temporary table t3(f int);
-SET TIMESTAMP=1040324186;
-SET @@session.pseudo_thread_id=1;
---disable_warnings
-insert into t2 select count(*) from t3;
---enable_warnings
-SET TIMESTAMP=1040324200;
-SET @@session.pseudo_thread_id=2;
---disable_warnings
-insert into t3 select * from t1 where f>=4;
---enable_warnings
-SET TIMESTAMP=1040324211;
-SET @@session.pseudo_thread_id=1;
-drop temporary table t3;
-SET TIMESTAMP=1040324219;
-SET @@session.pseudo_thread_id=2;
---disable_warnings
-insert into t2 select count(*) from t3;
---enable_warnings
-SET TIMESTAMP=1040324224;
-SET @@session.pseudo_thread_id=2;
-drop temporary table t3;
-
-select * from t2 ORDER BY f;
-drop table t1,t2;
-
-# Create last a temporary table that is not dropped at end to ensure that we
-# don't get any memory leaks for this
-
-create temporary table t3 (f int);
-#sync_with_master;
-
-# The server will now close done
-
-#
-# Bug#17284 erroneous temp table cleanup on slave
-#
-
-connection master;
-create temporary table t4 (f int);
-create table t5 (f int);
-#sync_with_master;
-# find dumper's $id
-select id from information_schema.processlist where command='Binlog Dump' into @id;
-kill @id; # to stimulate reconnection by slave w/o timeout
---disable_warnings
-insert into t5 select * from t4;
---enable_warnings
-save_master_pos;
-
-connection slave;
-sync_with_master;
-select * from t5 /* must be 1 after reconnection */;
-
-connection master;
-drop temporary table t4;
-drop table t5;
-
-#
-# BUG#17263 incorrect generation DROP temp tables
-# Temporary tables of connection are dropped in batches
-# where a batch correspond to pseudo_thread_id
-# value was set up at the moment of temp table creation
-#
-connection con1;
-set @@session.pseudo_thread_id=100;
-create temporary table t101 (id int);
-create temporary table t102 (id int);
-set @@session.pseudo_thread_id=200;
-create temporary table t201 (id int);
-create temporary table `t``201` (id int);
-# emulate internal temp table not to come to binlog
-create temporary table `#sql_not_user_table202` (id int);
-set @@session.pseudo_thread_id=300;
-create temporary table t301 (id int);
-create temporary table t302 (id int);
-create temporary table `#sql_not_user_table303` (id int);
-
-
-#Added on 2007/5/18
-DROP USER ''@localhost;
-
-disconnect con1;
-
-#now do something to show that slave is ok after DROP temp tables
-connection master;
-create table t1(f int);
-insert into t1 values (1);
-
-sync_slave_with_master;
-#connection slave;
-select * from t1 /* must be 1 */;
-
-connection master;
-drop table t1;
-
-#
-#14157: utf8 encoding in binlog without set character_set_client
-#
-exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=latin1 test -e "create table t1 (a int); set names latin1; create temporary table äöüÄÖÜ (a int); insert into äöüÄÖÜ values (1); insert into t1 select * from äöüÄÖÜ";
-
-sync_slave_with_master;
-#connection slave;
-select * from t1;
-
-connection master;
-drop table t1;
-
-# End of 5.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_trigger.test b/mysql-test/suite/engines/funcs/t/rpl_trigger.test
index 77cc7a3b2c0..4f61e738200 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_trigger.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_trigger.test
@@ -5,16 +5,7 @@
--source include/have_binlog_format_mixed_or_statement.inc
--source include/master-slave.inc
-disable_query_log;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-enable_query_log;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP TABLE IF EXISTS t3;
-
---enable_warnings
#
# #12482: Triggers has side effects with auto_increment values
@@ -45,19 +36,16 @@ SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186;
--disable_warnings
insert into t1 values(1,1,rand()),(NULL,2,rand());
insert into t2 (b) values(last_insert_id());
-insert into t2 values(3,0),(NULL,0);
-insert into t2 values(NULL,0),(500,0);
+insert into t2 values(3,0);
+insert into t2 values(NULL,0);
+insert into t2 values(NULL,0);
+insert into t2 values(500,0);
--enable_warnings
select a,b, truncate(rand_value,4) from t1;
select * from t2;
select a,name, old_a, old_b, truncate(rand_value,4) from t3;
-save_master_pos;
-connection slave;
-sync_with_master;
---disable_query_log
-select "--- On slave --" as "";
---enable_query_log
+--sync_slave_with_master
select a,b, truncate(rand_value,4) from t1;
select * from t2;
select a,name, old_a, old_b, truncate(rand_value,4) from t3;
@@ -109,17 +97,14 @@ let $time=`select a from t1`;
# - dump definers on the slave;
SELECT routine_name, definer
-FROM information_schema.routines;
+FROM information_schema.routines
+WHERE routine_name = 'bug12480';
SELECT trigger_name, definer
-FROM information_schema.triggers;
+FROM information_schema.triggers
+WHERE trigger_name = 't1_first';
-save_master_pos;
-connection slave;
-sync_with_master;
---disable_query_log
-select "--- On slave --" as "";
---enable_query_log
+--sync_slave_with_master
# XXX: Definers of stored procedures and functions are not replicated. WL#2897
# (Complete definer support in the stored routines) addresses this issue. So,
@@ -127,10 +112,12 @@ select "--- On slave --" as "";
# item.
SELECT routine_name, definer
-FROM information_schema.routines;
+FROM information_schema.routines
+WHERE routine_name = 'bug12480';
SELECT trigger_name, definer
-FROM information_schema.triggers;
+FROM information_schema.triggers
+WHERE trigger_name = 't1_first';
select a=b && a=c from t1;
--disable_query_log
@@ -170,9 +157,7 @@ create database other;
use other;
insert into test.t1 values (1);
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
connection master;
use test;
@@ -219,7 +204,7 @@ while ($rnd)
dec $i;
}
- sync_slave_with_master;
+ --sync_slave_with_master
#connection slave;
eval select * from t1$rnd;
delimiter |;
@@ -258,7 +243,7 @@ while ($rnd)
dec $i;
}
- sync_slave_with_master;
+ --sync_slave_with_master
#connection slave;
eval SELECT * from t1$rnd /* must be f1 $max_rows ... 1 */;
eval SELECT * from t3$rnd /* must be f3 $max_rows * 100 ... 100 */;
@@ -270,6 +255,8 @@ while ($rnd)
connection master;
eval drop table t1$rnd;
+ --sync_slave_with_master
+ connection master;
dec $rnd;
}
@@ -300,26 +287,42 @@ while ($rnd)
# Stop the slave.
connection slave;
-STOP SLAVE;
+--source include/stop_slave.inc
# Replace master's binlog.
connection master;
+let $MYSQLD_DATADIR= `select @@datadir`;
FLUSH LOGS;
-let $DATADIR = `select @@datadir`;
-remove_file $DATADIR/master-bin.000001;
-copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $DATADIR/master-bin.000001;
+
+# Stop master server
+--let $rpl_server_number= 1
+--source include/rpl_stop_server.inc
+
+# Replace binlog
+remove_file $MYSQLD_DATADIR/master-bin.000001;
+copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLD_DATADIR/master-bin.000001;
+
+--let $rpl_server_number= 1
+--source include/rpl_start_server.inc
+
+let $binlog_version= query_get_value(SHOW BINLOG EVENTS, Info, 1);
+
+
+# Make the slave to replay the new binlog.
+--echo --> Master binlog: $binlog_version
# Make the slave to replay the new binlog.
connection slave;
RESET SLAVE;
-START SLAVE;
+--source include/start_slave.inc
SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0;
# Check that the replication succeeded.
SHOW TABLES LIKE 't_';
+--replace_column 6 #
SHOW TRIGGERS;
SELECT * FROM t1;
SELECT * FROM t2;
@@ -338,7 +341,7 @@ DROP TRIGGER trg1;
DROP TABLE t1;
DROP TABLE t2;
-STOP SLAVE;
+--source include/stop_slave.inc
RESET SLAVE;
# The master should be clean.
@@ -352,7 +355,7 @@ RESET MASTER;
# Restart slave.
connection slave;
-START SLAVE;
+--source include/start_slave.inc
#
@@ -367,7 +370,6 @@ START SLAVE;
--echo
--echo ---> Preparing environment...
---echo ---> connection: master
--connection master
--disable_warnings
@@ -378,12 +380,9 @@ DROP TABLE IF EXISTS t2;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--echo
---echo ---> connection: master
--connection master
# Test.
@@ -412,11 +411,7 @@ SELECT * FROM t2;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
-
---echo ---> connection: master
+--sync_slave_with_master
--echo
--echo ---> Checking on slave...
@@ -427,7 +422,6 @@ SELECT * FROM t2;
# Cleanup.
--echo
---echo ---> connection: master
--connection master
--echo
@@ -436,9 +430,7 @@ SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--connection master
#
@@ -469,9 +461,7 @@ insert into t1 values (3, "c");
select * from t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
select * from t1;
@@ -481,6 +471,5 @@ drop table if exists t1,t11;
#
# End of tests
#
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test b/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test
index 28bcb0c06c3..fa072022824 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test
@@ -1,35 +1,2 @@
-# Requires statement logging
--- source include/have_binlog_format_mixed_or_statement.inc
+--source suite/rpl/t/rpl_trunc_temp.test
-source include/master-slave.inc;
-
-#
-# Bug#17137 Running "truncate table" on temporary table
-# leaves the table open on a slave
-#
-
-create temporary table t1 (n int);
-insert into t1 values(1);
-sync_slave_with_master;
-show status like 'Slave_open_temp_tables';
-
-# Perform a delete from temp table
-connection master;
-delete from t1;
-sync_slave_with_master;
-show status like 'Slave_open_temp_tables';
-
-# Perform truncate on temp table
-connection master;
-truncate t1;
-sync_slave_with_master;
-show status like 'Slave_open_temp_tables';
-
-# Disconnect the master, temp table on slave should dissapear
-disconnect master;
---real_sleep 3 # time for DROP to be read by slave
-connection slave;
-show status like 'Slave_open_temp_tables';
-
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_user_variables.test b/mysql-test/suite/engines/funcs/t/rpl_user_variables.test
index 530cda3d87a..1b78f2b5fb5 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_user_variables.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_user_variables.test
@@ -1,57 +1,2 @@
-###################################
-#
-# Test of replicating user variables
-#
-###################################
+--source suite/rpl/t/rpl_user_variables.test
--- 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 explicitly set before
-insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
-insert into t1 values (@a+(@b:=@a+1));
-set @q:='abc';
-insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
-set @a:=5;
-insert into t1 values (@a),(@a);
-# To flush the pending event, we add the following statement. RBR can
-# concatenate the result of several statements, which SBR cannot.
-select * from t1 where n = '<nonexistant>';
-connection master1; # see if variable is reset in binlog when thread changes
-insert into t1 values (@a),(@a),(@a*5);
-SELECT * FROM t1 ORDER BY n;
-sync_slave_with_master;
-SELECT * FROM t1 ORDER BY n;
-connection master;
-insert into t1 select * FROM (select @var1 union select @var2) AS t2;
-drop table t1;
-sync_slave_with_master;
-stop slave;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_variables.test b/mysql-test/suite/engines/funcs/t/rpl_variables.test
index 031131a3f2b..ca612a5593b 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_variables.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_variables.test
@@ -1,4 +1,4 @@
-source include/master-slave.inc;
+--source include/master-slave.inc
# Init for restoration of variable values
set @my_slave_net_timeout =@@global.slave_net_timeout;
@@ -19,3 +19,4 @@ show variables like 'slave_skip_errors';
# Cleanup
set global slave_net_timeout=@my_slave_net_timeout;
set global sql_slave_skip_counter=@my_sql_slave_skip_counter;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_view-slave.opt b/mysql-test/suite/engines/funcs/t/rpl_view-slave.opt
deleted file mode 100644
index 79b3bf6174b..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl_view-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---replicate-ignore-table=test.foo
diff --git a/mysql-test/suite/engines/funcs/t/rpl_view.test b/mysql-test/suite/engines/funcs/t/rpl_view.test
index 3eff8f7550a..b81b22ece4e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_view.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_view.test
@@ -1,155 +1,2 @@
-# NYI - row-based cannot use CREATE ... SELECT
+--source suite/rpl/t/rpl_view.test
-source include/master-slave.inc;
---disable_warnings
-drop table if exists t1,v1;
-drop view if exists t1,v1;
-sync_slave_with_master;
-reset master;
---enable_warnings
-
-#
-# Check that creation drop of view is replicated, also check replication of
-# updating of view
-#
-connection master;
-create table t1 (a int);
-insert into t1 values (1);
-create view v1 as select a from t1;
-insert into v1 values (2);
-select * from v1 order by a;
-sync_slave_with_master;
-# view already have to be on slave
-select * from v1 order by a;
-connection master;
-update v1 set a=3 where a=1;
-select * from v1 order by a;
-sync_slave_with_master;
-select * from v1 order by a;
-connection master;
-delete from v1 where a=2;
-select * from v1 order by a;
-sync_slave_with_master;
-select * from v1 order by a;
-connection master;
-# 'alter view' internally maped to creation, but still check that it works
-alter view v1 as select a as b from t1;
-sync_slave_with_master;
-select * from v1 order by 1;
-connection master;
-drop view v1;
-sync_slave_with_master;
-#error, because view have to be removed from slave
--- error 1146
-select * from v1 order by a;
-connection master;
-drop table t1;
-sync_slave_with_master;
-# Change Author: JBM
-# Change Date: 2005-12-22
-# Change: Commented out binlog events to work with SBR and RBR
-#--replace_column 2 # 5 #
-# show binlog events limit 1,100;
-
-#
-# BUG#20438: CREATE statements for views, stored routines and triggers can be
-# not replicable.
-#
-
---echo
---echo ---> Test for BUG#20438
-
-# Prepare environment.
-
---echo
---echo ---> Preparing environment...
---echo ---> connection: master
---connection master
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
---echo
---echo ---> Synchronizing slave with master...
-
---save_master_pos
---connection slave
---sync_with_master
-
---echo
---echo ---> connection: master
---connection master
-
-# Test.
-
---echo
---echo ---> Creating objects...
-
-CREATE TABLE t1(c INT);
-
-/*!50003 CREATE VIEW v1 AS SELECT * FROM t1 */;
-
---echo
---echo ---> Inserting value...
-
-INSERT INTO t1 VALUES(1);
-
---echo
---echo ---> Checking on master...
-
-SELECT * FROM t1;
-
---echo
---echo ---> Synchronizing slave with master...
-
---save_master_pos
---connection slave
---sync_with_master
-
---echo ---> connection: master
-
---echo
---echo ---> Checking on slave...
-
-SELECT * FROM t1;
-
-# Cleanup.
-
---echo
---echo ---> connection: master
---connection master
-
---echo
---echo ---> Cleaning up...
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---save_master_pos
---connection slave
---sync_with_master
---connection master
-
-#
-# BUG#19419: "VIEW: View that the column name is different
-# by master and slave is made".
-#
-connection master;
-create table t1(a int, b int);
-insert into t1 values (1, 1), (1, 2), (1, 3);
-create view v1(a, b) as select a, sum(b) from t1 group by a;
-
-sync_slave_with_master;
-explain v1;
-show create table v1;
-select * from v1;
-
-connection master;
-drop table t1;
-drop view v1;
-
-sync_slave_with_master;
-
---echo End of 5.0 tests
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 91d9ddc8bb1..17cdf6bcb41 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -13,7 +13,6 @@
GCF-1081 : MDEV-18283 Galera test failure on galera.GCF-1081
GCF-939 : MDEV-21520 galera.GCF-939
MDEV-20225 : MDEV-20886 galera.MDEV-20225
-MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill
MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
MW-328B : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
MW-329 : MDEV-19962 Galera test failure on MW-329
diff --git a/mysql-test/suite/galera/r/galera_fulltext.result b/mysql-test/suite/galera/r/galera_fulltext.result
index a22296278fa..6c642757aa4 100644
--- a/mysql-test/suite/galera/r/galera_fulltext.result
+++ b/mysql-test/suite/galera/r/galera_fulltext.result
@@ -36,3 +36,31 @@ COUNT(f1) = 1000
1
DROP TABLE t1;
DROP TABLE ten;
+connection node_1;
+SET @value=REPEAT (1,5001);
+CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb;
+INSERT IGNORE INTO t VALUES(@value);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_2;
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_1;
+DROP TABLE t;
+CREATE TABLE t (a VARCHAR(5000)) engine=innodb;
+INSERT IGNORE INTO t VALUES(@value);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_2;
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_1;
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/t/galera_fulltext.test b/mysql-test/suite/galera/t/galera_fulltext.test
index a90cab1aa1a..19aa4f7a0a0 100644
--- a/mysql-test/suite/galera/t/galera_fulltext.test
+++ b/mysql-test/suite/galera/t/galera_fulltext.test
@@ -60,3 +60,26 @@ SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk');
DROP TABLE t1;
DROP TABLE ten;
+#
+# MDEV-24978 : SIGABRT in __libc_message
+#
+--connection node_1
+SET @value=REPEAT (1,5001);
+CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb;
+INSERT IGNORE INTO t VALUES(@value);
+SELECT COUNT(*) FROM t;
+
+--connection node_2
+SELECT COUNT(*) FROM t;
+
+--connection node_1
+DROP TABLE t;
+CREATE TABLE t (a VARCHAR(5000)) engine=innodb;
+INSERT IGNORE INTO t VALUES(@value);
+SELECT COUNT(*) FROM t;
+
+--connection node_2
+SELECT COUNT(*) FROM t;
+
+--connection node_1
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index 273da66073e..1efd5c61af7 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -789,7 +789,7 @@ t2 CREATE TABLE `t2` (
`n` int(10) unsigned NOT NULL,
`o` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`m`)
-) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1;
Table Create Table
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_grant.result b/mysql-test/suite/rpl/r/rpl_ignore_grant.result
index 64da944a5dc..0a5564ac6c0 100644
--- a/mysql-test/suite/rpl/r/rpl_ignore_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_ignore_grant.result
@@ -1,14 +1,12 @@
include/master-slave.inc
[connection master]
connection master;
-set global sql_mode="";
-set local sql_mode="";
+set sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
connection slave;
-set global sql_mode="";
-set local sql_mode="";
+set sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
@@ -43,7 +41,5 @@ connection slave;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-set global sql_mode=default;
connection master;
-set global sql_mode=default;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
index 04f55fc1263..aae3418b546 100644
--- a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
+++ b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
@@ -12,6 +12,7 @@ Note 1003 select master_pos_wait('master-bin.999999',0,2) AS `master_pos_wait('m
select master_pos_wait('master-bin.999999',0);
connection slave1;
stop slave sql_thread;
+include/wait_for_slave_sql_to_stop.inc
connection slave;
master_pos_wait('master-bin.999999',0)
NULL
diff --git a/mysql-test/suite/rpl/r/rpl_row_USER.result b/mysql-test/suite/rpl/r/rpl_row_USER.result
index 5a59bb57795..2771c674f44 100644
--- a/mysql-test/suite/rpl/r/rpl_row_USER.result
+++ b/mysql-test/suite/rpl/r/rpl_row_USER.result
@@ -1,6 +1,5 @@
include/master-slave.inc
[connection master]
-set global sql_mode="";
set local sql_mode="";
connection master;
DROP DATABASE IF EXISTS mysqltest1;
@@ -40,7 +39,6 @@ REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
DROP USER tester@'%';
DROP USER ''@'localhost%';
+FLUSH PRIVILEGES;
connection slave;
include/rpl_end.inc
-set global sql_mode=default;
-set local sql_mode=default;
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index 686380427b5..5216a3b0a44 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -1,7 +1,6 @@
include/master-slave.inc
[connection master]
set local sql_mode='';
-set global sql_mode='';
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
@@ -175,16 +174,16 @@ fn1(20)
insert into t2 values(fn1(21));
select * from t1;
a
-21
20
+21
select * from t2;
a
23
connection slave;
select * from t1;
a
-21
20
+21
select * from t2;
a
23
@@ -243,7 +242,7 @@ return unix_timestamp();
end NONE
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
-end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
+end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
end NONE
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
@@ -268,7 +267,7 @@ return unix_timestamp();
end NONE
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
-end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
+end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
end NONE
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
@@ -865,6 +864,7 @@ SET TIMESTAMP=t/*!*/;
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`()
DETERMINISTIC
begin
@@ -883,6 +883,7 @@ COMMIT
START TRANSACTION
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
insert into t1 values (15)
/*!*/;
SET TIMESTAMP=t/*!*/;
@@ -891,17 +892,20 @@ COMMIT
START TRANSACTION
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
insert into t2 values(3)
/*!*/;
SET TIMESTAMP=t/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
alter procedure foo4 sql security invoker
/*!*/;
START TRANSACTION
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
insert into t2 values(3)
/*!*/;
SET TIMESTAMP=t/*!*/;
@@ -918,6 +922,7 @@ COMMIT
START TRANSACTION
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
delete from t2
/*!*/;
SET TIMESTAMP=t/*!*/;
@@ -1015,6 +1020,7 @@ SET TIMESTAMP=t/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11)
NO SQL
begin
@@ -1022,6 +1028,7 @@ return unix_timestamp();
end
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11)
READS SQL DATA
begin
@@ -1384,4 +1391,3 @@ drop procedure p1;
# End of 5.5 tests.
connection slave;
include/rpl_end.inc
-set global sql_mode=default;
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_grant.test b/mysql-test/suite/rpl/t/rpl_ignore_grant.test
index ee049a515d7..58457c14817 100644
--- a/mysql-test/suite/rpl/t/rpl_ignore_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_ignore_grant.test
@@ -6,16 +6,12 @@ source include/master-slave.inc;
# do not be influenced by other tests.
connection master;
-set global sql_mode="";
-set local sql_mode="";
+set sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-save_master_pos;
-connection slave;
-set global sql_mode="";
-set local sql_mode="";
-sync_with_master;
+--sync_slave_with_master
+set sql_mode="";
# as these DELETE were not replicated, we need to do them manually on the
# slave.
delete from mysql.user where user=_binary'rpl_ignore_grant';
@@ -27,9 +23,7 @@ connection master;
grant select on *.* to rpl_ignore_grant@localhost;
grant drop on test.* to rpl_ignore_grant@localhost;
show grants for rpl_ignore_grant@localhost;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
--error 1141 #("no such grant for user")
show grants for rpl_ignore_grant@localhost;
# check it another way
@@ -43,9 +37,7 @@ select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
grant select on *.* to rpl_ignore_grant@localhost;
connection master;
set password for rpl_ignore_grant@localhost=password("does it work?");
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
# clear what we have done, to not influence other tests.
@@ -53,15 +45,11 @@ connection master;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-set global sql_mode=default;
connection master;
-set global sql_mode=default;
# End of 4.1 tests
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table_update.test b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test
index 840052e2f25..6591dbbc6ad 100644
--- a/mysql-test/suite/rpl/t/rpl_ignore_table_update.test
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test
@@ -24,15 +24,11 @@ create table mysqltest_bar (m int);
insert into mysqltest_bar values(15);
create table t1 (k int);
insert into t1 values(55);
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1;
connection master;
drop table mysqltest_foo,mysqltest_bar,t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
drop table mysqltest_foo,mysqltest_bar,t1;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
index d8c8162ed9f..437d8412086 100644
--- a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
+++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
@@ -10,6 +10,7 @@ explain extended select master_pos_wait('master-bin.999999',0,2);
send select master_pos_wait('master-bin.999999',0);
connection slave1;
stop slave sql_thread;
+--source include/wait_for_slave_sql_to_stop.inc
connection slave;
reap;
diff --git a/mysql-test/suite/rpl/t/rpl_row_USER.test b/mysql-test/suite/rpl/t/rpl_row_USER.test
index 31826812efa..405f609f0f6 100644
--- a/mysql-test/suite/rpl/t/rpl_row_USER.test
+++ b/mysql-test/suite/rpl/t/rpl_row_USER.test
@@ -11,7 +11,6 @@
# Includes
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
-set global sql_mode="";
set local sql_mode="";
# Begin clean up test section
@@ -43,23 +42,18 @@ delimiter ;|
CALL mysqltest1.p1();
connection master;
SELECT * FROM mysqltest1.t1 ORDER BY a;
-sync_slave_with_master;
+--sync_slave_with_master
SELECT * FROM mysqltest1.t1 ORDER BY a;
connection master;
# Lets cleanup
-#show binlog events;
DROP DATABASE mysqltest1;
REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
DROP USER tester@'%';
DROP USER ''@'localhost%';
-
-sync_slave_with_master;
-
+FLUSH PRIVILEGES;
+--sync_slave_with_master
# End of 5.0 test case
--source include/rpl_end.inc
-
-set global sql_mode=default;
-set local sql_mode=default;
diff --git a/mysql-test/suite/rpl/t/rpl_row_trig002.test b/mysql-test/suite/rpl/t/rpl_row_trig002.test
index 46f9ad91a3d..f04d1e6d478 100644
--- a/mysql-test/suite/rpl/t/rpl_row_trig002.test
+++ b/mysql-test/suite/rpl/t/rpl_row_trig002.test
@@ -48,9 +48,11 @@ 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;
+--sorted_result
select * from test.t3;
sync_slave_with_master;
select * from test.t2;
+--sorted_result
select * from test.t3;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test
index fb30c5708bc..637dda47489 100644
--- a/mysql-test/suite/rpl/t/rpl_sp.test
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -7,8 +7,6 @@ source include/have_binlog_format_mixed.inc;
source include/master-slave.inc;
set local sql_mode='';
-set global sql_mode='';
-
# we need a db != test, where we don't have automatic grants
--disable_warnings
drop database if exists mysqltest1;
@@ -199,9 +197,11 @@ delimiter ;|
delete t1,t2 from t1,t2;
select fn1(20);
insert into t2 values(fn1(21));
+--sorted_result
select * from t1;
select * from t2;
sync_slave_with_master;
+--sorted_result
select * from t1;
select * from t2;
@@ -728,4 +728,3 @@ drop procedure p1;
# Cleanup
sync_slave_with_master;
--source include/rpl_end.inc
-set global sql_mode=default;
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 0b33f61710e..77ed36218d3 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -308,7 +308,9 @@ sub report_mysqlds
sub start_mysqlds()
{
- my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $info_sent);
+ my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $suffix_found, $info_sent);
+
+ $suffix_found= 0;
if (!$opt_no_log)
{
@@ -327,6 +329,7 @@ sub start_mysqlds()
$mysqld_found= 1; # The default
$mysqld_found= 0 if (!length($mysqld));
$com= "$mysqld";
+
for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
{
if ("--mysqladmin=" eq substr($options[$j], 0, 13))
@@ -347,6 +350,10 @@ sub start_mysqlds()
$options[$j]= quote_shell_word($options[$j]);
$tmp.= " $options[$j]";
}
+ elsif ("--defaults-group-suffix=" eq substr($options[$j], 0, 24))
+ {
+ $suffix_found= 1;
+ }
else
{
$options[$j]= quote_shell_word($options[$j]);
@@ -363,6 +370,12 @@ sub start_mysqlds()
$info_sent= 1;
}
+ if (!$suffix_found)
+ {
+ $com.= " --defaults-group-suffix=";
+ $com.= substr($groups[$i],6);
+ }
+
$com.= $tmp;
if ($opt_wsrep_new_cluster) {
diff --git a/sql/contributors.h b/sql/contributors.h
index 34f06087c8c..e16448ee985 100644
--- a/sql/contributors.h
+++ b/sql/contributors.h
@@ -37,22 +37,17 @@ struct show_table_contributors_st {
struct show_table_contributors_st show_table_contributors[]= {
/* MariaDB foundation sponsors, in contribution, size , time order */
- {"Booking.com", "https://www.booking.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"},
{"Alibaba Cloud", "https://www.alibabacloud.com/", "Platinum Sponsor of the MariaDB Foundation"},
{"Tencent Cloud", "https://cloud.tencent.com", "Platinum Sponsor of the MariaDB Foundation"},
{"Microsoft", "https://microsoft.com/", "Platinum Sponsor of the MariaDB Foundation"},
{"MariaDB Corporation", "https://mariadb.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"},
+ {"ServiceNow", "https://servicenow.com", "Platinum Sponsor of the MariaDB Foundation"},
{"Visma", "https://visma.com", "Gold Sponsor of the MariaDB Foundation"},
{"DBS", "https://dbs.com", "Gold Sponsor of the MariaDB Foundation"},
{"IBM", "https://www.ibm.com", "Gold Sponsor of the MariaDB Foundation"},
- {"Tencent Games", "http://game.qq.com/", "Gold Sponsor of the MariaDB Foundation"},
- {"Nexedi", "https://www.nexedi.com", "Silver Sponsor of the MariaDB Foundation"},
- {"Acronis", "https://www.acronis.com", "Silver Sponsor of the MariaDB Foundation"},
- {"Verkkokauppa.com", "https://www.verkkokauppa.com", "Bronze Sponsor of the MariaDB Foundation"},
- {"Virtuozzo", "https://virtuozzo.com", "Bronze Sponsor of the MariaDB Foundation"},
- {"Tencent Game DBA", "http://tencentdba.com/about", "Bronze Sponsor of the MariaDB Foundation"},
- {"Tencent TDSQL", "http://tdsql.org", "Bronze Sponsor of the MariaDB Foundation"},
- {"Percona", "https://www.percona.com/", "Bronze Sponsor of the MariaDB Foundation"},
+ {"Automattic", "https://automattic.com", "Silver Sponsor of the MariaDB Foundation"},
+ {"Percona", "https://www.percona.com/", "Sponsor of the MariaDB Foundation"},
+ {"Galera Cluster", "https://galeracluster.com", "Sponsor of the MariaDB Foundation"},
/* Sponsors of important features */
{"Google", "USA", "Sponsoring encryption, parallel replication and GTID"},
diff --git a/sql/item.cc b/sql/item.cc
index 3c736316a42..b8eb0d453d5 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
- Copyright (c) 2010, 2020, MariaDB Corporation.
+ Copyright (c) 2010, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -9829,7 +9829,7 @@ bool Item_cache_int::cache_value()
return FALSE;
value_cached= TRUE;
value= example->val_int_result();
- null_value= example->null_value;
+ null_value_inside= null_value= example->null_value;
unsigned_flag= example->unsigned_flag;
return TRUE;
}
@@ -9906,7 +9906,7 @@ bool Item_cache_temporal::cache_value()
return false;
value_cached= true;
value= example->val_datetime_packed_result(current_thd);
- null_value= example->null_value;
+ null_value_inside= null_value= example->null_value;
return true;
}
@@ -9917,7 +9917,7 @@ bool Item_cache_time::cache_value()
return false;
value_cached= true;
value= example->val_time_packed_result(current_thd);
- null_value= example->null_value;
+ null_value_inside= null_value= example->null_value;
return true;
}
@@ -10059,7 +10059,7 @@ bool Item_cache_real::cache_value()
return FALSE;
value_cached= TRUE;
value= example->val_result();
- null_value= example->null_value;
+ null_value_inside= null_value= example->null_value;
return TRUE;
}
@@ -10126,7 +10126,8 @@ bool Item_cache_decimal::cache_value()
return FALSE;
value_cached= TRUE;
my_decimal *val= example->val_decimal_result(&decimal_value);
- if (!(null_value= example->null_value) && val != &decimal_value)
+ if (!(null_value_inside= null_value= example->null_value) &&
+ val != &decimal_value)
my_decimal2decimal(val, &decimal_value);
return TRUE;
}
@@ -10175,11 +10176,14 @@ Item *Item_cache_decimal::convert_to_basic_const_item(THD *thd)
bool Item_cache_str::cache_value()
{
if (!example)
+ {
+ DBUG_ASSERT(value_cached == FALSE);
return FALSE;
+ }
value_cached= TRUE;
value_buff.set(buffer, sizeof(buffer), example->collation.collation);
value= example->str_result(&value_buff);
- if ((null_value= example->null_value))
+ if ((null_value= null_value_inside= example->null_value))
value= 0;
else if (value != &value_buff)
{
@@ -10274,6 +10278,8 @@ Item *Item_cache_str::convert_to_basic_const_item(THD *thd)
bool Item_cache_row::setup(THD *thd, Item *item)
{
example= item;
+ null_value= true;
+
if (!values && allocate(thd, item->cols()))
return 1;
for (uint i= 0; i < item_count; i++)
@@ -10306,12 +10312,19 @@ bool Item_cache_row::cache_value()
if (!example)
return FALSE;
value_cached= TRUE;
- null_value= 0;
+ null_value= TRUE;
+ null_value_inside= false;
example->bring_value();
+
+ /*
+ For Item_cache_row null_value is set to TRUE only when ALL the values
+ inside the cache are NULL
+ */
for (uint i= 0; i < item_count; i++)
{
values[i]->cache_value();
- null_value|= values[i]->null_value;
+ null_value&= values[i]->null_value;
+ null_value_inside|= values[i]->null_value;
}
return TRUE;
}
diff --git a/sql/item.h b/sql/item.h
index e2ddbc41542..9b55a515691 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -6751,6 +6751,14 @@ protected:
table_map used_table_map;
public:
+ /*
+ This is set if at least one of the values of a sub query is NULL
+ Item_cache_row returns this with null_inside().
+ For not row items, it's set to the value of null_value
+ It is set after cache_value() is called.
+ */
+ bool null_value_inside;
+
Item_cache(THD *thd):
Item(thd),
Type_handler_hybrid_field_type(&type_handler_string),
@@ -6760,6 +6768,7 @@ public:
{
maybe_null= 1;
null_value= 1;
+ null_value_inside= true;
}
protected:
Item_cache(THD *thd, const Type_handler *handler):
@@ -6771,6 +6780,7 @@ protected:
{
maybe_null= 1;
null_value= 1;
+ null_value_inside= true;
}
public:
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index bbd5fbf073a..875aacec3bc 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1565,7 +1565,7 @@ longlong Item_in_optimizer::val_int()
DBUG_RETURN(res);
}
- if (cache->null_value)
+ if (cache->null_value_inside)
{
DBUG_PRINT("info", ("Left NULL..."));
/*
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index ad6dba01ad6..486758c823e 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -879,7 +879,7 @@ bool Item_subselect::expr_cache_is_needed(THD *thd)
inline bool Item_in_subselect::left_expr_has_null()
{
- return (*(optimizer->get_cache()))->null_value;
+ return (*(optimizer->get_cache()))->null_value_inside;
}
@@ -1333,7 +1333,17 @@ bool Item_singlerow_subselect::null_inside()
void Item_singlerow_subselect::bring_value()
{
if (!exec() && assigned())
- null_value= 0;
+ {
+ null_value= true;
+ for (uint i= 0; i < max_columns ; i++)
+ {
+ if (!row[i]->null_value)
+ {
+ null_value= false;
+ return;
+ }
+ }
+ }
else
reset();
}
@@ -1359,7 +1369,11 @@ longlong Item_singlerow_subselect::val_int()
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_int();
+ {
+ longlong val= value->val_int();
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1368,6 +1382,7 @@ longlong Item_singlerow_subselect::val_int()
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1376,7 +1391,11 @@ String *Item_singlerow_subselect::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_str(str);
+ {
+ String *res= value->val_str(str);
+ null_value= value->null_value;
+ return res;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1385,6 +1404,7 @@ String *Item_singlerow_subselect::val_str(String *str)
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1412,7 +1432,11 @@ my_decimal *Item_singlerow_subselect::val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_decimal(decimal_value);
+ {
+ my_decimal *val= value->val_decimal(decimal_value);
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1421,6 +1445,7 @@ my_decimal *Item_singlerow_subselect::val_decimal(my_decimal *decimal_value)
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1430,7 +1455,11 @@ bool Item_singlerow_subselect::val_bool()
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_bool();
+ {
+ bool val= value->val_bool();
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1439,6 +1468,7 @@ bool Item_singlerow_subselect::val_bool()
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1448,7 +1478,11 @@ bool Item_singlerow_subselect::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->get_date(thd, ltime, fuzzydate);
+ {
+ bool val= value->get_date(thd, ltime, fuzzydate);
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1457,6 +1491,7 @@ bool Item_singlerow_subselect::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t
else
{
reset();
+ DBUG_ASSERT(null_value);
return 1;
}
}
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 015b32ae6d6..97e62e891b7 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -50,7 +50,11 @@ class Item_subselect :public Item_result_field,
protected Used_tables_and_const_cache,
protected With_sum_func_cache
{
- bool value_assigned; /* value already assigned to subselect */
+ /*
+ Set to TRUE if the value is assigned for the subselect
+ FALSE: subquery not executed or the subquery returns an empty result
+ */
+ bool value_assigned;
bool own_engine; /* the engine was not taken from other Item_subselect */
protected:
/* thread handler, will be assigned in fix_fields only */
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 71298e2ba00..d0081034c0c 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -7558,8 +7558,11 @@ static int show_memory_used(THD *thd, SHOW_VAR *var, char *buff,
var->type= SHOW_LONGLONG;
var->value= buff;
if (scope == OPT_GLOBAL)
+ {
+ calc_sum_of_all_status_if_needed(status_var);
*(longlong*) buff= (status_var->global_memory_used +
status_var->local_memory_used);
+ }
else
*(longlong*) buff= status_var->local_memory_used;
return 0;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 4eabd3da450..34a4edbb761 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -933,11 +933,24 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
STATUS_VAR *dec_var);
+uint calc_sum_of_all_status(STATUS_VAR *to);
+static inline void calc_sum_of_all_status_if_needed(STATUS_VAR *to)
+{
+ if (to->local_memory_used == 0)
+ {
+ mysql_mutex_lock(&LOCK_status);
+ *to= global_status_var;
+ mysql_mutex_unlock(&LOCK_status);
+ calc_sum_of_all_status(to);
+ DBUG_ASSERT(to->local_memory_used);
+ }
+}
+
/*
Update global_memory_used. We have to do this with atomic_add as the
global value can change outside of LOCK_status.
*/
-inline void update_global_memory_status(int64 size)
+static inline void update_global_memory_status(int64 size)
{
DBUG_PRINT("info", ("global memory_used: %lld size: %lld",
(longlong) global_status_var.global_memory_used,
@@ -955,7 +968,7 @@ inline void update_global_memory_status(int64 size)
@retval NULL on error
@retval Pointter to CHARSET_INFO with the given name on success
*/
-inline CHARSET_INFO *
+static inline CHARSET_INFO *
mysqld_collation_get_by_name(const char *name,
CHARSET_INFO *name_cs= system_charset_info)
{
@@ -974,7 +987,7 @@ mysqld_collation_get_by_name(const char *name,
return cs;
}
-inline bool is_supported_parser_charset(CHARSET_INFO *cs)
+static inline bool is_supported_parser_charset(CHARSET_INFO *cs)
{
return MY_TEST(cs->mbminlen == 1);
}
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index a9f5443e36d..f3861ebd3e9 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -904,6 +904,7 @@ st_select_lex_unit *With_element::clone_parsed_spec(THD *thd,
with_table->next_global= spec_tables;
}
res= &lex->unit;
+ res->with_element= this;
lex->unit.include_down(with_table->select_lex);
lex->unit.set_slave(with_select);
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 20ed976daab..c62d096ea01 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -1650,7 +1650,7 @@ void JOIN_CACHE::get_record_by_pos(uchar *rec_ptr)
}
-/*
+/*
Get the match flag from the referenced record: the default implementation
SYNOPSIS
@@ -1662,6 +1662,7 @@ void JOIN_CACHE::get_record_by_pos(uchar *rec_ptr)
get the match flag for the record pointed by the reference at the position
rec_ptr. If the match flag is placed in one of the previous buffers the
function first reaches the linked record fields in this buffer.
+ The function returns the value of the first encountered match flag.
RETURN VALUE
match flag for the record at the position rec_ptr
@@ -1686,6 +1687,39 @@ enum JOIN_CACHE::Match_flag JOIN_CACHE::get_match_flag_by_pos(uchar *rec_ptr)
/*
+ Get the match flag for the referenced record from specified join buffer
+
+ SYNOPSIS
+ get_match_flag_by_pos_from_join_buffer()
+ rec_ptr position of the first field of the record in the join buffer
+ tab join table with join buffer where to look for the match flag
+
+ DESCRIPTION
+ This default implementation of the get_match_flag_by_pos_from_join_buffer
+ method gets the match flag for the record pointed by the reference at the
+ position rec_ptr from the join buffer attached to the join table tab.
+
+ RETURN VALUE
+ match flag for the record at the position rec_ptr from the join
+ buffer attached to the table tab.
+*/
+
+enum JOIN_CACHE::Match_flag
+JOIN_CACHE::get_match_flag_by_pos_from_join_buffer(uchar *rec_ptr,
+ JOIN_TAB *tab)
+{
+ DBUG_ASSERT(tab->cache && tab->cache->with_match_flag);
+ for (JOIN_CACHE *cache= this; ; )
+ {
+ if (cache->join_tab == tab)
+ return (enum Match_flag) rec_ptr[0];
+ cache= cache->prev_cache;
+ rec_ptr= cache->get_rec_ref(rec_ptr);
+ }
+}
+
+
+/*
Calculate the increment of the auxiliary buffer for a record write
SYNOPSIS
@@ -1955,6 +1989,10 @@ bool JOIN_CACHE::read_referenced_field(CACHE_FIELD *copy,
If the record is skipped the value of 'pos' is set to point to the position
right after the record.
+ NOTE
+ Currently this function is called only when generating null complemented
+ records for outer joins (=> only when join_tab->first_unmatched != NULL).
+
RETURN VALUE
TRUE the match flag is set to MATCH_FOUND and the record has been skipped
FALSE otherwise
@@ -1967,7 +2005,9 @@ bool JOIN_CACHE::skip_if_matched()
if (prev_cache)
offset+= prev_cache->get_size_of_rec_offset();
/* Check whether the match flag is MATCH_FOUND */
- if (get_match_flag_by_pos(pos+offset) == MATCH_FOUND)
+ if (get_match_flag_by_pos_from_join_buffer(pos+offset,
+ join_tab->first_unmatched) ==
+ MATCH_FOUND)
{
pos+= size_of_rec_len + get_rec_length(pos);
return TRUE;
@@ -1984,13 +2024,23 @@ bool JOIN_CACHE::skip_if_matched()
DESCRIPTION
This default implementation of the virtual function skip_if_not_needed_match
- skips the next record from the join buffer if its match flag is not
- MATCH_NOT_FOUND, and, either its value is MATCH_FOUND and join_tab is the
- first inner table of an inner join, or, its value is MATCH_IMPOSSIBLE
- and join_tab is the first inner table of an outer join.
+ skips the next record from the join when generating join extensions
+ for the records in the join buffer depending on the value of the match flag.
+ - In the case of a semi-nest the match flag may be in two states
+ {MATCH_NOT_FOUND, MATCH_FOUND}. The record is skipped if the flag is set
+ to MATCH_FOUND.
+ - In the case of a outer join nest when not_exists optimization is applied
+ the match may be in three states {MATCH_NOT_FOUND, MATCH_IMPOSSIBLE,
+ MATCH_FOUND. The record is skipped if the flag is set to MATCH_FOUND or
+ to MATCH_IMPOSSIBLE.
+
If the record is skipped the value of 'pos' is set to point to the position
right after the record.
+ NOTE
+ Currently the function is called only when generating non-null complemented
+ extensions for records in the join buffer.
+
RETURN VALUE
TRUE the record has to be skipped
FALSE otherwise
@@ -2001,11 +2051,19 @@ bool JOIN_CACHE::skip_if_not_needed_match()
DBUG_ASSERT(with_length);
enum Match_flag match_fl;
uint offset= size_of_rec_len;
+ bool skip= FALSE;
if (prev_cache)
offset+= prev_cache->get_size_of_rec_offset();
- if ((match_fl= get_match_flag_by_pos(pos+offset)) != MATCH_NOT_FOUND &&
- (join_tab->check_only_first_match() == (match_fl == MATCH_FOUND)) )
+ if (!join_tab->check_only_first_match())
+ return FALSE;
+
+ match_fl= get_match_flag_by_pos(pos+offset);
+ skip= join_tab->first_sj_inner_tab ?
+ match_fl == MATCH_FOUND : // the case of semi-join
+ match_fl != MATCH_NOT_FOUND; // the case of outer-join
+
+ if (skip)
{
pos+= size_of_rec_len + get_rec_length(pos);
return TRUE;
@@ -2105,7 +2163,14 @@ enum_nested_loop_state JOIN_CACHE::join_records(bool skip_last)
goto finish;
}
join_tab->not_null_compl= FALSE;
- /* Prepare for generation of null complementing extensions */
+ /*
+ Prepare for generation of null complementing extensions.
+ For all inner tables of the outer join operation for which
+ regular matches have been just found the field 'first_unmatched'
+ is set to point the the first inner table. After all null
+ complement rows are generated for this outer join this field
+ is set back to NULL.
+ */
for (tab= join_tab->first_inner; tab <= join_tab->last_inner; tab++)
tab->first_unmatched= join_tab->first_inner;
}
@@ -2222,7 +2287,10 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last)
int error;
enum_nested_loop_state rc= NESTED_LOOP_OK;
join_tab->table->null_row= 0;
- bool check_only_first_match= join_tab->check_only_first_match();
+ bool check_only_first_match=
+ join_tab->check_only_first_match() &&
+ (!join_tab->first_inner || // semi-join case
+ join_tab->first_inner == join_tab->first_unmatched); // outer join case
bool outer_join_first_inner= join_tab->is_first_inner_for_outer_join();
DBUG_ENTER("JOIN_CACHE::join_matching_records");
diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h
index 7b8b942180f..d0bf4761f65 100644
--- a/sql/sql_join_cache.h
+++ b/sql/sql_join_cache.h
@@ -206,7 +206,9 @@ protected:
/*
This flag indicates that records written into the join buffer contain
- a match flag field. The flag must be set by the init method.
+ a match flag field. The flag must be set by the init method.
+ Currently any implementation of the virtial init method calls
+ the function JOIN_CACHE::calc_record_fields() to set this flag.
*/
bool with_match_flag;
/*
@@ -646,6 +648,13 @@ public:
/* Shall return the value of the match flag for the positioned record */
virtual enum Match_flag get_match_flag_by_pos(uchar *rec_ptr);
+ /*
+ Shall return the value of the match flag for the positioned record
+ from the join buffer attached to the specified table
+ */
+ virtual enum Match_flag
+ get_match_flag_by_pos_from_join_buffer(uchar *rec_ptr, JOIN_TAB *tab);
+
/* Shall return the position of the current record */
virtual uchar *get_curr_rec() { return curr_rec_pos; }
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index dad7b804e7e..23214020486 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -8987,7 +8987,13 @@ push_new_name_resolution_context(THD *thd,
left_op->first_leaf_for_name_resolution();
on_context->last_name_resolution_table=
right_op->last_leaf_for_name_resolution();
- return thd->lex->push_context(on_context);
+ LEX *lex= thd->lex;
+ on_context->select_lex = lex->current_select;
+ st_select_lex *curr_select= lex->pop_select();
+ st_select_lex *outer_sel= lex->select_stack_head();
+ lex->push_select(curr_select);
+ on_context->outer_context = outer_sel ? &outer_sel->context : 0;
+ return lex->push_context(on_context);
}
diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic
index a8b70e294e1..740569dc76e 100644
--- a/sql/sql_plugin_services.ic
+++ b/sql/sql_plugin_services.ic
@@ -155,7 +155,6 @@ static struct wsrep_service_st wsrep_handler = {
wsrep_thd_retry_counter,
wsrep_thd_ignore_table,
wsrep_thd_trx_seqno,
- wsrep_thd_auto_increment_variables,
wsrep_thd_is_aborting,
wsrep_set_data_home_dir,
wsrep_thd_is_BF,
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index ae93bd3107d..8cb82c602d9 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -3833,15 +3833,8 @@ static bool show_status_array(THD *thd, const char *wild,
if (show_type == SHOW_SYS)
mysql_mutex_lock(&LOCK_global_system_variables);
- else if (show_type >= SHOW_LONG_STATUS && scope == OPT_GLOBAL &&
- !status_var->local_memory_used)
- {
- mysql_mutex_lock(&LOCK_status);
- *status_var= global_status_var;
- mysql_mutex_unlock(&LOCK_status);
- calc_sum_of_all_status(status_var);
- DBUG_ASSERT(status_var->local_memory_used);
- }
+ else if (show_type >= SHOW_LONG_STATUS && scope == OPT_GLOBAL)
+ calc_sum_of_all_status_if_needed(status_var);
pos= get_one_variable(thd, var, scope, show_type, status_var,
&charset, buff, &length);
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc
index 2503a97590b..129df8e1577 100644
--- a/sql/wsrep_dummy.cc
+++ b/sql/wsrep_dummy.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014, 2020, MariaDB
+/* Copyright (C) 2014, 2021, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -107,14 +107,6 @@ const char* wsrep_thd_client_state_str(const THD*)
const char* wsrep_thd_client_mode_str(const THD*)
{ return 0; }
-void wsrep_thd_auto_increment_variables(THD *thd,
- unsigned long long *offset,
- unsigned long long *increment)
-{
- *offset= thd->variables.auto_increment_offset;
- *increment= thd->variables.auto_increment_increment;
-}
-
const char* wsrep_thd_transaction_state_str(const THD*)
{ return 0; }
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 2d814c62424..023da27c3c1 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -368,25 +368,6 @@ bool wsrep_bf_abort(const THD* bf_thd, THD* victim_thd)
return ret;
}
-/*
- Get auto increment variables for THD. Use global settings for
- applier threads.
- */
-void wsrep_thd_auto_increment_variables(THD* thd,
- unsigned long long* offset,
- unsigned long long* increment)
-{
- if (wsrep_thd_is_applying(thd) &&
- thd->wsrep_trx().state() != wsrep::transaction::s_replaying)
- {
- *offset= global_system_variables.auto_increment_offset;
- *increment= global_system_variables.auto_increment_increment;
- return;
- }
- *offset= thd->variables.auto_increment_offset;
- *increment= thd->variables.auto_increment_increment;
-}
-
int wsrep_create_threadvars()
{
int ret= 0;
diff --git a/storage/innobase/.clang-format b/storage/innobase/.clang-format-old
index 54f7b47bc88..54f7b47bc88 100644
--- a/storage/innobase/.clang-format
+++ b/storage/innobase/.clang-format-old
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 041cd8cd1b4..18ec60b0797 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -1192,7 +1192,6 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index)
TABLE_STATS_NAME)
|| !strcmp(index->table->name.m_name,
INDEX_STATS_NAME))) {
- ut_ad(!strcmp(field->name, "table_name"));
/* Interpret "table_name" as VARCHAR(199) even
if it was incorrectly defined as VARCHAR(64).
While the caller of ha_innobase enforces the
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 40a0744dd3d..c5323ed0ffc 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2020, MariaDB Corporation.
+Copyright (c) 2014, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index fd0b645f067..d6efaecc44c 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -2477,6 +2477,72 @@ innobase_raw_format(
return(ut_str_sql_format(buf_tmp, buf_tmp_used, buf, buf_size));
}
+/*
+The helper function nlz(x) calculates the number of leading zeros
+in the binary representation of the number "x", either using a
+built-in compiler function or a substitute trick based on the use
+of the multiplication operation and a table indexed by the prefix
+of the multiplication result:
+*/
+#ifdef __GNUC__
+#define nlz(x) __builtin_clzll(x)
+#elif defined(_MSC_VER) && !defined(_M_CEE_PURE) && \
+ (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64))
+#ifndef __INTRIN_H_
+#pragma warning(push, 4)
+#pragma warning(disable: 4255 4668)
+#include <intrin.h>
+#pragma warning(pop)
+#endif
+__forceinline unsigned int nlz (ulonglong x)
+{
+#if defined(_M_IX86) || defined(_M_X64)
+ unsigned long n;
+#ifdef _M_X64
+ _BitScanReverse64(&n, x);
+ return (unsigned int) n ^ 63;
+#else
+ unsigned long y = (unsigned long) (x >> 32);
+ unsigned int m = 31;
+ if (y == 0)
+ {
+ y = (unsigned long) x;
+ m = 63;
+ }
+ _BitScanReverse(&n, y);
+ return (unsigned int) n ^ m;
+#endif
+#elif defined(_M_ARM64)
+ return _CountLeadingZeros(x);
+#endif
+}
+#else
+inline unsigned int nlz (ulonglong x)
+{
+ static unsigned char table [48] = {
+ 32, 6, 5, 0, 4, 12, 0, 20,
+ 15, 3, 11, 0, 0, 18, 25, 31,
+ 8, 14, 2, 0, 10, 0, 0, 0,
+ 0, 0, 0, 21, 0, 0, 19, 26,
+ 7, 0, 13, 0, 16, 1, 22, 27,
+ 9, 0, 17, 23, 28, 24, 29, 30
+ };
+ unsigned int y= (unsigned int) (x >> 32);
+ unsigned int n= 0;
+ if (y == 0) {
+ y= (unsigned int) x;
+ n= 32;
+ }
+ y = y | (y >> 1); // Propagate leftmost 1-bit to the right.
+ y = y | (y >> 2);
+ y = y | (y >> 4);
+ y = y | (y >> 8);
+ y = y & ~(y >> 16);
+ y = y * 0x3EF5D037;
+ return n + table[y >> 26];
+}
+#endif
+
/*********************************************************************//**
Compute the next autoinc value.
@@ -2505,85 +2571,93 @@ innobase_next_autoinc(
ulonglong max_value) /*!< in: max value for type */
{
ulonglong next_value;
- ulonglong block = need * step;
+ ulonglong block;
/* Should never be 0. */
ut_a(need > 0);
- ut_a(block > 0);
+ ut_a(step > 0);
ut_a(max_value > 0);
- /*
- Allow auto_increment to go over max_value up to max ulonglong.
- This allows us to detect that all values are exhausted.
- If we don't do this, we will return max_value several times
- and get duplicate key errors instead of auto increment value
- out of range.
- */
- max_value= (~(ulonglong) 0);
+ /*
+ We need to calculate the "block" value equal to the product
+ "step * need". However, when calculating this product, an integer
+ overflow can occur, so we cannot simply use the usual multiplication
+ operation. The snippet below calculates the product of two numbers
+ and detects an unsigned integer overflow:
+ */
+ unsigned int m= nlz(need);
+ unsigned int n= nlz(step);
+ if (m + n <= 8 * sizeof(ulonglong) - 2) {
+ // The bit width of the original values is too large,
+ // therefore we are guaranteed to get an overflow.
+ goto overflow;
+ }
+ block = need * (step >> 1);
+ if ((longlong) block < 0) {
+ goto overflow;
+ }
+ block += block;
+ if (step & 1) {
+ block += need;
+ if (block < need) {
+ goto overflow;
+ }
+ }
+
+ /* Check for overflow. Current can be > max_value if the value
+ is in reality a negative value. Also, the visual studio compiler
+ converts large double values (which hypothetically can then be
+ passed here as the values of the "current" parameter) automatically
+ into unsigned long long datatype maximum value: */
+ if (current > max_value) {
+ goto overflow;
+ }
/* According to MySQL documentation, if the offset is greater than
the step then the offset is ignored. */
- if (offset > block) {
+ if (offset > step) {
offset = 0;
}
- /* Check for overflow. Current can be > max_value if the value is
- in reality a negative value.The visual studio compilers converts
- large double values automatically into unsigned long long datatype
- maximum value */
-
- if (block >= max_value
- || offset > max_value
- || current >= max_value
- || max_value - offset <= offset) {
-
- next_value = max_value;
+ /*
+ Let's round the current value to within a step-size block:
+ */
+ if (current > offset) {
+ next_value = current - offset;
} else {
- ut_a(max_value > current);
-
- ulonglong free = max_value - current;
-
- if (free < offset || free - offset <= block) {
- next_value = max_value;
- } else {
- next_value = 0;
- }
+ next_value = offset - current;
}
+ next_value -= next_value % step;
- if (next_value == 0) {
- ulonglong next;
-
- if (current > offset) {
- next = (current - offset) / step;
- } else {
- next = (offset - current) / step;
- }
-
- ut_a(max_value > next);
- next_value = next * step;
- /* Check for multiplication overflow. */
- ut_a(next_value >= next);
- ut_a(max_value > next_value);
-
- /* Check for overflow */
- if (max_value - next_value >= block) {
-
- next_value += block;
-
- if (max_value - next_value >= offset) {
- next_value += offset;
- } else {
- next_value = max_value;
- }
- } else {
- next_value = max_value;
- }
+ /*
+ Add an offset to the next value and check that the addition
+ does not cause an integer overflow:
+ */
+ next_value += offset;
+ if (next_value < offset) {
+ goto overflow;
}
- ut_a(next_value != 0);
- ut_a(next_value <= max_value);
+ /*
+ Add a block to the next value and check that the addition
+ does not cause an integer overflow:
+ */
+ next_value += block;
+ if (next_value < block) {
+ goto overflow;
+ }
return(next_value);
+
+overflow:
+ /*
+ Allow auto_increment to go over max_value up to max ulonglong.
+ This allows us to detect that all values are exhausted.
+ If we don't do this, we will return max_value several times
+ and get duplicate key errors instead of auto increment value
+ out of range:
+ */
+ return(~(ulonglong) 0);
}
/********************************************************************//**
@@ -6539,8 +6613,8 @@ wsrep_innobase_mysql_sort(
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_VARCHAR:
{
- uchar tmp_str[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'};
- uint tmp_length = REC_VERSION_56_MAX_INDEX_COL_LEN;
+ uchar *tmp_str;
+ uint tmp_length;
/* Use the charset number to pick the right charset struct for
the comparison. Since the MySQL function get_charset may be
@@ -6563,7 +6637,11 @@ wsrep_innobase_mysql_sort(
}
}
- ut_a(str_length <= tmp_length);
+ // Note that strnxfrm may change length of string
+ tmp_length= charset->coll->strnxfrmlen(charset, str_length);
+ tmp_length= ut_max(str_length, tmp_length) + 1;
+ tmp_str= static_cast<uchar *>(ut_malloc_nokey(tmp_length));
+ ut_ad(str_length <= tmp_length);
memcpy(tmp_str, str, str_length);
tmp_length = charset->coll->strnxfrm(charset, str, str_length,
@@ -6587,6 +6665,7 @@ wsrep_innobase_mysql_sort(
ret_length = tmp_length;
}
+ ut_free(tmp_str);
break;
}
case MYSQL_TYPE_DECIMAL :
@@ -6938,7 +7017,7 @@ wsrep_store_key_val_for_row(
THD* thd,
TABLE* table,
uint keynr, /*!< in: key number */
- char* buff, /*!< in/out: buffer for the key value (in MySQL
+ uchar* buff, /*!< in/out: buffer for the key value (in MySQL
format) */
uint buff_len,/*!< in: buffer length */
const uchar* record,
@@ -6947,7 +7026,7 @@ wsrep_store_key_val_for_row(
KEY* key_info = table->key_info + keynr;
KEY_PART_INFO* key_part = key_info->key_part;
KEY_PART_INFO* end = key_part + key_info->user_defined_key_parts;
- char* buff_start = buff;
+ uchar* buff_start = buff;
enum_field_types mysql_type;
Field* field;
uint buff_space = buff_len;
@@ -6959,7 +7038,8 @@ wsrep_store_key_val_for_row(
for (; key_part != end; key_part++) {
- uchar sorted[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'};
+ uchar *sorted=NULL;
+ uint max_len=0;
ibool part_is_null = FALSE;
if (key_part->null_bit) {
@@ -7038,10 +7118,14 @@ wsrep_store_key_val_for_row(
true_len = key_len;
}
+ max_len= true_len;
+ sorted= static_cast<uchar *>(ut_malloc_nokey(max_len+1));
memcpy(sorted, data, true_len);
true_len = wsrep_innobase_mysql_sort(
mysql_type, cs->number, sorted, true_len,
- REC_VERSION_56_MAX_INDEX_COL_LEN);
+ max_len);
+ ut_ad(true_len <= max_len);
+
if (wsrep_protocol_version > 1) {
/* Note that we always reserve the maximum possible
length of the true VARCHAR in the key value, though
@@ -7126,11 +7210,13 @@ wsrep_store_key_val_for_row(
true_len = key_len;
}
+ max_len= true_len;
+ sorted= static_cast<uchar *>(ut_malloc_nokey(max_len+1));
memcpy(sorted, blob_data, true_len);
true_len = wsrep_innobase_mysql_sort(
mysql_type, cs->number, sorted, true_len,
- REC_VERSION_56_MAX_INDEX_COL_LEN);
-
+ max_len);
+ ut_ad(true_len <= max_len);
/* Note that we always reserve the maximum possible
length of the BLOB prefix in the key value. */
@@ -7206,10 +7292,14 @@ wsrep_store_key_val_for_row(
cs->mbmaxlen),
&error);
}
+
+ max_len= true_len;
+ sorted= static_cast<uchar *>(ut_malloc_nokey(max_len+1));
memcpy(sorted, src_start, true_len);
true_len = wsrep_innobase_mysql_sort(
mysql_type, cs->number, sorted, true_len,
- REC_VERSION_56_MAX_INDEX_COL_LEN);
+ max_len);
+ ut_ad(true_len <= max_len);
if (true_len > buff_space) {
fprintf (stderr,
@@ -7224,6 +7314,11 @@ wsrep_store_key_val_for_row(
buff += true_len;
buff_space -= true_len;
}
+
+ if (sorted) {
+ ut_free(sorted);
+ sorted= NULL;
+ }
}
ut_a(buff <= buff_start + buff_len);
@@ -8033,7 +8128,6 @@ ha_innobase::write_row(
/* Handling of errors related to auto-increment. */
if (auto_inc_used) {
ulonglong auto_inc;
- ulonglong col_max_value;
/* Note the number of rows processed for this statement, used
by get_auto_increment() to determine the number of AUTO-INC
@@ -8043,11 +8137,6 @@ ha_innobase::write_row(
--trx->n_autoinc_rows;
}
- /* We need the upper limit of the col type to check for
- whether we update the table autoinc counter or not. */
- col_max_value =
- table->next_number_field->get_max_int_value();
-
/* Get the value that MySQL attempted to store in the table.*/
auto_inc = table->next_number_field->val_uint();
@@ -8114,36 +8203,25 @@ ha_innobase::write_row(
if (auto_inc >= m_prebuilt->autoinc_last_value) {
set_max_autoinc:
+ /* We need the upper limit of the col type to check for
+ whether we update the table autoinc counter or not. */
+ ulonglong col_max_value =
+ table->next_number_field->get_max_int_value();
+
/* This should filter out the negative
values set explicitly by the user. */
if (auto_inc <= col_max_value) {
+ ut_ad(m_prebuilt->autoinc_increment > 0);
ulonglong offset;
ulonglong increment;
dberr_t err;
-#ifdef WITH_WSREP
- /* Applier threads which are processing
- ROW events and don't go through server
- level autoinc processing, therefore
- m_prebuilt autoinc values don't get
- properly assigned. Fetch values from
- server side. */
- if (trx->is_wsrep() &&
- wsrep_thd_is_applying(m_user_thd))
- {
- wsrep_thd_auto_increment_variables(
- m_user_thd, &offset, &increment);
- }
- else
-#endif /* WITH_WSREP */
- {
- ut_a(m_prebuilt->autoinc_increment > 0);
- offset = m_prebuilt->autoinc_offset;
- increment = m_prebuilt->autoinc_increment;
- }
+
+ offset = m_prebuilt->autoinc_offset;
+ increment = m_prebuilt->autoinc_increment;
+
auto_inc = innobase_next_autoinc(
- auto_inc,
- 1, increment, offset,
+ auto_inc, 1, increment, offset,
col_max_value);
err = innobase_set_max_autoinc(
@@ -8845,39 +8923,37 @@ ha_innobase::update_row(
/* A value for an AUTO_INCREMENT column
was specified in the UPDATE statement. */
- ulonglong offset;
- ulonglong increment;
-#ifdef WITH_WSREP
- /* Applier threads which are processing
- ROW events and don't go through server
- level autoinc processing, therefore
- m_prebuilt autoinc values don't get
- properly assigned. Fetch values from
- server side. */
- if (trx->is_wsrep() && wsrep_thd_is_applying(m_user_thd))
- wsrep_thd_auto_increment_variables(
- m_user_thd, &offset, &increment);
- else
-#endif /* WITH_WSREP */
- offset = m_prebuilt->autoinc_offset,
- increment = m_prebuilt->autoinc_increment;
-
- autoinc = innobase_next_autoinc(
- autoinc, 1, increment, offset,
- table->found_next_number_field->get_max_int_value());
-
- error = innobase_set_max_autoinc(autoinc);
-
- if (m_prebuilt->table->persistent_autoinc) {
- /* Update the PAGE_ROOT_AUTO_INC. Yes, we do
- this even if dict_table_t::autoinc already was
- greater than autoinc, because we cannot know
- if any INSERT actually used (and wrote to
- PAGE_ROOT_AUTO_INC) a value bigger than our
- autoinc. */
- btr_write_autoinc(dict_table_get_first_index(
- m_prebuilt->table),
- autoinc);
+ /* We need the upper limit of the col type to check for
+ whether we update the table autoinc counter or not. */
+ ulonglong col_max_value =
+ table->found_next_number_field->get_max_int_value();
+
+ /* This should filter out the negative
+ values set explicitly by the user. */
+ if (autoinc <= col_max_value) {
+ ulonglong offset;
+ ulonglong increment;
+
+ offset = m_prebuilt->autoinc_offset;
+ increment = m_prebuilt->autoinc_increment;
+
+ autoinc = innobase_next_autoinc(
+ autoinc, 1, increment, offset,
+ col_max_value);
+
+ error = innobase_set_max_autoinc(autoinc);
+
+ if (m_prebuilt->table->persistent_autoinc) {
+ /* Update the PAGE_ROOT_AUTO_INC. Yes, we do
+ this even if dict_table_t::autoinc already was
+ greater than autoinc, because we cannot know
+ if any INSERT actually used (and wrote to
+ PAGE_ROOT_AUTO_INC) a value bigger than our
+ autoinc. */
+ btr_write_autoinc(dict_table_get_first_index(
+ m_prebuilt->table),
+ autoinc);
+ }
}
}
@@ -10328,7 +10404,7 @@ wsrep_append_key(
THD *thd,
trx_t *trx,
TABLE_SHARE *table_share,
- const char* key,
+ const uchar* key,
uint16_t key_len,
Wsrep_service_key_type key_type /*!< in: access type of this key
(shared, exclusive, semi...) */
@@ -10440,8 +10516,8 @@ ha_innobase::wsrep_append_keys(
if (wsrep_protocol_version == 0) {
uint len;
- char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
- char *key = &keyval[0];
+ uchar keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
+ uchar *key = &keyval[0];
ibool is_null;
len = wsrep_store_key_val_for_row(
@@ -10482,12 +10558,12 @@ ha_innobase::wsrep_append_keys(
/* keyval[] shall contain an ordinal number at byte 0
and the actual key data shall be written at byte 1.
Hence the total data length is the key length + 1 */
- char keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
- char keyval1[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
- keyval0[0] = (char)i;
- keyval1[0] = (char)i;
- char* key0 = &keyval0[1];
- char* key1 = &keyval1[1];
+ uchar keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1]= {'\0'};
+ uchar keyval1[WSREP_MAX_SUPPORTED_KEY_LENGTH+1]= {'\0'};
+ keyval0[0] = (uchar)i;
+ keyval1[0] = (uchar)i;
+ uchar* key0 = &keyval0[1];
+ uchar* key1 = &keyval1[1];
if (!tab) {
WSREP_WARN("MariaDB-InnoDB key mismatch %s %s",
@@ -10561,22 +10637,20 @@ ha_innobase::wsrep_append_keys(
/* if no PK, calculate hash of full row, to be the key value */
if (!key_appended && wsrep_certify_nonPK) {
uchar digest[16];
- int rcode;
wsrep_calc_row_hash(digest, record0, table, m_prebuilt);
- if ((rcode = wsrep_append_key(thd, trx, table_share,
- (const char*) digest, 16,
- key_type))) {
+ if (int rcode = wsrep_append_key(thd, trx, table_share,
+ digest, 16, key_type)) {
DBUG_RETURN(rcode);
}
if (record1) {
wsrep_calc_row_hash(
digest, record1, table, m_prebuilt);
- if ((rcode = wsrep_append_key(thd, trx, table_share,
- (const char*) digest,
- 16, key_type))) {
+ if (int rcode = wsrep_append_key(thd, trx, table_share,
+ digest, 16,
+ key_type)) {
DBUG_RETURN(rcode);
}
}
@@ -14185,6 +14259,13 @@ ha_innobase::info_low(
if (dict_stats_is_persistent_enabled(ib_table)) {
if (is_analyze) {
+ row_mysql_lock_data_dictionary(
+ m_prebuilt->trx);
+ dict_stats_recalc_pool_del(ib_table);
+ dict_stats_wait_bg_to_stop_using_table(
+ ib_table, m_prebuilt->trx);
+ row_mysql_unlock_data_dictionary(
+ m_prebuilt->trx);
opt = DICT_STATS_RECALC_PERSISTENT;
} else {
/* This is e.g. 'SHOW INDEXES', fetch
@@ -14197,6 +14278,13 @@ ha_innobase::info_low(
ret = dict_stats_update(ib_table, opt);
+ if (opt == DICT_STATS_RECALC_PERSISTENT) {
+ mutex_enter(&dict_sys.mutex);
+ ib_table->stats_bg_flag
+ &= byte(~BG_STAT_SHOULD_QUIT);
+ mutex_exit(&dict_sys.mutex);
+ }
+
if (ret != DB_SUCCESS) {
m_prebuilt->trx->op_info = "";
DBUG_RETURN(HA_ERR_GENERIC);
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index dbc53d0b786..fd12b0e3c9e 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2020, MariaDB Corporation.
+Copyright (c) 2013, 2021, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -152,7 +152,6 @@ static const ulint OS_FILE_NORMAL = 62;
/** Types for file create @{ */
static const ulint OS_DATA_FILE = 100;
static const ulint OS_LOG_FILE = 101;
-static const ulint OS_DATA_TEMP_FILE = 102;
static const ulint OS_DATA_FILE_NO_O_DIRECT = 103;
/* @} */
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index bf38252578b..62908d37337 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -2890,7 +2890,6 @@ os_file_create_func(
ut_a(type == OS_LOG_FILE
|| type == OS_DATA_FILE
- || type == OS_DATA_TEMP_FILE
|| type == OS_DATA_FILE_NO_O_DIRECT);
ut_a(purpose == OS_FILE_AIO || purpose == OS_FILE_NORMAL);
@@ -2938,7 +2937,7 @@ os_file_create_func(
/* We disable OS caching (O_DIRECT) only on data files */
if (!read_only
&& *success
- && (type != OS_LOG_FILE && type != OS_DATA_TEMP_FILE
+ && (type != OS_LOG_FILE
&& type != OS_DATA_FILE_NO_O_DIRECT)
&& (srv_file_flush_method == SRV_O_DIRECT
|| srv_file_flush_method == SRV_O_DIRECT_NO_FSYNC)) {
diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc
index c7613b618a1..597f603bbe3 100644
--- a/storage/innobase/trx/trx0i_s.cc
+++ b/storage/innobase/trx/trx0i_s.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1258,13 +1258,16 @@ static void fetch_data_into_cache(trx_i_s_cache_t *cache)
/* Capture the state of transactions */
mutex_enter(&trx_sys.mutex);
- for (const trx_t *trx= UT_LIST_GET_FIRST(trx_sys.trx_list);
+ for (trx_t *trx= UT_LIST_GET_FIRST(trx_sys.trx_list);
trx != NULL;
trx= UT_LIST_GET_NEXT(trx_list, trx))
{
- if (trx_is_started(trx) && trx != purge_sys.query->trx)
+ if (trx->state != TRX_STATE_NOT_STARTED && trx != purge_sys.query->trx)
{
- fetch_data_into_cache_low(cache, trx);
+ mutex_enter(&trx->mutex);
+ if (trx->state != TRX_STATE_NOT_STARTED)
+ fetch_data_into_cache_low(cache, trx);
+ mutex_exit(&trx->mutex);
if (cache->is_truncated)
break;
}
diff --git a/support-files/mariadb.pc.in b/support-files/mariadb.pc.in
index 7d321f28491..500e148d0ed 100644
--- a/support-files/mariadb.pc.in
+++ b/support-files/mariadb.pc.in
@@ -3,11 +3,12 @@ prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/@INSTALL_LIBDIR@
includedir=${prefix}/@INSTALL_INCLUDEDIR@
-# those are rarely present or not at all, but we export them regardless
+# its common to want to know where to install it.
+plugindir=${prefix}/@INSTALL_PLUGINDIR@
+# Below are rarely present or not at all, but we export them regardless
bindir=${prefix}/@INSTALL_BINDIR@
sbindir=${prefix}/@INSTALL_SBINDIR@
scriptdir=${prefix}/@INSTALL_SCRIPTDIR@
-plugindir=${prefix}/@INSTALL_PLUGINDIR@
docdir=${prefix}/@INSTALL_DOCDIR@
mandir=${prefix}/@INSTALL_MANDIR@
sharedir=${prefix}/@INSTALL_SHAREDIR@
diff --git a/vio/viossl.c b/vio/viossl.c
index a5b3396953e..91529ad31f7 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -97,6 +97,21 @@ static my_bool ssl_should_retry(Vio *vio, int ret, enum enum_vio_io_event *event
SSL *ssl= vio->ssl_arg;
my_bool should_retry= TRUE;
+#if defined(ERR_LIB_X509) && defined(X509_R_CERT_ALREADY_IN_HASH_TABLE)
+ /*
+ Ignore error X509_R_CERT_ALREADY_IN_HASH_TABLE.
+ This is a workaround for an OpenSSL bug in an older (< 1.1.1)
+ OpenSSL version.
+ */
+ unsigned long err = ERR_peek_error();
+ if (ERR_GET_LIB(err) == ERR_LIB_X509 &&
+ ERR_GET_REASON(err) == X509_R_CERT_ALREADY_IN_HASH_TABLE)
+ {
+ ERR_clear_error();
+ return TRUE;
+ }
+#endif
+
/* Retrieve the result for the SSL I/O operation. */
ssl_error= SSL_get_error(ssl, ret);