summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzr-mysql/default.conf2
-rw-r--r--.bzrignore2
-rwxr-xr-xCMakeLists.txt4
-rw-r--r--client/Makefile.am3
-rw-r--r--client/my_readline.h5
-rw-r--r--client/mysqlbinlog.cc25
-rw-r--r--client/sql_string.h5
-rw-r--r--dbug/dbug.c28
-rw-r--r--extra/my_print_defaults.c3
-rw-r--r--include/atomic/gcc_builtins.h5
-rw-r--r--include/atomic/nolock.h4
-rw-r--r--include/atomic/rwlock.h4
-rw-r--r--include/atomic/x86-gcc.h4
-rw-r--r--include/config-win.h5
-rw-r--r--include/errmsg.h4
-rw-r--r--include/help_end.h4
-rw-r--r--include/help_start.h4
-rw-r--r--include/my_aes.h5
-rw-r--r--include/my_atomic.h4
-rw-r--r--include/my_bit.h5
-rw-r--r--include/my_dbug.h19
-rw-r--r--include/my_libwrap.h4
-rw-r--r--include/my_md5.h5
-rw-r--r--include/my_no_pthread.h8
-rw-r--r--include/my_sys.h1
-rw-r--r--include/my_uctype.h4
-rw-r--r--include/myisampack.h4
-rw-r--r--include/mysql/plugin.h77
-rw-r--r--include/mysql/plugin.h.pp12
-rw-r--r--include/mysql_com.h6
-rw-r--r--include/mysql_embed.h4
-rw-r--r--include/rijndael.h5
-rw-r--r--include/sha1.h5
-rw-r--r--include/sql_common.h4
-rw-r--r--include/sslopt-case.h4
-rw-r--r--include/sslopt-longopts.h4
-rw-r--r--include/sslopt-vars.h4
-rw-r--r--libmysql/client_settings.h6
-rw-r--r--libmysqld/CMakeLists.txt1
-rw-r--r--libmysqld/Makefile.am5
-rw-r--r--mysql-test/collections/default.experimental3
-rw-r--r--mysql-test/extra/binlog_tests/binlog.test4
-rw-r--r--mysql-test/extra/binlog_tests/implicit.test28
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test4
-rw-r--r--mysql-test/extra/rpl_tests/check_type.inc52
-rw-r--r--mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test7
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_id.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_loaddata.test6
-rw-r--r--mysql-test/extra/rpl_tests/rpl_log.test6
-rw-r--r--mysql-test/extra/rpl_tests/rpl_reset_slave.test1
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_basic.test39
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_blob.test12
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_func003.test36
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp003.test5
-rw-r--r--mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc121
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_000001.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_trig004.test5
-rw-r--r--mysql-test/extra/rpl_tests/type_conversions.test710
-rw-r--r--mysql-test/include/have_semisync_plugin.inc22
-rw-r--r--mysql-test/include/have_ssl_communication.inc4
-rw-r--r--mysql-test/include/master-slave-reset.inc47
-rw-r--r--mysql-test/include/master-slave.inc7
-rw-r--r--mysql-test/include/not_ndb_default.inc2
-rw-r--r--mysql-test/include/setup_fake_relay_log.inc16
-rw-r--r--mysql-test/include/show_binlog_events.inc29
-rw-r--r--mysql-test/include/show_binlog_events2.inc2
-rw-r--r--mysql-test/include/show_relaylog_events.inc35
-rw-r--r--mysql-test/include/test_fieldsize.inc2
-rw-r--r--mysql-test/include/wait_for_ndb_to_binlog.inc41
-rw-r--r--mysql-test/include/wait_show_condition.inc74
-rw-r--r--mysql-test/include/wait_until_disconnected.inc2
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl29
-rwxr-xr-xmysql-test/mysql-test-run.pl40
-rw-r--r--mysql-test/r/ctype_cp932_binlog_stm.result14
-rw-r--r--mysql-test/r/debug_sync.result2
-rw-r--r--mysql-test/r/deprecated_features.result26
-rw-r--r--mysql-test/r/events_bugs.result4
-rw-r--r--mysql-test/r/flush2.result2
-rw-r--r--mysql-test/r/flush_block_commit_notembedded.result4
-rw-r--r--mysql-test/r/grant2.result4
-rw-r--r--mysql-test/r/information_schema_db.result2
-rw-r--r--mysql-test/r/multi_update.result4
-rw-r--r--mysql-test/r/mysqlbinlog_row_innodb.result40
-rw-r--r--mysql-test/r/mysqlbinlog_row_myisam.result8
-rw-r--r--mysql-test/r/mysqldump.result8
-rw-r--r--mysql-test/r/outfile_loaddata.result20
-rw-r--r--mysql-test/r/ps_1general.result2
-rw-r--r--mysql-test/r/show_check.result7
-rw-r--r--mysql-test/r/sp-code.result4
-rw-r--r--mysql-test/r/sp-error.result20
-rw-r--r--mysql-test/r/sp-security.result4
-rw-r--r--mysql-test/r/sp.result9
-rw-r--r--mysql-test/r/sp_trans.result4
-rw-r--r--mysql-test/r/sp_trans_log.result10
-rw-r--r--mysql-test/r/strict.result2
-rw-r--r--mysql-test/r/trigger_notembedded.result4
-rw-r--r--mysql-test/r/type_blob.result16
-rw-r--r--mysql-test/r/type_timestamp.result26
-rw-r--r--mysql-test/r/view_grant.result12
-rw-r--r--mysql-test/r/warnings.result3
-rw-r--r--mysql-test/suite/binlog/r/binlog_grant.result6
-rw-r--r--mysql-test/suite/binlog/r/binlog_implicit_commit.result345
-rw-r--r--mysql-test/suite/binlog/r/binlog_innodb.result10
-rw-r--r--mysql-test/suite/binlog/r/binlog_max_extension.result8
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_binlog.result1652
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_binlog.result852
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result16
-rw-r--r--mysql-test/suite/binlog/r/binlog_tmp_table.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_unsafe.result56
-rw-r--r--mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test19
-rw-r--r--mysql-test/suite/binlog/t/binlog_implicit_commit.test63
-rw-r--r--mysql-test/suite/binlog/t/binlog_incident.test2
-rw-r--r--mysql-test/suite/binlog/t/binlog_innodb.test6
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed.test2
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed_simulate.test4
-rw-r--r--mysql-test/suite/binlog/t/binlog_max_extension.test92
-rw-r--r--mysql-test/suite/binlog/t/binlog_tmp_table.test3
-rw-r--r--mysql-test/suite/binlog/t/binlog_unsafe.test68
-rw-r--r--mysql-test/suite/federated/federated_server.result8
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_03e.result4
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_03e.result4
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_03e.result4
-rw-r--r--mysql-test/suite/funcs_1/r/ndb_trig_03e.result4
-rw-r--r--mysql-test/suite/parts/r/rpl_partition.result2
-rw-r--r--mysql-test/suite/rpl/my.cnf9
-rw-r--r--mysql-test/suite/rpl/r/rpl000017.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_000015.result46
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_grant.result42
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug31076.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug33931.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug41902.result34
-rw-r--r--mysql-test/suite/rpl/r/rpl_change_master.result21
-rw-r--r--mysql-test/suite/rpl/r/rpl_colSize.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_deadlock_innodb.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_empty_master_crash.result11
-rw-r--r--mysql-test/suite/rpl/r/rpl_empty_master_host.result16
-rw-r--r--mysql-test/suite/rpl/r/rpl_extraCol_innodb.result87
-rw-r--r--mysql-test/suite/rpl/r/rpl_extraCol_myisam.result87
-rw-r--r--mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result90
-rw-r--r--mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result90
-rw-r--r--mysql-test/suite/rpl/r/rpl_flush_logs.result67
-rw-r--r--mysql-test/suite/rpl/r/rpl_flushlog_loop.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_grant.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat.result143
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result55
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_basic.result299
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result27
-rw-r--r--mysql-test/suite/rpl/r/rpl_incident.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_known_bugs_detection.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_load_from_master.result133
-rw-r--r--mysql-test/suite/rpl/r/rpl_load_table_from_master.result51
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata.result132
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_fatal.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_log_pos.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_replicate_do.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_rotate_logs.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result18
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_colSize.result130
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_conflicts.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_create_table.result138
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_drop.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log_innodb.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_max_relay_size.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_reset_slave.result11
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result274
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result17
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_until.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync.result440
-rw-r--r--mysql-test/suite/rpl/r/rpl_server_id_ignore.result46
-rw-r--r--mysql-test/suite/rpl/r/rpl_show_slave_hosts.result17
-rw-r--r--mysql-test/suite/rpl/r/rpl_skip_error.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_skip.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_slow_query_log.result49
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result189
-rw-r--r--mysql-test/suite/rpl/r/rpl_spec_variables.result225
-rw-r--r--mysql-test/suite/rpl/r/rpl_ssl.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_ssl1.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_log.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result148
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_reset_slave.result11
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_until.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_stop_middle_group.result61
-rw-r--r--mysql-test/suite/rpl/r/rpl_sync.result40
-rw-r--r--mysql-test/suite/rpl/r/rpl_temporary.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_temporary_errors.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_typeconv.result466
-rw-r--r--mysql-test/suite/rpl/r/rpl_typeconv_innodb.result18
-rw-r--r--mysql-test/suite/rpl/t/disabled.def1
-rw-r--r--mysql-test/suite/rpl/t/rpl000010.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl000011.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl000013.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl000017-slave.opt1
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/rpl/t/rpl000017-slave.sh0
-rw-r--r--mysql-test/suite/rpl/t/rpl000017.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015-slave.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_alter.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment_11932.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_grant.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_bit.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_bit_npk.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug31076.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug33931.test14
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug41902-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug41902.test61
-rw-r--r--mysql-test/suite/rpl/t/rpl_change_master.test55
-rw-r--r--mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_colSize.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_do_grant.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_view.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_dual_pos_advance.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_empty_master_crash-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_empty_master_crash.test14
-rw-r--r--mysql-test/suite/rpl/t/rpl_empty_master_host.test51
-rw-r--r--mysql-test/suite/rpl/t/rpl_flush_logs-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_flush_logs.test172
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh0
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat.test168
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf17
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test142
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf7
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_basic.test541
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test54
-rw-r--r--mysql-test/suite/rpl/t/rpl_known_bugs_detection.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_load_from_master.test181
-rw-r--r--mysql-test/suite/rpl/t/rpl_load_table_from_master.test98
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_charset.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_fatal.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_m.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_s.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddatalocal.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_master_pos_wait.test4
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh0
-rw-r--r--mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_delete.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_delete2.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_optimize.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_ps.test24
-rw-r--r--mysql-test/suite/rpl/t/rpl_relayspace.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_replicate_do.test8
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh0
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_create_table.test24
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test26
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test18
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp001.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp005.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp008.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp009.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp010.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test32
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig002.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig003.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync.test585
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id2.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id_ignore.test114
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var.test21
-rw-r--r--mysql-test/suite/rpl/t/rpl_set_charset.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_show_slave_hosts.cnf20
-rw-r--r--mysql-test/suite/rpl/t/rpl_show_slave_hosts.test47
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_skip.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_status.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_slow_query_log-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_slow_query_log.test187
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp-slave.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp.test28
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp004.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_spec_variables.test306
-rw-r--r--mysql-test/suite/rpl/t/rpl_sporadic_master.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl1.test19
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_stop_slave.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test18
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_until.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_stop_middle_group.test149
-rw-r--r--mysql-test/suite/rpl/t/rpl_sync-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_sync.test148
-rw-r--r--mysql-test/suite/rpl/t/rpl_temp_table.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporary.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_trigger.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_typeconv-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_typeconv.test69
-rw-r--r--mysql-test/suite/rpl/t/rpl_typeconv_innodb.test29
-rw-r--r--mysql-test/suite/rpl/t/rpl_user_variables.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_variables_stm.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_view.test12
-rw-r--r--mysql-test/suite/rpl_ndb/my.cnf10
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result2
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result4
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result4
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result85
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result12
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result12
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result246
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result4
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result2
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result12
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result68
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf5
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt1
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt1
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test373
-rw-r--r--mysql-test/suite/sys_vars/r/read_only_func.result2
-rwxr-xr-xmysql-test/t/backup-master.sh5
-rw-r--r--mysql-test/t/backup.test104
-rw-r--r--mysql-test/t/ctype_cp932_binlog_stm.test6
-rw-r--r--mysql-test/t/deprecated_features.test27
-rw-r--r--mysql-test/t/mysqlbinlog.test29
-rw-r--r--mysql-test/t/mysqlbinlog2.test20
-rw-r--r--mysql-test/t/ps_1general.test3
-rw-r--r--mysql-test/t/show_check.test14
-rw-r--r--mysql-test/t/sp-error.test19
-rw-r--r--mysql-test/t/sp.test7
-rw-r--r--mysql-test/t/sp_trans.test2
-rw-r--r--mysql-test/t/sp_trans_log.test3
-rw-r--r--mysql-test/t/system_mysql_db_fix40123.test6
-rw-r--r--mysql-test/t/system_mysql_db_fix50030.test8
-rw-r--r--mysql-test/t/system_mysql_db_fix50117.test6
-rw-r--r--mysql-test/t/type_blob.test14
-rw-r--r--mysql-test/t/type_timestamp.test13
-rw-r--r--mysql-test/t/warnings.test5
-rw-r--r--mysys/default.c45
-rw-r--r--mysys/my_delete.c41
-rw-r--r--mysys/my_getopt.c33
-rw-r--r--mysys/my_handler_errors.h3
-rw-r--r--mysys/my_static.h5
-rw-r--r--plugin/semisync/CMakeLists.txt35
-rw-r--r--plugin/semisync/Makefile.am38
-rw-r--r--plugin/semisync/configure.in9
-rw-r--r--plugin/semisync/plug.in3
-rw-r--r--plugin/semisync/semisync.cc30
-rw-r--r--plugin/semisync/semisync.h91
-rw-r--r--plugin/semisync/semisync_master.cc1310
-rw-r--r--plugin/semisync/semisync_master.h374
-rw-r--r--plugin/semisync/semisync_master_plugin.cc394
-rw-r--r--plugin/semisync/semisync_slave.cc138
-rw-r--r--plugin/semisync/semisync_slave.h96
-rw-r--r--plugin/semisync/semisync_slave_plugin.cc226
-rw-r--r--scripts/mysql_system_tables.sql6
-rw-r--r--scripts/mysql_system_tables_fix.sql2
-rw-r--r--sql-common/client.c2
-rwxr-xr-xsql/CMakeLists.txt1
-rw-r--r--sql/Makefile.am6
-rw-r--r--sql/authors.h5
-rw-r--r--sql/client_settings.h6
-rw-r--r--sql/contributors.h5
-rw-r--r--sql/field.cc293
-rw-r--r--sql/field.h50
-rw-r--r--sql/gstream.h5
-rw-r--r--sql/ha_ndbcluster.h5
-rw-r--r--sql/ha_ndbcluster_binlog.h5
-rw-r--r--sql/ha_ndbcluster_cond.h5
-rw-r--r--sql/ha_ndbcluster_tables.h5
-rw-r--r--sql/ha_partition.h5
-rw-r--r--sql/handler.cc60
-rw-r--r--sql/handler.h23
-rw-r--r--sql/item.h5
-rw-r--r--sql/item_cmpfunc.h4
-rw-r--r--sql/item_func.h4
-rw-r--r--sql/item_geofunc.h4
-rw-r--r--sql/item_row.h5
-rw-r--r--sql/item_strfunc.h4
-rw-r--r--sql/item_subselect.h5
-rw-r--r--sql/item_sum.h5
-rw-r--r--sql/item_timefunc.h5
-rw-r--r--sql/item_xmlfunc.h4
-rw-r--r--sql/lex.h14
-rw-r--r--sql/log.cc276
-rw-r--r--sql/log.h50
-rw-r--r--sql/log_event.cc192
-rw-r--r--sql/log_event.h67
-rw-r--r--sql/log_event_old.cc54
-rw-r--r--sql/message.h7
-rw-r--r--sql/mysql_priv.h139
-rw-r--r--sql/mysqld.cc245
-rw-r--r--sql/mysqld_suffix.h4
-rw-r--r--sql/nt_servc.h5
-rw-r--r--sql/partition_element.h5
-rw-r--r--sql/partition_info.h5
-rw-r--r--sql/procedure.h5
-rw-r--r--sql/protocol.h4
-rw-r--r--sql/repl_failsafe.cc332
-rw-r--r--sql/repl_failsafe.h4
-rw-r--r--sql/replication.h490
-rw-r--r--sql/rpl_handler.cc493
-rw-r--r--sql/rpl_handler.h213
-rw-r--r--sql/rpl_mi.cc198
-rw-r--r--sql/rpl_mi.h18
-rw-r--r--sql/rpl_record.cc63
-rw-r--r--sql/rpl_rli.cc18
-rw-r--r--sql/rpl_rli.h55
-rw-r--r--sql/rpl_utility.cc884
-rw-r--r--sql/rpl_utility.h193
-rw-r--r--sql/scheduler.h5
-rw-r--r--sql/set_var.cc112
-rw-r--r--sql/set_var.h52
-rw-r--r--sql/share/errmsg.txt18
-rw-r--r--sql/slave.cc880
-rw-r--r--sql/slave.h13
-rw-r--r--sql/sp_head.cc4
-rw-r--r--sql/sql_acl.h4
-rw-r--r--sql/sql_analyse.h5
-rw-r--r--sql/sql_array.h4
-rw-r--r--sql/sql_base.cc4
-rw-r--r--sql/sql_binlog.cc2
-rw-r--r--sql/sql_class.cc39
-rw-r--r--sql/sql_class.h34
-rw-r--r--sql/sql_crypt.h5
-rw-r--r--sql/sql_lex.h18
-rw-r--r--sql/sql_map.h5
-rw-r--r--sql/sql_parse.cc221
-rw-r--r--sql/sql_partition.cc4
-rw-r--r--sql/sql_partition.h4
-rw-r--r--sql/sql_plugin.cc17
-rw-r--r--sql/sql_plugin.h8
-rw-r--r--sql/sql_repl.cc510
-rw-r--r--sql/sql_repl.h4
-rw-r--r--sql/sql_select.cc12
-rw-r--r--sql/sql_select.h4
-rw-r--r--sql/sql_servers.h5
-rw-r--r--sql/sql_show.cc29
-rw-r--r--sql/sql_sort.h5
-rw-r--r--sql/sql_string.h5
-rw-r--r--sql/sql_table.cc90
-rw-r--r--sql/sql_trigger.h4
-rw-r--r--sql/sql_udf.h4
-rw-r--r--sql/sql_view.h4
-rw-r--r--sql/sql_yacc.yy218
-rw-r--r--sql/structs.h5
-rw-r--r--sql/table.h4
-rw-r--r--sql/tzfile.h5
-rw-r--r--sql/tztime.h4
-rw-r--r--sql/unireg.h5
-rw-r--r--storage/myisam/ha_myisam.cc191
-rw-r--r--storage/myisam/ha_myisam.h6
-rw-r--r--storage/ndb/test/run-test/setup.cpp8
-rw-r--r--strings/strings-not-used.h4
-rw-r--r--tests/mysql_client_test.c22
-rw-r--r--vio/vio_priv.h4
464 files changed, 18706 insertions, 5483 deletions
diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf
index f044f8e62da..4e9e581f800 100644
--- a/.bzr-mysql/default.conf
+++ b/.bzr-mysql/default.conf
@@ -1,4 +1,4 @@
[MYSQL]
post_commit_to = "commits@lists.mysql.com"
post_push_to = "commits@lists.mysql.com"
-tree_name = "mysql-5.1"
+tree_name = "mysql-5.1-rep+2"
diff --git a/.bzrignore b/.bzrignore
index e1e2083e2d2..c87963acb3e 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -392,6 +392,7 @@ client/rpl_record_old.h
client/rpl_tblmap.h
client/rpl_tblmap.cc
client/rpl_utility.h
+client/rpl_utility.cc
client/select_test
client/sql_string.cpp
client/ssl_test
@@ -1142,6 +1143,7 @@ libmysqld/rpl_filter.cc
libmysqld/rpl_injector.cc
libmysqld/rpl_record.cc
libmysqld/rpl_record_old.cc
+libmysqld/rpl_utility.cc
libmysqld/scheduler.cc
libmysqld/set_var.cc
libmysqld/simple-test
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7da3bd05cef..ac8a79927d8 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -287,6 +287,10 @@ FOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES})
ADD_SUBDIRECTORY(${DIR})
ENDFOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES})
+# Add subdirectories for semisync plugin
+IF(NOT WITHOUT_DYNAMIC_PLUGINS)
+ ADD_SUBDIRECTORY(plugin/semisync)
+ENDIF(NOT WITHOUT_DYNAMIC_PLUGINS)
# FIXME "debug" only needed if build type is "Debug", but
# CMAKE_BUILD_TYPE is not set during configure time.
diff --git a/client/Makefile.am b/client/Makefile.am
index ccd0d8aada0..14343bc60c3 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -104,9 +104,10 @@ DEFS = -DMYSQL_CLIENT_NO_THREADS \
-DMYSQL_DATADIR="\"$(localstatedir)\""
sql_src=log_event.h mysql_priv.h rpl_constants.h \
- rpl_utility.h rpl_tblmap.h rpl_tblmap.cc \
+ rpl_tblmap.h rpl_tblmap.cc \
log_event.cc my_decimal.h my_decimal.cc \
log_event_old.h log_event_old.cc \
+ rpl_utility.h rpl_utility.cc \
rpl_record_old.h rpl_record_old.cc
strings_src=decimal.c
diff --git a/client/my_readline.h b/client/my_readline.h
index 62ad19bece9..08cff565819 100644
--- a/client/my_readline.h
+++ b/client/my_readline.h
@@ -1,3 +1,6 @@
+#ifndef CLIENT_MY_READLINE_INCLUDED
+#define CLIENT_MY_READLINE_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -31,3 +34,5 @@ extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str);
extern char *batch_readline(LINE_BUFFER *buffer, bool *truncated);
extern void batch_readline_end(LINE_BUFFER *buffer);
+
+#endif /* CLIENT_MY_READLINE_INCLUDED */
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index f55dc75df5d..32945f0cf89 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -442,6 +442,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
{
error("Could not construct local filename %s%s.",
target_dir_name,bname);
+ my_free(fname, MYF(0));
delete ce;
DBUG_RETURN(ERROR_STOP);
}
@@ -449,9 +450,15 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
rec.fname= fname;
rec.event= ce;
+ /*
+ fname is freed in process_event()
+ after Execute_load_query_log_event or Execute_load_log_event
+ will have been processed, otherwise in Load_log_processor::destroy()
+ */
if (set_dynamic(&file_names, (uchar*)&rec, file_id))
{
error("Out of memory.");
+ my_free(fname, MYF(0));
delete ce;
DBUG_RETURN(ERROR_STOP);
}
@@ -831,7 +838,17 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
print_event_info->common_header_len=
glob_description_event->common_header_len;
ev->print(result_file, print_event_info);
- ev->temp_buf= 0; // as the event ref is zeroed
+ if (!remote_opt)
+ {
+ ev->free_temp_buf(); // free memory allocated in dump_local_log_entries
+ }
+ else
+ {
+ /*
+ disassociate but not free dump_remote_log_entries time memory
+ */
+ ev->temp_buf= 0;
+ }
/*
We don't want this event to be deleted now, so let's hide it (I
(Guilhem) should later see if this triggers a non-serious Valgrind
@@ -1358,7 +1375,6 @@ static int parse_args(int *argc, char*** argv)
int ho_error;
result_file = stdout;
- load_defaults("my",load_default_groups,argc,argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (debug_info_flag)
@@ -2015,8 +2031,9 @@ int main(int argc, char** argv)
my_init_time(); // for time functions
+ load_defaults("my", load_default_groups, &argc, &argv);
+ defaults_argv= argv;
parse_args(&argc, (char***)&argv);
- defaults_argv=argv;
if (!argc)
{
@@ -2122,4 +2139,4 @@ int main(int argc, char** argv)
#include "my_decimal.cc"
#include "log_event.cc"
#include "log_event_old.cc"
-
+#include "rpl_utility.cc"
diff --git a/client/sql_string.h b/client/sql_string.h
index da19c1ccfe5..0e6d6da4476 100644
--- a/client/sql_string.h
+++ b/client/sql_string.h
@@ -1,3 +1,6 @@
+#ifndef CLIENT_SQL_STRING_INCLUDED
+#define CLIENT_SQL_STRING_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -353,3 +356,5 @@ public:
return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length);
}
};
+
+#endif /* CLIENT_SQL_STRING_INCLUDED */
diff --git a/dbug/dbug.c b/dbug/dbug.c
index baf080f5e27..1ea160852eb 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -1665,6 +1665,27 @@ BOOLEAN _db_keyword_(CODE_STATE *cs, const char *keyword)
/*
* FUNCTION
*
+ * _db_keywords_ test keyword formed by a set of strings for member
+ * of keyword list
+ *
+ * DESCRIPTION
+ *
+ * This function is similar to _db_keyword but receives a set of strings to
+ * be concatenated in order to make the keyword to be compared.
+ */
+
+BOOLEAN _db_keywords_(const char *function, const char *type)
+{
+ char dest[_DBUG_MAX_FUNC_NAME_ + 1];
+
+ strxnmov(dest, _DBUG_MAX_FUNC_NAME_, function, type, NULL);
+
+ return _db_strict_keyword_(dest);
+}
+
+/*
+ * FUNCTION
+ *
* Indent indent a line to the given indentation level
*
* SYNOPSIS
@@ -2281,6 +2302,13 @@ void _db_unlock_file_()
pthread_mutex_unlock(&THR_LOCK_dbug);
}
+const char* _db_get_func_(void)
+{
+ CODE_STATE *cs= 0;
+ get_code_state_or_return NULL;
+ return cs->func;
+}
+
/*
* Here we need the definitions of the clock routine. Add your
* own for whatever system that you have.
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index 06f7e51c380..42a5cbd6877 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -192,7 +192,8 @@ int main(int argc, char **argv)
}
for (argument= arguments+1 ; *argument ; argument++)
- puts(*argument);
+ if (*argument != args_separator) /* skip arguments separator */
+ puts(*argument);
my_free((char*) load_default_groups,MYF(0));
free_defaults(arguments);
diff --git a/include/atomic/gcc_builtins.h b/include/atomic/gcc_builtins.h
index 509701b30a5..01ebc38707e 100644
--- a/include/atomic/gcc_builtins.h
+++ b/include/atomic/gcc_builtins.h
@@ -1,3 +1,6 @@
+#ifndef ATOMIC_GCC_BUILTINS_INCLUDED
+#define ATOMIC_GCC_BUILTINS_INCLUDED
+
/* Copyright (C) 2008 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -31,3 +34,5 @@
#define make_atomic_store_body(S) \
(void) __sync_lock_test_and_set(a, v);
#endif
+
+#endif /* ATOMIC_GCC_BUILTINS_INCLUDED */
diff --git a/include/atomic/nolock.h b/include/atomic/nolock.h
index 10ac17884b6..2c652fd52c1 100644
--- a/include/atomic/nolock.h
+++ b/include/atomic/nolock.h
@@ -1,3 +1,6 @@
+#ifndef ATOMIC_NOLOCK_INCLUDED
+#define ATOMIC_NOLOCK_INCLUDED
+
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -42,3 +45,4 @@ typedef struct { } my_atomic_rwlock_t;
#endif
+#endif /* ATOMIC_NOLOCK_INCLUDED */
diff --git a/include/atomic/rwlock.h b/include/atomic/rwlock.h
index 18b77e93d80..0ff4d16c545 100644
--- a/include/atomic/rwlock.h
+++ b/include/atomic/rwlock.h
@@ -1,3 +1,6 @@
+#ifndef ATOMIC_RWLOCK_INCLUDED
+#define ATOMIC_RWLOCK_INCLUDED
+
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -46,3 +49,4 @@ typedef struct {pthread_rwlock_t rw;} my_atomic_rwlock_t;
#define make_atomic_load_body(S) ret= *a;
#define make_atomic_store_body(S) *a= v;
+#endif /* ATOMIC_RWLOCK_INCLUDED */
diff --git a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h
index d79dadbf05e..d8afa5bfbf1 100644
--- a/include/atomic/x86-gcc.h
+++ b/include/atomic/x86-gcc.h
@@ -1,3 +1,6 @@
+#ifndef ATOMIC_X86_GCC_INCLUDED
+#define ATOMIC_X86_GCC_INCLUDED
+
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -56,3 +59,4 @@
asm volatile ("; xchg %0, %1;" : "+m" (*a) : "r" (v))
#endif
+#endif /* ATOMIC_X86_GCC_INCLUDED */
diff --git a/include/config-win.h b/include/config-win.h
index af4915440b1..c00e26866b9 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -1,3 +1,6 @@
+#ifndef CONFIG_WIN_INCLUDED
+#define CONFIG_WIN_INCLUDED
+
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
@@ -410,3 +413,5 @@ inline ulonglong double2ulonglong(double d)
#define HAVE_UCA_COLLATIONS 1
#define HAVE_BOOL 1
+
+#endif /* CONFIG_WIN_INCLUDED */
diff --git a/include/errmsg.h b/include/errmsg.h
index a6d8c770de8..5754e99ba5e 100644
--- a/include/errmsg.h
+++ b/include/errmsg.h
@@ -1,3 +1,6 @@
+#ifndef ERRMSG_INCLUDED
+#define ERRMSG_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -100,3 +103,4 @@ extern const char *client_errors[]; /* Error messages */
#define CR_ERROR_LAST /*Copy last error nr:*/ 2057
/* Add error numbers before CR_ERROR_LAST and change it accordingly. */
+#endif /* ERRMSG_INCLUDED */
diff --git a/include/help_end.h b/include/help_end.h
index 4426cb80bce..92953efe35a 100644
--- a/include/help_end.h
+++ b/include/help_end.h
@@ -1,3 +1,6 @@
+#ifndef HELP_END_INCLUDED
+#define HELP_END_INCLUDED
+
/* Copyright (C) 2004-2005 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -20,3 +23,4 @@
#undef fputc
#undef putchar
#endif
+#endif /* HELP_END_INCLUDED */
diff --git a/include/help_start.h b/include/help_start.h
index 3ae20eea7d7..414f7ec93a0 100644
--- a/include/help_start.h
+++ b/include/help_start.h
@@ -1,3 +1,6 @@
+#ifndef HELP_START_INCLUDED
+#define HELP_START_INCLUDED
+
/* Copyright (C) 2004-2005 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -22,3 +25,4 @@
#define fputc(s,f) consoleprintf("%c", s)
#define putchar(s) consoleprintf("%c", s)
#endif
+#endif /* HELP_START_INCLUDED */
diff --git a/include/my_aes.h b/include/my_aes.h
index 1bbdf5663ea..2e2a66b4968 100644
--- a/include/my_aes.h
+++ b/include/my_aes.h
@@ -1,3 +1,6 @@
+#ifndef MY_AES_INCLUDED
+#define MY_AES_INCLUDED
+
/* Copyright (C) 2002 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -63,3 +66,5 @@ int my_aes_decrypt(const char *source, int source_length, char *dest,
int my_aes_get_size(int source_length);
C_MODE_END
+
+#endif /* MY_AES_INCLUDED */
diff --git a/include/my_atomic.h b/include/my_atomic.h
index ed439e5fe87..8481b8e6d5a 100644
--- a/include/my_atomic.h
+++ b/include/my_atomic.h
@@ -1,3 +1,6 @@
+#ifndef MY_ATOMIC_INCLUDED
+#define MY_ATOMIC_INCLUDED
+
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -140,3 +143,4 @@ extern int my_atomic_initialize();
#endif
+#endif /* MY_ATOMIC_INCLUDED */
diff --git a/include/my_bit.h b/include/my_bit.h
index 2e464e89049..5cbf4f8b83e 100644
--- a/include/my_bit.h
+++ b/include/my_bit.h
@@ -1,3 +1,6 @@
+#ifndef MY_BIT_INCLUDED
+#define MY_BIT_INCLUDED
+
/*
Some useful bit functions
*/
@@ -107,3 +110,5 @@ extern uint my_count_bits(ulonglong v);
extern uint my_count_bits_ushort(ushort v);
#endif /* HAVE_INLINE */
C_MODE_END
+
+#endif /* MY_BIT_INCLUDED */
diff --git a/include/my_dbug.h b/include/my_dbug.h
index 0ba72b2210d..0451a868aa4 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -45,6 +45,7 @@ extern "C" {
#if !defined(DBUG_OFF) && !defined(_lint)
struct _db_code_state_;
extern int _db_keyword_(struct _db_code_state_ *cs, const char *keyword);
+extern int _db_keywords_(const char *, const char *);
extern int _db_strict_keyword_(const char *keyword);
extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len);
extern int _db_explain_init_(char *buf, size_t len);
@@ -69,6 +70,7 @@ extern void _db_end_(void);
extern void _db_lock_file_(void);
extern void _db_unlock_file_(void);
extern FILE *_db_fp_(void);
+extern const char* _db_get_func_(void);
#ifdef __cplusplus
@@ -124,6 +126,20 @@ extern FILE *_db_fp_(void);
#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))
#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len))
#define IF_DBUG(A) A
+#define _DBUG_MAX_FUNC_NAME_ 255
+#define DBUG_CHECK_CRASH(func, op) \
+ do { \
+ if (_db_keywords_((func), (op))) \
+ { abort(); } \
+ } while (0)
+#define DBUG_CRASH_ENTER(func) \
+ DBUG_ENTER(func); DBUG_CHECK_CRASH(func, "_crash_enter")
+#define DBUG_CRASH_RETURN(val) \
+ do {DBUG_CHECK_CRASH(_db_get_func_(), "_crash_return"); \
+ DBUG_RETURN(val);} while(0)
+#define DBUG_CRASH_VOID_RETURN \
+ do {DBUG_CHECK_CRASH (_db_get_func_(), "_crash_return"); \
+ DBUG_VOID_RETURN;} while(0)
#else /* No debugger */
#define DBUG_ENTER(a1)
@@ -152,6 +168,9 @@ extern FILE *_db_fp_(void);
#define DBUG_EXPLAIN(buf,len)
#define DBUG_EXPLAIN_INITIAL(buf,len)
#define IF_DBUG(A)
+#define DBUG_CRASH_ENTER(func)
+#define DBUG_CRASH_RETURN(val) do { return(val); } while(0)
+#define DBUG_CRASH_VOID_RETURN do { return; } while(0)
#endif
#ifdef __cplusplus
}
diff --git a/include/my_libwrap.h b/include/my_libwrap.h
index 9a8579475fb..8235c00d8f3 100644
--- a/include/my_libwrap.h
+++ b/include/my_libwrap.h
@@ -1,3 +1,6 @@
+#ifndef MY_LIBWRAP_INCLUDED
+#define MY_LIBWRAP_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -25,3 +28,4 @@ extern int my_hosts_access(struct request_info *req);
extern char *my_eval_client(struct request_info *req);
#endif /* HAVE_LIBWRAP */
+#endif /* MY_LIBWRAP_INCLUDED */
diff --git a/include/my_md5.h b/include/my_md5.h
index 6458f27c5cc..782bef8a27a 100644
--- a/include/my_md5.h
+++ b/include/my_md5.h
@@ -1,3 +1,6 @@
+#ifndef MY_MD5_INCLUDED
+#define MY_MD5_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -52,3 +55,5 @@ do { \
my_MD5Update (&ctx, buf, len); \
my_MD5Final (digest, &ctx); \
} while (0)
+
+#endif /* MY_MD__INCLUDED */
diff --git a/include/my_no_pthread.h b/include/my_no_pthread.h
index b11dbff42f0..31c1bf2b6ac 100644
--- a/include/my_no_pthread.h
+++ b/include/my_no_pthread.h
@@ -1,3 +1,6 @@
+#ifndef MY_NO_PTHREAD_INCLUDED
+#define MY_NO_PTHREAD_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -14,9 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#if !defined(_my_no_pthread_h) && !defined(THREAD)
-#define _my_no_pthread_h
-
+#ifndef THREAD
/*
This block is to access some thread-related type definitions
@@ -48,3 +49,4 @@
#define rwlock_destroy(A)
#endif
+#endif /* MY_NO_PTHREAD_INCLUDED */
diff --git a/include/my_sys.h b/include/my_sys.h
index b4aac3a17bd..344869fac2d 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -853,6 +853,7 @@ extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len);
extern int get_defaults_options(int argc, char **argv,
char **defaults, char **extra_defaults,
char **group_suffix);
+extern const char *args_separator;
extern int my_load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv, const char ***);
extern int load_defaults(const char *conf_file, const char **groups,
diff --git a/include/my_uctype.h b/include/my_uctype.h
index 9aaf478810c..580eb646e11 100644
--- a/include/my_uctype.h
+++ b/include/my_uctype.h
@@ -1,3 +1,6 @@
+#ifndef MY_UCTYPE_INCLUDED
+#define MY_UCTYPE_INCLUDED
+
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -1477,3 +1480,4 @@ MY_UNI_CTYPE my_uni_ctype[256]={
};
+#endif /* MY_UCTYPE_INCLUDED */
diff --git a/include/myisampack.h b/include/myisampack.h
index 7d4871bd1cb..ecf35520a88 100644
--- a/include/myisampack.h
+++ b/include/myisampack.h
@@ -1,3 +1,6 @@
+#ifndef MYISAMPACK_INCLUDED
+#define MYISAMPACK_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -236,3 +239,4 @@
mi_int4store(((T) + 4), A); }}
#define mi_sizekorr(T) mi_uint4korr((uchar*) (T) + 4)
#endif
+#endif /* MYISAMPACK_INCLUDED */
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index 2e59262d061..45d0234cb67 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -16,6 +16,11 @@
#ifndef _my_plugin_h
#define _my_plugin_h
+/* size_t */
+#include <stdlib.h>
+
+typedef struct st_mysql MYSQL;
+
/*
On Windows, exports from DLL need to be declared
@@ -75,7 +80,8 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */
#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */
-#define MYSQL_MAX_PLUGIN_TYPE_NUM 5 /* The number of plugin types */
+#define MYSQL_REPLICATION_PLUGIN 5 /* The replication plugin type */
+#define MYSQL_MAX_PLUGIN_TYPE_NUM 6 /* The number of plugin types */
/* We use the following strings to define licenses for plugins */
#define PLUGIN_LICENSE_PROPRIETARY 0
@@ -650,6 +656,17 @@ struct st_mysql_information_schema
int interface_version;
};
+/*
+ API for Replication plugin. (MYSQL_REPLICATION_PLUGIN)
+*/
+ #define MYSQL_REPLICATION_INTERFACE_VERSION 0x0100
+
+ /**
+ Replication plugin descriptor
+ */
+ struct Mysql_replication {
+ int interface_version;
+ };
/*
st_mysql_value struct for reading values from mysqld.
@@ -801,6 +818,64 @@ void mysql_query_cache_invalidate4(MYSQL_THD thd,
const char *key, unsigned int key_length,
int using_trx);
+/**
+ Get the value of user variable as an integer.
+
+ This function will return the value of variable @a name as an
+ integer. If the original value of the variable is not an integer,
+ the value will be converted into an integer.
+
+ @param name user variable name
+ @param value pointer to return the value
+ @param null_value if not NULL, the function will set it to true if
+ the value of variable is null, set to false if not
+
+ @retval 0 Success
+ @retval 1 Variable not found
+*/
+int get_user_var_int(const char *name,
+ long long int *value, int *null_value);
+
+/**
+ Get the value of user variable as a double precision float number.
+
+ This function will return the value of variable @a name as real
+ number. If the original value of the variable is not a real number,
+ the value will be converted into a real number.
+
+ @param name user variable name
+ @param value pointer to return the value
+ @param null_value if not NULL, the function will set it to true if
+ the value of variable is null, set to false if not
+
+ @retval 0 Success
+ @retval 1 Variable not found
+*/
+int get_user_var_real(const char *name,
+ double *value, int *null_value);
+
+/**
+ Get the value of user variable as a string.
+
+ This function will return the value of variable @a name as
+ string. If the original value of the variable is not a string,
+ the value will be converted into a string.
+
+ @param name user variable name
+ @param value pointer to the value buffer
+ @param len length of the value buffer
+ @param precision precision of the value if it is a float number
+ @param null_value if not NULL, the function will set it to true if
+ the value of variable is null, set to false if not
+
+ @retval 0 Success
+ @retval 1 Variable not found
+*/
+int get_user_var_str(const char *name,
+ char *value, unsigned long len,
+ unsigned int precision, int *null_value);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/include/mysql/plugin.h.pp b/include/mysql/plugin.h.pp
index 50511f515ab..d864140333b 100644
--- a/include/mysql/plugin.h.pp
+++ b/include/mysql/plugin.h.pp
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+typedef struct st_mysql MYSQL;
struct st_mysql_lex_string
{
char *str;
@@ -105,6 +107,9 @@ struct st_mysql_information_schema
{
int interface_version;
};
+struct Mysql_replication {
+ int interface_version;
+};
struct st_mysql_value
{
int (*value_type)(struct st_mysql_value *);
@@ -137,3 +142,10 @@ void thd_get_xid(const void* thd, MYSQL_XID *xid);
void mysql_query_cache_invalidate4(void* thd,
const char *key, unsigned int key_length,
int using_trx);
+int get_user_var_int(const char *name,
+ long long int *value, int *null_value);
+int get_user_var_real(const char *name,
+ double *value, int *null_value);
+int get_user_var_str(const char *name,
+ char *value, unsigned long len,
+ unsigned int precision, int *null_value);
diff --git a/include/mysql_com.h b/include/mysql_com.h
index db5a5eb8741..43bdcb4c3c7 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -115,6 +115,12 @@ enum enum_server_command
thread */
#define REFRESH_MASTER 128 /* Remove all bin logs in the index
and truncate the index */
+#define REFRESH_ERROR_LOG 256 /* Rotate only the erorr log */
+#define REFRESH_ENGINE_LOG 512 /* Flush all storage engine logs */
+#define REFRESH_BINARY_LOG 1024 /* Flush the binary log */
+#define REFRESH_RELAY_LOG 2048 /* Flush the relay log */
+#define REFRESH_GENERAL_LOG 4096 /* Flush the general log */
+#define REFRESH_SLOW_LOG 8192 /* Flush the slow query log */
/* The following can't be set with mysql_refresh() */
#define REFRESH_READ_LOCK 16384 /* Lock tables for read */
diff --git a/include/mysql_embed.h b/include/mysql_embed.h
index 4a7fd3ef63c..0e5a360585e 100644
--- a/include/mysql_embed.h
+++ b/include/mysql_embed.h
@@ -1,3 +1,6 @@
+#ifndef MYSQL_EMBED_INCLUDED
+#define MYSQL_EMBED_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -28,3 +31,4 @@
#define DONT_USE_RAID
#endif /* EMBEDDED_LIBRARY */
+#endif /* MYSQL_EMBED_INCLUDED */
diff --git a/include/rijndael.h b/include/rijndael.h
index 89963a85c99..71df1c48dbf 100644
--- a/include/rijndael.h
+++ b/include/rijndael.h
@@ -1,3 +1,6 @@
+#ifndef RIJNDAEL_INCLUDED
+#define RIJNDAEL_INCLUDED
+
/* Copyright (C) 2002 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -39,3 +42,5 @@ void rijndaelEncrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr,
const uint8 pt[16], uint8 ct[16]);
void rijndaelDecrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr,
const uint8 ct[16], uint8 pt[16]);
+
+#endif /* RIJNDAEL_INCLUDED */
diff --git a/include/sha1.h b/include/sha1.h
index e476456a9bd..5b4dc5d46ed 100644
--- a/include/sha1.h
+++ b/include/sha1.h
@@ -1,3 +1,6 @@
+#ifndef SHA1_INCLUDED
+#define SHA1_INCLUDED
+
/* Copyright (C) 2002, 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -64,3 +67,5 @@ int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int);
int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]);
C_MODE_END
+
+#endif /* SHA__INCLUDED */
diff --git a/include/sql_common.h b/include/sql_common.h
index 9e43d076ba9..5fd8778d62b 100644
--- a/include/sql_common.h
+++ b/include/sql_common.h
@@ -1,3 +1,6 @@
+#ifndef SQL_COMMON_INCLUDED
+#define SQL_COMMON_INCLUDED
+
/* Copyright (C) 2003-2004, 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -48,3 +51,4 @@ void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate);
#define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41)
+#endif /* SQL_COMMON_INCLUDED */
diff --git a/include/sslopt-case.h b/include/sslopt-case.h
index adb9a28503b..ce46cf65cc9 100644
--- a/include/sslopt-case.h
+++ b/include/sslopt-case.h
@@ -1,3 +1,6 @@
+#ifndef SSLOPT_CASE_INCLUDED
+#define SSLOPT_CASE_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -26,3 +29,4 @@
opt_use_ssl= 1;
break;
#endif
+#endif /* SSLOPT_CASE_INCLUDED */
diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h
index c76b5dcd252..eae1424238b 100644
--- a/include/sslopt-longopts.h
+++ b/include/sslopt-longopts.h
@@ -1,3 +1,6 @@
+#ifndef SSLOPT_LONGOPTS_INCLUDED
+#define SSLOPT_LONGOPTS_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -43,3 +46,4 @@
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
#endif /* HAVE_OPENSSL */
+#endif /* SSLOPT_LONGOPTS_INCLUDED */
diff --git a/include/sslopt-vars.h b/include/sslopt-vars.h
index 3369f870db2..4493fbc59ab 100644
--- a/include/sslopt-vars.h
+++ b/include/sslopt-vars.h
@@ -1,3 +1,6 @@
+#ifndef SSLOPT_VARS_INCLUDED
+#define SSLOPT_VARS_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -29,3 +32,4 @@ SSL_STATIC char *opt_ssl_key = 0;
SSL_STATIC my_bool opt_ssl_verify_server_cert= 0;
#endif
#endif
+#endif /* SSLOPT_VARS_INCLUDED */
diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h
index f87e625771f..1fd8619a746 100644
--- a/libmysql/client_settings.h
+++ b/libmysql/client_settings.h
@@ -13,6 +13,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#ifndef CLIENT_SETTINGS_INCLUDED
+#define CLIENT_SETTINGS_INCLUDED
+#else
+#error You have already included an client_settings.h and it should not be included twice
+#endif /* CLIENT_SETTINGS_INCLUDED */
+
extern uint mysql_port;
extern char * mysql_unix_port;
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index db398258b69..a5094cfc83d 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -141,6 +141,7 @@ SET(LIBMYSQLD_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
../sql/partition_info.cc ../sql/sql_connect.cc
../sql/scheduler.cc ../sql/event_parse_data.cc
+ ../sql/rpl_handler.cc
${GEN_SOURCES}
${LIB_SOURCES})
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
index 16c45816bbf..526e394dd27 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -55,7 +55,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
item_geofunc.cc item_subselect.cc item_row.cc\
item_xmlfunc.cc \
key.cc lock.cc log.cc sql_state.c \
- log_event.cc rpl_record.cc \
+ log_event.cc rpl_record.cc rpl_utility.cc \
log_event_old.cc rpl_record_old.cc \
protocol.cc net_serv.cc opt_range.cc \
opt_sum.cc procedure.cc records.cc sql_acl.cc \
@@ -77,7 +77,8 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
debug_sync.cc \
sql_tablespace.cc \
rpl_injector.cc my_user.c partition_info.cc \
- sql_servers.cc event_parse_data.cc
+ sql_servers.cc event_parse_data.cc \
+ rpl_handler.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources)
nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources)
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index 5f3b7251ce1..4248b5b4087 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -24,6 +24,9 @@ rpl.rpl_trigger* # Bug#47810 2009-10-04 joro rpl.rpl_tri
rpl_ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
rpl_ndb.rpl_ndb_log # Bug#38998
+rpl.rpl_innodb_bug28430* @solaris # Bug#46029
+rpl.rpl_get_master_version_and_clock* # Bug#46931 2009-08-26 alik rpl.rpl_get_master_version_and_clock fails on hpux11.31
+rpl_ndb.rpl_ndb_extraCol* # BUG#41369 2008-12-10 alik, BUG#47741 2009-09-30 alfranio
stress.ddl_ndb # joro : NDB tests marked as experimental as agreed with bochklin
diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test
index b819996acb0..b79093b6740 100644
--- a/mysql-test/extra/binlog_tests/binlog.test
+++ b/mysql-test/extra/binlog_tests/binlog.test
@@ -43,10 +43,10 @@ commit;
drop table t1;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events in 'master-bin.000001' from 106;
+show binlog events in 'master-bin.000001' from 107;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events in 'master-bin.000002' from 106;
+show binlog events in 'master-bin.000002' from 107;
#
diff --git a/mysql-test/extra/binlog_tests/implicit.test b/mysql-test/extra/binlog_tests/implicit.test
new file mode 100644
index 00000000000..84d80288d36
--- /dev/null
+++ b/mysql-test/extra/binlog_tests/implicit.test
@@ -0,0 +1,28 @@
+# First part: outside a transaction
+RESET MASTER;
+eval $prepare;
+
+INSERT INTO t1 VALUES (1);
+source include/show_binlog_events.inc;
+eval $statement;
+source include/show_binlog_events.inc;
+if (`select '$cleanup' != ''`) {
+ eval $cleanup;
+}
+
+# Second part: inside a transaction
+RESET MASTER;
+eval $prepare;
+BEGIN;
+INSERT INTO t1 VALUES (2);
+source include/show_binlog_events.inc;
+eval $statement;
+source include/show_binlog_events.inc;
+INSERT INTO t1 VALUES (3);
+source include/show_binlog_events.inc;
+COMMIT;
+source include/show_binlog_events.inc;
+if (`select '$cleanup' != ''`) {
+ eval $cleanup;
+}
+
diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
index 5db79e4f848..da0b77fbc23 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
@@ -323,12 +323,12 @@ let $MYSQLD_DATADIR= `select @@datadir`;
# and does not make slave to stop)
if (`select @@binlog_format = 'ROW'`)
{
- --exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+ --exec $MYSQL_BINLOG --start-position=525 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
}
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
- --exec $MYSQL_BINLOG --start-position=555 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+ --exec $MYSQL_BINLOG --start-position=556 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
}
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
diff --git a/mysql-test/extra/rpl_tests/check_type.inc b/mysql-test/extra/rpl_tests/check_type.inc
new file mode 100644
index 00000000000..63491d81da4
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/check_type.inc
@@ -0,0 +1,52 @@
+# Helper file to perform one insert of a value into a table with
+# different types on master and slave. The file will insert the
+# result into the type_conversions table *on the slave* to get a
+# summary of failing and succeeding tests.
+
+# Input:
+# $source_type Type on the master
+# $target_type Type on the slave
+# $source_value Value on the master (inserted into the table)
+# $target_value Value on the slave (expected value in the table
+# on the slave)
+# $can_convert True if conversion shall work, false if it
+# shall generate an error
+
+
+connection master;
+disable_warnings;
+DROP TABLE IF EXISTS t1;
+enable_warnings;
+eval CREATE TABLE t1 (a $source_type);
+sync_slave_with_master;
+eval ALTER TABLE t1 MODIFY a $target_type;
+
+connection master;
+eval INSERT INTO t1 VALUES($source_value);
+if ($can_convert) {
+ sync_slave_with_master;
+ eval SELECT a = $target_value into @compare FROM t1;
+ eval INSERT INTO type_conversions SET
+ Source = "$source_type",
+ Target = "$target_type",
+ Flags = @@slave_type_conversions,
+ On_Master = $source_value,
+ Expected = $target_value,
+ Compare = @compare;
+ UPDATE type_conversions
+ SET On_Slave = (SELECT a FROM t1)
+ WHERE TestNo = LAST_INSERT_ID();
+}
+if (!$can_convert) {
+ connection slave;
+ wait_for_slave_to_stop;
+ let $error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+ eval INSERT INTO type_conversions SET
+ Source = "$source_type",
+ Target = "$target_type",
+ Flags = @@slave_type_conversions,
+ On_Master = $source_value,
+ Error = "$error";
+ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
+ START SLAVE;
+}
diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
index 46168d6b97a..69b375677b6 100644
--- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
+++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
@@ -36,6 +36,9 @@ sync_slave_with_master;
STOP SLAVE;
RESET SLAVE;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
+
eval CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(4) DEFAULT 'TEST')
@@ -62,6 +65,8 @@ SELECT * FROM t1 ORDER BY a;
sync_slave_with_master;
SELECT * FROM t1 ORDER BY a;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
+
--echo *** Drop t1 ***
connection master;
DROP TABLE t1;
@@ -515,7 +520,7 @@ sync_slave_with_master;
--echo *** Create t11 on slave ***
STOP SLAVE;
RESET SLAVE;
-eval CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
+eval CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
--echo *** Create t11 on Master ***
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id.test b/mysql-test/extra/rpl_tests/rpl_insert_id.test
index bd815d9de02..b076e73a215 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_id.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_id.test
@@ -179,7 +179,9 @@ begin
end|
delimiter ;|
+--disable_warnings
insert into t1 (last_id) values (0);
+--enable_warnings
drop trigger t1_bi;
@@ -512,7 +514,9 @@ set sql_log_bin=0;
insert into t2 (id) values(5),(6),(7);
delete from t2 where id>=5;
set sql_log_bin=1;
+--disable_warnings
insert into t1 select insid();
+--enable_warnings
select * from t1 order by id;
select * from t2 order by id;
diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test
index 7db12600456..e159242ed10 100644
--- a/mysql-test/extra/rpl_tests/rpl_loaddata.test
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test
@@ -72,7 +72,7 @@ start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
+--query_vertical show slave status;
# Trigger error again to test CHANGE MASTER
@@ -94,7 +94,7 @@ change master to master_user='test';
change master to master_user='root';
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
+--query_vertical show slave status;
# Trigger error again to test RESET SLAVE
@@ -116,7 +116,7 @@ stop slave;
reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
+--query_vertical show slave status;
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test
index e4ebfd68761..0517fea1be3 100644
--- a/mysql-test/extra/rpl_tests/rpl_log.test
+++ b/mysql-test/extra/rpl_tests/rpl_log.test
@@ -37,13 +37,13 @@ select count(*) from t1;
show binlog events;
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 106 limit 1;
+show binlog events from 107 limit 1;
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 106 limit 2;
+show binlog events from 107 limit 2;
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 106 limit 2,1;
+show binlog events from 107 limit 2,1;
flush logs;
# We need an extra update before doing save_master_pos.
diff --git a/mysql-test/extra/rpl_tests/rpl_reset_slave.test b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
index 1f88c792fce..428554ac598 100644
--- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test
+++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
@@ -22,6 +22,7 @@ source include/show_slave_status2.inc;
reset slave;
source include/show_slave_status2.inc;
+change master to master_user='root';
start slave;
sync_with_master;
source include/show_slave_status2.inc;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_basic.test b/mysql-test/extra/rpl_tests/rpl_row_basic.test
index 0ba27c69a55..a45527848be 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_basic.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test
@@ -6,6 +6,7 @@
# First we test tables with only an index.
#
+connection master;
eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ;
SELECT * FROM t1;
sync_slave_with_master;
@@ -156,6 +157,12 @@ SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5
# Testing special column types
#
+if (`select char_length('$bit_field_special') > 0`) {
+ SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
+ connection slave;
+ eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
+}
+
connection master;
eval CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = $type ;
@@ -164,6 +171,10 @@ SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
sync_slave_with_master;
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+if (`select char_length('$bit_field_special') > 0`) {
+ SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
+}
+
#
# Testing conflicting operations
#
@@ -350,6 +361,10 @@ eval CREATE TABLE t7 (i INT NOT NULL,
c CHAR(255) CHARACTER SET utf8 NOT NULL,
j INT NOT NULL) ENGINE = $type ;
+connection slave;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
+
--echo [expecting slave to replicate correctly]
connection master;
INSERT INTO t1 VALUES (1, "", 1);
@@ -370,17 +385,9 @@ let $diff_table_1=master:test.t2;
let $diff_table_2=slave:test.t2;
source include/diff_tables.inc;
---echo [expecting slave to stop]
-connection master;
-INSERT INTO t3 VALUES (1, "", 1);
-INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
-
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
-let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
-disable_query_log;
-eval SELECT "$last_error" AS Last_SQL_Error;
-enable_query_log;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
+
connection master;
RESET MASTER;
connection slave;
@@ -600,7 +607,15 @@ sync_slave_with_master;
connection master;
+# Since t1 contain a bit field, we have to do this trick to handle InnoDB
+if (`select char_length('$bit_field_special') > 0`) {
+ SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
+ connection slave;
+ eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
+}
+
--disable_warnings
+connection master;
eval CREATE TABLE t1 (a bit) ENGINE=$type;
INSERT IGNORE INTO t1 VALUES (NULL);
INSERT INTO t1 ( a ) VALUES ( 0 );
@@ -645,6 +660,10 @@ UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3;
sync_slave_with_master;
+if (`select char_length('$bit_field_special') > 0`) {
+ SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
+}
+
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
source include/diff_tables.inc;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_blob.test b/mysql-test/extra/rpl_tests/rpl_row_blob.test
index 080df7d75dd..762daa816c0 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_blob.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_blob.test
@@ -36,7 +36,7 @@ SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
save_master_pos;
connection slave;
sync_with_master;
-sleep 5;
+--source include/wait_for_ndb_to_binlog.inc
--echo
--echo **** Data Insert Validation Slave Section test.t1 ****
--echo
@@ -56,12 +56,10 @@ UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
--echo
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
-# Sleep is needed for NDB to allow time for
-# Injector thread to populate the bin log.
save_master_pos;
connection slave;
sync_with_master;
-sleep 5;
+--source include/wait_for_ndb_to_binlog.inc
--echo
--echo **** Data Update Validation Slave Section test.t1 ****
--echo
@@ -132,7 +130,7 @@ FROM test.t2 WHERE c1=2;
save_master_pos;
connection slave;
sync_with_master;
-sleep 5;
+--source include/wait_for_ndb_to_binlog.inc
--echo
--echo **** Data Insert Validation Slave Section test.t2 ****
--echo
@@ -155,12 +153,10 @@ SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
-# Sleep is needed for NDB to allow time for
-# Injector thread to populate the bin log.
save_master_pos;
connection slave;
sync_with_master;
-sleep 5;
+--source include/wait_for_ndb_to_binlog.inc
--echo
--echo **** Data Update Validation Slave Section test.t2 ****
--echo
diff --git a/mysql-test/extra/rpl_tests/rpl_row_func003.test b/mysql-test/extra/rpl_tests/rpl_row_func003.test
index 8ee2d863527..e72ab04aec3 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_func003.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_func003.test
@@ -3,10 +3,7 @@
# Original Date: Aug/15/2005 #
# Update: 08/29/2005 Comment out sleep. Only needed for debugging #
#############################################################################
-# Note: Many lines are commented out in this test case. These were used for #
-# creating the test case and debugging and are being left for #
-# debugging, but they can not be used for the regular testing as the #
-# Time changes and is not deteministic, so instead we dump both the #
+# Note: Time changes and is not deteministic, so instead we dump both the #
# master and slave and diff the dumps. If the dumps differ then the #
# test case will fail. To run during diff failuers, comment out the #
# diff. #
@@ -26,7 +23,6 @@ DROP TABLE IF EXISTS test.t1;
--enable_warnings
-
eval CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=$engine_type;
delimiter |;
@@ -44,33 +40,24 @@ END|
delimiter ;|
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
-sleep 6;
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
-sleep 6;
-
-#Select in this test are used for debugging
-#select * from test.t1;
-#connection slave;
-#select * from test.t1;
-connection master;
SET AUTOCOMMIT=0;
START TRANSACTION;
INSERT INTO test.t1 VALUES (null,test.f1());
ROLLBACK;
SET AUTOCOMMIT=1;
-#select * from test.t1;
-#sleep 6;
-
-#connection slave;
-#select * from test.t1;
-
-#connection master;
-#used for debugging
-#show binlog events;
+# Sync master and slave for all engines except NDB
+if (`SELECT UPPER(LEFT('$engine_type', 3)) != 'NDB'`) {
+ sync_slave_with_master;
+ connection master;
+}
+# Sync master and slave for NDB engine
+let $wait_time= 6;
+--source include/wait_for_ndb_to_binlog.inc
-# time to dump the databases and so we can see if they match
+# 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/func003_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func003_slave.sql
@@ -87,5 +74,8 @@ DROP TABLE test.t1;
diff_files $MYSQLTEST_VARDIR/tmp/func003_master.sql $MYSQLTEST_VARDIR/tmp/func003_slave.sql;
+# Clean up
+remove_file $MYSQLTEST_VARDIR/tmp/func003_master.sql;
+remove_file $MYSQLTEST_VARDIR/tmp/func003_slave.sql;
# End of 5.0 test case
diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp003.test b/mysql-test/extra/rpl_tests/rpl_row_sp003.test
index 7cf3d0fa19c..7bc326a3791 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_sp003.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp003.test
@@ -41,10 +41,7 @@ CALL test.p2();
SELECT release_lock("test");
SELECT * FROM test.t1;
#show binlog events;
-# Added sleep for use with NDB to ensure that
-# the injector thread will populate log before
-# we switch to the slave.
-sleep 5;
+--source include/wait_for_ndb_to_binlog.inc
sync_slave_with_master;
connection slave;
SELECT * FROM test.t1;
diff --git a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
new file mode 100644
index 00000000000..50036e564a7
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
@@ -0,0 +1,121 @@
+-- connection master
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS IN ... *********
+let $binary_log_file= master-bin.000001;
+-- source include/show_binlog_events.inc
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS *********
+let $binary_log_file= ;
+-- source include/show_binlog_events.inc
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows *********
+let $binary_log_file= ;
+let $binary_log_limit_row= 3;
+-- source include/show_binlog_events.inc
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
+let $binary_log_file= ;
+let $binary_log_limit_row= 3;
+let $binary_log_limit_offset= 1;
+-- source include/show_binlog_events.inc
+
+# clear show_binlog_event/show_relaylog_events parameters
+let $binary_log_file= ;
+let $binary_log_limit_row= ;
+let $binary_log_limit_offset= ;
+
+-- sync_slave_with_master
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS IN ... *********
+let $binary_log_file= slave-bin.000001;
+-- source include/show_binlog_events.inc
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS *********
+let $binary_log_file= ;
+-- source include/show_binlog_events.inc
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows *********
+let $binary_log_file= ;
+let $binary_log_limit_row= 3;
+-- source include/show_binlog_events.inc
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
+let $binary_log_file= ;
+let $binary_log_limit_row= 3;
+let $binary_log_limit_offset= 1;
+-- source include/show_binlog_events.inc
+
+# clear show_binlog_event/show_relaylog_events parameters
+let $binary_log_file= ;
+let $binary_log_limit_row= ;
+let $binary_log_limit_offset= ;
+
+-- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+let $binary_log_file= slave-relay-bin.000003;
+-- source include/show_relaylog_events.inc
+
+-- echo [SLAVE] ********* SOW RELAYLOG EVENTS *********
+let $binary_log_file= ;
+-- source include/show_relaylog_events.inc
+
+-- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows *********
+let $binary_log_file= slave-relay-bin.000003;
+let $binary_log_limit_row= 3;
+let $binary_log_limit_offset= ;
+-- source include/show_relaylog_events.inc
+
+-- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows *********
+let $binary_log_file= slave-relay-bin.000003;
+let $binary_log_limit_offset= 1;
+let $binary_log_limit_row= 3;
+-- source include/show_relaylog_events.inc
+
+FLUSH LOGS;
+
+-- connection master
+FLUSH LOGS;
+DROP TABLE t1;
+
+# clear show_binlog_event/show_relaylog_events parameters
+let $binary_log_file= ;
+let $binary_log_limit_row= ;
+let $binary_log_limit_offset= ;
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS IN ... *********
+let $binary_log_file= master-bin.000002;
+-- source include/show_binlog_events.inc
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS *********
+let $binary_log_file= ;
+-- source include/show_binlog_events.inc
+
+-- sync_slave_with_master
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS IN ... *********
+let $binary_log_file= slave-bin.000002;
+-- source include/show_binlog_events.inc
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS *********
+let $binary_log_file= ;
+-- source include/show_binlog_events.inc
+
+-- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+let $binary_log_file= slave-relay-bin.000005;
+-- source include/show_relaylog_events.inc
+
+-- echo [SLAVE] ********* SOW RELAYLOG EVENTS *********
+let $binary_log_file= ;
+-- source include/show_relaylog_events.inc
+
+# clear show_binlog_event/show_relaylog_events parameters
+let $binary_log_name= ;
+let $binary_log_limit_row= ;
+let $binary_log_limit_offset= ;
diff --git a/mysql-test/extra/rpl_tests/rpl_stm_000001.test b/mysql-test/extra/rpl_tests/rpl_stm_000001.test
index 4397e81aadf..1276b00d882 100644
--- a/mysql-test/extra/rpl_tests/rpl_stm_000001.test
+++ b/mysql-test/extra/rpl_tests/rpl_stm_000001.test
@@ -67,8 +67,8 @@ enable_query_log;
connection slave;
lock tables t1 read;
start slave;
-#hope this is long enough for I/O thread to fetch over 16K relay log data
-sleep 3;
+connection master;
+--source include/sync_slave_io_with_master.inc
unlock tables;
#test handling of aborted connection in the middle of update
diff --git a/mysql-test/extra/rpl_tests/rpl_trig004.test b/mysql-test/extra/rpl_tests/rpl_trig004.test
index 45cb11f2787..1a738db27fc 100644
--- a/mysql-test/extra/rpl_tests/rpl_trig004.test
+++ b/mysql-test/extra/rpl_tests/rpl_trig004.test
@@ -35,9 +35,8 @@ INSERT INTO test.t2 VALUES (1, 0.0);
#show binlog events;
select * from test.t1;
select * from test.t2;
-# Have to sleep for a few seconds to allow
-# NDB injector thread to populate binlog
-sleep 10;
+let $wait_time= 10;
+--source include/wait_for_ndb_to_binlog.inc
sync_slave_with_master;
connection slave;
select * from test.t1;
diff --git a/mysql-test/extra/rpl_tests/type_conversions.test b/mysql-test/extra/rpl_tests/type_conversions.test
new file mode 100644
index 00000000000..2be1f6c0bec
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/type_conversions.test
@@ -0,0 +1,710 @@
+# File containing different lossy and non-lossy type conversions.
+
+# Integral conversion testing, we do not reduce the test using
+# transitivity of conversions since the implementation is not using a
+# transitivity strategy. Instead we do an exhaustive testing.
+
+disable_query_log;
+connection slave;
+--let $conv = `select @@slave_type_conversions`
+--echo **** Running tests with @@SLAVE_TYPE_CONVERSIONS = '$conv' ****
+
+let $if_is_lossy = `SELECT FIND_IN_SET('ALL_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
+let $if_is_non_lossy = `SELECT FIND_IN_SET('ALL_NON_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
+
+let $source_type = BIT(1);
+let $target_type = BIT(1);
+let $source_value = b'1';
+let $target_value = b'1';
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type = DATE;
+let $target_type = DATE;
+let $source_value = '2009-11-21';
+let $target_value = '2009-11-21';
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type = ENUM('master','slave');
+let $target_type = ENUM('master','slave');
+let $source_value = 'master';
+let $target_value = 'master';
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type = CHAR(10);
+let $target_type = ENUM('master','slave');
+let $source_value = 'master';
+let $target_value = 'master';
+let $can_convert = 0;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type = CHAR(10);
+let $target_type = SET('master','slave');
+let $source_value = 'master';
+let $target_value = 'master';
+let $can_convert = 0;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type = ENUM('master','slave');
+let $target_type = CHAR(10);
+let $source_value = 'master';
+let $target_value = 'master';
+let $can_convert = 0;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type = SET('master','slave');
+let $target_type = CHAR(10);
+let $source_value = 'master';
+let $target_value = 'master';
+let $can_convert = 0;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type = SET('master','slave');
+let $target_type = SET('master','slave');
+let $source_value = '';
+let $target_value = '';
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type = SET('master','slave');
+let $target_type = SET('master','slave');
+let $source_value = 'master,slave';
+let $target_value = 'master,slave';
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type = TINYINT;
+let $target_type = TINYINT;
+let $source_value = 1;
+let $target_value = 1;
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type = TINYINT;
+let $target_type = SMALLINT;
+let $source_value = 1;
+let $target_value = 1;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= TINYINT;
+let $target_type= MEDIUMINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= TINYINT;
+let $target_type= INT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= TINYINT;
+let $target_type= BIGINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= SMALLINT;
+let $target_type= TINYINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= SMALLINT;
+let $target_type= TINYINT;
+let $source_value= 1 << 9;
+let $target_value= (1 << 7) - 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= SMALLINT;
+let $target_type= TINYINT UNSIGNED;
+let $source_value= 1 << 9;
+let $target_value= (1 << 8) - 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= SMALLINT;
+let $target_type= SMALLINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= SMALLINT;
+let $target_type= MEDIUMINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= SMALLINT;
+let $target_type= INT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= SMALLINT;
+let $target_type= BIGINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= MEDIUMINT;
+let $target_type= TINYINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= MEDIUMINT;
+let $target_type= TINYINT;
+let $source_value= 1 << 20;
+let $target_value= (1 << 7) - 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= MEDIUMINT;
+let $target_type= TINYINT UNSIGNED;
+let $source_value= 1 << 20;
+let $target_value= (1 << 8) - 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= MEDIUMINT;
+let $target_type= SMALLINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= MEDIUMINT;
+let $target_type= MEDIUMINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= MEDIUMINT;
+let $target_type= INT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= MEDIUMINT;
+let $target_type= BIGINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= INT;
+let $target_type= TINYINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= INT;
+let $target_type= TINYINT;
+let $source_value= (1 << 30);
+let $target_value= (1 << 7) - 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= INT;
+let $target_type= TINYINT UNSIGNED;
+let $source_value= (1 << 30);
+let $target_value= (1 << 8) - 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= INT;
+let $target_type= SMALLINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= INT;
+let $target_type= MEDIUMINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= INT;
+let $target_type= INT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= INT;
+let $target_type= BIGINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= BIGINT;
+let $target_type= TINYINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= BIGINT;
+let $target_type= SMALLINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= BIGINT;
+let $target_type= MEDIUMINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= BIGINT;
+let $target_type= INT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= BIGINT;
+let $target_type= BIGINT;
+let $source_value= 1;
+let $target_value= 1;
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= CHAR(20);
+let $target_type= CHAR(20);
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= CHAR(20);
+let $target_type= CHAR(30);
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= CHAR(20);
+let $target_type= CHAR(10);
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnood';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= CHAR(20);
+let $target_type= VARCHAR(20);
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= CHAR(20);
+let $target_type= VARCHAR(30);
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= CHAR(20);
+let $target_type= VARCHAR(10);
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnood';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= CHAR(20);
+let $target_type= TINYTEXT;
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= CHAR(20);
+let $target_type= TEXT;
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= CHAR(20);
+let $target_type= MEDIUMTEXT;
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= CHAR(20);
+let $target_type= LONGTEXT;
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(20);
+let $target_type= VARCHAR(20);
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(20);
+let $target_type= VARCHAR(30);
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(20);
+let $target_type= VARCHAR(10);
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnood';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(20);
+let $target_type= CHAR(30);
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(20);
+let $target_type= CHAR(10);
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnood';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(20);
+let $target_type= TINYTEXT;
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(20);
+let $target_type= TEXT;
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(20);
+let $target_type= MEDIUMTEXT;
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(20);
+let $target_type= LONGTEXT;
+let $source_value= 'Smoothnoodlemaps';
+let $target_value= 'Smoothnoodlemaps';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $blob = `select repeat('abcd', 125)`;
+let $truncated_blob = `select left('$blob', 255)`;
+
+let $source_type= VARCHAR(500);
+let $target_type= VARCHAR(500);
+let $source_value= '$blob';
+let $target_value= '$blob';
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(500);
+let $target_type= VARCHAR(510);
+let $source_value= '$blob';
+let $target_value= '$blob';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(500);
+let $target_type= VARCHAR(255);
+let $source_value= '$blob';
+let $target_value= '$truncated_blob';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(500);
+let $target_type= TINYTEXT;
+let $source_value= '$blob';
+let $target_value= '$truncated_blob';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(500);
+let $target_type= TEXT;
+let $source_value= '$blob';
+let $target_value= '$blob';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(500);
+let $target_type= MEDIUMTEXT;
+let $source_value= '$blob';
+let $target_value= '$blob';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= VARCHAR(500);
+let $target_type= LONGTEXT;
+let $source_value= '$blob';
+let $target_value= '$blob';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $tiny_blob = `select repeat('tiny blob ', 25)`;
+let $truncated_tiny_blob = `select left('$tiny_blob', 254)`;
+
+let $source_type= TINYTEXT;
+let $target_type= VARCHAR(500);
+let $source_value= '$tiny_blob';
+let $target_value= '$tiny_blob';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= TEXT;
+let $target_type= VARCHAR(500);
+let $source_value= '$blob';
+let $target_value= '$blob';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= MEDIUMTEXT;
+let $target_type= VARCHAR(500);
+let $source_value= '$blob';
+let $target_value= '$blob';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= LONGTEXT;
+let $target_type= VARCHAR(500);
+let $source_value= '$blob';
+let $target_value= '$blob';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= TINYTEXT;
+let $target_type= CHAR(255);
+let $source_value= '$tiny_blob';
+let $target_value= '$tiny_blob';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= TINYTEXT;
+let $target_type= CHAR(250);
+let $source_value= '$tiny_blob';
+let $target_value= left('$tiny_blob', 250);
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= TEXT;
+let $target_type= CHAR(255);
+let $source_value= '$blob';
+let $target_value= left('$blob', 255);
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= MEDIUMTEXT;
+let $target_type= CHAR(255);
+let $source_value= '$blob';
+let $target_value= left('$blob', 255);
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= LONGTEXT;
+let $target_type= CHAR(255);
+let $source_value= '$blob';
+let $target_value= left('$blob', 255);
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= TINYTEXT;
+let $target_type= TINYTEXT;
+let $source_value= '$tiny_blob';
+let $target_value= '$tiny_blob';
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= TINYTEXT;
+let $target_type= TEXT;
+let $source_value= '$tiny_blob';
+let $target_value= '$tiny_blob';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= TEXT;
+let $target_type= TINYTEXT;
+let $source_value= '$blob';
+let $target_value= left('$blob',255);
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DECIMAL(10,5);
+let $target_type= DECIMAL(10,5);
+let $source_value= 3.14159;
+let $target_value= 3.14159;
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DECIMAL(10,5);
+let $target_type= DECIMAL(10,6);
+let $source_value= 3.14159;
+let $target_value= 3.141590;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DECIMAL(10,5);
+let $target_type= DECIMAL(11,5);
+let $source_value= 3.14159;
+let $target_value= 3.14159;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DECIMAL(10,5);
+let $target_type= DECIMAL(11,6);
+let $source_value= 3.14159;
+let $target_value= 3.141590;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DECIMAL(10,5);
+let $target_type= DECIMAL(10,4);
+let $source_value= 3.14159;
+let $target_value= 3.1416;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DECIMAL(10,5);
+let $target_type= DECIMAL(9,5);
+let $source_value= 3.14159;
+let $target_value= 3.14159;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DECIMAL(10,5);
+let $target_type= DECIMAL(9,4);
+let $source_value= 3.14159;
+let $target_value= 3.1416;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= FLOAT;
+let $target_type= DECIMAL(10,5);
+let $source_value= 3.15625;
+let $target_value= 3.15625;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DOUBLE;
+let $target_type= DECIMAL(10,5);
+let $source_value= 3.15625;
+let $target_value= 3.15625;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DECIMAL(10,5);
+let $target_type= FLOAT;
+let $source_value= 3.15625;
+let $target_value= 3.15625;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DECIMAL(10,5);
+let $target_type= DOUBLE;
+let $source_value= 3.15625;
+let $target_value= 3.15625;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= FLOAT;
+let $target_type= FLOAT;
+let $source_value= 3.15625;
+let $target_value= 3.15625;
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DOUBLE;
+let $target_type= DOUBLE;
+let $source_value= 3.15625;
+let $target_value= 3.15625;
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= FLOAT;
+let $target_type= DOUBLE;
+let $source_value= 3.15625;
+let $target_value= 3.15625;
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= DOUBLE;
+let $target_type= FLOAT;
+let $source_value= 3.15625;
+let $target_value= 3.15625;
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= BIT(5);
+let $target_type= BIT(5);
+let $source_value= b'11001';
+let $target_value= b'11001';
+let $can_convert = 1;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= BIT(5);
+let $target_type= BIT(6);
+let $source_value= b'11001';
+let $target_value= b'11001';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= BIT(6);
+let $target_type= BIT(5);
+let $source_value= b'111001';
+let $target_value= b'11111';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= BIT(5);
+let $target_type= BIT(12);
+let $source_value= b'11001';
+let $target_value= b'11001';
+let $can_convert = $if_is_non_lossy;
+source extra/rpl_tests/check_type.inc;
+
+let $source_type= BIT(12);
+let $target_type= BIT(5);
+let $source_value= b'101100111000';
+let $target_value= b'11111';
+let $can_convert = $if_is_lossy;
+source extra/rpl_tests/check_type.inc;
+
+disable_warnings;
+source include/reset_master_and_slave.inc;
+enable_warnings;
+enable_query_log; \ No newline at end of file
diff --git a/mysql-test/include/have_semisync_plugin.inc b/mysql-test/include/have_semisync_plugin.inc
new file mode 100644
index 00000000000..37c9a744b6a
--- /dev/null
+++ b/mysql-test/include/have_semisync_plugin.inc
@@ -0,0 +1,22 @@
+#
+# Check if dynamic loading is supported
+#
+--require r/have_dynamic_loading.require
+disable_query_log;
+show variables like 'have_dynamic_loading';
+enable_query_log;
+
+#
+# Check if the variable SEMISYNC_MASTER_PLUGIN is set
+#
+if (`select LENGTH('$SEMISYNC_MASTER_PLUGIN') = 0`)
+{
+ skip Need semisync plugins;
+}
+
+#
+# Check if --plugin-dir was setup for semisync
+#
+if (`SELECT CONCAT('--plugin-dir=', @@plugin_dir) != '$SEMISYNC_PLUGIN_OPT'`) {
+ --skip SEMISYNC plugin requires that --plugin-dir is set to the semisync plugin dir (either the .opt file does not contain \$SEMISYNC_PLUGIN_OPT or another plugin is in use)
+}
diff --git a/mysql-test/include/have_ssl_communication.inc b/mysql-test/include/have_ssl_communication.inc
new file mode 100644
index 00000000000..6f2d5587a75
--- /dev/null
+++ b/mysql-test/include/have_ssl_communication.inc
@@ -0,0 +1,4 @@
+-- require r/have_ssl.require
+disable_query_log;
+show variables like 'have_ssl';
+enable_query_log;
diff --git a/mysql-test/include/master-slave-reset.inc b/mysql-test/include/master-slave-reset.inc
index 938eb2c074a..f54f5b83eb5 100644
--- a/mysql-test/include/master-slave-reset.inc
+++ b/mysql-test/include/master-slave-reset.inc
@@ -6,12 +6,29 @@
# Since we expect STOP SLAVE to produce a warning as the slave is
# stopped (the server was started with skip-slave-start), we disable
# warnings when doing STOP SLAVE.
+#
+# $no_change_master If true, no change master will be done nor any reset slave.
+# This is to avoid touching the relay-log.info file allowing
+# the test to create one itself.
+# $skip_slave_start If true, the slave will not be started
connection slave;
+
+#we expect STOP SLAVE to produce a warning as the slave is stopped
+#(the server was started with skip-slave-start)
--disable_warnings
stop slave;
+--disable_query_log
+if (!$no_change_master) {
+ eval CHANGE MASTER TO MASTER_USER='root',
+ MASTER_CONNECT_RETRY=1,
+ MASTER_HOST='127.0.0.1',
+ MASTER_PORT=$MASTER_MYPORT;
+}
+--enable_query_log
source include/wait_for_slave_to_stop.inc;
--enable_warnings
+
connection master;
--disable_warnings
--disable_query_log
@@ -20,17 +37,39 @@ use test;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
reset master;
+
--disable_query_log
-reset slave;
+if (!$no_change_master) {
+ reset slave;
+}
--enable_query_log
connection slave;
-reset slave;
+
+--disable_warnings
+# the first RESET SLAVE may produce a warning about non-existent
+# 'ndb_apply_status' table, because this table is created
+# asynchronously at the server startup and may not exist yet
+# if RESET SLAVE comes too soon after the server startup
+if (!$no_change_master) {
+ reset slave;
+}
+--enable_warnings
+
# Clean up old test tables
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
+
--disable_query_log
+#eval CHANGE MASTER TO MASTER_USER='root',
+# MASTER_CONNECT_RETRY=1,
+# MASTER_HOST='127.0.0.1',
+# MASTER_PORT=$MASTER_MYPORT;
reset master;
--enable_query_log
-start slave;
-source include/wait_for_slave_to_start.inc;
+
+if (!$skip_slave_start) {
+ start slave;
+ source include/wait_for_slave_to_start.inc;
+}
+
diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc
index e0eb87f02f7..134bb61ddab 100644
--- a/mysql-test/include/master-slave.inc
+++ b/mysql-test/include/master-slave.inc
@@ -1,4 +1,6 @@
# Replication tests need binlog
+#
+# $skip_slave_start If true, the slave will not be started
source include/have_log_bin.inc;
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
@@ -8,5 +10,10 @@ connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
-- source include/master-slave-reset.inc
+if (!$skip_slave_start) {
+ connection master;
+ sync_slave_with_master;
+}
+
# Set the default connection to 'master'
connection master;
diff --git a/mysql-test/include/not_ndb_default.inc b/mysql-test/include/not_ndb_default.inc
index ca3c57a671a..682a2944171 100644
--- a/mysql-test/include/not_ndb_default.inc
+++ b/mysql-test/include/not_ndb_default.inc
@@ -1,4 +1,4 @@
--require r/not_ndb_default.require
disable_query_log;
-select convert(@@table_type using latin1) NOT IN ("ndbcluster","NDBCLUSTER") as "TRUE";
+select convert(@@storage_engine using latin1) NOT IN ("ndbcluster","NDBCLUSTER") as "TRUE";
enable_query_log;
diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc
index f88806e1079..b11e6afbeca 100644
--- a/mysql-test/include/setup_fake_relay_log.inc
+++ b/mysql-test/include/setup_fake_relay_log.inc
@@ -69,7 +69,21 @@ let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`;
# Create relay log file.
copy_file $fake_relay_log $_fake_relay_log;
# Create relay log index.
---exec echo $_fake_filename-fake.000001 > $_fake_relay_index
+
+# After patch for BUG#12190, the filename used in CHANGE MASTER
+# RELAY_LOG_FILE will be automatically added the directory of the
+# relay log before comparison, thus we need to added the directory
+# part (./ on unix .\ on windows) when faking the relay-log-bin.index.
+
+if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`)
+{
+ eval select './$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index';
+}
+
+if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") != 0`)
+{
+ eval select '.\\\\$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index';
+}
# Setup replication from existing relay log.
eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4;
diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc
index 68f913a16a3..fcdc52eaf14 100644
--- a/mysql-test/include/show_binlog_events.inc
+++ b/mysql-test/include/show_binlog_events.inc
@@ -1,10 +1,35 @@
# $binlog_start can be set by caller or take a default value
+# $binary_log_file the name of the log file show
+# $binary_log_limit_row - sets the number of binlog rows to be returned
+# $binary_log_limit_offset - sets the offset where to start returning events
+
+let $show_binlog_events= show binlog events;
if (!$binlog_start)
{
- let $binlog_start=106;
+ # defaults to chop the first event in the binary log
+ let $binlog_start=107;
}
+
+if (!`SELECT '$binary_log_file' = ''`)
+{
+ let $show_binlog_events= $show_binlog_events in '$binary_log_file';
+}
+let $show_binlog_events= $show_binlog_events from $binlog_start;
+
+if ($binary_log_limit_row)
+{
+ let $limit= limit;
+ if ($binary_log_limit_offset)
+ {
+ let $limit= $limit $binary_log_limit_offset, ;
+ }
+
+ let $limit= $limit $binary_log_limit_row;
+ let $show_binlog_events= $show_binlog_events $limit;
+}
+
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start>
--replace_column 2 # 4 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
---eval show binlog events from $binlog_start
+--eval $show_binlog_events
diff --git a/mysql-test/include/show_binlog_events2.inc b/mysql-test/include/show_binlog_events2.inc
index 5dd272c562d..0e1a889bacc 100644
--- a/mysql-test/include/show_binlog_events2.inc
+++ b/mysql-test/include/show_binlog_events2.inc
@@ -1,4 +1,4 @@
---let $binlog_start=106
+--let $binlog_start=107
--replace_result $binlog_start <binlog_start>
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
diff --git a/mysql-test/include/show_relaylog_events.inc b/mysql-test/include/show_relaylog_events.inc
new file mode 100644
index 00000000000..6f63b055d58
--- /dev/null
+++ b/mysql-test/include/show_relaylog_events.inc
@@ -0,0 +1,35 @@
+# $binlog_start can be set by caller or take a default value
+# $binary_log_file the name of the log file show
+# $binary_log_limit_row - sets the number of binlog rows to be returned
+# $binary_log_limit_offset - sets the offset where to start returning events
+
+let $show_binlog_events= show relaylog events;
+
+if (!$binlog_start)
+{
+ # defaults to chop the first event in the binary log
+ let $binlog_start=106;
+}
+
+if (!`SELECT '$binary_log_file' = ''`)
+{
+ let $show_binlog_events= $show_binlog_events in '$binary_log_file';
+}
+let $show_binlog_events= $show_binlog_events from $binlog_start;
+
+if ($binary_log_limit_row)
+{
+ let $limit= limit;
+ if ($binary_log_limit_offset)
+ {
+ let $limit= $limit $binary_log_limit_offset, ;
+ }
+
+ let $limit= $limit $binary_log_limit_row;
+ let $show_binlog_events= $show_binlog_events $limit;
+}
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start>
+--replace_column 2 # 4 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /Server ver:.*$/SERVER_VERSION, BINLOG_VERSION/
+--eval $show_binlog_events
diff --git a/mysql-test/include/test_fieldsize.inc b/mysql-test/include/test_fieldsize.inc
index cbe63e26318..606bc63779d 100644
--- a/mysql-test/include/test_fieldsize.inc
+++ b/mysql-test/include/test_fieldsize.inc
@@ -22,7 +22,7 @@ eval $test_insert;
connection slave;
START SLAVE;
-wait_for_slave_to_stop;
+--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
diff --git a/mysql-test/include/wait_for_ndb_to_binlog.inc b/mysql-test/include/wait_for_ndb_to_binlog.inc
new file mode 100644
index 00000000000..77da6d62154
--- /dev/null
+++ b/mysql-test/include/wait_for_ndb_to_binlog.inc
@@ -0,0 +1,41 @@
+# ==== Purpose ====
+#
+# Several test primitives from mysql-test/extra/rpl_tests
+# shared for test cases for MyISAM, InnoDB, NDB and other
+# engines. But for NDB all events will be added by NDB
+# injector and now there are no way to detect the state of
+# NDB injector therefore this primitive waits 5 sec
+# if engine type is NDB.
+# In future that should be fixed by waiting of proper
+# state of NDB injector.
+#
+# ==== Usage ====
+#
+# let $engine_type= NDB;
+# --source include/wait_for_ndb_to_binlog.inc
+#
+# ==== Parameters =====
+#
+# $engine_type
+# Type of engine. If type is NDB then it waits $wait_time sec
+#
+# $wait_time
+# Test will wait $wait_time seconds
+
+let $_wait_time= 5;
+
+if (!$wait_time) {
+ let $_wait_time= $wait_time;
+}
+
+if (`SELECT UPPER(LEFT('$engine_type',3)) = 'NDB'`) {
+ while (!$_wait_time) {
+ let $_wait_time_internal= 10;
+ while (!$_wait_time_internal) {
+ sleep 0.1;
+ dec $_wait_time_internal;
+ }
+ dec $_wait_time;
+ }
+}
+
diff --git a/mysql-test/include/wait_show_condition.inc b/mysql-test/include/wait_show_condition.inc
index 253101d1e07..f683ca7b47b 100644
--- a/mysql-test/include/wait_show_condition.inc
+++ b/mysql-test/include/wait_show_condition.inc
@@ -2,13 +2,16 @@
#
# SUMMARY
#
-# Waits until the show statement ($show_statement) has at least within one of
-# the rows of the result set for the field ($field) a value which fulfils
+# Waits until the show statement ($show_statement) has one or all of the
+# rows of the result set for the field ($field) a value which fulfils
# a condition ($condition), or the operation times out.
#
#
# USAGE
#
+# All rows of the result must fulfil the condition if $all_rows_fulfil is 1
+# else at least one of the result must fulfil the condition.
+# let $wait_for_all= 1;
# let $show_statement= SHOW PROCESSLIST;
# let $field= State;
# let $condition= = 'Updating';
@@ -46,27 +49,56 @@ inc $max_run_time;
let $found= 0;
let $max_end_time= `SELECT UNIX_TIMESTAMP() + $max_run_time`;
-while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`)
+
+if (`SELECT '$wait_for_all' != '1'`)
{
- # Sleep a bit to avoid too heavy load.
- real_sleep 0.2;
- let $rowno= 1;
- let $process_result= 1;
- while (`SELECT $process_result = 1 AND $found = 0`)
- {
- let $field_value= query_get_value($show_statement, $field, $rowno);
- if (`SELECT '$field_value' $condition`)
- {
- let $found= 1;
- }
- if (`SELECT '$field_value' = 'No such row'`)
- {
- # We are behind the last row of the result set.
- let $process_result= 0;
- }
- inc $rowno;
- }
+ while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`)
+ {
+ # Sleep a bit to avoid too heavy load.
+ real_sleep 0.2;
+ let $rowno= 1;
+ let $process_result= 1;
+ while (`SELECT $process_result = 1 AND $found = 0`)
+ {
+ let $field_value= query_get_value($show_statement, $field, $rowno);
+ if (`SELECT '$field_value' $condition`)
+ {
+ let $found= 1;
+ }
+ if (`SELECT '$field_value' = 'No such row'`)
+ {
+ # We are behind the last row of the result set.
+ let $process_result= 0;
+ }
+ inc $rowno;
+ }
+ }
}
+
+if (`SELECT '$wait_for_all' = '1'`)
+{
+ while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`)
+ {
+ # Sleep a bit to avoid too heavy load.
+ real_sleep 0.2;
+ let $rowno= 1;
+ let $process_result= 1;
+ while (`SELECT $process_result = 1 AND $found = 0`)
+ {
+ let $field_value= query_get_value($show_statement, $field, $rowno);
+ if (`SELECT '$field_value' = 'No such row'`)
+ {
+ let $found= 1;
+ }
+ if (`SELECT $found = 0 AND NOT '$field_value' $condition`)
+ {
+ let process_result= 0;
+ }
+ inc $rowno;
+ }
+ }
+}
+
if (!$found)
{
echo # Timeout in include/wait_show_condition.inc for $wait_condition;
diff --git a/mysql-test/include/wait_until_disconnected.inc b/mysql-test/include/wait_until_disconnected.inc
index a4362e52d01..8a989becc18 100644
--- a/mysql-test/include/wait_until_disconnected.inc
+++ b/mysql-test/include/wait_until_disconnected.inc
@@ -7,7 +7,7 @@ let $counter= 500;
let $mysql_errno= 0;
while (!$mysql_errno)
{
- --error 0,1053,2002,2006,2013
+ --error 0,1040,1053,2002,2003,2006,2013
show status;
dec $counter;
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index 86ad5c485c1..9ae3208fc24 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -4024,15 +4024,26 @@ sub mysqld_arguments ($$$$) {
}
else
{
- if ($mysql_version_id < 50200)
- {
- mtr_add_arg($args, "%s--master-user=root", $prefix);
- mtr_add_arg($args, "%s--master-connect-retry=1", $prefix);
- mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix);
- mtr_add_arg($args, "%s--master-password=", $prefix);
- mtr_add_arg($args, "%s--master-port=%d", $prefix,
- $master->[0]->{'port'}); # First master
- }
+# NOTE: the backport (see BUG#48048) originally removed the
+# commented out lines below. However, given that they are
+# protected with a version check (< 50200) now, it should be
+# safe to keep them. The problem is that the backported patch
+# was into a 5.1 GA codebase - mysql-5.1-rep+2 tree - so
+# version is 501XX, consequently check becomes worthless. It
+# should be safe to uncomment them when merging up to 5.5.
+#
+# RQG semisync test runs on the 5.1 GA tree and needs MTR v1.
+# This was causing the test to fail (slave would not start
+# due to unrecognized option(s)).
+# if ($mysql_version_id < 50200)
+# {
+# mtr_add_arg($args, "%s--master-user=root", $prefix);
+# mtr_add_arg($args, "%s--master-connect-retry=1", $prefix);
+# mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix);
+# mtr_add_arg($args, "%s--master-password=", $prefix);
+# mtr_add_arg($args, "%s--master-port=%d", $prefix,
+# $master->[0]->{'port'}); # First master
+# }
my $slave_server_id= 2 + $idx;
my $slave_rpl_rank= $slave_server_id;
mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 4d8d178e092..467d5caf2c6 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -68,7 +68,7 @@ use My::File::Path; # Patched version of File::Path
use File::Basename;
use File::Copy;
use File::Find;
-use File::Temp qw / tempdir /;
+use File::Temp qw /tempdir/;
use File::Spec::Functions qw / splitdir /;
use My::Platform;
use My::SafeProcess;
@@ -1823,6 +1823,44 @@ sub environment_setup {
$ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=EXAMPLE=".$plugin_filename;
}
+ # --------------------------------------------------------------------------
+ # Add the path where mysqld will find semisync plugins
+ # --------------------------------------------------------------------------
+ if (!$opt_embedded_server) {
+ my $semisync_master_filename;
+ my $semisync_slave_filename;
+ if (IS_WINDOWS)
+ {
+ $semisync_master_filename = "semisync_master.dll";
+ $semisync_slave_filename = "semisync_slave.dll";
+ }
+ else
+ {
+ $semisync_master_filename = "libsemisync_master.so";
+ $semisync_slave_filename = "libsemisync_slave.so";
+ }
+ my $lib_semisync_master_plugin=
+ mtr_file_exists(vs_config_dirs('plugin/semisync',$semisync_master_filename),
+ "$basedir/plugin/semisync/.libs/" . $semisync_master_filename,
+ "$basedir/lib/mysql/plugin/" . $semisync_master_filename);
+ my $lib_semisync_slave_plugin=
+ mtr_file_exists(vs_config_dirs('plugin/semisync',$semisync_slave_filename),
+ "$basedir/plugin/semisync/.libs/" . $semisync_slave_filename,
+ "$basedir/lib/mysql/plugin/" . $semisync_slave_filename);
+ if ($lib_semisync_master_plugin && $lib_semisync_slave_plugin)
+ {
+ $ENV{'SEMISYNC_MASTER_PLUGIN'}= basename($lib_semisync_master_plugin);
+ $ENV{'SEMISYNC_SLAVE_PLUGIN'}= basename($lib_semisync_slave_plugin);
+ $ENV{'SEMISYNC_PLUGIN_OPT'}= "--plugin-dir=".dirname($lib_semisync_master_plugin);
+ }
+ else
+ {
+ $ENV{'SEMISYNC_MASTER_PLUGIN'}= "";
+ $ENV{'SEMISYNC_SLAVE_PLUGIN'}= "";
+ $ENV{'SEMISYNC_PLUGIN_OPT'}="--plugin-dir=";
+ }
+ }
+
# ----------------------------------------------------
# Add the path where mysqld will find mypluglib.so
# ----------------------------------------------------
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index 044885d1ea7..bb971e5453b 100644
--- a/mysql-test/r/ctype_cp932_binlog_stm.result
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
@@ -29,22 +29,22 @@ HEX(s1) HEX(s2) d
466F6F2773206120426172 ED40ED41ED42 47.93
DROP PROCEDURE bug18293|
DROP TABLE t4|
-SHOW BINLOG EVENTS FROM 370|
+SHOW BINLOG EVENTS FROM 371|
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 370 Query 1 536 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
+master-bin.000001 371 Query 1 537 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
s2 CHAR(50) CHARACTER SET cp932,
d DECIMAL(10,2))
-master-bin.000001 536 Query 1 785 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50),
+master-bin.000001 537 Query 1 786 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50),
IN ins2 CHAR(50) CHARACTER SET cp932,
IN ind DECIMAL(10,2))
BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END
-master-bin.000001 785 Query 1 1049 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
-master-bin.000001 1049 Query 1 1138 use `test`; DROP PROCEDURE bug18293
-master-bin.000001 1138 Query 1 1217 use `test`; DROP TABLE t4
+master-bin.000001 786 Query 1 1050 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
+master-bin.000001 1050 Query 1 1139 use `test`; DROP PROCEDURE bug18293
+master-bin.000001 1139 Query 1 1218 use `test`; DROP TABLE t4
End of 5.0 tests
-SHOW BINLOG EVENTS FROM 365;
+SHOW BINLOG EVENTS FROM 366;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;
diff --git a/mysql-test/r/debug_sync.result b/mysql-test/r/debug_sync.result
index 47e968f79cf..8b46334204c 100644
--- a/mysql-test/r/debug_sync.result
+++ b/mysql-test/r/debug_sync.result
@@ -243,7 +243,7 @@ GRANT ALL ON *.* TO mysqltest_2@localhost;
REVOKE SUPER ON *.* FROM mysqltest_2@localhost;
connection con1, mysqltest_2
SET DEBUG_SYNC= 'RESET';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
connection default
DROP USER mysqltest_2@localhost;
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/deprecated_features.result b/mysql-test/r/deprecated_features.result
new file mode 100644
index 00000000000..ecfb830542d
--- /dev/null
+++ b/mysql-test/r/deprecated_features.result
@@ -0,0 +1,26 @@
+set global log_bin_trust_routine_creators=1;
+ERROR HY000: Unknown system variable 'log_bin_trust_routine_creators'
+set table_type='MyISAM';
+ERROR HY000: Unknown system variable 'table_type'
+select @@table_type='MyISAM';
+ERROR HY000: Unknown system variable 'table_type'
+backup table t1 to 'data.txt';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'backup table t1 to 'data.txt'' at line 1
+restore table t1 from 'data.txt';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'restore table t1 from 'data.txt'' at line 1
+show plugin;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'plugin' at line 1
+load table t1 from master;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table t1 from master' at line 1
+load data from master;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from master' at line 1
+SHOW INNODB STATUS;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNODB STATUS' at line 1
+create table t1 (t6 timestamp(6));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6))' at line 1
+create table t1 (t6 timestamp) type=myisam;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=myisam' at line 1
+show table types;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'types' at line 1
+show mutex status;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mutex status' at line 1
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result
index 50bfa97c59f..15a9e226c39 100644
--- a/mysql-test/r/events_bugs.result
+++ b/mysql-test/r/events_bugs.result
@@ -375,7 +375,7 @@ SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
event_name definer
e1 mysqltest_u1@localhost
ALTER DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 HOUR;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
event_name definer
e1 mysqltest_u1@localhost
@@ -386,7 +386,7 @@ event_name definer
e1 mysqltest_u1@localhost
DROP EVENT e1;
CREATE DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
DROP EVENT e1;
ERROR HY000: Unknown event 'e1'
DROP USER mysqltest_u1@localhost;
diff --git a/mysql-test/r/flush2.result b/mysql-test/r/flush2.result
index 5056955c7b7..13bcc371ef6 100644
--- a/mysql-test/r/flush2.result
+++ b/mysql-test/r/flush2.result
@@ -4,11 +4,9 @@ show variables like 'log_bin%';
Variable_name Value
log_bin OFF
log_bin_trust_function_creators ON
-log_bin_trust_routine_creators ON
flush logs;
show variables like 'log_bin%';
Variable_name Value
log_bin OFF
log_bin_trust_function_creators ON
-log_bin_trust_routine_creators ON
set global expire_logs_days = 0;
diff --git a/mysql-test/r/flush_block_commit_notembedded.result b/mysql-test/r/flush_block_commit_notembedded.result
index c7fd7a11877..4348dbd67e5 100644
--- a/mysql-test/r/flush_block_commit_notembedded.result
+++ b/mysql-test/r/flush_block_commit_notembedded.result
@@ -9,13 +9,13 @@ INSERT t1 VALUES (1);
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 106
+master-bin.000001 107
# Switch to connection con1
COMMIT;
# Switch to connection con2
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 106
+master-bin.000001 107
UNLOCK TABLES;
# Switch to connection con1
DROP TABLE t1;
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index 12269f0cb1c..75d3d5819f4 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -121,9 +121,9 @@ mysqltest_5@host5, mysqltest_6@host6, mysqltest_7@host7;
create database mysqltest_1;
grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
set sql_log_off = 1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
set sql_log_bin = 0;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
delete from mysql.user where user like 'mysqltest\_1';
delete from mysql.db where user like 'mysqltest\_1';
drop database mysqltest_1;
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index 2e3fa7f4acd..bc7500e4690 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -121,7 +121,7 @@ grant insert on v1 to testdb_2@localhost;
create view v5 as select f1 from t1;
grant show view on v5 to testdb_2@localhost;
create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
use testdb_1;
create view v6 as select f1 from t1;
grant show view on v6 to testdb_2@localhost;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 449333a4ae6..4f22029814c 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -604,7 +604,7 @@ a b
4 4
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 206
+master-bin.000001 207
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
@@ -614,7 +614,7 @@ UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 221
+master-bin.000001 222
drop table t1, t2;
set @@session.binlog_format= @sav_binlog_format;
drop table if exists t1, t2, t3;
diff --git a/mysql-test/r/mysqlbinlog_row_innodb.result b/mysql-test/r/mysqlbinlog_row_innodb.result
index 86f0b67ebb3..f11cc3221ad 100644
--- a/mysql-test/r/mysqlbinlog_row_innodb.result
+++ b/mysql-test/r/mysqlbinlog_row_innodb.result
@@ -2365,7 +2365,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO test.t1
### SET
-### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -2458,7 +2458,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO test.t1
### SET
-### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -2553,7 +2553,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO test.t1
### SET
-### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
+### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
@@ -2580,7 +2580,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
-### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
+### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@@ -2634,7 +2634,7 @@ BEGIN
### @79=3 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t1
### SET
-### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -2727,7 +2727,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
### UPDATE test.t1
### WHERE
-### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -2807,7 +2807,7 @@ BEGIN
### @78=b'00000000' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
### @79=1 /* INT meta=0 nullable=1 is_null=0 */
### SET
-### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -2900,7 +2900,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
### UPDATE test.t1
### WHERE
-### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -2980,7 +2980,7 @@ BEGIN
### @78=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
### @79=2 /* INT meta=0 nullable=1 is_null=0 */
### SET
-### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -3073,7 +3073,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
### UPDATE test.t1
### WHERE
-### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
+### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
@@ -3100,7 +3100,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
-### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
+### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@@ -3153,7 +3153,7 @@ BEGIN
### @78=NULL /* TIMESTAMP meta=63489 nullable=1 is_null=1 */
### @79=3 /* INT meta=0 nullable=1 is_null=0 */
### SET
-### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -3246,7 +3246,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
### UPDATE test.t1
### WHERE
-### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -3326,7 +3326,7 @@ BEGIN
### @78=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
### @79=4 /* INT meta=0 nullable=1 is_null=0 */
### SET
-### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
+### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
@@ -3353,7 +3353,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
-### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
+### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@@ -3419,7 +3419,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM test.t1
### WHERE
-### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -3512,7 +3512,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM test.t1
### WHERE
-### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -3605,7 +3605,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM test.t1
### WHERE
-### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
+### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@@ -3698,7 +3698,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM test.t1
### WHERE
-### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
+### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
@@ -3725,7 +3725,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
-### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
+### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
diff --git a/mysql-test/r/mysqlbinlog_row_myisam.result b/mysql-test/r/mysqlbinlog_row_myisam.result
index b9366d941f8..4d1050af916 100644
--- a/mysql-test/r/mysqlbinlog_row_myisam.result
+++ b/mysql-test/r/mysqlbinlog_row_myisam.result
@@ -2584,7 +2584,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
-### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
+### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@@ -3110,7 +3110,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
-### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
+### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@@ -3365,7 +3365,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
-### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
+### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@@ -3745,7 +3745,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
-### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
+### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 8162e1aca05..b2a4c1ae585 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -3554,11 +3554,11 @@ use test;
create user mysqltest_1@localhost;
create table t1(a int, b varchar(34));
reset master;
-mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need the RELOAD privilege for this operation (1227)
-mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need the RELOAD privilege for this operation (1227)
+mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227)
+mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227)
grant RELOAD on *.* to mysqltest_1@localhost;
-mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227)
-mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227)
+mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation (1227)
+mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation (1227)
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1@localhost;
diff --git a/mysql-test/r/outfile_loaddata.result b/mysql-test/r/outfile_loaddata.result
index 453e3adb54c..66ff28298ba 100644
--- a/mysql-test/r/outfile_loaddata.result
+++ b/mysql-test/r/outfile_loaddata.result
@@ -92,14 +92,14 @@ HEX(c1)
C3
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' FIELDS ENCLOSED BY 0xC3 FROM t1;
Warnings:
-Warning 1638 Non-ASCII separator arguments are not fully supported
+Warning 1639 Non-ASCII separator arguments are not fully supported
TRUNCATE t1;
SELECT HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'));
HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'))
C35CC3C30A
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' INTO TABLE t1 FIELDS ENCLOSED BY 0xC3;
Warnings:
-Warning 1638 Non-ASCII separator arguments are not fully supported
+Warning 1639 Non-ASCII separator arguments are not fully supported
SELECT HEX(c1) FROM t1;
HEX(c1)
C3
@@ -124,17 +124,17 @@ ERROR 42000: Field separator argument is not what is expected; check the manual
# LOAD DATA rises error or has unpredictable result -- to be fixed later
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ENCLOSED BY 'ÑŠ';
Warnings:
-Warning 1638 Non-ASCII separator arguments are not fully supported
+Warning 1639 Non-ASCII separator arguments are not fully supported
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ÑŠ';
ERROR 42000: Field separator argument is not what is expected; check the manual
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ESCAPED BY 'ÑŠ';
Warnings:
-Warning 1638 Non-ASCII separator arguments are not fully supported
+Warning 1639 Non-ASCII separator arguments are not fully supported
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ÑŠ';
ERROR 42000: Field separator argument is not what is expected; check the manual
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS TERMINATED BY 'ÑŠ';
Warnings:
-Warning 1638 Non-ASCII separator arguments are not fully supported
+Warning 1639 Non-ASCII separator arguments are not fully supported
##################################################
1ÑŠABC-áâ÷ÑŠDEF-ÂÃÄ
2ÑŠ\NÑŠ\N
@@ -142,7 +142,7 @@ Warning 1638 Non-ASCII separator arguments are not fully supported
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS TERMINATED BY 'ÑŠ';
Warnings:
-Warning 1638 Non-ASCII separator arguments are not fully supported
+Warning 1639 Non-ASCII separator arguments are not fully supported
Warning 1265 Data truncated for column 'a' at row 1
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -156,7 +156,7 @@ a b c
2 NULL NULL
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES STARTING BY 'ÑŠ';
Warnings:
-Warning 1638 Non-ASCII separator arguments are not fully supported
+Warning 1639 Non-ASCII separator arguments are not fully supported
##################################################
ÑŠ1 ABC-áâ÷ DEF-ÂÃÄ
ÑŠ2 \N \N
@@ -164,20 +164,20 @@ Warning 1638 Non-ASCII separator arguments are not fully supported
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary LINES STARTING BY 'ÑŠ';
Warnings:
-Warning 1638 Non-ASCII separator arguments are not fully supported
+Warning 1639 Non-ASCII separator arguments are not fully supported
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-ÐБВ DEF-ÂÃÄ
2 NULL NULL
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES TERMINATED BY 'ÑŠ';
Warnings:
-Warning 1638 Non-ASCII separator arguments are not fully supported
+Warning 1639 Non-ASCII separator arguments are not fully supported
##################################################
1 ABC-áâ÷ DEF-ÂÃÄÑŠ2 \N \NÑŠ##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary LINES TERMINATED BY 'ÑŠ';
Warnings:
-Warning 1638 Non-ASCII separator arguments are not fully supported
+Warning 1639 Non-ASCII separator arguments are not fully supported
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-ÐБВ DEF-ÂÃÄ
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index 1b2a0cc50b2..81b4b0e79ae 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -409,8 +409,6 @@ prepare stmt1 from ' optimize table t1 ' ;
prepare stmt1 from ' analyze table t1 ' ;
prepare stmt1 from ' checksum table t1 ' ;
prepare stmt1 from ' repair table t1 ' ;
-prepare stmt1 from ' restore table t1 from ''<MYSQLTEST_VARDIR>/tmp/data.txt'' ' ;
-ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' handler t1 open ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' commit ' ;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index e6550bee954..ea205c1ecd1 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -809,7 +809,6 @@ show columns in t1;
show slave hosts;
show keys in t1;
show column types;
-show table types;
show storage engines;
show authors;
show contributors;
@@ -1292,11 +1291,6 @@ delete from mysql.db where user='mysqltest_4';
delete from mysql.tables_priv where user='mysqltest_4';
flush privileges;
drop database mysqltest;
-show full plugin;
-show warnings;
-Level Code Message
-Warning 1287 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL 6.0. Please use 'SHOW PLUGINS' instead
-show plugin;
show plugins;
create database `mysqlttest\1`;
create table `mysqlttest\1`.`a\b` (a int);
@@ -1448,7 +1442,6 @@ DROP PROCEDURE p1;
DROP FUNCTION f1;
DROP TABLE t1;
DROP EVENT ev1;
-SHOW TABLE TYPES;
CREATE USER test_u@localhost;
GRANT PROCESS ON *.* TO test_u@localhost;
SHOW ENGINE MYISAM MUTEX;
diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result
index 39770dc4f2a..824d90944a0 100644
--- a/mysql-test/r/sp-code.result
+++ b/mysql-test/r/sp-code.result
@@ -155,11 +155,11 @@ Pos Instruction
0 stmt 9 "drop temporary table if exists sudoku..."
1 stmt 1 "create temporary table sudoku_work ( ..."
2 stmt 1 "create temporary table sudoku_schedul..."
-3 stmt 94 "call sudoku_init()"
+3 stmt 90 "call sudoku_init()"
4 jump_if_not 7(8) p_naive@0
5 stmt 4 "update sudoku_work set cnt = 0 where ..."
6 jump 8
-7 stmt 94 "call sudoku_count()"
+7 stmt 90 "call sudoku_count()"
8 stmt 6 "insert into sudoku_schedule (row,col)..."
9 set v_scounter@2 0
10 set v_i@3 1
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index b3968ea7eb6..ef51f5e37fb 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -921,10 +921,6 @@ CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DROP TRIGGER test1; EN
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE FUNCTION bug_13627_f() returns int BEGIN DROP TRIGGER test1; return 1; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN load table t1 from master; END |
-ERROR 0A000: LOAD TABLE is not allowed in stored procedures
-CREATE FUNCTION bug_13627_f() returns int BEGIN load table t1 from master; return 1; END |
-ERROR 0A000: LOAD TABLE is not allowed in stored procedures
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create table t2 (a int); END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE FUNCTION bug_13627_f() returns int BEGIN create table t2 (a int); return 1; END |
@@ -1115,18 +1111,6 @@ REPAIR TABLE t1;
RETURN 1;
END|
ERROR 0A000: Not allowed to return a result set from a function
-CREATE FUNCTION bug13012() RETURNS INT
-BEGIN
-BACKUP TABLE t1 TO '/tmp';
-RETURN 1;
-END|
-ERROR 0A000: Not allowed to return a result set from a function
-CREATE FUNCTION bug13012() RETURNS INT
-BEGIN
-RESTORE TABLE t1 FROM '/tmp';
-RETURN 1;
-END|
-ERROR 0A000: Not allowed to return a result set from a function
create table t1 (a int)|
CREATE PROCEDURE bug13012_1() REPAIR TABLE t1|
CREATE FUNCTION bug13012_2() RETURNS INT
@@ -1639,11 +1623,9 @@ DROP TABLE t1|
drop procedure if exists p1;
create procedure p1()
begin
-create table t1 (a int) type=MyISAM;
+create table t1 (a int) engine=MyISAM;
drop table t1;
end|
-Warnings:
-Warning 1287 The syntax 'TYPE=storage_engine' is deprecated and will be removed in MySQL 6.0. Please use 'ENGINE=storage_engine' instead
call p1();
call p1();
drop procedure p1;
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index c45ada2047a..4ea26d1021a 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -349,9 +349,9 @@ CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
---> connection: mysqltest_1_con
USE mysqltest;
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
---> connection: mysqltest_2_con
use mysqltest;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 83ad7545685..dd3ada2ee86 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -4296,19 +4296,10 @@ drop procedure if exists bug13012|
create procedure bug13012()
BEGIN
REPAIR TABLE t1;
-BACKUP TABLE t1 to '<MYSQLTEST_VARDIR>/tmp/';
-DROP TABLE t1;
-RESTORE TABLE t1 FROM '<MYSQLTEST_VARDIR>/tmp/';
END|
call bug13012()|
Table Op Msg_type Msg_text
test.t1 repair status OK
-Table Op Msg_type Msg_text
-test.t1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
-test.t1 backup status OK
-Table Op Msg_type Msg_text
-test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
-test.t1 restore status OK
drop procedure bug13012|
create view v1 as select * from t1|
create procedure bug13012()
diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result
index 3cc251bc0a6..0bcf89c5c5f 100644
--- a/mysql-test/r/sp_trans.result
+++ b/mysql-test/r/sp_trans.result
@@ -533,9 +533,7 @@ set @@session.max_heap_table_size=default|
CREATE DATABASE db_bug7787|
use db_bug7787|
CREATE PROCEDURE p1()
-SHOW INNODB STATUS; |
-Warnings:
-Warning 1287 The syntax 'SHOW INNODB STATUS' is deprecated and will be removed in MySQL 6.0. Please use 'SHOW ENGINE INNODB STATUS' instead
+SHOW ENGINE INNODB STATUS; |
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost|
DROP DATABASE db_bug7787|
drop user user_bug7787@localhost|
diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result
index 7a6173b89e2..117f6de754a 100644
--- a/mysql-test/r/sp_trans_log.result
+++ b/mysql-test/r/sp_trans_log.result
@@ -14,15 +14,5 @@ end|
reset master|
insert into t2 values (bug23333(),1)|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
-show binlog events from 106 /* with fixes for #23333 will show there is the query */|
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # #
-master-bin.000001 # Table_map 1 # #
-master-bin.000001 # Table_map 1 # #
-master-bin.000001 # Write_rows 1 # #
-master-bin.000001 # Query 1 # #
-select count(*),@a from t1 /* must be 1,1 */|
-count(*) @a
-1 1
drop table t1,t2;
drop function if exists bug23333;
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result
index 241f4198bf7..b11f60792ef 100644
--- a/mysql-test/r/strict.result
+++ b/mysql-test/r/strict.result
@@ -1327,7 +1327,7 @@ create table t1
123456789*123456789*123456789*123456789*
123456789*123456789*123456789*123456789*');
Warnings:
-Warning 1629 Comment for field 'i' is too long (max = 255)
+Warning 1630 Comment for field 'i' is too long (max = 255)
select column_name, column_comment from information_schema.columns where
table_schema = 'test' and table_name = 't1';
column_name column_comment
diff --git a/mysql-test/r/trigger_notembedded.result b/mysql-test/r/trigger_notembedded.result
index d66308a9bd7..4673ac26f73 100644
--- a/mysql-test/r/trigger_notembedded.result
+++ b/mysql-test/r/trigger_notembedded.result
@@ -117,7 +117,7 @@ CREATE DEFINER='mysqltest_inv'@'localhost'
TRIGGER trg1 BEFORE INSERT ON t1
FOR EACH ROW
SET @new_sum = 0;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
---> connection: default
use mysqltest_db1;
@@ -471,7 +471,7 @@ SELECT trigger_name FROM INFORMATION_SCHEMA.TRIGGERS
WHERE trigger_schema = 'db1';
trigger_name
SHOW CREATE TRIGGER db1.trg;
-ERROR 42000: Access denied; you need the TRIGGER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the TRIGGER privilege(s) for this operation
DROP USER 'no_rights'@'localhost';
DROP DATABASE db1;
End of 5.1 tests.
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index d11ab236c34..b7464ae8ad6 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -889,28 +889,12 @@ CREATE TABLE b15776 (a year(0));
DROP TABLE b15776;
CREATE TABLE b15776 (a year(-2));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1
-CREATE TABLE b15776 (a timestamp(4294967294));
-Warnings:
-Warning 1287 The syntax 'TIMESTAMP(4294967294)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
-DROP TABLE b15776;
-CREATE TABLE b15776 (a timestamp(4294967295));
-Warnings:
-Warning 1287 The syntax 'TIMESTAMP(4294967295)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
-DROP TABLE b15776;
-CREATE TABLE b15776 (a timestamp(4294967296));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
-CREATE TABLE b15776 (a timestamp(-1));
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1
-CREATE TABLE b15776 (a timestamp(-2));
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1
CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
-CREATE TABLE b15776 (a timestamp(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
CREATE TABLE b15776 select cast(null as char(4294967295));
show columns from b15776;
Field Type Null Key Default Extra
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 24cb725de9f..fd13f53d02b 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -97,30 +97,6 @@ date date_time time_stamp
2005-01-01 2005-01-01 00:00:00 2005-01-01 00:00:00
2030-01-01 2030-01-01 00:00:00 2030-01-01 00:00:00
drop table t1;
-create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
-t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
-t14 timestamp(14));
-Warnings:
-Warning 1287 The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
-Warning 1287 The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
-Warning 1287 The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
-Warning 1287 The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
-Warning 1287 The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
-Warning 1287 The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
-Warning 1287 The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
-insert t1 values (0,0,0,0,0,0,0),
-("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
-"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
-"1997-12-31 23:47:59");
-select * from t1;
-t2 t4 t6 t8 t10 t12 t14
-0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
-1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59
-select * from t1;
-t2 t4 t6 t8 t10 t12 t14
-0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
-1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59
-drop table t1;
create table t1 (ix timestamp);
insert into t1 values (0),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101),(20031200000000),(20030000000000);
Warnings:
@@ -436,7 +412,7 @@ max(t)
2004-02-01 00:00:00
drop table t1;
set sql_mode='maxdb';
-create table t1 (a timestamp, b timestamp(19));
+create table t1 (a timestamp, b timestamp);
show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index 2d5c515d0b5..83cacc315d8 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -16,7 +16,7 @@ create table mysqltest.t2 (a int, b int);
grant select on mysqltest.t1 to mysqltest_1@localhost;
grant create view,select on test.* to mysqltest_1@localhost;
create definer=root@localhost view v1 as select * from mysqltest.t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
create view v1 as select * from mysqltest.t1;
alter view v1 as select * from mysqltest.t1;
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1'
@@ -779,11 +779,11 @@ GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost;
GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost;
GRANT SELECT ON db26813.t1 TO u26813@localhost;
ALTER VIEW v1 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
ALTER VIEW v2 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
ALTER VIEW v3 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
SHOW CREATE VIEW v3;
View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
@@ -807,9 +807,9 @@ GRANT DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost;
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost;
ALTER VIEW v1 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
ALTER VIEW v2 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
SHOW CREATE VIEW v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index 8a87852d582..229621435f2 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -166,9 +166,6 @@ show variables like 'max_error_count';
Variable_name Value
max_error_count 10
drop table t1;
-set table_type=MYISAM;
-Warnings:
-Warning 1287 The syntax '@@table_type' is deprecated and will be removed in MySQL 6.0. Please use '@@storage_engine' instead
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
update t1 set a='abc';
diff --git a/mysql-test/suite/binlog/r/binlog_grant.result b/mysql-test/suite/binlog/r/binlog_grant.result
index 21ebb891103..548013fcbf2 100644
--- a/mysql-test/suite/binlog/r/binlog_grant.result
+++ b/mysql-test/suite/binlog/r/binlog_grant.result
@@ -13,16 +13,16 @@ set session sql_log_bin = 1;
set global sql_log_bin = 1;
ERROR HY000: Variable 'sql_log_bin' is a SESSION variable and can't be used with SET GLOBAL
set session sql_log_bin = 1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
**** Variable BINLOG_FORMAT ****
[root]
set global binlog_format = row;
set session binlog_format = row;
[plain]
set global binlog_format = row;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
set session binlog_format = row;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
**** Clean up ****
set global binlog_format = @saved_binlog_format;
drop user mysqltest_1@localhost;
diff --git a/mysql-test/suite/binlog/r/binlog_implicit_commit.result b/mysql-test/suite/binlog/r/binlog_implicit_commit.result
new file mode 100644
index 00000000000..ea43b31bde9
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_implicit_commit.result
@@ -0,0 +1,345 @@
+CREATE TABLE t1 (id INT) ENGINE = InnoDB;
+SET BINLOG_FORMAT = STATEMENT;
+RESET MASTER;
+SET AUTOCOMMIT = 0;
+INSERT INTO t1 VALUES (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 0;
+BEGIN;
+INSERT INTO t1 VALUES (2);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+INSERT INTO t1 VALUES (3);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 1;
+INSERT INTO t1 VALUES (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+SET AUTOCOMMIT = 1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 1;
+BEGIN;
+INSERT INTO t1 VALUES (2);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+INSERT INTO t1 VALUES (3);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 0;
+INSERT INTO t1 VALUES (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 0;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 0;
+BEGIN;
+INSERT INTO t1 VALUES (2);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 0;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+INSERT INTO t1 VALUES (3);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 1;
+INSERT INTO t1 VALUES (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+SET AUTOCOMMIT = 0;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 1;
+BEGIN;
+INSERT INTO t1 VALUES (2);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 0;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+INSERT INTO t1 VALUES (3);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+SET BINLOG_FORMAT = ROW;
+RESET MASTER;
+SET AUTOCOMMIT = 0;
+INSERT INTO t1 VALUES (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 0;
+BEGIN;
+INSERT INTO t1 VALUES (2);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+INSERT INTO t1 VALUES (3);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 1;
+INSERT INTO t1 VALUES (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+SET AUTOCOMMIT = 1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 1;
+BEGIN;
+INSERT INTO t1 VALUES (2);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+INSERT INTO t1 VALUES (3);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 0;
+INSERT INTO t1 VALUES (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 0;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 0;
+BEGIN;
+INSERT INTO t1 VALUES (2);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 0;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+INSERT INTO t1 VALUES (3);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 1;
+INSERT INTO t1 VALUES (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+SET AUTOCOMMIT = 0;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 1;
+BEGIN;
+INSERT INTO t1 VALUES (2);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+SET AUTOCOMMIT = 0;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+INSERT INTO t1 VALUES (3);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+RESET MASTER;
+SET AUTOCOMMIT = 0;
+INSERT INTO t1 VALUES (1);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+LOCK TABLES t1 WRITE;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+INSERT INTO t1 VALUES (2);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+UNLOCK TABLES;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/r/binlog_innodb.result b/mysql-test/suite/binlog/r/binlog_innodb.result
index 1922897f631..424f7d60829 100644
--- a/mysql-test/suite/binlog/r/binlog_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_innodb.result
@@ -156,9 +156,10 @@ select * from t2 /* must be (3,1), (4,4) */;
a b
1 1
4 4
-show master status /* there must no UPDATE in binlog */;
+there must no UPDATE in binlog
+show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 106
+master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
@@ -166,8 +167,9 @@ insert into t2 values (1,2),(3,4),(4,4);
reset master;
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
-show master status /* there must be no UPDATE query event */;
+there must no UPDATE in binlog
+show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 106
+master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
drop table t1, t2;
End of tests
diff --git a/mysql-test/suite/binlog/r/binlog_max_extension.result b/mysql-test/suite/binlog/r/binlog_max_extension.result
new file mode 100644
index 00000000000..af341db4536
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_max_extension.result
@@ -0,0 +1,8 @@
+call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0.");
+call mtr.add_suppression("Log filename extension number exhausted:");
+call mtr.add_suppression("Can't generate a unique log-filename");
+RESET MASTER;
+FLUSH LOGS;
+Warnings:
+Warning 1098 Can't generate a unique log-filename master-bin.(1-999)
+
diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result
index 4d32a4f4739..7dc37d7c365 100644
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result
@@ -26,7 +26,7 @@ create table t1 (n int) engine=innodb;
begin;
commit;
drop table t1;
-show binlog events in 'master-bin.000001' from 106;
+show binlog events in 'master-bin.000001' from 107;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb
master-bin.000001 # Query 1 # BEGIN
@@ -232,7 +232,7 @@ master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Xid 1 # COMMIT /* xid= */
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
-show binlog events in 'master-bin.000002' from 106;
+show binlog events in 'master-bin.000002' from 107;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Query 1 # use `test`; drop table t1
set @ac = @@autocommit;
@@ -247,25 +247,8 @@ commit;
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
-master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb
-master-bin.000001 205 Query 1 273 BEGIN
-master-bin.000001 273 Table_map 1 314 table_id: # (test.t1)
-master-bin.000001 314 Write_rows 1 348 table_id: # flags: STMT_END_F
-master-bin.000001 348 Table_map 1 389 table_id: # (test.t1)
-master-bin.000001 389 Write_rows 1 423 table_id: # flags: STMT_END_F
-master-bin.000001 423 Table_map 1 464 table_id: # (test.t1)
-master-bin.000001 464 Write_rows 1 498 table_id: # flags: STMT_END_F
-master-bin.000001 498 Xid 1 525 COMMIT /* XID */
-master-bin.000001 525 Query 1 601 use `test`; drop table t1
-set @bcs = @@binlog_cache_size;
-set global binlog_cache_size=4096;
-reset master;
-create table t1 (a int) engine=innodb;
-show binlog events from 0;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
-master-bin.000001 106 Query 1 206 use `test`; create table t1 (a int) engine=innodb
+master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4
+master-bin.000001 107 Query 1 206 use `test`; create table t1(n int) engine=innodb
master-bin.000001 206 Query 1 274 BEGIN
master-bin.000001 274 Table_map 1 315 table_id: # (test.t1)
master-bin.000001 315 Write_rows 1 349 table_id: # flags: STMT_END_F
@@ -273,802 +256,819 @@ master-bin.000001 349 Table_map 1 390 table_id: # (test.t1)
master-bin.000001 390 Write_rows 1 424 table_id: # flags: STMT_END_F
master-bin.000001 424 Table_map 1 465 table_id: # (test.t1)
master-bin.000001 465 Write_rows 1 499 table_id: # flags: STMT_END_F
-master-bin.000001 499 Table_map 1 540 table_id: # (test.t1)
-master-bin.000001 540 Write_rows 1 574 table_id: # flags: STMT_END_F
-master-bin.000001 574 Table_map 1 615 table_id: # (test.t1)
-master-bin.000001 615 Write_rows 1 649 table_id: # flags: STMT_END_F
-master-bin.000001 649 Table_map 1 690 table_id: # (test.t1)
-master-bin.000001 690 Write_rows 1 724 table_id: # flags: STMT_END_F
-master-bin.000001 724 Table_map 1 765 table_id: # (test.t1)
-master-bin.000001 765 Write_rows 1 799 table_id: # flags: STMT_END_F
-master-bin.000001 799 Table_map 1 840 table_id: # (test.t1)
-master-bin.000001 840 Write_rows 1 874 table_id: # flags: STMT_END_F
-master-bin.000001 874 Table_map 1 915 table_id: # (test.t1)
-master-bin.000001 915 Write_rows 1 949 table_id: # flags: STMT_END_F
-master-bin.000001 949 Table_map 1 990 table_id: # (test.t1)
-master-bin.000001 990 Write_rows 1 1024 table_id: # flags: STMT_END_F
-master-bin.000001 1024 Table_map 1 1065 table_id: # (test.t1)
-master-bin.000001 1065 Write_rows 1 1099 table_id: # flags: STMT_END_F
-master-bin.000001 1099 Table_map 1 1140 table_id: # (test.t1)
-master-bin.000001 1140 Write_rows 1 1174 table_id: # flags: STMT_END_F
-master-bin.000001 1174 Table_map 1 1215 table_id: # (test.t1)
-master-bin.000001 1215 Write_rows 1 1249 table_id: # flags: STMT_END_F
-master-bin.000001 1249 Table_map 1 1290 table_id: # (test.t1)
-master-bin.000001 1290 Write_rows 1 1324 table_id: # flags: STMT_END_F
-master-bin.000001 1324 Table_map 1 1365 table_id: # (test.t1)
-master-bin.000001 1365 Write_rows 1 1399 table_id: # flags: STMT_END_F
-master-bin.000001 1399 Table_map 1 1440 table_id: # (test.t1)
-master-bin.000001 1440 Write_rows 1 1474 table_id: # flags: STMT_END_F
-master-bin.000001 1474 Table_map 1 1515 table_id: # (test.t1)
-master-bin.000001 1515 Write_rows 1 1549 table_id: # flags: STMT_END_F
-master-bin.000001 1549 Table_map 1 1590 table_id: # (test.t1)
-master-bin.000001 1590 Write_rows 1 1624 table_id: # flags: STMT_END_F
-master-bin.000001 1624 Table_map 1 1665 table_id: # (test.t1)
-master-bin.000001 1665 Write_rows 1 1699 table_id: # flags: STMT_END_F
-master-bin.000001 1699 Table_map 1 1740 table_id: # (test.t1)
-master-bin.000001 1740 Write_rows 1 1774 table_id: # flags: STMT_END_F
-master-bin.000001 1774 Table_map 1 1815 table_id: # (test.t1)
-master-bin.000001 1815 Write_rows 1 1849 table_id: # flags: STMT_END_F
-master-bin.000001 1849 Table_map 1 1890 table_id: # (test.t1)
-master-bin.000001 1890 Write_rows 1 1924 table_id: # flags: STMT_END_F
-master-bin.000001 1924 Table_map 1 1965 table_id: # (test.t1)
-master-bin.000001 1965 Write_rows 1 1999 table_id: # flags: STMT_END_F
-master-bin.000001 1999 Table_map 1 2040 table_id: # (test.t1)
-master-bin.000001 2040 Write_rows 1 2074 table_id: # flags: STMT_END_F
-master-bin.000001 2074 Table_map 1 2115 table_id: # (test.t1)
-master-bin.000001 2115 Write_rows 1 2149 table_id: # flags: STMT_END_F
-master-bin.000001 2149 Table_map 1 2190 table_id: # (test.t1)
-master-bin.000001 2190 Write_rows 1 2224 table_id: # flags: STMT_END_F
-master-bin.000001 2224 Table_map 1 2265 table_id: # (test.t1)
-master-bin.000001 2265 Write_rows 1 2299 table_id: # flags: STMT_END_F
-master-bin.000001 2299 Table_map 1 2340 table_id: # (test.t1)
-master-bin.000001 2340 Write_rows 1 2374 table_id: # flags: STMT_END_F
-master-bin.000001 2374 Table_map 1 2415 table_id: # (test.t1)
-master-bin.000001 2415 Write_rows 1 2449 table_id: # flags: STMT_END_F
-master-bin.000001 2449 Table_map 1 2490 table_id: # (test.t1)
-master-bin.000001 2490 Write_rows 1 2524 table_id: # flags: STMT_END_F
-master-bin.000001 2524 Table_map 1 2565 table_id: # (test.t1)
-master-bin.000001 2565 Write_rows 1 2599 table_id: # flags: STMT_END_F
-master-bin.000001 2599 Table_map 1 2640 table_id: # (test.t1)
-master-bin.000001 2640 Write_rows 1 2674 table_id: # flags: STMT_END_F
-master-bin.000001 2674 Table_map 1 2715 table_id: # (test.t1)
-master-bin.000001 2715 Write_rows 1 2749 table_id: # flags: STMT_END_F
-master-bin.000001 2749 Table_map 1 2790 table_id: # (test.t1)
-master-bin.000001 2790 Write_rows 1 2824 table_id: # flags: STMT_END_F
-master-bin.000001 2824 Table_map 1 2865 table_id: # (test.t1)
-master-bin.000001 2865 Write_rows 1 2899 table_id: # flags: STMT_END_F
-master-bin.000001 2899 Table_map 1 2940 table_id: # (test.t1)
-master-bin.000001 2940 Write_rows 1 2974 table_id: # flags: STMT_END_F
-master-bin.000001 2974 Table_map 1 3015 table_id: # (test.t1)
-master-bin.000001 3015 Write_rows 1 3049 table_id: # flags: STMT_END_F
-master-bin.000001 3049 Table_map 1 3090 table_id: # (test.t1)
-master-bin.000001 3090 Write_rows 1 3124 table_id: # flags: STMT_END_F
-master-bin.000001 3124 Table_map 1 3165 table_id: # (test.t1)
-master-bin.000001 3165 Write_rows 1 3199 table_id: # flags: STMT_END_F
-master-bin.000001 3199 Table_map 1 3240 table_id: # (test.t1)
-master-bin.000001 3240 Write_rows 1 3274 table_id: # flags: STMT_END_F
-master-bin.000001 3274 Table_map 1 3315 table_id: # (test.t1)
-master-bin.000001 3315 Write_rows 1 3349 table_id: # flags: STMT_END_F
-master-bin.000001 3349 Table_map 1 3390 table_id: # (test.t1)
-master-bin.000001 3390 Write_rows 1 3424 table_id: # flags: STMT_END_F
-master-bin.000001 3424 Table_map 1 3465 table_id: # (test.t1)
-master-bin.000001 3465 Write_rows 1 3499 table_id: # flags: STMT_END_F
-master-bin.000001 3499 Table_map 1 3540 table_id: # (test.t1)
-master-bin.000001 3540 Write_rows 1 3574 table_id: # flags: STMT_END_F
-master-bin.000001 3574 Table_map 1 3615 table_id: # (test.t1)
-master-bin.000001 3615 Write_rows 1 3649 table_id: # flags: STMT_END_F
-master-bin.000001 3649 Table_map 1 3690 table_id: # (test.t1)
-master-bin.000001 3690 Write_rows 1 3724 table_id: # flags: STMT_END_F
-master-bin.000001 3724 Table_map 1 3765 table_id: # (test.t1)
-master-bin.000001 3765 Write_rows 1 3799 table_id: # flags: STMT_END_F
-master-bin.000001 3799 Table_map 1 3840 table_id: # (test.t1)
-master-bin.000001 3840 Write_rows 1 3874 table_id: # flags: STMT_END_F
-master-bin.000001 3874 Table_map 1 3915 table_id: # (test.t1)
-master-bin.000001 3915 Write_rows 1 3949 table_id: # flags: STMT_END_F
-master-bin.000001 3949 Table_map 1 3990 table_id: # (test.t1)
-master-bin.000001 3990 Write_rows 1 4024 table_id: # flags: STMT_END_F
-master-bin.000001 4024 Table_map 1 4065 table_id: # (test.t1)
-master-bin.000001 4065 Write_rows 1 4099 table_id: # flags: STMT_END_F
-master-bin.000001 4099 Table_map 1 4140 table_id: # (test.t1)
-master-bin.000001 4140 Write_rows 1 4174 table_id: # flags: STMT_END_F
-master-bin.000001 4174 Table_map 1 4215 table_id: # (test.t1)
-master-bin.000001 4215 Write_rows 1 4249 table_id: # flags: STMT_END_F
-master-bin.000001 4249 Table_map 1 4290 table_id: # (test.t1)
-master-bin.000001 4290 Write_rows 1 4324 table_id: # flags: STMT_END_F
-master-bin.000001 4324 Table_map 1 4365 table_id: # (test.t1)
-master-bin.000001 4365 Write_rows 1 4399 table_id: # flags: STMT_END_F
-master-bin.000001 4399 Table_map 1 4440 table_id: # (test.t1)
-master-bin.000001 4440 Write_rows 1 4474 table_id: # flags: STMT_END_F
-master-bin.000001 4474 Table_map 1 4515 table_id: # (test.t1)
-master-bin.000001 4515 Write_rows 1 4549 table_id: # flags: STMT_END_F
-master-bin.000001 4549 Table_map 1 4590 table_id: # (test.t1)
-master-bin.000001 4590 Write_rows 1 4624 table_id: # flags: STMT_END_F
-master-bin.000001 4624 Table_map 1 4665 table_id: # (test.t1)
-master-bin.000001 4665 Write_rows 1 4699 table_id: # flags: STMT_END_F
-master-bin.000001 4699 Table_map 1 4740 table_id: # (test.t1)
-master-bin.000001 4740 Write_rows 1 4774 table_id: # flags: STMT_END_F
-master-bin.000001 4774 Table_map 1 4815 table_id: # (test.t1)
-master-bin.000001 4815 Write_rows 1 4849 table_id: # flags: STMT_END_F
-master-bin.000001 4849 Table_map 1 4890 table_id: # (test.t1)
-master-bin.000001 4890 Write_rows 1 4924 table_id: # flags: STMT_END_F
-master-bin.000001 4924 Table_map 1 4965 table_id: # (test.t1)
-master-bin.000001 4965 Write_rows 1 4999 table_id: # flags: STMT_END_F
-master-bin.000001 4999 Table_map 1 5040 table_id: # (test.t1)
-master-bin.000001 5040 Write_rows 1 5074 table_id: # flags: STMT_END_F
-master-bin.000001 5074 Table_map 1 5115 table_id: # (test.t1)
-master-bin.000001 5115 Write_rows 1 5149 table_id: # flags: STMT_END_F
-master-bin.000001 5149 Table_map 1 5190 table_id: # (test.t1)
-master-bin.000001 5190 Write_rows 1 5224 table_id: # flags: STMT_END_F
-master-bin.000001 5224 Table_map 1 5265 table_id: # (test.t1)
-master-bin.000001 5265 Write_rows 1 5299 table_id: # flags: STMT_END_F
-master-bin.000001 5299 Table_map 1 5340 table_id: # (test.t1)
-master-bin.000001 5340 Write_rows 1 5374 table_id: # flags: STMT_END_F
-master-bin.000001 5374 Table_map 1 5415 table_id: # (test.t1)
-master-bin.000001 5415 Write_rows 1 5449 table_id: # flags: STMT_END_F
-master-bin.000001 5449 Table_map 1 5490 table_id: # (test.t1)
-master-bin.000001 5490 Write_rows 1 5524 table_id: # flags: STMT_END_F
-master-bin.000001 5524 Table_map 1 5565 table_id: # (test.t1)
-master-bin.000001 5565 Write_rows 1 5599 table_id: # flags: STMT_END_F
-master-bin.000001 5599 Table_map 1 5640 table_id: # (test.t1)
-master-bin.000001 5640 Write_rows 1 5674 table_id: # flags: STMT_END_F
-master-bin.000001 5674 Table_map 1 5715 table_id: # (test.t1)
-master-bin.000001 5715 Write_rows 1 5749 table_id: # flags: STMT_END_F
-master-bin.000001 5749 Table_map 1 5790 table_id: # (test.t1)
-master-bin.000001 5790 Write_rows 1 5824 table_id: # flags: STMT_END_F
-master-bin.000001 5824 Table_map 1 5865 table_id: # (test.t1)
-master-bin.000001 5865 Write_rows 1 5899 table_id: # flags: STMT_END_F
-master-bin.000001 5899 Table_map 1 5940 table_id: # (test.t1)
-master-bin.000001 5940 Write_rows 1 5974 table_id: # flags: STMT_END_F
-master-bin.000001 5974 Table_map 1 6015 table_id: # (test.t1)
-master-bin.000001 6015 Write_rows 1 6049 table_id: # flags: STMT_END_F
-master-bin.000001 6049 Table_map 1 6090 table_id: # (test.t1)
-master-bin.000001 6090 Write_rows 1 6124 table_id: # flags: STMT_END_F
-master-bin.000001 6124 Table_map 1 6165 table_id: # (test.t1)
-master-bin.000001 6165 Write_rows 1 6199 table_id: # flags: STMT_END_F
-master-bin.000001 6199 Table_map 1 6240 table_id: # (test.t1)
-master-bin.000001 6240 Write_rows 1 6274 table_id: # flags: STMT_END_F
-master-bin.000001 6274 Table_map 1 6315 table_id: # (test.t1)
-master-bin.000001 6315 Write_rows 1 6349 table_id: # flags: STMT_END_F
-master-bin.000001 6349 Table_map 1 6390 table_id: # (test.t1)
-master-bin.000001 6390 Write_rows 1 6424 table_id: # flags: STMT_END_F
-master-bin.000001 6424 Table_map 1 6465 table_id: # (test.t1)
-master-bin.000001 6465 Write_rows 1 6499 table_id: # flags: STMT_END_F
-master-bin.000001 6499 Table_map 1 6540 table_id: # (test.t1)
-master-bin.000001 6540 Write_rows 1 6574 table_id: # flags: STMT_END_F
-master-bin.000001 6574 Table_map 1 6615 table_id: # (test.t1)
-master-bin.000001 6615 Write_rows 1 6649 table_id: # flags: STMT_END_F
-master-bin.000001 6649 Table_map 1 6690 table_id: # (test.t1)
-master-bin.000001 6690 Write_rows 1 6724 table_id: # flags: STMT_END_F
-master-bin.000001 6724 Table_map 1 6765 table_id: # (test.t1)
-master-bin.000001 6765 Write_rows 1 6799 table_id: # flags: STMT_END_F
-master-bin.000001 6799 Table_map 1 6840 table_id: # (test.t1)
-master-bin.000001 6840 Write_rows 1 6874 table_id: # flags: STMT_END_F
-master-bin.000001 6874 Table_map 1 6915 table_id: # (test.t1)
-master-bin.000001 6915 Write_rows 1 6949 table_id: # flags: STMT_END_F
-master-bin.000001 6949 Table_map 1 6990 table_id: # (test.t1)
-master-bin.000001 6990 Write_rows 1 7024 table_id: # flags: STMT_END_F
-master-bin.000001 7024 Table_map 1 7065 table_id: # (test.t1)
-master-bin.000001 7065 Write_rows 1 7099 table_id: # flags: STMT_END_F
-master-bin.000001 7099 Table_map 1 7140 table_id: # (test.t1)
-master-bin.000001 7140 Write_rows 1 7174 table_id: # flags: STMT_END_F
-master-bin.000001 7174 Table_map 1 7215 table_id: # (test.t1)
-master-bin.000001 7215 Write_rows 1 7249 table_id: # flags: STMT_END_F
-master-bin.000001 7249 Table_map 1 7290 table_id: # (test.t1)
-master-bin.000001 7290 Write_rows 1 7324 table_id: # flags: STMT_END_F
-master-bin.000001 7324 Table_map 1 7365 table_id: # (test.t1)
-master-bin.000001 7365 Write_rows 1 7399 table_id: # flags: STMT_END_F
-master-bin.000001 7399 Table_map 1 7440 table_id: # (test.t1)
-master-bin.000001 7440 Write_rows 1 7474 table_id: # flags: STMT_END_F
-master-bin.000001 7474 Table_map 1 7515 table_id: # (test.t1)
-master-bin.000001 7515 Write_rows 1 7549 table_id: # flags: STMT_END_F
-master-bin.000001 7549 Table_map 1 7590 table_id: # (test.t1)
-master-bin.000001 7590 Write_rows 1 7624 table_id: # flags: STMT_END_F
-master-bin.000001 7624 Table_map 1 7665 table_id: # (test.t1)
-master-bin.000001 7665 Write_rows 1 7699 table_id: # flags: STMT_END_F
-master-bin.000001 7699 Table_map 1 7740 table_id: # (test.t1)
-master-bin.000001 7740 Write_rows 1 7774 table_id: # flags: STMT_END_F
-master-bin.000001 7774 Table_map 1 7815 table_id: # (test.t1)
-master-bin.000001 7815 Write_rows 1 7849 table_id: # flags: STMT_END_F
-master-bin.000001 7849 Table_map 1 7890 table_id: # (test.t1)
-master-bin.000001 7890 Write_rows 1 7924 table_id: # flags: STMT_END_F
-master-bin.000001 7924 Table_map 1 7965 table_id: # (test.t1)
-master-bin.000001 7965 Write_rows 1 7999 table_id: # flags: STMT_END_F
-master-bin.000001 7999 Table_map 1 8040 table_id: # (test.t1)
-master-bin.000001 8040 Write_rows 1 8074 table_id: # flags: STMT_END_F
-master-bin.000001 8074 Table_map 1 8115 table_id: # (test.t1)
-master-bin.000001 8115 Write_rows 1 8149 table_id: # flags: STMT_END_F
-master-bin.000001 8149 Table_map 1 8190 table_id: # (test.t1)
-master-bin.000001 8190 Write_rows 1 8224 table_id: # flags: STMT_END_F
-master-bin.000001 8224 Table_map 1 8265 table_id: # (test.t1)
-master-bin.000001 8265 Write_rows 1 8299 table_id: # flags: STMT_END_F
-master-bin.000001 8299 Table_map 1 8340 table_id: # (test.t1)
-master-bin.000001 8340 Write_rows 1 8374 table_id: # flags: STMT_END_F
-master-bin.000001 8374 Table_map 1 8415 table_id: # (test.t1)
-master-bin.000001 8415 Write_rows 1 8449 table_id: # flags: STMT_END_F
-master-bin.000001 8449 Table_map 1 8490 table_id: # (test.t1)
-master-bin.000001 8490 Write_rows 1 8524 table_id: # flags: STMT_END_F
-master-bin.000001 8524 Table_map 1 8565 table_id: # (test.t1)
-master-bin.000001 8565 Write_rows 1 8599 table_id: # flags: STMT_END_F
-master-bin.000001 8599 Table_map 1 8640 table_id: # (test.t1)
-master-bin.000001 8640 Write_rows 1 8674 table_id: # flags: STMT_END_F
-master-bin.000001 8674 Table_map 1 8715 table_id: # (test.t1)
-master-bin.000001 8715 Write_rows 1 8749 table_id: # flags: STMT_END_F
-master-bin.000001 8749 Table_map 1 8790 table_id: # (test.t1)
-master-bin.000001 8790 Write_rows 1 8824 table_id: # flags: STMT_END_F
-master-bin.000001 8824 Table_map 1 8865 table_id: # (test.t1)
-master-bin.000001 8865 Write_rows 1 8899 table_id: # flags: STMT_END_F
-master-bin.000001 8899 Table_map 1 8940 table_id: # (test.t1)
-master-bin.000001 8940 Write_rows 1 8974 table_id: # flags: STMT_END_F
-master-bin.000001 8974 Table_map 1 9015 table_id: # (test.t1)
-master-bin.000001 9015 Write_rows 1 9049 table_id: # flags: STMT_END_F
-master-bin.000001 9049 Table_map 1 9090 table_id: # (test.t1)
-master-bin.000001 9090 Write_rows 1 9124 table_id: # flags: STMT_END_F
-master-bin.000001 9124 Table_map 1 9165 table_id: # (test.t1)
-master-bin.000001 9165 Write_rows 1 9199 table_id: # flags: STMT_END_F
-master-bin.000001 9199 Table_map 1 9240 table_id: # (test.t1)
-master-bin.000001 9240 Write_rows 1 9274 table_id: # flags: STMT_END_F
-master-bin.000001 9274 Table_map 1 9315 table_id: # (test.t1)
-master-bin.000001 9315 Write_rows 1 9349 table_id: # flags: STMT_END_F
-master-bin.000001 9349 Table_map 1 9390 table_id: # (test.t1)
-master-bin.000001 9390 Write_rows 1 9424 table_id: # flags: STMT_END_F
-master-bin.000001 9424 Table_map 1 9465 table_id: # (test.t1)
-master-bin.000001 9465 Write_rows 1 9499 table_id: # flags: STMT_END_F
-master-bin.000001 9499 Table_map 1 9540 table_id: # (test.t1)
-master-bin.000001 9540 Write_rows 1 9574 table_id: # flags: STMT_END_F
-master-bin.000001 9574 Table_map 1 9615 table_id: # (test.t1)
-master-bin.000001 9615 Write_rows 1 9649 table_id: # flags: STMT_END_F
-master-bin.000001 9649 Table_map 1 9690 table_id: # (test.t1)
-master-bin.000001 9690 Write_rows 1 9724 table_id: # flags: STMT_END_F
-master-bin.000001 9724 Table_map 1 9765 table_id: # (test.t1)
-master-bin.000001 9765 Write_rows 1 9799 table_id: # flags: STMT_END_F
-master-bin.000001 9799 Table_map 1 9840 table_id: # (test.t1)
-master-bin.000001 9840 Write_rows 1 9874 table_id: # flags: STMT_END_F
-master-bin.000001 9874 Table_map 1 9915 table_id: # (test.t1)
-master-bin.000001 9915 Write_rows 1 9949 table_id: # flags: STMT_END_F
-master-bin.000001 9949 Table_map 1 9990 table_id: # (test.t1)
-master-bin.000001 9990 Write_rows 1 10024 table_id: # flags: STMT_END_F
-master-bin.000001 10024 Table_map 1 10065 table_id: # (test.t1)
-master-bin.000001 10065 Write_rows 1 10099 table_id: # flags: STMT_END_F
-master-bin.000001 10099 Table_map 1 10140 table_id: # (test.t1)
-master-bin.000001 10140 Write_rows 1 10174 table_id: # flags: STMT_END_F
-master-bin.000001 10174 Table_map 1 10215 table_id: # (test.t1)
-master-bin.000001 10215 Write_rows 1 10249 table_id: # flags: STMT_END_F
-master-bin.000001 10249 Table_map 1 10290 table_id: # (test.t1)
-master-bin.000001 10290 Write_rows 1 10324 table_id: # flags: STMT_END_F
-master-bin.000001 10324 Table_map 1 10365 table_id: # (test.t1)
-master-bin.000001 10365 Write_rows 1 10399 table_id: # flags: STMT_END_F
-master-bin.000001 10399 Table_map 1 10440 table_id: # (test.t1)
-master-bin.000001 10440 Write_rows 1 10474 table_id: # flags: STMT_END_F
-master-bin.000001 10474 Table_map 1 10515 table_id: # (test.t1)
-master-bin.000001 10515 Write_rows 1 10549 table_id: # flags: STMT_END_F
-master-bin.000001 10549 Table_map 1 10590 table_id: # (test.t1)
-master-bin.000001 10590 Write_rows 1 10624 table_id: # flags: STMT_END_F
-master-bin.000001 10624 Table_map 1 10665 table_id: # (test.t1)
-master-bin.000001 10665 Write_rows 1 10699 table_id: # flags: STMT_END_F
-master-bin.000001 10699 Table_map 1 10740 table_id: # (test.t1)
-master-bin.000001 10740 Write_rows 1 10774 table_id: # flags: STMT_END_F
-master-bin.000001 10774 Table_map 1 10815 table_id: # (test.t1)
-master-bin.000001 10815 Write_rows 1 10849 table_id: # flags: STMT_END_F
-master-bin.000001 10849 Table_map 1 10890 table_id: # (test.t1)
-master-bin.000001 10890 Write_rows 1 10924 table_id: # flags: STMT_END_F
-master-bin.000001 10924 Table_map 1 10965 table_id: # (test.t1)
-master-bin.000001 10965 Write_rows 1 10999 table_id: # flags: STMT_END_F
-master-bin.000001 10999 Table_map 1 11040 table_id: # (test.t1)
-master-bin.000001 11040 Write_rows 1 11074 table_id: # flags: STMT_END_F
-master-bin.000001 11074 Table_map 1 11115 table_id: # (test.t1)
-master-bin.000001 11115 Write_rows 1 11149 table_id: # flags: STMT_END_F
-master-bin.000001 11149 Table_map 1 11190 table_id: # (test.t1)
-master-bin.000001 11190 Write_rows 1 11224 table_id: # flags: STMT_END_F
-master-bin.000001 11224 Table_map 1 11265 table_id: # (test.t1)
-master-bin.000001 11265 Write_rows 1 11299 table_id: # flags: STMT_END_F
-master-bin.000001 11299 Table_map 1 11340 table_id: # (test.t1)
-master-bin.000001 11340 Write_rows 1 11374 table_id: # flags: STMT_END_F
-master-bin.000001 11374 Table_map 1 11415 table_id: # (test.t1)
-master-bin.000001 11415 Write_rows 1 11449 table_id: # flags: STMT_END_F
-master-bin.000001 11449 Table_map 1 11490 table_id: # (test.t1)
-master-bin.000001 11490 Write_rows 1 11524 table_id: # flags: STMT_END_F
-master-bin.000001 11524 Table_map 1 11565 table_id: # (test.t1)
-master-bin.000001 11565 Write_rows 1 11599 table_id: # flags: STMT_END_F
-master-bin.000001 11599 Table_map 1 11640 table_id: # (test.t1)
-master-bin.000001 11640 Write_rows 1 11674 table_id: # flags: STMT_END_F
-master-bin.000001 11674 Table_map 1 11715 table_id: # (test.t1)
-master-bin.000001 11715 Write_rows 1 11749 table_id: # flags: STMT_END_F
-master-bin.000001 11749 Table_map 1 11790 table_id: # (test.t1)
-master-bin.000001 11790 Write_rows 1 11824 table_id: # flags: STMT_END_F
-master-bin.000001 11824 Table_map 1 11865 table_id: # (test.t1)
-master-bin.000001 11865 Write_rows 1 11899 table_id: # flags: STMT_END_F
-master-bin.000001 11899 Table_map 1 11940 table_id: # (test.t1)
-master-bin.000001 11940 Write_rows 1 11974 table_id: # flags: STMT_END_F
-master-bin.000001 11974 Table_map 1 12015 table_id: # (test.t1)
-master-bin.000001 12015 Write_rows 1 12049 table_id: # flags: STMT_END_F
-master-bin.000001 12049 Table_map 1 12090 table_id: # (test.t1)
-master-bin.000001 12090 Write_rows 1 12124 table_id: # flags: STMT_END_F
-master-bin.000001 12124 Table_map 1 12165 table_id: # (test.t1)
-master-bin.000001 12165 Write_rows 1 12199 table_id: # flags: STMT_END_F
-master-bin.000001 12199 Table_map 1 12240 table_id: # (test.t1)
-master-bin.000001 12240 Write_rows 1 12274 table_id: # flags: STMT_END_F
-master-bin.000001 12274 Table_map 1 12315 table_id: # (test.t1)
-master-bin.000001 12315 Write_rows 1 12349 table_id: # flags: STMT_END_F
-master-bin.000001 12349 Table_map 1 12390 table_id: # (test.t1)
-master-bin.000001 12390 Write_rows 1 12424 table_id: # flags: STMT_END_F
-master-bin.000001 12424 Table_map 1 12465 table_id: # (test.t1)
-master-bin.000001 12465 Write_rows 1 12499 table_id: # flags: STMT_END_F
-master-bin.000001 12499 Table_map 1 12540 table_id: # (test.t1)
-master-bin.000001 12540 Write_rows 1 12574 table_id: # flags: STMT_END_F
-master-bin.000001 12574 Table_map 1 12615 table_id: # (test.t1)
-master-bin.000001 12615 Write_rows 1 12649 table_id: # flags: STMT_END_F
-master-bin.000001 12649 Table_map 1 12690 table_id: # (test.t1)
-master-bin.000001 12690 Write_rows 1 12724 table_id: # flags: STMT_END_F
-master-bin.000001 12724 Table_map 1 12765 table_id: # (test.t1)
-master-bin.000001 12765 Write_rows 1 12799 table_id: # flags: STMT_END_F
-master-bin.000001 12799 Table_map 1 12840 table_id: # (test.t1)
-master-bin.000001 12840 Write_rows 1 12874 table_id: # flags: STMT_END_F
-master-bin.000001 12874 Table_map 1 12915 table_id: # (test.t1)
-master-bin.000001 12915 Write_rows 1 12949 table_id: # flags: STMT_END_F
-master-bin.000001 12949 Table_map 1 12990 table_id: # (test.t1)
-master-bin.000001 12990 Write_rows 1 13024 table_id: # flags: STMT_END_F
-master-bin.000001 13024 Table_map 1 13065 table_id: # (test.t1)
-master-bin.000001 13065 Write_rows 1 13099 table_id: # flags: STMT_END_F
-master-bin.000001 13099 Table_map 1 13140 table_id: # (test.t1)
-master-bin.000001 13140 Write_rows 1 13174 table_id: # flags: STMT_END_F
-master-bin.000001 13174 Table_map 1 13215 table_id: # (test.t1)
-master-bin.000001 13215 Write_rows 1 13249 table_id: # flags: STMT_END_F
-master-bin.000001 13249 Table_map 1 13290 table_id: # (test.t1)
-master-bin.000001 13290 Write_rows 1 13324 table_id: # flags: STMT_END_F
-master-bin.000001 13324 Table_map 1 13365 table_id: # (test.t1)
-master-bin.000001 13365 Write_rows 1 13399 table_id: # flags: STMT_END_F
-master-bin.000001 13399 Table_map 1 13440 table_id: # (test.t1)
-master-bin.000001 13440 Write_rows 1 13474 table_id: # flags: STMT_END_F
-master-bin.000001 13474 Table_map 1 13515 table_id: # (test.t1)
-master-bin.000001 13515 Write_rows 1 13549 table_id: # flags: STMT_END_F
-master-bin.000001 13549 Table_map 1 13590 table_id: # (test.t1)
-master-bin.000001 13590 Write_rows 1 13624 table_id: # flags: STMT_END_F
-master-bin.000001 13624 Table_map 1 13665 table_id: # (test.t1)
-master-bin.000001 13665 Write_rows 1 13699 table_id: # flags: STMT_END_F
-master-bin.000001 13699 Table_map 1 13740 table_id: # (test.t1)
-master-bin.000001 13740 Write_rows 1 13774 table_id: # flags: STMT_END_F
-master-bin.000001 13774 Table_map 1 13815 table_id: # (test.t1)
-master-bin.000001 13815 Write_rows 1 13849 table_id: # flags: STMT_END_F
-master-bin.000001 13849 Table_map 1 13890 table_id: # (test.t1)
-master-bin.000001 13890 Write_rows 1 13924 table_id: # flags: STMT_END_F
-master-bin.000001 13924 Table_map 1 13965 table_id: # (test.t1)
-master-bin.000001 13965 Write_rows 1 13999 table_id: # flags: STMT_END_F
-master-bin.000001 13999 Table_map 1 14040 table_id: # (test.t1)
-master-bin.000001 14040 Write_rows 1 14074 table_id: # flags: STMT_END_F
-master-bin.000001 14074 Table_map 1 14115 table_id: # (test.t1)
-master-bin.000001 14115 Write_rows 1 14149 table_id: # flags: STMT_END_F
-master-bin.000001 14149 Table_map 1 14190 table_id: # (test.t1)
-master-bin.000001 14190 Write_rows 1 14224 table_id: # flags: STMT_END_F
-master-bin.000001 14224 Table_map 1 14265 table_id: # (test.t1)
-master-bin.000001 14265 Write_rows 1 14299 table_id: # flags: STMT_END_F
-master-bin.000001 14299 Table_map 1 14340 table_id: # (test.t1)
-master-bin.000001 14340 Write_rows 1 14374 table_id: # flags: STMT_END_F
-master-bin.000001 14374 Table_map 1 14415 table_id: # (test.t1)
-master-bin.000001 14415 Write_rows 1 14449 table_id: # flags: STMT_END_F
-master-bin.000001 14449 Table_map 1 14490 table_id: # (test.t1)
-master-bin.000001 14490 Write_rows 1 14524 table_id: # flags: STMT_END_F
-master-bin.000001 14524 Table_map 1 14565 table_id: # (test.t1)
-master-bin.000001 14565 Write_rows 1 14599 table_id: # flags: STMT_END_F
-master-bin.000001 14599 Table_map 1 14640 table_id: # (test.t1)
-master-bin.000001 14640 Write_rows 1 14674 table_id: # flags: STMT_END_F
-master-bin.000001 14674 Table_map 1 14715 table_id: # (test.t1)
-master-bin.000001 14715 Write_rows 1 14749 table_id: # flags: STMT_END_F
-master-bin.000001 14749 Table_map 1 14790 table_id: # (test.t1)
-master-bin.000001 14790 Write_rows 1 14824 table_id: # flags: STMT_END_F
-master-bin.000001 14824 Table_map 1 14865 table_id: # (test.t1)
-master-bin.000001 14865 Write_rows 1 14899 table_id: # flags: STMT_END_F
-master-bin.000001 14899 Table_map 1 14940 table_id: # (test.t1)
-master-bin.000001 14940 Write_rows 1 14974 table_id: # flags: STMT_END_F
-master-bin.000001 14974 Table_map 1 15015 table_id: # (test.t1)
-master-bin.000001 15015 Write_rows 1 15049 table_id: # flags: STMT_END_F
-master-bin.000001 15049 Table_map 1 15090 table_id: # (test.t1)
-master-bin.000001 15090 Write_rows 1 15124 table_id: # flags: STMT_END_F
-master-bin.000001 15124 Table_map 1 15165 table_id: # (test.t1)
-master-bin.000001 15165 Write_rows 1 15199 table_id: # flags: STMT_END_F
-master-bin.000001 15199 Table_map 1 15240 table_id: # (test.t1)
-master-bin.000001 15240 Write_rows 1 15274 table_id: # flags: STMT_END_F
-master-bin.000001 15274 Table_map 1 15315 table_id: # (test.t1)
-master-bin.000001 15315 Write_rows 1 15349 table_id: # flags: STMT_END_F
-master-bin.000001 15349 Table_map 1 15390 table_id: # (test.t1)
-master-bin.000001 15390 Write_rows 1 15424 table_id: # flags: STMT_END_F
-master-bin.000001 15424 Table_map 1 15465 table_id: # (test.t1)
-master-bin.000001 15465 Write_rows 1 15499 table_id: # flags: STMT_END_F
-master-bin.000001 15499 Table_map 1 15540 table_id: # (test.t1)
-master-bin.000001 15540 Write_rows 1 15574 table_id: # flags: STMT_END_F
-master-bin.000001 15574 Table_map 1 15615 table_id: # (test.t1)
-master-bin.000001 15615 Write_rows 1 15649 table_id: # flags: STMT_END_F
-master-bin.000001 15649 Table_map 1 15690 table_id: # (test.t1)
-master-bin.000001 15690 Write_rows 1 15724 table_id: # flags: STMT_END_F
-master-bin.000001 15724 Table_map 1 15765 table_id: # (test.t1)
-master-bin.000001 15765 Write_rows 1 15799 table_id: # flags: STMT_END_F
-master-bin.000001 15799 Table_map 1 15840 table_id: # (test.t1)
-master-bin.000001 15840 Write_rows 1 15874 table_id: # flags: STMT_END_F
-master-bin.000001 15874 Table_map 1 15915 table_id: # (test.t1)
-master-bin.000001 15915 Write_rows 1 15949 table_id: # flags: STMT_END_F
-master-bin.000001 15949 Table_map 1 15990 table_id: # (test.t1)
-master-bin.000001 15990 Write_rows 1 16024 table_id: # flags: STMT_END_F
-master-bin.000001 16024 Table_map 1 16065 table_id: # (test.t1)
-master-bin.000001 16065 Write_rows 1 16099 table_id: # flags: STMT_END_F
-master-bin.000001 16099 Table_map 1 16140 table_id: # (test.t1)
-master-bin.000001 16140 Write_rows 1 16174 table_id: # flags: STMT_END_F
-master-bin.000001 16174 Table_map 1 16215 table_id: # (test.t1)
-master-bin.000001 16215 Write_rows 1 16249 table_id: # flags: STMT_END_F
-master-bin.000001 16249 Table_map 1 16290 table_id: # (test.t1)
-master-bin.000001 16290 Write_rows 1 16324 table_id: # flags: STMT_END_F
-master-bin.000001 16324 Table_map 1 16365 table_id: # (test.t1)
-master-bin.000001 16365 Write_rows 1 16399 table_id: # flags: STMT_END_F
-master-bin.000001 16399 Table_map 1 16440 table_id: # (test.t1)
-master-bin.000001 16440 Write_rows 1 16474 table_id: # flags: STMT_END_F
-master-bin.000001 16474 Table_map 1 16515 table_id: # (test.t1)
-master-bin.000001 16515 Write_rows 1 16549 table_id: # flags: STMT_END_F
-master-bin.000001 16549 Table_map 1 16590 table_id: # (test.t1)
-master-bin.000001 16590 Write_rows 1 16624 table_id: # flags: STMT_END_F
-master-bin.000001 16624 Table_map 1 16665 table_id: # (test.t1)
-master-bin.000001 16665 Write_rows 1 16699 table_id: # flags: STMT_END_F
-master-bin.000001 16699 Table_map 1 16740 table_id: # (test.t1)
-master-bin.000001 16740 Write_rows 1 16774 table_id: # flags: STMT_END_F
-master-bin.000001 16774 Table_map 1 16815 table_id: # (test.t1)
-master-bin.000001 16815 Write_rows 1 16849 table_id: # flags: STMT_END_F
-master-bin.000001 16849 Table_map 1 16890 table_id: # (test.t1)
-master-bin.000001 16890 Write_rows 1 16924 table_id: # flags: STMT_END_F
-master-bin.000001 16924 Table_map 1 16965 table_id: # (test.t1)
-master-bin.000001 16965 Write_rows 1 16999 table_id: # flags: STMT_END_F
-master-bin.000001 16999 Table_map 1 17040 table_id: # (test.t1)
-master-bin.000001 17040 Write_rows 1 17074 table_id: # flags: STMT_END_F
-master-bin.000001 17074 Table_map 1 17115 table_id: # (test.t1)
-master-bin.000001 17115 Write_rows 1 17149 table_id: # flags: STMT_END_F
-master-bin.000001 17149 Table_map 1 17190 table_id: # (test.t1)
-master-bin.000001 17190 Write_rows 1 17224 table_id: # flags: STMT_END_F
-master-bin.000001 17224 Table_map 1 17265 table_id: # (test.t1)
-master-bin.000001 17265 Write_rows 1 17299 table_id: # flags: STMT_END_F
-master-bin.000001 17299 Table_map 1 17340 table_id: # (test.t1)
-master-bin.000001 17340 Write_rows 1 17374 table_id: # flags: STMT_END_F
-master-bin.000001 17374 Table_map 1 17415 table_id: # (test.t1)
-master-bin.000001 17415 Write_rows 1 17449 table_id: # flags: STMT_END_F
-master-bin.000001 17449 Table_map 1 17490 table_id: # (test.t1)
-master-bin.000001 17490 Write_rows 1 17524 table_id: # flags: STMT_END_F
-master-bin.000001 17524 Table_map 1 17565 table_id: # (test.t1)
-master-bin.000001 17565 Write_rows 1 17599 table_id: # flags: STMT_END_F
-master-bin.000001 17599 Table_map 1 17640 table_id: # (test.t1)
-master-bin.000001 17640 Write_rows 1 17674 table_id: # flags: STMT_END_F
-master-bin.000001 17674 Table_map 1 17715 table_id: # (test.t1)
-master-bin.000001 17715 Write_rows 1 17749 table_id: # flags: STMT_END_F
-master-bin.000001 17749 Table_map 1 17790 table_id: # (test.t1)
-master-bin.000001 17790 Write_rows 1 17824 table_id: # flags: STMT_END_F
-master-bin.000001 17824 Table_map 1 17865 table_id: # (test.t1)
-master-bin.000001 17865 Write_rows 1 17899 table_id: # flags: STMT_END_F
-master-bin.000001 17899 Table_map 1 17940 table_id: # (test.t1)
-master-bin.000001 17940 Write_rows 1 17974 table_id: # flags: STMT_END_F
-master-bin.000001 17974 Table_map 1 18015 table_id: # (test.t1)
-master-bin.000001 18015 Write_rows 1 18049 table_id: # flags: STMT_END_F
-master-bin.000001 18049 Table_map 1 18090 table_id: # (test.t1)
-master-bin.000001 18090 Write_rows 1 18124 table_id: # flags: STMT_END_F
-master-bin.000001 18124 Table_map 1 18165 table_id: # (test.t1)
-master-bin.000001 18165 Write_rows 1 18199 table_id: # flags: STMT_END_F
-master-bin.000001 18199 Table_map 1 18240 table_id: # (test.t1)
-master-bin.000001 18240 Write_rows 1 18274 table_id: # flags: STMT_END_F
-master-bin.000001 18274 Table_map 1 18315 table_id: # (test.t1)
-master-bin.000001 18315 Write_rows 1 18349 table_id: # flags: STMT_END_F
-master-bin.000001 18349 Table_map 1 18390 table_id: # (test.t1)
-master-bin.000001 18390 Write_rows 1 18424 table_id: # flags: STMT_END_F
-master-bin.000001 18424 Table_map 1 18465 table_id: # (test.t1)
-master-bin.000001 18465 Write_rows 1 18499 table_id: # flags: STMT_END_F
-master-bin.000001 18499 Table_map 1 18540 table_id: # (test.t1)
-master-bin.000001 18540 Write_rows 1 18574 table_id: # flags: STMT_END_F
-master-bin.000001 18574 Table_map 1 18615 table_id: # (test.t1)
-master-bin.000001 18615 Write_rows 1 18649 table_id: # flags: STMT_END_F
-master-bin.000001 18649 Table_map 1 18690 table_id: # (test.t1)
-master-bin.000001 18690 Write_rows 1 18724 table_id: # flags: STMT_END_F
-master-bin.000001 18724 Table_map 1 18765 table_id: # (test.t1)
-master-bin.000001 18765 Write_rows 1 18799 table_id: # flags: STMT_END_F
-master-bin.000001 18799 Table_map 1 18840 table_id: # (test.t1)
-master-bin.000001 18840 Write_rows 1 18874 table_id: # flags: STMT_END_F
-master-bin.000001 18874 Table_map 1 18915 table_id: # (test.t1)
-master-bin.000001 18915 Write_rows 1 18949 table_id: # flags: STMT_END_F
-master-bin.000001 18949 Table_map 1 18990 table_id: # (test.t1)
-master-bin.000001 18990 Write_rows 1 19024 table_id: # flags: STMT_END_F
-master-bin.000001 19024 Table_map 1 19065 table_id: # (test.t1)
-master-bin.000001 19065 Write_rows 1 19099 table_id: # flags: STMT_END_F
-master-bin.000001 19099 Table_map 1 19140 table_id: # (test.t1)
-master-bin.000001 19140 Write_rows 1 19174 table_id: # flags: STMT_END_F
-master-bin.000001 19174 Table_map 1 19215 table_id: # (test.t1)
-master-bin.000001 19215 Write_rows 1 19249 table_id: # flags: STMT_END_F
-master-bin.000001 19249 Table_map 1 19290 table_id: # (test.t1)
-master-bin.000001 19290 Write_rows 1 19324 table_id: # flags: STMT_END_F
-master-bin.000001 19324 Table_map 1 19365 table_id: # (test.t1)
-master-bin.000001 19365 Write_rows 1 19399 table_id: # flags: STMT_END_F
-master-bin.000001 19399 Table_map 1 19440 table_id: # (test.t1)
-master-bin.000001 19440 Write_rows 1 19474 table_id: # flags: STMT_END_F
-master-bin.000001 19474 Table_map 1 19515 table_id: # (test.t1)
-master-bin.000001 19515 Write_rows 1 19549 table_id: # flags: STMT_END_F
-master-bin.000001 19549 Table_map 1 19590 table_id: # (test.t1)
-master-bin.000001 19590 Write_rows 1 19624 table_id: # flags: STMT_END_F
-master-bin.000001 19624 Table_map 1 19665 table_id: # (test.t1)
-master-bin.000001 19665 Write_rows 1 19699 table_id: # flags: STMT_END_F
-master-bin.000001 19699 Table_map 1 19740 table_id: # (test.t1)
-master-bin.000001 19740 Write_rows 1 19774 table_id: # flags: STMT_END_F
-master-bin.000001 19774 Table_map 1 19815 table_id: # (test.t1)
-master-bin.000001 19815 Write_rows 1 19849 table_id: # flags: STMT_END_F
-master-bin.000001 19849 Table_map 1 19890 table_id: # (test.t1)
-master-bin.000001 19890 Write_rows 1 19924 table_id: # flags: STMT_END_F
-master-bin.000001 19924 Table_map 1 19965 table_id: # (test.t1)
-master-bin.000001 19965 Write_rows 1 19999 table_id: # flags: STMT_END_F
-master-bin.000001 19999 Table_map 1 20040 table_id: # (test.t1)
-master-bin.000001 20040 Write_rows 1 20074 table_id: # flags: STMT_END_F
-master-bin.000001 20074 Table_map 1 20115 table_id: # (test.t1)
-master-bin.000001 20115 Write_rows 1 20149 table_id: # flags: STMT_END_F
-master-bin.000001 20149 Table_map 1 20190 table_id: # (test.t1)
-master-bin.000001 20190 Write_rows 1 20224 table_id: # flags: STMT_END_F
-master-bin.000001 20224 Table_map 1 20265 table_id: # (test.t1)
-master-bin.000001 20265 Write_rows 1 20299 table_id: # flags: STMT_END_F
-master-bin.000001 20299 Table_map 1 20340 table_id: # (test.t1)
-master-bin.000001 20340 Write_rows 1 20374 table_id: # flags: STMT_END_F
-master-bin.000001 20374 Table_map 1 20415 table_id: # (test.t1)
-master-bin.000001 20415 Write_rows 1 20449 table_id: # flags: STMT_END_F
-master-bin.000001 20449 Table_map 1 20490 table_id: # (test.t1)
-master-bin.000001 20490 Write_rows 1 20524 table_id: # flags: STMT_END_F
-master-bin.000001 20524 Table_map 1 20565 table_id: # (test.t1)
-master-bin.000001 20565 Write_rows 1 20599 table_id: # flags: STMT_END_F
-master-bin.000001 20599 Table_map 1 20640 table_id: # (test.t1)
-master-bin.000001 20640 Write_rows 1 20674 table_id: # flags: STMT_END_F
-master-bin.000001 20674 Table_map 1 20715 table_id: # (test.t1)
-master-bin.000001 20715 Write_rows 1 20749 table_id: # flags: STMT_END_F
-master-bin.000001 20749 Table_map 1 20790 table_id: # (test.t1)
-master-bin.000001 20790 Write_rows 1 20824 table_id: # flags: STMT_END_F
-master-bin.000001 20824 Table_map 1 20865 table_id: # (test.t1)
-master-bin.000001 20865 Write_rows 1 20899 table_id: # flags: STMT_END_F
-master-bin.000001 20899 Table_map 1 20940 table_id: # (test.t1)
-master-bin.000001 20940 Write_rows 1 20974 table_id: # flags: STMT_END_F
-master-bin.000001 20974 Table_map 1 21015 table_id: # (test.t1)
-master-bin.000001 21015 Write_rows 1 21049 table_id: # flags: STMT_END_F
-master-bin.000001 21049 Table_map 1 21090 table_id: # (test.t1)
-master-bin.000001 21090 Write_rows 1 21124 table_id: # flags: STMT_END_F
-master-bin.000001 21124 Table_map 1 21165 table_id: # (test.t1)
-master-bin.000001 21165 Write_rows 1 21199 table_id: # flags: STMT_END_F
-master-bin.000001 21199 Table_map 1 21240 table_id: # (test.t1)
-master-bin.000001 21240 Write_rows 1 21274 table_id: # flags: STMT_END_F
-master-bin.000001 21274 Table_map 1 21315 table_id: # (test.t1)
-master-bin.000001 21315 Write_rows 1 21349 table_id: # flags: STMT_END_F
-master-bin.000001 21349 Table_map 1 21390 table_id: # (test.t1)
-master-bin.000001 21390 Write_rows 1 21424 table_id: # flags: STMT_END_F
-master-bin.000001 21424 Table_map 1 21465 table_id: # (test.t1)
-master-bin.000001 21465 Write_rows 1 21499 table_id: # flags: STMT_END_F
-master-bin.000001 21499 Table_map 1 21540 table_id: # (test.t1)
-master-bin.000001 21540 Write_rows 1 21574 table_id: # flags: STMT_END_F
-master-bin.000001 21574 Table_map 1 21615 table_id: # (test.t1)
-master-bin.000001 21615 Write_rows 1 21649 table_id: # flags: STMT_END_F
-master-bin.000001 21649 Table_map 1 21690 table_id: # (test.t1)
-master-bin.000001 21690 Write_rows 1 21724 table_id: # flags: STMT_END_F
-master-bin.000001 21724 Table_map 1 21765 table_id: # (test.t1)
-master-bin.000001 21765 Write_rows 1 21799 table_id: # flags: STMT_END_F
-master-bin.000001 21799 Table_map 1 21840 table_id: # (test.t1)
-master-bin.000001 21840 Write_rows 1 21874 table_id: # flags: STMT_END_F
-master-bin.000001 21874 Table_map 1 21915 table_id: # (test.t1)
-master-bin.000001 21915 Write_rows 1 21949 table_id: # flags: STMT_END_F
-master-bin.000001 21949 Table_map 1 21990 table_id: # (test.t1)
-master-bin.000001 21990 Write_rows 1 22024 table_id: # flags: STMT_END_F
-master-bin.000001 22024 Table_map 1 22065 table_id: # (test.t1)
-master-bin.000001 22065 Write_rows 1 22099 table_id: # flags: STMT_END_F
-master-bin.000001 22099 Table_map 1 22140 table_id: # (test.t1)
-master-bin.000001 22140 Write_rows 1 22174 table_id: # flags: STMT_END_F
-master-bin.000001 22174 Table_map 1 22215 table_id: # (test.t1)
-master-bin.000001 22215 Write_rows 1 22249 table_id: # flags: STMT_END_F
-master-bin.000001 22249 Table_map 1 22290 table_id: # (test.t1)
-master-bin.000001 22290 Write_rows 1 22324 table_id: # flags: STMT_END_F
-master-bin.000001 22324 Table_map 1 22365 table_id: # (test.t1)
-master-bin.000001 22365 Write_rows 1 22399 table_id: # flags: STMT_END_F
-master-bin.000001 22399 Table_map 1 22440 table_id: # (test.t1)
-master-bin.000001 22440 Write_rows 1 22474 table_id: # flags: STMT_END_F
-master-bin.000001 22474 Table_map 1 22515 table_id: # (test.t1)
-master-bin.000001 22515 Write_rows 1 22549 table_id: # flags: STMT_END_F
-master-bin.000001 22549 Table_map 1 22590 table_id: # (test.t1)
-master-bin.000001 22590 Write_rows 1 22624 table_id: # flags: STMT_END_F
-master-bin.000001 22624 Table_map 1 22665 table_id: # (test.t1)
-master-bin.000001 22665 Write_rows 1 22699 table_id: # flags: STMT_END_F
-master-bin.000001 22699 Table_map 1 22740 table_id: # (test.t1)
-master-bin.000001 22740 Write_rows 1 22774 table_id: # flags: STMT_END_F
-master-bin.000001 22774 Table_map 1 22815 table_id: # (test.t1)
-master-bin.000001 22815 Write_rows 1 22849 table_id: # flags: STMT_END_F
-master-bin.000001 22849 Table_map 1 22890 table_id: # (test.t1)
-master-bin.000001 22890 Write_rows 1 22924 table_id: # flags: STMT_END_F
-master-bin.000001 22924 Table_map 1 22965 table_id: # (test.t1)
-master-bin.000001 22965 Write_rows 1 22999 table_id: # flags: STMT_END_F
-master-bin.000001 22999 Table_map 1 23040 table_id: # (test.t1)
-master-bin.000001 23040 Write_rows 1 23074 table_id: # flags: STMT_END_F
-master-bin.000001 23074 Table_map 1 23115 table_id: # (test.t1)
-master-bin.000001 23115 Write_rows 1 23149 table_id: # flags: STMT_END_F
-master-bin.000001 23149 Table_map 1 23190 table_id: # (test.t1)
-master-bin.000001 23190 Write_rows 1 23224 table_id: # flags: STMT_END_F
-master-bin.000001 23224 Table_map 1 23265 table_id: # (test.t1)
-master-bin.000001 23265 Write_rows 1 23299 table_id: # flags: STMT_END_F
-master-bin.000001 23299 Table_map 1 23340 table_id: # (test.t1)
-master-bin.000001 23340 Write_rows 1 23374 table_id: # flags: STMT_END_F
-master-bin.000001 23374 Table_map 1 23415 table_id: # (test.t1)
-master-bin.000001 23415 Write_rows 1 23449 table_id: # flags: STMT_END_F
-master-bin.000001 23449 Table_map 1 23490 table_id: # (test.t1)
-master-bin.000001 23490 Write_rows 1 23524 table_id: # flags: STMT_END_F
-master-bin.000001 23524 Table_map 1 23565 table_id: # (test.t1)
-master-bin.000001 23565 Write_rows 1 23599 table_id: # flags: STMT_END_F
-master-bin.000001 23599 Table_map 1 23640 table_id: # (test.t1)
-master-bin.000001 23640 Write_rows 1 23674 table_id: # flags: STMT_END_F
-master-bin.000001 23674 Table_map 1 23715 table_id: # (test.t1)
-master-bin.000001 23715 Write_rows 1 23749 table_id: # flags: STMT_END_F
-master-bin.000001 23749 Table_map 1 23790 table_id: # (test.t1)
-master-bin.000001 23790 Write_rows 1 23824 table_id: # flags: STMT_END_F
-master-bin.000001 23824 Table_map 1 23865 table_id: # (test.t1)
-master-bin.000001 23865 Write_rows 1 23899 table_id: # flags: STMT_END_F
-master-bin.000001 23899 Table_map 1 23940 table_id: # (test.t1)
-master-bin.000001 23940 Write_rows 1 23974 table_id: # flags: STMT_END_F
-master-bin.000001 23974 Table_map 1 24015 table_id: # (test.t1)
-master-bin.000001 24015 Write_rows 1 24049 table_id: # flags: STMT_END_F
-master-bin.000001 24049 Table_map 1 24090 table_id: # (test.t1)
-master-bin.000001 24090 Write_rows 1 24124 table_id: # flags: STMT_END_F
-master-bin.000001 24124 Table_map 1 24165 table_id: # (test.t1)
-master-bin.000001 24165 Write_rows 1 24199 table_id: # flags: STMT_END_F
-master-bin.000001 24199 Table_map 1 24240 table_id: # (test.t1)
-master-bin.000001 24240 Write_rows 1 24274 table_id: # flags: STMT_END_F
-master-bin.000001 24274 Table_map 1 24315 table_id: # (test.t1)
-master-bin.000001 24315 Write_rows 1 24349 table_id: # flags: STMT_END_F
-master-bin.000001 24349 Table_map 1 24390 table_id: # (test.t1)
-master-bin.000001 24390 Write_rows 1 24424 table_id: # flags: STMT_END_F
-master-bin.000001 24424 Table_map 1 24465 table_id: # (test.t1)
-master-bin.000001 24465 Write_rows 1 24499 table_id: # flags: STMT_END_F
-master-bin.000001 24499 Table_map 1 24540 table_id: # (test.t1)
-master-bin.000001 24540 Write_rows 1 24574 table_id: # flags: STMT_END_F
-master-bin.000001 24574 Table_map 1 24615 table_id: # (test.t1)
-master-bin.000001 24615 Write_rows 1 24649 table_id: # flags: STMT_END_F
-master-bin.000001 24649 Table_map 1 24690 table_id: # (test.t1)
-master-bin.000001 24690 Write_rows 1 24724 table_id: # flags: STMT_END_F
-master-bin.000001 24724 Table_map 1 24765 table_id: # (test.t1)
-master-bin.000001 24765 Write_rows 1 24799 table_id: # flags: STMT_END_F
-master-bin.000001 24799 Table_map 1 24840 table_id: # (test.t1)
-master-bin.000001 24840 Write_rows 1 24874 table_id: # flags: STMT_END_F
-master-bin.000001 24874 Table_map 1 24915 table_id: # (test.t1)
-master-bin.000001 24915 Write_rows 1 24949 table_id: # flags: STMT_END_F
-master-bin.000001 24949 Table_map 1 24990 table_id: # (test.t1)
-master-bin.000001 24990 Write_rows 1 25024 table_id: # flags: STMT_END_F
-master-bin.000001 25024 Table_map 1 25065 table_id: # (test.t1)
-master-bin.000001 25065 Write_rows 1 25099 table_id: # flags: STMT_END_F
-master-bin.000001 25099 Table_map 1 25140 table_id: # (test.t1)
-master-bin.000001 25140 Write_rows 1 25174 table_id: # flags: STMT_END_F
-master-bin.000001 25174 Table_map 1 25215 table_id: # (test.t1)
-master-bin.000001 25215 Write_rows 1 25249 table_id: # flags: STMT_END_F
-master-bin.000001 25249 Table_map 1 25290 table_id: # (test.t1)
-master-bin.000001 25290 Write_rows 1 25324 table_id: # flags: STMT_END_F
-master-bin.000001 25324 Table_map 1 25365 table_id: # (test.t1)
-master-bin.000001 25365 Write_rows 1 25399 table_id: # flags: STMT_END_F
-master-bin.000001 25399 Table_map 1 25440 table_id: # (test.t1)
-master-bin.000001 25440 Write_rows 1 25474 table_id: # flags: STMT_END_F
-master-bin.000001 25474 Table_map 1 25515 table_id: # (test.t1)
-master-bin.000001 25515 Write_rows 1 25549 table_id: # flags: STMT_END_F
-master-bin.000001 25549 Table_map 1 25590 table_id: # (test.t1)
-master-bin.000001 25590 Write_rows 1 25624 table_id: # flags: STMT_END_F
-master-bin.000001 25624 Table_map 1 25665 table_id: # (test.t1)
-master-bin.000001 25665 Write_rows 1 25699 table_id: # flags: STMT_END_F
-master-bin.000001 25699 Table_map 1 25740 table_id: # (test.t1)
-master-bin.000001 25740 Write_rows 1 25774 table_id: # flags: STMT_END_F
-master-bin.000001 25774 Table_map 1 25815 table_id: # (test.t1)
-master-bin.000001 25815 Write_rows 1 25849 table_id: # flags: STMT_END_F
-master-bin.000001 25849 Table_map 1 25890 table_id: # (test.t1)
-master-bin.000001 25890 Write_rows 1 25924 table_id: # flags: STMT_END_F
-master-bin.000001 25924 Table_map 1 25965 table_id: # (test.t1)
-master-bin.000001 25965 Write_rows 1 25999 table_id: # flags: STMT_END_F
-master-bin.000001 25999 Table_map 1 26040 table_id: # (test.t1)
-master-bin.000001 26040 Write_rows 1 26074 table_id: # flags: STMT_END_F
-master-bin.000001 26074 Table_map 1 26115 table_id: # (test.t1)
-master-bin.000001 26115 Write_rows 1 26149 table_id: # flags: STMT_END_F
-master-bin.000001 26149 Table_map 1 26190 table_id: # (test.t1)
-master-bin.000001 26190 Write_rows 1 26224 table_id: # flags: STMT_END_F
-master-bin.000001 26224 Table_map 1 26265 table_id: # (test.t1)
-master-bin.000001 26265 Write_rows 1 26299 table_id: # flags: STMT_END_F
-master-bin.000001 26299 Table_map 1 26340 table_id: # (test.t1)
-master-bin.000001 26340 Write_rows 1 26374 table_id: # flags: STMT_END_F
-master-bin.000001 26374 Table_map 1 26415 table_id: # (test.t1)
-master-bin.000001 26415 Write_rows 1 26449 table_id: # flags: STMT_END_F
-master-bin.000001 26449 Table_map 1 26490 table_id: # (test.t1)
-master-bin.000001 26490 Write_rows 1 26524 table_id: # flags: STMT_END_F
-master-bin.000001 26524 Table_map 1 26565 table_id: # (test.t1)
-master-bin.000001 26565 Write_rows 1 26599 table_id: # flags: STMT_END_F
-master-bin.000001 26599 Table_map 1 26640 table_id: # (test.t1)
-master-bin.000001 26640 Write_rows 1 26674 table_id: # flags: STMT_END_F
-master-bin.000001 26674 Table_map 1 26715 table_id: # (test.t1)
-master-bin.000001 26715 Write_rows 1 26749 table_id: # flags: STMT_END_F
-master-bin.000001 26749 Table_map 1 26790 table_id: # (test.t1)
-master-bin.000001 26790 Write_rows 1 26824 table_id: # flags: STMT_END_F
-master-bin.000001 26824 Table_map 1 26865 table_id: # (test.t1)
-master-bin.000001 26865 Write_rows 1 26899 table_id: # flags: STMT_END_F
-master-bin.000001 26899 Table_map 1 26940 table_id: # (test.t1)
-master-bin.000001 26940 Write_rows 1 26974 table_id: # flags: STMT_END_F
-master-bin.000001 26974 Table_map 1 27015 table_id: # (test.t1)
-master-bin.000001 27015 Write_rows 1 27049 table_id: # flags: STMT_END_F
-master-bin.000001 27049 Table_map 1 27090 table_id: # (test.t1)
-master-bin.000001 27090 Write_rows 1 27124 table_id: # flags: STMT_END_F
-master-bin.000001 27124 Table_map 1 27165 table_id: # (test.t1)
-master-bin.000001 27165 Write_rows 1 27199 table_id: # flags: STMT_END_F
-master-bin.000001 27199 Table_map 1 27240 table_id: # (test.t1)
-master-bin.000001 27240 Write_rows 1 27274 table_id: # flags: STMT_END_F
-master-bin.000001 27274 Table_map 1 27315 table_id: # (test.t1)
-master-bin.000001 27315 Write_rows 1 27349 table_id: # flags: STMT_END_F
-master-bin.000001 27349 Table_map 1 27390 table_id: # (test.t1)
-master-bin.000001 27390 Write_rows 1 27424 table_id: # flags: STMT_END_F
-master-bin.000001 27424 Table_map 1 27465 table_id: # (test.t1)
-master-bin.000001 27465 Write_rows 1 27499 table_id: # flags: STMT_END_F
-master-bin.000001 27499 Table_map 1 27540 table_id: # (test.t1)
-master-bin.000001 27540 Write_rows 1 27574 table_id: # flags: STMT_END_F
-master-bin.000001 27574 Table_map 1 27615 table_id: # (test.t1)
-master-bin.000001 27615 Write_rows 1 27649 table_id: # flags: STMT_END_F
-master-bin.000001 27649 Table_map 1 27690 table_id: # (test.t1)
-master-bin.000001 27690 Write_rows 1 27724 table_id: # flags: STMT_END_F
-master-bin.000001 27724 Table_map 1 27765 table_id: # (test.t1)
-master-bin.000001 27765 Write_rows 1 27799 table_id: # flags: STMT_END_F
-master-bin.000001 27799 Table_map 1 27840 table_id: # (test.t1)
-master-bin.000001 27840 Write_rows 1 27874 table_id: # flags: STMT_END_F
-master-bin.000001 27874 Table_map 1 27915 table_id: # (test.t1)
-master-bin.000001 27915 Write_rows 1 27949 table_id: # flags: STMT_END_F
-master-bin.000001 27949 Table_map 1 27990 table_id: # (test.t1)
-master-bin.000001 27990 Write_rows 1 28024 table_id: # flags: STMT_END_F
-master-bin.000001 28024 Table_map 1 28065 table_id: # (test.t1)
-master-bin.000001 28065 Write_rows 1 28099 table_id: # flags: STMT_END_F
-master-bin.000001 28099 Table_map 1 28140 table_id: # (test.t1)
-master-bin.000001 28140 Write_rows 1 28174 table_id: # flags: STMT_END_F
-master-bin.000001 28174 Table_map 1 28215 table_id: # (test.t1)
-master-bin.000001 28215 Write_rows 1 28249 table_id: # flags: STMT_END_F
-master-bin.000001 28249 Table_map 1 28290 table_id: # (test.t1)
-master-bin.000001 28290 Write_rows 1 28324 table_id: # flags: STMT_END_F
-master-bin.000001 28324 Table_map 1 28365 table_id: # (test.t1)
-master-bin.000001 28365 Write_rows 1 28399 table_id: # flags: STMT_END_F
-master-bin.000001 28399 Table_map 1 28440 table_id: # (test.t1)
-master-bin.000001 28440 Write_rows 1 28474 table_id: # flags: STMT_END_F
-master-bin.000001 28474 Table_map 1 28515 table_id: # (test.t1)
-master-bin.000001 28515 Write_rows 1 28549 table_id: # flags: STMT_END_F
-master-bin.000001 28549 Table_map 1 28590 table_id: # (test.t1)
-master-bin.000001 28590 Write_rows 1 28624 table_id: # flags: STMT_END_F
-master-bin.000001 28624 Table_map 1 28665 table_id: # (test.t1)
-master-bin.000001 28665 Write_rows 1 28699 table_id: # flags: STMT_END_F
-master-bin.000001 28699 Table_map 1 28740 table_id: # (test.t1)
-master-bin.000001 28740 Write_rows 1 28774 table_id: # flags: STMT_END_F
-master-bin.000001 28774 Table_map 1 28815 table_id: # (test.t1)
-master-bin.000001 28815 Write_rows 1 28849 table_id: # flags: STMT_END_F
-master-bin.000001 28849 Table_map 1 28890 table_id: # (test.t1)
-master-bin.000001 28890 Write_rows 1 28924 table_id: # flags: STMT_END_F
-master-bin.000001 28924 Table_map 1 28965 table_id: # (test.t1)
-master-bin.000001 28965 Write_rows 1 28999 table_id: # flags: STMT_END_F
-master-bin.000001 28999 Table_map 1 29040 table_id: # (test.t1)
-master-bin.000001 29040 Write_rows 1 29074 table_id: # flags: STMT_END_F
-master-bin.000001 29074 Table_map 1 29115 table_id: # (test.t1)
-master-bin.000001 29115 Write_rows 1 29149 table_id: # flags: STMT_END_F
-master-bin.000001 29149 Table_map 1 29190 table_id: # (test.t1)
-master-bin.000001 29190 Write_rows 1 29224 table_id: # flags: STMT_END_F
-master-bin.000001 29224 Table_map 1 29265 table_id: # (test.t1)
-master-bin.000001 29265 Write_rows 1 29299 table_id: # flags: STMT_END_F
-master-bin.000001 29299 Table_map 1 29340 table_id: # (test.t1)
-master-bin.000001 29340 Write_rows 1 29374 table_id: # flags: STMT_END_F
-master-bin.000001 29374 Table_map 1 29415 table_id: # (test.t1)
-master-bin.000001 29415 Write_rows 1 29449 table_id: # flags: STMT_END_F
-master-bin.000001 29449 Table_map 1 29490 table_id: # (test.t1)
-master-bin.000001 29490 Write_rows 1 29524 table_id: # flags: STMT_END_F
-master-bin.000001 29524 Table_map 1 29565 table_id: # (test.t1)
-master-bin.000001 29565 Write_rows 1 29599 table_id: # flags: STMT_END_F
-master-bin.000001 29599 Table_map 1 29640 table_id: # (test.t1)
-master-bin.000001 29640 Write_rows 1 29674 table_id: # flags: STMT_END_F
-master-bin.000001 29674 Table_map 1 29715 table_id: # (test.t1)
-master-bin.000001 29715 Write_rows 1 29749 table_id: # flags: STMT_END_F
-master-bin.000001 29749 Table_map 1 29790 table_id: # (test.t1)
-master-bin.000001 29790 Write_rows 1 29824 table_id: # flags: STMT_END_F
-master-bin.000001 29824 Table_map 1 29865 table_id: # (test.t1)
-master-bin.000001 29865 Write_rows 1 29899 table_id: # flags: STMT_END_F
-master-bin.000001 29899 Table_map 1 29940 table_id: # (test.t1)
-master-bin.000001 29940 Write_rows 1 29974 table_id: # flags: STMT_END_F
-master-bin.000001 29974 Table_map 1 30015 table_id: # (test.t1)
-master-bin.000001 30015 Write_rows 1 30049 table_id: # flags: STMT_END_F
-master-bin.000001 30049 Table_map 1 30090 table_id: # (test.t1)
-master-bin.000001 30090 Write_rows 1 30124 table_id: # flags: STMT_END_F
-master-bin.000001 30124 Table_map 1 30165 table_id: # (test.t1)
-master-bin.000001 30165 Write_rows 1 30199 table_id: # flags: STMT_END_F
-master-bin.000001 30199 Table_map 1 30240 table_id: # (test.t1)
-master-bin.000001 30240 Write_rows 1 30274 table_id: # flags: STMT_END_F
-master-bin.000001 30274 Xid 1 30301 COMMIT /* XID */
-master-bin.000001 30301 Rotate 1 30345 master-bin.000002;pos=4
+master-bin.000001 499 Xid 1 526 COMMIT /* XID */
+master-bin.000001 526 Query 1 602 use `test`; drop table t1
+set @bcs = @@binlog_cache_size;
+set global binlog_cache_size=4096;
+reset master;
+create table t1 (a int) engine=innodb;
+show binlog events from 0;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4
+master-bin.000001 107 Query 1 207 use `test`; create table t1 (a int) engine=innodb
+master-bin.000001 207 Query 1 275 BEGIN
+master-bin.000001 275 Table_map 1 316 table_id: # (test.t1)
+master-bin.000001 316 Write_rows 1 350 table_id: # flags: STMT_END_F
+master-bin.000001 350 Table_map 1 391 table_id: # (test.t1)
+master-bin.000001 391 Write_rows 1 425 table_id: # flags: STMT_END_F
+master-bin.000001 425 Table_map 1 466 table_id: # (test.t1)
+master-bin.000001 466 Write_rows 1 500 table_id: # flags: STMT_END_F
+master-bin.000001 500 Table_map 1 541 table_id: # (test.t1)
+master-bin.000001 541 Write_rows 1 575 table_id: # flags: STMT_END_F
+master-bin.000001 575 Table_map 1 616 table_id: # (test.t1)
+master-bin.000001 616 Write_rows 1 650 table_id: # flags: STMT_END_F
+master-bin.000001 650 Table_map 1 691 table_id: # (test.t1)
+master-bin.000001 691 Write_rows 1 725 table_id: # flags: STMT_END_F
+master-bin.000001 725 Table_map 1 766 table_id: # (test.t1)
+master-bin.000001 766 Write_rows 1 800 table_id: # flags: STMT_END_F
+master-bin.000001 800 Table_map 1 841 table_id: # (test.t1)
+master-bin.000001 841 Write_rows 1 875 table_id: # flags: STMT_END_F
+master-bin.000001 875 Table_map 1 916 table_id: # (test.t1)
+master-bin.000001 916 Write_rows 1 950 table_id: # flags: STMT_END_F
+master-bin.000001 950 Table_map 1 991 table_id: # (test.t1)
+master-bin.000001 991 Write_rows 1 1025 table_id: # flags: STMT_END_F
+master-bin.000001 1025 Table_map 1 1066 table_id: # (test.t1)
+master-bin.000001 1066 Write_rows 1 1100 table_id: # flags: STMT_END_F
+master-bin.000001 1100 Table_map 1 1141 table_id: # (test.t1)
+master-bin.000001 1141 Write_rows 1 1175 table_id: # flags: STMT_END_F
+master-bin.000001 1175 Table_map 1 1216 table_id: # (test.t1)
+master-bin.000001 1216 Write_rows 1 1250 table_id: # flags: STMT_END_F
+master-bin.000001 1250 Table_map 1 1291 table_id: # (test.t1)
+master-bin.000001 1291 Write_rows 1 1325 table_id: # flags: STMT_END_F
+master-bin.000001 1325 Table_map 1 1366 table_id: # (test.t1)
+master-bin.000001 1366 Write_rows 1 1400 table_id: # flags: STMT_END_F
+master-bin.000001 1400 Table_map 1 1441 table_id: # (test.t1)
+master-bin.000001 1441 Write_rows 1 1475 table_id: # flags: STMT_END_F
+master-bin.000001 1475 Table_map 1 1516 table_id: # (test.t1)
+master-bin.000001 1516 Write_rows 1 1550 table_id: # flags: STMT_END_F
+master-bin.000001 1550 Table_map 1 1591 table_id: # (test.t1)
+master-bin.000001 1591 Write_rows 1 1625 table_id: # flags: STMT_END_F
+master-bin.000001 1625 Table_map 1 1666 table_id: # (test.t1)
+master-bin.000001 1666 Write_rows 1 1700 table_id: # flags: STMT_END_F
+master-bin.000001 1700 Table_map 1 1741 table_id: # (test.t1)
+master-bin.000001 1741 Write_rows 1 1775 table_id: # flags: STMT_END_F
+master-bin.000001 1775 Table_map 1 1816 table_id: # (test.t1)
+master-bin.000001 1816 Write_rows 1 1850 table_id: # flags: STMT_END_F
+master-bin.000001 1850 Table_map 1 1891 table_id: # (test.t1)
+master-bin.000001 1891 Write_rows 1 1925 table_id: # flags: STMT_END_F
+master-bin.000001 1925 Table_map 1 1966 table_id: # (test.t1)
+master-bin.000001 1966 Write_rows 1 2000 table_id: # flags: STMT_END_F
+master-bin.000001 2000 Table_map 1 2041 table_id: # (test.t1)
+master-bin.000001 2041 Write_rows 1 2075 table_id: # flags: STMT_END_F
+master-bin.000001 2075 Table_map 1 2116 table_id: # (test.t1)
+master-bin.000001 2116 Write_rows 1 2150 table_id: # flags: STMT_END_F
+master-bin.000001 2150 Table_map 1 2191 table_id: # (test.t1)
+master-bin.000001 2191 Write_rows 1 2225 table_id: # flags: STMT_END_F
+master-bin.000001 2225 Table_map 1 2266 table_id: # (test.t1)
+master-bin.000001 2266 Write_rows 1 2300 table_id: # flags: STMT_END_F
+master-bin.000001 2300 Table_map 1 2341 table_id: # (test.t1)
+master-bin.000001 2341 Write_rows 1 2375 table_id: # flags: STMT_END_F
+master-bin.000001 2375 Table_map 1 2416 table_id: # (test.t1)
+master-bin.000001 2416 Write_rows 1 2450 table_id: # flags: STMT_END_F
+master-bin.000001 2450 Table_map 1 2491 table_id: # (test.t1)
+master-bin.000001 2491 Write_rows 1 2525 table_id: # flags: STMT_END_F
+master-bin.000001 2525 Table_map 1 2566 table_id: # (test.t1)
+master-bin.000001 2566 Write_rows 1 2600 table_id: # flags: STMT_END_F
+master-bin.000001 2600 Table_map 1 2641 table_id: # (test.t1)
+master-bin.000001 2641 Write_rows 1 2675 table_id: # flags: STMT_END_F
+master-bin.000001 2675 Table_map 1 2716 table_id: # (test.t1)
+master-bin.000001 2716 Write_rows 1 2750 table_id: # flags: STMT_END_F
+master-bin.000001 2750 Table_map 1 2791 table_id: # (test.t1)
+master-bin.000001 2791 Write_rows 1 2825 table_id: # flags: STMT_END_F
+master-bin.000001 2825 Table_map 1 2866 table_id: # (test.t1)
+master-bin.000001 2866 Write_rows 1 2900 table_id: # flags: STMT_END_F
+master-bin.000001 2900 Table_map 1 2941 table_id: # (test.t1)
+master-bin.000001 2941 Write_rows 1 2975 table_id: # flags: STMT_END_F
+master-bin.000001 2975 Table_map 1 3016 table_id: # (test.t1)
+master-bin.000001 3016 Write_rows 1 3050 table_id: # flags: STMT_END_F
+master-bin.000001 3050 Table_map 1 3091 table_id: # (test.t1)
+master-bin.000001 3091 Write_rows 1 3125 table_id: # flags: STMT_END_F
+master-bin.000001 3125 Table_map 1 3166 table_id: # (test.t1)
+master-bin.000001 3166 Write_rows 1 3200 table_id: # flags: STMT_END_F
+master-bin.000001 3200 Table_map 1 3241 table_id: # (test.t1)
+master-bin.000001 3241 Write_rows 1 3275 table_id: # flags: STMT_END_F
+master-bin.000001 3275 Table_map 1 3316 table_id: # (test.t1)
+master-bin.000001 3316 Write_rows 1 3350 table_id: # flags: STMT_END_F
+master-bin.000001 3350 Table_map 1 3391 table_id: # (test.t1)
+master-bin.000001 3391 Write_rows 1 3425 table_id: # flags: STMT_END_F
+master-bin.000001 3425 Table_map 1 3466 table_id: # (test.t1)
+master-bin.000001 3466 Write_rows 1 3500 table_id: # flags: STMT_END_F
+master-bin.000001 3500 Table_map 1 3541 table_id: # (test.t1)
+master-bin.000001 3541 Write_rows 1 3575 table_id: # flags: STMT_END_F
+master-bin.000001 3575 Table_map 1 3616 table_id: # (test.t1)
+master-bin.000001 3616 Write_rows 1 3650 table_id: # flags: STMT_END_F
+master-bin.000001 3650 Table_map 1 3691 table_id: # (test.t1)
+master-bin.000001 3691 Write_rows 1 3725 table_id: # flags: STMT_END_F
+master-bin.000001 3725 Table_map 1 3766 table_id: # (test.t1)
+master-bin.000001 3766 Write_rows 1 3800 table_id: # flags: STMT_END_F
+master-bin.000001 3800 Table_map 1 3841 table_id: # (test.t1)
+master-bin.000001 3841 Write_rows 1 3875 table_id: # flags: STMT_END_F
+master-bin.000001 3875 Table_map 1 3916 table_id: # (test.t1)
+master-bin.000001 3916 Write_rows 1 3950 table_id: # flags: STMT_END_F
+master-bin.000001 3950 Table_map 1 3991 table_id: # (test.t1)
+master-bin.000001 3991 Write_rows 1 4025 table_id: # flags: STMT_END_F
+master-bin.000001 4025 Table_map 1 4066 table_id: # (test.t1)
+master-bin.000001 4066 Write_rows 1 4100 table_id: # flags: STMT_END_F
+master-bin.000001 4100 Table_map 1 4141 table_id: # (test.t1)
+master-bin.000001 4141 Write_rows 1 4175 table_id: # flags: STMT_END_F
+master-bin.000001 4175 Table_map 1 4216 table_id: # (test.t1)
+master-bin.000001 4216 Write_rows 1 4250 table_id: # flags: STMT_END_F
+master-bin.000001 4250 Table_map 1 4291 table_id: # (test.t1)
+master-bin.000001 4291 Write_rows 1 4325 table_id: # flags: STMT_END_F
+master-bin.000001 4325 Table_map 1 4366 table_id: # (test.t1)
+master-bin.000001 4366 Write_rows 1 4400 table_id: # flags: STMT_END_F
+master-bin.000001 4400 Table_map 1 4441 table_id: # (test.t1)
+master-bin.000001 4441 Write_rows 1 4475 table_id: # flags: STMT_END_F
+master-bin.000001 4475 Table_map 1 4516 table_id: # (test.t1)
+master-bin.000001 4516 Write_rows 1 4550 table_id: # flags: STMT_END_F
+master-bin.000001 4550 Table_map 1 4591 table_id: # (test.t1)
+master-bin.000001 4591 Write_rows 1 4625 table_id: # flags: STMT_END_F
+master-bin.000001 4625 Table_map 1 4666 table_id: # (test.t1)
+master-bin.000001 4666 Write_rows 1 4700 table_id: # flags: STMT_END_F
+master-bin.000001 4700 Table_map 1 4741 table_id: # (test.t1)
+master-bin.000001 4741 Write_rows 1 4775 table_id: # flags: STMT_END_F
+master-bin.000001 4775 Table_map 1 4816 table_id: # (test.t1)
+master-bin.000001 4816 Write_rows 1 4850 table_id: # flags: STMT_END_F
+master-bin.000001 4850 Table_map 1 4891 table_id: # (test.t1)
+master-bin.000001 4891 Write_rows 1 4925 table_id: # flags: STMT_END_F
+master-bin.000001 4925 Table_map 1 4966 table_id: # (test.t1)
+master-bin.000001 4966 Write_rows 1 5000 table_id: # flags: STMT_END_F
+master-bin.000001 5000 Table_map 1 5041 table_id: # (test.t1)
+master-bin.000001 5041 Write_rows 1 5075 table_id: # flags: STMT_END_F
+master-bin.000001 5075 Table_map 1 5116 table_id: # (test.t1)
+master-bin.000001 5116 Write_rows 1 5150 table_id: # flags: STMT_END_F
+master-bin.000001 5150 Table_map 1 5191 table_id: # (test.t1)
+master-bin.000001 5191 Write_rows 1 5225 table_id: # flags: STMT_END_F
+master-bin.000001 5225 Table_map 1 5266 table_id: # (test.t1)
+master-bin.000001 5266 Write_rows 1 5300 table_id: # flags: STMT_END_F
+master-bin.000001 5300 Table_map 1 5341 table_id: # (test.t1)
+master-bin.000001 5341 Write_rows 1 5375 table_id: # flags: STMT_END_F
+master-bin.000001 5375 Table_map 1 5416 table_id: # (test.t1)
+master-bin.000001 5416 Write_rows 1 5450 table_id: # flags: STMT_END_F
+master-bin.000001 5450 Table_map 1 5491 table_id: # (test.t1)
+master-bin.000001 5491 Write_rows 1 5525 table_id: # flags: STMT_END_F
+master-bin.000001 5525 Table_map 1 5566 table_id: # (test.t1)
+master-bin.000001 5566 Write_rows 1 5600 table_id: # flags: STMT_END_F
+master-bin.000001 5600 Table_map 1 5641 table_id: # (test.t1)
+master-bin.000001 5641 Write_rows 1 5675 table_id: # flags: STMT_END_F
+master-bin.000001 5675 Table_map 1 5716 table_id: # (test.t1)
+master-bin.000001 5716 Write_rows 1 5750 table_id: # flags: STMT_END_F
+master-bin.000001 5750 Table_map 1 5791 table_id: # (test.t1)
+master-bin.000001 5791 Write_rows 1 5825 table_id: # flags: STMT_END_F
+master-bin.000001 5825 Table_map 1 5866 table_id: # (test.t1)
+master-bin.000001 5866 Write_rows 1 5900 table_id: # flags: STMT_END_F
+master-bin.000001 5900 Table_map 1 5941 table_id: # (test.t1)
+master-bin.000001 5941 Write_rows 1 5975 table_id: # flags: STMT_END_F
+master-bin.000001 5975 Table_map 1 6016 table_id: # (test.t1)
+master-bin.000001 6016 Write_rows 1 6050 table_id: # flags: STMT_END_F
+master-bin.000001 6050 Table_map 1 6091 table_id: # (test.t1)
+master-bin.000001 6091 Write_rows 1 6125 table_id: # flags: STMT_END_F
+master-bin.000001 6125 Table_map 1 6166 table_id: # (test.t1)
+master-bin.000001 6166 Write_rows 1 6200 table_id: # flags: STMT_END_F
+master-bin.000001 6200 Table_map 1 6241 table_id: # (test.t1)
+master-bin.000001 6241 Write_rows 1 6275 table_id: # flags: STMT_END_F
+master-bin.000001 6275 Table_map 1 6316 table_id: # (test.t1)
+master-bin.000001 6316 Write_rows 1 6350 table_id: # flags: STMT_END_F
+master-bin.000001 6350 Table_map 1 6391 table_id: # (test.t1)
+master-bin.000001 6391 Write_rows 1 6425 table_id: # flags: STMT_END_F
+master-bin.000001 6425 Table_map 1 6466 table_id: # (test.t1)
+master-bin.000001 6466 Write_rows 1 6500 table_id: # flags: STMT_END_F
+master-bin.000001 6500 Table_map 1 6541 table_id: # (test.t1)
+master-bin.000001 6541 Write_rows 1 6575 table_id: # flags: STMT_END_F
+master-bin.000001 6575 Table_map 1 6616 table_id: # (test.t1)
+master-bin.000001 6616 Write_rows 1 6650 table_id: # flags: STMT_END_F
+master-bin.000001 6650 Table_map 1 6691 table_id: # (test.t1)
+master-bin.000001 6691 Write_rows 1 6725 table_id: # flags: STMT_END_F
+master-bin.000001 6725 Table_map 1 6766 table_id: # (test.t1)
+master-bin.000001 6766 Write_rows 1 6800 table_id: # flags: STMT_END_F
+master-bin.000001 6800 Table_map 1 6841 table_id: # (test.t1)
+master-bin.000001 6841 Write_rows 1 6875 table_id: # flags: STMT_END_F
+master-bin.000001 6875 Table_map 1 6916 table_id: # (test.t1)
+master-bin.000001 6916 Write_rows 1 6950 table_id: # flags: STMT_END_F
+master-bin.000001 6950 Table_map 1 6991 table_id: # (test.t1)
+master-bin.000001 6991 Write_rows 1 7025 table_id: # flags: STMT_END_F
+master-bin.000001 7025 Table_map 1 7066 table_id: # (test.t1)
+master-bin.000001 7066 Write_rows 1 7100 table_id: # flags: STMT_END_F
+master-bin.000001 7100 Table_map 1 7141 table_id: # (test.t1)
+master-bin.000001 7141 Write_rows 1 7175 table_id: # flags: STMT_END_F
+master-bin.000001 7175 Table_map 1 7216 table_id: # (test.t1)
+master-bin.000001 7216 Write_rows 1 7250 table_id: # flags: STMT_END_F
+master-bin.000001 7250 Table_map 1 7291 table_id: # (test.t1)
+master-bin.000001 7291 Write_rows 1 7325 table_id: # flags: STMT_END_F
+master-bin.000001 7325 Table_map 1 7366 table_id: # (test.t1)
+master-bin.000001 7366 Write_rows 1 7400 table_id: # flags: STMT_END_F
+master-bin.000001 7400 Table_map 1 7441 table_id: # (test.t1)
+master-bin.000001 7441 Write_rows 1 7475 table_id: # flags: STMT_END_F
+master-bin.000001 7475 Table_map 1 7516 table_id: # (test.t1)
+master-bin.000001 7516 Write_rows 1 7550 table_id: # flags: STMT_END_F
+master-bin.000001 7550 Table_map 1 7591 table_id: # (test.t1)
+master-bin.000001 7591 Write_rows 1 7625 table_id: # flags: STMT_END_F
+master-bin.000001 7625 Table_map 1 7666 table_id: # (test.t1)
+master-bin.000001 7666 Write_rows 1 7700 table_id: # flags: STMT_END_F
+master-bin.000001 7700 Table_map 1 7741 table_id: # (test.t1)
+master-bin.000001 7741 Write_rows 1 7775 table_id: # flags: STMT_END_F
+master-bin.000001 7775 Table_map 1 7816 table_id: # (test.t1)
+master-bin.000001 7816 Write_rows 1 7850 table_id: # flags: STMT_END_F
+master-bin.000001 7850 Table_map 1 7891 table_id: # (test.t1)
+master-bin.000001 7891 Write_rows 1 7925 table_id: # flags: STMT_END_F
+master-bin.000001 7925 Table_map 1 7966 table_id: # (test.t1)
+master-bin.000001 7966 Write_rows 1 8000 table_id: # flags: STMT_END_F
+master-bin.000001 8000 Table_map 1 8041 table_id: # (test.t1)
+master-bin.000001 8041 Write_rows 1 8075 table_id: # flags: STMT_END_F
+master-bin.000001 8075 Table_map 1 8116 table_id: # (test.t1)
+master-bin.000001 8116 Write_rows 1 8150 table_id: # flags: STMT_END_F
+master-bin.000001 8150 Table_map 1 8191 table_id: # (test.t1)
+master-bin.000001 8191 Write_rows 1 8225 table_id: # flags: STMT_END_F
+master-bin.000001 8225 Table_map 1 8266 table_id: # (test.t1)
+master-bin.000001 8266 Write_rows 1 8300 table_id: # flags: STMT_END_F
+master-bin.000001 8300 Table_map 1 8341 table_id: # (test.t1)
+master-bin.000001 8341 Write_rows 1 8375 table_id: # flags: STMT_END_F
+master-bin.000001 8375 Table_map 1 8416 table_id: # (test.t1)
+master-bin.000001 8416 Write_rows 1 8450 table_id: # flags: STMT_END_F
+master-bin.000001 8450 Table_map 1 8491 table_id: # (test.t1)
+master-bin.000001 8491 Write_rows 1 8525 table_id: # flags: STMT_END_F
+master-bin.000001 8525 Table_map 1 8566 table_id: # (test.t1)
+master-bin.000001 8566 Write_rows 1 8600 table_id: # flags: STMT_END_F
+master-bin.000001 8600 Table_map 1 8641 table_id: # (test.t1)
+master-bin.000001 8641 Write_rows 1 8675 table_id: # flags: STMT_END_F
+master-bin.000001 8675 Table_map 1 8716 table_id: # (test.t1)
+master-bin.000001 8716 Write_rows 1 8750 table_id: # flags: STMT_END_F
+master-bin.000001 8750 Table_map 1 8791 table_id: # (test.t1)
+master-bin.000001 8791 Write_rows 1 8825 table_id: # flags: STMT_END_F
+master-bin.000001 8825 Table_map 1 8866 table_id: # (test.t1)
+master-bin.000001 8866 Write_rows 1 8900 table_id: # flags: STMT_END_F
+master-bin.000001 8900 Table_map 1 8941 table_id: # (test.t1)
+master-bin.000001 8941 Write_rows 1 8975 table_id: # flags: STMT_END_F
+master-bin.000001 8975 Table_map 1 9016 table_id: # (test.t1)
+master-bin.000001 9016 Write_rows 1 9050 table_id: # flags: STMT_END_F
+master-bin.000001 9050 Table_map 1 9091 table_id: # (test.t1)
+master-bin.000001 9091 Write_rows 1 9125 table_id: # flags: STMT_END_F
+master-bin.000001 9125 Table_map 1 9166 table_id: # (test.t1)
+master-bin.000001 9166 Write_rows 1 9200 table_id: # flags: STMT_END_F
+master-bin.000001 9200 Table_map 1 9241 table_id: # (test.t1)
+master-bin.000001 9241 Write_rows 1 9275 table_id: # flags: STMT_END_F
+master-bin.000001 9275 Table_map 1 9316 table_id: # (test.t1)
+master-bin.000001 9316 Write_rows 1 9350 table_id: # flags: STMT_END_F
+master-bin.000001 9350 Table_map 1 9391 table_id: # (test.t1)
+master-bin.000001 9391 Write_rows 1 9425 table_id: # flags: STMT_END_F
+master-bin.000001 9425 Table_map 1 9466 table_id: # (test.t1)
+master-bin.000001 9466 Write_rows 1 9500 table_id: # flags: STMT_END_F
+master-bin.000001 9500 Table_map 1 9541 table_id: # (test.t1)
+master-bin.000001 9541 Write_rows 1 9575 table_id: # flags: STMT_END_F
+master-bin.000001 9575 Table_map 1 9616 table_id: # (test.t1)
+master-bin.000001 9616 Write_rows 1 9650 table_id: # flags: STMT_END_F
+master-bin.000001 9650 Table_map 1 9691 table_id: # (test.t1)
+master-bin.000001 9691 Write_rows 1 9725 table_id: # flags: STMT_END_F
+master-bin.000001 9725 Table_map 1 9766 table_id: # (test.t1)
+master-bin.000001 9766 Write_rows 1 9800 table_id: # flags: STMT_END_F
+master-bin.000001 9800 Table_map 1 9841 table_id: # (test.t1)
+master-bin.000001 9841 Write_rows 1 9875 table_id: # flags: STMT_END_F
+master-bin.000001 9875 Table_map 1 9916 table_id: # (test.t1)
+master-bin.000001 9916 Write_rows 1 9950 table_id: # flags: STMT_END_F
+master-bin.000001 9950 Table_map 1 9991 table_id: # (test.t1)
+master-bin.000001 9991 Write_rows 1 10025 table_id: # flags: STMT_END_F
+master-bin.000001 10025 Table_map 1 10066 table_id: # (test.t1)
+master-bin.000001 10066 Write_rows 1 10100 table_id: # flags: STMT_END_F
+master-bin.000001 10100 Table_map 1 10141 table_id: # (test.t1)
+master-bin.000001 10141 Write_rows 1 10175 table_id: # flags: STMT_END_F
+master-bin.000001 10175 Table_map 1 10216 table_id: # (test.t1)
+master-bin.000001 10216 Write_rows 1 10250 table_id: # flags: STMT_END_F
+master-bin.000001 10250 Table_map 1 10291 table_id: # (test.t1)
+master-bin.000001 10291 Write_rows 1 10325 table_id: # flags: STMT_END_F
+master-bin.000001 10325 Table_map 1 10366 table_id: # (test.t1)
+master-bin.000001 10366 Write_rows 1 10400 table_id: # flags: STMT_END_F
+master-bin.000001 10400 Table_map 1 10441 table_id: # (test.t1)
+master-bin.000001 10441 Write_rows 1 10475 table_id: # flags: STMT_END_F
+master-bin.000001 10475 Table_map 1 10516 table_id: # (test.t1)
+master-bin.000001 10516 Write_rows 1 10550 table_id: # flags: STMT_END_F
+master-bin.000001 10550 Table_map 1 10591 table_id: # (test.t1)
+master-bin.000001 10591 Write_rows 1 10625 table_id: # flags: STMT_END_F
+master-bin.000001 10625 Table_map 1 10666 table_id: # (test.t1)
+master-bin.000001 10666 Write_rows 1 10700 table_id: # flags: STMT_END_F
+master-bin.000001 10700 Table_map 1 10741 table_id: # (test.t1)
+master-bin.000001 10741 Write_rows 1 10775 table_id: # flags: STMT_END_F
+master-bin.000001 10775 Table_map 1 10816 table_id: # (test.t1)
+master-bin.000001 10816 Write_rows 1 10850 table_id: # flags: STMT_END_F
+master-bin.000001 10850 Table_map 1 10891 table_id: # (test.t1)
+master-bin.000001 10891 Write_rows 1 10925 table_id: # flags: STMT_END_F
+master-bin.000001 10925 Table_map 1 10966 table_id: # (test.t1)
+master-bin.000001 10966 Write_rows 1 11000 table_id: # flags: STMT_END_F
+master-bin.000001 11000 Table_map 1 11041 table_id: # (test.t1)
+master-bin.000001 11041 Write_rows 1 11075 table_id: # flags: STMT_END_F
+master-bin.000001 11075 Table_map 1 11116 table_id: # (test.t1)
+master-bin.000001 11116 Write_rows 1 11150 table_id: # flags: STMT_END_F
+master-bin.000001 11150 Table_map 1 11191 table_id: # (test.t1)
+master-bin.000001 11191 Write_rows 1 11225 table_id: # flags: STMT_END_F
+master-bin.000001 11225 Table_map 1 11266 table_id: # (test.t1)
+master-bin.000001 11266 Write_rows 1 11300 table_id: # flags: STMT_END_F
+master-bin.000001 11300 Table_map 1 11341 table_id: # (test.t1)
+master-bin.000001 11341 Write_rows 1 11375 table_id: # flags: STMT_END_F
+master-bin.000001 11375 Table_map 1 11416 table_id: # (test.t1)
+master-bin.000001 11416 Write_rows 1 11450 table_id: # flags: STMT_END_F
+master-bin.000001 11450 Table_map 1 11491 table_id: # (test.t1)
+master-bin.000001 11491 Write_rows 1 11525 table_id: # flags: STMT_END_F
+master-bin.000001 11525 Table_map 1 11566 table_id: # (test.t1)
+master-bin.000001 11566 Write_rows 1 11600 table_id: # flags: STMT_END_F
+master-bin.000001 11600 Table_map 1 11641 table_id: # (test.t1)
+master-bin.000001 11641 Write_rows 1 11675 table_id: # flags: STMT_END_F
+master-bin.000001 11675 Table_map 1 11716 table_id: # (test.t1)
+master-bin.000001 11716 Write_rows 1 11750 table_id: # flags: STMT_END_F
+master-bin.000001 11750 Table_map 1 11791 table_id: # (test.t1)
+master-bin.000001 11791 Write_rows 1 11825 table_id: # flags: STMT_END_F
+master-bin.000001 11825 Table_map 1 11866 table_id: # (test.t1)
+master-bin.000001 11866 Write_rows 1 11900 table_id: # flags: STMT_END_F
+master-bin.000001 11900 Table_map 1 11941 table_id: # (test.t1)
+master-bin.000001 11941 Write_rows 1 11975 table_id: # flags: STMT_END_F
+master-bin.000001 11975 Table_map 1 12016 table_id: # (test.t1)
+master-bin.000001 12016 Write_rows 1 12050 table_id: # flags: STMT_END_F
+master-bin.000001 12050 Table_map 1 12091 table_id: # (test.t1)
+master-bin.000001 12091 Write_rows 1 12125 table_id: # flags: STMT_END_F
+master-bin.000001 12125 Table_map 1 12166 table_id: # (test.t1)
+master-bin.000001 12166 Write_rows 1 12200 table_id: # flags: STMT_END_F
+master-bin.000001 12200 Table_map 1 12241 table_id: # (test.t1)
+master-bin.000001 12241 Write_rows 1 12275 table_id: # flags: STMT_END_F
+master-bin.000001 12275 Table_map 1 12316 table_id: # (test.t1)
+master-bin.000001 12316 Write_rows 1 12350 table_id: # flags: STMT_END_F
+master-bin.000001 12350 Table_map 1 12391 table_id: # (test.t1)
+master-bin.000001 12391 Write_rows 1 12425 table_id: # flags: STMT_END_F
+master-bin.000001 12425 Table_map 1 12466 table_id: # (test.t1)
+master-bin.000001 12466 Write_rows 1 12500 table_id: # flags: STMT_END_F
+master-bin.000001 12500 Table_map 1 12541 table_id: # (test.t1)
+master-bin.000001 12541 Write_rows 1 12575 table_id: # flags: STMT_END_F
+master-bin.000001 12575 Table_map 1 12616 table_id: # (test.t1)
+master-bin.000001 12616 Write_rows 1 12650 table_id: # flags: STMT_END_F
+master-bin.000001 12650 Table_map 1 12691 table_id: # (test.t1)
+master-bin.000001 12691 Write_rows 1 12725 table_id: # flags: STMT_END_F
+master-bin.000001 12725 Table_map 1 12766 table_id: # (test.t1)
+master-bin.000001 12766 Write_rows 1 12800 table_id: # flags: STMT_END_F
+master-bin.000001 12800 Table_map 1 12841 table_id: # (test.t1)
+master-bin.000001 12841 Write_rows 1 12875 table_id: # flags: STMT_END_F
+master-bin.000001 12875 Table_map 1 12916 table_id: # (test.t1)
+master-bin.000001 12916 Write_rows 1 12950 table_id: # flags: STMT_END_F
+master-bin.000001 12950 Table_map 1 12991 table_id: # (test.t1)
+master-bin.000001 12991 Write_rows 1 13025 table_id: # flags: STMT_END_F
+master-bin.000001 13025 Table_map 1 13066 table_id: # (test.t1)
+master-bin.000001 13066 Write_rows 1 13100 table_id: # flags: STMT_END_F
+master-bin.000001 13100 Table_map 1 13141 table_id: # (test.t1)
+master-bin.000001 13141 Write_rows 1 13175 table_id: # flags: STMT_END_F
+master-bin.000001 13175 Table_map 1 13216 table_id: # (test.t1)
+master-bin.000001 13216 Write_rows 1 13250 table_id: # flags: STMT_END_F
+master-bin.000001 13250 Table_map 1 13291 table_id: # (test.t1)
+master-bin.000001 13291 Write_rows 1 13325 table_id: # flags: STMT_END_F
+master-bin.000001 13325 Table_map 1 13366 table_id: # (test.t1)
+master-bin.000001 13366 Write_rows 1 13400 table_id: # flags: STMT_END_F
+master-bin.000001 13400 Table_map 1 13441 table_id: # (test.t1)
+master-bin.000001 13441 Write_rows 1 13475 table_id: # flags: STMT_END_F
+master-bin.000001 13475 Table_map 1 13516 table_id: # (test.t1)
+master-bin.000001 13516 Write_rows 1 13550 table_id: # flags: STMT_END_F
+master-bin.000001 13550 Table_map 1 13591 table_id: # (test.t1)
+master-bin.000001 13591 Write_rows 1 13625 table_id: # flags: STMT_END_F
+master-bin.000001 13625 Table_map 1 13666 table_id: # (test.t1)
+master-bin.000001 13666 Write_rows 1 13700 table_id: # flags: STMT_END_F
+master-bin.000001 13700 Table_map 1 13741 table_id: # (test.t1)
+master-bin.000001 13741 Write_rows 1 13775 table_id: # flags: STMT_END_F
+master-bin.000001 13775 Table_map 1 13816 table_id: # (test.t1)
+master-bin.000001 13816 Write_rows 1 13850 table_id: # flags: STMT_END_F
+master-bin.000001 13850 Table_map 1 13891 table_id: # (test.t1)
+master-bin.000001 13891 Write_rows 1 13925 table_id: # flags: STMT_END_F
+master-bin.000001 13925 Table_map 1 13966 table_id: # (test.t1)
+master-bin.000001 13966 Write_rows 1 14000 table_id: # flags: STMT_END_F
+master-bin.000001 14000 Table_map 1 14041 table_id: # (test.t1)
+master-bin.000001 14041 Write_rows 1 14075 table_id: # flags: STMT_END_F
+master-bin.000001 14075 Table_map 1 14116 table_id: # (test.t1)
+master-bin.000001 14116 Write_rows 1 14150 table_id: # flags: STMT_END_F
+master-bin.000001 14150 Table_map 1 14191 table_id: # (test.t1)
+master-bin.000001 14191 Write_rows 1 14225 table_id: # flags: STMT_END_F
+master-bin.000001 14225 Table_map 1 14266 table_id: # (test.t1)
+master-bin.000001 14266 Write_rows 1 14300 table_id: # flags: STMT_END_F
+master-bin.000001 14300 Table_map 1 14341 table_id: # (test.t1)
+master-bin.000001 14341 Write_rows 1 14375 table_id: # flags: STMT_END_F
+master-bin.000001 14375 Table_map 1 14416 table_id: # (test.t1)
+master-bin.000001 14416 Write_rows 1 14450 table_id: # flags: STMT_END_F
+master-bin.000001 14450 Table_map 1 14491 table_id: # (test.t1)
+master-bin.000001 14491 Write_rows 1 14525 table_id: # flags: STMT_END_F
+master-bin.000001 14525 Table_map 1 14566 table_id: # (test.t1)
+master-bin.000001 14566 Write_rows 1 14600 table_id: # flags: STMT_END_F
+master-bin.000001 14600 Table_map 1 14641 table_id: # (test.t1)
+master-bin.000001 14641 Write_rows 1 14675 table_id: # flags: STMT_END_F
+master-bin.000001 14675 Table_map 1 14716 table_id: # (test.t1)
+master-bin.000001 14716 Write_rows 1 14750 table_id: # flags: STMT_END_F
+master-bin.000001 14750 Table_map 1 14791 table_id: # (test.t1)
+master-bin.000001 14791 Write_rows 1 14825 table_id: # flags: STMT_END_F
+master-bin.000001 14825 Table_map 1 14866 table_id: # (test.t1)
+master-bin.000001 14866 Write_rows 1 14900 table_id: # flags: STMT_END_F
+master-bin.000001 14900 Table_map 1 14941 table_id: # (test.t1)
+master-bin.000001 14941 Write_rows 1 14975 table_id: # flags: STMT_END_F
+master-bin.000001 14975 Table_map 1 15016 table_id: # (test.t1)
+master-bin.000001 15016 Write_rows 1 15050 table_id: # flags: STMT_END_F
+master-bin.000001 15050 Table_map 1 15091 table_id: # (test.t1)
+master-bin.000001 15091 Write_rows 1 15125 table_id: # flags: STMT_END_F
+master-bin.000001 15125 Table_map 1 15166 table_id: # (test.t1)
+master-bin.000001 15166 Write_rows 1 15200 table_id: # flags: STMT_END_F
+master-bin.000001 15200 Table_map 1 15241 table_id: # (test.t1)
+master-bin.000001 15241 Write_rows 1 15275 table_id: # flags: STMT_END_F
+master-bin.000001 15275 Table_map 1 15316 table_id: # (test.t1)
+master-bin.000001 15316 Write_rows 1 15350 table_id: # flags: STMT_END_F
+master-bin.000001 15350 Table_map 1 15391 table_id: # (test.t1)
+master-bin.000001 15391 Write_rows 1 15425 table_id: # flags: STMT_END_F
+master-bin.000001 15425 Table_map 1 15466 table_id: # (test.t1)
+master-bin.000001 15466 Write_rows 1 15500 table_id: # flags: STMT_END_F
+master-bin.000001 15500 Table_map 1 15541 table_id: # (test.t1)
+master-bin.000001 15541 Write_rows 1 15575 table_id: # flags: STMT_END_F
+master-bin.000001 15575 Table_map 1 15616 table_id: # (test.t1)
+master-bin.000001 15616 Write_rows 1 15650 table_id: # flags: STMT_END_F
+master-bin.000001 15650 Table_map 1 15691 table_id: # (test.t1)
+master-bin.000001 15691 Write_rows 1 15725 table_id: # flags: STMT_END_F
+master-bin.000001 15725 Table_map 1 15766 table_id: # (test.t1)
+master-bin.000001 15766 Write_rows 1 15800 table_id: # flags: STMT_END_F
+master-bin.000001 15800 Table_map 1 15841 table_id: # (test.t1)
+master-bin.000001 15841 Write_rows 1 15875 table_id: # flags: STMT_END_F
+master-bin.000001 15875 Table_map 1 15916 table_id: # (test.t1)
+master-bin.000001 15916 Write_rows 1 15950 table_id: # flags: STMT_END_F
+master-bin.000001 15950 Table_map 1 15991 table_id: # (test.t1)
+master-bin.000001 15991 Write_rows 1 16025 table_id: # flags: STMT_END_F
+master-bin.000001 16025 Table_map 1 16066 table_id: # (test.t1)
+master-bin.000001 16066 Write_rows 1 16100 table_id: # flags: STMT_END_F
+master-bin.000001 16100 Table_map 1 16141 table_id: # (test.t1)
+master-bin.000001 16141 Write_rows 1 16175 table_id: # flags: STMT_END_F
+master-bin.000001 16175 Table_map 1 16216 table_id: # (test.t1)
+master-bin.000001 16216 Write_rows 1 16250 table_id: # flags: STMT_END_F
+master-bin.000001 16250 Table_map 1 16291 table_id: # (test.t1)
+master-bin.000001 16291 Write_rows 1 16325 table_id: # flags: STMT_END_F
+master-bin.000001 16325 Table_map 1 16366 table_id: # (test.t1)
+master-bin.000001 16366 Write_rows 1 16400 table_id: # flags: STMT_END_F
+master-bin.000001 16400 Table_map 1 16441 table_id: # (test.t1)
+master-bin.000001 16441 Write_rows 1 16475 table_id: # flags: STMT_END_F
+master-bin.000001 16475 Table_map 1 16516 table_id: # (test.t1)
+master-bin.000001 16516 Write_rows 1 16550 table_id: # flags: STMT_END_F
+master-bin.000001 16550 Table_map 1 16591 table_id: # (test.t1)
+master-bin.000001 16591 Write_rows 1 16625 table_id: # flags: STMT_END_F
+master-bin.000001 16625 Table_map 1 16666 table_id: # (test.t1)
+master-bin.000001 16666 Write_rows 1 16700 table_id: # flags: STMT_END_F
+master-bin.000001 16700 Table_map 1 16741 table_id: # (test.t1)
+master-bin.000001 16741 Write_rows 1 16775 table_id: # flags: STMT_END_F
+master-bin.000001 16775 Table_map 1 16816 table_id: # (test.t1)
+master-bin.000001 16816 Write_rows 1 16850 table_id: # flags: STMT_END_F
+master-bin.000001 16850 Table_map 1 16891 table_id: # (test.t1)
+master-bin.000001 16891 Write_rows 1 16925 table_id: # flags: STMT_END_F
+master-bin.000001 16925 Table_map 1 16966 table_id: # (test.t1)
+master-bin.000001 16966 Write_rows 1 17000 table_id: # flags: STMT_END_F
+master-bin.000001 17000 Table_map 1 17041 table_id: # (test.t1)
+master-bin.000001 17041 Write_rows 1 17075 table_id: # flags: STMT_END_F
+master-bin.000001 17075 Table_map 1 17116 table_id: # (test.t1)
+master-bin.000001 17116 Write_rows 1 17150 table_id: # flags: STMT_END_F
+master-bin.000001 17150 Table_map 1 17191 table_id: # (test.t1)
+master-bin.000001 17191 Write_rows 1 17225 table_id: # flags: STMT_END_F
+master-bin.000001 17225 Table_map 1 17266 table_id: # (test.t1)
+master-bin.000001 17266 Write_rows 1 17300 table_id: # flags: STMT_END_F
+master-bin.000001 17300 Table_map 1 17341 table_id: # (test.t1)
+master-bin.000001 17341 Write_rows 1 17375 table_id: # flags: STMT_END_F
+master-bin.000001 17375 Table_map 1 17416 table_id: # (test.t1)
+master-bin.000001 17416 Write_rows 1 17450 table_id: # flags: STMT_END_F
+master-bin.000001 17450 Table_map 1 17491 table_id: # (test.t1)
+master-bin.000001 17491 Write_rows 1 17525 table_id: # flags: STMT_END_F
+master-bin.000001 17525 Table_map 1 17566 table_id: # (test.t1)
+master-bin.000001 17566 Write_rows 1 17600 table_id: # flags: STMT_END_F
+master-bin.000001 17600 Table_map 1 17641 table_id: # (test.t1)
+master-bin.000001 17641 Write_rows 1 17675 table_id: # flags: STMT_END_F
+master-bin.000001 17675 Table_map 1 17716 table_id: # (test.t1)
+master-bin.000001 17716 Write_rows 1 17750 table_id: # flags: STMT_END_F
+master-bin.000001 17750 Table_map 1 17791 table_id: # (test.t1)
+master-bin.000001 17791 Write_rows 1 17825 table_id: # flags: STMT_END_F
+master-bin.000001 17825 Table_map 1 17866 table_id: # (test.t1)
+master-bin.000001 17866 Write_rows 1 17900 table_id: # flags: STMT_END_F
+master-bin.000001 17900 Table_map 1 17941 table_id: # (test.t1)
+master-bin.000001 17941 Write_rows 1 17975 table_id: # flags: STMT_END_F
+master-bin.000001 17975 Table_map 1 18016 table_id: # (test.t1)
+master-bin.000001 18016 Write_rows 1 18050 table_id: # flags: STMT_END_F
+master-bin.000001 18050 Table_map 1 18091 table_id: # (test.t1)
+master-bin.000001 18091 Write_rows 1 18125 table_id: # flags: STMT_END_F
+master-bin.000001 18125 Table_map 1 18166 table_id: # (test.t1)
+master-bin.000001 18166 Write_rows 1 18200 table_id: # flags: STMT_END_F
+master-bin.000001 18200 Table_map 1 18241 table_id: # (test.t1)
+master-bin.000001 18241 Write_rows 1 18275 table_id: # flags: STMT_END_F
+master-bin.000001 18275 Table_map 1 18316 table_id: # (test.t1)
+master-bin.000001 18316 Write_rows 1 18350 table_id: # flags: STMT_END_F
+master-bin.000001 18350 Table_map 1 18391 table_id: # (test.t1)
+master-bin.000001 18391 Write_rows 1 18425 table_id: # flags: STMT_END_F
+master-bin.000001 18425 Table_map 1 18466 table_id: # (test.t1)
+master-bin.000001 18466 Write_rows 1 18500 table_id: # flags: STMT_END_F
+master-bin.000001 18500 Table_map 1 18541 table_id: # (test.t1)
+master-bin.000001 18541 Write_rows 1 18575 table_id: # flags: STMT_END_F
+master-bin.000001 18575 Table_map 1 18616 table_id: # (test.t1)
+master-bin.000001 18616 Write_rows 1 18650 table_id: # flags: STMT_END_F
+master-bin.000001 18650 Table_map 1 18691 table_id: # (test.t1)
+master-bin.000001 18691 Write_rows 1 18725 table_id: # flags: STMT_END_F
+master-bin.000001 18725 Table_map 1 18766 table_id: # (test.t1)
+master-bin.000001 18766 Write_rows 1 18800 table_id: # flags: STMT_END_F
+master-bin.000001 18800 Table_map 1 18841 table_id: # (test.t1)
+master-bin.000001 18841 Write_rows 1 18875 table_id: # flags: STMT_END_F
+master-bin.000001 18875 Table_map 1 18916 table_id: # (test.t1)
+master-bin.000001 18916 Write_rows 1 18950 table_id: # flags: STMT_END_F
+master-bin.000001 18950 Table_map 1 18991 table_id: # (test.t1)
+master-bin.000001 18991 Write_rows 1 19025 table_id: # flags: STMT_END_F
+master-bin.000001 19025 Table_map 1 19066 table_id: # (test.t1)
+master-bin.000001 19066 Write_rows 1 19100 table_id: # flags: STMT_END_F
+master-bin.000001 19100 Table_map 1 19141 table_id: # (test.t1)
+master-bin.000001 19141 Write_rows 1 19175 table_id: # flags: STMT_END_F
+master-bin.000001 19175 Table_map 1 19216 table_id: # (test.t1)
+master-bin.000001 19216 Write_rows 1 19250 table_id: # flags: STMT_END_F
+master-bin.000001 19250 Table_map 1 19291 table_id: # (test.t1)
+master-bin.000001 19291 Write_rows 1 19325 table_id: # flags: STMT_END_F
+master-bin.000001 19325 Table_map 1 19366 table_id: # (test.t1)
+master-bin.000001 19366 Write_rows 1 19400 table_id: # flags: STMT_END_F
+master-bin.000001 19400 Table_map 1 19441 table_id: # (test.t1)
+master-bin.000001 19441 Write_rows 1 19475 table_id: # flags: STMT_END_F
+master-bin.000001 19475 Table_map 1 19516 table_id: # (test.t1)
+master-bin.000001 19516 Write_rows 1 19550 table_id: # flags: STMT_END_F
+master-bin.000001 19550 Table_map 1 19591 table_id: # (test.t1)
+master-bin.000001 19591 Write_rows 1 19625 table_id: # flags: STMT_END_F
+master-bin.000001 19625 Table_map 1 19666 table_id: # (test.t1)
+master-bin.000001 19666 Write_rows 1 19700 table_id: # flags: STMT_END_F
+master-bin.000001 19700 Table_map 1 19741 table_id: # (test.t1)
+master-bin.000001 19741 Write_rows 1 19775 table_id: # flags: STMT_END_F
+master-bin.000001 19775 Table_map 1 19816 table_id: # (test.t1)
+master-bin.000001 19816 Write_rows 1 19850 table_id: # flags: STMT_END_F
+master-bin.000001 19850 Table_map 1 19891 table_id: # (test.t1)
+master-bin.000001 19891 Write_rows 1 19925 table_id: # flags: STMT_END_F
+master-bin.000001 19925 Table_map 1 19966 table_id: # (test.t1)
+master-bin.000001 19966 Write_rows 1 20000 table_id: # flags: STMT_END_F
+master-bin.000001 20000 Table_map 1 20041 table_id: # (test.t1)
+master-bin.000001 20041 Write_rows 1 20075 table_id: # flags: STMT_END_F
+master-bin.000001 20075 Table_map 1 20116 table_id: # (test.t1)
+master-bin.000001 20116 Write_rows 1 20150 table_id: # flags: STMT_END_F
+master-bin.000001 20150 Table_map 1 20191 table_id: # (test.t1)
+master-bin.000001 20191 Write_rows 1 20225 table_id: # flags: STMT_END_F
+master-bin.000001 20225 Table_map 1 20266 table_id: # (test.t1)
+master-bin.000001 20266 Write_rows 1 20300 table_id: # flags: STMT_END_F
+master-bin.000001 20300 Table_map 1 20341 table_id: # (test.t1)
+master-bin.000001 20341 Write_rows 1 20375 table_id: # flags: STMT_END_F
+master-bin.000001 20375 Table_map 1 20416 table_id: # (test.t1)
+master-bin.000001 20416 Write_rows 1 20450 table_id: # flags: STMT_END_F
+master-bin.000001 20450 Table_map 1 20491 table_id: # (test.t1)
+master-bin.000001 20491 Write_rows 1 20525 table_id: # flags: STMT_END_F
+master-bin.000001 20525 Table_map 1 20566 table_id: # (test.t1)
+master-bin.000001 20566 Write_rows 1 20600 table_id: # flags: STMT_END_F
+master-bin.000001 20600 Table_map 1 20641 table_id: # (test.t1)
+master-bin.000001 20641 Write_rows 1 20675 table_id: # flags: STMT_END_F
+master-bin.000001 20675 Table_map 1 20716 table_id: # (test.t1)
+master-bin.000001 20716 Write_rows 1 20750 table_id: # flags: STMT_END_F
+master-bin.000001 20750 Table_map 1 20791 table_id: # (test.t1)
+master-bin.000001 20791 Write_rows 1 20825 table_id: # flags: STMT_END_F
+master-bin.000001 20825 Table_map 1 20866 table_id: # (test.t1)
+master-bin.000001 20866 Write_rows 1 20900 table_id: # flags: STMT_END_F
+master-bin.000001 20900 Table_map 1 20941 table_id: # (test.t1)
+master-bin.000001 20941 Write_rows 1 20975 table_id: # flags: STMT_END_F
+master-bin.000001 20975 Table_map 1 21016 table_id: # (test.t1)
+master-bin.000001 21016 Write_rows 1 21050 table_id: # flags: STMT_END_F
+master-bin.000001 21050 Table_map 1 21091 table_id: # (test.t1)
+master-bin.000001 21091 Write_rows 1 21125 table_id: # flags: STMT_END_F
+master-bin.000001 21125 Table_map 1 21166 table_id: # (test.t1)
+master-bin.000001 21166 Write_rows 1 21200 table_id: # flags: STMT_END_F
+master-bin.000001 21200 Table_map 1 21241 table_id: # (test.t1)
+master-bin.000001 21241 Write_rows 1 21275 table_id: # flags: STMT_END_F
+master-bin.000001 21275 Table_map 1 21316 table_id: # (test.t1)
+master-bin.000001 21316 Write_rows 1 21350 table_id: # flags: STMT_END_F
+master-bin.000001 21350 Table_map 1 21391 table_id: # (test.t1)
+master-bin.000001 21391 Write_rows 1 21425 table_id: # flags: STMT_END_F
+master-bin.000001 21425 Table_map 1 21466 table_id: # (test.t1)
+master-bin.000001 21466 Write_rows 1 21500 table_id: # flags: STMT_END_F
+master-bin.000001 21500 Table_map 1 21541 table_id: # (test.t1)
+master-bin.000001 21541 Write_rows 1 21575 table_id: # flags: STMT_END_F
+master-bin.000001 21575 Table_map 1 21616 table_id: # (test.t1)
+master-bin.000001 21616 Write_rows 1 21650 table_id: # flags: STMT_END_F
+master-bin.000001 21650 Table_map 1 21691 table_id: # (test.t1)
+master-bin.000001 21691 Write_rows 1 21725 table_id: # flags: STMT_END_F
+master-bin.000001 21725 Table_map 1 21766 table_id: # (test.t1)
+master-bin.000001 21766 Write_rows 1 21800 table_id: # flags: STMT_END_F
+master-bin.000001 21800 Table_map 1 21841 table_id: # (test.t1)
+master-bin.000001 21841 Write_rows 1 21875 table_id: # flags: STMT_END_F
+master-bin.000001 21875 Table_map 1 21916 table_id: # (test.t1)
+master-bin.000001 21916 Write_rows 1 21950 table_id: # flags: STMT_END_F
+master-bin.000001 21950 Table_map 1 21991 table_id: # (test.t1)
+master-bin.000001 21991 Write_rows 1 22025 table_id: # flags: STMT_END_F
+master-bin.000001 22025 Table_map 1 22066 table_id: # (test.t1)
+master-bin.000001 22066 Write_rows 1 22100 table_id: # flags: STMT_END_F
+master-bin.000001 22100 Table_map 1 22141 table_id: # (test.t1)
+master-bin.000001 22141 Write_rows 1 22175 table_id: # flags: STMT_END_F
+master-bin.000001 22175 Table_map 1 22216 table_id: # (test.t1)
+master-bin.000001 22216 Write_rows 1 22250 table_id: # flags: STMT_END_F
+master-bin.000001 22250 Table_map 1 22291 table_id: # (test.t1)
+master-bin.000001 22291 Write_rows 1 22325 table_id: # flags: STMT_END_F
+master-bin.000001 22325 Table_map 1 22366 table_id: # (test.t1)
+master-bin.000001 22366 Write_rows 1 22400 table_id: # flags: STMT_END_F
+master-bin.000001 22400 Table_map 1 22441 table_id: # (test.t1)
+master-bin.000001 22441 Write_rows 1 22475 table_id: # flags: STMT_END_F
+master-bin.000001 22475 Table_map 1 22516 table_id: # (test.t1)
+master-bin.000001 22516 Write_rows 1 22550 table_id: # flags: STMT_END_F
+master-bin.000001 22550 Table_map 1 22591 table_id: # (test.t1)
+master-bin.000001 22591 Write_rows 1 22625 table_id: # flags: STMT_END_F
+master-bin.000001 22625 Table_map 1 22666 table_id: # (test.t1)
+master-bin.000001 22666 Write_rows 1 22700 table_id: # flags: STMT_END_F
+master-bin.000001 22700 Table_map 1 22741 table_id: # (test.t1)
+master-bin.000001 22741 Write_rows 1 22775 table_id: # flags: STMT_END_F
+master-bin.000001 22775 Table_map 1 22816 table_id: # (test.t1)
+master-bin.000001 22816 Write_rows 1 22850 table_id: # flags: STMT_END_F
+master-bin.000001 22850 Table_map 1 22891 table_id: # (test.t1)
+master-bin.000001 22891 Write_rows 1 22925 table_id: # flags: STMT_END_F
+master-bin.000001 22925 Table_map 1 22966 table_id: # (test.t1)
+master-bin.000001 22966 Write_rows 1 23000 table_id: # flags: STMT_END_F
+master-bin.000001 23000 Table_map 1 23041 table_id: # (test.t1)
+master-bin.000001 23041 Write_rows 1 23075 table_id: # flags: STMT_END_F
+master-bin.000001 23075 Table_map 1 23116 table_id: # (test.t1)
+master-bin.000001 23116 Write_rows 1 23150 table_id: # flags: STMT_END_F
+master-bin.000001 23150 Table_map 1 23191 table_id: # (test.t1)
+master-bin.000001 23191 Write_rows 1 23225 table_id: # flags: STMT_END_F
+master-bin.000001 23225 Table_map 1 23266 table_id: # (test.t1)
+master-bin.000001 23266 Write_rows 1 23300 table_id: # flags: STMT_END_F
+master-bin.000001 23300 Table_map 1 23341 table_id: # (test.t1)
+master-bin.000001 23341 Write_rows 1 23375 table_id: # flags: STMT_END_F
+master-bin.000001 23375 Table_map 1 23416 table_id: # (test.t1)
+master-bin.000001 23416 Write_rows 1 23450 table_id: # flags: STMT_END_F
+master-bin.000001 23450 Table_map 1 23491 table_id: # (test.t1)
+master-bin.000001 23491 Write_rows 1 23525 table_id: # flags: STMT_END_F
+master-bin.000001 23525 Table_map 1 23566 table_id: # (test.t1)
+master-bin.000001 23566 Write_rows 1 23600 table_id: # flags: STMT_END_F
+master-bin.000001 23600 Table_map 1 23641 table_id: # (test.t1)
+master-bin.000001 23641 Write_rows 1 23675 table_id: # flags: STMT_END_F
+master-bin.000001 23675 Table_map 1 23716 table_id: # (test.t1)
+master-bin.000001 23716 Write_rows 1 23750 table_id: # flags: STMT_END_F
+master-bin.000001 23750 Table_map 1 23791 table_id: # (test.t1)
+master-bin.000001 23791 Write_rows 1 23825 table_id: # flags: STMT_END_F
+master-bin.000001 23825 Table_map 1 23866 table_id: # (test.t1)
+master-bin.000001 23866 Write_rows 1 23900 table_id: # flags: STMT_END_F
+master-bin.000001 23900 Table_map 1 23941 table_id: # (test.t1)
+master-bin.000001 23941 Write_rows 1 23975 table_id: # flags: STMT_END_F
+master-bin.000001 23975 Table_map 1 24016 table_id: # (test.t1)
+master-bin.000001 24016 Write_rows 1 24050 table_id: # flags: STMT_END_F
+master-bin.000001 24050 Table_map 1 24091 table_id: # (test.t1)
+master-bin.000001 24091 Write_rows 1 24125 table_id: # flags: STMT_END_F
+master-bin.000001 24125 Table_map 1 24166 table_id: # (test.t1)
+master-bin.000001 24166 Write_rows 1 24200 table_id: # flags: STMT_END_F
+master-bin.000001 24200 Table_map 1 24241 table_id: # (test.t1)
+master-bin.000001 24241 Write_rows 1 24275 table_id: # flags: STMT_END_F
+master-bin.000001 24275 Table_map 1 24316 table_id: # (test.t1)
+master-bin.000001 24316 Write_rows 1 24350 table_id: # flags: STMT_END_F
+master-bin.000001 24350 Table_map 1 24391 table_id: # (test.t1)
+master-bin.000001 24391 Write_rows 1 24425 table_id: # flags: STMT_END_F
+master-bin.000001 24425 Table_map 1 24466 table_id: # (test.t1)
+master-bin.000001 24466 Write_rows 1 24500 table_id: # flags: STMT_END_F
+master-bin.000001 24500 Table_map 1 24541 table_id: # (test.t1)
+master-bin.000001 24541 Write_rows 1 24575 table_id: # flags: STMT_END_F
+master-bin.000001 24575 Table_map 1 24616 table_id: # (test.t1)
+master-bin.000001 24616 Write_rows 1 24650 table_id: # flags: STMT_END_F
+master-bin.000001 24650 Table_map 1 24691 table_id: # (test.t1)
+master-bin.000001 24691 Write_rows 1 24725 table_id: # flags: STMT_END_F
+master-bin.000001 24725 Table_map 1 24766 table_id: # (test.t1)
+master-bin.000001 24766 Write_rows 1 24800 table_id: # flags: STMT_END_F
+master-bin.000001 24800 Table_map 1 24841 table_id: # (test.t1)
+master-bin.000001 24841 Write_rows 1 24875 table_id: # flags: STMT_END_F
+master-bin.000001 24875 Table_map 1 24916 table_id: # (test.t1)
+master-bin.000001 24916 Write_rows 1 24950 table_id: # flags: STMT_END_F
+master-bin.000001 24950 Table_map 1 24991 table_id: # (test.t1)
+master-bin.000001 24991 Write_rows 1 25025 table_id: # flags: STMT_END_F
+master-bin.000001 25025 Table_map 1 25066 table_id: # (test.t1)
+master-bin.000001 25066 Write_rows 1 25100 table_id: # flags: STMT_END_F
+master-bin.000001 25100 Table_map 1 25141 table_id: # (test.t1)
+master-bin.000001 25141 Write_rows 1 25175 table_id: # flags: STMT_END_F
+master-bin.000001 25175 Table_map 1 25216 table_id: # (test.t1)
+master-bin.000001 25216 Write_rows 1 25250 table_id: # flags: STMT_END_F
+master-bin.000001 25250 Table_map 1 25291 table_id: # (test.t1)
+master-bin.000001 25291 Write_rows 1 25325 table_id: # flags: STMT_END_F
+master-bin.000001 25325 Table_map 1 25366 table_id: # (test.t1)
+master-bin.000001 25366 Write_rows 1 25400 table_id: # flags: STMT_END_F
+master-bin.000001 25400 Table_map 1 25441 table_id: # (test.t1)
+master-bin.000001 25441 Write_rows 1 25475 table_id: # flags: STMT_END_F
+master-bin.000001 25475 Table_map 1 25516 table_id: # (test.t1)
+master-bin.000001 25516 Write_rows 1 25550 table_id: # flags: STMT_END_F
+master-bin.000001 25550 Table_map 1 25591 table_id: # (test.t1)
+master-bin.000001 25591 Write_rows 1 25625 table_id: # flags: STMT_END_F
+master-bin.000001 25625 Table_map 1 25666 table_id: # (test.t1)
+master-bin.000001 25666 Write_rows 1 25700 table_id: # flags: STMT_END_F
+master-bin.000001 25700 Table_map 1 25741 table_id: # (test.t1)
+master-bin.000001 25741 Write_rows 1 25775 table_id: # flags: STMT_END_F
+master-bin.000001 25775 Table_map 1 25816 table_id: # (test.t1)
+master-bin.000001 25816 Write_rows 1 25850 table_id: # flags: STMT_END_F
+master-bin.000001 25850 Table_map 1 25891 table_id: # (test.t1)
+master-bin.000001 25891 Write_rows 1 25925 table_id: # flags: STMT_END_F
+master-bin.000001 25925 Table_map 1 25966 table_id: # (test.t1)
+master-bin.000001 25966 Write_rows 1 26000 table_id: # flags: STMT_END_F
+master-bin.000001 26000 Table_map 1 26041 table_id: # (test.t1)
+master-bin.000001 26041 Write_rows 1 26075 table_id: # flags: STMT_END_F
+master-bin.000001 26075 Table_map 1 26116 table_id: # (test.t1)
+master-bin.000001 26116 Write_rows 1 26150 table_id: # flags: STMT_END_F
+master-bin.000001 26150 Table_map 1 26191 table_id: # (test.t1)
+master-bin.000001 26191 Write_rows 1 26225 table_id: # flags: STMT_END_F
+master-bin.000001 26225 Table_map 1 26266 table_id: # (test.t1)
+master-bin.000001 26266 Write_rows 1 26300 table_id: # flags: STMT_END_F
+master-bin.000001 26300 Table_map 1 26341 table_id: # (test.t1)
+master-bin.000001 26341 Write_rows 1 26375 table_id: # flags: STMT_END_F
+master-bin.000001 26375 Table_map 1 26416 table_id: # (test.t1)
+master-bin.000001 26416 Write_rows 1 26450 table_id: # flags: STMT_END_F
+master-bin.000001 26450 Table_map 1 26491 table_id: # (test.t1)
+master-bin.000001 26491 Write_rows 1 26525 table_id: # flags: STMT_END_F
+master-bin.000001 26525 Table_map 1 26566 table_id: # (test.t1)
+master-bin.000001 26566 Write_rows 1 26600 table_id: # flags: STMT_END_F
+master-bin.000001 26600 Table_map 1 26641 table_id: # (test.t1)
+master-bin.000001 26641 Write_rows 1 26675 table_id: # flags: STMT_END_F
+master-bin.000001 26675 Table_map 1 26716 table_id: # (test.t1)
+master-bin.000001 26716 Write_rows 1 26750 table_id: # flags: STMT_END_F
+master-bin.000001 26750 Table_map 1 26791 table_id: # (test.t1)
+master-bin.000001 26791 Write_rows 1 26825 table_id: # flags: STMT_END_F
+master-bin.000001 26825 Table_map 1 26866 table_id: # (test.t1)
+master-bin.000001 26866 Write_rows 1 26900 table_id: # flags: STMT_END_F
+master-bin.000001 26900 Table_map 1 26941 table_id: # (test.t1)
+master-bin.000001 26941 Write_rows 1 26975 table_id: # flags: STMT_END_F
+master-bin.000001 26975 Table_map 1 27016 table_id: # (test.t1)
+master-bin.000001 27016 Write_rows 1 27050 table_id: # flags: STMT_END_F
+master-bin.000001 27050 Table_map 1 27091 table_id: # (test.t1)
+master-bin.000001 27091 Write_rows 1 27125 table_id: # flags: STMT_END_F
+master-bin.000001 27125 Table_map 1 27166 table_id: # (test.t1)
+master-bin.000001 27166 Write_rows 1 27200 table_id: # flags: STMT_END_F
+master-bin.000001 27200 Table_map 1 27241 table_id: # (test.t1)
+master-bin.000001 27241 Write_rows 1 27275 table_id: # flags: STMT_END_F
+master-bin.000001 27275 Table_map 1 27316 table_id: # (test.t1)
+master-bin.000001 27316 Write_rows 1 27350 table_id: # flags: STMT_END_F
+master-bin.000001 27350 Table_map 1 27391 table_id: # (test.t1)
+master-bin.000001 27391 Write_rows 1 27425 table_id: # flags: STMT_END_F
+master-bin.000001 27425 Table_map 1 27466 table_id: # (test.t1)
+master-bin.000001 27466 Write_rows 1 27500 table_id: # flags: STMT_END_F
+master-bin.000001 27500 Table_map 1 27541 table_id: # (test.t1)
+master-bin.000001 27541 Write_rows 1 27575 table_id: # flags: STMT_END_F
+master-bin.000001 27575 Table_map 1 27616 table_id: # (test.t1)
+master-bin.000001 27616 Write_rows 1 27650 table_id: # flags: STMT_END_F
+master-bin.000001 27650 Table_map 1 27691 table_id: # (test.t1)
+master-bin.000001 27691 Write_rows 1 27725 table_id: # flags: STMT_END_F
+master-bin.000001 27725 Table_map 1 27766 table_id: # (test.t1)
+master-bin.000001 27766 Write_rows 1 27800 table_id: # flags: STMT_END_F
+master-bin.000001 27800 Table_map 1 27841 table_id: # (test.t1)
+master-bin.000001 27841 Write_rows 1 27875 table_id: # flags: STMT_END_F
+master-bin.000001 27875 Table_map 1 27916 table_id: # (test.t1)
+master-bin.000001 27916 Write_rows 1 27950 table_id: # flags: STMT_END_F
+master-bin.000001 27950 Table_map 1 27991 table_id: # (test.t1)
+master-bin.000001 27991 Write_rows 1 28025 table_id: # flags: STMT_END_F
+master-bin.000001 28025 Table_map 1 28066 table_id: # (test.t1)
+master-bin.000001 28066 Write_rows 1 28100 table_id: # flags: STMT_END_F
+master-bin.000001 28100 Table_map 1 28141 table_id: # (test.t1)
+master-bin.000001 28141 Write_rows 1 28175 table_id: # flags: STMT_END_F
+master-bin.000001 28175 Table_map 1 28216 table_id: # (test.t1)
+master-bin.000001 28216 Write_rows 1 28250 table_id: # flags: STMT_END_F
+master-bin.000001 28250 Table_map 1 28291 table_id: # (test.t1)
+master-bin.000001 28291 Write_rows 1 28325 table_id: # flags: STMT_END_F
+master-bin.000001 28325 Table_map 1 28366 table_id: # (test.t1)
+master-bin.000001 28366 Write_rows 1 28400 table_id: # flags: STMT_END_F
+master-bin.000001 28400 Table_map 1 28441 table_id: # (test.t1)
+master-bin.000001 28441 Write_rows 1 28475 table_id: # flags: STMT_END_F
+master-bin.000001 28475 Table_map 1 28516 table_id: # (test.t1)
+master-bin.000001 28516 Write_rows 1 28550 table_id: # flags: STMT_END_F
+master-bin.000001 28550 Table_map 1 28591 table_id: # (test.t1)
+master-bin.000001 28591 Write_rows 1 28625 table_id: # flags: STMT_END_F
+master-bin.000001 28625 Table_map 1 28666 table_id: # (test.t1)
+master-bin.000001 28666 Write_rows 1 28700 table_id: # flags: STMT_END_F
+master-bin.000001 28700 Table_map 1 28741 table_id: # (test.t1)
+master-bin.000001 28741 Write_rows 1 28775 table_id: # flags: STMT_END_F
+master-bin.000001 28775 Table_map 1 28816 table_id: # (test.t1)
+master-bin.000001 28816 Write_rows 1 28850 table_id: # flags: STMT_END_F
+master-bin.000001 28850 Table_map 1 28891 table_id: # (test.t1)
+master-bin.000001 28891 Write_rows 1 28925 table_id: # flags: STMT_END_F
+master-bin.000001 28925 Table_map 1 28966 table_id: # (test.t1)
+master-bin.000001 28966 Write_rows 1 29000 table_id: # flags: STMT_END_F
+master-bin.000001 29000 Table_map 1 29041 table_id: # (test.t1)
+master-bin.000001 29041 Write_rows 1 29075 table_id: # flags: STMT_END_F
+master-bin.000001 29075 Table_map 1 29116 table_id: # (test.t1)
+master-bin.000001 29116 Write_rows 1 29150 table_id: # flags: STMT_END_F
+master-bin.000001 29150 Table_map 1 29191 table_id: # (test.t1)
+master-bin.000001 29191 Write_rows 1 29225 table_id: # flags: STMT_END_F
+master-bin.000001 29225 Table_map 1 29266 table_id: # (test.t1)
+master-bin.000001 29266 Write_rows 1 29300 table_id: # flags: STMT_END_F
+master-bin.000001 29300 Table_map 1 29341 table_id: # (test.t1)
+master-bin.000001 29341 Write_rows 1 29375 table_id: # flags: STMT_END_F
+master-bin.000001 29375 Table_map 1 29416 table_id: # (test.t1)
+master-bin.000001 29416 Write_rows 1 29450 table_id: # flags: STMT_END_F
+master-bin.000001 29450 Table_map 1 29491 table_id: # (test.t1)
+master-bin.000001 29491 Write_rows 1 29525 table_id: # flags: STMT_END_F
+master-bin.000001 29525 Table_map 1 29566 table_id: # (test.t1)
+master-bin.000001 29566 Write_rows 1 29600 table_id: # flags: STMT_END_F
+master-bin.000001 29600 Table_map 1 29641 table_id: # (test.t1)
+master-bin.000001 29641 Write_rows 1 29675 table_id: # flags: STMT_END_F
+master-bin.000001 29675 Table_map 1 29716 table_id: # (test.t1)
+master-bin.000001 29716 Write_rows 1 29750 table_id: # flags: STMT_END_F
+master-bin.000001 29750 Table_map 1 29791 table_id: # (test.t1)
+master-bin.000001 29791 Write_rows 1 29825 table_id: # flags: STMT_END_F
+master-bin.000001 29825 Table_map 1 29866 table_id: # (test.t1)
+master-bin.000001 29866 Write_rows 1 29900 table_id: # flags: STMT_END_F
+master-bin.000001 29900 Table_map 1 29941 table_id: # (test.t1)
+master-bin.000001 29941 Write_rows 1 29975 table_id: # flags: STMT_END_F
+master-bin.000001 29975 Table_map 1 30016 table_id: # (test.t1)
+master-bin.000001 30016 Write_rows 1 30050 table_id: # flags: STMT_END_F
+master-bin.000001 30050 Table_map 1 30091 table_id: # (test.t1)
+master-bin.000001 30091 Write_rows 1 30125 table_id: # flags: STMT_END_F
+master-bin.000001 30125 Table_map 1 30166 table_id: # (test.t1)
+master-bin.000001 30166 Write_rows 1 30200 table_id: # flags: STMT_END_F
+master-bin.000001 30200 Table_map 1 30241 table_id: # (test.t1)
+master-bin.000001 30241 Write_rows 1 30275 table_id: # flags: STMT_END_F
+master-bin.000001 30275 Xid 1 30302 COMMIT /* XID */
+master-bin.000001 30302 Rotate 1 30346 master-bin.000002;pos=4
drop table t1;
set global binlog_cache_size=@bcs;
set session autocommit = @ac;
@@ -1083,13 +1083,13 @@ deallocate prepare stmt;
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
-master-bin.000001 106 Query 1 227 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
-master-bin.000001 227 Query 1 295 BEGIN
-master-bin.000001 295 Table_map 1 337 table_id: # (test.t1)
-master-bin.000001 337 Write_rows 1 383 table_id: # flags: STMT_END_F
-master-bin.000001 383 Query 1 452 COMMIT
-master-bin.000001 452 Query 1 528 use `test`; drop table t1
+master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4
+master-bin.000001 107 Query 1 228 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
+master-bin.000001 228 Query 1 296 BEGIN
+master-bin.000001 296 Table_map 1 338 table_id: # (test.t1)
+master-bin.000001 338 Write_rows 1 384 table_id: # flags: STMT_END_F
+master-bin.000001 384 Query 1 453 COMMIT
+master-bin.000001 453 Query 1 529 use `test`; drop table t1
reset master;
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE bug39182;
@@ -1289,14 +1289,14 @@ drop table if exists t3;
create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 346
+master-bin.000001 347
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
show master status /* must show new binlog index after rotating */;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000002 106
+master-bin.000002 107
drop table t3;
#
# Bug #45998: database crashes when running "create as select"
diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
index eebcfceaa25..c5ac0a726ba 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
@@ -4,11 +4,11 @@ insert into t1 values (1,2);
commit;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server ver: #, Binlog ver: #
-master-bin.000001 106 Query 1 213 use `test`; create table t1 (a int, b int) engine=innodb
-master-bin.000001 213 Query 1 281 BEGIN
-master-bin.000001 281 Query 1 371 use `test`; insert into t1 values (1,2)
-master-bin.000001 371 Xid 1 398 COMMIT /* XID */
+master-bin.000001 4 Format_desc 1 107 Server ver: #, Binlog ver: #
+master-bin.000001 107 Query 1 214 use `test`; create table t1 (a int, b int) engine=innodb
+master-bin.000001 214 Query 1 282 BEGIN
+master-bin.000001 282 Query 1 372 use `test`; insert into t1 values (1,2)
+master-bin.000001 372 Xid 1 399 COMMIT /* XID */
drop table t1;
drop table if exists t1, t2;
reset master;
@@ -36,7 +36,7 @@ create table t1 (n int) engine=innodb;
begin;
commit;
drop table t1;
-show binlog events in 'master-bin.000001' from 106;
+show binlog events in 'master-bin.000001' from 107;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb
master-bin.000001 # Query 1 # BEGIN
@@ -142,7 +142,7 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values(2 + 4)
master-bin.000001 # Query 1 # use `test`; insert into t1 values(1 + 4)
master-bin.000001 # Xid 1 # COMMIT /* xid= */
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
-show binlog events in 'master-bin.000002' from 106;
+show binlog events in 'master-bin.000002' from 107;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Query 1 # use `test`; drop table t1
set @ac = @@autocommit;
@@ -157,425 +157,425 @@ commit;
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
-master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb
-master-bin.000001 205 Query 1 273 BEGIN
-master-bin.000001 273 Query 1 361 use `test`; insert into t1 values (1)
-master-bin.000001 361 Query 1 449 use `test`; insert into t1 values (2)
-master-bin.000001 449 Query 1 537 use `test`; insert into t1 values (3)
-master-bin.000001 537 Xid 1 564 COMMIT /* XID */
-master-bin.000001 564 Query 1 640 use `test`; drop table t1
+master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4
+master-bin.000001 107 Query 1 206 use `test`; create table t1(n int) engine=innodb
+master-bin.000001 206 Query 1 274 BEGIN
+master-bin.000001 274 Query 1 362 use `test`; insert into t1 values (1)
+master-bin.000001 362 Query 1 450 use `test`; insert into t1 values (2)
+master-bin.000001 450 Query 1 538 use `test`; insert into t1 values (3)
+master-bin.000001 538 Xid 1 565 COMMIT /* XID */
+master-bin.000001 565 Query 1 641 use `test`; drop table t1
set @bcs = @@binlog_cache_size;
set global binlog_cache_size=4096;
reset master;
create table t1 (a int) engine=innodb;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
-master-bin.000001 106 Query 1 206 use `test`; create table t1 (a int) engine=innodb
-master-bin.000001 206 Query 1 274 BEGIN
-master-bin.000001 274 Query 1 365 use `test`; insert into t1 values( 400 )
-master-bin.000001 365 Query 1 456 use `test`; insert into t1 values( 399 )
-master-bin.000001 456 Query 1 547 use `test`; insert into t1 values( 398 )
-master-bin.000001 547 Query 1 638 use `test`; insert into t1 values( 397 )
-master-bin.000001 638 Query 1 729 use `test`; insert into t1 values( 396 )
-master-bin.000001 729 Query 1 820 use `test`; insert into t1 values( 395 )
-master-bin.000001 820 Query 1 911 use `test`; insert into t1 values( 394 )
-master-bin.000001 911 Query 1 1002 use `test`; insert into t1 values( 393 )
-master-bin.000001 1002 Query 1 1093 use `test`; insert into t1 values( 392 )
-master-bin.000001 1093 Query 1 1184 use `test`; insert into t1 values( 391 )
-master-bin.000001 1184 Query 1 1275 use `test`; insert into t1 values( 390 )
-master-bin.000001 1275 Query 1 1366 use `test`; insert into t1 values( 389 )
-master-bin.000001 1366 Query 1 1457 use `test`; insert into t1 values( 388 )
-master-bin.000001 1457 Query 1 1548 use `test`; insert into t1 values( 387 )
-master-bin.000001 1548 Query 1 1639 use `test`; insert into t1 values( 386 )
-master-bin.000001 1639 Query 1 1730 use `test`; insert into t1 values( 385 )
-master-bin.000001 1730 Query 1 1821 use `test`; insert into t1 values( 384 )
-master-bin.000001 1821 Query 1 1912 use `test`; insert into t1 values( 383 )
-master-bin.000001 1912 Query 1 2003 use `test`; insert into t1 values( 382 )
-master-bin.000001 2003 Query 1 2094 use `test`; insert into t1 values( 381 )
-master-bin.000001 2094 Query 1 2185 use `test`; insert into t1 values( 380 )
-master-bin.000001 2185 Query 1 2276 use `test`; insert into t1 values( 379 )
-master-bin.000001 2276 Query 1 2367 use `test`; insert into t1 values( 378 )
-master-bin.000001 2367 Query 1 2458 use `test`; insert into t1 values( 377 )
-master-bin.000001 2458 Query 1 2549 use `test`; insert into t1 values( 376 )
-master-bin.000001 2549 Query 1 2640 use `test`; insert into t1 values( 375 )
-master-bin.000001 2640 Query 1 2731 use `test`; insert into t1 values( 374 )
-master-bin.000001 2731 Query 1 2822 use `test`; insert into t1 values( 373 )
-master-bin.000001 2822 Query 1 2913 use `test`; insert into t1 values( 372 )
-master-bin.000001 2913 Query 1 3004 use `test`; insert into t1 values( 371 )
-master-bin.000001 3004 Query 1 3095 use `test`; insert into t1 values( 370 )
-master-bin.000001 3095 Query 1 3186 use `test`; insert into t1 values( 369 )
-master-bin.000001 3186 Query 1 3277 use `test`; insert into t1 values( 368 )
-master-bin.000001 3277 Query 1 3368 use `test`; insert into t1 values( 367 )
-master-bin.000001 3368 Query 1 3459 use `test`; insert into t1 values( 366 )
-master-bin.000001 3459 Query 1 3550 use `test`; insert into t1 values( 365 )
-master-bin.000001 3550 Query 1 3641 use `test`; insert into t1 values( 364 )
-master-bin.000001 3641 Query 1 3732 use `test`; insert into t1 values( 363 )
-master-bin.000001 3732 Query 1 3823 use `test`; insert into t1 values( 362 )
-master-bin.000001 3823 Query 1 3914 use `test`; insert into t1 values( 361 )
-master-bin.000001 3914 Query 1 4005 use `test`; insert into t1 values( 360 )
-master-bin.000001 4005 Query 1 4096 use `test`; insert into t1 values( 359 )
-master-bin.000001 4096 Query 1 4187 use `test`; insert into t1 values( 358 )
-master-bin.000001 4187 Query 1 4278 use `test`; insert into t1 values( 357 )
-master-bin.000001 4278 Query 1 4369 use `test`; insert into t1 values( 356 )
-master-bin.000001 4369 Query 1 4460 use `test`; insert into t1 values( 355 )
-master-bin.000001 4460 Query 1 4551 use `test`; insert into t1 values( 354 )
-master-bin.000001 4551 Query 1 4642 use `test`; insert into t1 values( 353 )
-master-bin.000001 4642 Query 1 4733 use `test`; insert into t1 values( 352 )
-master-bin.000001 4733 Query 1 4824 use `test`; insert into t1 values( 351 )
-master-bin.000001 4824 Query 1 4915 use `test`; insert into t1 values( 350 )
-master-bin.000001 4915 Query 1 5006 use `test`; insert into t1 values( 349 )
-master-bin.000001 5006 Query 1 5097 use `test`; insert into t1 values( 348 )
-master-bin.000001 5097 Query 1 5188 use `test`; insert into t1 values( 347 )
-master-bin.000001 5188 Query 1 5279 use `test`; insert into t1 values( 346 )
-master-bin.000001 5279 Query 1 5370 use `test`; insert into t1 values( 345 )
-master-bin.000001 5370 Query 1 5461 use `test`; insert into t1 values( 344 )
-master-bin.000001 5461 Query 1 5552 use `test`; insert into t1 values( 343 )
-master-bin.000001 5552 Query 1 5643 use `test`; insert into t1 values( 342 )
-master-bin.000001 5643 Query 1 5734 use `test`; insert into t1 values( 341 )
-master-bin.000001 5734 Query 1 5825 use `test`; insert into t1 values( 340 )
-master-bin.000001 5825 Query 1 5916 use `test`; insert into t1 values( 339 )
-master-bin.000001 5916 Query 1 6007 use `test`; insert into t1 values( 338 )
-master-bin.000001 6007 Query 1 6098 use `test`; insert into t1 values( 337 )
-master-bin.000001 6098 Query 1 6189 use `test`; insert into t1 values( 336 )
-master-bin.000001 6189 Query 1 6280 use `test`; insert into t1 values( 335 )
-master-bin.000001 6280 Query 1 6371 use `test`; insert into t1 values( 334 )
-master-bin.000001 6371 Query 1 6462 use `test`; insert into t1 values( 333 )
-master-bin.000001 6462 Query 1 6553 use `test`; insert into t1 values( 332 )
-master-bin.000001 6553 Query 1 6644 use `test`; insert into t1 values( 331 )
-master-bin.000001 6644 Query 1 6735 use `test`; insert into t1 values( 330 )
-master-bin.000001 6735 Query 1 6826 use `test`; insert into t1 values( 329 )
-master-bin.000001 6826 Query 1 6917 use `test`; insert into t1 values( 328 )
-master-bin.000001 6917 Query 1 7008 use `test`; insert into t1 values( 327 )
-master-bin.000001 7008 Query 1 7099 use `test`; insert into t1 values( 326 )
-master-bin.000001 7099 Query 1 7190 use `test`; insert into t1 values( 325 )
-master-bin.000001 7190 Query 1 7281 use `test`; insert into t1 values( 324 )
-master-bin.000001 7281 Query 1 7372 use `test`; insert into t1 values( 323 )
-master-bin.000001 7372 Query 1 7463 use `test`; insert into t1 values( 322 )
-master-bin.000001 7463 Query 1 7554 use `test`; insert into t1 values( 321 )
-master-bin.000001 7554 Query 1 7645 use `test`; insert into t1 values( 320 )
-master-bin.000001 7645 Query 1 7736 use `test`; insert into t1 values( 319 )
-master-bin.000001 7736 Query 1 7827 use `test`; insert into t1 values( 318 )
-master-bin.000001 7827 Query 1 7918 use `test`; insert into t1 values( 317 )
-master-bin.000001 7918 Query 1 8009 use `test`; insert into t1 values( 316 )
-master-bin.000001 8009 Query 1 8100 use `test`; insert into t1 values( 315 )
-master-bin.000001 8100 Query 1 8191 use `test`; insert into t1 values( 314 )
-master-bin.000001 8191 Query 1 8282 use `test`; insert into t1 values( 313 )
-master-bin.000001 8282 Query 1 8373 use `test`; insert into t1 values( 312 )
-master-bin.000001 8373 Query 1 8464 use `test`; insert into t1 values( 311 )
-master-bin.000001 8464 Query 1 8555 use `test`; insert into t1 values( 310 )
-master-bin.000001 8555 Query 1 8646 use `test`; insert into t1 values( 309 )
-master-bin.000001 8646 Query 1 8737 use `test`; insert into t1 values( 308 )
-master-bin.000001 8737 Query 1 8828 use `test`; insert into t1 values( 307 )
-master-bin.000001 8828 Query 1 8919 use `test`; insert into t1 values( 306 )
-master-bin.000001 8919 Query 1 9010 use `test`; insert into t1 values( 305 )
-master-bin.000001 9010 Query 1 9101 use `test`; insert into t1 values( 304 )
-master-bin.000001 9101 Query 1 9192 use `test`; insert into t1 values( 303 )
-master-bin.000001 9192 Query 1 9283 use `test`; insert into t1 values( 302 )
-master-bin.000001 9283 Query 1 9374 use `test`; insert into t1 values( 301 )
-master-bin.000001 9374 Query 1 9465 use `test`; insert into t1 values( 300 )
-master-bin.000001 9465 Query 1 9556 use `test`; insert into t1 values( 299 )
-master-bin.000001 9556 Query 1 9647 use `test`; insert into t1 values( 298 )
-master-bin.000001 9647 Query 1 9738 use `test`; insert into t1 values( 297 )
-master-bin.000001 9738 Query 1 9829 use `test`; insert into t1 values( 296 )
-master-bin.000001 9829 Query 1 9920 use `test`; insert into t1 values( 295 )
-master-bin.000001 9920 Query 1 10011 use `test`; insert into t1 values( 294 )
-master-bin.000001 10011 Query 1 10102 use `test`; insert into t1 values( 293 )
-master-bin.000001 10102 Query 1 10193 use `test`; insert into t1 values( 292 )
-master-bin.000001 10193 Query 1 10284 use `test`; insert into t1 values( 291 )
-master-bin.000001 10284 Query 1 10375 use `test`; insert into t1 values( 290 )
-master-bin.000001 10375 Query 1 10466 use `test`; insert into t1 values( 289 )
-master-bin.000001 10466 Query 1 10557 use `test`; insert into t1 values( 288 )
-master-bin.000001 10557 Query 1 10648 use `test`; insert into t1 values( 287 )
-master-bin.000001 10648 Query 1 10739 use `test`; insert into t1 values( 286 )
-master-bin.000001 10739 Query 1 10830 use `test`; insert into t1 values( 285 )
-master-bin.000001 10830 Query 1 10921 use `test`; insert into t1 values( 284 )
-master-bin.000001 10921 Query 1 11012 use `test`; insert into t1 values( 283 )
-master-bin.000001 11012 Query 1 11103 use `test`; insert into t1 values( 282 )
-master-bin.000001 11103 Query 1 11194 use `test`; insert into t1 values( 281 )
-master-bin.000001 11194 Query 1 11285 use `test`; insert into t1 values( 280 )
-master-bin.000001 11285 Query 1 11376 use `test`; insert into t1 values( 279 )
-master-bin.000001 11376 Query 1 11467 use `test`; insert into t1 values( 278 )
-master-bin.000001 11467 Query 1 11558 use `test`; insert into t1 values( 277 )
-master-bin.000001 11558 Query 1 11649 use `test`; insert into t1 values( 276 )
-master-bin.000001 11649 Query 1 11740 use `test`; insert into t1 values( 275 )
-master-bin.000001 11740 Query 1 11831 use `test`; insert into t1 values( 274 )
-master-bin.000001 11831 Query 1 11922 use `test`; insert into t1 values( 273 )
-master-bin.000001 11922 Query 1 12013 use `test`; insert into t1 values( 272 )
-master-bin.000001 12013 Query 1 12104 use `test`; insert into t1 values( 271 )
-master-bin.000001 12104 Query 1 12195 use `test`; insert into t1 values( 270 )
-master-bin.000001 12195 Query 1 12286 use `test`; insert into t1 values( 269 )
-master-bin.000001 12286 Query 1 12377 use `test`; insert into t1 values( 268 )
-master-bin.000001 12377 Query 1 12468 use `test`; insert into t1 values( 267 )
-master-bin.000001 12468 Query 1 12559 use `test`; insert into t1 values( 266 )
-master-bin.000001 12559 Query 1 12650 use `test`; insert into t1 values( 265 )
-master-bin.000001 12650 Query 1 12741 use `test`; insert into t1 values( 264 )
-master-bin.000001 12741 Query 1 12832 use `test`; insert into t1 values( 263 )
-master-bin.000001 12832 Query 1 12923 use `test`; insert into t1 values( 262 )
-master-bin.000001 12923 Query 1 13014 use `test`; insert into t1 values( 261 )
-master-bin.000001 13014 Query 1 13105 use `test`; insert into t1 values( 260 )
-master-bin.000001 13105 Query 1 13196 use `test`; insert into t1 values( 259 )
-master-bin.000001 13196 Query 1 13287 use `test`; insert into t1 values( 258 )
-master-bin.000001 13287 Query 1 13378 use `test`; insert into t1 values( 257 )
-master-bin.000001 13378 Query 1 13469 use `test`; insert into t1 values( 256 )
-master-bin.000001 13469 Query 1 13560 use `test`; insert into t1 values( 255 )
-master-bin.000001 13560 Query 1 13651 use `test`; insert into t1 values( 254 )
-master-bin.000001 13651 Query 1 13742 use `test`; insert into t1 values( 253 )
-master-bin.000001 13742 Query 1 13833 use `test`; insert into t1 values( 252 )
-master-bin.000001 13833 Query 1 13924 use `test`; insert into t1 values( 251 )
-master-bin.000001 13924 Query 1 14015 use `test`; insert into t1 values( 250 )
-master-bin.000001 14015 Query 1 14106 use `test`; insert into t1 values( 249 )
-master-bin.000001 14106 Query 1 14197 use `test`; insert into t1 values( 248 )
-master-bin.000001 14197 Query 1 14288 use `test`; insert into t1 values( 247 )
-master-bin.000001 14288 Query 1 14379 use `test`; insert into t1 values( 246 )
-master-bin.000001 14379 Query 1 14470 use `test`; insert into t1 values( 245 )
-master-bin.000001 14470 Query 1 14561 use `test`; insert into t1 values( 244 )
-master-bin.000001 14561 Query 1 14652 use `test`; insert into t1 values( 243 )
-master-bin.000001 14652 Query 1 14743 use `test`; insert into t1 values( 242 )
-master-bin.000001 14743 Query 1 14834 use `test`; insert into t1 values( 241 )
-master-bin.000001 14834 Query 1 14925 use `test`; insert into t1 values( 240 )
-master-bin.000001 14925 Query 1 15016 use `test`; insert into t1 values( 239 )
-master-bin.000001 15016 Query 1 15107 use `test`; insert into t1 values( 238 )
-master-bin.000001 15107 Query 1 15198 use `test`; insert into t1 values( 237 )
-master-bin.000001 15198 Query 1 15289 use `test`; insert into t1 values( 236 )
-master-bin.000001 15289 Query 1 15380 use `test`; insert into t1 values( 235 )
-master-bin.000001 15380 Query 1 15471 use `test`; insert into t1 values( 234 )
-master-bin.000001 15471 Query 1 15562 use `test`; insert into t1 values( 233 )
-master-bin.000001 15562 Query 1 15653 use `test`; insert into t1 values( 232 )
-master-bin.000001 15653 Query 1 15744 use `test`; insert into t1 values( 231 )
-master-bin.000001 15744 Query 1 15835 use `test`; insert into t1 values( 230 )
-master-bin.000001 15835 Query 1 15926 use `test`; insert into t1 values( 229 )
-master-bin.000001 15926 Query 1 16017 use `test`; insert into t1 values( 228 )
-master-bin.000001 16017 Query 1 16108 use `test`; insert into t1 values( 227 )
-master-bin.000001 16108 Query 1 16199 use `test`; insert into t1 values( 226 )
-master-bin.000001 16199 Query 1 16290 use `test`; insert into t1 values( 225 )
-master-bin.000001 16290 Query 1 16381 use `test`; insert into t1 values( 224 )
-master-bin.000001 16381 Query 1 16472 use `test`; insert into t1 values( 223 )
-master-bin.000001 16472 Query 1 16563 use `test`; insert into t1 values( 222 )
-master-bin.000001 16563 Query 1 16654 use `test`; insert into t1 values( 221 )
-master-bin.000001 16654 Query 1 16745 use `test`; insert into t1 values( 220 )
-master-bin.000001 16745 Query 1 16836 use `test`; insert into t1 values( 219 )
-master-bin.000001 16836 Query 1 16927 use `test`; insert into t1 values( 218 )
-master-bin.000001 16927 Query 1 17018 use `test`; insert into t1 values( 217 )
-master-bin.000001 17018 Query 1 17109 use `test`; insert into t1 values( 216 )
-master-bin.000001 17109 Query 1 17200 use `test`; insert into t1 values( 215 )
-master-bin.000001 17200 Query 1 17291 use `test`; insert into t1 values( 214 )
-master-bin.000001 17291 Query 1 17382 use `test`; insert into t1 values( 213 )
-master-bin.000001 17382 Query 1 17473 use `test`; insert into t1 values( 212 )
-master-bin.000001 17473 Query 1 17564 use `test`; insert into t1 values( 211 )
-master-bin.000001 17564 Query 1 17655 use `test`; insert into t1 values( 210 )
-master-bin.000001 17655 Query 1 17746 use `test`; insert into t1 values( 209 )
-master-bin.000001 17746 Query 1 17837 use `test`; insert into t1 values( 208 )
-master-bin.000001 17837 Query 1 17928 use `test`; insert into t1 values( 207 )
-master-bin.000001 17928 Query 1 18019 use `test`; insert into t1 values( 206 )
-master-bin.000001 18019 Query 1 18110 use `test`; insert into t1 values( 205 )
-master-bin.000001 18110 Query 1 18201 use `test`; insert into t1 values( 204 )
-master-bin.000001 18201 Query 1 18292 use `test`; insert into t1 values( 203 )
-master-bin.000001 18292 Query 1 18383 use `test`; insert into t1 values( 202 )
-master-bin.000001 18383 Query 1 18474 use `test`; insert into t1 values( 201 )
-master-bin.000001 18474 Query 1 18565 use `test`; insert into t1 values( 200 )
-master-bin.000001 18565 Query 1 18656 use `test`; insert into t1 values( 199 )
-master-bin.000001 18656 Query 1 18747 use `test`; insert into t1 values( 198 )
-master-bin.000001 18747 Query 1 18838 use `test`; insert into t1 values( 197 )
-master-bin.000001 18838 Query 1 18929 use `test`; insert into t1 values( 196 )
-master-bin.000001 18929 Query 1 19020 use `test`; insert into t1 values( 195 )
-master-bin.000001 19020 Query 1 19111 use `test`; insert into t1 values( 194 )
-master-bin.000001 19111 Query 1 19202 use `test`; insert into t1 values( 193 )
-master-bin.000001 19202 Query 1 19293 use `test`; insert into t1 values( 192 )
-master-bin.000001 19293 Query 1 19384 use `test`; insert into t1 values( 191 )
-master-bin.000001 19384 Query 1 19475 use `test`; insert into t1 values( 190 )
-master-bin.000001 19475 Query 1 19566 use `test`; insert into t1 values( 189 )
-master-bin.000001 19566 Query 1 19657 use `test`; insert into t1 values( 188 )
-master-bin.000001 19657 Query 1 19748 use `test`; insert into t1 values( 187 )
-master-bin.000001 19748 Query 1 19839 use `test`; insert into t1 values( 186 )
-master-bin.000001 19839 Query 1 19930 use `test`; insert into t1 values( 185 )
-master-bin.000001 19930 Query 1 20021 use `test`; insert into t1 values( 184 )
-master-bin.000001 20021 Query 1 20112 use `test`; insert into t1 values( 183 )
-master-bin.000001 20112 Query 1 20203 use `test`; insert into t1 values( 182 )
-master-bin.000001 20203 Query 1 20294 use `test`; insert into t1 values( 181 )
-master-bin.000001 20294 Query 1 20385 use `test`; insert into t1 values( 180 )
-master-bin.000001 20385 Query 1 20476 use `test`; insert into t1 values( 179 )
-master-bin.000001 20476 Query 1 20567 use `test`; insert into t1 values( 178 )
-master-bin.000001 20567 Query 1 20658 use `test`; insert into t1 values( 177 )
-master-bin.000001 20658 Query 1 20749 use `test`; insert into t1 values( 176 )
-master-bin.000001 20749 Query 1 20840 use `test`; insert into t1 values( 175 )
-master-bin.000001 20840 Query 1 20931 use `test`; insert into t1 values( 174 )
-master-bin.000001 20931 Query 1 21022 use `test`; insert into t1 values( 173 )
-master-bin.000001 21022 Query 1 21113 use `test`; insert into t1 values( 172 )
-master-bin.000001 21113 Query 1 21204 use `test`; insert into t1 values( 171 )
-master-bin.000001 21204 Query 1 21295 use `test`; insert into t1 values( 170 )
-master-bin.000001 21295 Query 1 21386 use `test`; insert into t1 values( 169 )
-master-bin.000001 21386 Query 1 21477 use `test`; insert into t1 values( 168 )
-master-bin.000001 21477 Query 1 21568 use `test`; insert into t1 values( 167 )
-master-bin.000001 21568 Query 1 21659 use `test`; insert into t1 values( 166 )
-master-bin.000001 21659 Query 1 21750 use `test`; insert into t1 values( 165 )
-master-bin.000001 21750 Query 1 21841 use `test`; insert into t1 values( 164 )
-master-bin.000001 21841 Query 1 21932 use `test`; insert into t1 values( 163 )
-master-bin.000001 21932 Query 1 22023 use `test`; insert into t1 values( 162 )
-master-bin.000001 22023 Query 1 22114 use `test`; insert into t1 values( 161 )
-master-bin.000001 22114 Query 1 22205 use `test`; insert into t1 values( 160 )
-master-bin.000001 22205 Query 1 22296 use `test`; insert into t1 values( 159 )
-master-bin.000001 22296 Query 1 22387 use `test`; insert into t1 values( 158 )
-master-bin.000001 22387 Query 1 22478 use `test`; insert into t1 values( 157 )
-master-bin.000001 22478 Query 1 22569 use `test`; insert into t1 values( 156 )
-master-bin.000001 22569 Query 1 22660 use `test`; insert into t1 values( 155 )
-master-bin.000001 22660 Query 1 22751 use `test`; insert into t1 values( 154 )
-master-bin.000001 22751 Query 1 22842 use `test`; insert into t1 values( 153 )
-master-bin.000001 22842 Query 1 22933 use `test`; insert into t1 values( 152 )
-master-bin.000001 22933 Query 1 23024 use `test`; insert into t1 values( 151 )
-master-bin.000001 23024 Query 1 23115 use `test`; insert into t1 values( 150 )
-master-bin.000001 23115 Query 1 23206 use `test`; insert into t1 values( 149 )
-master-bin.000001 23206 Query 1 23297 use `test`; insert into t1 values( 148 )
-master-bin.000001 23297 Query 1 23388 use `test`; insert into t1 values( 147 )
-master-bin.000001 23388 Query 1 23479 use `test`; insert into t1 values( 146 )
-master-bin.000001 23479 Query 1 23570 use `test`; insert into t1 values( 145 )
-master-bin.000001 23570 Query 1 23661 use `test`; insert into t1 values( 144 )
-master-bin.000001 23661 Query 1 23752 use `test`; insert into t1 values( 143 )
-master-bin.000001 23752 Query 1 23843 use `test`; insert into t1 values( 142 )
-master-bin.000001 23843 Query 1 23934 use `test`; insert into t1 values( 141 )
-master-bin.000001 23934 Query 1 24025 use `test`; insert into t1 values( 140 )
-master-bin.000001 24025 Query 1 24116 use `test`; insert into t1 values( 139 )
-master-bin.000001 24116 Query 1 24207 use `test`; insert into t1 values( 138 )
-master-bin.000001 24207 Query 1 24298 use `test`; insert into t1 values( 137 )
-master-bin.000001 24298 Query 1 24389 use `test`; insert into t1 values( 136 )
-master-bin.000001 24389 Query 1 24480 use `test`; insert into t1 values( 135 )
-master-bin.000001 24480 Query 1 24571 use `test`; insert into t1 values( 134 )
-master-bin.000001 24571 Query 1 24662 use `test`; insert into t1 values( 133 )
-master-bin.000001 24662 Query 1 24753 use `test`; insert into t1 values( 132 )
-master-bin.000001 24753 Query 1 24844 use `test`; insert into t1 values( 131 )
-master-bin.000001 24844 Query 1 24935 use `test`; insert into t1 values( 130 )
-master-bin.000001 24935 Query 1 25026 use `test`; insert into t1 values( 129 )
-master-bin.000001 25026 Query 1 25117 use `test`; insert into t1 values( 128 )
-master-bin.000001 25117 Query 1 25208 use `test`; insert into t1 values( 127 )
-master-bin.000001 25208 Query 1 25299 use `test`; insert into t1 values( 126 )
-master-bin.000001 25299 Query 1 25390 use `test`; insert into t1 values( 125 )
-master-bin.000001 25390 Query 1 25481 use `test`; insert into t1 values( 124 )
-master-bin.000001 25481 Query 1 25572 use `test`; insert into t1 values( 123 )
-master-bin.000001 25572 Query 1 25663 use `test`; insert into t1 values( 122 )
-master-bin.000001 25663 Query 1 25754 use `test`; insert into t1 values( 121 )
-master-bin.000001 25754 Query 1 25845 use `test`; insert into t1 values( 120 )
-master-bin.000001 25845 Query 1 25936 use `test`; insert into t1 values( 119 )
-master-bin.000001 25936 Query 1 26027 use `test`; insert into t1 values( 118 )
-master-bin.000001 26027 Query 1 26118 use `test`; insert into t1 values( 117 )
-master-bin.000001 26118 Query 1 26209 use `test`; insert into t1 values( 116 )
-master-bin.000001 26209 Query 1 26300 use `test`; insert into t1 values( 115 )
-master-bin.000001 26300 Query 1 26391 use `test`; insert into t1 values( 114 )
-master-bin.000001 26391 Query 1 26482 use `test`; insert into t1 values( 113 )
-master-bin.000001 26482 Query 1 26573 use `test`; insert into t1 values( 112 )
-master-bin.000001 26573 Query 1 26664 use `test`; insert into t1 values( 111 )
-master-bin.000001 26664 Query 1 26755 use `test`; insert into t1 values( 110 )
-master-bin.000001 26755 Query 1 26846 use `test`; insert into t1 values( 109 )
-master-bin.000001 26846 Query 1 26937 use `test`; insert into t1 values( 108 )
-master-bin.000001 26937 Query 1 27028 use `test`; insert into t1 values( 107 )
-master-bin.000001 27028 Query 1 27119 use `test`; insert into t1 values( 106 )
-master-bin.000001 27119 Query 1 27210 use `test`; insert into t1 values( 105 )
-master-bin.000001 27210 Query 1 27301 use `test`; insert into t1 values( 104 )
-master-bin.000001 27301 Query 1 27392 use `test`; insert into t1 values( 103 )
-master-bin.000001 27392 Query 1 27483 use `test`; insert into t1 values( 102 )
-master-bin.000001 27483 Query 1 27574 use `test`; insert into t1 values( 101 )
-master-bin.000001 27574 Query 1 27665 use `test`; insert into t1 values( 100 )
-master-bin.000001 27665 Query 1 27755 use `test`; insert into t1 values( 99 )
-master-bin.000001 27755 Query 1 27845 use `test`; insert into t1 values( 98 )
-master-bin.000001 27845 Query 1 27935 use `test`; insert into t1 values( 97 )
-master-bin.000001 27935 Query 1 28025 use `test`; insert into t1 values( 96 )
-master-bin.000001 28025 Query 1 28115 use `test`; insert into t1 values( 95 )
-master-bin.000001 28115 Query 1 28205 use `test`; insert into t1 values( 94 )
-master-bin.000001 28205 Query 1 28295 use `test`; insert into t1 values( 93 )
-master-bin.000001 28295 Query 1 28385 use `test`; insert into t1 values( 92 )
-master-bin.000001 28385 Query 1 28475 use `test`; insert into t1 values( 91 )
-master-bin.000001 28475 Query 1 28565 use `test`; insert into t1 values( 90 )
-master-bin.000001 28565 Query 1 28655 use `test`; insert into t1 values( 89 )
-master-bin.000001 28655 Query 1 28745 use `test`; insert into t1 values( 88 )
-master-bin.000001 28745 Query 1 28835 use `test`; insert into t1 values( 87 )
-master-bin.000001 28835 Query 1 28925 use `test`; insert into t1 values( 86 )
-master-bin.000001 28925 Query 1 29015 use `test`; insert into t1 values( 85 )
-master-bin.000001 29015 Query 1 29105 use `test`; insert into t1 values( 84 )
-master-bin.000001 29105 Query 1 29195 use `test`; insert into t1 values( 83 )
-master-bin.000001 29195 Query 1 29285 use `test`; insert into t1 values( 82 )
-master-bin.000001 29285 Query 1 29375 use `test`; insert into t1 values( 81 )
-master-bin.000001 29375 Query 1 29465 use `test`; insert into t1 values( 80 )
-master-bin.000001 29465 Query 1 29555 use `test`; insert into t1 values( 79 )
-master-bin.000001 29555 Query 1 29645 use `test`; insert into t1 values( 78 )
-master-bin.000001 29645 Query 1 29735 use `test`; insert into t1 values( 77 )
-master-bin.000001 29735 Query 1 29825 use `test`; insert into t1 values( 76 )
-master-bin.000001 29825 Query 1 29915 use `test`; insert into t1 values( 75 )
-master-bin.000001 29915 Query 1 30005 use `test`; insert into t1 values( 74 )
-master-bin.000001 30005 Query 1 30095 use `test`; insert into t1 values( 73 )
-master-bin.000001 30095 Query 1 30185 use `test`; insert into t1 values( 72 )
-master-bin.000001 30185 Query 1 30275 use `test`; insert into t1 values( 71 )
-master-bin.000001 30275 Query 1 30365 use `test`; insert into t1 values( 70 )
-master-bin.000001 30365 Query 1 30455 use `test`; insert into t1 values( 69 )
-master-bin.000001 30455 Query 1 30545 use `test`; insert into t1 values( 68 )
-master-bin.000001 30545 Query 1 30635 use `test`; insert into t1 values( 67 )
-master-bin.000001 30635 Query 1 30725 use `test`; insert into t1 values( 66 )
-master-bin.000001 30725 Query 1 30815 use `test`; insert into t1 values( 65 )
-master-bin.000001 30815 Query 1 30905 use `test`; insert into t1 values( 64 )
-master-bin.000001 30905 Query 1 30995 use `test`; insert into t1 values( 63 )
-master-bin.000001 30995 Query 1 31085 use `test`; insert into t1 values( 62 )
-master-bin.000001 31085 Query 1 31175 use `test`; insert into t1 values( 61 )
-master-bin.000001 31175 Query 1 31265 use `test`; insert into t1 values( 60 )
-master-bin.000001 31265 Query 1 31355 use `test`; insert into t1 values( 59 )
-master-bin.000001 31355 Query 1 31445 use `test`; insert into t1 values( 58 )
-master-bin.000001 31445 Query 1 31535 use `test`; insert into t1 values( 57 )
-master-bin.000001 31535 Query 1 31625 use `test`; insert into t1 values( 56 )
-master-bin.000001 31625 Query 1 31715 use `test`; insert into t1 values( 55 )
-master-bin.000001 31715 Query 1 31805 use `test`; insert into t1 values( 54 )
-master-bin.000001 31805 Query 1 31895 use `test`; insert into t1 values( 53 )
-master-bin.000001 31895 Query 1 31985 use `test`; insert into t1 values( 52 )
-master-bin.000001 31985 Query 1 32075 use `test`; insert into t1 values( 51 )
-master-bin.000001 32075 Query 1 32165 use `test`; insert into t1 values( 50 )
-master-bin.000001 32165 Query 1 32255 use `test`; insert into t1 values( 49 )
-master-bin.000001 32255 Query 1 32345 use `test`; insert into t1 values( 48 )
-master-bin.000001 32345 Query 1 32435 use `test`; insert into t1 values( 47 )
-master-bin.000001 32435 Query 1 32525 use `test`; insert into t1 values( 46 )
-master-bin.000001 32525 Query 1 32615 use `test`; insert into t1 values( 45 )
-master-bin.000001 32615 Query 1 32705 use `test`; insert into t1 values( 44 )
-master-bin.000001 32705 Query 1 32795 use `test`; insert into t1 values( 43 )
-master-bin.000001 32795 Query 1 32885 use `test`; insert into t1 values( 42 )
-master-bin.000001 32885 Query 1 32975 use `test`; insert into t1 values( 41 )
-master-bin.000001 32975 Query 1 33065 use `test`; insert into t1 values( 40 )
-master-bin.000001 33065 Query 1 33155 use `test`; insert into t1 values( 39 )
-master-bin.000001 33155 Query 1 33245 use `test`; insert into t1 values( 38 )
-master-bin.000001 33245 Query 1 33335 use `test`; insert into t1 values( 37 )
-master-bin.000001 33335 Query 1 33425 use `test`; insert into t1 values( 36 )
-master-bin.000001 33425 Query 1 33515 use `test`; insert into t1 values( 35 )
-master-bin.000001 33515 Query 1 33605 use `test`; insert into t1 values( 34 )
-master-bin.000001 33605 Query 1 33695 use `test`; insert into t1 values( 33 )
-master-bin.000001 33695 Query 1 33785 use `test`; insert into t1 values( 32 )
-master-bin.000001 33785 Query 1 33875 use `test`; insert into t1 values( 31 )
-master-bin.000001 33875 Query 1 33965 use `test`; insert into t1 values( 30 )
-master-bin.000001 33965 Query 1 34055 use `test`; insert into t1 values( 29 )
-master-bin.000001 34055 Query 1 34145 use `test`; insert into t1 values( 28 )
-master-bin.000001 34145 Query 1 34235 use `test`; insert into t1 values( 27 )
-master-bin.000001 34235 Query 1 34325 use `test`; insert into t1 values( 26 )
-master-bin.000001 34325 Query 1 34415 use `test`; insert into t1 values( 25 )
-master-bin.000001 34415 Query 1 34505 use `test`; insert into t1 values( 24 )
-master-bin.000001 34505 Query 1 34595 use `test`; insert into t1 values( 23 )
-master-bin.000001 34595 Query 1 34685 use `test`; insert into t1 values( 22 )
-master-bin.000001 34685 Query 1 34775 use `test`; insert into t1 values( 21 )
-master-bin.000001 34775 Query 1 34865 use `test`; insert into t1 values( 20 )
-master-bin.000001 34865 Query 1 34955 use `test`; insert into t1 values( 19 )
-master-bin.000001 34955 Query 1 35045 use `test`; insert into t1 values( 18 )
-master-bin.000001 35045 Query 1 35135 use `test`; insert into t1 values( 17 )
-master-bin.000001 35135 Query 1 35225 use `test`; insert into t1 values( 16 )
-master-bin.000001 35225 Query 1 35315 use `test`; insert into t1 values( 15 )
-master-bin.000001 35315 Query 1 35405 use `test`; insert into t1 values( 14 )
-master-bin.000001 35405 Query 1 35495 use `test`; insert into t1 values( 13 )
-master-bin.000001 35495 Query 1 35585 use `test`; insert into t1 values( 12 )
-master-bin.000001 35585 Query 1 35675 use `test`; insert into t1 values( 11 )
-master-bin.000001 35675 Query 1 35765 use `test`; insert into t1 values( 10 )
-master-bin.000001 35765 Query 1 35854 use `test`; insert into t1 values( 9 )
-master-bin.000001 35854 Query 1 35943 use `test`; insert into t1 values( 8 )
-master-bin.000001 35943 Query 1 36032 use `test`; insert into t1 values( 7 )
-master-bin.000001 36032 Query 1 36121 use `test`; insert into t1 values( 6 )
-master-bin.000001 36121 Query 1 36210 use `test`; insert into t1 values( 5 )
-master-bin.000001 36210 Query 1 36299 use `test`; insert into t1 values( 4 )
-master-bin.000001 36299 Query 1 36388 use `test`; insert into t1 values( 3 )
-master-bin.000001 36388 Query 1 36477 use `test`; insert into t1 values( 2 )
-master-bin.000001 36477 Query 1 36566 use `test`; insert into t1 values( 1 )
-master-bin.000001 36566 Xid 1 36593 COMMIT /* XID */
-master-bin.000001 36593 Rotate 1 36637 master-bin.000002;pos=4
+master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4
+master-bin.000001 107 Query 1 207 use `test`; create table t1 (a int) engine=innodb
+master-bin.000001 207 Query 1 275 BEGIN
+master-bin.000001 275 Query 1 366 use `test`; insert into t1 values( 400 )
+master-bin.000001 366 Query 1 457 use `test`; insert into t1 values( 399 )
+master-bin.000001 457 Query 1 548 use `test`; insert into t1 values( 398 )
+master-bin.000001 548 Query 1 639 use `test`; insert into t1 values( 397 )
+master-bin.000001 639 Query 1 730 use `test`; insert into t1 values( 396 )
+master-bin.000001 730 Query 1 821 use `test`; insert into t1 values( 395 )
+master-bin.000001 821 Query 1 912 use `test`; insert into t1 values( 394 )
+master-bin.000001 912 Query 1 1003 use `test`; insert into t1 values( 393 )
+master-bin.000001 1003 Query 1 1094 use `test`; insert into t1 values( 392 )
+master-bin.000001 1094 Query 1 1185 use `test`; insert into t1 values( 391 )
+master-bin.000001 1185 Query 1 1276 use `test`; insert into t1 values( 390 )
+master-bin.000001 1276 Query 1 1367 use `test`; insert into t1 values( 389 )
+master-bin.000001 1367 Query 1 1458 use `test`; insert into t1 values( 388 )
+master-bin.000001 1458 Query 1 1549 use `test`; insert into t1 values( 387 )
+master-bin.000001 1549 Query 1 1640 use `test`; insert into t1 values( 386 )
+master-bin.000001 1640 Query 1 1731 use `test`; insert into t1 values( 385 )
+master-bin.000001 1731 Query 1 1822 use `test`; insert into t1 values( 384 )
+master-bin.000001 1822 Query 1 1913 use `test`; insert into t1 values( 383 )
+master-bin.000001 1913 Query 1 2004 use `test`; insert into t1 values( 382 )
+master-bin.000001 2004 Query 1 2095 use `test`; insert into t1 values( 381 )
+master-bin.000001 2095 Query 1 2186 use `test`; insert into t1 values( 380 )
+master-bin.000001 2186 Query 1 2277 use `test`; insert into t1 values( 379 )
+master-bin.000001 2277 Query 1 2368 use `test`; insert into t1 values( 378 )
+master-bin.000001 2368 Query 1 2459 use `test`; insert into t1 values( 377 )
+master-bin.000001 2459 Query 1 2550 use `test`; insert into t1 values( 376 )
+master-bin.000001 2550 Query 1 2641 use `test`; insert into t1 values( 375 )
+master-bin.000001 2641 Query 1 2732 use `test`; insert into t1 values( 374 )
+master-bin.000001 2732 Query 1 2823 use `test`; insert into t1 values( 373 )
+master-bin.000001 2823 Query 1 2914 use `test`; insert into t1 values( 372 )
+master-bin.000001 2914 Query 1 3005 use `test`; insert into t1 values( 371 )
+master-bin.000001 3005 Query 1 3096 use `test`; insert into t1 values( 370 )
+master-bin.000001 3096 Query 1 3187 use `test`; insert into t1 values( 369 )
+master-bin.000001 3187 Query 1 3278 use `test`; insert into t1 values( 368 )
+master-bin.000001 3278 Query 1 3369 use `test`; insert into t1 values( 367 )
+master-bin.000001 3369 Query 1 3460 use `test`; insert into t1 values( 366 )
+master-bin.000001 3460 Query 1 3551 use `test`; insert into t1 values( 365 )
+master-bin.000001 3551 Query 1 3642 use `test`; insert into t1 values( 364 )
+master-bin.000001 3642 Query 1 3733 use `test`; insert into t1 values( 363 )
+master-bin.000001 3733 Query 1 3824 use `test`; insert into t1 values( 362 )
+master-bin.000001 3824 Query 1 3915 use `test`; insert into t1 values( 361 )
+master-bin.000001 3915 Query 1 4006 use `test`; insert into t1 values( 360 )
+master-bin.000001 4006 Query 1 4097 use `test`; insert into t1 values( 359 )
+master-bin.000001 4097 Query 1 4188 use `test`; insert into t1 values( 358 )
+master-bin.000001 4188 Query 1 4279 use `test`; insert into t1 values( 357 )
+master-bin.000001 4279 Query 1 4370 use `test`; insert into t1 values( 356 )
+master-bin.000001 4370 Query 1 4461 use `test`; insert into t1 values( 355 )
+master-bin.000001 4461 Query 1 4552 use `test`; insert into t1 values( 354 )
+master-bin.000001 4552 Query 1 4643 use `test`; insert into t1 values( 353 )
+master-bin.000001 4643 Query 1 4734 use `test`; insert into t1 values( 352 )
+master-bin.000001 4734 Query 1 4825 use `test`; insert into t1 values( 351 )
+master-bin.000001 4825 Query 1 4916 use `test`; insert into t1 values( 350 )
+master-bin.000001 4916 Query 1 5007 use `test`; insert into t1 values( 349 )
+master-bin.000001 5007 Query 1 5098 use `test`; insert into t1 values( 348 )
+master-bin.000001 5098 Query 1 5189 use `test`; insert into t1 values( 347 )
+master-bin.000001 5189 Query 1 5280 use `test`; insert into t1 values( 346 )
+master-bin.000001 5280 Query 1 5371 use `test`; insert into t1 values( 345 )
+master-bin.000001 5371 Query 1 5462 use `test`; insert into t1 values( 344 )
+master-bin.000001 5462 Query 1 5553 use `test`; insert into t1 values( 343 )
+master-bin.000001 5553 Query 1 5644 use `test`; insert into t1 values( 342 )
+master-bin.000001 5644 Query 1 5735 use `test`; insert into t1 values( 341 )
+master-bin.000001 5735 Query 1 5826 use `test`; insert into t1 values( 340 )
+master-bin.000001 5826 Query 1 5917 use `test`; insert into t1 values( 339 )
+master-bin.000001 5917 Query 1 6008 use `test`; insert into t1 values( 338 )
+master-bin.000001 6008 Query 1 6099 use `test`; insert into t1 values( 337 )
+master-bin.000001 6099 Query 1 6190 use `test`; insert into t1 values( 336 )
+master-bin.000001 6190 Query 1 6281 use `test`; insert into t1 values( 335 )
+master-bin.000001 6281 Query 1 6372 use `test`; insert into t1 values( 334 )
+master-bin.000001 6372 Query 1 6463 use `test`; insert into t1 values( 333 )
+master-bin.000001 6463 Query 1 6554 use `test`; insert into t1 values( 332 )
+master-bin.000001 6554 Query 1 6645 use `test`; insert into t1 values( 331 )
+master-bin.000001 6645 Query 1 6736 use `test`; insert into t1 values( 330 )
+master-bin.000001 6736 Query 1 6827 use `test`; insert into t1 values( 329 )
+master-bin.000001 6827 Query 1 6918 use `test`; insert into t1 values( 328 )
+master-bin.000001 6918 Query 1 7009 use `test`; insert into t1 values( 327 )
+master-bin.000001 7009 Query 1 7100 use `test`; insert into t1 values( 326 )
+master-bin.000001 7100 Query 1 7191 use `test`; insert into t1 values( 325 )
+master-bin.000001 7191 Query 1 7282 use `test`; insert into t1 values( 324 )
+master-bin.000001 7282 Query 1 7373 use `test`; insert into t1 values( 323 )
+master-bin.000001 7373 Query 1 7464 use `test`; insert into t1 values( 322 )
+master-bin.000001 7464 Query 1 7555 use `test`; insert into t1 values( 321 )
+master-bin.000001 7555 Query 1 7646 use `test`; insert into t1 values( 320 )
+master-bin.000001 7646 Query 1 7737 use `test`; insert into t1 values( 319 )
+master-bin.000001 7737 Query 1 7828 use `test`; insert into t1 values( 318 )
+master-bin.000001 7828 Query 1 7919 use `test`; insert into t1 values( 317 )
+master-bin.000001 7919 Query 1 8010 use `test`; insert into t1 values( 316 )
+master-bin.000001 8010 Query 1 8101 use `test`; insert into t1 values( 315 )
+master-bin.000001 8101 Query 1 8192 use `test`; insert into t1 values( 314 )
+master-bin.000001 8192 Query 1 8283 use `test`; insert into t1 values( 313 )
+master-bin.000001 8283 Query 1 8374 use `test`; insert into t1 values( 312 )
+master-bin.000001 8374 Query 1 8465 use `test`; insert into t1 values( 311 )
+master-bin.000001 8465 Query 1 8556 use `test`; insert into t1 values( 310 )
+master-bin.000001 8556 Query 1 8647 use `test`; insert into t1 values( 309 )
+master-bin.000001 8647 Query 1 8738 use `test`; insert into t1 values( 308 )
+master-bin.000001 8738 Query 1 8829 use `test`; insert into t1 values( 307 )
+master-bin.000001 8829 Query 1 8920 use `test`; insert into t1 values( 306 )
+master-bin.000001 8920 Query 1 9011 use `test`; insert into t1 values( 305 )
+master-bin.000001 9011 Query 1 9102 use `test`; insert into t1 values( 304 )
+master-bin.000001 9102 Query 1 9193 use `test`; insert into t1 values( 303 )
+master-bin.000001 9193 Query 1 9284 use `test`; insert into t1 values( 302 )
+master-bin.000001 9284 Query 1 9375 use `test`; insert into t1 values( 301 )
+master-bin.000001 9375 Query 1 9466 use `test`; insert into t1 values( 300 )
+master-bin.000001 9466 Query 1 9557 use `test`; insert into t1 values( 299 )
+master-bin.000001 9557 Query 1 9648 use `test`; insert into t1 values( 298 )
+master-bin.000001 9648 Query 1 9739 use `test`; insert into t1 values( 297 )
+master-bin.000001 9739 Query 1 9830 use `test`; insert into t1 values( 296 )
+master-bin.000001 9830 Query 1 9921 use `test`; insert into t1 values( 295 )
+master-bin.000001 9921 Query 1 10012 use `test`; insert into t1 values( 294 )
+master-bin.000001 10012 Query 1 10103 use `test`; insert into t1 values( 293 )
+master-bin.000001 10103 Query 1 10194 use `test`; insert into t1 values( 292 )
+master-bin.000001 10194 Query 1 10285 use `test`; insert into t1 values( 291 )
+master-bin.000001 10285 Query 1 10376 use `test`; insert into t1 values( 290 )
+master-bin.000001 10376 Query 1 10467 use `test`; insert into t1 values( 289 )
+master-bin.000001 10467 Query 1 10558 use `test`; insert into t1 values( 288 )
+master-bin.000001 10558 Query 1 10649 use `test`; insert into t1 values( 287 )
+master-bin.000001 10649 Query 1 10740 use `test`; insert into t1 values( 286 )
+master-bin.000001 10740 Query 1 10831 use `test`; insert into t1 values( 285 )
+master-bin.000001 10831 Query 1 10922 use `test`; insert into t1 values( 284 )
+master-bin.000001 10922 Query 1 11013 use `test`; insert into t1 values( 283 )
+master-bin.000001 11013 Query 1 11104 use `test`; insert into t1 values( 282 )
+master-bin.000001 11104 Query 1 11195 use `test`; insert into t1 values( 281 )
+master-bin.000001 11195 Query 1 11286 use `test`; insert into t1 values( 280 )
+master-bin.000001 11286 Query 1 11377 use `test`; insert into t1 values( 279 )
+master-bin.000001 11377 Query 1 11468 use `test`; insert into t1 values( 278 )
+master-bin.000001 11468 Query 1 11559 use `test`; insert into t1 values( 277 )
+master-bin.000001 11559 Query 1 11650 use `test`; insert into t1 values( 276 )
+master-bin.000001 11650 Query 1 11741 use `test`; insert into t1 values( 275 )
+master-bin.000001 11741 Query 1 11832 use `test`; insert into t1 values( 274 )
+master-bin.000001 11832 Query 1 11923 use `test`; insert into t1 values( 273 )
+master-bin.000001 11923 Query 1 12014 use `test`; insert into t1 values( 272 )
+master-bin.000001 12014 Query 1 12105 use `test`; insert into t1 values( 271 )
+master-bin.000001 12105 Query 1 12196 use `test`; insert into t1 values( 270 )
+master-bin.000001 12196 Query 1 12287 use `test`; insert into t1 values( 269 )
+master-bin.000001 12287 Query 1 12378 use `test`; insert into t1 values( 268 )
+master-bin.000001 12378 Query 1 12469 use `test`; insert into t1 values( 267 )
+master-bin.000001 12469 Query 1 12560 use `test`; insert into t1 values( 266 )
+master-bin.000001 12560 Query 1 12651 use `test`; insert into t1 values( 265 )
+master-bin.000001 12651 Query 1 12742 use `test`; insert into t1 values( 264 )
+master-bin.000001 12742 Query 1 12833 use `test`; insert into t1 values( 263 )
+master-bin.000001 12833 Query 1 12924 use `test`; insert into t1 values( 262 )
+master-bin.000001 12924 Query 1 13015 use `test`; insert into t1 values( 261 )
+master-bin.000001 13015 Query 1 13106 use `test`; insert into t1 values( 260 )
+master-bin.000001 13106 Query 1 13197 use `test`; insert into t1 values( 259 )
+master-bin.000001 13197 Query 1 13288 use `test`; insert into t1 values( 258 )
+master-bin.000001 13288 Query 1 13379 use `test`; insert into t1 values( 257 )
+master-bin.000001 13379 Query 1 13470 use `test`; insert into t1 values( 256 )
+master-bin.000001 13470 Query 1 13561 use `test`; insert into t1 values( 255 )
+master-bin.000001 13561 Query 1 13652 use `test`; insert into t1 values( 254 )
+master-bin.000001 13652 Query 1 13743 use `test`; insert into t1 values( 253 )
+master-bin.000001 13743 Query 1 13834 use `test`; insert into t1 values( 252 )
+master-bin.000001 13834 Query 1 13925 use `test`; insert into t1 values( 251 )
+master-bin.000001 13925 Query 1 14016 use `test`; insert into t1 values( 250 )
+master-bin.000001 14016 Query 1 14107 use `test`; insert into t1 values( 249 )
+master-bin.000001 14107 Query 1 14198 use `test`; insert into t1 values( 248 )
+master-bin.000001 14198 Query 1 14289 use `test`; insert into t1 values( 247 )
+master-bin.000001 14289 Query 1 14380 use `test`; insert into t1 values( 246 )
+master-bin.000001 14380 Query 1 14471 use `test`; insert into t1 values( 245 )
+master-bin.000001 14471 Query 1 14562 use `test`; insert into t1 values( 244 )
+master-bin.000001 14562 Query 1 14653 use `test`; insert into t1 values( 243 )
+master-bin.000001 14653 Query 1 14744 use `test`; insert into t1 values( 242 )
+master-bin.000001 14744 Query 1 14835 use `test`; insert into t1 values( 241 )
+master-bin.000001 14835 Query 1 14926 use `test`; insert into t1 values( 240 )
+master-bin.000001 14926 Query 1 15017 use `test`; insert into t1 values( 239 )
+master-bin.000001 15017 Query 1 15108 use `test`; insert into t1 values( 238 )
+master-bin.000001 15108 Query 1 15199 use `test`; insert into t1 values( 237 )
+master-bin.000001 15199 Query 1 15290 use `test`; insert into t1 values( 236 )
+master-bin.000001 15290 Query 1 15381 use `test`; insert into t1 values( 235 )
+master-bin.000001 15381 Query 1 15472 use `test`; insert into t1 values( 234 )
+master-bin.000001 15472 Query 1 15563 use `test`; insert into t1 values( 233 )
+master-bin.000001 15563 Query 1 15654 use `test`; insert into t1 values( 232 )
+master-bin.000001 15654 Query 1 15745 use `test`; insert into t1 values( 231 )
+master-bin.000001 15745 Query 1 15836 use `test`; insert into t1 values( 230 )
+master-bin.000001 15836 Query 1 15927 use `test`; insert into t1 values( 229 )
+master-bin.000001 15927 Query 1 16018 use `test`; insert into t1 values( 228 )
+master-bin.000001 16018 Query 1 16109 use `test`; insert into t1 values( 227 )
+master-bin.000001 16109 Query 1 16200 use `test`; insert into t1 values( 226 )
+master-bin.000001 16200 Query 1 16291 use `test`; insert into t1 values( 225 )
+master-bin.000001 16291 Query 1 16382 use `test`; insert into t1 values( 224 )
+master-bin.000001 16382 Query 1 16473 use `test`; insert into t1 values( 223 )
+master-bin.000001 16473 Query 1 16564 use `test`; insert into t1 values( 222 )
+master-bin.000001 16564 Query 1 16655 use `test`; insert into t1 values( 221 )
+master-bin.000001 16655 Query 1 16746 use `test`; insert into t1 values( 220 )
+master-bin.000001 16746 Query 1 16837 use `test`; insert into t1 values( 219 )
+master-bin.000001 16837 Query 1 16928 use `test`; insert into t1 values( 218 )
+master-bin.000001 16928 Query 1 17019 use `test`; insert into t1 values( 217 )
+master-bin.000001 17019 Query 1 17110 use `test`; insert into t1 values( 216 )
+master-bin.000001 17110 Query 1 17201 use `test`; insert into t1 values( 215 )
+master-bin.000001 17201 Query 1 17292 use `test`; insert into t1 values( 214 )
+master-bin.000001 17292 Query 1 17383 use `test`; insert into t1 values( 213 )
+master-bin.000001 17383 Query 1 17474 use `test`; insert into t1 values( 212 )
+master-bin.000001 17474 Query 1 17565 use `test`; insert into t1 values( 211 )
+master-bin.000001 17565 Query 1 17656 use `test`; insert into t1 values( 210 )
+master-bin.000001 17656 Query 1 17747 use `test`; insert into t1 values( 209 )
+master-bin.000001 17747 Query 1 17838 use `test`; insert into t1 values( 208 )
+master-bin.000001 17838 Query 1 17929 use `test`; insert into t1 values( 207 )
+master-bin.000001 17929 Query 1 18020 use `test`; insert into t1 values( 206 )
+master-bin.000001 18020 Query 1 18111 use `test`; insert into t1 values( 205 )
+master-bin.000001 18111 Query 1 18202 use `test`; insert into t1 values( 204 )
+master-bin.000001 18202 Query 1 18293 use `test`; insert into t1 values( 203 )
+master-bin.000001 18293 Query 1 18384 use `test`; insert into t1 values( 202 )
+master-bin.000001 18384 Query 1 18475 use `test`; insert into t1 values( 201 )
+master-bin.000001 18475 Query 1 18566 use `test`; insert into t1 values( 200 )
+master-bin.000001 18566 Query 1 18657 use `test`; insert into t1 values( 199 )
+master-bin.000001 18657 Query 1 18748 use `test`; insert into t1 values( 198 )
+master-bin.000001 18748 Query 1 18839 use `test`; insert into t1 values( 197 )
+master-bin.000001 18839 Query 1 18930 use `test`; insert into t1 values( 196 )
+master-bin.000001 18930 Query 1 19021 use `test`; insert into t1 values( 195 )
+master-bin.000001 19021 Query 1 19112 use `test`; insert into t1 values( 194 )
+master-bin.000001 19112 Query 1 19203 use `test`; insert into t1 values( 193 )
+master-bin.000001 19203 Query 1 19294 use `test`; insert into t1 values( 192 )
+master-bin.000001 19294 Query 1 19385 use `test`; insert into t1 values( 191 )
+master-bin.000001 19385 Query 1 19476 use `test`; insert into t1 values( 190 )
+master-bin.000001 19476 Query 1 19567 use `test`; insert into t1 values( 189 )
+master-bin.000001 19567 Query 1 19658 use `test`; insert into t1 values( 188 )
+master-bin.000001 19658 Query 1 19749 use `test`; insert into t1 values( 187 )
+master-bin.000001 19749 Query 1 19840 use `test`; insert into t1 values( 186 )
+master-bin.000001 19840 Query 1 19931 use `test`; insert into t1 values( 185 )
+master-bin.000001 19931 Query 1 20022 use `test`; insert into t1 values( 184 )
+master-bin.000001 20022 Query 1 20113 use `test`; insert into t1 values( 183 )
+master-bin.000001 20113 Query 1 20204 use `test`; insert into t1 values( 182 )
+master-bin.000001 20204 Query 1 20295 use `test`; insert into t1 values( 181 )
+master-bin.000001 20295 Query 1 20386 use `test`; insert into t1 values( 180 )
+master-bin.000001 20386 Query 1 20477 use `test`; insert into t1 values( 179 )
+master-bin.000001 20477 Query 1 20568 use `test`; insert into t1 values( 178 )
+master-bin.000001 20568 Query 1 20659 use `test`; insert into t1 values( 177 )
+master-bin.000001 20659 Query 1 20750 use `test`; insert into t1 values( 176 )
+master-bin.000001 20750 Query 1 20841 use `test`; insert into t1 values( 175 )
+master-bin.000001 20841 Query 1 20932 use `test`; insert into t1 values( 174 )
+master-bin.000001 20932 Query 1 21023 use `test`; insert into t1 values( 173 )
+master-bin.000001 21023 Query 1 21114 use `test`; insert into t1 values( 172 )
+master-bin.000001 21114 Query 1 21205 use `test`; insert into t1 values( 171 )
+master-bin.000001 21205 Query 1 21296 use `test`; insert into t1 values( 170 )
+master-bin.000001 21296 Query 1 21387 use `test`; insert into t1 values( 169 )
+master-bin.000001 21387 Query 1 21478 use `test`; insert into t1 values( 168 )
+master-bin.000001 21478 Query 1 21569 use `test`; insert into t1 values( 167 )
+master-bin.000001 21569 Query 1 21660 use `test`; insert into t1 values( 166 )
+master-bin.000001 21660 Query 1 21751 use `test`; insert into t1 values( 165 )
+master-bin.000001 21751 Query 1 21842 use `test`; insert into t1 values( 164 )
+master-bin.000001 21842 Query 1 21933 use `test`; insert into t1 values( 163 )
+master-bin.000001 21933 Query 1 22024 use `test`; insert into t1 values( 162 )
+master-bin.000001 22024 Query 1 22115 use `test`; insert into t1 values( 161 )
+master-bin.000001 22115 Query 1 22206 use `test`; insert into t1 values( 160 )
+master-bin.000001 22206 Query 1 22297 use `test`; insert into t1 values( 159 )
+master-bin.000001 22297 Query 1 22388 use `test`; insert into t1 values( 158 )
+master-bin.000001 22388 Query 1 22479 use `test`; insert into t1 values( 157 )
+master-bin.000001 22479 Query 1 22570 use `test`; insert into t1 values( 156 )
+master-bin.000001 22570 Query 1 22661 use `test`; insert into t1 values( 155 )
+master-bin.000001 22661 Query 1 22752 use `test`; insert into t1 values( 154 )
+master-bin.000001 22752 Query 1 22843 use `test`; insert into t1 values( 153 )
+master-bin.000001 22843 Query 1 22934 use `test`; insert into t1 values( 152 )
+master-bin.000001 22934 Query 1 23025 use `test`; insert into t1 values( 151 )
+master-bin.000001 23025 Query 1 23116 use `test`; insert into t1 values( 150 )
+master-bin.000001 23116 Query 1 23207 use `test`; insert into t1 values( 149 )
+master-bin.000001 23207 Query 1 23298 use `test`; insert into t1 values( 148 )
+master-bin.000001 23298 Query 1 23389 use `test`; insert into t1 values( 147 )
+master-bin.000001 23389 Query 1 23480 use `test`; insert into t1 values( 146 )
+master-bin.000001 23480 Query 1 23571 use `test`; insert into t1 values( 145 )
+master-bin.000001 23571 Query 1 23662 use `test`; insert into t1 values( 144 )
+master-bin.000001 23662 Query 1 23753 use `test`; insert into t1 values( 143 )
+master-bin.000001 23753 Query 1 23844 use `test`; insert into t1 values( 142 )
+master-bin.000001 23844 Query 1 23935 use `test`; insert into t1 values( 141 )
+master-bin.000001 23935 Query 1 24026 use `test`; insert into t1 values( 140 )
+master-bin.000001 24026 Query 1 24117 use `test`; insert into t1 values( 139 )
+master-bin.000001 24117 Query 1 24208 use `test`; insert into t1 values( 138 )
+master-bin.000001 24208 Query 1 24299 use `test`; insert into t1 values( 137 )
+master-bin.000001 24299 Query 1 24390 use `test`; insert into t1 values( 136 )
+master-bin.000001 24390 Query 1 24481 use `test`; insert into t1 values( 135 )
+master-bin.000001 24481 Query 1 24572 use `test`; insert into t1 values( 134 )
+master-bin.000001 24572 Query 1 24663 use `test`; insert into t1 values( 133 )
+master-bin.000001 24663 Query 1 24754 use `test`; insert into t1 values( 132 )
+master-bin.000001 24754 Query 1 24845 use `test`; insert into t1 values( 131 )
+master-bin.000001 24845 Query 1 24936 use `test`; insert into t1 values( 130 )
+master-bin.000001 24936 Query 1 25027 use `test`; insert into t1 values( 129 )
+master-bin.000001 25027 Query 1 25118 use `test`; insert into t1 values( 128 )
+master-bin.000001 25118 Query 1 25209 use `test`; insert into t1 values( 127 )
+master-bin.000001 25209 Query 1 25300 use `test`; insert into t1 values( 126 )
+master-bin.000001 25300 Query 1 25391 use `test`; insert into t1 values( 125 )
+master-bin.000001 25391 Query 1 25482 use `test`; insert into t1 values( 124 )
+master-bin.000001 25482 Query 1 25573 use `test`; insert into t1 values( 123 )
+master-bin.000001 25573 Query 1 25664 use `test`; insert into t1 values( 122 )
+master-bin.000001 25664 Query 1 25755 use `test`; insert into t1 values( 121 )
+master-bin.000001 25755 Query 1 25846 use `test`; insert into t1 values( 120 )
+master-bin.000001 25846 Query 1 25937 use `test`; insert into t1 values( 119 )
+master-bin.000001 25937 Query 1 26028 use `test`; insert into t1 values( 118 )
+master-bin.000001 26028 Query 1 26119 use `test`; insert into t1 values( 117 )
+master-bin.000001 26119 Query 1 26210 use `test`; insert into t1 values( 116 )
+master-bin.000001 26210 Query 1 26301 use `test`; insert into t1 values( 115 )
+master-bin.000001 26301 Query 1 26392 use `test`; insert into t1 values( 114 )
+master-bin.000001 26392 Query 1 26483 use `test`; insert into t1 values( 113 )
+master-bin.000001 26483 Query 1 26574 use `test`; insert into t1 values( 112 )
+master-bin.000001 26574 Query 1 26665 use `test`; insert into t1 values( 111 )
+master-bin.000001 26665 Query 1 26756 use `test`; insert into t1 values( 110 )
+master-bin.000001 26756 Query 1 26847 use `test`; insert into t1 values( 109 )
+master-bin.000001 26847 Query 1 26938 use `test`; insert into t1 values( 108 )
+master-bin.000001 26938 Query 1 27029 use `test`; insert into t1 values( 107 )
+master-bin.000001 27029 Query 1 27120 use `test`; insert into t1 values( 106 )
+master-bin.000001 27120 Query 1 27211 use `test`; insert into t1 values( 105 )
+master-bin.000001 27211 Query 1 27302 use `test`; insert into t1 values( 104 )
+master-bin.000001 27302 Query 1 27393 use `test`; insert into t1 values( 103 )
+master-bin.000001 27393 Query 1 27484 use `test`; insert into t1 values( 102 )
+master-bin.000001 27484 Query 1 27575 use `test`; insert into t1 values( 101 )
+master-bin.000001 27575 Query 1 27666 use `test`; insert into t1 values( 100 )
+master-bin.000001 27666 Query 1 27756 use `test`; insert into t1 values( 99 )
+master-bin.000001 27756 Query 1 27846 use `test`; insert into t1 values( 98 )
+master-bin.000001 27846 Query 1 27936 use `test`; insert into t1 values( 97 )
+master-bin.000001 27936 Query 1 28026 use `test`; insert into t1 values( 96 )
+master-bin.000001 28026 Query 1 28116 use `test`; insert into t1 values( 95 )
+master-bin.000001 28116 Query 1 28206 use `test`; insert into t1 values( 94 )
+master-bin.000001 28206 Query 1 28296 use `test`; insert into t1 values( 93 )
+master-bin.000001 28296 Query 1 28386 use `test`; insert into t1 values( 92 )
+master-bin.000001 28386 Query 1 28476 use `test`; insert into t1 values( 91 )
+master-bin.000001 28476 Query 1 28566 use `test`; insert into t1 values( 90 )
+master-bin.000001 28566 Query 1 28656 use `test`; insert into t1 values( 89 )
+master-bin.000001 28656 Query 1 28746 use `test`; insert into t1 values( 88 )
+master-bin.000001 28746 Query 1 28836 use `test`; insert into t1 values( 87 )
+master-bin.000001 28836 Query 1 28926 use `test`; insert into t1 values( 86 )
+master-bin.000001 28926 Query 1 29016 use `test`; insert into t1 values( 85 )
+master-bin.000001 29016 Query 1 29106 use `test`; insert into t1 values( 84 )
+master-bin.000001 29106 Query 1 29196 use `test`; insert into t1 values( 83 )
+master-bin.000001 29196 Query 1 29286 use `test`; insert into t1 values( 82 )
+master-bin.000001 29286 Query 1 29376 use `test`; insert into t1 values( 81 )
+master-bin.000001 29376 Query 1 29466 use `test`; insert into t1 values( 80 )
+master-bin.000001 29466 Query 1 29556 use `test`; insert into t1 values( 79 )
+master-bin.000001 29556 Query 1 29646 use `test`; insert into t1 values( 78 )
+master-bin.000001 29646 Query 1 29736 use `test`; insert into t1 values( 77 )
+master-bin.000001 29736 Query 1 29826 use `test`; insert into t1 values( 76 )
+master-bin.000001 29826 Query 1 29916 use `test`; insert into t1 values( 75 )
+master-bin.000001 29916 Query 1 30006 use `test`; insert into t1 values( 74 )
+master-bin.000001 30006 Query 1 30096 use `test`; insert into t1 values( 73 )
+master-bin.000001 30096 Query 1 30186 use `test`; insert into t1 values( 72 )
+master-bin.000001 30186 Query 1 30276 use `test`; insert into t1 values( 71 )
+master-bin.000001 30276 Query 1 30366 use `test`; insert into t1 values( 70 )
+master-bin.000001 30366 Query 1 30456 use `test`; insert into t1 values( 69 )
+master-bin.000001 30456 Query 1 30546 use `test`; insert into t1 values( 68 )
+master-bin.000001 30546 Query 1 30636 use `test`; insert into t1 values( 67 )
+master-bin.000001 30636 Query 1 30726 use `test`; insert into t1 values( 66 )
+master-bin.000001 30726 Query 1 30816 use `test`; insert into t1 values( 65 )
+master-bin.000001 30816 Query 1 30906 use `test`; insert into t1 values( 64 )
+master-bin.000001 30906 Query 1 30996 use `test`; insert into t1 values( 63 )
+master-bin.000001 30996 Query 1 31086 use `test`; insert into t1 values( 62 )
+master-bin.000001 31086 Query 1 31176 use `test`; insert into t1 values( 61 )
+master-bin.000001 31176 Query 1 31266 use `test`; insert into t1 values( 60 )
+master-bin.000001 31266 Query 1 31356 use `test`; insert into t1 values( 59 )
+master-bin.000001 31356 Query 1 31446 use `test`; insert into t1 values( 58 )
+master-bin.000001 31446 Query 1 31536 use `test`; insert into t1 values( 57 )
+master-bin.000001 31536 Query 1 31626 use `test`; insert into t1 values( 56 )
+master-bin.000001 31626 Query 1 31716 use `test`; insert into t1 values( 55 )
+master-bin.000001 31716 Query 1 31806 use `test`; insert into t1 values( 54 )
+master-bin.000001 31806 Query 1 31896 use `test`; insert into t1 values( 53 )
+master-bin.000001 31896 Query 1 31986 use `test`; insert into t1 values( 52 )
+master-bin.000001 31986 Query 1 32076 use `test`; insert into t1 values( 51 )
+master-bin.000001 32076 Query 1 32166 use `test`; insert into t1 values( 50 )
+master-bin.000001 32166 Query 1 32256 use `test`; insert into t1 values( 49 )
+master-bin.000001 32256 Query 1 32346 use `test`; insert into t1 values( 48 )
+master-bin.000001 32346 Query 1 32436 use `test`; insert into t1 values( 47 )
+master-bin.000001 32436 Query 1 32526 use `test`; insert into t1 values( 46 )
+master-bin.000001 32526 Query 1 32616 use `test`; insert into t1 values( 45 )
+master-bin.000001 32616 Query 1 32706 use `test`; insert into t1 values( 44 )
+master-bin.000001 32706 Query 1 32796 use `test`; insert into t1 values( 43 )
+master-bin.000001 32796 Query 1 32886 use `test`; insert into t1 values( 42 )
+master-bin.000001 32886 Query 1 32976 use `test`; insert into t1 values( 41 )
+master-bin.000001 32976 Query 1 33066 use `test`; insert into t1 values( 40 )
+master-bin.000001 33066 Query 1 33156 use `test`; insert into t1 values( 39 )
+master-bin.000001 33156 Query 1 33246 use `test`; insert into t1 values( 38 )
+master-bin.000001 33246 Query 1 33336 use `test`; insert into t1 values( 37 )
+master-bin.000001 33336 Query 1 33426 use `test`; insert into t1 values( 36 )
+master-bin.000001 33426 Query 1 33516 use `test`; insert into t1 values( 35 )
+master-bin.000001 33516 Query 1 33606 use `test`; insert into t1 values( 34 )
+master-bin.000001 33606 Query 1 33696 use `test`; insert into t1 values( 33 )
+master-bin.000001 33696 Query 1 33786 use `test`; insert into t1 values( 32 )
+master-bin.000001 33786 Query 1 33876 use `test`; insert into t1 values( 31 )
+master-bin.000001 33876 Query 1 33966 use `test`; insert into t1 values( 30 )
+master-bin.000001 33966 Query 1 34056 use `test`; insert into t1 values( 29 )
+master-bin.000001 34056 Query 1 34146 use `test`; insert into t1 values( 28 )
+master-bin.000001 34146 Query 1 34236 use `test`; insert into t1 values( 27 )
+master-bin.000001 34236 Query 1 34326 use `test`; insert into t1 values( 26 )
+master-bin.000001 34326 Query 1 34416 use `test`; insert into t1 values( 25 )
+master-bin.000001 34416 Query 1 34506 use `test`; insert into t1 values( 24 )
+master-bin.000001 34506 Query 1 34596 use `test`; insert into t1 values( 23 )
+master-bin.000001 34596 Query 1 34686 use `test`; insert into t1 values( 22 )
+master-bin.000001 34686 Query 1 34776 use `test`; insert into t1 values( 21 )
+master-bin.000001 34776 Query 1 34866 use `test`; insert into t1 values( 20 )
+master-bin.000001 34866 Query 1 34956 use `test`; insert into t1 values( 19 )
+master-bin.000001 34956 Query 1 35046 use `test`; insert into t1 values( 18 )
+master-bin.000001 35046 Query 1 35136 use `test`; insert into t1 values( 17 )
+master-bin.000001 35136 Query 1 35226 use `test`; insert into t1 values( 16 )
+master-bin.000001 35226 Query 1 35316 use `test`; insert into t1 values( 15 )
+master-bin.000001 35316 Query 1 35406 use `test`; insert into t1 values( 14 )
+master-bin.000001 35406 Query 1 35496 use `test`; insert into t1 values( 13 )
+master-bin.000001 35496 Query 1 35586 use `test`; insert into t1 values( 12 )
+master-bin.000001 35586 Query 1 35676 use `test`; insert into t1 values( 11 )
+master-bin.000001 35676 Query 1 35766 use `test`; insert into t1 values( 10 )
+master-bin.000001 35766 Query 1 35855 use `test`; insert into t1 values( 9 )
+master-bin.000001 35855 Query 1 35944 use `test`; insert into t1 values( 8 )
+master-bin.000001 35944 Query 1 36033 use `test`; insert into t1 values( 7 )
+master-bin.000001 36033 Query 1 36122 use `test`; insert into t1 values( 6 )
+master-bin.000001 36122 Query 1 36211 use `test`; insert into t1 values( 5 )
+master-bin.000001 36211 Query 1 36300 use `test`; insert into t1 values( 4 )
+master-bin.000001 36300 Query 1 36389 use `test`; insert into t1 values( 3 )
+master-bin.000001 36389 Query 1 36478 use `test`; insert into t1 values( 2 )
+master-bin.000001 36478 Query 1 36567 use `test`; insert into t1 values( 1 )
+master-bin.000001 36567 Xid 1 36594 COMMIT /* XID */
+master-bin.000001 36594 Rotate 1 36638 master-bin.000002;pos=4
drop table t1;
set global binlog_cache_size=@bcs;
set session autocommit = @ac;
@@ -590,10 +590,10 @@ deallocate prepare stmt;
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
-master-bin.000001 106 Query 1 227 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
-master-bin.000001 227 Query 1 351 use `test`; insert into t1 values (9999999999999999,14632475938453979136)
-master-bin.000001 351 Query 1 427 use `test`; drop table t1
+master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4
+master-bin.000001 107 Query 1 228 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
+master-bin.000001 228 Query 1 352 use `test`; insert into t1 values (9999999999999999,14632475938453979136)
+master-bin.000001 352 Query 1 428 use `test`; drop table t1
reset master;
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE bug39182;
@@ -764,14 +764,14 @@ drop table if exists t3;
create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 346
+master-bin.000001 347
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
show master status /* must show new binlog index after rotating */;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000002 106
+master-bin.000002 107
drop table t3;
#
# Bug #45998: database crashes when running "create as select"
diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
index de83c7a873d..268d390a1a1 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
@@ -459,7 +459,11 @@ return n;
end|
reset master;
insert into t2 values (bug27417(1));
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
insert into t2 select bug27417(2);
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
reset master;
insert into t2 values (bug27417(2));
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
@@ -476,6 +480,8 @@ select count(*) from t2;
count(*)
2
delete from t2 where a=bug27417(3);
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
select count(*) from t2 /* nothing got deleted */;
count(*)
2
@@ -488,6 +494,8 @@ select count(*) from t1 /* must be 5 */;
count(*)
5
delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
affected rows: 0
select count(*) from t1 /* must be 7 */;
count(*)
@@ -703,7 +711,11 @@ return n;
end|
reset master;
insert into t2 values (bug27417(1));
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
insert into t2 select bug27417(2);
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
reset master;
insert into t2 values (bug27417(2));
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
@@ -719,6 +731,8 @@ select count(*) from t2;
count(*)
2
delete from t2 where a=bug27417(3);
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
select count(*) from t2 /* nothing got deleted */;
count(*)
2
@@ -730,6 +744,8 @@ select count(*) from t1 /* must be 5 */;
count(*)
5
delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
affected rows: 0
select count(*) from t1 /* must be 7 */;
count(*)
diff --git a/mysql-test/suite/binlog/r/binlog_tmp_table.result b/mysql-test/suite/binlog/r/binlog_tmp_table.result
index 14b1963ffd9..b057d24cba9 100644
--- a/mysql-test/suite/binlog/r/binlog_tmp_table.result
+++ b/mysql-test/suite/binlog/r/binlog_tmp_table.result
@@ -1,4 +1,4 @@
-RESET MASTER;
+reset master;
create table foo (a int);
flush logs;
create temporary table tmp1_foo like foo;
diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result
index 8bbf993a727..c3ce1783f95 100644
--- a/mysql-test/suite/binlog/r/binlog_unsafe.result
+++ b/mysql-test/suite/binlog/r/binlog_unsafe.result
@@ -327,6 +327,62 @@ Warnings:
Note 1592 Statement may not be safe to log in statement format.
DROP TABLE t1, t2;
SET @@SESSION.SQL_MODE = @save_sql_mode;
+CREATE TABLE t1 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
+CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
+CREATE FUNCTION func_modify_t1 ()
+RETURNS INT
+BEGIN
+INSERT INTO t1 SET a = 1;
+RETURN 0;
+END|
+# The following statement causes auto-incrementation
+# of both t1 and t2. It is logged in statement format,
+# so it should produce unsafe warning.
+INSERT INTO t2 SET a = func_modify_t1();
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+SET SESSION binlog_format = MIXED;
+# Check if the statement is logged in row format.
+INSERT INTO t2 SET a = func_modify_t1();
+SHOW BINLOG EVENTS FROM 12283;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 12283 Query 1 12351 BEGIN
+master-bin.000001 12351 Table_map 1 12393 table_id: 44 (test.t2)
+master-bin.000001 12393 Table_map 1 12435 table_id: 45 (test.t1)
+master-bin.000001 12435 Write_rows 1 12473 table_id: 45
+master-bin.000001 12473 Write_rows 1 12511 table_id: 44 flags: STMT_END_F
+master-bin.000001 12511 Query 1 12580 COMMIT
+DROP TABLE t1,t2;
+DROP FUNCTION func_modify_t1;
+SET SESSION binlog_format = STATEMENT;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
+CREATE TABLE t3 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
+create trigger tri_modify_two_tables before insert on t1 for each row begin
+insert into t2(a) values(new.a);
+insert into t3(a) values(new.a);
+end |
+# The following statement causes auto-incrementation
+# of both t2 and t3. It is logged in statement format,
+# so it should produce unsafe warning
+INSERT INTO t1 SET a = 1;
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+SET SESSION binlog_format = MIXED;
+# Check if the statement is logged in row format.
+INSERT INTO t1 SET a = 2;
+SHOW BINLOG EVENTS FROM 13426;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 13426 Query 1 13494 BEGIN
+master-bin.000001 13494 Table_map 1 13535 table_id: 47 (test.t1)
+master-bin.000001 13535 Table_map 1 13577 table_id: 48 (test.t3)
+master-bin.000001 13577 Table_map 1 13619 table_id: 49 (test.t2)
+master-bin.000001 13619 Write_rows 1 13657 table_id: 49
+master-bin.000001 13657 Write_rows 1 13695 table_id: 48
+master-bin.000001 13695 Write_rows 1 13729 table_id: 47 flags: STMT_END_F
+master-bin.000001 13729 Query 1 13798 COMMIT
+DROP TABLE t1,t2,t3;
+SET SESSION binlog_format = STATEMENT;
CREATE TABLE t1 (a VARCHAR(1000));
INSERT INTO t1 VALUES (CURRENT_USER());
Warnings:
diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test
index 5297767675c..19137066429 100644
--- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test
+++ b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test
@@ -25,9 +25,22 @@ let $MYSQLD_DATADIR= `select @@datadir`;
copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLD_DATADIR/slave-relay-bin.000001;
-write_file $MYSQLD_DATADIR/slave-relay-bin.index;
-slave-relay-bin.000001
-EOF
+
+# After patch for BUG#12190, the filename used in CHANGE MASTER
+# RELAY_LOG_FILE will be automatically added the directory of the
+# relay log before comparison, thus we need to added the directory
+# part (./ on unix .\ on windows) when faking the relay-log-bin.index.
+disable_query_log;
+if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`)
+{
+ eval select './slave-relay-bin.000001\n' into dumpfile '$MYSQLD_DATADIR/slave-relay-bin.index';
+}
+
+if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") != 0`)
+{
+ eval select '.\\\\slave-relay-bin.000001\n' into dumpfile '$MYSQLD_DATADIR/slave-relay-bin.index';
+}
+enable_query_log;
change master to
MASTER_HOST='dummy.localdomain',
diff --git a/mysql-test/suite/binlog/t/binlog_implicit_commit.test b/mysql-test/suite/binlog/t/binlog_implicit_commit.test
new file mode 100644
index 00000000000..a682ab95e3d
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_implicit_commit.test
@@ -0,0 +1,63 @@
+# The purpose of this test is to test that setting autocommit does a
+# commit of outstanding transactions and nothing is left pending in
+# the transaction cache.
+
+source include/have_log_bin.inc;
+source include/have_innodb.inc;
+
+# We need a transactional engine, so let's use InnoDB
+CREATE TABLE t1 (id INT) ENGINE = InnoDB;
+
+# Testing SET AUTOCOMMIT
+SET BINLOG_FORMAT = STATEMENT;
+
+let $cleanup = COMMIT;
+
+let $prepare = SET AUTOCOMMIT = 0;
+let $statement = SET AUTOCOMMIT = 1;
+source extra/binlog_tests/implicit.test;
+
+let $prepare = SET AUTOCOMMIT = 1;
+let $statement = SET AUTOCOMMIT = 1;
+source extra/binlog_tests/implicit.test;
+
+let $prepare = SET AUTOCOMMIT = 0;
+let $statement = SET AUTOCOMMIT = 0;
+source extra/binlog_tests/implicit.test;
+
+let $prepare = SET AUTOCOMMIT = 1;
+let $statement = SET AUTOCOMMIT = 0;
+source extra/binlog_tests/implicit.test;
+
+SET BINLOG_FORMAT = ROW;
+let $prepare = SET AUTOCOMMIT = 0;
+let $statement = SET AUTOCOMMIT = 1;
+source extra/binlog_tests/implicit.test;
+
+let $prepare = SET AUTOCOMMIT = 1;
+let $statement = SET AUTOCOMMIT = 1;
+source extra/binlog_tests/implicit.test;
+
+let $prepare = SET AUTOCOMMIT = 0;
+let $statement = SET AUTOCOMMIT = 0;
+source extra/binlog_tests/implicit.test;
+
+let $prepare = SET AUTOCOMMIT = 1;
+let $statement = SET AUTOCOMMIT = 0;
+source extra/binlog_tests/implicit.test;
+
+RESET MASTER;
+SET AUTOCOMMIT = 0;
+INSERT INTO t1 VALUES (1);
+source include/show_binlog_events.inc;
+LOCK TABLES t1 WRITE;
+source include/show_binlog_events.inc;
+INSERT INTO t1 VALUES (2);
+source include/show_binlog_events.inc;
+UNLOCK TABLES;
+source include/show_binlog_events.inc;
+COMMIT;
+source include/show_binlog_events.inc;
+
+# Cleaning up
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/t/binlog_incident.test b/mysql-test/suite/binlog/t/binlog_incident.test
index 901ac49ea24..88e7332e88e 100644
--- a/mysql-test/suite/binlog/t/binlog_incident.test
+++ b/mysql-test/suite/binlog/t/binlog_incident.test
@@ -20,7 +20,7 @@ REPLACE INTO t1 VALUES (4);
DROP TABLE t1;
FLUSH LOGS;
-exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
+exec $MYSQL_BINLOG --start-position=107 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
--disable_query_log
eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl;
--enable_query_log
diff --git a/mysql-test/suite/binlog/t/binlog_innodb.test b/mysql-test/suite/binlog/t/binlog_innodb.test
index f84fd65226a..4469fa6224c 100644
--- a/mysql-test/suite/binlog/t/binlog_innodb.test
+++ b/mysql-test/suite/binlog/t/binlog_innodb.test
@@ -155,7 +155,8 @@ reset master;
UPDATE t2,t1 SET t2.a=t1.a+2;
# check
select * from t2 /* must be (3,1), (4,4) */;
-show master status /* there must no UPDATE in binlog */;
+--echo there must no UPDATE in binlog
+source include/show_master_status.inc;
# B. testing multi_update::send_error() execution branch
delete from t1;
@@ -165,7 +166,8 @@ insert into t2 values (1,2),(3,4),(4,4);
reset master;
--error ER_DUP_ENTRY
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
-show master status /* there must be no UPDATE query event */;
+--echo there must no UPDATE in binlog
+source include/show_master_status.inc;
# cleanup bug#27716
drop table t1, t2;
diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test
index e2db326129d..2e261f6fafd 100644
--- a/mysql-test/suite/binlog/t/binlog_killed.test
+++ b/mysql-test/suite/binlog/t/binlog_killed.test
@@ -51,7 +51,7 @@ reap;
let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=135 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
index ec61271ae88..f9240291dba 100644
--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
@@ -24,7 +24,7 @@ update t1 set a=2 /* will be "killed" after work has been done */;
# for some constants like the offset of the first real event
# that is different between severs versions.
let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=107 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
@@ -52,7 +52,7 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "kil
source include/show_binlog_events.inc;
---exec $MYSQL_BINLOG --force-if-open --start-position=98 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=107 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
diff --git a/mysql-test/suite/binlog/t/binlog_max_extension.test b/mysql-test/suite/binlog/t/binlog_max_extension.test
new file mode 100644
index 00000000000..9f52d195e21
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_max_extension.test
@@ -0,0 +1,92 @@
+# BUG#40611: MySQL cannot make a binary log after sequential number beyond
+# unsigned long.
+#
+# Problem statement
+# =================
+#
+# Extension for log file names might be created with negative
+# numbers (when counter used would wrap around), causing server
+# failure when incrementing -00001 (reaching number 000000
+# extension).
+#
+# Test
+# ====
+# This tests aims at testing the a patch that removes negatives
+# numbers from log name extensions and checks that the server
+# reports gracefully that the limit has been reached.
+#
+# It instruments index file to point to a log file close to
+# the new maximum and calls flush logs to get warning.
+#
+
+call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0.");
+call mtr.add_suppression("Log filename extension number exhausted:");
+call mtr.add_suppression("Can't generate a unique log-filename");
+
+
+-- source include/have_log_bin.inc
+RESET MASTER;
+
+-- let $MYSQLD_DATADIR= `select @@datadir`
+
+###############################################
+# check hitting maximum file name extension:
+###############################################
+
+##########
+# Prepare
+##########
+
+# 1. Stop master server
+-- write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait
+EOF
+-- shutdown_server 10
+-- source include/wait_until_disconnected.inc
+
+# 2. Prepare log and index file
+-- copy_file $MYSQLD_DATADIR/master-bin.index $MYSQLD_DATADIR/master-bin.index.orig
+-- copy_file $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.2147483646
+-- append_file $MYSQLD_DATADIR/master-bin.index
+master-bin.2147483646
+EOF
+
+# 3. Restart the server
+-- append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
+-- enable_reconnect
+-- source include/wait_until_connected_again.inc
+
+###########
+# Assertion
+###########
+
+# assertion: should throw warning
+FLUSH LOGS;
+
+##############
+# Clean up
+##############
+
+# 1. Stop the server
+-- write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait
+EOF
+-- shutdown_server 10
+-- source include/wait_until_disconnected.inc
+
+# 2. Undo changes to index and log files
+-- remove_file $MYSQLD_DATADIR/master-bin.index
+-- copy_file $MYSQLD_DATADIR/master-bin.index.orig $MYSQLD_DATADIR/master-bin.index
+-- remove_file $MYSQLD_DATADIR/master-bin.index.orig
+
+-- remove_file $MYSQLD_DATADIR/master-bin.2147483646
+-- remove_file $MYSQLD_DATADIR/master-bin.2147483647
+
+# 3. Restart the server
+-- append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
+-- enable_reconnect
+-- source include/wait_until_connected_again.inc
diff --git a/mysql-test/suite/binlog/t/binlog_tmp_table.test b/mysql-test/suite/binlog/t/binlog_tmp_table.test
index 54af8a8cb68..cd147149ed1 100644
--- a/mysql-test/suite/binlog/t/binlog_tmp_table.test
+++ b/mysql-test/suite/binlog/t/binlog_tmp_table.test
@@ -30,7 +30,8 @@ source include/have_binlog_format_mixed_or_statement.inc;
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
-RESET MASTER;
+
+reset master;
create table foo (a int);
diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test
index 1acb4d090ca..09e1241e5c7 100644
--- a/mysql-test/suite/binlog/t/binlog_unsafe.test
+++ b/mysql-test/suite/binlog/t/binlog_unsafe.test
@@ -390,12 +390,80 @@ DROP TABLE t1, t2;
SET @@SESSION.SQL_MODE = @save_sql_mode;
#
+# BUG#45827
+# The test verifies if stmt that have more than one
+# different tables to update with autoinc columns
+# will produce unsafe warning
+#
+
+# Test case1: stmt that have more than one different tables
+# to update with autoinc columns should produce
+# unsafe warning when calling a function
+CREATE TABLE t1 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
+CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
+
+# The purpose of this function is to insert into t1 so that the second
+# column is auto_increment'ed.
+DELIMITER |;
+CREATE FUNCTION func_modify_t1 ()
+RETURNS INT
+BEGIN
+ INSERT INTO t1 SET a = 1;
+ RETURN 0;
+END|
+DELIMITER ;|
+--echo # The following statement causes auto-incrementation
+--echo # of both t1 and t2. It is logged in statement format,
+--echo # so it should produce unsafe warning.
+INSERT INTO t2 SET a = func_modify_t1();
+
+SET SESSION binlog_format = MIXED;
+--echo # Check if the statement is logged in row format.
+let $pos0_master= query_get_value(SHOW MASTER STATUS, Position, 1);
+INSERT INTO t2 SET a = func_modify_t1();
+eval SHOW BINLOG EVENTS FROM $pos0_master;
+
+# clean up
+DROP TABLE t1,t2;
+DROP FUNCTION func_modify_t1;
+#
+# Test case2: stmt that have more than one different tables
+# to update with autoinc columns should produce
+# unsafe warning when invoking a trigger
+SET SESSION binlog_format = STATEMENT;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
+CREATE TABLE t3 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
+# The purpose of this function is to insert into t1 so that the second
+# column is auto_increment'ed.
+delimiter |;
+create trigger tri_modify_two_tables before insert on t1 for each row begin
+ insert into t2(a) values(new.a);
+ insert into t3(a) values(new.a);
+end |
+delimiter ;|
+--echo # The following statement causes auto-incrementation
+--echo # of both t2 and t3. It is logged in statement format,
+--echo # so it should produce unsafe warning
+INSERT INTO t1 SET a = 1;
+
+SET SESSION binlog_format = MIXED;
+--echo # Check if the statement is logged in row format.
+let $pos1_master= query_get_value(SHOW MASTER STATUS, Position, 1);
+INSERT INTO t1 SET a = 2;
+eval SHOW BINLOG EVENTS FROM $pos1_master;
+
+# clean up
+DROP TABLE t1,t2,t3;
+
+#
# BUG#47995: Mark user functions as unsafe
#
# Test that the system functions that are supposed to be marked unsafe
# generate a warning. Each INSERT statement below should generate a
# warning.
#
+SET SESSION binlog_format = STATEMENT;
CREATE TABLE t1 (a VARCHAR(1000));
INSERT INTO t1 VALUES (CURRENT_USER()); #marked unsafe before BUG#47995
diff --git a/mysql-test/suite/federated/federated_server.result b/mysql-test/suite/federated/federated_server.result
index 2c20d1c1d57..5079a4dcfa0 100644
--- a/mysql-test/suite/federated/federated_server.result
+++ b/mysql-test/suite/federated/federated_server.result
@@ -197,13 +197,13 @@ select * from federated.t1;
id name
1 this is legitimate
alter server s1 options (database 'db_bogus');
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
flush tables;
select * from federated.t1;
id name
1 this is legitimate
alter server s1 options (database 'db_bogus');
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
flush tables;
select * from federated.t1;
id name
@@ -214,7 +214,7 @@ select * from federated.t1;
id name
2 this is bogus
drop server if exists 's1';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
@@ -223,7 +223,7 @@ PASSWORD '',
PORT SLAVE_PORT,
SOCKET '',
OWNER 'root');
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
drop server 's1';
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
index 476ccc6ebd8..25edc0f68bb 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
@@ -1251,7 +1251,7 @@ drop trigger trg1_0;
create definer=not_ex_user@localhost trigger trg1_0
before INSERT on t1 for each row
set new.f1 = 'trig 1_0-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
create definer=current_user trigger trg1_1
before INSERT on t1 for each row
set new.f1 = 'trig 1_1-yes';
@@ -1284,7 +1284,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'loca
create definer=not_ex_user@localhost trigger trg1_3
after UPDATE on t1 for each row
set @var1 = 'trig 1_3-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
select current_user;
current_user
root@localhost
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03e.result b/mysql-test/suite/funcs_1/r/memory_trig_03e.result
index bbee7d47e7e..462a8858029 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_03e.result
@@ -1252,7 +1252,7 @@ drop trigger trg1_0;
create definer=not_ex_user@localhost trigger trg1_0
before INSERT on t1 for each row
set new.f1 = 'trig 1_0-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
create definer=current_user trigger trg1_1
before INSERT on t1 for each row
set new.f1 = 'trig 1_1-yes';
@@ -1285,7 +1285,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'loca
create definer=not_ex_user@localhost trigger trg1_3
after UPDATE on t1 for each row
set @var1 = 'trig 1_3-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
select current_user;
current_user
root@localhost
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
index e4dc67098ad..104db478638 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
@@ -1252,7 +1252,7 @@ drop trigger trg1_0;
create definer=not_ex_user@localhost trigger trg1_0
before INSERT on t1 for each row
set new.f1 = 'trig 1_0-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
create definer=current_user trigger trg1_1
before INSERT on t1 for each row
set new.f1 = 'trig 1_1-yes';
@@ -1285,7 +1285,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'loca
create definer=not_ex_user@localhost trigger trg1_3
after UPDATE on t1 for each row
set @var1 = 'trig 1_3-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
select current_user;
current_user
root@localhost
diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_03e.result b/mysql-test/suite/funcs_1/r/ndb_trig_03e.result
index 84260822edf..73388680481 100644
--- a/mysql-test/suite/funcs_1/r/ndb_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/ndb_trig_03e.result
@@ -1251,7 +1251,7 @@ drop trigger trg1_0;
create definer=not_ex_user@localhost trigger trg1_0
before INSERT on t1 for each row
set new.f1 = 'trig 1_0-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
create definer=current_user trigger trg1_1
before INSERT on t1 for each row
set new.f1 = 'trig 1_1-yes';
@@ -1284,7 +1284,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'loca
create definer=not_ex_user@localhost trigger trg1_3
after UPDATE on t1 for each row
set @var1 = 'trig 1_3-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
select current_user;
current_user
root@localhost
diff --git a/mysql-test/suite/parts/r/rpl_partition.result b/mysql-test/suite/parts/r/rpl_partition.result
index c2537815631..dfce1c3cdfa 100644
--- a/mysql-test/suite/parts/r/rpl_partition.result
+++ b/mysql-test/suite/parts/r/rpl_partition.result
@@ -177,6 +177,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT count(*) "Slave norm" FROM t1;
Slave norm 500
SELECT count(*) "Slave bykey" FROM t2;
diff --git a/mysql-test/suite/rpl/my.cnf b/mysql-test/suite/rpl/my.cnf
index ea4caeb2ddd..95f365f4058 100644
--- a/mysql-test/suite/rpl/my.cnf
+++ b/mysql-test/suite/rpl/my.cnf
@@ -2,13 +2,6 @@
# add setting to connect the slave to the master by default
!include rpl_1slave_base.cnf
+
[mysqld.2]
-# Hardcode the host to 127.0.0.1 until running on more
-# than one host and it need to be masked
-# master-host= @mysqld.1.#host
-master-host= 127.0.0.1
-master-port= @mysqld.1.port
-master-password= @mysqld.1.#password
-master-user= @mysqld.1.#user
-master-connect-retry= 1
diff --git a/mysql-test/suite/rpl/r/rpl000017.result b/mysql-test/suite/rpl/r/rpl000017.result
index 1c611357e64..403f4d4d4fe 100644
--- a/mysql-test/suite/rpl/r/rpl000017.result
+++ b/mysql-test/suite/rpl/r/rpl000017.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;
-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;
diff --git a/mysql-test/suite/rpl/r/rpl_000015.result b/mysql-test/suite/rpl/r/rpl_000015.result
index 03b96d5870b..1b1249bc979 100644
--- a/mysql-test/suite/rpl/r/rpl_000015.result
+++ b/mysql-test/suite/rpl/r/rpl_000015.result
@@ -4,48 +4,8 @@ File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
reset slave;
SHOW SLAVE STATUS;
-change master to master_host='127.0.0.1';
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User test
-Master_Port 3306
-Connect_Retry 7
-Master_Log_File
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File
-Slave_IO_Running No
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-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 #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
change master to master_host='127.0.0.1',master_user='root',
-master_password='',master_port=MASTER_PORT;
+master_password='',master_port=MASTER_PORT, MASTER_CONNECT_RETRY=7;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
@@ -85,6 +45,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 0
start slave;
SHOW SLAVE STATUS;
Slave_IO_State #
@@ -125,6 +87,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
drop table if exists t1;
create table t1 (n int, PRIMARY KEY(n));
insert into t1 values (10),(45),(90);
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_grant.result b/mysql-test/suite/rpl/r/rpl_binlog_grant.result
index 4a789f361c6..2a7e4401500 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_grant.result
@@ -17,16 +17,15 @@ show grants for x@y;
Grants for x@y
GRANT USAGE ON *.* TO 'x'@'y'
GRANT SELECT ON `d1`.`t` TO 'x'@'y'
-show binlog events;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 106 Query 1 193 drop database if exists d1
-master-bin.000001 193 Query 1 272 create database d1
-master-bin.000001 272 Query 1 370 use `d1`; create table t (s1 int) engine=innodb
-master-bin.000001 370 Query 1 436 BEGIN
-master-bin.000001 436 Query 1 521 use `d1`; insert into t values (1)
-master-bin.000001 521 Xid 1 548 COMMIT /* XID */
-master-bin.000001 548 Query 1 633 use `d1`; grant select on t to x@y
+master-bin.000001 # Query # # drop database if exists d1
+master-bin.000001 # Query # # create database d1
+master-bin.000001 # Query # # use `d1`; create table t (s1 int) engine=innodb
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `d1`; insert into t values (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `d1`; grant select on t to x@y
start transaction;
insert into t values (2);
revoke select on t from x@y;
@@ -38,19 +37,18 @@ s1
show grants for x@y;
Grants for x@y
GRANT USAGE ON *.* TO 'x'@'y'
-show binlog events;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 106 Query 1 193 drop database if exists d1
-master-bin.000001 193 Query 1 272 create database d1
-master-bin.000001 272 Query 1 370 use `d1`; create table t (s1 int) engine=innodb
-master-bin.000001 370 Query 1 436 BEGIN
-master-bin.000001 436 Query 1 521 use `d1`; insert into t values (1)
-master-bin.000001 521 Xid 1 548 COMMIT /* XID */
-master-bin.000001 548 Query 1 633 use `d1`; grant select on t to x@y
-master-bin.000001 633 Query 1 699 BEGIN
-master-bin.000001 699 Query 1 784 use `d1`; insert into t values (2)
-master-bin.000001 784 Xid 1 811 COMMIT /* XID */
-master-bin.000001 811 Query 1 899 use `d1`; revoke select on t from x@y
+master-bin.000001 # Query # # drop database if exists d1
+master-bin.000001 # Query # # create database d1
+master-bin.000001 # Query # # use `d1`; create table t (s1 int) engine=innodb
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `d1`; insert into t values (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `d1`; grant select on t to x@y
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `d1`; insert into t values (2)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `d1`; revoke select on t from x@y
drop user x@y;
drop database d1;
diff --git a/mysql-test/suite/rpl/r/rpl_bug31076.result b/mysql-test/suite/rpl/r/rpl_bug31076.result
index fd66ca85d57..76bce39fc43 100644
--- a/mysql-test/suite/rpl/r/rpl_bug31076.result
+++ b/mysql-test/suite/rpl/r/rpl_bug31076.result
@@ -4,6 +4,8 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
CREATE DATABASE track;
USE track;
CREATE TABLE `visits` (
@@ -65,5 +67,6 @@ visits_id myid src ip cc org ref time host entry visit_exit user_id visit_start
SELECT * FROM visits_events;
event_id visit_id timestamp src data visits_events_id
20000 21231038 2007-09-18 03:59:02 Downloads/MySQL-4.1/mysql-4.1.12a-win32.zip 33712207
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
DROP DATABASE track;
End of 5.1 tests
diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result
index a17941f6ba9..256238d35cd 100644
--- a/mysql-test/suite/rpl/r/rpl_bug33931.result
+++ b/mysql-test/suite/rpl/r/rpl_bug33931.result
@@ -1,7 +1,6 @@
reset master;
-call mtr.add_suppression("Failed during slave I/O thread initialization");
-stop slave;
reset slave;
+call mtr.add_suppression("Failed during slave I/O thread initialization");
SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
show slave status;
@@ -43,4 +42,6 @@ Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno #
Last_SQL_Error Failed during slave thread initialization
+Replicate_Ignore_Server_Ids
+Master_Server_Id 0
SET GLOBAL debug="";
diff --git a/mysql-test/suite/rpl/r/rpl_bug41902.result b/mysql-test/suite/rpl/r/rpl_bug41902.result
new file mode 100644
index 00000000000..c65773708cc
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_bug41902.result
@@ -0,0 +1,34 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+SET @@debug="d,simulate_find_log_pos_error";
+reset slave;
+ERROR HY000: Target log not found in binlog index
+show warnings;
+Level Code Message
+Error 1373 Target log not found in binlog index
+Error 1371 Failed purging old relay logs: Failed during log reset
+SET @@debug="";
+reset slave;
+change master to master_host='dummy';
+SET @@debug="d,simulate_find_log_pos_error";
+change master to master_host='dummy';
+ERROR HY000: Target log not found in binlog index
+SET @@debug="";
+reset slave;
+change master to master_host='dummy';
+SET @@debug="d,simulate_find_log_pos_error";
+reset master;
+ERROR HY000: Target log not found in binlog index
+SET @@debug="";
+reset master;
+SET @@debug="d,simulate_find_log_pos_error";
+purge binary logs to 'master-bin.000001';
+ERROR HY000: Target log not found in binlog index
+SET @@debug="";
+purge binary logs to 'master-bin.000001';
+End of the tests
diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result
index c06c1201e3d..a51ba50475b 100644
--- a/mysql-test/suite/rpl/r/rpl_change_master.result
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result
@@ -50,6 +50,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
change master to master_user='root';
SHOW SLAVE STATUS;
Slave_IO_State #
@@ -90,9 +92,28 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
start slave;
select * from t1;
n
1
2
drop table t1;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int);
+insert into t1 values (1);
+flush logs;
+insert into t1 values (2);
+include/stop_slave.inc
+delete from t1 where a=2;
+CHANGE MASTER TO relay_log_file='slave-relay-bin.000005', relay_log_pos=4;
+start slave sql_thread;
+start slave io_thread;
+set global relay_log_purge=1;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_colSize.result b/mysql-test/suite/rpl/r/rpl_colSize.result
index 91456742833..ae1ac3c7fed 100644
--- a/mysql-test/suite/rpl/r/rpl_colSize.result
+++ b/mysql-test/suite/rpl/r/rpl_colSize.result
@@ -9,6 +9,8 @@ DROP TABLE IF EXISTS t1;
*** Create "wider" table on slave ***
STOP SLAVE;
RESET SLAVE;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
CREATE TABLE t1 (
a float (47),
b double (143,9),
@@ -177,3 +179,4 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
*** Cleanup ***
DROP TABLE t1;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
index 6c8d35619e5..25c31675b53 100644
--- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
@@ -89,6 +89,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
*** Test lock wait timeout ***
include/stop_slave.inc
@@ -151,13 +153,15 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
*** Test lock wait timeout and purged relay logs ***
SET @my_max_relay_log_size= @@global.max_relay_log_size;
SET global max_relay_log_size=0;
include/stop_slave.inc
DELETE FROM t2;
-CHANGE MASTER TO MASTER_LOG_POS=440;
+CHANGE MASTER TO MASTER_LOG_POS=441;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
@@ -218,6 +222,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
*** Clean up ***
DROP TABLE t1,t2,t3;
diff --git a/mysql-test/suite/rpl/r/rpl_empty_master_crash.result b/mysql-test/suite/rpl/r/rpl_empty_master_crash.result
deleted file mode 100644
index f0d84f85069..00000000000
--- a/mysql-test/suite/rpl/r/rpl_empty_master_crash.result
+++ /dev/null
@@ -1,11 +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;
-load table t1 from master;
-ERROR 08S01: Error connecting to master: Master is not configured
-load table t1 from master;
-ERROR HY000: Error from master: 'Table 'test.t1' doesn't exist'
diff --git a/mysql-test/suite/rpl/r/rpl_empty_master_host.result b/mysql-test/suite/rpl/r/rpl_empty_master_host.result
new file mode 100644
index 00000000000..46ef32d415b
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_empty_master_host.result
@@ -0,0 +1,16 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+Master_Host = '127.0.0.1' (expected '127.0.0.1')
+CHANGE MASTER TO MASTER_HOST="";
+ERROR HY000: Incorrect arguments to MASTER_HOST
+Master_Host = '127.0.0.1' (expected '127.0.0.1')
+CHANGE MASTER TO MASTER_HOST="foo";
+Master_Host = 'foo' (expected 'foo')
+CHANGE MASTER TO MASTER_HOST="127.0.0.1";
+Master_Host = '127.0.0.1' (expected '127.0.0.1')
+START SLAVE;
diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
index 63154383e8c..a9b8c2de107 100644
--- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
@@ -9,6 +9,8 @@ call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
*** On Slave ***
STOP SLAVE;
RESET SLAVE;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(4) DEFAULT 'TEST')
@@ -32,6 +34,7 @@ a b c d e
1 2 TEXAS 2 TEST
2 1 AUSTIN 2 TEST
3 4 QA 2 TEST
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
*** Drop t1 ***
DROP TABLE t1;
*** Create t2 on slave ***
@@ -73,8 +76,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -91,8 +94,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
@@ -140,8 +145,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -158,8 +163,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t3 ***
@@ -202,8 +209,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -220,8 +227,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t4 ***
@@ -264,8 +273,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
+Last_Errno 1642
+Last_Error Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -282,8 +291,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
+Last_SQL_Errno 1642
+Last_SQL_Error Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t5 ***
@@ -325,8 +336,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
+Last_Errno 1642
+Last_Error Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -343,8 +354,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
+Last_SQL_Errno 1642
+Last_SQL_Error Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -461,8 +474,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -479,8 +492,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t10 ***
@@ -488,7 +503,7 @@ DROP TABLE t10;
*** Create t11 on slave ***
STOP SLAVE;
RESET SLAVE;
-CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
+CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='InnoDB';
*** Create t11 on Master ***
CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
@@ -522,8 +537,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -540,8 +555,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t11 ***
@@ -792,6 +809,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1060
Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
*** Try to insert in master ****
@@ -912,8 +931,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -930,8 +949,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
** DROP table t17 ***
diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
index d80ac5eea2c..4075d31c915 100644
--- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
@@ -9,6 +9,8 @@ call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
*** On Slave ***
STOP SLAVE;
RESET SLAVE;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(4) DEFAULT 'TEST')
@@ -32,6 +34,7 @@ a b c d e
1 2 TEXAS 2 TEST
2 1 AUSTIN 2 TEST
3 4 QA 2 TEST
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
*** Drop t1 ***
DROP TABLE t1;
*** Create t2 on slave ***
@@ -73,8 +76,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -91,8 +94,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
@@ -140,8 +145,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -158,8 +163,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t3 ***
@@ -202,8 +209,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -220,8 +227,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t4 ***
@@ -264,8 +273,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
+Last_Errno 1642
+Last_Error Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -282,8 +291,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
+Last_SQL_Errno 1642
+Last_SQL_Error Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t5 ***
@@ -325,8 +336,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
+Last_Errno 1642
+Last_Error Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -343,8 +354,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
+Last_SQL_Errno 1642
+Last_SQL_Error Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -461,8 +474,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -479,8 +492,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t10 ***
@@ -488,7 +503,7 @@ DROP TABLE t10;
*** Create t11 on slave ***
STOP SLAVE;
RESET SLAVE;
-CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
+CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
*** Create t11 on Master ***
CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
@@ -522,8 +537,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -540,8 +555,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t11 ***
@@ -792,6 +809,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1060
Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
*** Try to insert in master ****
@@ -912,8 +931,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -930,8 +949,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
** DROP table t17 ***
diff --git a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
index ad67f96db71..25fb6f03832 100644
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
@@ -133,6 +133,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
***** Testing Altering table def scenario *****
@@ -509,6 +511,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
****************************************
* columns in master at middle of table *
@@ -563,8 +567,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -581,8 +585,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -638,8 +644,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -656,8 +662,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -809,6 +817,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1091
Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -895,6 +905,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1054
Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -981,6 +993,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1072
Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -1274,6 +1288,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
***** Testing Altering table def scenario *****
@@ -1650,6 +1666,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
****************************************
* columns in master at middle of table *
@@ -1704,8 +1722,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -1722,8 +1740,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -1779,8 +1799,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -1797,8 +1817,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -1950,6 +1972,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1091
Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -2036,6 +2060,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1054
Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -2122,6 +2148,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1072
Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -2415,6 +2443,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
***** Testing Altering table def scenario *****
@@ -2791,6 +2821,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
****************************************
* columns in master at middle of table *
@@ -2845,8 +2877,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -2863,8 +2895,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -2920,8 +2954,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -2938,8 +2972,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -3091,6 +3127,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1091
Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -3177,6 +3215,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1054
Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -3263,6 +3303,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1072
Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
diff --git a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
index 8859a8e24e3..63f1e49239e 100644
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
@@ -133,6 +133,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
***** Testing Altering table def scenario *****
@@ -509,6 +511,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
****************************************
* columns in master at middle of table *
@@ -563,8 +567,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -581,8 +585,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -638,8 +644,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -656,8 +662,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -809,6 +817,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1091
Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -895,6 +905,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1054
Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -981,6 +993,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1072
Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -1274,6 +1288,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
***** Testing Altering table def scenario *****
@@ -1650,6 +1666,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
****************************************
* columns in master at middle of table *
@@ -1704,8 +1722,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -1722,8 +1740,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -1779,8 +1799,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -1797,8 +1817,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -1950,6 +1972,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1091
Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -2036,6 +2060,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1054
Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -2122,6 +2148,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1072
Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -2415,6 +2443,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
***** Testing Altering table def scenario *****
@@ -2791,6 +2821,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
****************************************
* columns in master at middle of table *
@@ -2845,8 +2877,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -2863,8 +2895,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -2920,8 +2954,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_Errno 1642
+Last_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -2938,8 +2972,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Last_SQL_Errno 1642
+Last_SQL_Error Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -3091,6 +3127,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1091
Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -3177,6 +3215,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1054
Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
@@ -3263,6 +3303,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1072
Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
diff --git a/mysql-test/suite/rpl/r/rpl_flush_logs.result b/mysql-test/suite/rpl/r/rpl_flush_logs.result
new file mode 100644
index 00000000000..7f50ce0cdd0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_flush_logs.result
@@ -0,0 +1,67 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+# Make sure the 'master_log.err-old' file does not
+# exist before execute 'flush error logs' statement.
+# Test if support 'flush error logs' statement.
+flush error logs;
+# Check the 'master_log.err-old' file is created
+# after executed 'flush error logs' statement.
+# Make sure binary logs was not be flushed
+# after execute 'flush error logs' statement.
+# Make sure relay logs was not be flushed
+# after execute 'flush error logs' statement.
+# Make sure the 'slave-relay-bin.000004' file does not
+# exist before execute 'flush relay logs' statement.
+# Test if support 'flush relay logs' statement.
+flush relay logs;
+# Check the 'slave-relay-bin.000004' file is created
+# after executed 'flush relay logs' statement.
+# Make sure binary logs was not be flushed
+# after execute 'flush relay logs' statement.
+# Test if support 'flush slow logs' statement.
+flush slow logs;
+# Make sure binary logs was not be flushed
+# after execute 'flush slow logs' statement.
+# Test if support 'flush general logs' statement.
+flush general logs;
+# Make sure binary logs was not be flushed
+# after execute 'flush general logs' statement.
+# Test if support 'flush engine logs' statement.
+flush engine logs;
+# Make sure binary logs was not be flushed
+# after execute 'flush engine logs' statement.
+# Make sure the 'master-bin.000002' file does not
+# exist before execute 'flush binary logs' statement.
+# Test if support 'flush binary logs' statement.
+flush binary logs;
+# Check the 'master-bin.000002' file is created
+# after executed 'flush binary logs' statement.
+# Make sure the 'slave-relay-bin.000007' file does not exist
+# exist before execute 'flush error logs, relay logs' statement.
+# Make sure the 'master_log.err-old' file does not exist
+# before execute 'flush error logs, relay logs' statement.
+# Test if support to combine all kinds of logs into one statement.
+flush error logs, relay logs;
+# Check the 'master_log.err-old' file is created
+# after executed 'flush error logs, relay logs' statement.
+# Make sure binary logs was not be flushed
+# after execute 'flush error logs, relay logs' statement.
+# Check the 'slave-relay-bin.000007' file is created after
+# execute 'flush error logs, relay logs' statement.
+# Make sure the 'slave-relay-bin.000008' and 'slave-relay-bin.000009'
+# files do not exist before execute 'flush error logs, relay logs'
+# statement.
+# Make sure the 'master_log.err-old' file does not exist
+# before execute 'flush logs' statement.
+# Test if 'flush logs' statement works fine and flush all the logs.
+flush logs;
+# Check the 'master_log.err-old' file is created
+# after executed 'flush logs' statement.
+# Check 'master-bin.000003' is created
+# after execute 'flush logs' statement.
+# Check the 'slave-relay-bin.000008' and 'slave-relay-bin.000009'
+# files are created after execute 'flush logs' statement.
diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
index 600ac44fc86..5e74a4eb999 100644
--- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
+++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
@@ -10,6 +10,7 @@ relay_log MYSQLD_DATADIR/relay-log
relay_log_index
relay_log_info_file relay-log.info
relay_log_purge ON
+relay_log_recovery OFF
relay_log_space_limit 0
stop slave;
change master to master_host='127.0.0.1',master_user='root',
@@ -59,3 +60,5 @@ Last_IO_Errno #
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 2
diff --git a/mysql-test/suite/rpl/r/rpl_grant.result b/mysql-test/suite/rpl/r/rpl_grant.result
index 1bed6101e3c..fc32dcefec7 100644
--- a/mysql-test/suite/rpl/r/rpl_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_grant.result
@@ -80,3 +80,5 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat.result b/mysql-test/suite/rpl/r/rpl_heartbeat.result
new file mode 100644
index 00000000000..92ba8549ee4
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result
@@ -0,0 +1,143 @@
+reset master;
+set @restore_slave_net_timeout= @@global.slave_net_timeout;
+set @@global.slave_net_timeout= 10;
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
+show status like 'Slave_heartbeat_period';;
+Variable_name Slave_heartbeat_period
+Value 5.000
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 4294968;
+ERROR HY000: The requested value for the heartbeat period is negative or exceeds the maximum 4294967 seconds
+show status like 'Slave_heartbeat_period';;
+Variable_name Slave_heartbeat_period
+Value 5.000
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 0.0009999;
+Warnings:
+Warning 1624 The requested value for the heartbeat period is less than 1 msec. The period is reset to zero which means no heartbeats will be sending
+show status like 'Slave_heartbeat_period';;
+Variable_name Slave_heartbeat_period
+Value 0.000
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 4294967;
+Warnings:
+Warning 1624 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
+show status like 'Slave_heartbeat_period';;
+Variable_name Slave_heartbeat_period
+Value 4294967.000
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 0.001;
+show status like 'Slave_heartbeat_period';;
+Variable_name Slave_heartbeat_period
+Value 0.001
+reset slave;
+set @@global.slave_net_timeout= 5;
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 5.001;
+Warnings:
+Warning 1624 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
+show status like 'Slave_heartbeat_period';;
+Variable_name Slave_heartbeat_period
+Value 5.001
+reset slave;
+set @@global.slave_net_timeout= 5;
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 4;
+show status like 'Slave_heartbeat_period';;
+Variable_name Slave_heartbeat_period
+Value 4.000
+set @@global.slave_net_timeout= 3 /* must be a warning */;
+Warnings:
+Warning 1624 The currect value for master_heartbeat_period exceeds the new value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
+reset slave;
+drop table if exists t1;
+set @@global.slave_net_timeout= 10;
+change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 0.5;
+show status like 'Slave_heartbeat_period';;
+Variable_name Slave_heartbeat_period
+Value 0.500
+start slave;
+create table t1 (f1 int);
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 60
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 280
+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 280
+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 #
+Last_IO_Error #
+Last_SQL_Errno 0
+Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 60
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 280
+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 280
+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 #
+Last_IO_Error #
+Last_SQL_Errno 0
+Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
+show status like 'Slave_heartbeat_period';;
+Variable_name Slave_heartbeat_period
+Value 0.500
+A heartbeat has been received by the slave
+drop table t1;
+set @@global.slave_net_timeout= @restore_slave_net_timeout;
+End of tests
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result b/mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result
new file mode 100644
index 00000000000..ecb7c62c488
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result
@@ -0,0 +1,55 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+*** Preparing ***
+[on slave]
+include/stop_slave.inc
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='MASTER_BINLOG';
+include/start_slave.inc
+[on slave1]
+STOP SLAVE;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='MASTER_BINLOG';
+include/start_slave.inc
+
+*** 2 slaves ***
+Slave has received heartbeat event
+Slave1 has received heartbeat event
+Slave has received more heartbeats than Slave1 (1 means 'yes'): 1
+
+*** Master->data->Slave1->heartbeat->Slave: ***
+[on slave1]
+RESET MASTER;
+[on slave]
+include/stop_slave.inc
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE1_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.2, MASTER_LOG_FILE='SLAVE1_BINLOG';
+include/start_slave.inc
+Slave has received heartbeat event
+[on master]
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT);
+INSERT INTO t1 VALUES (1, 'on master', '');
+SHOW TABLES;
+Tables_in_test
+t1
+[on slave1]
+SHOW TABLES;
+Tables_in_test
+t1
+[on slave]
+SHOW TABLES;
+Tables_in_test
+[on master]
+creating updates on master and send to slave1 during 5 second
+[on slave]
+Slave has received heartbeats (1 means 'yes'): 1
+
+*** Clean up ***
+DROP TABLE t1;
+
+End of 6.0 test
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
new file mode 100644
index 00000000000..d229e1260dd
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
@@ -0,0 +1,299 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+*** Preparing ***
+include/stop_slave.inc
+RESET SLAVE;
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+RESET MASTER;
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+SET @restore_event_scheduler=@@global.event_scheduler;
+
+*** Default value ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
+slave_net_timeout/slave_heartbeat_timeout=2.0000
+RESET SLAVE;
+
+*** Reset slave affect ***
+SET @@global.slave_net_timeout=30;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+RESET SLAVE;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 15.000
+
+*** Default value if slave_net_timeout changed ***
+SET @@global.slave_net_timeout=50;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 25.000
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+
+*** Warning if updated slave_net_timeout < slave_heartbeat_timeout ***
+SET @@global.slave_net_timeout=FLOOR(SLAVE_HEARTBEAT_TIMEOUT)-1;
+Warnings:
+Warning 1624 The currect value for master_heartbeat_period exceeds the new value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+
+*** Warning if updated slave_heartbeat_timeout > slave_net_timeout ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=SLAVE_NET_TIMEOUT;
+Warnings:
+Warning 1624 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
+RESET SLAVE;
+
+*** CHANGE MASTER statement only updates slave_heartbeat_period ***
+SET @@global.slave_net_timeout=20;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+SHOW VARIABLES LIKE 'slave_net_timeout';
+Variable_name Value
+slave_net_timeout 20
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 5.000
+SET @@global.slave_net_timeout=2*@@global.slave_net_timeout;
+SHOW VARIABLES LIKE 'slave_net_timeout';
+Variable_name Value
+slave_net_timeout 40
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 5.000
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+
+*** Update slave_net_timeout on master ***
+SET @@global.slave_net_timeout=500;
+SET @@global.slave_net_timeout=200;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
+include/start_slave.inc
+SHOW VARIABLES LIKE 'slave_net_timeout';
+Variable_name Value
+slave_net_timeout 200
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 100.000
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+include/stop_slave.inc
+RESET SLAVE;
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+
+*** Start/stop slave ***
+SET @@global.slave_net_timeout=100;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=20;
+include/start_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 20.000
+include/stop_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 20.000
+
+*** Reload slave ***
+SET @@global.slave_net_timeout=50;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=30;
+Reload slave
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 30.000
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+
+*** Disable heartbeat ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 0.000
+SHOW STATUS LIKE 'slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 0
+include/start_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 0.000
+SHOW STATUS LIKE 'slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 0
+include/stop_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 0.000
+SHOW STATUS LIKE 'slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 0
+RESET SLAVE;
+SELECT SLAVE_HEARTBEAT_TIMEOUT = 0 AS Result;
+Result
+0
+
+*** Min slave_heartbeat_timeout ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.001;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 0.001
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.0009;
+Warnings:
+Warning 1624 The requested value for the heartbeat period is less than 1 msec. The period is reset to zero which means no heartbeats will be sending
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 0.000
+RESET SLAVE;
+
+*** Max slave_heartbeat_timeout ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967;
+Warnings:
+Warning 1624 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 4294967.000
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294968;
+ERROR HY000: The requested value for the heartbeat period is negative or exceeds the maximum 4294967 seconds
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=8589935;
+ERROR HY000: The requested value for the heartbeat period is negative or exceeds the maximum 4294967 seconds
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967296;
+ERROR HY000: The requested value for the heartbeat period is negative or exceeds the maximum 4294967 seconds
+RESET SLAVE;
+
+*** Misc incorrect values ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='-1';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''-1'' at line 1
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='123abc';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''123abc'' at line 1
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' at line 1
+RESET SLAVE;
+
+*** Running slave ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+include/start_slave.inc
+Heartbeat event received
+
+*** Stopped slave ***
+include/stop_slave.inc
+Number of received heartbeat events while slave stopped: 0
+
+*** Started slave ***
+include/start_slave.inc
+Heartbeat event received
+
+*** Stopped IO thread ***
+STOP SLAVE IO_THREAD;
+Number of received heartbeat events while io thread stopped: 0
+
+*** Started IO thread ***
+START SLAVE IO_THREAD;
+Heartbeat event received
+
+*** Stopped SQL thread ***
+STOP SLAVE SQL_THREAD;
+Heartbeat events are received while sql thread stopped (1 means 'yes'): 1
+
+*** Started SQL thread ***
+START SLAVE SQL_THREAD;
+Heartbeat event received
+
+*** Stopped SQL thread by error ***
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT);
+INSERT INTO t1 VALUES (1, 'on slave', NULL);
+INSERT INTO t1 VALUES (1, 'on master', NULL);
+Heartbeat events are received while sql thread stopped (1 means 'yes'): 1
+include/stop_slave.inc
+DROP TABLE t1;
+
+*** Master send to slave ***
+CREATE EVENT e1
+ON SCHEDULE EVERY 1 SECOND
+DO
+BEGIN
+UPDATE test.t1 SET a = a + 1 WHERE a < 10;
+END|
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+include/start_slave.inc
+SET @@global.event_scheduler=1;
+Number of received heartbeat events: 0
+DELETE FROM t1;
+DROP EVENT e1;
+
+*** Flush logs on slave ***
+STOP SLAVE;
+RESET SLAVE;
+DROP TABLE t1;
+DROP TABLE t1;
+RESET MASTER;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.5;
+include/start_slave.inc
+Heartbeat events are received while rotation of relay logs (1 means 'yes'): 1
+
+*** Compressed protocol ***
+SET @@global.slave_compressed_protocol=1;
+include/stop_slave.inc
+RESET SLAVE;
+SET @@global.slave_compressed_protocol=1;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+include/start_slave.inc
+Heartbeat event received
+SET @@global.slave_compressed_protocol=0;
+SET @@global.slave_compressed_protocol=0;
+
+*** Reset master ***
+STOP SLAVE;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+include/start_slave.inc
+RESET MASTER;
+Heartbeat events are received after reset of master (1 means 'yes'): 1
+
+*** Reload master ***
+STOP SLAVE;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+include/start_slave.inc
+Heartbeat event received
+Reload master
+Heartbeat event received
+
+*** Circular replication ***
+RESET MASTER;
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10));
+include/stop_slave.inc
+RESET MASTER;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='MASTER_BINLOG';
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='SLAVE_BINLOG';
+include/start_slave.inc
+INSERT INTO t1 VALUES(1, 'on master');
+include/start_slave.inc
+INSERT INTO t1 VALUES(2, 'on slave');
+SELECT * FROM t1 ORDER BY a;
+a b
+1 on master
+2 on slave
+SELECT * FROM t1 ORDER BY a;
+a b
+1 on master
+2 on slave
+Heartbeat event received on master
+Heartbeat event received on slave
+Slave has received more events than master (1 means 'yes'): 1
+
+*** Clean up ***
+include/stop_slave.inc
+DROP TABLE t1;
+include/stop_slave.inc
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+
+End of 6.0 test
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result b/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result
new file mode 100644
index 00000000000..42de3c459cb
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result
@@ -0,0 +1,27 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+*** Heartbeat over SSL ***
+include/stop_slave.inc
+RESET SLAVE;
+CHANGE MASTER TO
+MASTER_HOST='127.0.0.1',
+MASTER_PORT=MASTER_PORT,
+MASTER_USER='root',
+MASTER_HEARTBEAT_PERIOD=0.1,
+MASTER_LOG_FILE='MASTER_BINLOG',
+MASTER_SSL=1,
+MASTER_SSL_CA='MYSQL_TEST_DIR/std_data/cacert.pem',
+MASTER_SSL_CERT='MYSQL_TEST_DIR/std_data/client-cert.pem',
+MASTER_SSL_KEY='MYSQL_TEST_DIR/std_data/client-key.pem';
+include/start_slave.inc
+Master_SSL_Allowed: Yes
+Heartbeat event has received
+
+*** Clean up ***
+
+End of 6.0 test
diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result
index c3baabbdbc3..a9b641b243b 100644
--- a/mysql-test/suite/rpl/r/rpl_incident.result
+++ b/mysql-test/suite/rpl/r/rpl_incident.result
@@ -64,6 +64,8 @@ Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 1590
Last_SQL_Error The incident LOST_EVENTS occured on the master. Message: <none>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SELECT * FROM t1;
@@ -111,4 +113,6 @@ Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
index 75180334c28..7f346070290 100644
--- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
+++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
@@ -33,7 +33,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 1105
Last_Error Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10'
Skip_Counter 0
-Exec_Master_Log_Pos 246
+Exec_Master_Log_Pos 247
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -50,6 +50,8 @@ Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 1105
Last_SQL_Error Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT * FROM t1;
a b
stop slave;
@@ -120,7 +122,7 @@ FROM t2
ON DUPLICATE KEY UPDATE
t1.field_3 = t2.field_c'
Skip_Counter 0
-Exec_Master_Log_Pos 1278
+Exec_Master_Log_Pos 1279
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -141,6 +143,8 @@ SELECT t2.field_a, t2.field_b, t2.field_c
FROM t2
ON DUPLICATE KEY UPDATE
t1.field_3 = t2.field_c'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT * FROM t1;
id field_1 field_2 field_3
drop table t1, t2;
diff --git a/mysql-test/suite/rpl/r/rpl_load_from_master.result b/mysql-test/suite/rpl/r/rpl_load_from_master.result
deleted file mode 100644
index e1c2ecb35be..00000000000
--- a/mysql-test/suite/rpl/r/rpl_load_from_master.result
+++ /dev/null
@@ -1,133 +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;
-drop database if exists mysqltest;
-drop database if exists mysqltest2;
-drop database if exists mysqltest3;
-drop database if exists mysqltest;
-drop database if exists mysqltest2;
-drop database if exists mysqltest3;
-create database mysqltest2;
-create database mysqltest;
-create database mysqltest2;
-create table mysqltest2.foo (n int)ENGINE=MyISAM;
-insert into mysqltest2.foo values(4);
-create table mysqltest2.foo (n int)ENGINE=MyISAM;
-insert into mysqltest2.foo values(5);
-create table mysqltest.bar (m int)ENGINE=MyISAM;
-insert into mysqltest.bar values(15);
-select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
-n m
-4 15
-drop database mysqltest;
-drop database if exists mysqltest2;
-drop database mysqltest;
-ERROR HY000: Can't drop database 'mysqltest'; database doesn't exist
-drop database mysqltest2;
-set sql_log_bin = 0;
-create database mysqltest2;
-create database mysqltest;
-show databases like 'mysql%';
-Database (mysql%)
-mysql
-mysqltest
-mysqltest2
-create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
-create table mysqltest2.t2(n int, s text)ENGINE=MyISAM;
-insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
-insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
-create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
-create table mysqltest.t2(n int, s text)ENGINE=MyISAM;
-insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
-insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
-(13, 'thirteen test');
-set sql_log_bin = 1;
-show databases like 'mysql%';
-Database (mysql%)
-mysql
-create database mysqltest2;
-create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
-insert into mysqltest2.t1 values (1, 'original foo.t1');
-create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM;
-insert into mysqltest2.t3 values (1, 'original foo.t3');
-create database mysqltest3;
-create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM;
-insert into mysqltest3.t1 values (1, 'original foo2.t1');
-create database mysqltest;
-create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
-insert into mysqltest.t1 values (1, 'original bar.t1');
-create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM;
-insert into mysqltest.t3 values (1, 'original bar.t3');
-load data from master;
-show databases like 'mysql%';
-Database (mysql%)
-mysql
-mysqltest
-mysqltest2
-mysqltest3
-use mysqltest2;
-show tables;
-Tables_in_mysqltest2
-t1
-t3
-select * from t1;
-n s
-1 original foo.t1
-use mysqltest3;
-show tables;
-Tables_in_mysqltest3
-t1
-select * from t1;
-n s
-1 original foo2.t1
-use mysqltest;
-show tables;
-Tables_in_mysqltest
-t1
-t2
-t3
-select * from mysqltest.t1;
-n s
-1 one test
-2 two test
-3 three test
-select * from mysqltest.t2;
-n s
-11 eleven test
-12 twelve test
-13 thirteen test
-select * from mysqltest.t3;
-n s
-1 original bar.t3
-insert into mysqltest.t1 values (4, 'four test');
-select * from mysqltest.t1;
-n s
-1 one test
-2 two test
-3 three test
-4 four test
-stop slave;
-reset slave;
-load data from master;
-start slave;
-insert into mysqltest.t1 values (5, 'five bar');
-select * from mysqltest.t1;
-n s
-1 one test
-2 two test
-3 three test
-4 four test
-5 five bar
-load table mysqltest.t1 from master;
-ERROR 42S01: Table 't1' already exists
-drop table mysqltest.t1;
-load table mysqltest.t1 from master;
-load table bar.t1 from master;
-ERROR HY000: Error from master: 'Table 'bar.t1' doesn't exist'
-drop database mysqltest;
-drop database mysqltest2;
-drop database mysqltest2;
-drop database mysqltest3;
diff --git a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result
deleted file mode 100644
index 9d9a1d7d6cb..00000000000
--- a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result
+++ /dev/null
@@ -1,51 +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;
-"******************** Test Requirment 1 *************"
-SET SQL_LOG_BIN=0,timestamp=200006;
-CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM;
-INSERT INTO t1 ( a) VALUE ('F');
-select unix_timestamp(t) from t1;
-unix_timestamp(t)
-200006
-load table t1 from master;
-select unix_timestamp(t) from t1;
-unix_timestamp(t)
-200006
-set SQL_LOG_BIN=1,timestamp=default;
-drop table t1;
-set SQL_LOG_BIN=0;
-"******************** Test Requirment 2 *************"
-CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
-INSERT INTO t1 VALUES (1);
-load table t1 from master;
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-drop table t1;
-drop table t1;
-set SQL_LOG_BIN=0;
-create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
-load data infile '../../std_data/words.dat' into table t1;
-create table t2 (word char(20) not null)ENGINE=MyISAM;
-load data infile '../../std_data/words.dat' into table t2;
-create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
-load table t1 from master;
-load table t2 from master;
-load table t3 from master;
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-select count(*) from t2;
-count(*)
-70
-select count(*) from t3;
-count(*)
-0
-set SQL_LOG_BIN=1;
-drop table if exists t1,t2,t3;
-create table t1(n int);
-drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata.result b/mysql-test/suite/rpl/r/rpl_loaddata.result
index ca9c14691b0..4e81d90a970 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata.result
@@ -34,9 +34,47 @@ insert into t1 values(1,10);
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
set global sql_slave_skip_counter=1;
start slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 2009 # # master-bin.000001 Yes Yes # 0 0 2009 # None 0 No # No 0 0
+show slave status;;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 2010
+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 2010
+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
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
@@ -44,9 +82,47 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1;
stop slave;
change master to master_user='test';
change master to master_user='root';
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 2044 # # master-bin.000001 No No # 0 0 2044 # None 0 No # No 0 0
+show slave status;;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 2045
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 2045
+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
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
@@ -55,9 +131,47 @@ set sql_log_bin=1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
stop slave;
reset slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # No 0 0
+show slave status;;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File
+Read_Master_Log_Pos 4
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 0
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+Last_IO_Errno 0
+Last_IO_Error
+Last_SQL_Errno 0
+Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=MyISAM;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
index 35696615b5a..a4d6e419d83 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
@@ -13,7 +13,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 290
+Read_Master_Log_Pos 291
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -28,7 +28,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 290
+Exec_Master_Log_Pos 291
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -45,6 +45,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
SHOW SLAVE STATUS;
Slave_IO_State #
@@ -53,7 +55,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 556
+Read_Master_Log_Pos 557
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -68,7 +70,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 1593
Last_Error Fatal error: Not enough memory
Skip_Counter 0
-Exec_Master_Log_Pos 325
+Exec_Master_Log_Pos 326
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -85,6 +87,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1593
Last_SQL_Error Fatal error: Not enough memory
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result
index 85fa4c10eac..433351b41f7 100644
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result
@@ -49,6 +49,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
start slave;
include/stop_slave.inc
SHOW SLAVE STATUS;
@@ -90,6 +92,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result
index 08d3241c48f..a353ee73d3f 100644
--- a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result
@@ -13,8 +13,8 @@ n
2001
2002
show slave hosts;
-Server_id Host Port Rpl_recovery_rank Master_id
-2 127.0.0.1 9999 0 1
+Server_id Host Port Master_id
+2 127.0.0.1 9999 1
drop table t1;
stop slave;
create table t2(id int auto_increment primary key, created datetime);
diff --git a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
index 2e707fb62c1..53e8899d27f 100644
--- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
+++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
@@ -31,7 +31,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 594
+Read_Master_Log_Pos 595
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -46,7 +46,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 594
+Exec_Master_Log_Pos 595
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -63,6 +63,8 @@ Last_IO_Errno #
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
diff --git a/mysql-test/suite/rpl/r/rpl_replicate_do.result b/mysql-test/suite/rpl/r/rpl_replicate_do.result
index 33088ee2ec8..2fbd283a9c8 100644
--- a/mysql-test/suite/rpl/r/rpl_replicate_do.result
+++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result
@@ -65,6 +65,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
create table t1 (ts timestamp);
set one_shot time_zone='met';
insert into t1 values('2005-08-12 00:00:00');
diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result
index 013ba87ec0b..b3b1480a740 100644
--- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result
+++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result
@@ -53,6 +53,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
select * from t1;
s
Could not break slave
@@ -132,6 +134,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
select * from t2;
m
34
@@ -196,6 +200,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
index 7920b9a981d..27960be8054 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
@@ -58,12 +58,12 @@ DELETE FROM t1 WHERE a = 0;
UPDATE t1 SET a=99 WHERE a = 0;
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a INT)
-master-bin.000001 192 Query 1 260 BEGIN
-master-bin.000001 260 Table_map 1 301 table_id: # (test.t1)
-master-bin.000001 301 Write_rows 1 340 table_id: # flags: STMT_END_F
-master-bin.000001 340 Query 1 409 COMMIT
+master-bin.000001 4 Format_desc 1 107 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 107 Query 1 193 use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 193 Query 1 261 BEGIN
+master-bin.000001 261 Table_map 1 302 table_id: # (test.t1)
+master-bin.000001 302 Write_rows 1 341 table_id: # flags: STMT_END_F
+master-bin.000001 341 Query 1 410 COMMIT
DROP TABLE t1;
================ Test for BUG#17620 ================
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
index a980092ac37..9c8f87af5af 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
@@ -476,6 +476,8 @@ ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
CREATE TABLE t7 (i INT NOT NULL,
c CHAR(255) CHARACTER SET utf8 NOT NULL,
j INT NOT NULL) ENGINE = 'MYISAM' ;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
[expecting slave to replicate correctly]
INSERT INTO t1 VALUES (1, "", 1);
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
@@ -484,11 +486,7 @@ Comparing tables master:test.t1 and slave:test.t1
INSERT INTO t2 VALUES (1, "", 1);
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
Comparing tables master:test.t2 and slave:test.t2
-[expecting slave to stop]
-INSERT INTO t3 VALUES (1, "", 1);
-INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
-Last_SQL_Error
-Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -501,7 +499,7 @@ Comparing tables master:test.t4 and slave:test.t4
INSERT INTO t5 VALUES (1, "", 1);
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
Last_SQL_Error
-Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.
+Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)'
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -510,7 +508,7 @@ START SLAVE;
INSERT INTO t6 VALUES (1, "", 1);
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
Last_SQL_Error
-Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.
+Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)'
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
index ea0c322fe6d..4cf4c9fb27d 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
@@ -354,6 +354,8 @@ X Q 5 7 R 49 X Y 2 S 1
X Q 5 7 R 49 X Z 2 S 2
X Q 5 9 R 81 X Y 2 S 1
X Q 5 9 R 81 X Z 2 S 2
+SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY';
CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = 'INNODB' ;
INSERT INTO t4 SET C1 = 1;
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
@@ -362,6 +364,7 @@ C1 HEX(B1) HEX(B2)
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
C1 HEX(B1) HEX(B2)
1 NULL 0
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'INNODB' ;
--- on slave: original values ---
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
@@ -476,6 +479,8 @@ ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
CREATE TABLE t7 (i INT NOT NULL,
c CHAR(255) CHARACTER SET utf8 NOT NULL,
j INT NOT NULL) ENGINE = 'INNODB' ;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
[expecting slave to replicate correctly]
INSERT INTO t1 VALUES (1, "", 1);
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
@@ -484,11 +489,7 @@ Comparing tables master:test.t1 and slave:test.t1
INSERT INTO t2 VALUES (1, "", 1);
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
Comparing tables master:test.t2 and slave:test.t2
-[expecting slave to stop]
-INSERT INTO t3 VALUES (1, "", 1);
-INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
-Last_SQL_Error
-Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -501,7 +502,7 @@ Comparing tables master:test.t4 and slave:test.t4
INSERT INTO t5 VALUES (1, "", 1);
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
Last_SQL_Error
-Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.
+Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)'
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -510,7 +511,7 @@ START SLAVE;
INSERT INTO t6 VALUES (1, "", 1);
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
Last_SQL_Error
-Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.
+Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)'
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -597,6 +598,8 @@ UPDATE t1 SET a = 0 WHERE a < 4;
UPDATE t1 SET a = 8 WHERE a < 5;
Comparing tables master:test.t1 and slave:test.t1
drop table t1;
+SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY';
CREATE TABLE t1 (a bit) ENGINE='INNODB' ;
INSERT IGNORE INTO t1 VALUES (NULL);
INSERT INTO t1 ( a ) VALUES ( 0 );
@@ -637,5 +640,6 @@ DELETE FROM t1 WHERE a < 3 LIMIT 0;
UPDATE t1 SET a = 8 WHERE a = 5 LIMIT 2;
INSERT INTO t1 ( a ) VALUES ( 1 );
UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
Comparing tables master:test.t1 and slave:test.t1
drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_colSize.result b/mysql-test/suite/rpl/r/rpl_row_colSize.result
index 6d002a722f1..fd9d9f76ec9 100644
--- a/mysql-test/suite/rpl/r/rpl_row_colSize.result
+++ b/mysql-test/suite/rpl/r/rpl_row_colSize.result
@@ -37,8 +37,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -55,8 +55,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -91,8 +93,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 12, test.t1 on slave has size 12. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'decimal(27,18)' to type 'decimal(27,9)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -109,8 +111,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 12, test.t1 on slave has size 12. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'decimal(27,18)' to type 'decimal(27,9)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -145,8 +149,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -163,8 +167,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -200,8 +206,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'double' to type 'float'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -218,8 +224,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'double' to type 'float'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -255,8 +263,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 8, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'bit(64)' to type 'bit(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -273,8 +281,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 8, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'bit(64)' to type 'bit(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -309,8 +319,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 2. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'bit(12)' to type 'bit(11)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -327,8 +337,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 2. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'bit(12)' to type 'bit(11)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -364,8 +376,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'set' to type 'set('4')'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -382,8 +394,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'set' to type 'set('4')'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -419,8 +433,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 20, test.t1 on slave has size 11. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'char(20)' to type 'char(10)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -437,8 +451,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 20, test.t1 on slave has size 11. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'char(20)' to type 'char(10)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -505,8 +521,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'enum' to type 'enum('44','54')'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -523,8 +539,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'enum' to type 'enum('44','54')'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -560,8 +578,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 100. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(100)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -578,8 +596,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 100. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(100)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -614,8 +634,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 200, test.t1 on slave has size 10. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'varchar(200)' to type 'varchar(10)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -632,8 +652,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 200, test.t1 on slave has size 10. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'varchar(200)' to type 'varchar(10)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -668,8 +690,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 1000. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(1000)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -686,8 +708,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 1000. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(1000)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -723,8 +747,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 4, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.
+Last_Errno 1642
+Last_Error Column 0 of table 'test.t1' cannot be converted from type 'tinyblob' to type 'tinyblob'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -741,8 +765,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 4, test.t1 on slave has size 1. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1642
+Last_SQL_Error Column 0 of table 'test.t1' cannot be converted from type 'tinyblob' to type 'tinyblob'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT COUNT(*) FROM t1;
COUNT(*)
0
diff --git a/mysql-test/suite/rpl/r/rpl_row_conflicts.result b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
index 0f15bfc7156..6f98c25c335 100644
--- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result
+++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
@@ -24,7 +24,7 @@ a
1
[on slave]
---- Wait until slave stops with an error ----
-Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 346 (expected "duplicate key" error)
+Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 347 (expected "duplicate key" error)
SELECT * FROM t1;
a
1
@@ -50,7 +50,7 @@ SELECT * FROM t1;
a
[on slave]
---- Wait until slave stops with an error ----
-Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 982 (expected "can't find record" error)
+Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 983 (expected "can't find record" error)
SELECT * FROM t1;
a
---- Resolve the conflict on the slave and restart SQL thread ----
diff --git a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result
index 4c2b9ebeaee..9fc48e32645 100644
--- a/mysql-test/suite/rpl/r/rpl_row_create_table.result
+++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result
@@ -13,30 +13,30 @@ CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
Log_name #
-Pos 106
+Pos 107
Event_type Query
Server_id #
-End_log_pos 199
+End_log_pos 200
Info use `test`; CREATE TABLE t1 (a INT, b INT)
Log_name #
-Pos 199
+Pos 200
Event_type Query
Server_id #
-End_log_pos 305
+End_log_pos 306
Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
Log_name #
-Pos 305
+Pos 306
Event_type Query
Server_id #
-End_log_pos 411
+End_log_pos 412
Info use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
Log_name #
-Pos 411
+Pos 412
Event_type Query
Server_id #
-End_log_pos 530
+End_log_pos 531
Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
**** On Master ****
SHOW CREATE TABLE t1;
@@ -137,7 +137,7 @@ RESET MASTER;
include/start_slave.inc
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
ERROR 23000: Duplicate entry '2' for key 'b'
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
Log_name Pos Event_type Server_id End_log_pos Info
CREATE TABLE t7 (a INT, b INT UNIQUE);
INSERT INTO t7 SELECT a,b FROM tt3;
@@ -147,13 +147,13 @@ a b
1 2
2 4
3 6
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
Log_name Pos Event_type Server_id End_log_pos Info
-# 106 Query # 206 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
-# 206 Query # 274 BEGIN
-# 274 Table_map # 316 table_id: # (test.t7)
-# 316 Write_rows # 372 table_id: # flags: STMT_END_F
-# 372 Query # 443 ROLLBACK
+# 107 Query # 207 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
+# 207 Query # 275 BEGIN
+# 275 Table_map # 317 table_id: # (test.t7)
+# 317 Write_rows # 373 table_id: # flags: STMT_END_F
+# 373 Query # 444 ROLLBACK
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
@@ -171,12 +171,12 @@ INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
Log_name Pos Event_type Server_id End_log_pos Info
-# 106 Query # 174 BEGIN
-# 174 Table_map # 216 table_id: # (test.t7)
-# 216 Write_rows # 272 table_id: # flags: STMT_END_F
-# 272 Query # 341 COMMIT
+# 107 Query # 175 BEGIN
+# 175 Table_map # 217 table_id: # (test.t7)
+# 217 Write_rows # 273 table_id: # flags: STMT_END_F
+# 273 Query # 342 COMMIT
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
@@ -216,10 +216,10 @@ Create Table CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
Log_name Pos Event_type Server_id End_log_pos Info
-# 106 Query # 192 use `test`; CREATE TABLE t8 LIKE t4
-# 192 Query # 331 use `test`; CREATE TABLE `t9` (
+# 107 Query # 193 use `test`; CREATE TABLE t8 LIKE t4
+# 193 Query # 332 use `test`; CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
)
@@ -296,38 +296,38 @@ a
1
2
3
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
Log_name Pos Event_type Server_id End_log_pos Info
-# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT)
-# 192 Query # 260 BEGIN
-# 260 Table_map # 301 table_id: # (test.t1)
-# 301 Write_rows # 345 table_id: # flags: STMT_END_F
-# 345 Query # 414 COMMIT
-# 414 Query # 482 BEGIN
-# 482 Query # 607 use `test`; CREATE TABLE `t2` (
+# 107 Query # 193 use `test`; CREATE TABLE t1 (a INT)
+# 193 Query # 261 BEGIN
+# 261 Table_map # 302 table_id: # (test.t1)
+# 302 Write_rows # 346 table_id: # flags: STMT_END_F
+# 346 Query # 415 COMMIT
+# 415 Query # 483 BEGIN
+# 483 Query # 608 use `test`; CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
-# 607 Table_map # 648 table_id: # (test.t2)
-# 648 Write_rows # 692 table_id: # flags: STMT_END_F
-# 692 Xid # 719 COMMIT /* XID */
-# 719 Query # 787 BEGIN
-# 787 Query # 912 use `test`; CREATE TABLE `t3` (
+# 608 Table_map # 649 table_id: # (test.t2)
+# 649 Write_rows # 693 table_id: # flags: STMT_END_F
+# 693 Xid # 720 COMMIT /* XID */
+# 720 Query # 788 BEGIN
+# 788 Query # 913 use `test`; CREATE TABLE `t3` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
-# 912 Table_map # 953 table_id: # (test.t3)
-# 953 Write_rows # 997 table_id: # flags: STMT_END_F
-# 997 Xid # 1024 COMMIT /* XID */
-# 1024 Query # 1092 BEGIN
-# 1092 Query # 1217 use `test`; CREATE TABLE `t4` (
+# 913 Table_map # 954 table_id: # (test.t3)
+# 954 Write_rows # 998 table_id: # flags: STMT_END_F
+# 998 Xid # 1025 COMMIT /* XID */
+# 1025 Query # 1093 BEGIN
+# 1093 Query # 1218 use `test`; CREATE TABLE `t4` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
-# 1217 Table_map # 1258 table_id: # (test.t4)
-# 1258 Write_rows # 1302 table_id: # flags: STMT_END_F
-# 1302 Xid # 1329 COMMIT /* XID */
-# 1329 Query # 1397 BEGIN
-# 1397 Table_map # 1438 table_id: # (test.t1)
-# 1438 Write_rows # 1482 table_id: # flags: STMT_END_F
-# 1482 Query # 1551 COMMIT
+# 1218 Table_map # 1259 table_id: # (test.t4)
+# 1259 Write_rows # 1303 table_id: # flags: STMT_END_F
+# 1303 Xid # 1330 COMMIT /* XID */
+# 1330 Query # 1398 BEGIN
+# 1398 Table_map # 1439 table_id: # (test.t1)
+# 1439 Write_rows # 1483 table_id: # flags: STMT_END_F
+# 1483 Query # 1552 COMMIT
SHOW TABLES;
Tables_in_test
t1
@@ -390,20 +390,20 @@ a
4
6
9
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
Log_name Pos Event_type Server_id End_log_pos Info
-# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT)
-# 192 Query # 260 BEGIN
-# 260 Table_map # 301 table_id: # (test.t1)
-# 301 Write_rows # 345 table_id: # flags: STMT_END_F
-# 345 Query # 414 COMMIT
-# 414 Query # 514 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
-# 514 Query # 582 BEGIN
-# 582 Table_map # 623 table_id: # (test.t2)
-# 623 Write_rows # 667 table_id: # flags: STMT_END_F
-# 667 Table_map # 708 table_id: # (test.t2)
-# 708 Write_rows # 747 table_id: # flags: STMT_END_F
-# 747 Xid # 774 COMMIT /* XID */
+# 107 Query # 193 use `test`; CREATE TABLE t1 (a INT)
+# 193 Query # 261 BEGIN
+# 261 Table_map # 302 table_id: # (test.t1)
+# 302 Write_rows # 346 table_id: # flags: STMT_END_F
+# 346 Query # 415 COMMIT
+# 415 Query # 515 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
+# 515 Query # 583 BEGIN
+# 583 Table_map # 624 table_id: # (test.t2)
+# 624 Write_rows # 668 table_id: # flags: STMT_END_F
+# 668 Table_map # 709 table_id: # (test.t2)
+# 709 Write_rows # 748 table_id: # flags: STMT_END_F
+# 748 Xid # 775 COMMIT /* XID */
SELECT * FROM t2 ORDER BY a;
a
1
@@ -429,14 +429,14 @@ Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SELECT * FROM t2 ORDER BY a;
a
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
Log_name Pos Event_type Server_id End_log_pos Info
-# 106 Query # 174 BEGIN
-# 174 Table_map # 215 table_id: # (test.t2)
-# 215 Write_rows # 259 table_id: # flags: STMT_END_F
-# 259 Table_map # 300 table_id: # (test.t2)
-# 300 Write_rows # 339 table_id: # flags: STMT_END_F
-# 339 Query # 410 ROLLBACK
+# 107 Query # 175 BEGIN
+# 175 Table_map # 216 table_id: # (test.t2)
+# 216 Write_rows # 260 table_id: # flags: STMT_END_F
+# 260 Table_map # 301 table_id: # (test.t2)
+# 301 Write_rows # 340 table_id: # flags: STMT_END_F
+# 340 Query # 411 ROLLBACK
SELECT * FROM t2 ORDER BY a;
a
DROP TABLE t1,t2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_drop.result b/mysql-test/suite/rpl/r/rpl_row_drop.result
index 89654ebf165..f1a350b3df0 100644
--- a/mysql-test/suite/rpl/r/rpl_row_drop.result
+++ b/mysql-test/suite/rpl/r/rpl_row_drop.result
@@ -43,10 +43,10 @@ t2
DROP TABLE t1,t2;
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a int)
-master-bin.000001 192 Query 1 278 use `test`; CREATE TABLE t2 (a int)
-master-bin.000001 278 Query 1 382 use `test`; DROP TABLE `t1` /* generated by server */
+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 383 use `test`; DROP TABLE `t1` /* generated by server */
SHOW TABLES;
Tables_in_test
t2
diff --git a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
index 129bad0fbcc..384573c0461 100644
--- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
+++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
@@ -12,13 +12,13 @@ create table t4 (a int);
insert into t4 select * from t3;
rename table t1 to t5, t2 to t1;
flush no_write_to_binlog tables;
-SHOW BINLOG EVENTS FROM 897 ;
+SHOW BINLOG EVENTS FROM 898 ;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
select * from t3;
a
flush tables;
-SHOW BINLOG EVENTS FROM 897 ;
+SHOW BINLOG EVENTS FROM 898 ;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
master-bin.000001 # Query 1 # use `test`; flush tables
diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result
index 9593b009d1f..789db064eb5 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result
@@ -30,14 +30,14 @@ master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT
-show binlog events from 106 limit 1;
+show binlog events from 107 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-show binlog events from 106 limit 2;
+show binlog events from 107 limit 2;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
master-bin.000001 # Query 1 # BEGIN
-show binlog events from 106 limit 2,1;
+show binlog events from 107 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
flush logs;
@@ -251,7 +251,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000002
-Read_Master_Log_Pos 516
+Read_Master_Log_Pos 517
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000002
@@ -266,7 +266,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 516
+Exec_Master_Log_Pos 517
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -283,6 +283,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
index 8526bad558b..fbd9f685ba9 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
@@ -30,14 +30,14 @@ master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Xid 1 # COMMIT /* XID */
-show binlog events from 106 limit 1;
+show binlog events from 107 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
-show binlog events from 106 limit 2;
+show binlog events from 107 limit 2;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
master-bin.000001 # Query 1 # BEGIN
-show binlog events from 106 limit 2,1;
+show binlog events from 107 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
flush logs;
@@ -251,7 +251,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000002
-Read_Master_Log_Pos 474
+Read_Master_Log_Pos 475
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000002
@@ -266,7 +266,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 474
+Exec_Master_Log_Pos 475
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -283,6 +283,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
index 2215b34814e..c2554218f73 100644
--- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
+++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
@@ -60,6 +60,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
#
# Test 2
#
@@ -108,6 +110,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
#
# Test 3: max_relay_log_size = 0
#
@@ -156,6 +160,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
@@ -201,6 +207,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
#
# Test 5
#
@@ -247,6 +255,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
@@ -291,6 +301,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
diff --git a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
index fa40d8760a8..028b73e6153 100644
--- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
@@ -43,6 +43,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
stop slave;
change master to master_user='test';
SHOW SLAVE STATUS;
@@ -84,11 +86,13 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
reset slave;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
-Master_User root
+Master_User test
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File
@@ -124,6 +128,9 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
+change master to master_user='root';
start slave;
SHOW SLAVE STATUS;
Slave_IO_State #
@@ -164,6 +171,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
stop slave;
reset slave;
start slave;
diff --git a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
new file mode 100644
index 00000000000..461ab14a93a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
@@ -0,0 +1,274 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+[MASTER] ********* SOW BINLOG EVENTS IN ... *********
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+[MASTER] ********* SOW BINLOG EVENTS *********
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+[MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows *********
+show binlog events from <binlog_start> limit 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+[MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
+show binlog events from <binlog_start> limit 1, 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+[SLAVE] ********* SOW BINLOG EVENTS IN ... *********
+show binlog events in 'slave-bin.000001' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+[SLAVE] ********* SOW BINLOG EVENTS *********
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows *********
+show binlog events from <binlog_start> limit 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
+show binlog events from <binlog_start> limit 1, 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4
+slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-relay-bin.000003 # Query # # BEGIN
+slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000003 # Query # # COMMIT
+slave-relay-bin.000003 # Query # # BEGIN
+slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000003 # Query # # COMMIT
+slave-relay-bin.000003 # Query # # BEGIN
+slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000003 # Query # # COMMIT
+slave-relay-bin.000003 # Query # # BEGIN
+slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000003 # Query # # COMMIT
+slave-relay-bin.000003 # Query # # BEGIN
+slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000003 # Query # # COMMIT
+slave-relay-bin.000003 # Query # # BEGIN
+slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
+slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
+slave-relay-bin.000003 # Query # # COMMIT
+[SLAVE] ********* SOW RELAYLOG EVENTS *********
+show relaylog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4
+[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4
+slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
+[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1, 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-relay-bin.000003 # Query # # BEGIN
+FLUSH LOGS;
+FLUSH LOGS;
+DROP TABLE t1;
+[MASTER] ********* SOW BINLOG EVENTS IN ... *********
+show binlog events in 'master-bin.000002' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Query # # use `test`; DROP TABLE t1
+[MASTER] ********* SOW BINLOG EVENTS *********
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Rotate # # master-bin.000002;pos=4
+[SLAVE] ********* SOW BINLOG EVENTS IN ... *********
+show binlog events in 'slave-bin.000002' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Query # # use `test`; DROP TABLE t1
+[SLAVE] ********* SOW BINLOG EVENTS *********
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Rotate # # slave-bin.000002;pos=4
+[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+show relaylog events in 'slave-relay-bin.000005' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4
+slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4
+[SLAVE] ********* SOW RELAYLOG EVENTS *********
+show relaylog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4
+slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4
diff --git a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result
deleted file mode 100644
index 1934b01505c..00000000000
--- a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result
+++ /dev/null
@@ -1,17 +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 (words varchar(20)) engine=myisam;
-load data infile '../../std_data/words.dat' into table t1 (words);
-select count(*) from t1;
-count(*)
-70
-select count(*) from t1;
-count(*)
-70
-drop table t1;
-include/stop_slave.inc
-drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
index bb9865ab2d1..99d2154f364 100644
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
@@ -157,6 +157,8 @@ Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 0
Last_SQL_Error <Last_SQL_Error>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
INSERT INTO t9 VALUES (4);
INSERT INTO t4 VALUES (4);
SHOW SLAVE STATUS;
@@ -178,7 +180,7 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
+Last_Errno 1642
Last_Error <Last_Error>
Skip_Counter 0
Exec_Master_Log_Pos #
@@ -196,8 +198,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
+Last_SQL_Errno 1642
Last_SQL_Error <Last_SQL_Error>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (5);
@@ -221,7 +225,7 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
+Last_Errno 1642
Last_Error <Last_Error>
Skip_Counter 0
Exec_Master_Log_Pos #
@@ -239,8 +243,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
+Last_SQL_Errno 1642
Last_SQL_Error <Last_SQL_Error>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -264,7 +270,7 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
+Last_Errno 1642
Last_Error <Last_Error>
Skip_Counter 0
Exec_Master_Log_Pos #
@@ -282,8 +288,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
+Last_SQL_Errno 1642
Last_SQL_Error <Last_SQL_Error>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -326,6 +334,8 @@ Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 0
Last_SQL_Error <Last_SQL_Error>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
INSERT INTO t7 VALUES (1),(2),(3);
INSERT INTO t8 VALUES (1),(2),(3);
SELECT * FROM t7 ORDER BY a;
diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
index f606a28c2d9..5f0d2be9149 100644
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
@@ -157,6 +157,8 @@ Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 0
Last_SQL_Error <Last_SQL_Error>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
INSERT INTO t9 VALUES (4);
INSERT INTO t4 VALUES (4);
SHOW SLAVE STATUS;
@@ -178,7 +180,7 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
+Last_Errno 1642
Last_Error <Last_Error>
Skip_Counter 0
Exec_Master_Log_Pos #
@@ -196,8 +198,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
+Last_SQL_Errno 1642
Last_SQL_Error <Last_SQL_Error>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (5);
@@ -221,7 +225,7 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
+Last_Errno 1642
Last_Error <Last_Error>
Skip_Counter 0
Exec_Master_Log_Pos #
@@ -239,8 +243,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
+Last_SQL_Errno 1642
Last_SQL_Error <Last_SQL_Error>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -264,7 +270,7 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
+Last_Errno 1642
Last_Error <Last_Error>
Skip_Counter 0
Exec_Master_Log_Pos #
@@ -282,8 +288,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
+Last_SQL_Errno 1642
Last_SQL_Error <Last_SQL_Error>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -326,6 +334,8 @@ Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 0
Last_SQL_Error <Last_SQL_Error>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
INSERT INTO t7 VALUES (1),(2),(3);
INSERT INTO t8 VALUES (1),(2),(3);
SELECT * FROM t7 ORDER BY a;
diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result
index ad54450af74..e878456e296 100644
--- a/mysql-test/suite/rpl/r/rpl_row_until.result
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result
@@ -59,6 +59,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
SELECT * FROM t1;
n
@@ -105,6 +107,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2
SELECT * FROM t2;
n
@@ -149,6 +153,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
START SLAVE;
include/stop_slave.inc
START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2
@@ -191,6 +197,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result
new file mode 100644
index 00000000000..1e220b28d78
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result
@@ -0,0 +1,440 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+#
+# Uninstall semi-sync plugins on master and slave
+#
+include/stop_slave.inc
+reset slave;
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+reset master;
+set sql_log_bin=0;
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+set sql_log_bin=1;
+#
+# Main test of semi-sync replication start here
+#
+[ on master ]
+[ default state of semi-sync on master should be OFF ]
+show variables like 'rpl_semi_sync_master_enabled';
+Variable_name Value
+rpl_semi_sync_master_enabled OFF
+[ enable semi-sync on master ]
+set global rpl_semi_sync_master_enabled = 1;
+show variables like 'rpl_semi_sync_master_enabled';
+Variable_name Value
+rpl_semi_sync_master_enabled ON
+[ status of semi-sync on master should be ON even without any semi-sync slaves ]
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name Value
+Rpl_semi_sync_master_clients 0
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 0
+#
+# BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed
+# BUG#45673 Semisynch reports correct operation even if no slave is connected
+#
+[ status of semi-sync on master should be OFF ]
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name Value
+Rpl_semi_sync_master_clients 0
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status OFF
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 0
+#
+# INSTALL PLUGIN semi-sync on slave
+#
+[ on slave ]
+[ default state of semi-sync on slave should be OFF ]
+show variables like 'rpl_semi_sync_slave_enabled';
+Variable_name Value
+rpl_semi_sync_slave_enabled OFF
+[ enable semi-sync on slave ]
+set global rpl_semi_sync_slave_enabled = 1;
+show variables like 'rpl_semi_sync_slave_enabled';
+Variable_name Value
+rpl_semi_sync_slave_enabled ON
+include/start_slave.inc
+[ on master ]
+[ initial master state after the semi-sync slave connected ]
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name Value
+Rpl_semi_sync_master_clients 1
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 0
+create table t1(a int) engine = ENGINE_TYPE;
+[ master state after CREATE TABLE statement ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 1
+select CONNECTIONS_NORMAL_SLAVE - CONNECTIONS_NORMAL_SLAVE as 'Should be 0';
+Should be 0
+0
+[ insert records to table ]
+[ master status after inserts ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 301
+[ on slave ]
+[ slave status after replicated inserts ]
+show status like 'Rpl_semi_sync_slave_status';
+Variable_name Value
+Rpl_semi_sync_slave_status ON
+select count(distinct a) from t1;
+count(distinct a)
+300
+select min(a) from t1;
+min(a)
+1
+select max(a) from t1;
+max(a)
+300
+#
+# Test semi-sync master will switch OFF after one transacton
+# timeout waiting for slave reply.
+#
+include/stop_slave.inc
+[ on master ]
+[ master status should be ON ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 301
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name Value
+Rpl_semi_sync_master_clients 1
+[ semi-sync replication of these transactions will fail ]
+insert into t1 values (500);
+[ master status should be OFF ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status OFF
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 1
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 301
+insert into t1 values (100);
+[ master status should be OFF ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status OFF
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 302
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 301
+#
+# Test semi-sync status on master will be ON again when slave catches up
+#
+[ on slave ]
+[ slave status should be OFF ]
+show status like 'Rpl_semi_sync_slave_status';
+Variable_name Value
+Rpl_semi_sync_slave_status OFF
+include/start_slave.inc
+[ slave status should be ON ]
+show status like 'Rpl_semi_sync_slave_status';
+Variable_name Value
+Rpl_semi_sync_slave_status ON
+select count(distinct a) from t1;
+count(distinct a)
+2
+select min(a) from t1;
+min(a)
+100
+select max(a) from t1;
+max(a)
+500
+[ on master ]
+[ master status should be ON again after slave catches up ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 302
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 301
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name Value
+Rpl_semi_sync_master_clients 1
+#
+# Test disable/enable master semi-sync on the fly.
+#
+drop table t1;
+[ on slave ]
+include/stop_slave.inc
+#
+# Flush status
+#
+[ Semi-sync master status variables before FLUSH STATUS ]
+SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 302
+SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 302
+FLUSH NO_WRITE_TO_BINLOG STATUS;
+[ Semi-sync master status variables after FLUSH STATUS ]
+SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 0
+SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 0
+[ on master ]
+show master logs;
+Log_name master-bin.000001
+File_size #
+show variables like 'rpl_semi_sync_master_enabled';
+Variable_name Value
+rpl_semi_sync_master_enabled ON
+[ disable semi-sync on the fly ]
+set global rpl_semi_sync_master_enabled=0;
+show variables like 'rpl_semi_sync_master_enabled';
+Variable_name Value
+rpl_semi_sync_master_enabled OFF
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status OFF
+[ enable semi-sync on the fly ]
+set global rpl_semi_sync_master_enabled=1;
+show variables like 'rpl_semi_sync_master_enabled';
+Variable_name Value
+rpl_semi_sync_master_enabled ON
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+#
+# Test RESET MASTER/SLAVE
+#
+[ on slave ]
+include/start_slave.inc
+[ on master ]
+create table t1 (a int) engine = ENGINE_TYPE;
+drop table t1;
+show status like 'Rpl_relay%';
+Variable_name Value
+[ test reset master ]
+[ on master]
+reset master;
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 0
+[ on slave ]
+include/stop_slave.inc
+reset slave;
+include/start_slave.inc
+[ on master ]
+create table t1 (a int) engine = ENGINE_TYPE;
+insert into t1 values (1);
+insert into t1 values (2), (3);
+[ on slave ]
+select * from t1;
+a
+1
+2
+3
+[ on master ]
+[ master semi-sync status should be ON ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 3
+#
+# Start semi-sync replication without SUPER privilege
+#
+include/stop_slave.inc
+reset slave;
+[ on master ]
+reset master;
+set sql_log_bin=0;
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+flush privileges;
+set sql_log_bin=1;
+[ on slave ]
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+flush privileges;
+change master to master_user='rpl',master_password='rpl';
+include/start_slave.inc
+show status like 'Rpl_semi_sync_slave_status';
+Variable_name Value
+Rpl_semi_sync_slave_status ON
+[ on master ]
+[ master semi-sync should be ON ]
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name Value
+Rpl_semi_sync_master_clients 1
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 0
+insert into t1 values (4);
+insert into t1 values (5);
+[ master semi-sync should be ON ]
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name Value
+Rpl_semi_sync_master_clients 1
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name Value
+Rpl_semi_sync_master_no_tx 0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name Value
+Rpl_semi_sync_master_yes_tx 2
+#
+# Test semi-sync slave connect to non-semi-sync master
+#
+[ on slave ]
+include/stop_slave.inc
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name Value
+Rpl_semi_sync_slave_status OFF
+[ on master ]
+[ Semi-sync status on master should be ON ]
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name Value
+Rpl_semi_sync_master_clients 0
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status ON
+set global rpl_semi_sync_master_enabled= 0;
+[ on slave ]
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+Variable_name Value
+rpl_semi_sync_slave_enabled ON
+include/start_slave.inc
+[ on master ]
+insert into t1 values (8);
+[ master semi-sync clients should be 1, status should be OFF ]
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name Value
+Rpl_semi_sync_master_clients 1
+show status like 'Rpl_semi_sync_master_status';
+Variable_name Value
+Rpl_semi_sync_master_status OFF
+[ on slave ]
+show status like 'Rpl_semi_sync_slave_status';
+Variable_name Value
+Rpl_semi_sync_slave_status ON
+include/stop_slave.inc
+[ on master ]
+set sql_log_bin=0;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+set sql_log_bin=1;
+SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
+Variable_name Value
+[ on slave ]
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+Variable_name Value
+rpl_semi_sync_slave_enabled ON
+include/start_slave.inc
+[ on master ]
+insert into t1 values (10);
+[ on slave ]
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name Value
+Rpl_semi_sync_slave_status OFF
+#
+# Test non-semi-sync slave connect to semi-sync master
+#
+set sql_log_bin=0;
+INSTALL PLUGIN rpl_semi_sync_master SONAME 'SEMISYNC_MASTER_PLUGIN';
+set global rpl_semi_sync_master_timeout= 5000;
+/* 5s */
+set sql_log_bin=1;
+set global rpl_semi_sync_master_enabled= 1;
+[ on slave ]
+include/stop_slave.inc
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name Value
+Rpl_semi_sync_slave_status OFF
+[ uninstall semi-sync slave plugin ]
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+Variable_name Value
+include/start_slave.inc
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name Value
+include/stop_slave.inc
+[ reinstall semi-sync slave plugin and disable semi-sync ]
+INSTALL PLUGIN rpl_semi_sync_slave SONAME 'SEMISYNC_SLAVE_PLUGIN';
+set global rpl_semi_sync_slave_enabled= 0;
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+Variable_name Value
+rpl_semi_sync_slave_enabled OFF
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name Value
+Rpl_semi_sync_slave_status OFF
+include/start_slave.inc
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name Value
+Rpl_semi_sync_slave_status OFF
+#
+# Clean up
+#
+include/stop_slave.inc
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+include/start_slave.inc
+drop table t1;
+drop user rpl@127.0.0.1;
+flush privileges;
diff --git a/mysql-test/suite/rpl/r/rpl_server_id_ignore.result b/mysql-test/suite/rpl/r/rpl_server_id_ignore.result
new file mode 100644
index 00000000000..cba6571eb1a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_server_id_ignore.result
@@ -0,0 +1,46 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+master_id: 1
+stop slave;
+*** --replicate-same-server-id and change master option can clash ***
+change master to IGNORE_SERVER_IDS= (2, 1);
+ERROR HY000: The requested server id 2 clashes with the slave startup option --replicate-same-server-id
+*** must be empty due to the error ***
+ignore server id list:
+change master to IGNORE_SERVER_IDS= (10, 100);
+*** must be 10, 100 ***
+ignore server id list: 10, 100
+reset slave;
+*** must be empty due to reset slave ***
+ignore server id list: 10, 100
+change master to IGNORE_SERVER_IDS= (10, 100);
+*** CHANGE MASTER with IGNORE_SERVER_IDS option overrides (does not increment) the previous setup ***
+change master to IGNORE_SERVER_IDS= (5, 1, 4, 3, 1);
+*** must be 1, 3, 4, 5 due to overriding policy ***
+ignore server id list: 1, 3, 4, 5
+*** ignore master (server 1) queries for a while ***
+start slave;
+create table t1 (n int);
+*** must be empty as the event is to be filtered out ***
+show tables;
+Tables_in_test
+*** allowing events from master ***
+stop slave;
+reset slave;
+change master to IGNORE_SERVER_IDS= (10, 100);
+*** the list must remain (10, 100) after reset slave ***
+change master to IGNORE_SERVER_IDS= ();
+*** must be empty due to IGNORE_SERVER_IDS empty list ***
+ignore server id list:
+change master to master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root';
+start slave;
+*** must have caught create table ***
+show tables;
+Tables_in_test
+t1
+drop table t1;
+end of the tests
diff --git a/mysql-test/suite/rpl/r/rpl_show_slave_hosts.result b/mysql-test/suite/rpl/r/rpl_show_slave_hosts.result
new file mode 100644
index 00000000000..9838d8b08a8
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_show_slave_hosts.result
@@ -0,0 +1,17 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+RESET SLAVE;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_PORT,master_user='root';
+START SLAVE IO_THREAD;
+SHOW SLAVE HOSTS;
+Server_id Host Port Master_id
+3 slave2 DEFAULT_PORT 1
+2 SLAVE_PORT 1
+STOP SLAVE IO_THREAD;
+SHOW SLAVE HOSTS;
+Server_id Host Port Master_id
+2 SLAVE_PORT 1
diff --git a/mysql-test/suite/rpl/r/rpl_skip_error.result b/mysql-test/suite/rpl/r/rpl_skip_error.result
index d955859f030..7b2bd48515d 100644
--- a/mysql-test/suite/rpl/r/rpl_skip_error.result
+++ b/mysql-test/suite/rpl/r/rpl_skip_error.result
@@ -70,6 +70,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
==== Clean Up ====
drop table t1;
create table t1(a int primary key);
@@ -123,6 +125,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
==== Clean Up ====
drop table t1;
==== Using Innodb ====
diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
index e2efcf08d7a..880fc9e8569 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
@@ -49,6 +49,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 9
Last_SQL_Error Error in Begin_load_query event: write to '../../tmp/SQL_LOAD.data' failed
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
drop table t1;
drop table t1;
call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3");
diff --git a/mysql-test/suite/rpl/r/rpl_slave_skip.result b/mysql-test/suite/rpl/r/rpl_slave_skip.result
index 6148de5d954..5a37344cac6 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_skip.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result
@@ -50,7 +50,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 1115
+Read_Master_Log_Pos 1116
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -65,7 +65,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 762
+Exec_Master_Log_Pos 763
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-bin.000001
@@ -82,6 +82,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SELECT * FROM t1;
@@ -114,7 +116,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 248
+Read_Master_Log_Pos 249
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
@@ -129,7 +131,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 248
+Exec_Master_Log_Pos 249
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -146,6 +148,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
**** On Master ****
DROP TABLE t1, t2;
SET SESSION BINLOG_FORMAT=ROW;
diff --git a/mysql-test/suite/rpl/r/rpl_slow_query_log.result b/mysql-test/suite/rpl/r/rpl_slow_query_log.result
new file mode 100644
index 00000000000..9d1cc602b68
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_slow_query_log.result
@@ -0,0 +1,49 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+include/stop_slave.inc
+SET @old_log_output= @@log_output;
+SET GLOBAL log_output= 'TABLE';
+SET @old_long_query_time= @@long_query_time;
+SET GLOBAL long_query_time= 2;
+TRUNCATE mysql.slow_log;
+include/start_slave.inc
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 values(1, 1);
+INSERT INTO t1 values(1, sleep(3));
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+TRUNCATE mysql.slow_log;
+SELECT 1, sleep(3);
+1 sleep(3)
+1 0
+SELECT 1;
+1
+1
+TRUNCATE mysql.slow_log;
+SET TIMESTAMP= 1;
+SELECT 2, sleep(3);
+2 sleep(3)
+2 0
+SELECT 2;
+2
+2
+TRUNCATE mysql.slow_log;
+SET @old_slow_query_log= @@slow_query_log;
+SET GLOBAL slow_query_log= 'OFF';
+SELECT 3, sleep(3);
+3 sleep(3)
+3 0
+SELECT 3;
+3
+3
+TRUNCATE mysql.slow_log;
+SET GLOBAL slow_query_log= @old_slow_query_log;
+DROP TABLE t1;
+include/stop_slave.inc
+SET GLOBAL long_query_time= @old_long_query_time;
+SET GLOBAL log_output= @old_log_output;
+include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index 90a362c352b..58c0280aafe 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -191,14 +191,9 @@ begin
return unix_timestamp();
end|
ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
-set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
-set global log_bin_trust_routine_creators=1;
-Warnings:
-Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 6.0. Please use '@@log_bin_trust_function_creators' instead
set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=1;
-set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_function_creators=1;
create function fn2()
@@ -409,110 +404,110 @@ return 0;
end|
use mysqltest;
set @a:= mysqltest2.f1();
-show binlog events in 'master-bin.000001' from 106;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # drop database if exists mysqltest1
-master-bin.000001 # Query 1 # create database mysqltest1
-master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100))
-master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+master-bin.000001 # Query # # drop database if exists mysqltest1
+master-bin.000001 # Query # # create database mysqltest1
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a varchar(100))
+master-bin.000001 # 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 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8))
-master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp())
-master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
-master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8))
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (unix_timestamp())
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
select * from mysqltest1.t1
-master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo2 contains sql
-master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
-master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int)
-master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1
-master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`()
+master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo2 contains sql
+master-bin.000001 # Query # # use `mysqltest1`; drop table t1
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int)
+master-bin.000001 # Query # # use `mysqltest1`; create table t2 like t1
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`()
DETERMINISTIC
insert into t1 values (15)
-master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
-master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1
-master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
-master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`()
+master-bin.000001 # Query # # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Query # # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Query # # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
+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 # Query 1 # use `mysqltest1`; insert into t2 values(3)
-master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15)
-master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
-master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker
-master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
-master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5)
-master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2
-master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a)
-master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4
-master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`()
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (15)
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo4 sql security invoker
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (5)
+master-bin.000001 # Query # # use `mysqltest1`; delete from t2
+master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a)
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`()
DETERMINISTIC
begin
insert into t2 values(20),(20);
end
-master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(20),(20)
-master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4
-master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo
-master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo2
-master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo3
-master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11)
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(20),(20)
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo2
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo3
+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 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2
-master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
-master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21))
-master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
-master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`() RETURNS int(11)
+master-bin.000001 # Query # # use `mysqltest1`; delete t1,t2 from t1,t2
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(fn1(21))
+master-bin.000001 # Query # # use `mysqltest1`; drop function fn1
+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 # Query 1 # use `mysqltest1`; delete from t1
-master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(fn1())
-master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11)
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(fn1())
+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 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11)
+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 # Query 1 # use `mysqltest1`; delete from t2
-master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a)
-master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
-master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11)
+master-bin.000001 # Query # # use `mysqltest1`; delete from t2
+master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a)
+master-bin.000001 # Query # # use `mysqltest1`; drop function fn1
+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 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100)
-master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
-master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
-master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
-master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1)
-master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
-master-bin.000001 # Query 1 # use `mysqltest1`; drop trigger trg
-master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1)
-master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100)
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+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 # Query # # use `mysqltest1`; insert into t1 values (1)
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+master-bin.000001 # Query # # use `mysqltest1`; drop trigger trg
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1)
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
READS SQL DATA
select * from t1
-master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo
-master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
-master-bin.000001 # Query 1 # drop database mysqltest1
-master-bin.000001 # Query 1 # drop user "zedjzlcsjhd"@127.0.0.1
-master-bin.000001 # Query 1 # use `test`; drop function if exists f1
-master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo
+master-bin.000001 # Query # # use `mysqltest1`; drop function fn1
+master-bin.000001 # Query # # drop database mysqltest1
+master-bin.000001 # Query # # drop user "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Query # # use `test`; drop function if exists f1
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
READS SQL DATA
begin
declare var integer;
@@ -522,48 +517,42 @@ fetch c into var;
close c;
return var;
end
-master-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
-master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
-master-bin.000001 # Query 1 # use `test`; insert into t1 (a) values (f1())
-master-bin.000001 # Query 1 # use `test`; drop view v1
-master-bin.000001 # Query 1 # use `test`; drop function f1
-master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE IF EXISTS p1
-master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1
-master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(col VARCHAR(10))
-master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
+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 # Query # # use `test`; create table t1 (a int)
+master-bin.000001 # Query # # use `test`; insert into t1 (a) values (f1())
+master-bin.000001 # Query # # use `test`; drop view v1
+master-bin.000001 # Query # # use `test`; drop function f1
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS p1
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1(col VARCHAR(10))
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
INSERT INTO t1 VALUES(arg)
-master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
-master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1
-master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE IF EXISTS p1
-master-bin.000001 # Query 1 # use `test`; DROP FUNCTION IF EXISTS f1
-master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS p1
+master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS f1
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SET @a = 1
-master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 0
-master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1
-master-bin.000001 # Query 1 # use `test`; DROP FUNCTION f1
-master-bin.000001 # Query 1 # use `test`; drop table t1
-master-bin.000001 # Query 1 # drop database if exists mysqltest
-master-bin.000001 # Query 1 # drop database if exists mysqltest2
-master-bin.000001 # Query 1 # create database mysqltest
-master-bin.000001 # Query 1 # create database mysqltest2
-master-bin.000001 # Query 1 # use `mysqltest2`; create table t ( t integer )
-master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`()
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1
+master-bin.000001 # Query # # use `test`; DROP FUNCTION f1
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # drop database if exists mysqltest
+master-bin.000001 # Query # # drop database if exists mysqltest2
+master-bin.000001 # Query # # create database mysqltest
+master-bin.000001 # Query # # create database mysqltest2
+master-bin.000001 # Query # # use `mysqltest2`; create table t ( t integer )
+master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`()
begin end
-master-bin.000001 # Query 1 # use `mysqltest2`; insert into t values ( 1 )
-master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+master-bin.000001 # Query # # use `mysqltest2`; insert into t values ( 1 )
+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 # Query 1 # use `mysqltest`; SELECT `mysqltest2`.`f1`()
-set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
-Warnings:
-Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 6.0. Please use '@@log_bin_trust_function_creators' instead
+master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`()
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
-set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
-Warnings:
-Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 6.0. Please use '@@log_bin_trust_function_creators' instead
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
drop database mysqltest;
drop database mysqltest2;
diff --git a/mysql-test/suite/rpl/r/rpl_spec_variables.result b/mysql-test/suite/rpl/r/rpl_spec_variables.result
new file mode 100644
index 00000000000..ea2778bf71c
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_spec_variables.result
@@ -0,0 +1,225 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+* auto_increment_increment, auto_increment_offset *
+SET @@global.auto_increment_increment=2;
+SET @@session.auto_increment_increment=2;
+SET @@global.auto_increment_offset=10;
+SET @@session.auto_increment_offset=10;
+SET @@global.auto_increment_increment=3;
+SET @@session.auto_increment_increment=3;
+SET @@global.auto_increment_offset=20;
+SET @@session.auto_increment_offset=20;
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t1 (b) VALUES ('master');
+INSERT INTO t1 (b) VALUES ('master');
+SELECT * FROM t1 ORDER BY a;
+a b
+2 master
+4 master
+CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t1 (b) VALUES ('slave');
+INSERT INTO t1 (b) VALUES ('slave');
+INSERT INTO t2 (b) VALUES ('slave');
+INSERT INTO t2 (b) VALUES ('slave');
+SELECT * FROM t1 ORDER BY a;
+a b
+2 master
+4 master
+7 slave
+10 slave
+SELECT * FROM t2 ORDER BY a;
+a b
+1 slave
+4 slave
+DROP TABLE IF EXISTS t1,t2;
+SET @@global.auto_increment_increment=1;
+SET @@session.auto_increment_increment=1;
+SET @@global.auto_increment_offset=1;
+SET @@session.auto_increment_offset=1;
+SET @@global.auto_increment_increment=1;
+SET @@session.auto_increment_increment=1;
+SET @@global.auto_increment_offset=1;
+SET @@session.auto_increment_offset=1;
+SET auto_increment_increment=1;
+SET auto_increment_offset=1;
+
+* character_set_database, collation_server *
+SET @restore_master_character_set_database=@@global.character_set_database;
+SET @restore_master_collation_server=@@global.collation_server;
+SET @@global.character_set_database=latin1;
+SET @@session.character_set_database=latin1;
+SET @@global.collation_server=latin1_german1_ci;
+SET @@session.collation_server=latin1_german1_ci;
+SET @restore_slave_character_set_database=@@global.character_set_database;
+SET @restore_slave_collation_server=@@global.collation_server;
+SET @@global.character_set_database=utf8;
+SET @@session.character_set_database=utf8;
+SET @@global.collation_server=utf8_bin;
+SET @@session.collation_server=utf8_bin;
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` varchar(10) COLLATE latin1_german1_ci DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
+CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` varchar(10) COLLATE latin1_german1_ci DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ `b` varchar(10) COLLATE utf8_bin DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin
+SET @@global.collation_server=latin1_swedish_ci;
+SET @@session.collation_server=latin1_swedish_ci;
+SET @@global.collation_server=latin1_swedish_ci;
+SET @@session.collation_server=latin1_swedish_ci;
+DROP TABLE IF EXISTS t1,t2;
+
+* default_week_format *
+SET @@global.default_week_format=0;
+SET @@session.default_week_format=0;
+SET @@global.default_week_format=1;
+SET @@session.default_week_format=1;
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, 'master ', WEEK('2008-01-07'));
+SELECT * FROM t1 ORDER BY a;
+a b c
+1 master 1
+INSERT INTO t1 VALUES (2, 'slave ', WEEK('2008-01-07'));
+SELECT * FROM t1 ORDER BY a;
+a b c
+1 master 1
+2 slave 2
+DROP TABLE t1;
+SET @@global.default_week_format=0;
+SET @@session.default_week_format=0;
+
+* local_infile *
+SET @@global.local_infile=0;
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(20), c CHAR(254)) ENGINE=MyISAM;
+LOAD DATA LOCAL INFILE 'FILE' INTO TABLE t1 (b);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+70
+LOAD DATA LOCAL INFILE 'FILE2' INTO TABLE t1 (b);
+ERROR 42000: The used command is not allowed with this MySQL version
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+70
+SET @@global.local_infile=1;
+DROP TABLE t1;
+
+* max_heap_table_size *
+SET @restore_slave_max_heap_table_size=@@global.max_heap_table_size;
+SET @@global.max_heap_table_size=16384;
+SET @@session.max_heap_table_size=16384;
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), c CHAR(254)) ENGINE=MEMORY;
+SELECT COUNT(*)=2000 FROM t1;
+COUNT(*)=2000
+1
+SELECT COUNT(*)=2000 FROM t1 WHERE b='master' GROUP BY b ORDER BY b;
+COUNT(*)=2000
+1
+SELECT COUNT(*)<2000 AND COUNT(*)>0 FROM t1 WHERE b='slave' GROUP BY b ORDER BY b;
+COUNT(*)<2000 AND COUNT(*)>0
+1
+SELECT COUNT(*)<2000 AND COUNT(*)>0 FROM t2 WHERE b='slave' GROUP BY b ORDER BY b;
+COUNT(*)<2000 AND COUNT(*)>0
+1
+DROP TABLE IF EXISTS t1,t2;
+
+* storage_engine *
+SET @restore_master_storage_engine=@@global.storage_engine;
+SET @@global.storage_engine=InnoDB;
+SET @@session.storage_engine=InnoDB;
+SET @restore_slave_storage_engine=@@global.storage_engine;
+SET @@global.storage_engine=Memory;
+SET @@session.storage_engine=Memory;
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10));
+CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
+CREATE TABLE t3 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ `b` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ `b` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` int(11) NOT NULL,
+ `b` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+SET @@global.storage_engine=InnoDB;
+SET @@session.storage_engine=InnoDB;
+DROP TABLE IF EXISTS t1,t2,t3;
+
+* sql_mode *
+SET @@global.sql_mode=ANSI;
+SET @@session.sql_mode=ANSI;
+SET @@global.sql_mode=TRADITIONAL;
+SET @@session.sql_mode=TRADITIONAL;
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c DATE);
+INSERT INTO t1 VALUES (1, 'master', '0000-00-00');
+SELECT * FROM t1 ORDER BY a;
+a b c
+1 master 0000-00-00
+INSERT INTO t1 VALUES (1, 'slave', '0000-00-00');
+ERROR 22007: Incorrect date value: '0000-00-00' for column 'c' at row 1
+SELECT * FROM t1 ORDER BY a;
+a b c
+1 master 0000-00-00
+SET @@global.sql_mode='';
+SET @@session.sql_mode='';
+SET @@global.sql_mode='';
+SET @@session.sql_mode='';
+DROP TABLE t1;
+
+*** clean up ***
+SET @@global.character_set_database=@restore_master_character_set_database;
+SET @@global.collation_server=@restore_master_collation_server;
+SET @@global.storage_engine=@restore_master_storage_engine;
+SET @@global.character_set_database=@restore_slave_character_set_database;
+SET @@global.collation_server=@restore_slave_collation_server;
+SET @@global.max_heap_table_size=@restore_slave_max_heap_table_size;
+SET @@global.storage_engine=@restore_slave_storage_engine;
+
+call mtr.add_suppression("The table 't[12]' is full");
diff --git a/mysql-test/suite/rpl/r/rpl_ssl.result b/mysql-test/suite/rpl/r/rpl_ssl.result
index d188dd353ce..c8e9e1a4911 100644
--- a/mysql-test/suite/rpl/r/rpl_ssl.result
+++ b/mysql-test/suite/rpl/r/rpl_ssl.result
@@ -58,6 +58,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
select * from t1;
t
@@ -102,6 +104,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
drop user replssl@localhost;
drop table t1;
End of 5.0 tests
diff --git a/mysql-test/suite/rpl/r/rpl_ssl1.result b/mysql-test/suite/rpl/r/rpl_ssl1.result
index 74d2550cdaf..de255228aff 100644
--- a/mysql-test/suite/rpl/r/rpl_ssl1.result
+++ b/mysql-test/suite/rpl/r/rpl_ssl1.result
@@ -57,6 +57,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
stop slave;
change master to master_user='root',master_password='', master_ssl=0;
start slave;
@@ -101,6 +103,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
stop slave;
change master to
master_host="localhost",
@@ -155,4 +159,6 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result b/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
index 2f6e98d5eec..7e2e0d96cb5 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
@@ -42,6 +42,9 @@ INSERT INTO t2 VALUES (NULL);
RETURN i;
END//
CALL p1();
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Statement may not be safe to log in statement format.
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=1
@@ -98,6 +101,9 @@ SELECT * FROM t2;
id
DROP TRIGGER tr1;
CALL p2();
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Statement may not be safe to log in statement format.
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=11
diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
index 74031af1dde..1f6c86768b5 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
@@ -12,13 +12,13 @@ create table t4 (a int);
insert into t4 select * from t3;
rename table t1 to t5, t2 to t1;
flush no_write_to_binlog tables;
-SHOW BINLOG EVENTS FROM 656 ;
+SHOW BINLOG EVENTS FROM 657 ;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
select * from t3;
a
flush tables;
-SHOW BINLOG EVENTS FROM 656 ;
+SHOW BINLOG EVENTS FROM 657 ;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
master-bin.000001 # Query 1 # use `test`; flush tables
diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result
index d73b8990041..22105f42879 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result
@@ -26,14 +26,14 @@ master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
master-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (word) ;file_id=1
-show binlog events from 106 limit 1;
+show binlog events from 107 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-show binlog events from 106 limit 2;
+show binlog events from 107 limit 2;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
master-bin.000001 # Intvar 1 # INSERT_ID=1
-show binlog events from 106 limit 2,1;
+show binlog events from 107 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
flush logs;
@@ -233,7 +233,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000002
-Read_Master_Log_Pos 392
+Read_Master_Log_Pos 393
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000002
@@ -248,7 +248,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 392
+Exec_Master_Log_Pos 393
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -265,6 +265,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
index 2215b34814e..c2554218f73 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
@@ -60,6 +60,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
#
# Test 2
#
@@ -108,6 +110,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
#
# Test 3: max_relay_log_size = 0
#
@@ -156,6 +160,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
@@ -201,6 +207,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
#
# Test 5
#
@@ -247,6 +255,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
@@ -291,6 +301,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
diff --git a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
new file mode 100644
index 00000000000..512a72c3040
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
@@ -0,0 +1,148 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+[MASTER] ********* SOW BINLOG EVENTS IN ... *********
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6)
+[MASTER] ********* SOW BINLOG EVENTS *********
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6)
+[MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows *********
+show binlog events from <binlog_start> limit 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+[MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
+show binlog events from <binlog_start> limit 1, 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+[SLAVE] ********* SOW BINLOG EVENTS IN ... *********
+show binlog events in 'slave-bin.000001' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6)
+[SLAVE] ********* SOW BINLOG EVENTS *********
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6)
+[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows *********
+show binlog events from <binlog_start> limit 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
+show binlog events from <binlog_start> limit 1, 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4
+slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (4)
+slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (5)
+slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (6)
+[SLAVE] ********* SOW RELAYLOG EVENTS *********
+show relaylog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4
+[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4
+slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
+[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1, 3;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+FLUSH LOGS;
+FLUSH LOGS;
+DROP TABLE t1;
+[MASTER] ********* SOW BINLOG EVENTS IN ... *********
+show binlog events in 'master-bin.000002' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Query # # use `test`; DROP TABLE t1
+[MASTER] ********* SOW BINLOG EVENTS *********
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6)
+master-bin.000001 # Rotate # # master-bin.000002;pos=4
+[SLAVE] ********* SOW BINLOG EVENTS IN ... *********
+show binlog events in 'slave-bin.000002' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Query # # use `test`; DROP TABLE t1
+[SLAVE] ********* SOW BINLOG EVENTS *********
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6)
+slave-bin.000001 # Rotate # # slave-bin.000002;pos=4
+[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+show relaylog events in 'slave-relay-bin.000005' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4
+slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4
+[SLAVE] ********* SOW RELAYLOG EVENTS *********
+show relaylog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4
+slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4
diff --git a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
index 78d9d7c41eb..94e8a31390d 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
@@ -43,6 +43,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
stop slave;
change master to master_user='test';
SHOW SLAVE STATUS;
@@ -84,11 +86,13 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
reset slave;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
-Master_User root
+Master_User test
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File
@@ -124,6 +128,9 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
+change master to master_user='root';
start slave;
SHOW SLAVE STATUS;
Slave_IO_State #
@@ -164,6 +171,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
stop slave;
reset slave;
start slave;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result
index 55074f0be0d..6af9be0da3b 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_until.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_until.result
@@ -63,6 +63,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1;
n
@@ -109,6 +111,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
select * from t2;
n
@@ -153,6 +157,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
start slave;
[on master]
[on slave]
@@ -197,6 +203,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
==== Test various error conditions ====
start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
diff --git a/mysql-test/suite/rpl/r/rpl_stop_middle_group.result b/mysql-test/suite/rpl/r/rpl_stop_middle_group.result
new file mode 100644
index 00000000000..0bf0384bf85
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stop_middle_group.result
@@ -0,0 +1,61 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,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 tm (a int auto_increment primary key) engine=myisam;
+create table ti (a int auto_increment primary key) engine=innodb;
+set @@global.debug="+d,stop_slave_middle_group";
+begin;
+insert into ti set a=null;
+insert into tm set a=null;
+commit;
+SELECT "NO" AS Last_SQL_Error, @check as `true`;
+Last_SQL_Error true
+NO 1
+select count(*) as one from tm;
+one
+1
+select count(*) as one from ti;
+one
+1
+set @@global.debug="-d";
+include/start_slave.inc
+truncate table tm;
+truncate table ti;
+set @@global.debug="+d,stop_slave_middle_group";
+set @@global.debug="+d,incomplete_group_in_relay_log";
+begin;
+insert into ti set a=null;
+insert into tm set a=null;
+commit;
+SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`;
+Last_SQL_Error true
+Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details). 1
+select count(*) as one from tm;
+one
+1
+select count(*) as zero from ti;
+zero
+0
+set @@global.debug="-d";
+stop slave;
+truncate table tm;
+include/start_slave.inc
+set @@global.debug="+d,stop_slave_middle_group";
+set @@global.debug="+d,incomplete_group_in_relay_log";
+update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
+SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`;
+Last_SQL_Error true
+Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details). 1
+select max(a) as two from tm;
+two
+2
+select max(a) as one from ti;
+one
+1
+set @@global.debug="-d";
+drop table tm, ti;
+include/stop_slave.inc
+drop table tm, ti;
diff --git a/mysql-test/suite/rpl/r/rpl_sync.result b/mysql-test/suite/rpl/r/rpl_sync.result
new file mode 100644
index 00000000000..edc20c46140
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_sync.result
@@ -0,0 +1,40 @@
+=====Configuring the enviroment=======;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+call mtr.add_suppression('Attempting backtrace');
+call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
+CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb;
+insert into t1(a) values(1);
+insert into t1(a) values(2);
+insert into t1(a) values(3);
+=====Inserting data on the master but without the SQL Thread being running=======;
+stop slave SQL_THREAD;
+insert into t1(a) values(4);
+insert into t1(a) values(5);
+insert into t1(a) values(6);
+=====Removing relay log files and crashing/recoverying the slave=======;
+stop slave IO_THREAD;
+SET SESSION debug="d,crash_before_rotate_relaylog";
+FLUSH LOGS;
+ERROR HY000: Lost connection to MySQL server during query
+=====Dumping and comparing tables=======;
+start slave;
+Comparing tables master:test.t1 and slave:test.t1
+=====Corrupting the master.info=======;
+stop slave;
+FLUSH LOGS;
+insert into t1(a) values(7);
+insert into t1(a) values(8);
+insert into t1(a) values(9);
+SET SESSION debug="d,crash_before_rotate_relaylog";
+FLUSH LOGS;
+ERROR HY000: Lost connection to MySQL server during query
+=====Dumping and comparing tables=======;
+start slave;
+Comparing tables master:test.t1 and slave:test.t1
+=====Clean up=======;
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_temporary.result b/mysql-test/suite/rpl/r/rpl_temporary.result
index 631eb0677b0..b2400a03f63 100644
--- a/mysql-test/suite/rpl/r/rpl_temporary.result
+++ b/mysql-test/suite/rpl/r/rpl_temporary.result
@@ -27,12 +27,12 @@ Warning 1265 Data truncated for column 'b' at row 1
DROP TABLE t1;
SET @save_select_limit=@@session.sql_select_limit;
SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
SELECT @@session.sql_select_limit = @save_select_limit;
@@session.sql_select_limit = @save_select_limit
1
SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
SELECT @@session.sql_select_limit = @save_select_limit;
@@session.sql_select_limit = @save_select_limit
1
diff --git a/mysql-test/suite/rpl/r/rpl_temporary_errors.result b/mysql-test/suite/rpl/r/rpl_temporary_errors.result
index d14380a6369..f4626304fc3 100644
--- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result
@@ -79,6 +79,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
DROP TABLE t1;
**** On Master ****
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_typeconv.result b/mysql-test/suite/rpl/r/rpl_typeconv.result
new file mode 100644
index 00000000000..716956cf2cf
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_typeconv.result
@@ -0,0 +1,466 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,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_slave_type_conversions = @@global.slave_type_conversions;
+CREATE TABLE type_conversions (
+TestNo INT AUTO_INCREMENT PRIMARY KEY,
+Source TEXT,
+Target TEXT,
+Flags TEXT,
+On_Master TEXT,
+On_Slave TEXT,
+Expected TEXT,
+Compare INT,
+Error TEXT);
+SELECT @@global.slave_type_conversions;
+@@global.slave_type_conversions
+
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
+SELECT @@global.slave_type_conversions;
+@@global.slave_type_conversions
+
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+SELECT @@global.slave_type_conversions;
+@@global.slave_type_conversions
+ALL_NON_LOSSY
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
+SELECT @@global.slave_type_conversions;
+@@global.slave_type_conversions
+ALL_LOSSY
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
+SELECT @@global.slave_type_conversions;
+@@global.slave_type_conversions
+ALL_LOSSY,ALL_NON_LOSSY
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT';
+ERROR 42000: Variable 'slave_type_conversions' can't be set to the value of 'NONEXISTING_BIT'
+SELECT @@global.slave_type_conversions;
+@@global.slave_type_conversions
+ALL_LOSSY,ALL_NON_LOSSY
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = '' ****
+**** Resetting master and slave ****
+include/stop_slave.inc
+RESET SLAVE;
+RESET MASTER;
+include/start_slave.inc
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY' ****
+**** Resetting master and slave ****
+include/stop_slave.inc
+RESET SLAVE;
+RESET MASTER;
+include/start_slave.inc
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY' ****
+**** Resetting master and slave ****
+include/stop_slave.inc
+RESET SLAVE;
+RESET MASTER;
+include/start_slave.inc
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
+**** Running tests with @@SLAVE_TYPE_CONVERSIONS = 'ALL_LOSSY,ALL_NON_LOSSY' ****
+**** Resetting master and slave ****
+include/stop_slave.inc
+RESET SLAVE;
+RESET MASTER;
+include/start_slave.inc
+**** Result of conversions ****
+Source_Type Target_Type All_Type_Conversion_Flags Value_On_Slave
+BIT(1) BIT(1) <Correct value>
+DATE DATE <Correct value>
+ENUM('master',' ENUM('master',' <Correct value>
+CHAR(10) ENUM('master',' <Correct error>
+CHAR(10) SET('master','s <Correct error>
+ENUM('master',' CHAR(10) <Correct error>
+SET('master','s CHAR(10) <Correct error>
+SET('master','s SET('master','s <Correct value>
+SET('master','s SET('master','s <Correct value>
+TINYINT TINYINT <Correct value>
+TINYINT SMALLINT <Correct error>
+TINYINT MEDIUMINT <Correct error>
+TINYINT INT <Correct error>
+TINYINT BIGINT <Correct error>
+SMALLINT TINYINT <Correct error>
+SMALLINT TINYINT <Correct error>
+SMALLINT TINYINT UNSIGNE <Correct error>
+SMALLINT SMALLINT <Correct value>
+SMALLINT MEDIUMINT <Correct error>
+SMALLINT INT <Correct error>
+SMALLINT BIGINT <Correct error>
+MEDIUMINT TINYINT <Correct error>
+MEDIUMINT TINYINT <Correct error>
+MEDIUMINT TINYINT UNSIGNE <Correct error>
+MEDIUMINT SMALLINT <Correct error>
+MEDIUMINT MEDIUMINT <Correct value>
+MEDIUMINT INT <Correct error>
+MEDIUMINT BIGINT <Correct error>
+INT TINYINT <Correct error>
+INT TINYINT <Correct error>
+INT TINYINT UNSIGNE <Correct error>
+INT SMALLINT <Correct error>
+INT MEDIUMINT <Correct error>
+INT INT <Correct value>
+INT BIGINT <Correct error>
+BIGINT TINYINT <Correct error>
+BIGINT SMALLINT <Correct error>
+BIGINT MEDIUMINT <Correct error>
+BIGINT INT <Correct error>
+BIGINT BIGINT <Correct value>
+CHAR(20) CHAR(20) <Correct value>
+CHAR(20) CHAR(30) <Correct error>
+CHAR(20) CHAR(10) <Correct error>
+CHAR(20) VARCHAR(20) <Correct error>
+CHAR(20) VARCHAR(30) <Correct error>
+CHAR(20) VARCHAR(10) <Correct error>
+CHAR(20) TINYTEXT <Correct error>
+CHAR(20) TEXT <Correct error>
+CHAR(20) MEDIUMTEXT <Correct error>
+CHAR(20) LONGTEXT <Correct error>
+VARCHAR(20) VARCHAR(20) <Correct value>
+VARCHAR(20) VARCHAR(30) <Correct error>
+VARCHAR(20) VARCHAR(10) <Correct error>
+VARCHAR(20) CHAR(30) <Correct error>
+VARCHAR(20) CHAR(10) <Correct error>
+VARCHAR(20) TINYTEXT <Correct error>
+VARCHAR(20) TEXT <Correct error>
+VARCHAR(20) MEDIUMTEXT <Correct error>
+VARCHAR(20) LONGTEXT <Correct error>
+VARCHAR(500) VARCHAR(500) <Correct value>
+VARCHAR(500) VARCHAR(510) <Correct error>
+VARCHAR(500) VARCHAR(255) <Correct error>
+VARCHAR(500) TINYTEXT <Correct error>
+VARCHAR(500) TEXT <Correct error>
+VARCHAR(500) MEDIUMTEXT <Correct error>
+VARCHAR(500) LONGTEXT <Correct error>
+TINYTEXT VARCHAR(500) <Correct error>
+TEXT VARCHAR(500) <Correct error>
+MEDIUMTEXT VARCHAR(500) <Correct error>
+LONGTEXT VARCHAR(500) <Correct error>
+TINYTEXT CHAR(255) <Correct error>
+TINYTEXT CHAR(250) <Correct error>
+TEXT CHAR(255) <Correct error>
+MEDIUMTEXT CHAR(255) <Correct error>
+LONGTEXT CHAR(255) <Correct error>
+TINYTEXT TINYTEXT <Correct value>
+TINYTEXT TEXT <Correct error>
+TEXT TINYTEXT <Correct error>
+DECIMAL(10,5) DECIMAL(10,5) <Correct value>
+DECIMAL(10,5) DECIMAL(10,6) <Correct error>
+DECIMAL(10,5) DECIMAL(11,5) <Correct error>
+DECIMAL(10,5) DECIMAL(11,6) <Correct error>
+DECIMAL(10,5) DECIMAL(10,4) <Correct error>
+DECIMAL(10,5) DECIMAL(9,5) <Correct error>
+DECIMAL(10,5) DECIMAL(9,4) <Correct error>
+FLOAT DECIMAL(10,5) <Correct error>
+DOUBLE DECIMAL(10,5) <Correct error>
+DECIMAL(10,5) FLOAT <Correct error>
+DECIMAL(10,5) DOUBLE <Correct error>
+FLOAT FLOAT <Correct value>
+DOUBLE DOUBLE <Correct value>
+FLOAT DOUBLE <Correct error>
+DOUBLE FLOAT <Correct error>
+BIT(5) BIT(5) <Correct value>
+BIT(5) BIT(6) <Correct error>
+BIT(6) BIT(5) <Correct error>
+BIT(5) BIT(12) <Correct error>
+BIT(12) BIT(5) <Correct error>
+BIT(1) BIT(1) ALL_NON_LOSSY <Correct value>
+DATE DATE ALL_NON_LOSSY <Correct value>
+ENUM('master',' ENUM('master',' ALL_NON_LOSSY <Correct value>
+CHAR(10) ENUM('master',' ALL_NON_LOSSY <Correct error>
+CHAR(10) SET('master','s ALL_NON_LOSSY <Correct error>
+ENUM('master',' CHAR(10) ALL_NON_LOSSY <Correct error>
+SET('master','s CHAR(10) ALL_NON_LOSSY <Correct error>
+SET('master','s SET('master','s ALL_NON_LOSSY <Correct value>
+SET('master','s SET('master','s ALL_NON_LOSSY <Correct value>
+TINYINT TINYINT ALL_NON_LOSSY <Correct value>
+TINYINT SMALLINT ALL_NON_LOSSY <Correct value>
+TINYINT MEDIUMINT ALL_NON_LOSSY <Correct value>
+TINYINT INT ALL_NON_LOSSY <Correct value>
+TINYINT BIGINT ALL_NON_LOSSY <Correct value>
+SMALLINT TINYINT ALL_NON_LOSSY <Correct error>
+SMALLINT TINYINT ALL_NON_LOSSY <Correct error>
+SMALLINT TINYINT UNSIGNE ALL_NON_LOSSY <Correct error>
+SMALLINT SMALLINT ALL_NON_LOSSY <Correct value>
+SMALLINT MEDIUMINT ALL_NON_LOSSY <Correct value>
+SMALLINT INT ALL_NON_LOSSY <Correct value>
+SMALLINT BIGINT ALL_NON_LOSSY <Correct value>
+MEDIUMINT TINYINT ALL_NON_LOSSY <Correct error>
+MEDIUMINT TINYINT ALL_NON_LOSSY <Correct error>
+MEDIUMINT TINYINT UNSIGNE ALL_NON_LOSSY <Correct error>
+MEDIUMINT SMALLINT ALL_NON_LOSSY <Correct error>
+MEDIUMINT MEDIUMINT ALL_NON_LOSSY <Correct value>
+MEDIUMINT INT ALL_NON_LOSSY <Correct value>
+MEDIUMINT BIGINT ALL_NON_LOSSY <Correct value>
+INT TINYINT ALL_NON_LOSSY <Correct error>
+INT TINYINT ALL_NON_LOSSY <Correct error>
+INT TINYINT UNSIGNE ALL_NON_LOSSY <Correct error>
+INT SMALLINT ALL_NON_LOSSY <Correct error>
+INT MEDIUMINT ALL_NON_LOSSY <Correct error>
+INT INT ALL_NON_LOSSY <Correct value>
+INT BIGINT ALL_NON_LOSSY <Correct value>
+BIGINT TINYINT ALL_NON_LOSSY <Correct error>
+BIGINT SMALLINT ALL_NON_LOSSY <Correct error>
+BIGINT MEDIUMINT ALL_NON_LOSSY <Correct error>
+BIGINT INT ALL_NON_LOSSY <Correct error>
+BIGINT BIGINT ALL_NON_LOSSY <Correct value>
+CHAR(20) CHAR(20) ALL_NON_LOSSY <Correct value>
+CHAR(20) CHAR(30) ALL_NON_LOSSY <Correct value>
+CHAR(20) CHAR(10) ALL_NON_LOSSY <Correct error>
+CHAR(20) VARCHAR(20) ALL_NON_LOSSY <Correct value>
+CHAR(20) VARCHAR(30) ALL_NON_LOSSY <Correct value>
+CHAR(20) VARCHAR(10) ALL_NON_LOSSY <Correct error>
+CHAR(20) TINYTEXT ALL_NON_LOSSY <Correct value>
+CHAR(20) TEXT ALL_NON_LOSSY <Correct value>
+CHAR(20) MEDIUMTEXT ALL_NON_LOSSY <Correct value>
+CHAR(20) LONGTEXT ALL_NON_LOSSY <Correct value>
+VARCHAR(20) VARCHAR(20) ALL_NON_LOSSY <Correct value>
+VARCHAR(20) VARCHAR(30) ALL_NON_LOSSY <Correct value>
+VARCHAR(20) VARCHAR(10) ALL_NON_LOSSY <Correct error>
+VARCHAR(20) CHAR(30) ALL_NON_LOSSY <Correct value>
+VARCHAR(20) CHAR(10) ALL_NON_LOSSY <Correct error>
+VARCHAR(20) TINYTEXT ALL_NON_LOSSY <Correct value>
+VARCHAR(20) TEXT ALL_NON_LOSSY <Correct value>
+VARCHAR(20) MEDIUMTEXT ALL_NON_LOSSY <Correct value>
+VARCHAR(20) LONGTEXT ALL_NON_LOSSY <Correct value>
+VARCHAR(500) VARCHAR(500) ALL_NON_LOSSY <Correct value>
+VARCHAR(500) VARCHAR(510) ALL_NON_LOSSY <Correct value>
+VARCHAR(500) VARCHAR(255) ALL_NON_LOSSY <Correct error>
+VARCHAR(500) TINYTEXT ALL_NON_LOSSY <Correct error>
+VARCHAR(500) TEXT ALL_NON_LOSSY <Correct value>
+VARCHAR(500) MEDIUMTEXT ALL_NON_LOSSY <Correct value>
+VARCHAR(500) LONGTEXT ALL_NON_LOSSY <Correct value>
+TINYTEXT VARCHAR(500) ALL_NON_LOSSY <Correct value>
+TEXT VARCHAR(500) ALL_NON_LOSSY <Correct error>
+MEDIUMTEXT VARCHAR(500) ALL_NON_LOSSY <Correct error>
+LONGTEXT VARCHAR(500) ALL_NON_LOSSY <Correct error>
+TINYTEXT CHAR(255) ALL_NON_LOSSY <Correct value>
+TINYTEXT CHAR(250) ALL_NON_LOSSY <Correct error>
+TEXT CHAR(255) ALL_NON_LOSSY <Correct error>
+MEDIUMTEXT CHAR(255) ALL_NON_LOSSY <Correct error>
+LONGTEXT CHAR(255) ALL_NON_LOSSY <Correct error>
+TINYTEXT TINYTEXT ALL_NON_LOSSY <Correct value>
+TINYTEXT TEXT ALL_NON_LOSSY <Correct value>
+TEXT TINYTEXT ALL_NON_LOSSY <Correct error>
+DECIMAL(10,5) DECIMAL(10,5) ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(10,6) ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(11,5) ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(11,6) ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(10,4) ALL_NON_LOSSY <Correct error>
+DECIMAL(10,5) DECIMAL(9,5) ALL_NON_LOSSY <Correct error>
+DECIMAL(10,5) DECIMAL(9,4) ALL_NON_LOSSY <Correct error>
+FLOAT DECIMAL(10,5) ALL_NON_LOSSY <Correct error>
+DOUBLE DECIMAL(10,5) ALL_NON_LOSSY <Correct error>
+DECIMAL(10,5) FLOAT ALL_NON_LOSSY <Correct error>
+DECIMAL(10,5) DOUBLE ALL_NON_LOSSY <Correct error>
+FLOAT FLOAT ALL_NON_LOSSY <Correct value>
+DOUBLE DOUBLE ALL_NON_LOSSY <Correct value>
+FLOAT DOUBLE ALL_NON_LOSSY <Correct value>
+DOUBLE FLOAT ALL_NON_LOSSY <Correct error>
+BIT(5) BIT(5) ALL_NON_LOSSY <Correct value>
+BIT(5) BIT(6) ALL_NON_LOSSY <Correct value>
+BIT(6) BIT(5) ALL_NON_LOSSY <Correct error>
+BIT(5) BIT(12) ALL_NON_LOSSY <Correct value>
+BIT(12) BIT(5) ALL_NON_LOSSY <Correct error>
+BIT(1) BIT(1) ALL_LOSSY <Correct value>
+DATE DATE ALL_LOSSY <Correct value>
+ENUM('master',' ENUM('master',' ALL_LOSSY <Correct value>
+CHAR(10) ENUM('master',' ALL_LOSSY <Correct error>
+CHAR(10) SET('master','s ALL_LOSSY <Correct error>
+ENUM('master',' CHAR(10) ALL_LOSSY <Correct error>
+SET('master','s CHAR(10) ALL_LOSSY <Correct error>
+SET('master','s SET('master','s ALL_LOSSY <Correct value>
+SET('master','s SET('master','s ALL_LOSSY <Correct value>
+TINYINT TINYINT ALL_LOSSY <Correct value>
+TINYINT SMALLINT ALL_LOSSY <Correct error>
+TINYINT MEDIUMINT ALL_LOSSY <Correct error>
+TINYINT INT ALL_LOSSY <Correct error>
+TINYINT BIGINT ALL_LOSSY <Correct error>
+SMALLINT TINYINT ALL_LOSSY <Correct value>
+SMALLINT TINYINT ALL_LOSSY <Correct value>
+SMALLINT TINYINT UNSIGNE ALL_LOSSY <Correct value>
+SMALLINT SMALLINT ALL_LOSSY <Correct value>
+SMALLINT MEDIUMINT ALL_LOSSY <Correct error>
+SMALLINT INT ALL_LOSSY <Correct error>
+SMALLINT BIGINT ALL_LOSSY <Correct error>
+MEDIUMINT TINYINT ALL_LOSSY <Correct value>
+MEDIUMINT TINYINT ALL_LOSSY <Correct value>
+MEDIUMINT TINYINT UNSIGNE ALL_LOSSY <Correct value>
+MEDIUMINT SMALLINT ALL_LOSSY <Correct value>
+MEDIUMINT MEDIUMINT ALL_LOSSY <Correct value>
+MEDIUMINT INT ALL_LOSSY <Correct error>
+MEDIUMINT BIGINT ALL_LOSSY <Correct error>
+INT TINYINT ALL_LOSSY <Correct value>
+INT TINYINT ALL_LOSSY <Correct value>
+INT TINYINT UNSIGNE ALL_LOSSY <Correct value>
+INT SMALLINT ALL_LOSSY <Correct value>
+INT MEDIUMINT ALL_LOSSY <Correct value>
+INT INT ALL_LOSSY <Correct value>
+INT BIGINT ALL_LOSSY <Correct error>
+BIGINT TINYINT ALL_LOSSY <Correct value>
+BIGINT SMALLINT ALL_LOSSY <Correct value>
+BIGINT MEDIUMINT ALL_LOSSY <Correct value>
+BIGINT INT ALL_LOSSY <Correct value>
+BIGINT BIGINT ALL_LOSSY <Correct value>
+CHAR(20) CHAR(20) ALL_LOSSY <Correct value>
+CHAR(20) CHAR(30) ALL_LOSSY <Correct error>
+CHAR(20) CHAR(10) ALL_LOSSY <Correct value>
+CHAR(20) VARCHAR(20) ALL_LOSSY <Correct error>
+CHAR(20) VARCHAR(30) ALL_LOSSY <Correct error>
+CHAR(20) VARCHAR(10) ALL_LOSSY <Correct value>
+CHAR(20) TINYTEXT ALL_LOSSY <Correct error>
+CHAR(20) TEXT ALL_LOSSY <Correct error>
+CHAR(20) MEDIUMTEXT ALL_LOSSY <Correct error>
+CHAR(20) LONGTEXT ALL_LOSSY <Correct error>
+VARCHAR(20) VARCHAR(20) ALL_LOSSY <Correct value>
+VARCHAR(20) VARCHAR(30) ALL_LOSSY <Correct error>
+VARCHAR(20) VARCHAR(10) ALL_LOSSY <Correct value>
+VARCHAR(20) CHAR(30) ALL_LOSSY <Correct error>
+VARCHAR(20) CHAR(10) ALL_LOSSY <Correct value>
+VARCHAR(20) TINYTEXT ALL_LOSSY <Correct error>
+VARCHAR(20) TEXT ALL_LOSSY <Correct error>
+VARCHAR(20) MEDIUMTEXT ALL_LOSSY <Correct error>
+VARCHAR(20) LONGTEXT ALL_LOSSY <Correct error>
+VARCHAR(500) VARCHAR(500) ALL_LOSSY <Correct value>
+VARCHAR(500) VARCHAR(510) ALL_LOSSY <Correct error>
+VARCHAR(500) VARCHAR(255) ALL_LOSSY <Correct value>
+VARCHAR(500) TINYTEXT ALL_LOSSY <Correct value>
+VARCHAR(500) TEXT ALL_LOSSY <Correct error>
+VARCHAR(500) MEDIUMTEXT ALL_LOSSY <Correct error>
+VARCHAR(500) LONGTEXT ALL_LOSSY <Correct error>
+TINYTEXT VARCHAR(500) ALL_LOSSY <Correct error>
+TEXT VARCHAR(500) ALL_LOSSY <Correct value>
+MEDIUMTEXT VARCHAR(500) ALL_LOSSY <Correct value>
+LONGTEXT VARCHAR(500) ALL_LOSSY <Correct value>
+TINYTEXT CHAR(255) ALL_LOSSY <Correct error>
+TINYTEXT CHAR(250) ALL_LOSSY <Correct value>
+TEXT CHAR(255) ALL_LOSSY <Correct value>
+MEDIUMTEXT CHAR(255) ALL_LOSSY <Correct value>
+LONGTEXT CHAR(255) ALL_LOSSY <Correct value>
+TINYTEXT TINYTEXT ALL_LOSSY <Correct value>
+TINYTEXT TEXT ALL_LOSSY <Correct error>
+TEXT TINYTEXT ALL_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(10,5) ALL_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(10,6) ALL_LOSSY <Correct error>
+DECIMAL(10,5) DECIMAL(11,5) ALL_LOSSY <Correct error>
+DECIMAL(10,5) DECIMAL(11,6) ALL_LOSSY <Correct error>
+DECIMAL(10,5) DECIMAL(10,4) ALL_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(9,5) ALL_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(9,4) ALL_LOSSY <Correct value>
+FLOAT DECIMAL(10,5) ALL_LOSSY <Correct value>
+DOUBLE DECIMAL(10,5) ALL_LOSSY <Correct value>
+DECIMAL(10,5) FLOAT ALL_LOSSY <Correct value>
+DECIMAL(10,5) DOUBLE ALL_LOSSY <Correct value>
+FLOAT FLOAT ALL_LOSSY <Correct value>
+DOUBLE DOUBLE ALL_LOSSY <Correct value>
+FLOAT DOUBLE ALL_LOSSY <Correct error>
+DOUBLE FLOAT ALL_LOSSY <Correct value>
+BIT(5) BIT(5) ALL_LOSSY <Correct value>
+BIT(5) BIT(6) ALL_LOSSY <Correct error>
+BIT(6) BIT(5) ALL_LOSSY <Correct value>
+BIT(5) BIT(12) ALL_LOSSY <Correct error>
+BIT(12) BIT(5) ALL_LOSSY <Correct value>
+BIT(1) BIT(1) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DATE DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+ENUM('master',' ENUM('master',' ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+CHAR(10) ENUM('master',' ALL_LOSSY,ALL_NON_LOSSY <Correct error>
+CHAR(10) SET('master','s ALL_LOSSY,ALL_NON_LOSSY <Correct error>
+ENUM('master',' CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct error>
+SET('master','s CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct error>
+SET('master','s SET('master','s ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+SET('master','s SET('master','s ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+SMALLINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+SMALLINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+SMALLINT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+SMALLINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+SMALLINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+SMALLINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+SMALLINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMINT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+INT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+INT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+INT TINYINT UNSIGNE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+INT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+INT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+INT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+INT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BIGINT TINYINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BIGINT SMALLINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BIGINT MEDIUMINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BIGINT INT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BIGINT BIGINT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+CHAR(20) CHAR(20) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+CHAR(20) CHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+CHAR(20) CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+CHAR(20) VARCHAR(20) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+CHAR(20) VARCHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+CHAR(20) VARCHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+CHAR(20) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+CHAR(20) TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+CHAR(20) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+CHAR(20) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(20) VARCHAR(20) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(20) VARCHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(20) VARCHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(20) CHAR(30) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(20) CHAR(10) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(20) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(20) TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(20) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(20) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(500) VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(500) VARCHAR(510) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(500) VARCHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(500) TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(500) TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(500) MEDIUMTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+VARCHAR(500) LONGTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+LONGTEXT VARCHAR(500) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYTEXT CHAR(250) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+LONGTEXT CHAR(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYTEXT TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYTEXT TEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TEXT TINYTEXT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(10,6) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(11,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(11,6) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(10,4) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(9,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DECIMAL(9,4) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+FLOAT DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DOUBLE DECIMAL(10,5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) FLOAT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DECIMAL(10,5) DOUBLE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+FLOAT FLOAT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DOUBLE DOUBLE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+FLOAT DOUBLE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DOUBLE FLOAT ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BIT(5) BIT(5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BIT(5) BIT(6) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BIT(6) BIT(5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BIT(5) BIT(12) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BIT(12) BIT(5) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+DROP TABLE type_conversions;
+DROP TABLE t1;
+set global slave_type_conversions = @saved_slave_type_conversions;
diff --git a/mysql-test/suite/rpl/r/rpl_typeconv_innodb.result b/mysql-test/suite/rpl/r/rpl_typeconv_innodb.result
new file mode 100644
index 00000000000..0b4286c54eb
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_typeconv_innodb.result
@@ -0,0 +1,18 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** Resetting master and slave ****
+include/stop_slave.inc
+RESET SLAVE;
+RESET MASTER;
+include/start_slave.inc
+SET @saved_slave_type_conversions = @@GLOBAL.SLAVE_TYPE_CONVERSIONS;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = '';
+CREATE TABLE t1(b1 BIT(1), b2 BIT(2), b3 BIT(3)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (b'0', b'01', b'101');
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def
index d2cb1ce9518..c222d3dd523 100644
--- a/mysql-test/suite/rpl/t/disabled.def
+++ b/mysql-test/suite/rpl/t/disabled.def
@@ -10,4 +10,5 @@
#
##############################################################################
+rpl_cross_version : Bug#42311 2009-03-27 joro rpl_cross_version fails on macosx
rpl_row_create_table : Bug#45576 2009-12-01 joro rpl_row_create_table fails on PB2
diff --git a/mysql-test/suite/rpl/t/rpl000010.test b/mysql-test/suite/rpl/t/rpl000010.test
index 261b9148774..a95cded6496 100644
--- a/mysql-test/suite/rpl/t/rpl000010.test
+++ b/mysql-test/suite/rpl/t/rpl000010.test
@@ -6,14 +6,10 @@ 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;
+sync_slave_with_master;
select n from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl000011.test b/mysql-test/suite/rpl/t/rpl000011.test
index 32f6227f7c5..baff7c1a1b5 100644
--- a/mysql-test/suite/rpl/t/rpl000011.test
+++ b/mysql-test/suite/rpl/t/rpl000011.test
@@ -4,7 +4,9 @@ create table t1 (n int);
insert into t1 values(1);
sync_slave_with_master;
stop slave;
+--source include/wait_for_slave_to_stop.inc
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
insert into t1 values(2);
#let slave catch up
diff --git a/mysql-test/suite/rpl/t/rpl000013.test b/mysql-test/suite/rpl/t/rpl000013.test
index 69a102e84ce..c5a3285733a 100644
--- a/mysql-test/suite/rpl/t/rpl000013.test
+++ b/mysql-test/suite/rpl/t/rpl000013.test
@@ -9,9 +9,7 @@
--source include/have_binlog_format_mixed_or_statement.inc
source include/master-slave.inc;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
connection master;
create table t2(n int);
@@ -46,8 +44,6 @@ connection master2;
# exist in this connection.
drop table if exists t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.opt b/mysql-test/suite/rpl/t/rpl000017-slave.opt
deleted file mode 100644
index 58a964c90d0..00000000000
--- a/mysql-test/suite/rpl/t/rpl000017-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-slave-start
diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.sh b/mysql-test/suite/rpl/t/rpl000017-slave.sh
index 1d95798260a..1d95798260a 100755..100644
--- a/mysql-test/suite/rpl/t/rpl000017-slave.sh
+++ b/mysql-test/suite/rpl/t/rpl000017-slave.sh
diff --git a/mysql-test/suite/rpl/t/rpl000017.test b/mysql-test/suite/rpl/t/rpl000017.test
index 2ba321cd8c3..a65189657cc 100644
--- a/mysql-test/suite/rpl/t/rpl000017.test
+++ b/mysql-test/suite/rpl/t/rpl000017.test
@@ -1,11 +1,23 @@
+# The test manually replaces the relay-log.info file with connection
+# information which the slave then should pick up. However, to avoid
+# overwriting the file, no CHANGE MASTER TO nor RESET SLAVE statements
+# should be executed.
+#
+# Starting replication before granting a replication user privileges
+# to replicate will cause the start slave to fail, so we shouldn't do
+# that.
+
+let $no_change_master = 1;
+let $skip_slave_start = 1;
source include/master-slave.inc;
-connection 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;
+source include/wait_for_slave_to_start.inc;
+
connection master;
--disable_warnings
drop table if exists t1;
diff --git a/mysql-test/suite/rpl/t/rpl_000015-slave.opt b/mysql-test/suite/rpl/t/rpl_000015-slave.opt
index 28bc753dd56..178e9d781f6 100644
--- a/mysql-test/suite/rpl/t/rpl_000015-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_000015-slave.opt
@@ -1 +1 @@
---server-id=22 --master-connect-retry=7
+--server-id=22
diff --git a/mysql-test/suite/rpl/t/rpl_000015.test b/mysql-test/suite/rpl/t/rpl_000015.test
index 45a43cd38d0..446c2f06ae5 100644
--- a/mysql-test/suite/rpl/t/rpl_000015.test
+++ b/mysql-test/suite/rpl/t/rpl_000015.test
@@ -15,14 +15,12 @@ connection slave;
reset slave;
source include/show_slave_status2.inc;
-change master to master_host='127.0.0.1';
-# The following needs to be cleaned up when change master is fixed
-source include/show_slave_status2.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;
+ master_password='',master_port=$MASTER_MYPORT, MASTER_CONNECT_RETRY=7;
source include/show_slave_status2.inc;
start slave;
+--source include/wait_for_slave_to_start.inc
sync_with_master;
source include/show_slave_status2.inc;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_alter.test b/mysql-test/suite/rpl/t/rpl_alter.test
index 576376a0264..6a6da9c9f24 100644
--- a/mysql-test/suite/rpl/t/rpl_alter.test
+++ b/mysql-test/suite/rpl/t/rpl_alter.test
@@ -10,15 +10,11 @@ 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;
+sync_slave_with_master;
select * from mysqltest.t2;
select * from mysqltest.t3;
connection master;
drop database mysqltest;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test
index d4b7872fb2b..8c95e158847 100644
--- a/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test
+++ b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test
@@ -51,9 +51,7 @@ CALL simpleproc3();
select * from t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
use test1;
select * from t1;
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_grant.test b/mysql-test/suite/rpl/t/rpl_binlog_grant.test
index 31163927ce2..da14b45d5c3 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_grant.test
@@ -25,9 +25,7 @@ grant select on t to x@y;
#
rollback;
show grants for x@y;
---replace_result $VERSION VERSION
---replace_regex /\/\* xid=.* \*\//\/* XID *\//
-show binlog events;
+source include/show_binlog_events.inc;
start transaction;
insert into t values (2);
revoke select on t from x@y;
@@ -37,9 +35,7 @@ revoke select on t from x@y;
commit;
select * from t;
show grants for x@y;
---replace_result $VERSION VERSION
---replace_regex /\/\* xid=.* \*\//\/* XID *\//
-show binlog events;
+source include/show_binlog_events.inc;
drop user x@y;
drop database d1;
--sync_slave_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_bit.test b/mysql-test/suite/rpl/t/rpl_bit.test
index 07b0778296c..c648159ff3a 100644
--- a/mysql-test/suite/rpl/t/rpl_bit.test
+++ b/mysql-test/suite/rpl/t/rpl_bit.test
@@ -78,10 +78,8 @@ 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;
+sync_slave_with_master;
-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;
diff --git a/mysql-test/suite/rpl/t/rpl_bit_npk.test b/mysql-test/suite/rpl/t/rpl_bit_npk.test
index 12b587919f9..1df7341eafc 100644
--- a/mysql-test/suite/rpl/t/rpl_bit_npk.test
+++ b/mysql-test/suite/rpl/t/rpl_bit_npk.test
@@ -76,10 +76,8 @@ SELECT 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;
+sync_slave_with_master;
-connection slave;
-sync_with_master;
SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
FROM test.t1
ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
@@ -100,10 +98,8 @@ 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;
+sync_slave_with_master;
-connection slave;
-sync_with_master;
SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
SELECT * FROM test.t3 ORDER BY a,b;
diff --git a/mysql-test/suite/rpl/t/rpl_bug31076.test b/mysql-test/suite/rpl/t/rpl_bug31076.test
index 9176bafe022..1f488aae64e 100644
--- a/mysql-test/suite/rpl/t/rpl_bug31076.test
+++ b/mysql-test/suite/rpl/t/rpl_bug31076.test
@@ -1,5 +1,8 @@
source include/master-slave.inc;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
+
CREATE DATABASE track;
USE track;
@@ -130,7 +133,10 @@ VALUES ('3m3l4rhs6do0sf5p1i9lr94g928a272v', '', '', INET_ATON('71.118.124.98'),
SELECT * FROM visits;
SELECT * FROM visits_events;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
+
# Cleanup
DROP DATABASE track;
sync_slave_with_master;
+
--echo End of 5.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test
index 1316ddb7401..42d86a7fc1e 100644
--- a/mysql-test/suite/rpl/t/rpl_bug33931.test
+++ b/mysql-test/suite/rpl/t/rpl_bug33931.test
@@ -8,23 +8,25 @@ source include/have_log_bin.inc;
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
-
connection master;
reset master;
connection slave;
+reset slave;
# Add suppression for expected warnings in slaves error log
call mtr.add_suppression("Failed during slave I/O thread initialization");
---disable_warnings
-stop slave;
---enable_warnings
-reset slave;
-
# Set debug flags on slave to force errors to occur
SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
+--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
+
start slave;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_bug41902-slave.opt b/mysql-test/suite/rpl/t/rpl_bug41902-slave.opt
new file mode 100644
index 00000000000..37fc56036fb
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_bug41902-slave.opt
@@ -0,0 +1 @@
+--loose-debug=-d,simulate_find_log_pos_error
diff --git a/mysql-test/suite/rpl/t/rpl_bug41902.test b/mysql-test/suite/rpl/t/rpl_bug41902.test
new file mode 100644
index 00000000000..05f13bbc848
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_bug41902.test
@@ -0,0 +1,61 @@
+# Test for Bug #41902 MYSQL_BIN_LOG::reset_logs() doesn't call my_error()
+# in face of an error
+#
+
+source include/have_debug.inc;
+source include/master-slave.inc;
+
+#
+# test checks that
+# a. there is no crash when find_log_pos() returns with an error
+# that tests expect to receive;
+# b. in the case of multiple error messages the first error message is
+# reported to the user and others are available as warnings.
+#
+
+connection slave;
+stop slave;
+
+SET @@debug="d,simulate_find_log_pos_error";
+
+--error ER_UNKNOWN_TARGET_BINLOG
+reset slave;
+show warnings;
+
+SET @@debug="";
+reset slave;
+change master to master_host='dummy';
+
+SET @@debug="d,simulate_find_log_pos_error";
+
+--error ER_UNKNOWN_TARGET_BINLOG
+change master to master_host='dummy';
+
+SET @@debug="";
+reset slave;
+change master to master_host='dummy';
+
+connection master;
+SET @@debug="d,simulate_find_log_pos_error";
+--error ER_UNKNOWN_TARGET_BINLOG
+reset master;
+
+SET @@debug="";
+reset master;
+
+SET @@debug="d,simulate_find_log_pos_error";
+--error ER_UNKNOWN_TARGET_BINLOG
+purge binary logs to 'master-bin.000001';
+
+SET @@debug="";
+purge binary logs to 'master-bin.000001';
+
+--disable_query_log
+call mtr.add_suppression("Failed to locate old binlog or relay log files");
+call mtr.add_suppression("MYSQL_LOG::purge_logs was called with file ./master-bin.000001 not listed in the index");
+connection slave;
+call mtr.add_suppression("Failed to locate old binlog or relay log files");
+call mtr.add_suppression("MYSQL_LOG::purge_logs was called with file ./master-bin.000001 not listed in the index");
+--enable_query_log
+
+--echo End of the tests
diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test
index d0cd40e2e11..997cca42e82 100644
--- a/mysql-test/suite/rpl/t/rpl_change_master.test
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test
@@ -28,8 +28,59 @@ sync_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
+sync_slave_with_master;
+
+# End of 4.1 tests
+
+#
+# BUG#12190 CHANGE MASTER has differ path requiremts on MASTER_LOG_FILE and RELAY_LOG_FILE
+#
+
+source include/master-slave-reset.inc;
+
+connection master;
+create table t1 (a int);
+insert into t1 values (1);
+flush logs;
+insert into t1 values (2);
+
+# Note: the master positon saved by this will also be used by the
+# 'sync_with_master' below.
+sync_slave_with_master;
+
+# Check if the table t1 and t2 are identical on master and slave;
+let $diff_table_1= master:test.t1
+let $diff_table_2= slave:test.t1
+source include/diff_tables.inc;
+
connection slave;
+source include/stop_slave.inc;
+delete from t1 where a=2;
+
+# start replication from the second insert, after fix of BUG#12190,
+# relay_log_file does not use absolute path, only the filename is
+# required
+#
+# Note: the follow change master will automatically reset
+# relay_log_purge to false, save the old value to restore
+let $relay_log_purge= `select @@global.relay_log_purge`;
+CHANGE MASTER TO relay_log_file='slave-relay-bin.000005', relay_log_pos=4;
+start slave sql_thread;
+source include/wait_for_slave_sql_to_start.inc;
+
+# Sync to the same position saved by the 'sync_slave_with_master' above.
sync_with_master;
-# End of 4.1 tests
+# Check if the table t1 and t2 are identical on master and slave;
+let $diff_table_1= master:test.t1
+let $diff_table_2= slave:test.t1
+source include/diff_tables.inc;
+
+# clean up
+connection slave;
+start slave io_thread;
+source include/wait_for_slave_io_to_start.inc;
+eval set global relay_log_purge=$relay_log_purge;
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
index a49253f90c1..37420b13805 100644
--- a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
+++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
@@ -7,6 +7,9 @@
#############################################################
--source include/have_innodb.inc
+# Use wait_for_slave_to_(start|stop) for current connections
+let $keep_connection= 1;
+
# Set up circular ring and new names for servers
--echo *** Set up circular ring by schema A->B->C->D->A ***
--source include/circular_rpl_for_4_hosts_init.inc
diff --git a/mysql-test/suite/rpl/t/rpl_colSize.test b/mysql-test/suite/rpl/t/rpl_colSize.test
index c20f2c3fd35..4c808ef3dfd 100644
--- a/mysql-test/suite/rpl/t/rpl_colSize.test
+++ b/mysql-test/suite/rpl/t/rpl_colSize.test
@@ -16,8 +16,12 @@ DROP TABLE IF EXISTS t1;
--echo *** Create "wider" table on slave ***
sync_slave_with_master;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
RESET SLAVE;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
+
eval CREATE TABLE t1 (
a float (47),
b double (143,9),
@@ -69,6 +73,7 @@ RESET MASTER;
--echo *** Start replication ***
connection slave;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
--echo *** Insert data on master and display it. ***
connection master;
@@ -217,4 +222,6 @@ connection master;
DROP TABLE t1;
sync_slave_with_master;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
+
# END 5.1 Test Case
diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test
index a13adf28b95..1cd36d35931 100644
--- a/mysql-test/suite/rpl/t/rpl_do_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test
@@ -8,9 +8,7 @@ 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;
+sync_slave_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';
@@ -21,17 +19,13 @@ flush privileges;
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;
+sync_slave_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;
+sync_slave_with_master;
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
#
@@ -44,9 +38,7 @@ select password<>'' from mysql.user where user='rpl_do_grant';
set sql_mode='ANSI_QUOTES';
set password for rpl_do_grant@localhost=password('does it work?');
set sql_mode='';
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select password<>'' from mysql.user where user='rpl_do_grant';
diff --git a/mysql-test/suite/rpl/t/rpl_drop.test b/mysql-test/suite/rpl/t/rpl_drop.test
index b38007a755f..6f586d90de3 100644
--- a/mysql-test/suite/rpl/t/rpl_drop.test
+++ b/mysql-test/suite/rpl/t/rpl_drop.test
@@ -7,10 +7,6 @@ drop table if exists t1, t2;
create table t1 (a int);
--error 1051
drop table t1, t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
-
-
diff --git a/mysql-test/suite/rpl/t/rpl_drop_view.test b/mysql-test/suite/rpl/t/rpl_drop_view.test
index 11633a0a7e8..05bf112b8b8 100644
--- a/mysql-test/suite/rpl/t/rpl_drop_view.test
+++ b/mysql-test/suite/rpl/t/rpl_drop_view.test
@@ -20,9 +20,7 @@ drop view v1, not_exist_view;
--error 1146
select * from v1;
drop view v2, v3;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
--error 1146
select * from v1;
--error 1146
diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
index 9efb3d16d2b..b2530e83b89 100644
--- a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
+++ b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
@@ -22,6 +22,7 @@ connection master;
eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root";
start slave;
+--source include/wait_for_slave_to_start.inc
# now we test it
@@ -38,12 +39,11 @@ sync_with_master;
# log-slave-updates and circul repl
#
stop slave;
+--source include/wait_for_slave_to_stop.inc
create table t2 (n int); # create one ignored event
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
connection slave;
@@ -85,6 +85,7 @@ start slave until master_log_file="slave-bin.000001",master_log_pos=663;
select * from t3;
start slave;
+--source include/wait_for_slave_to_start.inc
# BUG#13023 is that Exec_master_log_pos may stay too low "forever":
@@ -94,9 +95,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;
@@ -114,11 +113,10 @@ show tables;
# cleanup
stop slave;
+--source include/wait_for_slave_to_stop.inc
reset slave;
drop table t1,t2,t3,t4,t5,t6;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_empty_master_crash-master.opt b/mysql-test/suite/rpl/t/rpl_empty_master_crash-master.opt
deleted file mode 100644
index cef79bc8585..00000000000
--- a/mysql-test/suite/rpl/t/rpl_empty_master_crash-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---force-restart
diff --git a/mysql-test/suite/rpl/t/rpl_empty_master_crash.test b/mysql-test/suite/rpl/t/rpl_empty_master_crash.test
deleted file mode 100644
index f8e7870ae3c..00000000000
--- a/mysql-test/suite/rpl/t/rpl_empty_master_crash.test
+++ /dev/null
@@ -1,14 +0,0 @@
-source include/master-slave.inc;
-
-source include/show_slave_status.inc;
-
-#
-# Load table should not succeed on the master as this is not a slave
-#
---error 1218
-load table t1 from master;
-connection slave;
---error 1188
-load table t1 from master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_empty_master_host.test b/mysql-test/suite/rpl/t/rpl_empty_master_host.test
new file mode 100644
index 00000000000..7d245b1d5d5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_empty_master_host.test
@@ -0,0 +1,51 @@
+#
+# BUG
+# ---
+# BUG#28796: CHANGE MASTER TO MASTER_HOST="" leads to invalid master.info
+#
+# Description
+# -----------
+#
+# This test aims at:
+# i) verifying that an error is thrown when setting MASTER_HOST=''
+# ii) no error is thrown when setting non empty MASTER_HOST
+# iii) replication works after setting a correct host name/ip
+#
+# Implementation is performed by feeding different values (according
+# to i), ii) and iii) ) to CHANGE MASTER TO MASTER_HOST= x and checking
+# along the way if error/no error is thrown and/or if replication starts
+# working when expected.
+
+--source include/master-slave.inc
+
+connection slave;
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+
+let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
+--echo Master_Host = '$master_host' (expected '127.0.0.1')
+
+# attempt to change to an empty master host should
+# result in error ER_WRONG_ARGUMENTS: "Incorrect arguments to ..."
+error ER_WRONG_ARGUMENTS;
+CHANGE MASTER TO MASTER_HOST="";
+
+# show slave status still holds previous information
+let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
+--echo Master_Host = '$master_host' (expected '127.0.0.1')
+
+# changing master to other than empty master host succeeds
+CHANGE MASTER TO MASTER_HOST="foo";
+
+# show slave status should hold "foo" as master host
+let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
+--echo Master_Host = '$master_host' (expected 'foo')
+
+# changing back to localhost
+CHANGE MASTER TO MASTER_HOST="127.0.0.1";
+let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
+--echo Master_Host = '$master_host' (expected '127.0.0.1')
+
+# start slave must succeed.
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
diff --git a/mysql-test/suite/rpl/t/rpl_flush_logs-master.opt b/mysql-test/suite/rpl/t/rpl_flush_logs-master.opt
new file mode 100644
index 00000000000..36eab1d6c8f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_flush_logs-master.opt
@@ -0,0 +1 @@
+--log-error=$MYSQLTEST_VARDIR/tmp/master_log.err
diff --git a/mysql-test/suite/rpl/t/rpl_flush_logs.test b/mysql-test/suite/rpl/t/rpl_flush_logs.test
new file mode 100644
index 00000000000..2118b48f946
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_flush_logs.test
@@ -0,0 +1,172 @@
+#
+# WL#5124
+# This test verifies if the 'flush individual logs' statement
+# works fine.
+#
+
+--source include/master-slave.inc
+--source include/have_binlog_format_statement.inc
+connection master;
+
+# Test 'flush error logs' statement.
+--echo # Make sure the 'master_log.err-old' file does not
+--echo # exist before execute 'flush error logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
+
+--echo # Test if support 'flush error logs' statement.
+flush error logs;
+
+--echo # Check the 'master_log.err-old' file is created
+--echo # after executed 'flush error logs' statement.
+file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
+file_exists $MYSQLTEST_VARDIR/tmp/master_log.err;
+
+--echo # Make sure binary logs was not be flushed
+--echo # after execute 'flush error logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
+
+sync_slave_with_master;
+--echo # Make sure relay logs was not be flushed
+--echo # after execute 'flush error logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000004;
+
+
+# Test 'flush relay logs' statement.
+--echo # Make sure the 'slave-relay-bin.000004' file does not
+--echo # exist before execute 'flush relay logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000004;
+
+connection master;
+--echo # Test if support 'flush relay logs' statement.
+flush relay logs;
+
+sync_slave_with_master;
+--echo # Check the 'slave-relay-bin.000004' file is created
+--echo # after executed 'flush relay logs' statement.
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000004;
+
+connection master;
+--echo # Make sure binary logs was not be flushed
+--echo # after execute 'flush relay logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
+
+
+# Test 'flush slow logs' statement.
+--echo # Test if support 'flush slow logs' statement.
+flush slow logs;
+
+--echo # Make sure binary logs was not be flushed
+--echo # after execute 'flush slow logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
+
+
+# Test 'flush general logs' statement.
+--echo # Test if support 'flush general logs' statement.
+flush general logs;
+
+--echo # Make sure binary logs was not be flushed
+--echo # after execute 'flush general logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
+
+
+# Test 'flush engine logs' statement.
+--echo # Test if support 'flush engine logs' statement.
+flush engine logs;
+
+--echo # Make sure binary logs was not be flushed
+--echo # after execute 'flush engine logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
+
+
+# Test 'flush binary logs' statement.
+--echo # Make sure the 'master-bin.000002' file does not
+--echo # exist before execute 'flush binary logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
+
+--echo # Test if support 'flush binary logs' statement.
+flush binary logs;
+
+--echo # Check the 'master-bin.000002' file is created
+--echo # after executed 'flush binary logs' statement.
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001;
+
+
+# Test 'flush error logs, relay logs' statement
+sync_slave_with_master;
+--echo # Make sure the 'slave-relay-bin.000007' file does not exist
+--echo # exist before execute 'flush error logs, relay logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007;
+
+connection master;
+remove_file $MYSQLTEST_VARDIR/tmp/master_log.err-old;
+
+--echo # Make sure the 'master_log.err-old' file does not exist
+--echo # before execute 'flush error logs, relay logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
+
+--echo # Test if support to combine all kinds of logs into one statement.
+flush error logs, relay logs;
+
+--echo # Check the 'master_log.err-old' file is created
+--echo # after executed 'flush error logs, relay logs' statement.
+file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
+file_exists $MYSQLTEST_VARDIR/tmp/master_log.err;
+
+--echo # Make sure binary logs was not be flushed
+--echo # after execute 'flush error logs, relay logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000003;
+
+sync_slave_with_master;
+--echo # Check the 'slave-relay-bin.000007' file is created after
+--echo # execute 'flush error logs, relay logs' statement.
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007;
+
+
+# Test 'flush logs' statement
+--echo # Make sure the 'slave-relay-bin.000008' and 'slave-relay-bin.000009'
+--echo # files do not exist before execute 'flush error logs, relay logs'
+--echo # statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008;
+--error 1
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000009;
+
+connection master;
+remove_file $MYSQLTEST_VARDIR/tmp/master_log.err-old;
+
+--echo # Make sure the 'master_log.err-old' file does not exist
+--echo # before execute 'flush logs' statement.
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
+
+--echo # Test if 'flush logs' statement works fine and flush all the logs.
+flush logs;
+
+--echo # Check the 'master_log.err-old' file is created
+--echo # after executed 'flush logs' statement.
+file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
+file_exists $MYSQLTEST_VARDIR/tmp/master_log.err;
+
+--echo # Check 'master-bin.000003' is created
+--echo # after execute 'flush logs' statement.
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000003;
+
+sync_slave_with_master;
+--echo # Check the 'slave-relay-bin.000008' and 'slave-relay-bin.000009'
+--echo # files are created after execute 'flush logs' statement.
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008;
+file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000009;
+
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh
index a321dd690cd..a321dd690cd 100755..100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh
index e46ea6d400b..e46ea6d400b 100755..100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
index a8befe612c2..a873c1fa3a9 100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
@@ -1,6 +1,8 @@
# Testing if "flush logs" command bouncing resulting in logs created in a loop
# in case of bi-directional replication
-- source include/master-slave.inc
+# Use wait_for_slave_to_(start|stop) for current connections
+let $keep_connection= 1;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/
@@ -9,18 +11,20 @@ show variables like 'relay_log%';
connection slave;
--disable_warnings
stop slave;
+--source include/wait_for_slave_to_stop.inc
--enable_warnings
--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
start slave;
-
+--source include/wait_for_slave_to_start.inc
#
# Start replication slave -> master
#
connection master;
--disable_warnings
stop slave;
+--source include/wait_for_slave_to_stop.inc
--enable_warnings
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat.test b/mysql-test/suite/rpl/t/rpl_heartbeat.test
new file mode 100644
index 00000000000..3b0d21052ee
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test
@@ -0,0 +1,168 @@
+# Testing master to slave heartbeat protocol
+#
+# Including:
+# - user interface, grammar, checking the range and warnings about
+# unreasonable values for the heartbeat period;
+# - no rotation of relay log if heartbeat is less that slave_net_timeout
+# - SHOW STATUS like 'Slave_received_heartbeats' action
+# - SHOW STATUS like 'Slave_heartbeat_period' report
+
+-- source include/have_log_bin.inc
+
+connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
+connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK);
+
+connection master;
+reset master;
+
+connection slave;
+set @restore_slave_net_timeout= @@global.slave_net_timeout;
+set @@global.slave_net_timeout= 10;
+
+###
+### Checking the range
+###
+
+#
+# default period slave_net_timeout/2
+#
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
+--query_vertical show status like 'Slave_heartbeat_period';
+
+#
+# the max for the period is ULONG_MAX/1000; an attempt to exceed it is denied
+#
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 4294968;
+--query_vertical show status like 'Slave_heartbeat_period';
+
+#
+# the min value for the period is 1 millisecond an attempt to assign a
+# lesser will be warned with treating the value as zero
+#
+connection slave;
+--replace_result $MASTER_MYPORT MASTER_PORT
+### 5.1 mtr does not have --warning ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 0.0009999;
+--query_vertical show status like 'Slave_heartbeat_period';
+
+#
+# the actual max and min must be accepted
+#
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 4294967;
+--query_vertical show status like 'Slave_heartbeat_period';
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 0.001;
+--query_vertical show status like 'Slave_heartbeat_period';
+
+reset slave;
+
+#
+# A warning if period greater than slave_net_timeout
+#
+set @@global.slave_net_timeout= 5;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 5.001;
+--query_vertical show status like 'Slave_heartbeat_period';
+
+reset slave;
+
+#
+# A warning if slave_net_timeout is set to less than the current HB period
+#
+set @@global.slave_net_timeout= 5;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 4;
+--query_vertical show status like 'Slave_heartbeat_period';
+set @@global.slave_net_timeout= 3 /* must be a warning */;
+
+reset slave;
+
+
+###
+### checking no rotation
+###
+
+connection master;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+#
+# Even though master_heartbeat_period= 0.5 is 20 times less than
+# @@global.slave_net_timeout= 10 in some circumstances master will
+# not be able to send any heartbeat during the slave's net timeout
+# and slave's relay log will rotate.
+# The probability for such a scenario is pretty small so the following
+# part is almost deterministic.
+#
+
+connection slave;
+set @@global.slave_net_timeout= 10;
+--replace_result $MASTER_MYPORT MASTER_PORT
+# no error this time but rather a warning
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 0.5;
+--query_vertical show status like 'Slave_heartbeat_period';
+
+start slave;
+
+connection master;
+create table t1 (f1 int);
+
+#connection slave;
+sync_slave_with_master;
+source include/show_slave_status.inc;
+
+# there is an explicit sleep lasting longer than slave_net_timeout
+# to ensure that nothing will come to slave from master for that period.
+# That would cause reconnecting and relaylog rotation w/o the fix i.e
+# without a heartbeat received.
+
+real_sleep 15;
+
+# check (compare with the previous show's results) that no rotation happened
+source include/show_slave_status.inc;
+
+###
+### SHOW STATUS like 'Slave_heartbeat_period' and 'Slave_received_heartbeats'
+###
+
+--query_vertical show status like 'Slave_heartbeat_period';
+
+#
+# proof that there has been received at least one heartbeat;
+# The exact number of received heartbeat is an indeterministic value
+# and therefore it's not recorded into results.
+#
+
+let $slave_wait_param_counter= 300;
+let $slave_value= query_get_value("SHOW STATUS like 'Slave_received_heartbeats'", Value, 1);
+# Checking the fact that at least one heartbeat is received
+while (`select $slave_value = 0`)
+{
+ dec $slave_wait_param_counter;
+ if (!$slave_wait_param_counter)
+ {
+ --echo ERROR: failed while waiting for slave parameter $slave_param: $slave_param_value
+ query_vertical show slave status;
+ SHOW STATUS like 'Slave_received_heartbeats';
+ exit;
+ }
+ sleep 0.1;
+ let $slave_value= query_get_value("SHOW STATUS like 'Slave_received_heartbeats'", Value, 1);
+}
+--echo A heartbeat has been received by the slave
+# cleanup
+
+connection master;
+drop table t1;
+
+#connection slave;
+sync_slave_with_master;
+set @@global.slave_net_timeout= @restore_slave_net_timeout;
+
+
+--echo End of tests
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf
new file mode 100644
index 00000000000..a3ed77c8bd2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf
@@ -0,0 +1,17 @@
+!include ../my.cnf
+
+[mysqld.1]
+server_id=1
+
+[mysqld.2]
+server_id=2
+
+[mysqld.3]
+server_id=3
+
+[ENV]
+SLAVE_MYPORT1= @mysqld.3.port
+SLAVE_MYSOCK1= @mysqld.3.socket
+
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test
new file mode 100644
index 00000000000..81737feea9e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test
@@ -0,0 +1,142 @@
+#############################################################
+# Author: Serge Kozlov <Serge.Kozlov@Sun.COM>
+# Date: 02/19/2009
+# Purpose: Testing heartbeat for schema
+# 1 master and 2 slaves
+#############################################################
+--source include/master-slave.inc
+--echo
+
+--echo *** Preparing ***
+--connection master
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+--connection slave
+--echo [on slave]
+--source include/stop_slave.inc
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT $binlog_file MASTER_BINLOG
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='$binlog_file';
+--source include/start_slave.inc
+--disconnect slave1
+--connect(slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,)
+--connection slave1
+--echo [on slave1]
+--disable_warnings
+STOP SLAVE;
+--enable_warnings
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT $binlog_file MASTER_BINLOG
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$binlog_file';
+--source include/start_slave.inc
+--echo
+
+#
+# Testing heartbeat
+#
+
+# Check that heartbeat events sent to both slaves with correct periods
+--echo *** 2 slaves ***
+--connection slave
+let $status_var= slave_received_heartbeats;
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Slave has received heartbeat event
+--connection slave1
+let $status_var= slave_received_heartbeats;
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+let $slave1_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--echo Slave1 has received heartbeat event
+--connection slave
+let $slave_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($slave_rcvd_heartbeats DIV $slave1_rcvd_heartbeats) > 1 AS Result, Result, 1);
+--echo Slave has received more heartbeats than Slave1 (1 means 'yes'): $result
+--echo
+
+
+# Create topology A->B->C and check that C receives heartbeat while B gets data
+# Slave1 (B) started w/o --log-slave-updates because B should not send data from A to C
+--echo *** Master->data->Slave1->heartbeat->Slave: ***
+--connection slave1
+--echo [on slave1]
+RESET MASTER;
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+--connection slave
+--echo [on slave]
+--source include/stop_slave.inc
+RESET SLAVE;
+--replace_result $SLAVE_MYPORT1 SLAVE1_PORT $binlog_file SLAVE1_BINLOG
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT1, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.2, MASTER_LOG_FILE='$binlog_file';
+--source include/start_slave.inc
+# Check heartbeat for new replication channel slave1->slave
+let $status_var= slave_received_heartbeats;
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Slave has received heartbeat event
+--connection master
+--echo [on master]
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT);
+INSERT INTO t1 VALUES (1, 'on master', '');
+--save_master_pos
+SHOW TABLES;
+--connection slave1
+--sync_with_master 0
+--echo [on slave1]
+SHOW TABLES;
+let $slave_pos_before= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+--save_master_pos
+--connection slave
+--sync_with_master 0
+--echo [on slave]
+SHOW TABLES;
+--connection master
+--echo [on master]
+--echo creating updates on master and send to slave1 during 5 second
+# Generate events on master and send to slave1 during 5 second
+let $i= 1;
+let $j= 1;
+let $k= 1;
+--disable_query_log
+while ($i) {
+ eval SET @c_text=REPEAT('1234567890', $j);
+ eval UPDATE t1 SET a=$j, c=@c_text;
+ --connection slave1
+ let $slave_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+ if (`SELECT ($k*($slave_pos - $slave_pos_before)) > 0`) {
+ --connection slave
+ let $slave_rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+ let $k= 0;
+ let $time_before = `SELECT NOW()`;
+ }
+ if (`SELECT ((1-$k)*TIMESTAMPDIFF(SECOND,'$time_before',NOW())) > 5`) {
+ --connection slave
+ let $slave_rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+ let $i= 0;
+ }
+ --connection master
+ inc $j;
+ sleep 0.1;
+}
+--enable_query_log
+--connection slave
+--echo [on slave]
+let $result= query_get_value(SELECT ($slave_rcvd_heartbeats_after - $slave_rcvd_heartbeats_before) > 0 AS Result, Result, 1);
+--echo Slave has received heartbeats (1 means 'yes'): $result
+--echo
+
+#
+# Clean up
+#
+--echo *** Clean up ***
+--connection master
+DROP TABLE t1;
+--save_master_pos
+--connection slave1
+--sync_with_master 0
+--echo
+
+# End of 6.0 test
+--echo End of 6.0 test
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf
new file mode 100644
index 00000000000..a4a291bca79
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf
@@ -0,0 +1,7 @@
+!include ../my.cnf
+
+[mysqld.1]
+log-slave-updates
+
+[mysqld.2]
+log-slave-updates
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
new file mode 100644
index 00000000000..10d327eece0
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
@@ -0,0 +1,541 @@
+#############################################################
+# Author: Serge Kozlov <Serge.Kozlov@Sun.COM>
+# Date: 02/19/2009
+# Purpose: Testing basic functionality of heartbeat.
+# Description:
+# * Testing different values for slave_heartbeat_period.
+# * How to affect various statements to slave_heartbeat_period
+# * Various states of slave and heartbeat
+# * Various states of master and heartbeat
+# * Circular replication
+#############################################################
+--source include/master-slave.inc
+--echo
+
+--echo *** Preparing ***
+--connection slave
+--source include/stop_slave.inc
+RESET SLAVE;
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1);
+--disable_query_log
+eval SET @restore_slave_heartbeat_timeout=$slave_heartbeat_timeout;
+--enable_query_log
+
+--connection master
+RESET MASTER;
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+SET @restore_event_scheduler=@@global.event_scheduler;
+--echo
+
+#
+# Test slave_heartbeat_period
+#
+
+--connection slave
+
+# Default value of slave_heartbeat_timeout = slave_net_timeout/2
+--echo *** Default value ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root';
+let $slave_net_timeout= query_get_value(SHOW VARIABLES LIKE 'slave_net_timeout', Value, 1);
+let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1);
+let $result= query_get_value(SELECT $slave_net_timeout/$slave_heartbeat_timeout AS Result, Result, 1);
+--echo slave_net_timeout/slave_heartbeat_timeout=$result
+RESET SLAVE;
+--echo
+
+# Reset slave set slave_heartbeat_timeout = slave_net_timeout/2
+--echo *** Reset slave affect ***
+--disable_warnings
+SET @@global.slave_net_timeout=30;
+--enable_warnings
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+RESET SLAVE;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+--echo
+
+# Check default value of slave_heartbeat_timeout if slave_net_timeout is changed
+--echo *** Default value if slave_net_timeout changed ***
+--disable_warnings
+SET @@global.slave_net_timeout=50;
+--enable_warnings
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root';
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+--echo
+
+# Set slave_net_timeout less than current value of slave_heartbeat_period
+--echo *** Warning if updated slave_net_timeout < slave_heartbeat_timeout ***
+let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1);
+--replace_result $slave_heartbeat_timeout SLAVE_HEARTBEAT_TIMEOUT
+eval SET @@global.slave_net_timeout=FLOOR($slave_heartbeat_timeout)-1;
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+--echo
+
+# Set value of slave_heartbeat_period greater than slave_net_timeout
+--echo *** Warning if updated slave_heartbeat_timeout > slave_net_timeout ***
+let $slave_net_timeout= query_get_value(SHOW VARIABLES LIKE 'slave_net_timeout', Value, 1);
+inc $slave_net_timeout;
+--replace_result $MASTER_MYPORT MASTER_PORT $slave_net_timeout SLAVE_NET_TIMEOUT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=$slave_net_timeout;
+RESET SLAVE;
+--echo
+
+# Changing of slave_net_timeout shouldn't affect to current value of slave_heartbeat_period
+--echo *** CHANGE MASTER statement only updates slave_heartbeat_period ***
+--disable_warnings
+SET @@global.slave_net_timeout=20;
+--enable_warnings
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+SHOW VARIABLES LIKE 'slave_net_timeout';
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SET @@global.slave_net_timeout=2*@@global.slave_net_timeout;
+SHOW VARIABLES LIKE 'slave_net_timeout';
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+--echo
+
+# Master value of slave_net_timeout shouldn't affect to slave's slave_heartbeat_period
+--echo *** Update slave_net_timeout on master ***
+--connection master
+--disable_warnings
+SET @@global.slave_net_timeout=500;
+--enable_warnings
+--connection slave
+SET @@global.slave_net_timeout=200;
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root';
+--source include/start_slave.inc
+--sync_with_master
+SHOW VARIABLES LIKE 'slave_net_timeout';
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+--source include/stop_slave.inc
+RESET SLAVE;
+--connection master
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+--echo
+
+# Start/stop slave shouldn't change slave_heartbeat_period
+--echo *** Start/stop slave ***
+--connection slave
+--disable_warnings
+SET @@global.slave_net_timeout=100;
+--enable_warnings
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=20;
+--source include/start_slave.inc
+--sync_with_master
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+--source include/stop_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+--echo
+
+# Reload slave shouldn't change slave_heartbeat_period
+--echo *** Reload slave ***
+--connection slave
+--disable_warnings
+SET @@global.slave_net_timeout=50;
+--enable_warnings
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=30;
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+wait
+EOF
+--echo Reload slave
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+--echo
+
+# Disable heartbeat
+--echo *** Disable heartbeat ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SHOW STATUS LIKE 'slave_received_heartbeats';
+--source include/start_slave.inc
+--sync_with_master
+--sleep 2
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SHOW STATUS LIKE 'slave_received_heartbeats';
+--source include/stop_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SHOW STATUS LIKE 'slave_received_heartbeats';
+RESET SLAVE;
+let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1);
+--replace_result $slave_heartbeat_timeout SLAVE_HEARTBEAT_TIMEOUT
+--eval SELECT $slave_heartbeat_timeout = 0 AS Result
+--echo
+
+#
+# Check limits for slave_heartbeat_timeout
+#
+
+--echo *** Min slave_heartbeat_timeout ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.001;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.0009;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+RESET SLAVE;
+--echo
+
+--echo *** Max slave_heartbeat_timeout ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294968;
+RESET SLAVE;
+# Check double size of max allowed value for master_heartbeat_period
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=8589935;
+RESET SLAVE;
+# Check 2^32
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967296;
+RESET SLAVE;
+--echo
+
+--echo *** Misc incorrect values ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_PARSE_ERROR
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='-1';
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_PARSE_ERROR
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='123abc';
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_PARSE_ERROR
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='';
+RESET SLAVE;
+--echo
+
+#
+# Testing heartbeat
+#
+
+# Check received heartbeat events for running slave
+--echo *** Running slave ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+--source include/start_slave.inc
+--sync_with_master
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var= slave_received_heartbeats;
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--echo
+
+# Check received heartbeat events for stopped slave
+--echo *** Stopped slave ***
+--source include/stop_slave.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+sleep 2;
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) AS Result, Result, 1);
+--echo Number of received heartbeat events while slave stopped: $result
+--echo
+
+# Check received heartbeat events for started slave
+--echo *** Started slave ***
+--source include/start_slave.inc
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--echo
+
+# Check received heartbeat events for stopped IO thread
+--echo *** Stopped IO thread ***
+STOP SLAVE IO_THREAD;
+--source include/wait_for_slave_io_to_stop.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+sleep 2;
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) AS Result, Result, 1);
+--echo Number of received heartbeat events while io thread stopped: $result
+--echo
+
+# Check received heartbeat events for started IO thread
+--echo *** Started IO thread ***
+START SLAVE IO_THREAD;
+--source include/wait_for_slave_io_to_start.inc
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--echo
+
+# Check received heartbeat events for stopped SQL thread
+--echo *** Stopped SQL thread ***
+STOP SLAVE SQL_THREAD;
+--source include/wait_for_slave_sql_to_stop.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+sleep 2;
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
+--echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result
+--echo
+
+# Check received heartbeat events for started SQL thread
+--echo *** Started SQL thread ***
+START SLAVE SQL_THREAD;
+--source include/wait_for_slave_sql_to_start.inc
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--echo
+
+# Check received heartbeat event for stopped SQL thread by error
+--echo *** Stopped SQL thread by error ***
+--connection master
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT);
+--sync_slave_with_master
+INSERT INTO t1 VALUES (1, 'on slave', NULL);
+--connection master
+INSERT INTO t1 VALUES (1, 'on master', NULL);
+--connection slave
+let $slave_errno= ER_DUP_ENTRY
+--source include/wait_for_slave_sql_error.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+sleep 2;
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
+--echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result
+--source include/stop_slave.inc
+DROP TABLE t1;
+--echo
+
+# Check received heartbeat events while master send events to slave
+--echo *** Master send to slave ***
+--connection master
+# Create the event that will update table t1 every second
+DELIMITER |;
+CREATE EVENT e1
+ ON SCHEDULE EVERY 1 SECOND
+ DO
+ BEGIN
+ UPDATE test.t1 SET a = a + 1 WHERE a < 10;
+ END|
+DELIMITER ;|
+--connection slave
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+--source include/start_slave.inc
+--connection master
+# Enable scheduler
+SET @@global.event_scheduler=1;
+--connection slave
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--sync_with_master
+# Wait some updates for table t1 from master
+let $wait_condition= SELECT COUNT(*)=1 FROM t1 WHERE a > 5;
+--source include/wait_condition.inc
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
+--echo Number of received heartbeat events: $result
+--connection master
+DELETE FROM t1;
+DROP EVENT e1;
+--echo
+
+
+
+
+# Check received heartbeat events while logs flushed on slave
+--connection slave
+--echo *** Flush logs on slave ***
+STOP SLAVE;
+RESET SLAVE;
+DROP TABLE t1;
+--connection master
+DROP TABLE t1;
+RESET MASTER;
+--connection slave
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.5;
+let $slave_param_comparison= =;
+--source include/start_slave.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+# Flush logs every 0.1 second during 5 sec
+--disable_query_log
+let $i=50;
+while ($i) {
+ FLUSH LOGS;
+ dec $i;
+ sleep 0.1;
+}
+--enable_query_log
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
+--echo Heartbeat events are received while rotation of relay logs (1 means 'yes'): $result
+--echo
+
+# Use compressed protocol between master and slave
+--echo *** Compressed protocol ***
+--connection master
+SET @@global.slave_compressed_protocol=1;
+--connection slave
+--source include/stop_slave.inc
+RESET SLAVE;
+SET @@global.slave_compressed_protocol=1;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+--source include/start_slave.inc
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var= slave_received_heartbeats;
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+SET @@global.slave_compressed_protocol=0;
+--connection master
+SET @@global.slave_compressed_protocol=0;
+--echo
+
+
+# Check received heartbeat events after reset of master
+--echo *** Reset master ***
+--connection slave
+STOP SLAVE;
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+--source include/start_slave.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--connection master
+RESET MASTER;
+--enable_query_log
+--sync_slave_with_master
+--sleep 2
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
+--echo Heartbeat events are received after reset of master (1 means 'yes'): $result
+--echo
+
+# Reloaded master should restore heartbeat
+--echo *** Reload master ***
+--connection slave
+STOP SLAVE;
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+--source include/start_slave.inc
+# Wait until slave_received_heartbeats will be incremented
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var= slave_received_heartbeats;
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--connection master
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait
+EOF
+--echo Reload master
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--connection slave
+# Wait until slave_received_heartbeats will be incremented
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var= slave_received_heartbeats;
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--echo
+
+# Circular replication
+--echo *** Circular replication ***
+# Configure circular replication
+--connection master
+RESET MASTER;
+let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1);
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10));
+--sync_slave_with_master
+--source include/stop_slave.inc
+RESET MASTER;
+let $slave_binlog= query_get_value(SHOW MASTER STATUS, File, 1);
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT $master_binlog MASTER_BINLOG
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='$master_binlog';
+--connection master
+RESET SLAVE;
+--replace_result $SLAVE_MYPORT SLAVE_PORT $slave_binlog SLAVE_BINLOG
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$slave_binlog';
+--source include/start_slave.inc
+# Insert data on master and on slave and make sure that it replicated for both directions
+INSERT INTO t1 VALUES(1, 'on master');
+--save_master_pos
+--connection slave
+--source include/start_slave.inc
+--sync_with_master
+INSERT INTO t1 VALUES(2, 'on slave');
+--save_master_pos
+--connection master
+--sync_with_master
+SELECT * FROM t1 ORDER BY a;
+let $master_rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--connection slave
+SELECT * FROM t1 ORDER BY a;
+# Wait heartbeat event on master
+--connection master
+let $status_var= slave_received_heartbeats;
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received on master
+let $master_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+# Wait heartbeat event on slave
+--connection slave
+let $status_var= slave_received_heartbeats;
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received on slave
+let $slave_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+# Heartbeat period on slave less than on master therefore number of received events on slave
+# should be greater than on master
+let $result= query_get_value(SELECT ($slave_rcvd_heartbeats DIV $master_rcvd_heartbeats) > 1 AS Result, Result, 1);
+--echo Slave has received more events than master (1 means 'yes'): $result
+--echo
+
+#
+# Clean up and restore system variables
+#
+--echo *** Clean up ***
+--connection master
+--source include/stop_slave.inc
+DROP TABLE t1;
+--sync_slave_with_master
+--source include/stop_slave.inc
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+--echo
+
+# End of 6.0 test
+--echo End of 6.0 test
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test b/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test
new file mode 100644
index 00000000000..6460b157b52
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test
@@ -0,0 +1,54 @@
+#############################################################
+# Author: Serge Kozlov <Serge.Kozlov@Sun.COM>
+# Date: 02/19/2009
+# Purpose: Testing basic functionality of heartbeat over SSL
+#############################################################
+--source include/have_ssl_communication.inc
+--source include/master-slave.inc
+--echo
+
+#
+# Testing heartbeat over SSL
+#
+
+# Heartbeat over SSL
+--echo *** Heartbeat over SSL ***
+--connection master
+let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1);
+--connection slave
+--source include/stop_slave.inc
+RESET SLAVE;
+# Connect to master with SSL
+--replace_result $MASTER_MYPORT MASTER_PORT $MYSQL_TEST_DIR MYSQL_TEST_DIR $master_binlog MASTER_BINLOG
+eval CHANGE MASTER TO
+ MASTER_HOST='127.0.0.1',
+ MASTER_PORT=$MASTER_MYPORT,
+ MASTER_USER='root',
+ MASTER_HEARTBEAT_PERIOD=0.1,
+ MASTER_LOG_FILE='$master_binlog',
+ MASTER_SSL=1,
+ MASTER_SSL_CA='$MYSQL_TEST_DIR/std_data/cacert.pem',
+ MASTER_SSL_CERT='$MYSQL_TEST_DIR/std_data/client-cert.pem',
+ MASTER_SSL_KEY='$MYSQL_TEST_DIR/std_data/client-key.pem';
+--source include/start_slave.inc
+# Check SSL state of slave
+let $slave_ssl_status= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1);
+--echo Master_SSL_Allowed: $slave_ssl_status
+# Wait until hearbeat event will received
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var= slave_received_heartbeats;
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event has received
+--echo
+
+#
+# Clean up
+#
+--echo *** Clean up ***
+--connection master
+--sync_slave_with_master
+--echo
+
+# End of 6.0 test
+--echo End of 6.0 test
diff --git a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
index b300603f454..60bccaad0d3 100644
--- a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
+++ b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
@@ -34,12 +34,14 @@ SELECT * FROM t1;
# restart replication for the next testcase
stop slave;
+--source include/wait_for_slave_to_stop.inc
reset slave;
connection master;
reset master;
drop table t1;
connection slave;
start slave;
+--source include/wait_for_slave_to_start.inc
# testcase with INSERT SELECT
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_load_from_master.test b/mysql-test/suite/rpl/t/rpl_load_from_master.test
deleted file mode 100644
index 0f085457817..00000000000
--- a/mysql-test/suite/rpl/t/rpl_load_from_master.test
+++ /dev/null
@@ -1,181 +0,0 @@
-# This one assumes we are ignoring updates on tables in database mysqltest2,
-# but doing the ones in database mysqltest
-#################################################################
-# Change Author: JBM
-# Change Date: 2006-02-02
-# Change: Added ENGINE=MyISAM
-# Reason: LOAD from master is only supported by MyISAM
-#################################################################
-
-source include/master-slave.inc;
---disable_warnings
-drop database if exists mysqltest;
-drop database if exists mysqltest2;
-drop database if exists mysqltest3;
-connection slave;
-drop database if exists mysqltest;
-drop database if exists mysqltest2;
-drop database if exists mysqltest3;
-connection master;
-create database mysqltest2;
-create database mysqltest;
---enable_warnings
-
-save_master_pos;
-connection slave;
-sync_with_master;
-create database mysqltest2;
-create table mysqltest2.foo (n int)ENGINE=MyISAM;
-insert into mysqltest2.foo values(4);
-connection master;
-create table mysqltest2.foo (n int)ENGINE=MyISAM;
-insert into mysqltest2.foo values(5);
-create table mysqltest.bar (m int)ENGINE=MyISAM;
-insert into mysqltest.bar values(15);
-save_master_pos;
-connection slave;
-sync_with_master;
-select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
-connection master;
-drop database mysqltest;
-drop database if exists mysqltest2;
-save_master_pos;
-connection slave;
-sync_with_master;
---error 1008
-drop database mysqltest;
-drop database mysqltest2;
-
-# Now let's test load data from master
-
-# First create some databases and tables on the master
-
-connection master;
-set sql_log_bin = 0;
-create database mysqltest2;
-create database mysqltest;
-show databases like 'mysql%';
-create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
-create table mysqltest2.t2(n int, s text)ENGINE=MyISAM;
-insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
-insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
-
-create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
-create table mysqltest.t2(n int, s text)ENGINE=MyISAM;
-insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
-insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
- (13, 'thirteen test');
-set sql_log_bin = 1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# This should show that the slave is empty at this point
-show databases like 'mysql%';
-# Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM
-# MASTER will neither touch database mysqltest nor mysqltest3
-create database mysqltest2;
-create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
-insert into mysqltest2.t1 values (1, 'original foo.t1');
-create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM;
-insert into mysqltest2.t3 values (1, 'original foo.t3');
-create database mysqltest3;
-create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM;
-insert into mysqltest3.t1 values (1, 'original foo2.t1');
-
-# Create mysqltest, and mysqltest.t1, to check that it gets replaced,
-# and mysqltest.t3 to check that it is not touched (there is no
-# mysqltest.t3 on master)
-create database mysqltest;
-create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
-insert into mysqltest.t1 values (1, 'original bar.t1');
-create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM;
-insert into mysqltest.t3 values (1, 'original bar.t3');
-
-load data from master;
-
-# Now let's check if we have the right tables and the right data in them
-show databases like 'mysql%';
-use mysqltest2;
-
-# LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which
-# databases have to be copied. So it thinks "mysqltest" has to be
-# copied. Before 4.0.16 it would first drop "mysqltest", then create
-# "mysqltest". This "drop" is a bug; in that case t3 would disappear. So
-# here the effect of this bug (BUG#1248) would be to leave an empty
-# "mysqltest" on the slave.
-
-show tables; # should be t1 & t3
-select * from t1; # should be slave's original
-use mysqltest3;
-show tables; # should be t1
-select * from t1; # should be slave's original
-use mysqltest;
-show tables; # should contain master's copied t1&t2, slave's original t3
-select * from mysqltest.t1;
-select * from mysqltest.t2;
-select * from mysqltest.t3;
-
-# Now let's see if replication works
-connection master;
-insert into mysqltest.t1 values (4, 'four test');
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from mysqltest.t1;
-
-# Check that LOAD DATA FROM MASTER is able to create master.info
-# if needed (if RESET SLAVE was used before), before writing to it (BUG#2922).
-
-stop slave;
-reset slave;
-load data from master;
-start slave;
-# see if replication coordinates were restored fine
-connection master;
-insert into mysqltest.t1 values (5, 'five bar');
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from mysqltest.t1;
-
-# Check that LOAD DATA FROM MASTER reports the error if it can't drop a
-# table to be overwritten.
-# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
-# insert into mysqltest.t1 values(10, 'should be there');
-# flush tables;
-let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
-# system chmod 500 $MYSQLD_SLAVE_DATADIR/mysqltest/;
-# --error 6
-# load data from master; # should fail (errno 13)
-# system chmod 700 $MYSQLD_SLAVE_DATADIR/mysqltest/;
-# select * from mysqltest.t1; # should contain the row (10, ...)
-
-
-# Check that LOAD TABLE FROM MASTER fails if the table exists on slave
---error 1050
-load table mysqltest.t1 from master;
-drop table mysqltest.t1;
-load table mysqltest.t1 from master;
-
-# Check what happens when requestion not existing table
-#
---error 1188
-load table bar.t1 from master;
-
-# as LOAD DATA FROM MASTER failed it did not restart slave threads
-# DISABLED FOR NOW
-# start slave;
-
-# Now time for cleanup
-connection master;
-drop database mysqltest;
-drop database mysqltest2;
-save_master_pos;
-connection slave;
-sync_with_master;
-# These have to be dropped on slave because they are not replicated
-drop database mysqltest2;
-drop database mysqltest3;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
deleted file mode 100644
index aad113878d3..00000000000
--- a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
+++ /dev/null
@@ -1,98 +0,0 @@
-###########################################################
-# Change Author: JBM
-# Change Date: 2006-2-2
-# Change: Added ENGINE=$engine_type for first create table
-# Reason: Only MyISAM supports load from master no need to
-# run test case for other engines, in addition test will
-# fail if other engines are set as default engine
-###########################################################
-# Change Author: JBM
-# Change Date: 2006-2-3
-# Change: removed ENGINE=$engine_type for first create table
-# and renamed test file to rpl_load_table_from_master.test.
-# In addition added test requirements.
-# Reason: Request from review.
-############################################################
-# REQUIREMENT TEST 1:
-# LOAD TABLE FROM MASTER must work with a forced timestamp.
-############################################################
-#
-# Test forced timestamp
-#
--- source include/master-slave.inc
-
--- echo "******************** Test Requirment 1 *************"
-
-# Don't log table creating to the slave as we want to test LOAD TABLE
-SET SQL_LOG_BIN=0,timestamp=200006;
-eval CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM;
-INSERT INTO t1 ( a) VALUE ('F');
-select unix_timestamp(t) from t1;
-connection slave;
-load table t1 from master;
-select unix_timestamp(t) from t1;
-
-# Delete the created table on master and slave
-connection master;
-set SQL_LOG_BIN=1,timestamp=default;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-connection master;
-
-#
-# Test copying table with checksum
-#
-
-# Don't log table creating to the slave as we want to test LOAD TABLE
-set SQL_LOG_BIN=0;
-
-#######################################################
-# REQUIREMENTi TEST 2:
-#LOAD TABLE FROM MASTER must work with table checksum
-#######################################################
--- echo "******************** Test Requirment 2 *************"
-
-eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
-INSERT INTO t1 VALUES (1);
-save_master_pos;
-connection slave;
-sync_with_master;
-load table t1 from master;
-check table t1;
-drop table t1;
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-connection master;
-set SQL_LOG_BIN=0;
-create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
-load data infile '../../std_data/words.dat' into table t1;
-create table t2 (word char(20) not null)ENGINE=MyISAM;
-load data infile '../../std_data/words.dat' into table t2;
-create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
-connection slave;
-load table t1 from master;
-load table t2 from master;
-load table t3 from master;
-check table t1;
-select count(*) from t2;
-select count(*) from t3;
-connection master;
-set SQL_LOG_BIN=1;
-drop table if exists t1,t2,t3;
-save_master_pos;
-connection slave;
-sync_with_master;
-create table t1(n int);
-drop table t1;
-
-
-
-
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
index 031a0f6c351..3e1bc917a41 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
@@ -23,9 +23,7 @@ load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8
select hex(a) from t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select hex(a) from t1;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
index b7d9995c834..979f09f64e6 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
@@ -16,7 +16,7 @@ connection master;
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
connection slave;
-wait_for_slave_to_stop;
+--source include/wait_for_slave_sql_to_stop.inc
source include/show_slave_status.inc;
connection slave;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_m.test b/mysql-test/suite/rpl/t/rpl_loaddata_m.test
index 42c3ad99f33..48451c4aee1 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_m.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_m.test
@@ -28,9 +28,7 @@ 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;
+sync_slave_with_master;
SHOW DATABASES;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_s.test b/mysql-test/suite/rpl/t/rpl_loaddata_s.test
index 2dd2218eb5c..91ebcf058a6 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_s.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_s.test
@@ -16,9 +16,7 @@ load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
# Test logging on slave;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select count(*) from test.t1; # check that LOAD was replicated
source include/show_binlog_events.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
index a93a82d6d9f..ed556f3aedf 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
@@ -27,15 +27,11 @@ truncate table t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
--remove_file $MYSQLD_DATADIR/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
diff --git a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
index 2f7b18ae04b..ea107a28954 100644
--- a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
+++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
@@ -1,9 +1,7 @@
# See if master_pos_wait(,,timeout)
# Terminates with "timeout expired" (-1)
source include/master-slave.inc;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_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);
diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh b/mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh
index 8ce79797822..8ce79797822 100755..100644
--- a/mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh
+++ b/mysql-test/suite/rpl/t/rpl_misc_functions-slave.sh
diff --git a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test
index 6a1f81abed3..85335d47c3a 100644
--- a/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test
+++ b/mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test
@@ -18,6 +18,7 @@ show slave hosts;
drop table t1;
sync_slave_with_master;
stop slave;
+--source include/wait_for_slave_to_stop.inc
connection master;
# Test replication of timestamp
@@ -35,6 +36,7 @@ create table t5 select * from t4;
save_master_pos;
connection slave;
start slave;
+--source include/wait_for_slave_to_start.inc
sync_with_master;
select * from t2;
show create table t3;
diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete.test b/mysql-test/suite/rpl/t/rpl_multi_delete.test
index a251cbf8833..568a8a578a9 100644
--- a/mysql-test/suite/rpl/t/rpl_multi_delete.test
+++ b/mysql-test/suite/rpl/t/rpl_multi_delete.test
@@ -19,8 +19,6 @@ select * from t2;
connection master;
drop table t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_multi_delete2.test b/mysql-test/suite/rpl/t/rpl_multi_delete2.test
index 81379d4056b..4062b08ceba 100644
--- a/mysql-test/suite/rpl/t/rpl_multi_delete2.test
+++ b/mysql-test/suite/rpl/t/rpl_multi_delete2.test
@@ -27,11 +27,9 @@ SELECT * FROM a;
insert into a values(2),(3);
delete a alias FROM a alias where alias.i=2;
select * from a;
-save_master_pos;
-connection slave;
+sync_slave_with_master;
use mysqltest_to;
-sync_with_master;
select * from a;
# BUG#3461
diff --git a/mysql-test/suite/rpl/t/rpl_optimize.test b/mysql-test/suite/rpl/t/rpl_optimize.test
index f4582ba1167..3c677a95463 100644
--- a/mysql-test/suite/rpl/t/rpl_optimize.test
+++ b/mysql-test/suite/rpl/t/rpl_optimize.test
@@ -47,8 +47,7 @@ sync_with_master; # won't work if slave SQL thread stopped
connection master; # cleanup
drop table t1;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# If the machine is so fast that slave syncs before OPTIMIZE
# starts, this test wil demonstrate nothing but will pass.
diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test
index bfc144c759b..61a1ad9d987 100644
--- a/mysql-test/suite/rpl/t/rpl_packet.test
+++ b/mysql-test/suite/rpl/t/rpl_packet.test
@@ -38,20 +38,15 @@ select @@net_buffer_length, @@max_allowed_packet;
create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023');
-save_master_pos;
+sync_slave_with_master;
-connection slave;
-sync_with_master;
eval select count(*) from `$db`.`t1` /* must be 1 */;
SHOW STATUS LIKE 'Slave_running';
select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING';
connection master;
eval drop database $db;
-save_master_pos;
-
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#
# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits
diff --git a/mysql-test/suite/rpl/t/rpl_ps.test b/mysql-test/suite/rpl/t/rpl_ps.test
index b00dec6b80c..143f75e5477 100644
--- a/mysql-test/suite/rpl/t/rpl_ps.test
+++ b/mysql-test/suite/rpl/t/rpl_ps.test
@@ -6,9 +6,7 @@
###########################################################
source include/master-slave.inc;
-#save_master_pos;
-#connection slave;
-#sync_with_master;
+#sync_slave_with_master;
#reset master;
#connection master;
@@ -30,20 +28,16 @@ prepare stmt2 from @var2;
set @var1='from-master-3';
execute stmt2 using @var1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM t1 ORDER BY n;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
stop slave;
-
+source include/wait_for_slave_to_stop.inc;
# End of 4.1 tests
#
@@ -102,13 +96,12 @@ use mysqltest1;
EXECUTE stmt_d_1;
--echo
---save_master_pos
+--sync_slave_with_master
+
--echo
--echo # Connection: slave
--echo
---connection slave
---sync_with_master
--echo
SELECT * FROM t1;
@@ -125,13 +118,12 @@ DROP DATABASE mysqltest1;
use test;
DROP TABLE t1;
--echo
---save_master_pos
+--sync_slave_with_master
+
--echo
--echo # Connection: slave
--echo
---connection slave
---sync_with_master
--echo
STOP SLAVE;
diff --git a/mysql-test/suite/rpl/t/rpl_relayspace.test b/mysql-test/suite/rpl/t/rpl_relayspace.test
index 0fc564cdb46..45b46674c05 100644
--- a/mysql-test/suite/rpl/t/rpl_relayspace.test
+++ b/mysql-test/suite/rpl/t/rpl_relayspace.test
@@ -4,6 +4,7 @@
source include/master-slave.inc;
connection slave;
stop slave;
+--source include/wait_for_slave_to_stop.inc
connection master;
# This will generate a master's binlog > 10 bytes
create table t1 (a int);
diff --git a/mysql-test/suite/rpl/t/rpl_replicate_do.test b/mysql-test/suite/rpl/t/rpl_replicate_do.test
index fea168ee9f1..3e22984aef8 100644
--- a/mysql-test/suite/rpl/t/rpl_replicate_do.test
+++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test
@@ -18,18 +18,14 @@ insert into t1 values(15),(16),(17);
update t1 set m=20 where m=16;
delete from t1 where m=17;
create table t11 select * from t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1 ORDER BY m;
select * from t2;
--error 1146
select * from t11;
connection master;
drop table if exists t1,t2,t11;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# show slave status, just to see of it prints replicate-do-table
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh
index 81490a54b4b..81490a54b4b 100755..100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
index e06099fd707..2490471018b 100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
@@ -56,6 +56,7 @@ connection master;
reset master;
connection slave;
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
#
@@ -100,6 +101,7 @@ connection slave;
#restart slave skipping one event
set global sql_slave_skip_counter=1;
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
@@ -161,9 +163,7 @@ select count(*) from t3 where n >= 4;
create table t4 select * from temp_table;
source include/show_binary_logs.inc;
source include/show_master_status.inc;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t4;
source include/show_slave_status2.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
index 3786a697e3f..41cf1cc622a 100644
--- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
@@ -2,6 +2,8 @@
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
+connection slave;
+let $bit_field_special = ALL_LOSSY;
let $type= 'INNODB' ;
let $extra_index= ;
-- source extra/rpl_tests/rpl_row_basic.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test
index 54dcbd24419..de5de130c58 100644
--- a/mysql-test/suite/rpl/t/rpl_row_create_table.test
+++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test
@@ -25,8 +25,10 @@ sync_slave_with_master;
--disable_query_log
set @storage_engine = @@global.storage_engine;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
SET GLOBAL storage_engine=memory;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
--enable_query_log
--source include/reset_master_and_slave.inc
@@ -38,7 +40,7 @@ CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---query_vertical SHOW BINLOG EVENTS FROM 106
+--query_vertical SHOW BINLOG EVENTS FROM 107
--echo **** On Master ****
--query_vertical SHOW CREATE TABLE t1
--query_vertical SHOW CREATE TABLE t2
@@ -76,7 +78,7 @@ CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
# Shouldn't be written to the binary log
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
# Test that INSERT-SELECT works the same way as for SBR.
CREATE TABLE t7 (a INT, b INT UNIQUE);
@@ -86,7 +88,7 @@ SELECT * FROM t7 ORDER BY a,b;
# Should be written to the binary log
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
@@ -100,7 +102,7 @@ INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
SELECT * FROM t7 ORDER BY a,b;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
@@ -118,7 +120,7 @@ CREATE TEMPORARY TABLE tt7 SELECT 1;
--query_vertical SHOW CREATE TABLE t9
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
sync_slave_with_master;
--echo **** On Slave ****
--query_vertical SHOW CREATE TABLE t8
@@ -129,8 +131,10 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
sync_slave_with_master;
# Here we reset the value of the default storage engine
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
SET GLOBAL storage_engine=@storage_engine;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
--enable_ps_protocol
# BUG#22864 (Rollback following CREATE ... SELECT discards 'CREATE
@@ -138,11 +142,13 @@ START SLAVE;
--echo ================ BUG#22864 ================
connection slave;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
RESET SLAVE;
connection master;
RESET MASTER;
connection slave;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
connection master;
SET AUTOCOMMIT=0;
CREATE TABLE t1 (a INT);
@@ -170,7 +176,7 @@ SELECT * FROM t3 ORDER BY a;
SELECT * FROM t4 ORDER BY a;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
sync_slave_with_master;
SHOW TABLES;
SELECT TABLE_NAME,ENGINE
@@ -190,6 +196,7 @@ sync_slave_with_master;
# Some tests with temporary tables
connection slave;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
RESET SLAVE;
connection master;
@@ -197,6 +204,7 @@ RESET MASTER;
connection slave;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
connection master;
CREATE TABLE t1 (a INT);
@@ -216,7 +224,7 @@ COMMIT;
SELECT * FROM t2 ORDER BY a;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
@@ -239,7 +247,7 @@ ROLLBACK;
SELECT * FROM t2 ORDER BY a;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+SHOW BINLOG EVENTS FROM 107;
sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
diff --git a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
index 667e1d9a1a8..d2996bbe525 100644
--- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
+++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
@@ -1,7 +1,7 @@
# depends on the binlog output
-- source include/have_binlog_format_row.inc
-let $rename_event_pos= 897;
+let $rename_event_pos= 898;
# Bug#18326: Do not lock table for writing during prepare of statement
# The use of the ps protocol causes extra table maps in the binlog, so
diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
index 3328d582692..9a645baead0 100644
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
@@ -116,16 +116,14 @@ sync_slave_with_master;
#(the server was started with skip-slave-start)
--disable_warnings
stop slave;
+--source include/wait_for_slave_to_stop.inc
--enable_warnings
---require r/slave-stopped.result
-show status like 'Slave_running';
connection master;
reset master;
connection slave;
reset slave;
start slave;
---require r/slave-running.result
-show status like 'Slave_running';
+--source include/wait_for_slave_to_start.inc
connection master;
# We should be clean at this point, now we will run in the file from above.
@@ -170,7 +168,7 @@ select "--- Test 2 position test --" as "";
--enable_query_log
let $MYSQLD_DATADIR= `select @@datadir;`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLD_DATADIR/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=417 --stop-position=570 $MYSQLD_DATADIR/master-bin.000001
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -183,8 +181,6 @@ select "--- Test 3 First Remote test --" as "";
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=569 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
-# This part is disabled due to bug #17654
-
--disable_query_log
select "--- Test 4 Second Remote test --" as "";
--enable_query_log
@@ -206,16 +202,14 @@ sync_slave_with_master;
--disable_warnings
stop slave;
+--source include/wait_for_slave_to_stop.inc
--enable_warnings
---require r/slave-stopped.result
-show status like 'Slave_running';
connection master;
reset master;
connection slave;
reset slave;
start slave;
---require r/slave-running.result
-show status like 'Slave_running';
+--source include/wait_for_slave_to_start.inc
connection master;
# We should be clean at this point, now we will run in the file from above.
@@ -272,8 +266,8 @@ let $MYSQLD_DATADIR= `select @@datadir;`;
select "--- Test 7 reading stdin w/position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
-
+--exec $MYSQL_BINLOG --short-form --position=417 --stop-position=570 - < $MYSQLD_DATADIR/master-bin.000001
+
# Bug#16217 (mysql client did not know how not switch its internal charset)
--disable_query_log
select "--- Test 8 switch internal charset --" as "";
@@ -285,16 +279,14 @@ sync_slave_with_master;
--disable_warnings
stop slave;
+--source include/wait_for_slave_to_stop.inc
--enable_warnings
---require r/slave-stopped.result
-show status like 'Slave_running';
connection master;
reset master;
connection slave;
reset slave;
start slave;
---require r/slave-running.result
-show status like 'Slave_running';
+--source include/wait_for_slave_to_start.inc
connection master;
create table t4 (f text character set utf8);
diff --git a/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test b/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test
new file mode 100644
index 00000000000..6a426efc7ea
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test
@@ -0,0 +1,18 @@
+# BUG#28777 SHOW BINLOG EVENTS does not work on relay log files
+#
+# GOAL
+# ====
+#
+# Test that SHOW BINLOG EVENTS and the new SHOW RELAYLOG EVENTS works after
+# the patch, both on master and slave.
+#
+# HOW
+# ===
+#
+# This test issues SHOW [BINLOG|RELAYLOG] EVENTS both on master and slave after
+# some statements have been issued.
+
+-- source include/master-slave.inc
+-- source include/have_binlog_format_row.inc
+
+-- source extra/rpl_tests/rpl_show_relaylog_events.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp001.test b/mysql-test/suite/rpl/t/rpl_row_sp001.test
index 1595c4a21d5..34d42d985f9 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp001.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp001.test
@@ -90,9 +90,7 @@ 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;
+sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
connection master;
@@ -105,17 +103,13 @@ 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;
+sync_slave_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;
+sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
##Used for debugging
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp005.test b/mysql-test/suite/rpl/t/rpl_row_sp005.test
index f5a74325b7c..abc7fb4f490 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp005.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp005.test
@@ -74,9 +74,7 @@ SELECT * FROM test.t2 ORDER BY id2;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1 ORDER BY id;
SELECT * FROM test.t2 ORDER BY id2;
@@ -92,8 +90,7 @@ SELECT * FROM test.t3 ORDER BY id3;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t3 ORDER BY id3;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp008.test b/mysql-test/suite/rpl/t/rpl_row_sp008.test
index b1295820c99..80603c28d27 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp008.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp008.test
@@ -41,9 +41,7 @@ SELECT * FROM test.t2;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t2;
# Cleanup
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp009.test b/mysql-test/suite/rpl/t/rpl_row_sp009.test
index 92d47c6f50f..77860621961 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp009.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp009.test
@@ -71,9 +71,7 @@ delimiter ;|
CALL test.p1('a');
SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t2 ORDER BY a;
connection master;
truncate test.t2;
@@ -81,17 +79,13 @@ 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;
+sync_slave_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;
+sync_slave_with_master;
SELECT * FROM test.t2 ORDER BY a;
# Cleanup
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp010.test b/mysql-test/suite/rpl/t/rpl_row_sp010.test
index 28b82217517..7fa0077f117 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp010.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp010.test
@@ -39,9 +39,7 @@ delimiter ;|
CALL test.p2();
SELECT * FROM test.t1 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
show tables;
connection master;
@@ -61,9 +59,7 @@ delimiter ;|
CALL test.p4();
SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t2 ORDER BY a;
# Cleanup
diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt
deleted file mode 100644
index b7db8f97bdd..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-binlog-row-event-max-size=256
diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt
deleted file mode 100644
index ea49a27adf4..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-debug=d,STOP_SLAVE_after_first_Rows_event
diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
deleted file mode 100644
index 9b24c78e62d..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
+++ /dev/null
@@ -1,32 +0,0 @@
--- source include/have_binlog_format_row.inc
--- source include/have_debug.inc
--- source include/master-slave.inc
-
-# master is asked to create small Rows events: if only one event is
-# created, stopping slave at the end of that one will show no bug, we
-# need at least two (and stop after first); in this test we use three.
-
-connection master;
-create table t1 (words varchar(20)) engine=myisam;
-
-load data infile '../../std_data/words.dat' into table t1 (words);
-select count(*) from t1;
-save_master_pos;
-
-connection slave;
-
-# slave will automatically stop the sql thread thanks to the .opt
-# file; it will initiate the stop request after the first
-# Rows_log_event (out of 3) but should wait until the last one is
-# executed before stopping.
-
-source include/wait_for_slave_sql_to_stop.inc;
-
-# check that we inserted all rows (waited until the last Rows event)
-select count(*) from t1;
-
-connection master;
-drop table t1;
-connection slave; # slave SQL thread is stopped
-source include/stop_slave.inc;
-drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_row_trig002.test b/mysql-test/suite/rpl/t/rpl_row_trig002.test
index 7ca8a68f060..1ea245498d5 100644
--- a/mysql-test/suite/rpl/t/rpl_row_trig002.test
+++ b/mysql-test/suite/rpl/t/rpl_row_trig002.test
@@ -39,9 +39,7 @@ INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherw
SELECT * FROM test.t1 ORDER BY id;
#show binlog events;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1 ORDER BY id;
connection master;
@@ -51,9 +49,7 @@ INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
select * from test.t2;
select * from test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from test.t2;
select * from test.t3;
connection master;
@@ -63,9 +59,7 @@ 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;
+sync_slave_with_master;
SELECT * FROM test.t1 ORDER BY id;
# Cleanup
diff --git a/mysql-test/suite/rpl/t/rpl_row_trig003.test b/mysql-test/suite/rpl/t/rpl_row_trig003.test
index 5d667e29d69..781862161c1 100644
--- a/mysql-test/suite/rpl/t/rpl_row_trig003.test
+++ b/mysql-test/suite/rpl/t/rpl_row_trig003.test
@@ -120,9 +120,7 @@ DELETE FROM test.t1 WHERE id = 1;
DELETE FROM test.t2 WHERE id = 1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
connection master;
# time to dump the databases and so we can see if they match
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt b/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt
new file mode 100644
index 00000000000..58029d28ace
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt
@@ -0,0 +1 @@
+$SEMISYNC_PLUGIN_OPT
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt b/mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt
new file mode 100644
index 00000000000..58029d28ace
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt
@@ -0,0 +1 @@
+$SEMISYNC_PLUGIN_OPT
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test
new file mode 100644
index 00000000000..4900acc1e91
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test
@@ -0,0 +1,585 @@
+source include/have_semisync_plugin.inc;
+source include/not_embedded.inc;
+source include/have_innodb.inc;
+source include/master-slave.inc;
+
+let $engine_type= InnoDB;
+#let $engine_type= MyISAM;
+
+# Suppress warnings that might be generated during the test
+disable_query_log;
+connection master;
+call mtr.add_suppression("Timeout waiting for reply of binlog");
+call mtr.add_suppression("Read semi-sync reply");
+connection slave;
+call mtr.add_suppression("Master server does not support semi-sync");
+call mtr.add_suppression("Semi-sync slave .* reply");
+enable_query_log;
+connection master;
+
+# After fix of BUG#45848, semi-sync slave should not create any extra
+# connections on master, save the count of connections before start
+# semi-sync slave for comparison below.
+let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
+
+--echo #
+--echo # Uninstall semi-sync plugins on master and slave
+--echo #
+connection slave;
+disable_query_log;
+source include/stop_slave.inc;
+reset slave;
+disable_warnings;
+error 0,1305;
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+error 0,1305;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+enable_warnings;
+
+connection master;
+reset master;
+set sql_log_bin=0;
+disable_warnings;
+error 0,1305;
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+error 0,1305;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+enable_warnings;
+set sql_log_bin=1;
+enable_query_log;
+
+--echo #
+--echo # Main test of semi-sync replication start here
+--echo #
+
+connection master;
+echo [ on master ];
+
+disable_query_log;
+let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1);
+if (`select '$value' = 'No such row'`)
+{
+ set sql_log_bin=0;
+ eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN';
+ set global rpl_semi_sync_master_timeout= 5000; /* 5s */
+ set sql_log_bin=1;
+}
+enable_query_log;
+
+echo [ default state of semi-sync on master should be OFF ];
+show variables like 'rpl_semi_sync_master_enabled';
+
+echo [ enable semi-sync on master ];
+set global rpl_semi_sync_master_enabled = 1;
+show variables like 'rpl_semi_sync_master_enabled';
+
+echo [ status of semi-sync on master should be ON even without any semi-sync slaves ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+--echo #
+--echo # BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed
+--echo # BUG#45673 Semisynch reports correct operation even if no slave is connected
+--echo #
+
+# BUG#45672 When semi-sync is enabled on master, it would allocate
+# transaction node even without semi-sync slave connected, and would
+# finally result in transaction node allocation error.
+#
+# Semi-sync master will pre-allocate 'max_connections' transaction
+# nodes, so here we do more than that much transactions to check if it
+# will fail or not.
+# select @@global.max_connections + 1;
+let $i= `select @@global.max_connections + 1`;
+disable_query_log;
+eval create table t1 (a int) engine=$engine_type;
+while ($i)
+{
+ eval insert into t1 values ($i);
+ dec $i;
+}
+drop table t1;
+enable_query_log;
+
+# BUG#45673
+echo [ status of semi-sync on master should be OFF ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+disable_query_log;
+# reset master to make sure the following test will start with a clean environment
+reset master;
+enable_query_log;
+
+--echo #
+--echo # INSTALL PLUGIN semi-sync on slave
+--echo #
+
+connection slave;
+echo [ on slave ];
+
+disable_query_log;
+let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1);
+if (`select '$value' = 'No such row'`)
+{
+ set sql_log_bin=0;
+ eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN';
+ set sql_log_bin=1;
+}
+enable_query_log;
+
+echo [ default state of semi-sync on slave should be OFF ];
+show variables like 'rpl_semi_sync_slave_enabled';
+
+echo [ enable semi-sync on slave ];
+set global rpl_semi_sync_slave_enabled = 1;
+show variables like 'rpl_semi_sync_slave_enabled';
+source include/start_slave.inc;
+
+connection master;
+echo [ on master ];
+
+# NOTE: Rpl_semi_sync_master_client will only be updated when
+# semi-sync slave has started binlog dump request
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 1;
+source include/wait_for_status_var.inc;
+
+echo [ initial master state after the semi-sync slave connected ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+replace_result $engine_type ENGINE_TYPE;
+eval create table t1(a int) engine = $engine_type;
+
+echo [ master state after CREATE TABLE statement ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+# After fix of BUG#45848, semi-sync slave should not create any extra
+# connections on master.
+let $_connections_semisync_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
+replace_result $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE;
+replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE;
+eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0';
+
+let $i=300;
+echo [ insert records to table ];
+disable_query_log;
+while ($i)
+{
+ eval insert into t1 values ($i);
+ dec $i;
+}
+enable_query_log;
+
+echo [ master status after inserts ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+sync_slave_with_master;
+echo [ on slave ];
+
+echo [ slave status after replicated inserts ];
+show status like 'Rpl_semi_sync_slave_status';
+
+select count(distinct a) from t1;
+select min(a) from t1;
+select max(a) from t1;
+
+--echo #
+--echo # Test semi-sync master will switch OFF after one transacton
+--echo # timeout waiting for slave reply.
+--echo #
+connection slave;
+source include/stop_slave.inc;
+
+connection master;
+echo [ on master ];
+
+# The first semi-sync check should be on because after slave stop,
+# there are no transactions on the master.
+echo [ master status should be ON ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+show status like 'Rpl_semi_sync_master_clients';
+
+echo [ semi-sync replication of these transactions will fail ];
+insert into t1 values (500);
+
+# Wait for the semi-sync replication of this transaction to timeout
+let $status_var= Rpl_semi_sync_master_status;
+let $status_var_value= OFF;
+source include/wait_for_status_var.inc;
+
+# The second semi-sync check should be off because one transaction
+# times out during waiting.
+echo [ master status should be OFF ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+# Semi-sync status on master is now OFF, so all these transactions
+# will be replicated asynchronously.
+let $i=300;
+disable_query_log;
+while ($i)
+{
+ eval delete from t1 where a=$i;
+ dec $i;
+}
+enable_query_log;
+
+insert into t1 values (100);
+
+echo [ master status should be OFF ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+--echo #
+--echo # Test semi-sync status on master will be ON again when slave catches up
+--echo #
+
+# Save the master position for later use.
+save_master_pos;
+
+connection slave;
+echo [ on slave ];
+
+echo [ slave status should be OFF ];
+show status like 'Rpl_semi_sync_slave_status';
+source include/start_slave.inc;
+sync_with_master;
+
+echo [ slave status should be ON ];
+show status like 'Rpl_semi_sync_slave_status';
+
+select count(distinct a) from t1;
+select min(a) from t1;
+select max(a) from t1;
+
+connection master;
+echo [ on master ];
+
+# The master semi-sync status should be on again after slave catches up.
+echo [ master status should be ON again after slave catches up ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+show status like 'Rpl_semi_sync_master_clients';
+
+--echo #
+--echo # Test disable/enable master semi-sync on the fly.
+--echo #
+
+drop table t1;
+sync_slave_with_master;
+echo [ on slave ];
+
+source include/stop_slave.inc;
+
+--echo #
+--echo # Flush status
+--echo #
+connection master;
+echo [ Semi-sync master status variables before FLUSH STATUS ];
+SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
+SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
+# Do not write the FLUSH STATUS to binlog, to make sure we'll get a
+# clean status after this.
+FLUSH NO_WRITE_TO_BINLOG STATUS;
+echo [ Semi-sync master status variables after FLUSH STATUS ];
+SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
+SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
+
+connection master;
+echo [ on master ];
+
+source include/show_master_logs.inc;
+show variables like 'rpl_semi_sync_master_enabled';
+
+echo [ disable semi-sync on the fly ];
+set global rpl_semi_sync_master_enabled=0;
+show variables like 'rpl_semi_sync_master_enabled';
+show status like 'Rpl_semi_sync_master_status';
+
+echo [ enable semi-sync on the fly ];
+set global rpl_semi_sync_master_enabled=1;
+show variables like 'rpl_semi_sync_master_enabled';
+show status like 'Rpl_semi_sync_master_status';
+
+--echo #
+--echo # Test RESET MASTER/SLAVE
+--echo #
+
+connection slave;
+echo [ on slave ];
+
+source include/start_slave.inc;
+
+connection master;
+echo [ on master ];
+
+replace_result $engine_type ENGINE_TYPE;
+eval create table t1 (a int) engine = $engine_type;
+drop table t1;
+
+##show status like 'Rpl_semi_sync_master_status';
+
+sync_slave_with_master;
+--replace_column 2 #
+show status like 'Rpl_relay%';
+
+echo [ test reset master ];
+connection master;
+echo [ on master];
+
+reset master;
+
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+connection slave;
+echo [ on slave ];
+
+source include/stop_slave.inc;
+reset slave;
+
+# Kill the dump thread on master for previous slave connection and
+# wait for it to exit
+connection master;
+let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
+if ($_tid)
+{
+ disable_query_log;
+ eval kill query $_tid;
+ enable_query_log;
+
+ # After dump thread exit, Rpl_semi_sync_master_clients will be 0
+ let $status_var= Rpl_semi_sync_master_clients;
+ let $status_var_value= 0;
+ source include/wait_for_status_var.inc;
+}
+
+connection slave;
+source include/start_slave.inc;
+
+connection master;
+echo [ on master ];
+
+# Wait for dump thread to start, Rpl_semi_sync_master_clients will be
+# 1 after dump thread started.
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 1;
+source include/wait_for_status_var.inc;
+
+replace_result $engine_type ENGINE_TYPE;
+eval create table t1 (a int) engine = $engine_type;
+insert into t1 values (1);
+insert into t1 values (2), (3);
+
+sync_slave_with_master;
+echo [ on slave ];
+
+select * from t1;
+
+connection master;
+echo [ on master ];
+
+echo [ master semi-sync status should be ON ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+--echo #
+--echo # Start semi-sync replication without SUPER privilege
+--echo #
+connection slave;
+source include/stop_slave.inc;
+reset slave;
+connection master;
+echo [ on master ];
+reset master;
+
+# Kill the dump thread on master for previous slave connection and wait for it to exit
+let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
+if ($_tid)
+{
+ disable_query_log;
+ eval kill query $_tid;
+ enable_query_log;
+
+ # After dump thread exit, Rpl_semi_sync_master_clients will be 0
+ let $status_var= Rpl_semi_sync_master_clients;
+ let $status_var_value= 0;
+ source include/wait_for_status_var.inc;
+}
+
+# Do not binlog the following statement because it will generate
+# different events for ROW and STATEMENT format
+set sql_log_bin=0;
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+flush privileges;
+set sql_log_bin=1;
+connection slave;
+echo [ on slave ];
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+flush privileges;
+change master to master_user='rpl',master_password='rpl';
+source include/start_slave.inc;
+show status like 'Rpl_semi_sync_slave_status';
+connection master;
+echo [ on master ];
+
+# Wait for the semi-sync binlog dump thread to start
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 1;
+source include/wait_for_status_var.inc;
+echo [ master semi-sync should be ON ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+insert into t1 values (4);
+insert into t1 values (5);
+echo [ master semi-sync should be ON ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+--echo #
+--echo # Test semi-sync slave connect to non-semi-sync master
+--echo #
+
+# Disable semi-sync on master
+connection slave;
+echo [ on slave ];
+source include/stop_slave.inc;
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+
+connection master;
+echo [ on master ];
+
+# Kill the dump thread on master for previous slave connection and wait for it to exit
+let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
+if ($_tid)
+{
+ disable_query_log;
+ eval kill query $_tid;
+ enable_query_log;
+
+ # After dump thread exit, Rpl_semi_sync_master_clients will be 0
+ let $status_var= Rpl_semi_sync_master_clients;
+ let $status_var_value= 0;
+ source include/wait_for_status_var.inc;
+}
+
+echo [ Semi-sync status on master should be ON ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+set global rpl_semi_sync_master_enabled= 0;
+
+connection slave;
+echo [ on slave ];
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+source include/start_slave.inc;
+connection master;
+echo [ on master ];
+insert into t1 values (8);
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 1;
+source include/wait_for_status_var.inc;
+echo [ master semi-sync clients should be 1, status should be OFF ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+sync_slave_with_master;
+echo [ on slave ];
+show status like 'Rpl_semi_sync_slave_status';
+
+# Uninstall semi-sync plugin on master
+connection slave;
+source include/stop_slave.inc;
+connection master;
+echo [ on master ];
+set sql_log_bin=0;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+set sql_log_bin=1;
+enable_query_log;
+SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
+
+connection slave;
+echo [ on slave ];
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+source include/start_slave.inc;
+
+connection master;
+echo [ on master ];
+insert into t1 values (10);
+sync_slave_with_master;
+echo [ on slave ];
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+
+--echo #
+--echo # Test non-semi-sync slave connect to semi-sync master
+--echo #
+
+connection master;
+set sql_log_bin=0;
+replace_result $SEMISYNC_MASTER_PLUGIN SEMISYNC_MASTER_PLUGIN;
+eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN';
+set global rpl_semi_sync_master_timeout= 5000; /* 5s */
+set sql_log_bin=1;
+set global rpl_semi_sync_master_enabled= 1;
+
+connection slave;
+echo [ on slave ];
+source include/stop_slave.inc;
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+
+echo [ uninstall semi-sync slave plugin ];
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+source include/start_slave.inc;
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+source include/stop_slave.inc;
+
+echo [ reinstall semi-sync slave plugin and disable semi-sync ];
+replace_result $SEMISYNC_SLAVE_PLUGIN SEMISYNC_SLAVE_PLUGIN;
+eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN';
+set global rpl_semi_sync_slave_enabled= 0;
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+source include/start_slave.inc;
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+
+--echo #
+--echo # Clean up
+--echo #
+
+connection slave;
+source include/stop_slave.inc;
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+
+connection master;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+
+connection slave;
+source include/start_slave.inc;
+
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+connection master;
+drop user rpl@127.0.0.1;
+flush privileges;
diff --git a/mysql-test/suite/rpl/t/rpl_server_id2.test b/mysql-test/suite/rpl/t/rpl_server_id2.test
index 488a3aa6ab6..5c51a7fc08e 100644
--- a/mysql-test/suite/rpl/t/rpl_server_id2.test
+++ b/mysql-test/suite/rpl/t/rpl_server_id2.test
@@ -7,9 +7,11 @@ create table t1 (n int);
reset master;
# replicate ourselves
stop slave;
+--source include/wait_for_slave_to_stop.inc
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
start slave;
+--source include/wait_for_slave_to_start.inc
insert into t1 values (1);
save_master_pos;
sync_with_master;
@@ -18,6 +20,7 @@ select * from t1; # check that indeed 2 were inserted
# 'drop table t1' executed twice, so an error in the slave.err
# (not critical).
stop slave;
+--source include/wait_for_slave_to_stop.inc
drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt b/mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt
new file mode 100644
index 00000000000..302889525dd
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt
@@ -0,0 +1 @@
+--disable-log-slave-updates --replicate-same-server-id
diff --git a/mysql-test/suite/rpl/t/rpl_server_id_ignore.test b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test
new file mode 100644
index 00000000000..1b38bd34d3d
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test
@@ -0,0 +1,114 @@
+# This test checks that the slave rejects events originating
+# by a server from the list of ignored originators (bug#27808 etc)
+#
+# phases of tests:
+#
+# 0. master_id new line in show slave status
+# 1. syntax related:
+# a. error reporting if options clash;
+# b. overriding the old IGNORE_SERVER_IDS setup by the following
+# CHANGE MASTER ... IGNORE_SERVER_IDS= (list);
+# c. the old setup preserving by CHANGE MASTER w/o IGNORE_SERVER_IDS
+# d. resetting the ignored server ids with the empty list arg to
+# IGNORE_SERVER_IDS=()
+# e. RESET SLAVE preserves the list
+# 2. run time related:
+# a. observing no processing events from a master listed in IGNORE_SERVER_IDS
+# b. nullifying the list and resuming of taking binlog from the very beginning with
+# executing events this time
+
+source include/master-slave.inc;
+
+connection slave;
+
+# a new line for master_id
+let $master_id= query_get_value(SHOW SLAVE STATUS, Master_Server_Id, 1);
+echo master_id: $master_id;
+
+stop slave;
+--echo *** --replicate-same-server-id and change master option can clash ***
+--error ER_SLAVE_IGNORE_SERVER_IDS
+change master to IGNORE_SERVER_IDS= (2, 1);
+--echo *** must be empty due to the error ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+echo ignore server id list: $ignore_list;
+
+change master to IGNORE_SERVER_IDS= (10, 100);
+--echo *** must be 10, 100 ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+echo ignore server id list: $ignore_list;
+reset slave;
+--echo *** must be empty due to reset slave ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+echo ignore server id list: $ignore_list;
+change master to IGNORE_SERVER_IDS= (10, 100);
+--echo *** CHANGE MASTER with IGNORE_SERVER_IDS option overrides (does not increment) the previous setup ***
+change master to IGNORE_SERVER_IDS= (5, 1, 4, 3, 1);
+--echo *** must be 1, 3, 4, 5 due to overriding policy ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+echo ignore server id list: $ignore_list;
+--echo *** ignore master (server 1) queries for a while ***
+start slave;
+
+connection master;
+
+#connection slave;
+sync_slave_with_master;
+let $slave_relay_pos0= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);
+
+connection master;
+create table t1 (n int);
+let $master_binlog_end= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+connection slave;
+let $slave_param= Exec_Master_Log_Pos;
+let $slave_param_value= $master_binlog_end;
+source include/wait_for_slave_param.inc;
+--echo *** must be empty as the event is to be filtered out ***
+show tables;
+--echo *** allowing events from master ***
+let $slave_relay_pos1= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);
+#
+# checking stability of relay log pos
+#
+if (`select $slave_relay_pos1 - $slave_relay_pos0`)
+{
+ --echo Error: relay log position changed: $slave_relay_pos0, $slave_relay_pos1
+ query_vertical show slave status;
+}
+
+stop slave;
+source include/wait_for_slave_to_stop.inc;
+reset slave;
+change master to IGNORE_SERVER_IDS= (10, 100);
+--echo *** the list must remain (10, 100) after reset slave ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+
+change master to IGNORE_SERVER_IDS= ();
+--echo *** must be empty due to IGNORE_SERVER_IDS empty list ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+echo ignore server id list: $ignore_list;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval change master to master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root';
+start slave;
+
+connection master;
+
+#connection slave;
+sync_slave_with_master;
+--echo *** must have caught create table ***
+show tables;
+
+# cleanup
+connection master;
+drop table t1;
+#connection slave
+sync_slave_with_master;
+
+--echo end of the tests
+
+
+
+
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_session_var.test b/mysql-test/suite/rpl/t/rpl_session_var.test
index 50efc8930a1..ee9f7e0585a 100644
--- a/mysql-test/suite/rpl/t/rpl_session_var.test
+++ b/mysql-test/suite/rpl/t/rpl_session_var.test
@@ -9,9 +9,7 @@ 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;
+sync_slave_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
@@ -31,15 +29,11 @@ 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;
+sync_slave_with_master;
select * from t2 order by b;
connection master;
drop table t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#
# Bug #29878 Garbage data generation when executing SESSION_USER() on a slave.
@@ -54,12 +48,9 @@ CREATE TABLE t1 (
--disable_warnings
INSERT INTO t1(data) VALUES(SESSION_USER());
--enable_warnings
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT length(data) < 100 FROM t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
+
diff --git a/mysql-test/suite/rpl/t/rpl_set_charset.test b/mysql-test/suite/rpl/t/rpl_set_charset.test
index c70eb2681f5..241c1c5738b 100644
--- a/mysql-test/suite/rpl/t/rpl_set_charset.test
+++ b/mysql-test/suite/rpl/t/rpl_set_charset.test
@@ -20,16 +20,12 @@ INSERT INTO t1 VALUES ('àáâãäåæçèéêëìíîï','E0');
INSERT INTO t1 VALUES ('ðñòóôõö÷øùúûüýþÿ','F0');
select "--- on master ---";
select hex(a),b from t1 order by b;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
use mysqltest1;
select "--- on slave ---";
select hex(a),b from t1 order by b;
connection master;
drop database mysqltest1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_hosts.cnf b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.cnf
new file mode 100644
index 00000000000..288f0132fba
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.cnf
@@ -0,0 +1,20 @@
+!include ../my.cnf
+
+[mysqld.1]
+server_id=1
+
+[mysqld.2]
+server_id=2
+report-host=
+report-user=
+
+[mysqld.3]
+server_id=3
+report-host=slave2
+slave-net-timeout=5
+
+[ENV]
+SLAVE_MYPORT2= @mysqld.3.port
+SLAVE_MYSOCK2= @mysqld.3.socket
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test
new file mode 100644
index 00000000000..9f202487968
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test
@@ -0,0 +1,47 @@
+###############################################################################
+# Bug#13963 SHOW SLAVE HOSTS is unreliable
+#
+# Slaves only appear in the output of SHOW SLAVE HOSTS when report-host option
+# is set. If an expected slave does not appear in the list, nobody knows
+# whether the slave does not connect or has started without the "report-host"
+# option.
+#
+# Remove the "Rpl_recovery_rank" column from SHOW SLAVE HOSTS, It is not
+# implemented.
+#######################################################################
+source include/master-slave.inc;
+connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT2,);
+
+connection slave2;
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root'
+START SLAVE IO_THREAD;
+source include/wait_for_slave_io_to_start.inc;
+
+connection master;
+let $show_statement= SHOW SLAVE HOSTS;
+let $field= Server_id;
+# 3 is server_id of slave2.
+let $connection= ='3';
+source include/wait_show_condition.inc;
+--replace_result $SLAVE_MYPORT SLAVE_PORT $DEFAULT_MASTER_PORT DEFAULT_PORT
+SHOW SLAVE HOSTS;
+
+connection slave2;
+STOP SLAVE IO_THREAD;
+source include/wait_for_slave_io_to_stop.inc;
+
+connection master;
+let $show_statement= SHOW SLAVE HOSTS;
+let $field= Server_id;
+# 3 is server_id of slave2.
+let $condition= <> '3';
+# All rows of 'SHOW SLAVE HOSTS' are not equal to 3. It mean that master has
+# knew the leave of slave2 and has unregistered it.
+let $wait_for_all= 1;
+source include/wait_show_condition.inc;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW SLAVE HOSTS;
+
+source include/master-slave-end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test
index f4cb0f69e93..5ef58892ef6 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_skip.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test
@@ -5,6 +5,7 @@ source include/have_innodb.inc;
connection slave;
source include/have_innodb.inc;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
--echo **** On Master ****
connection master;
@@ -27,7 +28,7 @@ connection slave;
# Stop when reaching the the first table map event.
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
-wait_for_slave_to_stop;
+--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
query_vertical SHOW SLAVE STATUS;
@@ -37,6 +38,7 @@ query_vertical SHOW SLAVE STATUS;
# changed.
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
sync_with_master;
# These values should be what was inserted, not what was
@@ -47,6 +49,7 @@ SELECT * FROM t1;
SELECT * FROM t2;
STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
RESET SLAVE;
connection master;
RESET MASTER;
@@ -59,9 +62,10 @@ source include/show_binlog_events.inc;
connection slave;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=106;
-wait_for_slave_to_stop;
+--source include/wait_for_slave_sql_to_stop.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
+--source include/wait_for_slave_to_start.inc
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test
index 4edf1802a5d..02fd555d13c 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_status.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_status.test
@@ -54,6 +54,7 @@ sync_slave_with_master;
source include/stop_slave.inc;
START SLAVE;
source include/wait_for_slave_sql_to_start.inc;
+source include/wait_for_slave_io_to_stop.inc;
--echo ==== Verify that Slave_IO_Running = No ====
let $result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1);
diff --git a/mysql-test/suite/rpl/t/rpl_slow_query_log-slave.opt b/mysql-test/suite/rpl/t/rpl_slow_query_log-slave.opt
new file mode 100644
index 00000000000..a27d3a0f5a7
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_slow_query_log-slave.opt
@@ -0,0 +1 @@
+--force-restart --log-slow-slave-statements --log-slow-queries
diff --git a/mysql-test/suite/rpl/t/rpl_slow_query_log.test b/mysql-test/suite/rpl/t/rpl_slow_query_log.test
new file mode 100644
index 00000000000..3523af4c951
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test
@@ -0,0 +1,187 @@
+#
+# BUG#23300: Slow query log on slave does not log slow replicated statements
+#
+# Description:
+# The slave should log slow queries replicated from master when
+# --log-slow-slave-statements is used.
+#
+# Test is implemented as follows:
+# i) stop slave
+# ii) On slave, set long_query_time to a small value.
+# ii) start slave so that long_query_time variable is picked by sql thread
+# iii) On master, do one short time query and one long time query, on slave
+# and check that slow query is logged to slow query log but fast query
+# is not.
+# iv) On slave, check that slow queries go into the slow log and fast dont,
+# when issued through a regular client connection
+# v) On slave, check that slow queries go into the slow log and fast dont
+# when we use SET TIMESTAMP= 1 on a regular client connection.
+# vi) check that when setting slow_query_log= OFF in a connection 'extra2'
+# prevents logging slow queries in a connection 'extra'
+#
+# OBS:
+# This test only runs for statement and mixed binlogging firmat because on
+# row format slow queries do not get slow query logged.
+
+source include/master-slave.inc;
+source include/have_binlog_format_statement.inc;
+
+
+# Prepare slave for different long_query_time we need to stop the slave
+# and restart it as long_query_time variable is dynamic and, after
+# setting it, it only takes effect on new connections.
+#
+# Reference:
+# http://dev.mysql.com/doc/refman/6.0/en/set-option.html
+connection slave;
+
+source include/stop_slave.inc;
+
+SET @old_log_output= @@log_output;
+SET GLOBAL log_output= 'TABLE';
+SET @old_long_query_time= @@long_query_time;
+SET GLOBAL long_query_time= 2;
+TRUNCATE mysql.slow_log;
+
+source include/start_slave.inc;
+
+connection master;
+CREATE TABLE t1 (a int, b int);
+
+# test:
+# check that slave logs the slow query to the slow log, but not the fast one.
+
+let $slow_query= INSERT INTO t1 values(1, sleep(3));
+let $fast_query= INSERT INTO t1 values(1, 1);
+
+eval $fast_query;
+eval $slow_query;
+sync_slave_with_master;
+
+let $found_fast_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$fast_query'`;
+let $found_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;
+
+if ($found_fast_query)
+{
+ SELECT * FROM mysql.slow_log;
+ die "Assertion failed! Fast query FOUND in slow query log. Bailing out!";
+}
+
+if (!$found_slow_query)
+{
+ SELECT * FROM mysql.slow_log;
+ die "Assertion failed! Slow query NOT FOUND in slow query log. Bailing out!";
+}
+TRUNCATE mysql.slow_log;
+
+# regular checks for slow query log (using a new connection - 'extra' - to slave)
+
+# test:
+# when using direct connections to the slave, check that slow query is logged
+# but not the fast one.
+
+connect(extra,127.0.0.1,root,,test,$SLAVE_MYPORT);
+connection extra;
+
+let $fast_query= SELECT 1;
+let $slow_query= SELECT 1, sleep(3);
+
+eval $slow_query;
+eval $fast_query;
+
+let $found_fast_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$fast_query'`;
+let $found_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;
+
+if ($found_fast_query)
+{
+ SELECT * FROM mysql.slow_log;
+ die "Assertion failed! Fast query FOUND in slow query log. Bailing out!";
+}
+
+if (!$found_slow_query)
+{
+ SELECT * FROM mysql.slow_log;
+ die "Assertion failed! Slow query NOT FOUND in slow query log. Bailing out!";
+}
+TRUNCATE mysql.slow_log;
+
+# test:
+# when using direct connections to the slave, check that when setting timestamp to 1 the
+# slow query is logged but the fast one is not.
+
+let $fast_query= SELECT 2;
+let $slow_query= SELECT 2, sleep(3);
+
+SET TIMESTAMP= 1;
+eval $slow_query;
+eval $fast_query;
+
+let $found_fast_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$fast_query'`;
+let $found_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;
+
+if ($found_fast_query)
+{
+ SELECT * FROM mysql.slow_log;
+ die "Assertion failed! Fast query FOUND in slow query log. Bailing out!";
+}
+
+if (!$found_slow_query)
+{
+ SELECT * FROM mysql.slow_log;
+ die "Assertion failed! Slow query NOT FOUND in slow query log. Bailing out!";
+}
+TRUNCATE mysql.slow_log;
+
+# test:
+# check that when setting the slow_query_log= OFF on connection 'extra2'
+# prevents connection 'extra' from logging to slow query log.
+
+let $fast_query= SELECT 3;
+let $slow_query= SELECT 3, sleep(3);
+
+connect(extra2,127.0.0.1,root,,test,$SLAVE_MYPORT);
+connection extra2;
+
+SET @old_slow_query_log= @@slow_query_log;
+SET GLOBAL slow_query_log= 'OFF';
+
+connection extra;
+
+eval $slow_query;
+eval $fast_query;
+
+let $found_fast_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$fast_query'`;
+let $found_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;
+
+if ($found_fast_query)
+{
+ SELECT * FROM mysql.slow_log;
+ die "Assertion failed! Fast query FOUND in slow query log when slow_query_log= OFF. Bailing out!";
+}
+
+if ($found_slow_query)
+{
+ SELECT * FROM mysql.slow_log;
+ die "Assertion failed! Slow query FOUND in slow query log when slow_query_log= OFF. Bailing out!";
+}
+TRUNCATE mysql.slow_log;
+
+# clean up: drop tables, reset the variables back to the previous value,
+# disconnect extra connections
+connection extra2;
+
+SET GLOBAL slow_query_log= @old_slow_query_log;
+
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+
+source include/stop_slave.inc;
+
+SET GLOBAL long_query_time= @old_long_query_time;
+SET GLOBAL log_output= @old_log_output;
+
+source include/start_slave.inc;
+
+disconnect extra;
+disconnect extra2;
diff --git a/mysql-test/suite/rpl/t/rpl_sp-master.opt b/mysql-test/suite/rpl/t/rpl_sp-master.opt
index 709a224fd92..18c5c96955f 100644
--- a/mysql-test/suite/rpl/t/rpl_sp-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_sp-master.opt
@@ -1 +1 @@
---log_bin_trust_routine_creators=0
+--log_bin_trust_function_creators=0
diff --git a/mysql-test/suite/rpl/t/rpl_sp-slave.opt b/mysql-test/suite/rpl/t/rpl_sp-slave.opt
index 709a224fd92..18c5c96955f 100644
--- a/mysql-test/suite/rpl/t/rpl_sp-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_sp-slave.opt
@@ -1 +1 @@
---log_bin_trust_routine_creators=0
+--log_bin_trust_function_creators=0
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test
index 9be630e9ae8..96a41d9a9ad 100644
--- a/mysql-test/suite/rpl/t/rpl_sp.test
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -3,11 +3,6 @@
# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
# Modified by WL#2971.
-# Note that in the .opt files we still use the old variable name
-# log-bin-trust-routine-creators so that this test checks that it's
-# still accepted (this test also checks that the new name is
-# accepted). The old name could be removed in 5.1 or 6.0.
-
source include/have_binlog_format_mixed.inc;
source include/master-slave.inc;
@@ -241,16 +236,11 @@ begin
end|
delimiter ;|
connection master;
-set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
-# test old variable name:
-set global log_bin_trust_routine_creators=1;
-# now use new name:
set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=1;
# slave needs it too otherwise will not execute what master allowed:
connection slave;
-set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_function_creators=1;
@@ -466,9 +456,7 @@ DROP FUNCTION IF EXISTS f1;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--echo
--echo ---> connection: master
@@ -492,9 +480,7 @@ SHOW CREATE FUNCTION f1;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--echo ---> connection: master
@@ -516,9 +502,7 @@ SHOW CREATE FUNCTION f1;
DROP PROCEDURE p1;
DROP FUNCTION f1;
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--connection master
@@ -568,19 +552,15 @@ connection master;
# Final inspection which verifies how all statements of this test file
# were written to the binary log.
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
# Restore log_bin_trust_function_creators to its original value.
# This is a cleanup for all parts above where we tested stored
# functions and triggers.
connection slave;
-set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
connection master;
-set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
# Clean up
diff --git a/mysql-test/suite/rpl/t/rpl_sp004.test b/mysql-test/suite/rpl/t/rpl_sp004.test
index 967e7007c15..2f9b329eb66 100644
--- a/mysql-test/suite/rpl/t/rpl_sp004.test
+++ b/mysql-test/suite/rpl/t/rpl_sp004.test
@@ -46,9 +46,7 @@ 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;
+sync_slave_with_master;
SELECT * FROM test.t1 ORDER BY a;
SELECT * FROM test.t2 ORDER BY a;
@@ -57,9 +55,7 @@ CALL test.p2();
USE test;
SHOW TABLES;
#SELECT * FROM test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
USE test;
SHOW TABLES;
#SELECT * FROM test.t3;
@@ -69,9 +65,7 @@ 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;
+sync_slave_with_master;
SELECT * FROM test.t1 ORDER BY a;
SELECT * FROM test.t2 ORDER BY a;
#SELECT * FROM test.t3;
diff --git a/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt b/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/suite/rpl/t/rpl_spec_variables.test b/mysql-test/suite/rpl/t/rpl_spec_variables.test
new file mode 100644
index 00000000000..a60738316c8
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_spec_variables.test
@@ -0,0 +1,306 @@
+#############################################################
+# Author: Serge Kozlov <skozlov@mysql.com>
+# Date: 07/01/2008
+# Purpose: Testing possible affects of some system dynamic
+# variables to the replication.
+# Scenario for each variable:
+# 1) Set different values for master and slave
+# 2) Create and replicate a data from master to slave
+# 3) Check results on master and slave: changes on slave
+# shouldn't be affected to replicated data.
+#############################################################
+--source include/have_innodb.inc
+--source include/master-slave.inc
+--echo
+
+#
+# AUTO_INCREMENT
+#
+--echo * auto_increment_increment, auto_increment_offset *
+
+--connection master
+SET @@global.auto_increment_increment=2;
+SET @@session.auto_increment_increment=2;
+SET @@global.auto_increment_offset=10;
+SET @@session.auto_increment_offset=10;
+
+--connection slave
+SET @@global.auto_increment_increment=3;
+SET @@session.auto_increment_increment=3;
+SET @@global.auto_increment_offset=20;
+SET @@session.auto_increment_offset=20;
+
+--connection master
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t1 (b) VALUES ('master');
+INSERT INTO t1 (b) VALUES ('master');
+SELECT * FROM t1 ORDER BY a;
+
+--sync_slave_with_master
+CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
+INSERT INTO t1 (b) VALUES ('slave');
+INSERT INTO t1 (b) VALUES ('slave');
+INSERT INTO t2 (b) VALUES ('slave');
+INSERT INTO t2 (b) VALUES ('slave');
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+--connection master
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+SET @@global.auto_increment_increment=1;
+SET @@session.auto_increment_increment=1;
+SET @@global.auto_increment_offset=1;
+SET @@session.auto_increment_offset=1;
+
+--connection slave
+SET @@global.auto_increment_increment=1;
+SET @@session.auto_increment_increment=1;
+SET @@global.auto_increment_offset=1;
+SET @@session.auto_increment_offset=1;
+
+--connection slave
+SET auto_increment_increment=1;
+SET auto_increment_offset=1;
+--echo
+
+#
+# CHARACTER_SET_DATABASE, COLLATION_SERVER
+#
+--echo * character_set_database, collation_server *
+
+--connection master
+SET @restore_master_character_set_database=@@global.character_set_database;
+SET @restore_master_collation_server=@@global.collation_server;
+SET @@global.character_set_database=latin1;
+SET @@session.character_set_database=latin1;
+SET @@global.collation_server=latin1_german1_ci;
+SET @@session.collation_server=latin1_german1_ci;
+
+--connection slave
+SET @restore_slave_character_set_database=@@global.character_set_database;
+SET @restore_slave_collation_server=@@global.collation_server;
+SET @@global.character_set_database=utf8;
+SET @@session.character_set_database=utf8;
+SET @@global.collation_server=utf8_bin;
+SET @@session.collation_server=utf8_bin;
+
+--connection master
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+
+--sync_slave_with_master
+CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+
+SET @@global.collation_server=latin1_swedish_ci;
+SET @@session.collation_server=latin1_swedish_ci;
+
+--connection master
+SET @@global.collation_server=latin1_swedish_ci;
+SET @@session.collation_server=latin1_swedish_ci;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+--echo
+
+#
+# DEFAULT_WEEK_FORMAT
+#
+--echo * default_week_format *
+
+--connection master
+SET @@global.default_week_format=0;
+SET @@session.default_week_format=0;
+
+--connection slave
+SET @@global.default_week_format=1;
+SET @@session.default_week_format=1;
+
+--connection master
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, 'master ', WEEK('2008-01-07'));
+SELECT * FROM t1 ORDER BY a;
+
+--sync_slave_with_master
+INSERT INTO t1 VALUES (2, 'slave ', WEEK('2008-01-07'));
+SELECT * FROM t1 ORDER BY a;
+
+--connection master
+DROP TABLE t1;
+
+--connection slave
+SET @@global.default_week_format=0;
+SET @@session.default_week_format=0;
+--echo
+
+#
+# LOCAL_INFILE
+#
+--echo * local_infile *
+
+--connection slave
+SET @@global.local_infile=0;
+
+--connection master
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(20), c CHAR(254)) ENGINE=MyISAM;
+--copy_file ./std_data/words.dat $MYSQLTEST_VARDIR/tmp/words.dat
+--copy_file ./std_data/words2.dat $MYSQLTEST_VARDIR/tmp/words2.dat
+--replace_regex /\'.+\'/'FILE'/
+--eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/words.dat' INTO TABLE t1 (b)
+SELECT COUNT(*) FROM t1;
+--sync_slave_with_master
+--replace_regex /\'.+\'/'FILE2'/
+--error 1148
+--eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/words2.dat' INTO TABLE t1 (b)
+SELECT COUNT(*) FROM t1;
+
+SET @@global.local_infile=1;
+
+--connection master
+DROP TABLE t1;
+--echo
+
+#
+# MAX_HEAP_TABLE_SIZE
+#
+--echo * max_heap_table_size *
+
+--connection slave
+SET @restore_slave_max_heap_table_size=@@global.max_heap_table_size;
+SET @@global.max_heap_table_size=16384;
+SET @@session.max_heap_table_size=16384;
+
+--connection master
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), c CHAR(254)) ENGINE=MEMORY;
+let $counter=2000;
+--disable_query_log
+while ($counter) {
+ INSERT INTO t1 (b,c) VALUES ('master', REPEAT('A', 254));
+ dec $counter;
+}
+--enable_query_log
+SELECT COUNT(*)=2000 FROM t1;
+
+--sync_slave_with_master
+let $counter=2000;
+--disable_query_log
+while ($counter) {
+ --error 0,1114
+ INSERT INTO t1 (b,c) VALUES ('slave', REPEAT('A', 254));
+ dec $counter;
+}
+CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), c CHAR(254)) ENGINE=MEMORY;
+let $counter=2000;
+--disable_query_log
+while ($counter) {
+ --error 0,1114
+ INSERT INTO t2 (b,c) VALUES ('slave', REPEAT('A', 254));
+ dec $counter;
+}
+--enable_query_log
+# We don't know how many memory used and can't check exact values so need to check following
+# conditions
+SELECT COUNT(*)=2000 FROM t1 WHERE b='master' GROUP BY b ORDER BY b;
+SELECT COUNT(*)<2000 AND COUNT(*)>0 FROM t1 WHERE b='slave' GROUP BY b ORDER BY b;
+SELECT COUNT(*)<2000 AND COUNT(*)>0 FROM t2 WHERE b='slave' GROUP BY b ORDER BY b;
+
+--connection master
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+--echo
+
+#
+# STORAGE_ENGINE
+#
+--echo * storage_engine *
+
+--connection master
+SET @restore_master_storage_engine=@@global.storage_engine;
+SET @@global.storage_engine=InnoDB;
+SET @@session.storage_engine=InnoDB;
+
+--connection slave
+SET @restore_slave_storage_engine=@@global.storage_engine;
+SET @@global.storage_engine=Memory;
+SET @@session.storage_engine=Memory;
+
+--connection master
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10));
+CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
+
+--sync_slave_with_master
+CREATE TABLE t3 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10));
+
+--connection master
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+
+--connection slave
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+SHOW CREATE TABLE t3;
+
+SET @@global.storage_engine=InnoDB;
+SET @@session.storage_engine=InnoDB;
+
+--connection master
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3;
+--enable_warnings
+--echo
+
+#
+# SQL_MODE
+#
+--echo * sql_mode *
+
+--connection master
+SET @@global.sql_mode=ANSI;
+SET @@session.sql_mode=ANSI;
+
+--connection slave
+SET @@global.sql_mode=TRADITIONAL;
+SET @@session.sql_mode=TRADITIONAL;
+
+--connection master
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c DATE);
+INSERT INTO t1 VALUES (1, 'master', '0000-00-00');
+SELECT * FROM t1 ORDER BY a;
+
+--sync_slave_with_master
+--error 1292
+INSERT INTO t1 VALUES (1, 'slave', '0000-00-00');
+SELECT * FROM t1 ORDER BY a;
+SET @@global.sql_mode='';
+SET @@session.sql_mode='';
+
+--connection master
+SET @@global.sql_mode='';
+SET @@session.sql_mode='';
+DROP TABLE t1;
+--echo
+
+
+# Clean up
+--echo *** clean up ***
+--connection master
+SET @@global.character_set_database=@restore_master_character_set_database;
+SET @@global.collation_server=@restore_master_collation_server;
+SET @@global.storage_engine=@restore_master_storage_engine;
+--sync_slave_with_master
+SET @@global.character_set_database=@restore_slave_character_set_database;
+SET @@global.collation_server=@restore_slave_collation_server;
+SET @@global.max_heap_table_size=@restore_slave_max_heap_table_size;
+SET @@global.storage_engine=@restore_slave_storage_engine;
+
+# Put at the end since the test otherwise emptied the table.
+
+--echo
+call mtr.add_suppression("The table 't[12]' is full");
+
+# End of 5.1 test
diff --git a/mysql-test/suite/rpl/t/rpl_sporadic_master.test b/mysql-test/suite/rpl/t/rpl_sporadic_master.test
index 824f7abc9f5..6640544b0ed 100644
--- a/mysql-test/suite/rpl/t/rpl_sporadic_master.test
+++ b/mysql-test/suite/rpl/t/rpl_sporadic_master.test
@@ -14,7 +14,9 @@ truncate table t1;
insert into t1 values (4),(NULL);
sync_slave_with_master;
stop slave;
+--source include/wait_for_slave_to_stop.inc
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
insert into t1 values (NULL),(NULL);
flush logs;
diff --git a/mysql-test/suite/rpl/t/rpl_ssl1.test b/mysql-test/suite/rpl/t/rpl_ssl1.test
index b5355d737d5..85f073d9c09 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl1.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl1.test
@@ -9,14 +9,13 @@ source include/master-slave.inc;
connection master;
grant replication slave on *.* to replssl@localhost require ssl;
create table t1 (t int);
-save_master_pos;
#syncing with master
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#trying to use this user without ssl
stop slave;
+--source include/wait_for_slave_to_stop.inc
change master to master_user='replssl',master_password='';
start slave;
@@ -31,15 +30,15 @@ select * from t1;
#showing that replication could work with ssl params
stop slave;
+--source include/wait_for_slave_to_stop.inc
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval change master to master_ssl=1 , master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem';
start slave;
+--source include/wait_for_slave_to_start.inc
#avoiding unneeded sleeps
connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#checking that replication is ok
select * from t1;
@@ -51,14 +50,14 @@ query_vertical show slave status;
#checking if replication works without ssl also performing clean up
stop slave;
+--source include/wait_for_slave_to_stop.inc
change master to master_user='root',master_password='', master_ssl=0;
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
drop user replssl@localhost;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
query_vertical show slave status;
@@ -68,6 +67,7 @@ query_vertical show slave status;
# Start replication with ssl_verify_server_cert turned on
connection slave;
stop slave;
+--source include/wait_for_slave_to_stop.inc
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval change master to
master_host="localhost",
@@ -77,6 +77,7 @@ eval change master to
master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem',
master_ssl_verify_server_cert=1;
start slave;
+--source include/wait_for_slave_to_start.inc
connection master;
create table t1 (t int);
diff --git a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
index d9b87427321..d599e88c840 100644
--- a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
@@ -9,6 +9,7 @@ connection master;
create table t1(n int);
sync_slave_with_master;
stop slave;
+--source include/wait_for_slave_to_stop.inc
connection master;
let $1=5000;
disable_query_log;
@@ -31,10 +32,7 @@ sync_with_master;
connection master;
drop table t1;
-save_master_pos;
-
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#
diff --git a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
index a8a33d05e8b..f3993f80b90 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
@@ -1,7 +1,7 @@
# depends on the binlog output
--source include/have_binlog_format_mixed_or_statement.inc
-let $rename_event_pos= 656;
+let $rename_event_pos= 657;
-- source extra/rpl_tests/rpl_flsh_tbls.test
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test b/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test
new file mode 100644
index 00000000000..523e883d9fa
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test
@@ -0,0 +1,18 @@
+# BUG#28777 SHOW BINLOG EVENTS does not work on relay log files
+#
+# GOAL
+# ====
+#
+# Test that SHOW BINLOG EVENTS and the new SHOW RELAYLOG EVENTS works after
+# the patch, both on master and slave.
+#
+# HOW
+# ===
+#
+# This test issues SHOW [BINLOG|RELAYLOG] EVENTS both on master and slave after
+# some statements have been issued.
+
+-- source include/master-slave.inc
+-- source include/have_binlog_format_mixed_or_statement.inc
+
+-- source extra/rpl_tests/rpl_show_relaylog_events.inc
diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test
index 07a3b27763d..6b731780163 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_until.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_until.test
@@ -22,6 +22,9 @@
# Test is dependent on binlog positions
+# prepare version for substitutions
+let $VERSION=`select version()`;
+
# Stop slave before it starts replication. Also sync with master
# to avoid nondeterministic behaviour.
--echo [on slave]
diff --git a/mysql-test/suite/rpl/t/rpl_stop_middle_group.test b/mysql-test/suite/rpl/t/rpl_stop_middle_group.test
new file mode 100644
index 00000000000..2cd41b45cf9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stop_middle_group.test
@@ -0,0 +1,149 @@
+-- source include/have_debug.inc
+-- source include/master-slave.inc
+-- source include/have_innodb.inc
+
+# Proving that stopping in the middle of applying a group of events
+# does not have immediate effect if a non-transaction table has been changed.
+# The slave sql thread has to try to finish applying first.
+# The tests rely on simulation of the killed status.
+# The matter of testing correlates to some of `rpl_start_stop_slave' that does
+# not require `have_debug'.
+
+connection master;
+
+create table tm (a int auto_increment primary key) engine=myisam;
+create table ti (a int auto_increment primary key) engine=innodb;
+
+sync_slave_with_master;
+set @@global.debug="+d,stop_slave_middle_group";
+
+connection master;
+
+begin;
+insert into ti set a=null;
+insert into tm set a=null; # to simulate killed status on the slave
+commit;
+
+connection slave;
+
+# slave will catch the killed status but won't shut down immediately
+# only after the whole group has done (commit)
+
+source include/wait_for_slave_sql_to_stop.inc;
+
+# checking: no error and the group is finished
+
+let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
+let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
+--disable_query_log
+eval SELECT $read = $exec into @check;
+--enable_query_log
+eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`;
+select count(*) as one from tm;
+select count(*) as one from ti;
+
+set @@global.debug="-d";
+
+#
+# bug#45940 issues around rli->last_event_start_time
+# Testing of slave stopped after it had waited (in vain) for
+# the group be finished.
+# It could not be finished because of simulation of failure to
+# receive the terminal part
+# The test relay on simulation of the incomplete group in the relay log
+
+# Two cases are verified: a mixed transacton and a mixed multi-table update.
+#
+# The mixed transacton.
+#
+source include/start_slave.inc;
+
+connection master;
+
+truncate table tm; # cleanup of former tests
+truncate table ti;
+
+#connection slave;
+sync_slave_with_master;
+
+set @@global.debug="+d,stop_slave_middle_group";
+set @@global.debug="+d,incomplete_group_in_relay_log";
+
+connection master;
+
+begin;
+insert into ti set a=null;
+insert into tm set a=null;
+commit;
+
+connection slave;
+
+# slave will catch the killed status, won't shut down immediately
+# but does it eventually having the whole group unfinished (not committed)
+
+source include/wait_for_slave_sql_to_stop.inc;
+
+# checking: the error and group unfinished
+
+let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
+let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
+--disable_query_log
+eval SELECT $read - $exec > 0 into @check;
+--enable_query_log
+eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
+select count(*) as one from tm;
+select count(*) as zero from ti;
+
+set @@global.debug="-d";
+
+#
+# The mixed multi-table update
+#
+stop slave;
+truncate table tm;
+source include/start_slave.inc;
+
+connection master;
+
+#connection slave;
+sync_slave_with_master;
+set @@global.debug="+d,stop_slave_middle_group";
+set @@global.debug="+d,incomplete_group_in_relay_log";
+
+connection master;
+update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
+
+connection slave;
+
+# slave will catch the killed status, won't shut down immediately
+# but does it eventually having the whole group unfinished (not committed)
+#
+
+source include/wait_for_slave_sql_to_stop.inc;
+
+# checking: the error and group unfinished
+
+let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
+let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
+--disable_query_log
+eval SELECT $read - $exec > 0 into @check;
+--enable_query_log
+eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
+select max(a) as two from tm;
+select max(a) as one from ti;
+
+set @@global.debug="-d";
+
+#
+# clean-up
+#
+
+connection master;
+drop table tm, ti;
+
+connection slave; # slave SQL thread is stopped
+source include/stop_slave.inc;
+drop table tm, ti;
diff --git a/mysql-test/suite/rpl/t/rpl_sync-slave.opt b/mysql-test/suite/rpl/t/rpl_sync-slave.opt
new file mode 100644
index 00000000000..77809a42c43
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sync-slave.opt
@@ -0,0 +1 @@
+--sync-relay-log-info=1 --relay-log-recovery=1
diff --git a/mysql-test/suite/rpl/t/rpl_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test
new file mode 100644
index 00000000000..80b6a144187
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_sync.test
@@ -0,0 +1,148 @@
+########################################################################################
+# This test verifies the options --sync-relay-log-info and --relay-log-recovery by
+# crashing the slave in two different situations:
+# (case-1) - Corrupt the relay log with changes which were not processed by
+# the SQL Thread and crashes it.
+# (case-2) - Corrupt the master.info with wrong coordinates and crashes it.
+#
+# Case 1:
+# 1 - Stops the SQL Thread
+# 2 - Inserts new records into the master.
+# 3 - Corrupts the relay-log.bin* which most likely has such changes.
+# 4 - Crashes the slave
+# 5 - Verifies if the slave is sync with the master which means that the information
+# loss was circumvented by the recovery process.
+#
+# Case 2:
+# 1 - Stops the SQL/IO Threads
+# 2 - Inserts new records into the master.
+# 3 - Corrupts the master.info with wrong coordinates.
+# 4 - Crashes the slave
+# 5 - Verifies if the slave is sync with the master which means that the information
+# loss was circumvented by the recovery process.
+########################################################################################
+
+########################################################################################
+# Configuring the environment
+########################################################################################
+--echo =====Configuring the enviroment=======;
+--source include/master-slave.inc
+--source include/not_embedded.inc
+--source include/not_valgrind.inc
+--source include/have_debug.inc
+--source include/have_innodb.inc
+
+call mtr.add_suppression('Attempting backtrace');
+call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
+CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb;
+
+insert into t1(a) values(1);
+insert into t1(a) values(2);
+insert into t1(a) values(3);
+
+########################################################################################
+# Case 1: Corrupt a relay-log.bin*
+########################################################################################
+--echo =====Inserting data on the master but without the SQL Thread being running=======;
+sync_slave_with_master;
+
+connection slave;
+let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR
+--copy_file $MYSQLD_SLAVE_DATADIR/master.info $MYSQLD_SLAVE_DATADIR/master.backup
+stop slave SQL_THREAD;
+source include/wait_for_slave_sql_to_stop.inc;
+
+connection master;
+insert into t1(a) values(4);
+insert into t1(a) values(5);
+insert into t1(a) values(6);
+
+--echo =====Removing relay log files and crashing/recoverying the slave=======;
+connection slave;
+stop slave IO_THREAD;
+source include/wait_for_slave_io_to_stop.inc;
+
+let $file= query_get_value("SHOW SLAVE STATUS", Relay_Log_File, 1);
+--replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR
+--exec echo "failure" > $MYSQLD_SLAVE_DATADIR/$file
+
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+SET SESSION debug="d,crash_before_rotate_relaylog";
+--error 2013
+FLUSH LOGS;
+
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--echo =====Dumping and comparing tables=======;
+start slave;
+source include/wait_for_slave_to_start.inc;
+
+connection master;
+sync_slave_with_master;
+
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+
+########################################################################################
+# Case 2: Corrupt a master.info
+########################################################################################
+--echo =====Corrupting the master.info=======;
+connection slave;
+stop slave;
+source include/wait_for_slave_to_stop.inc;
+
+connection master;
+FLUSH LOGS;
+
+insert into t1(a) values(7);
+insert into t1(a) values(8);
+insert into t1(a) values(9);
+
+connection slave;
+--replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR
+--exec cat $MYSQLD_SLAVE_DATADIR/master.backup > $MYSQLD_SLAVE_DATADIR/master.info
+
+let MYSQLD_SLAVE_DATADIR=`select @@datadir`;
+
+--perl
+use strict;
+use warnings;
+my $src= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.backup";
+my $dst= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.info";
+open(FILE, "<", $src) or die;
+my @content= <FILE>;
+close FILE;
+open(FILE, ">", $dst) or die;
+binmode FILE;
+print FILE @content;
+close FILE;
+EOF
+
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+SET SESSION debug="d,crash_before_rotate_relaylog";
+--error 2013
+FLUSH LOGS;
+
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--echo =====Dumping and comparing tables=======;
+start slave;
+source include/wait_for_slave_to_start.inc;
+
+connection master;
+sync_slave_with_master;
+
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+
+########################################################################################
+# Clean up
+########################################################################################
+--echo =====Clean up=======;
+connection master;
+drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_temp_table.test b/mysql-test/suite/rpl/t/rpl_temp_table.test
index 9b73961aeea..dc24f2fc87b 100644
--- a/mysql-test/suite/rpl/t/rpl_temp_table.test
+++ b/mysql-test/suite/rpl/t/rpl_temp_table.test
@@ -54,6 +54,4 @@ show status like 'Slave_open_temp_tables';
connect (master2,localhost,root,,);
connection master2;
drop table if exists t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test
index a59e4f2fd21..3f9f5c19a25 100644
--- a/mysql-test/suite/rpl/t/rpl_temporary.test
+++ b/mysql-test/suite/rpl/t/rpl_temporary.test
@@ -1,6 +1,5 @@
# Test need anonymous user when connection are made as "zedjzlcsjhd"
source include/add_anonymous_users.inc;
-
-- source include/master-slave.inc
# Clean up old slave's binlogs.
diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test
index 4b40fbea719..e296da01bad 100644
--- a/mysql-test/suite/rpl/t/rpl_trigger.test
+++ b/mysql-test/suite/rpl/t/rpl_trigger.test
@@ -40,10 +40,12 @@ insert into t3 values(100,"log",0,0,0);
SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186;
# Emulate that we have rows 2-9 deleted on the slave
+--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);
+--enable_warnings
select a,b, truncate(rand_value,4) from t1;
select * from t2;
diff --git a/mysql-test/suite/rpl/t/rpl_typeconv-slave.opt b/mysql-test/suite/rpl/t/rpl_typeconv-slave.opt
new file mode 100644
index 00000000000..73ca7001985
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_typeconv-slave.opt
@@ -0,0 +1 @@
+--innodb \ No newline at end of file
diff --git a/mysql-test/suite/rpl/t/rpl_typeconv.test b/mysql-test/suite/rpl/t/rpl_typeconv.test
new file mode 100644
index 00000000000..2a6a3f3b33d
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_typeconv.test
@@ -0,0 +1,69 @@
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+connection slave;
+set @saved_slave_type_conversions = @@global.slave_type_conversions;
+CREATE TABLE type_conversions (
+ TestNo INT AUTO_INCREMENT PRIMARY KEY,
+ Source TEXT,
+ Target TEXT,
+ Flags TEXT,
+ On_Master TEXT,
+ On_Slave TEXT,
+ Expected TEXT,
+ Compare INT,
+ Error TEXT);
+
+SELECT @@global.slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
+SELECT @@global.slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+SELECT @@global.slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
+SELECT @@global.slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
+SELECT @@global.slave_type_conversions;
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT';
+SELECT @@global.slave_type_conversions;
+
+# Checking strict interpretation of type conversions
+connection slave;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
+source extra/rpl_tests/type_conversions.test;
+
+# Checking lossy integer type conversions
+connection slave;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+source extra/rpl_tests/type_conversions.test;
+
+# Checking non-lossy integer type conversions
+connection slave;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
+source extra/rpl_tests/type_conversions.test;
+
+# Checking all type conversions
+connection slave;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
+source extra/rpl_tests/type_conversions.test;
+
+connection slave;
+--echo **** Result of conversions ****
+disable_query_log;
+SELECT RPAD(Source, 15, ' ') AS Source_Type,
+ RPAD(Target, 15, ' ') AS Target_Type,
+ RPAD(Flags, 25, ' ') AS All_Type_Conversion_Flags,
+ IF(Compare IS NULL AND Error IS NOT NULL, '<Correct error>',
+ IF(Compare, '<Correct value>',
+ CONCAT("'", On_Slave, "' != '", Expected, "'")))
+ AS Value_On_Slave
+ FROM type_conversions;
+enable_query_log;
+DROP TABLE type_conversions;
+
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+
+set global slave_type_conversions = @saved_slave_type_conversions;
+
diff --git a/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test b/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test
new file mode 100644
index 00000000000..729a622348f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_typeconv_innodb.test
@@ -0,0 +1,29 @@
+--source include/have_binlog_format_row.inc
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+#
+# BUG#49618: Field length stored incorrectly in binary log for InnoDB
+#
+
+source include/reset_master_and_slave.inc;
+
+connection slave;
+SET @saved_slave_type_conversions = @@GLOBAL.SLAVE_TYPE_CONVERSIONS;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = '';
+
+connection master;
+CREATE TABLE t1(b1 BIT(1), b2 BIT(2), b3 BIT(3)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (b'0', b'01', b'101');
+sync_slave_with_master;
+
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+
+connection slave;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
diff --git a/mysql-test/suite/rpl/t/rpl_user_variables.test b/mysql-test/suite/rpl/t/rpl_user_variables.test
index 8d570f28f64..0eae78fcb9f 100644
--- a/mysql-test/suite/rpl/t/rpl_user_variables.test
+++ b/mysql-test/suite/rpl/t/rpl_user_variables.test
@@ -20,9 +20,7 @@
# 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;
+sync_slave_with_master;
reset master;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_variables_stm.test b/mysql-test/suite/rpl/t/rpl_variables_stm.test
index 85152ae878a..67f2e50e041 100644
--- a/mysql-test/suite/rpl/t/rpl_variables_stm.test
+++ b/mysql-test/suite/rpl/t/rpl_variables_stm.test
@@ -471,7 +471,9 @@ BEGIN
END|
DELIMITER ;|
+--disable_warnings
INSERT INTO trigger_table VALUES ('bye.');
+--enable_warnings
--echo ==== Insert variables from a prepared statement ====
diff --git a/mysql-test/suite/rpl/t/rpl_view.test b/mysql-test/suite/rpl/t/rpl_view.test
index 1053514bfec..01b4dc5ef55 100644
--- a/mysql-test/suite/rpl/t/rpl_view.test
+++ b/mysql-test/suite/rpl/t/rpl_view.test
@@ -74,9 +74,7 @@ DROP VIEW IF EXISTS v1;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--echo
--echo ---> connection: master
@@ -104,9 +102,7 @@ SELECT * FROM t1;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--echo ---> connection: master
@@ -127,9 +123,7 @@ SELECT * FROM t1;
DROP VIEW v1;
DROP TABLE t1;
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--connection master
#
diff --git a/mysql-test/suite/rpl_ndb/my.cnf b/mysql-test/suite/rpl_ndb/my.cnf
index 58fec36eedd..a496510f55f 100644
--- a/mysql-test/suite/rpl_ndb/my.cnf
+++ b/mysql-test/suite/rpl_ndb/my.cnf
@@ -29,16 +29,6 @@ log-bin= master-bin
# starting the mysqld
#!use-slave-opt
-# Connect mysqld in the second cluster as save to first mysqld
-# Hardcode the host to 127.0.0.1 until running on more
-# than one host and it probably need to be masked anyway
-# master-host= @mysqld.1.#host
-master-host= 127.0.0.1
-master-port= @mysqld.1.1.port
-master-password= @mysqld.1.1.#password
-master-user= @mysqld.1.1.#user
-master-connect-retry= 1
-
log-bin= slave-bin
relay-log= slave-relay-bin
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
index b16a63ec5ad..6680f3fd70f 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
@@ -179,6 +179,8 @@ Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno <Last_SQL_Errno>
Last_SQL_Error <Last_SQL_Error>
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
set GLOBAL slave_transaction_retries=10;
include/start_slave.inc
select * from t1 order by nid;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
index 2daacb351a9..aeb9e215d15 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
@@ -56,6 +56,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT * FROM t1 ORDER BY a;
a b
1 2
@@ -99,5 +101,7 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 2
STOP SLAVE;
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
index b6f32668c42..8eb7df3f890 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
@@ -53,6 +53,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 2
SELECT * FROM t1 ORDER BY a;
a b
1 2
@@ -102,4 +104,6 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
index f514bf7a75b..e08d21b4dcb 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
@@ -9,6 +9,8 @@ call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
*** On Slave ***
STOP SLAVE;
RESET SLAVE;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(4) DEFAULT 'TEST')
@@ -32,6 +34,7 @@ a b c d e
1 2 TEXAS NULL NULL
2 1 AUSTIN NULL NULL
3 4 QA NULL NULL
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
*** Drop t1 ***
DROP TABLE t1;
*** Create t2 on slave ***
@@ -73,8 +76,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
+Last_Errno 1641
+Last_Error Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -91,8 +94,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
+Last_SQL_Errno 1641
+Last_SQL_Error Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
@@ -140,8 +145,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
+Last_Errno 1641
+Last_Error Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -158,8 +163,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
+Last_SQL_Errno 1641
+Last_SQL_Error Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t3 ***
@@ -202,8 +209,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
+Last_Errno 1641
+Last_Error Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -220,8 +227,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
+Last_SQL_Errno 1641
+Last_SQL_Error Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t4 ***
@@ -264,8 +273,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
+Last_Errno 1641
+Last_Error Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -282,8 +291,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
+Last_SQL_Errno 1641
+Last_SQL_Error Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t5 ***
@@ -325,8 +336,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
+Last_Errno 1641
+Last_Error Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -343,8 +354,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
+Last_SQL_Errno 1641
+Last_SQL_Error Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -437,8 +450,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
+Last_Errno 1641
+Last_Error Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -455,8 +468,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
+Last_SQL_Errno 1641
+Last_SQL_Error Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t10 ***
@@ -464,7 +479,7 @@ DROP TABLE t10;
*** Create t11 on slave ***
STOP SLAVE;
RESET SLAVE;
-CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
+CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='NDB';
*** Create t11 on Master ***
CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
@@ -498,8 +513,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
+Last_Errno 1641
+Last_Error Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -516,8 +531,10 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
+Last_SQL_Errno 1641
+Last_SQL_Error Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t11 ***
@@ -768,6 +785,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1060
Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
*** Try to insert in master ****
@@ -888,8 +907,8 @@ Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
+Last_Errno 1641
+Last_Error Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)'
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -906,8 +925,8 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
-Last_SQL_Errno 1535
-Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
+Last_SQL_Errno 1641
+Last_SQL_Error Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)'
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
** DROP table t17 ***
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
index e2fee391bab..2df70ace0c1 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
@@ -33,15 +33,15 @@ c1 c2 c3
row3 C 3
row4 D 4
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
-<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No <Last_IO_Errno> <Last_IO_Error> 0
+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
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No <Last_IO_Errno> <Last_IO_Error> 0 1
STOP SLAVE;
CHANGE MASTER TO
master_log_file = 'master-bin.000001',
master_log_pos = <the_pos> ;
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
-<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 No No <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No <Last_IO_Errno> <Last_IO_Error> 0
+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
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 No No <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No <Last_IO_Errno> <Last_IO_Error> 0 1
START SLAVE;
SELECT * FROM t1 ORDER BY c3;
c1 c2 c3
@@ -68,6 +68,6 @@ SELECT * FROM t1;
c1 c2 c3
row2 new on slave 2
SHOW SLAVE STATUS;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> <Last_IO_Errno> <Last_IO_Error> 0
+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
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> <Last_IO_Errno> <Last_IO_Error> 0 1
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
index 540c430e757..301f4c2e45b 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
@@ -34,14 +34,14 @@ master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
master-bin.000001 # Write_rows 1 # table_id: #
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT
-show binlog events from 106 limit 1;
+show binlog events from 107 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
-show binlog events from 106 limit 2;
+show binlog events from 107 limit 2;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
master-bin.000001 # Query 1 # BEGIN
-show binlog events from 106 limit 2,1;
+show binlog events from 107 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
flush logs;
@@ -267,7 +267,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000002
-Read_Master_Log_Pos 623
+Read_Master_Log_Pos 624
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000002
@@ -282,7 +282,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 623
+Exec_Master_Log_Pos 624
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -299,6 +299,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result
new file mode 100644
index 00000000000..43efc10c2e1
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result
@@ -0,0 +1,246 @@
+==== Initialization ====
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+---- setup master ----
+CREATE TABLE myisam_innodb (a INT) ENGINE=MYISAM;
+CREATE TABLE innodb_myisam (a INT) ENGINE=INNODB;
+CREATE TABLE myisam_ndb (a INT) ENGINE=MYISAM;
+CREATE TABLE ndb_myisam (a INT) ENGINE=NDB;
+CREATE TABLE innodb_ndb (a INT) ENGINE=INNODB;
+CREATE TABLE ndb_innodb (a INT) ENGINE=NDB;
+SHOW CREATE TABLE myisam_innodb;
+Table Create Table
+myisam_innodb CREATE TABLE `myisam_innodb` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE innodb_myisam;
+Table Create Table
+innodb_myisam CREATE TABLE `innodb_myisam` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE myisam_ndb;
+Table Create Table
+myisam_ndb CREATE TABLE `myisam_ndb` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE ndb_myisam;
+Table Create Table
+ndb_myisam CREATE TABLE `ndb_myisam` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+SHOW CREATE TABLE innodb_ndb;
+Table Create Table
+innodb_ndb CREATE TABLE `innodb_ndb` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE ndb_innodb;
+Table Create Table
+ndb_innodb CREATE TABLE `ndb_innodb` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+---- setup slave with different engines ----
+DROP TABLE myisam_innodb, innodb_myisam;
+DROP TABLE myisam_ndb, ndb_myisam;
+DROP TABLE innodb_ndb, ndb_innodb;
+CREATE TABLE myisam_innodb (a INT) ENGINE=INNODB;
+CREATE TABLE innodb_myisam (a INT) ENGINE=MYISAM;
+CREATE TABLE myisam_ndb (a INT) ENGINE=NDB;
+CREATE TABLE ndb_myisam (a INT) ENGINE=MYISAM;
+CREATE TABLE innodb_ndb (a INT) ENGINE=NDB;
+CREATE TABLE ndb_innodb (a INT) ENGINE=INNODB;
+SHOW CREATE TABLE myisam_innodb;
+Table Create Table
+myisam_innodb CREATE TABLE `myisam_innodb` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE innodb_myisam;
+Table Create Table
+innodb_myisam CREATE TABLE `innodb_myisam` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE myisam_ndb;
+Table Create Table
+myisam_ndb CREATE TABLE `myisam_ndb` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+SHOW CREATE TABLE ndb_myisam;
+Table Create Table
+ndb_myisam CREATE TABLE `ndb_myisam` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE innodb_ndb;
+Table Create Table
+innodb_ndb CREATE TABLE `innodb_ndb` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+SHOW CREATE TABLE ndb_innodb;
+Table Create Table
+ndb_innodb CREATE TABLE `ndb_innodb` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+==== AUTOCOMMIT=0, transactions ====
+---- COMMIT ----
+SET AUTOCOMMIT = 0;
+BEGIN;
+INSERT INTO myisam_innodb VALUES (1);
+INSERT INTO myisam_innodb VALUES (2);
+COMMIT;
+BEGIN;
+INSERT INTO innodb_myisam VALUES (3);
+INSERT INTO innodb_myisam VALUES (4);
+COMMIT;
+BEGIN;
+INSERT INTO myisam_ndb VALUES (5);
+INSERT INTO myisam_ndb VALUES (6);
+COMMIT;
+BEGIN;
+INSERT INTO ndb_myisam VALUES (7);
+INSERT INTO ndb_myisam VALUES (8);
+COMMIT;
+BEGIN;
+INSERT INTO ndb_innodb VALUES (9);
+INSERT INTO ndb_innodb VALUES (10);
+COMMIT;
+BEGIN;
+INSERT INTO innodb_ndb VALUES (11);
+INSERT INTO innodb_ndb VALUES (12);
+COMMIT;
+---- ROLLBACK ----
+BEGIN;
+INSERT INTO innodb_myisam VALUES (15);
+INSERT INTO innodb_myisam VALUES (16);
+ROLLBACK;
+BEGIN;
+INSERT INTO ndb_myisam VALUES (19);
+INSERT INTO ndb_myisam VALUES (20);
+ROLLBACK;
+BEGIN;
+INSERT INTO ndb_innodb VALUES (21);
+INSERT INTO ndb_innodb VALUES (22);
+ROLLBACK;
+BEGIN;
+INSERT INTO innodb_ndb VALUES (23);
+INSERT INTO innodb_ndb VALUES (24);
+ROLLBACK;
+==== AUTOCOMMIT=1, transactions ====
+---- COMMIT ----
+SET AUTOCOMMIT = 1;
+BEGIN;
+INSERT INTO myisam_innodb VALUES (25);
+INSERT INTO myisam_innodb VALUES (26);
+COMMIT;
+BEGIN;
+INSERT INTO innodb_myisam VALUES (27);
+INSERT INTO innodb_myisam VALUES (28);
+COMMIT;
+BEGIN;
+INSERT INTO myisam_ndb VALUES (29);
+INSERT INTO myisam_ndb VALUES (30);
+COMMIT;
+BEGIN;
+INSERT INTO ndb_myisam VALUES (31);
+INSERT INTO ndb_myisam VALUES (32);
+COMMIT;
+BEGIN;
+INSERT INTO ndb_innodb VALUES (33);
+INSERT INTO ndb_innodb VALUES (34);
+COMMIT;
+BEGIN;
+INSERT INTO innodb_ndb VALUES (35);
+INSERT INTO innodb_ndb VALUES (36);
+COMMIT;
+---- ROLLBACK ----
+BEGIN;
+INSERT INTO innodb_myisam VALUES (39);
+INSERT INTO innodb_myisam VALUES (40);
+ROLLBACK;
+BEGIN;
+INSERT INTO ndb_myisam VALUES (43);
+INSERT INTO ndb_myisam VALUES (44);
+ROLLBACK;
+BEGIN;
+INSERT INTO ndb_innodb VALUES (45);
+INSERT INTO ndb_innodb VALUES (46);
+ROLLBACK;
+BEGIN;
+INSERT INTO innodb_ndb VALUES (47);
+INSERT INTO innodb_ndb VALUES (48);
+ROLLBACK;
+==== AUTOCOMMIT=1, single statements ====
+INSERT INTO myisam_innodb VALUES (49);
+INSERT INTO myisam_innodb VALUES (50);
+INSERT INTO innodb_myisam VALUES (51);
+INSERT INTO innodb_myisam VALUES (52);
+INSERT INTO myisam_ndb VALUES (53);
+INSERT INTO myisam_ndb VALUES (54);
+INSERT INTO ndb_myisam VALUES (55);
+INSERT INTO ndb_myisam VALUES (56);
+INSERT INTO ndb_innodb VALUES (57);
+INSERT INTO ndb_innodb VALUES (58);
+INSERT INTO innodb_ndb VALUES (59);
+INSERT INTO innodb_ndb VALUES (60);
+==== AUTOCOMMIT=0, single statements, myisam on master ====
+SET AUTOCOMMIT = 0;
+==== Show results ====
+SELECT * FROM myisam_innodb ORDER BY a;
+a
+1
+2
+25
+26
+49
+50
+SELECT * FROM innodb_myisam ORDER BY a;
+a
+3
+4
+27
+28
+51
+52
+SELECT * FROM myisam_ndb ORDER BY a;
+a
+5
+6
+29
+30
+53
+54
+SELECT * FROM ndb_myisam ORDER BY a;
+a
+7
+8
+31
+32
+55
+56
+SELECT * FROM innodb_ndb ORDER BY a;
+a
+11
+12
+35
+36
+59
+60
+SELECT * FROM ndb_innodb ORDER BY a;
+a
+9
+10
+33
+34
+57
+58
+Comparing tables master:test.myisam_innodb and slave:test.myisam_innodb
+Comparing tables master:test.innodb_myisam and slave:test.innodb_myisam
+Comparing tables master:test.myisam_ndb and slave:test.myisam_ndb
+Comparing tables master:test.ndb_myisam and slave:test.ndb_myisam
+Comparing tables master:test.innodb_ndb and slave:test.innodb_ndb
+Comparing tables master:test.ndb_innodb and slave:test.ndb_innodb
+==== Clean up ====
+drop table myisam_innodb, innodb_myisam;
+drop table myisam_ndb, ndb_myisam;
+drop table innodb_ndb, ndb_innodb;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
index f8eb5ebdd89..66eeaa6357c 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
@@ -26,11 +26,11 @@ stop slave;
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
-106 master-bin.000001
+107 master-bin.000001
CHANGE MASTER TO
master_port=<MASTER_PORT1>,
master_log_file = 'master-bin.000001',
-master_log_pos = 106 ;
+master_log_pos = 107 ;
start slave;
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
DELETE FROM t1 WHERE c3 = 1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
index 3ef5e2b7e53..b61f5550719 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
@@ -107,6 +107,8 @@ Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
hex(c1) hex(c2) c3
1 1 row1
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result
index 409397cb3d1..603bb61e2d5 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result
@@ -476,6 +476,8 @@ ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
CREATE TABLE t7 (i INT NOT NULL,
c CHAR(255) CHARACTER SET utf8 NOT NULL,
j INT NOT NULL) ENGINE = 'NDB' ;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
[expecting slave to replicate correctly]
INSERT INTO t1 VALUES (1, "", 1);
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
@@ -484,11 +486,7 @@ Comparing tables master:test.t1 and slave:test.t1
INSERT INTO t2 VALUES (1, "", 1);
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
Comparing tables master:test.t2 and slave:test.t2
-[expecting slave to stop]
-INSERT INTO t3 VALUES (1, "", 1);
-INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
-Last_SQL_Error
-Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -501,7 +499,7 @@ Comparing tables master:test.t4 and slave:test.t4
INSERT INTO t5 VALUES (1, "", 1);
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
Last_SQL_Error
-Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.
+Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)'
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -510,7 +508,7 @@ START SLAVE;
INSERT INTO t6 VALUES (1, "", 1);
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
Last_SQL_Error
-Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.
+Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)'
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result
index d6c57aed41b..6c9e20fd56a 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result
@@ -29,16 +29,16 @@ a b
DROP TABLE t1;
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
-master-bin.000001 223 Query 1 287 BEGIN
-master-bin.000001 287 Table_map 1 330 table_id: # (test.t1)
-master-bin.000001 330 Table_map 1 392 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 392 Write_rows 1 451 table_id: #
-master-bin.000001 451 Write_rows 1 498 table_id: # flags: STMT_END_F
-master-bin.000001 498 Query 1 563 COMMIT
-master-bin.000001 563 Query 1 643 use `test`; TRUNCATE TABLE t1
-master-bin.000001 643 Query 1 719 use `test`; DROP TABLE t1
+master-bin.000001 4 Format_desc 1 107 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 107 Query 1 224 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 224 Query 1 288 BEGIN
+master-bin.000001 288 Table_map 1 331 table_id: # (test.t1)
+master-bin.000001 331 Table_map 1 393 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 393 Write_rows 1 452 table_id: #
+master-bin.000001 452 Write_rows 1 499 table_id: # flags: STMT_END_F
+master-bin.000001 499 Query 1 564 COMMIT
+master-bin.000001 564 Query 1 644 use `test`; TRUNCATE TABLE t1
+master-bin.000001 644 Query 1 720 use `test`; DROP TABLE t1
**** On Master ****
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
INSERT INTO t1 VALUES (1,1), (2,2);
@@ -65,27 +65,27 @@ a b
DROP TABLE t1;
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
-master-bin.000001 223 Query 1 287 BEGIN
-master-bin.000001 287 Table_map 1 330 table_id: # (test.t1)
-master-bin.000001 330 Table_map 1 392 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 392 Write_rows 1 451 table_id: #
-master-bin.000001 451 Write_rows 1 498 table_id: # flags: STMT_END_F
-master-bin.000001 498 Query 1 563 COMMIT
-master-bin.000001 563 Query 1 643 use `test`; TRUNCATE TABLE t1
-master-bin.000001 643 Query 1 719 use `test`; DROP TABLE t1
-master-bin.000001 719 Query 1 836 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
-master-bin.000001 836 Query 1 900 BEGIN
-master-bin.000001 900 Table_map 1 943 table_id: # (test.t1)
-master-bin.000001 943 Table_map 1 1005 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 1005 Write_rows 1 1064 table_id: #
-master-bin.000001 1064 Write_rows 1 1111 table_id: # flags: STMT_END_F
-master-bin.000001 1111 Query 1 1176 COMMIT
-master-bin.000001 1176 Query 1 1240 BEGIN
-master-bin.000001 1240 Table_map 1 1283 table_id: # (test.t1)
-master-bin.000001 1283 Table_map 1 1345 table_id: # (mysql.ndb_apply_status)
-master-bin.000001 1345 Write_rows 1 1404 table_id: #
-master-bin.000001 1404 Delete_rows 1 1443 table_id: # flags: STMT_END_F
-master-bin.000001 1443 Query 1 1508 COMMIT
-master-bin.000001 1508 Query 1 1584 use `test`; DROP TABLE t1
+master-bin.000001 4 Format_desc 1 107 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 107 Query 1 224 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 224 Query 1 288 BEGIN
+master-bin.000001 288 Table_map 1 331 table_id: # (test.t1)
+master-bin.000001 331 Table_map 1 393 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 393 Write_rows 1 452 table_id: #
+master-bin.000001 452 Write_rows 1 499 table_id: # flags: STMT_END_F
+master-bin.000001 499 Query 1 564 COMMIT
+master-bin.000001 564 Query 1 644 use `test`; TRUNCATE TABLE t1
+master-bin.000001 644 Query 1 720 use `test`; DROP TABLE t1
+master-bin.000001 720 Query 1 837 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 837 Query 1 901 BEGIN
+master-bin.000001 901 Table_map 1 944 table_id: # (test.t1)
+master-bin.000001 944 Table_map 1 1006 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 1006 Write_rows 1 1065 table_id: #
+master-bin.000001 1065 Write_rows 1 1112 table_id: # flags: STMT_END_F
+master-bin.000001 1112 Query 1 1177 COMMIT
+master-bin.000001 1177 Query 1 1241 BEGIN
+master-bin.000001 1241 Table_map 1 1284 table_id: # (test.t1)
+master-bin.000001 1284 Table_map 1 1346 table_id: # (mysql.ndb_apply_status)
+master-bin.000001 1346 Write_rows 1 1405 table_id: #
+master-bin.000001 1405 Delete_rows 1 1444 table_id: # flags: STMT_END_F
+master-bin.000001 1444 Query 1 1509 COMMIT
+master-bin.000001 1509 Query 1 1585 use `test`; DROP TABLE t1
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf
index b1b010ef0f3..58f8555afd1 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf
@@ -15,11 +15,6 @@ skip-slave-start
[mysqld.2.slave]
server-id= 2
-master-host= 127.0.0.1
-master-port= @mysqld.2.1.port
-master-password= @mysqld.2.1.#password
-master-user= @mysqld.2.1.#user
-master-connect-retry= 1
init-rpl-role= slave
log-bin
skip-slave-start
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt
new file mode 100644
index 00000000000..b74354b22e1
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt
@@ -0,0 +1 @@
+--innodb --ndbcluster
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt
new file mode 100644
index 00000000000..bbb86b2991b
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt
@@ -0,0 +1 @@
+--innodb --ndbcluster --replicate-ignore-table=mysql.ndb_apply_status
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test
new file mode 100644
index 00000000000..a20e42f1b24
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test
@@ -0,0 +1,373 @@
+# ==== Purpose ====
+#
+# Test replication of transactions on tables which have different
+# engines on master and slave. This tests all combinations of innodb,
+# myisam, and ndb.
+#
+# ==== Method ====
+#
+# Set up six tables, each being innodb, myisam, or innodb on master,
+# and another of innodb, myisam, or innodb on slave. For each table,
+# do the following:
+#
+# - committed and rollback'ed transactions, with autocommit on and
+# off
+# - non-transactions with autocommit on
+# - non-transactions with autocommit off, where the master table is
+# myisam.
+#
+# Note: we are running the slave with
+# --replicate-ignore-table=mysql.ndb_apply_status . See BUG#34557 for
+# explanation.
+#
+# ==== Related bugs ====
+#
+# BUG#26395: if crash during autocommit update to transactional table on master, slave fails
+# BUG#29288: myisam transactions replicated to a transactional slave leaves slave unstable
+# BUG#34557: Row-based replication from ndb to non-ndb gives error on slave
+# BUG#34600: Rolled-back punch transactions not replicated correctly
+#
+# ==== Todo ====
+#
+# We should eventually try transactions touching two tables which are
+# of different engines on the same server (so that we try, e.g. punch
+# transactions; cf BUG#34600). However, that will make the test much
+# bigger (9 master-slave engine combinations [myisam->myisam,
+# myisam->ndb, etc]. To try all combinations of one or more such
+# tables means 2^9-1=511 transactions. We need to multiplied by 5
+# since we want to test committed/rollback'ed transactions
+# with/without AUTOCOMMIT, as well as non-transactions with
+# autocommit). We'd have to write a script to produce the test case.
+
+
+--echo ==== Initialization ====
+
+--source include/have_ndb.inc
+--source include/have_innodb.inc
+--source include/ndb_master-slave.inc
+
+--echo ---- setup master ----
+
+CREATE TABLE myisam_innodb (a INT) ENGINE=MYISAM;
+CREATE TABLE innodb_myisam (a INT) ENGINE=INNODB;
+CREATE TABLE myisam_ndb (a INT) ENGINE=MYISAM;
+CREATE TABLE ndb_myisam (a INT) ENGINE=NDB;
+CREATE TABLE innodb_ndb (a INT) ENGINE=INNODB;
+CREATE TABLE ndb_innodb (a INT) ENGINE=NDB;
+
+SHOW CREATE TABLE myisam_innodb;
+SHOW CREATE TABLE innodb_myisam;
+SHOW CREATE TABLE myisam_ndb;
+SHOW CREATE TABLE ndb_myisam;
+SHOW CREATE TABLE innodb_ndb;
+SHOW CREATE TABLE ndb_innodb;
+
+--echo ---- setup slave with different engines ----
+
+sync_slave_with_master;
+
+DROP TABLE myisam_innodb, innodb_myisam;
+DROP TABLE myisam_ndb, ndb_myisam;
+DROP TABLE innodb_ndb, ndb_innodb;
+
+CREATE TABLE myisam_innodb (a INT) ENGINE=INNODB;
+CREATE TABLE innodb_myisam (a INT) ENGINE=MYISAM;
+CREATE TABLE myisam_ndb (a INT) ENGINE=NDB;
+CREATE TABLE ndb_myisam (a INT) ENGINE=MYISAM;
+CREATE TABLE innodb_ndb (a INT) ENGINE=NDB;
+CREATE TABLE ndb_innodb (a INT) ENGINE=INNODB;
+
+SHOW CREATE TABLE myisam_innodb;
+SHOW CREATE TABLE innodb_myisam;
+SHOW CREATE TABLE myisam_ndb;
+SHOW CREATE TABLE ndb_myisam;
+SHOW CREATE TABLE innodb_ndb;
+SHOW CREATE TABLE ndb_innodb;
+
+connection master;
+
+
+--echo ==== AUTOCOMMIT=0, transactions ====
+
+--echo ---- COMMIT ----
+
+SET AUTOCOMMIT = 0;
+
+BEGIN;
+INSERT INTO myisam_innodb VALUES (1);
+INSERT INTO myisam_innodb VALUES (2);
+COMMIT;
+sync_slave_with_master;
+connection master;
+BEGIN;
+INSERT INTO innodb_myisam VALUES (3);
+INSERT INTO innodb_myisam VALUES (4);
+COMMIT;
+sync_slave_with_master;
+connection master;
+
+BEGIN;
+INSERT INTO myisam_ndb VALUES (5);
+INSERT INTO myisam_ndb VALUES (6);
+COMMIT;
+sync_slave_with_master;
+connection master;
+BEGIN;
+INSERT INTO ndb_myisam VALUES (7);
+INSERT INTO ndb_myisam VALUES (8);
+COMMIT;
+sync_slave_with_master;
+connection master;
+
+BEGIN;
+INSERT INTO ndb_innodb VALUES (9);
+INSERT INTO ndb_innodb VALUES (10);
+COMMIT;
+sync_slave_with_master;
+connection master;
+BEGIN;
+INSERT INTO innodb_ndb VALUES (11);
+INSERT INTO innodb_ndb VALUES (12);
+COMMIT;
+sync_slave_with_master;
+connection master;
+
+--echo ---- ROLLBACK ----
+
+# This test does not work in ROW mode after the changes introduced in
+# BUG#40116. After WL#2687 is pushed, Tests should be added again.
+--disable_parsing
+BEGIN;
+INSERT INTO myisam_innodb VALUES (13);
+INSERT INTO myisam_innodb VALUES (14);
+ROLLBACK;
+sync_slave_with_master;
+--enable_parsing
+connection master;
+BEGIN;
+INSERT INTO innodb_myisam VALUES (15);
+INSERT INTO innodb_myisam VALUES (16);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+
+# This test does not work in ROW mode after the changes introduced in
+# BUG#40116. After WL#2687 is pushed, these tests should be enabled
+# again.
+--disable_parsing
+BEGIN;
+INSERT INTO myisam_ndb VALUES (17);
+INSERT INTO myisam_ndb VALUES (18);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+--enable_parsing
+BEGIN;
+INSERT INTO ndb_myisam VALUES (19);
+INSERT INTO ndb_myisam VALUES (20);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+
+BEGIN;
+INSERT INTO ndb_innodb VALUES (21);
+INSERT INTO ndb_innodb VALUES (22);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+BEGIN;
+INSERT INTO innodb_ndb VALUES (23);
+INSERT INTO innodb_ndb VALUES (24);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+
+
+--echo ==== AUTOCOMMIT=1, transactions ====
+
+--echo ---- COMMIT ----
+
+SET AUTOCOMMIT = 1;
+
+BEGIN;
+INSERT INTO myisam_innodb VALUES (25);
+INSERT INTO myisam_innodb VALUES (26);
+COMMIT;
+sync_slave_with_master;
+connection master;
+BEGIN;
+INSERT INTO innodb_myisam VALUES (27);
+INSERT INTO innodb_myisam VALUES (28);
+COMMIT;
+sync_slave_with_master;
+connection master;
+
+BEGIN;
+INSERT INTO myisam_ndb VALUES (29);
+INSERT INTO myisam_ndb VALUES (30);
+COMMIT;
+sync_slave_with_master;
+connection master;
+BEGIN;
+INSERT INTO ndb_myisam VALUES (31);
+INSERT INTO ndb_myisam VALUES (32);
+COMMIT;
+sync_slave_with_master;
+connection master;
+
+BEGIN;
+INSERT INTO ndb_innodb VALUES (33);
+INSERT INTO ndb_innodb VALUES (34);
+COMMIT;
+sync_slave_with_master;
+connection master;
+BEGIN;
+INSERT INTO innodb_ndb VALUES (35);
+INSERT INTO innodb_ndb VALUES (36);
+COMMIT;
+sync_slave_with_master;
+connection master;
+
+--echo ---- ROLLBACK ----
+
+# This test does not work in ROW mode after the changes introduced in
+# BUG#40116. After WL#2687 is pushed, these tests should be enabled
+# again.
+--disable_parsing
+BEGIN;
+INSERT INTO myisam_innodb VALUES (37);
+INSERT INTO myisam_innodb VALUES (38);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+--enable_parsing
+BEGIN;
+INSERT INTO innodb_myisam VALUES (39);
+INSERT INTO innodb_myisam VALUES (40);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+
+# This test does not work in ROW mode after the changes introduced in
+# BUG#40116. After WL#2687 is pushed, these tests should be enabled
+# again.
+--disable_parsing
+BEGIN;
+INSERT INTO myisam_ndb VALUES (41);
+INSERT INTO myisam_ndb VALUES (42);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+--enable_parsing
+BEGIN;
+INSERT INTO ndb_myisam VALUES (43);
+INSERT INTO ndb_myisam VALUES (44);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+
+BEGIN;
+INSERT INTO ndb_innodb VALUES (45);
+INSERT INTO ndb_innodb VALUES (46);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+BEGIN;
+INSERT INTO innodb_ndb VALUES (47);
+INSERT INTO innodb_ndb VALUES (48);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+
+
+--echo ==== AUTOCOMMIT=1, single statements ====
+
+INSERT INTO myisam_innodb VALUES (49);
+INSERT INTO myisam_innodb VALUES (50);
+sync_slave_with_master;
+connection master;
+INSERT INTO innodb_myisam VALUES (51);
+INSERT INTO innodb_myisam VALUES (52);
+sync_slave_with_master;
+connection master;
+
+INSERT INTO myisam_ndb VALUES (53);
+INSERT INTO myisam_ndb VALUES (54);
+sync_slave_with_master;
+connection master;
+INSERT INTO ndb_myisam VALUES (55);
+INSERT INTO ndb_myisam VALUES (56);
+sync_slave_with_master;
+connection master;
+
+INSERT INTO ndb_innodb VALUES (57);
+INSERT INTO ndb_innodb VALUES (58);
+sync_slave_with_master;
+connection master;
+INSERT INTO innodb_ndb VALUES (59);
+INSERT INTO innodb_ndb VALUES (60);
+sync_slave_with_master;
+connection master;
+
+
+--echo ==== AUTOCOMMIT=0, single statements, myisam on master ====
+
+SET AUTOCOMMIT = 0;
+
+# These tests do not work in ROW mode after the changes introduced in
+# BUG#40116. After WL#2687 is pushed, these tests should be enabled
+# again.
+--disable_parsing
+# This tests BUG#29288.
+INSERT INTO myisam_innodb VALUES (61);
+INSERT INTO myisam_innodb VALUES (62);
+sync_slave_with_master;
+connection master;
+
+INSERT INTO myisam_ndb VALUES (63);
+INSERT INTO myisam_ndb VALUES (64);
+sync_slave_with_master;
+connection master;
+--enable_parsing
+
+
+--echo ==== Show results ====
+
+SELECT * FROM myisam_innodb ORDER BY a;
+SELECT * FROM innodb_myisam ORDER BY a;
+SELECT * FROM myisam_ndb ORDER BY a;
+SELECT * FROM ndb_myisam ORDER BY a;
+SELECT * FROM innodb_ndb ORDER BY a;
+SELECT * FROM ndb_innodb ORDER BY a;
+
+let $diff_table_1=master:test.myisam_innodb;
+let $diff_table_2=slave:test.myisam_innodb;
+source include/diff_tables.inc;
+
+let $diff_table_1=master:test.innodb_myisam;
+let $diff_table_2=slave:test.innodb_myisam;
+source include/diff_tables.inc;
+
+let $diff_table_1=master:test.myisam_ndb;
+let $diff_table_2=slave:test.myisam_ndb;
+source include/diff_tables.inc;
+
+let $diff_table_1=master:test.ndb_myisam;
+let $diff_table_2=slave:test.ndb_myisam;
+source include/diff_tables.inc;
+
+let $diff_table_1=master:test.innodb_ndb;
+let $diff_table_2=slave:test.innodb_ndb;
+source include/diff_tables.inc;
+
+let $diff_table_1=master:test.ndb_innodb;
+let $diff_table_2=slave:test.ndb_innodb;
+source include/diff_tables.inc;
+
+
+--echo ==== Clean up ====
+
+drop table myisam_innodb, innodb_myisam;
+drop table myisam_ndb, ndb_myisam;
+drop table innodb_ndb, ndb_innodb;
+sync_slave_with_master;
diff --git a/mysql-test/suite/sys_vars/r/read_only_func.result b/mysql-test/suite/sys_vars/r/read_only_func.result
index 35b42d468d6..7e98b7adc50 100644
--- a/mysql-test/suite/sys_vars/r/read_only_func.result
+++ b/mysql-test/suite/sys_vars/r/read_only_func.result
@@ -20,7 +20,7 @@ id name
CREATE user sameea;
** Connecting connn using username 'sameea' **
SET Global read_ONLY=ON;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
CREATE TABLE t2
(
id INT NOT NULL auto_increment,
diff --git a/mysql-test/t/backup-master.sh b/mysql-test/t/backup-master.sh
deleted file mode 100755
index c099064f6b7..00000000000
--- a/mysql-test/t/backup-master.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-if [ "$MYSQL_TEST_DIR" ]
-then
- rm -f $MYSQLTEST_VARDIR/tmp/*.frm $MYSQLTEST_VARDIR/tmp/*.MY?
-fi
diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test
deleted file mode 100644
index c761f48cbcb..00000000000
--- a/mysql-test/t/backup.test
+++ /dev/null
@@ -1,104 +0,0 @@
-
-# The server need to be started in $MYSQLTEST_VARDIR since it
-# uses ../../std_data/
---source include/uses_vardir.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-#
-# This test is a bit tricky as we can't use backup table to overwrite an old
-# table
-#
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connection con1;
-set SQL_LOG_BIN=0;
---disable_warnings
-drop table if exists t1, t2, t3, t4;
---enable_warnings
-create table t4(n int);
---replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-backup table t4 to '../../bogus';
-backup table t4 to '../../tmp';
---replace_result ": 7" ": X" ": 17" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-backup table t4 to '../../tmp';
-drop table t4;
-restore table t4 from '../../tmp';
-select count(*) from t4;
-
-create table t1(n int);
-insert into t1 values (23),(45),(67);
-backup table t1 to '../../tmp';
-drop table t1;
---replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-restore table t1 from '../../bogus';
-restore table t1 from '../../tmp';
-select n from t1;
-create table t2(m int not null primary key);
-create table t3(k int not null primary key);
-insert into t2 values (123),(145),(167);
-insert into t3 values (223),(245),(267);
-backup table t2,t3 to '../../tmp';
-drop table t1,t2,t3;
-restore table t1,t2,t3 from '../../tmp';
-select n from t1;
-select m from t2;
-select k from t3;
-drop table t1,t2,t3,t4;
-restore table t1 from '../../tmp';
-connection con2;
-rename table t1 to t5;
---send
-lock tables t5 write;
-connection con1;
---send
-backup table t5 to '../../tmp';
-connection con2;
-reap;
-unlock tables;
-connection con1;
-reap;
-drop table t5;
-connection default;
-disconnect con1;
-disconnect con2;
-remove_file $MYSQLTEST_VARDIR/tmp/t1.MYD;
-remove_file $MYSQLTEST_VARDIR/tmp/t2.MYD;
-remove_file $MYSQLTEST_VARDIR/tmp/t3.MYD;
-remove_file $MYSQLTEST_VARDIR/tmp/t4.MYD;
-remove_file $MYSQLTEST_VARDIR/tmp/t5.MYD;
-remove_file $MYSQLTEST_VARDIR/tmp/t1.frm;
-remove_file $MYSQLTEST_VARDIR/tmp/t2.frm;
-remove_file $MYSQLTEST_VARDIR/tmp/t3.frm;
-remove_file $MYSQLTEST_VARDIR/tmp/t4.frm;
-remove_file $MYSQLTEST_VARDIR/tmp/t5.frm;
-
-
-# End of 4.1 tests
-# End of 5.0 tests
-
-#
-# Bug#18775 - Temporary table from alter table visible to other threads
-#
-# Backup did not encode table names.
---disable_warnings
-DROP TABLE IF EXISTS `t+1`;
---enable_warnings
-CREATE TABLE `t+1` (c1 INT);
-INSERT INTO `t+1` VALUES (1), (2), (3);
-BACKUP TABLE `t+1` TO '../../tmp';
-DROP TABLE `t+1`;
-#
-# Same for restore.
-RESTORE TABLE `t+1` FROM '../../tmp';
-SELECT * FROM `t+1`;
-DROP TABLE `t+1`;
-#
-remove_file $MYSQLTEST_VARDIR/tmp/t@002b1.frm;
-remove_file $MYSQLTEST_VARDIR/tmp/t@002b1.MYD;
-
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test
index 89df33a6df5..af6e6baf92a 100644
--- a/mysql-test/t/ctype_cp932_binlog_stm.test
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
@@ -22,18 +22,18 @@ CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
SELECT HEX(s1),HEX(s2),d FROM t4|
DROP PROCEDURE bug18293|
DROP TABLE t4|
-SHOW BINLOG EVENTS FROM 370|
+SHOW BINLOG EVENTS FROM 371|
delimiter ;|
--echo End of 5.0 tests
#
# #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump
-# Note: 364 is a magic position (found experimentally, depends on
+# Note: 365 is a magic position (found experimentally, depends on
# the log's contents) that caused the server crash.
--error 1220
-SHOW BINLOG EVENTS FROM 365;
+SHOW BINLOG EVENTS FROM 366;
--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;
diff --git a/mysql-test/t/deprecated_features.test b/mysql-test/t/deprecated_features.test
new file mode 100644
index 00000000000..002f4ad1122
--- /dev/null
+++ b/mysql-test/t/deprecated_features.test
@@ -0,0 +1,27 @@
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+set global log_bin_trust_routine_creators=1;
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+set table_type='MyISAM';
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+select @@table_type='MyISAM';
+--error ER_PARSE_ERROR
+backup table t1 to 'data.txt';
+--error ER_PARSE_ERROR
+restore table t1 from 'data.txt';
+--error ER_PARSE_ERROR
+show plugin;
+--error ER_PARSE_ERROR
+load table t1 from master;
+--error ER_PARSE_ERROR
+load data from master;
+--error ER_PARSE_ERROR
+SHOW INNODB STATUS;
+--error ER_PARSE_ERROR
+create table t1 (t6 timestamp(6));
+--error ER_PARSE_ERROR
+create table t1 (t6 timestamp) type=myisam;
+--error ER_PARSE_ERROR
+show table types;
+--error ER_PARSE_ERROR
+show mutex status;
+
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 78661b1bbc4..1e5ce4cb0e1 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -71,8 +71,7 @@ select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=330 $MYSQLD_DATADIR/master-bin.000002
-
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=331 $MYSQLD_DATADIR/master-bin.000002
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -108,7 +107,7 @@ select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=330 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=331 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 mysqlbinlog does not accept input from stdin
--disable_query_log
@@ -443,3 +442,27 @@ FLUSH LOGS;
--echo End of 5.0 tests
--echo End of 5.1 tests
+
+#
+# BUG#38468 Memory leak detected when using mysqlbinlog utility;
+#
+disable_query_log;
+RESET MASTER;
+CREATE TABLE t1 SELECT 1;
+FLUSH LOGS;
+DROP TABLE t1;
+enable_query_log;
+
+# Write an empty file for comparison
+write_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
+EOF
+
+# Before fix of BUG#38468, this would generate some warnings
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 >/dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
+
+# Make sure the command above does not generate any error or warnings
+diff_files $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
+
+# Cleanup for this part of test
+remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
+remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn;
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
index d6be029ea56..6089b83e42d 100644
--- a/mysql-test/t/mysqlbinlog2.test
+++ b/mysql-test/t/mysqlbinlog2.test
@@ -50,15 +50,15 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=609 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=609 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start and stop positions ---" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=609 --stop-position 726 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -84,11 +84,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=609 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=135 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -111,15 +111,15 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start and stop positions ---" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=609 --stop-position 726 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -142,11 +142,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=134 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index 387b3ebdd05..b9e84d8d7df 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -458,9 +458,6 @@ prepare stmt1 from ' analyze table t1 ' ;
prepare stmt1 from ' checksum table t1 ' ;
prepare stmt1 from ' repair table t1 ' ;
---replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
---error ER_UNSUPPORTED_PS
-eval prepare stmt1 from ' restore table t1 from ''$datafile'' ' ;
--remove_file $datafile
## handler
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 0ce807ae73e..9a984a0b8c9 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -630,7 +630,6 @@ show columns in t1;
show slave hosts;
show keys in t1;
show column types;
-show table types;
show storage engines;
show authors;
show contributors;
@@ -1009,11 +1008,6 @@ disconnect con4;
#
--disable_result_log
-show full plugin;
---enable_result_log
-show warnings;
---disable_result_log
-show plugin;
show plugins;
--enable_result_log
@@ -1181,14 +1175,6 @@ DROP TABLE t1;
DROP EVENT ev1;
#
-# Bug#30036 SHOW TABLE TYPES causes the debug client to crash
-#
---disable_result_log
-SHOW TABLE TYPES;
---enable_result_log
-
-
-#
# Bug#32710 SHOW INNODB STATUS requires SUPER
#
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 18a4a117939..f61088086b9 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -1325,11 +1325,6 @@ CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DROP TRIGGER test1; EN
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
CREATE FUNCTION bug_13627_f() returns int BEGIN DROP TRIGGER test1; return 1; END |
--- error ER_SP_BADSTATEMENT
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN load table t1 from master; END |
--- error ER_SP_BADSTATEMENT
-CREATE FUNCTION bug_13627_f() returns int BEGIN load table t1 from master; return 1; END |
-
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create table t2 (a int); END |
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
@@ -1580,18 +1575,6 @@ BEGIN
REPAIR TABLE t1;
RETURN 1;
END|
---error ER_SP_NO_RETSET
-CREATE FUNCTION bug13012() RETURNS INT
-BEGIN
- BACKUP TABLE t1 TO '/tmp';
- RETURN 1;
-END|
---error ER_SP_NO_RETSET
-CREATE FUNCTION bug13012() RETURNS INT
-BEGIN
- RESTORE TABLE t1 FROM '/tmp';
- RETURN 1;
-END|
create table t1 (a int)|
CREATE PROCEDURE bug13012_1() REPAIR TABLE t1|
CREATE FUNCTION bug13012_2() RETURNS INT
@@ -2386,7 +2369,7 @@ drop procedure if exists p1;
delimiter |;
create procedure p1()
begin
- create table t1 (a int) type=MyISAM;
+ create table t1 (a int) engine=MyISAM;
drop table t1;
end|
delimiter ;|
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 73ba62612b8..2b7e89c106b 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -5208,20 +5208,15 @@ drop procedure bug5967|
--disable_warnings
drop procedure if exists bug13012|
+--enable_warnings
# Disable warnings also for BACKUP/RESTORE: they are deprecated.
---replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval create procedure bug13012()
BEGIN
REPAIR TABLE t1;
- BACKUP TABLE t1 to '$backupdir';
- DROP TABLE t1;
- RESTORE TABLE t1 FROM '$backupdir';
END|
call bug13012()|
--enable_warnings
---remove_file $backupdir/t1.frm
---remove_file $backupdir/t1.MYD
drop procedure bug13012|
diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test
index 0b04b9d7668..cc1d6b8803f 100644
--- a/mysql-test/t/sp_trans.test
+++ b/mysql-test/t/sp_trans.test
@@ -565,7 +565,7 @@ use db_bug7787|
# Test.
CREATE PROCEDURE p1()
- SHOW INNODB STATUS; |
+ SHOW ENGINE INNODB STATUS; |
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost|
diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test
index 2f2b84a9bef..68467f71ee1 100644
--- a/mysql-test/t/sp_trans_log.test
+++ b/mysql-test/t/sp_trans_log.test
@@ -35,7 +35,8 @@ reset master|
--error ER_DUP_ENTRY
insert into t2 values (bug23333(),1)|
--replace_column 2 # 5 # 6 #
-show binlog events from 106 /* with fixes for #23333 will show there is the query */|
+# the following must show there is (are) events after the query */
+source include/show_binlog_events.inc|
select count(*),@a from t1 /* must be 1,1 */|
delimiter ;|
diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test
index 440fcc8aa8a..818993e5f27 100644
--- a/mysql-test/t/system_mysql_db_fix40123.test
+++ b/mysql-test/t/system_mysql_db_fix40123.test
@@ -26,7 +26,7 @@ use test;
# create system tables as in mysql-4.1.23
# created by executing "./mysql_create_system_tables real ."
-set table_type=myisam;
+set storage_engine=myisam;
CREATE TABLE db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
@@ -41,8 +41,8 @@ INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','
CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
-CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
-CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
+CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
+CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
CREATE TABLE help_topic ( help_topic_id int unsigned not null, name varchar(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url varchar(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
CREATE TABLE help_category ( help_category_id smallint unsigned not null, name varchar(64) not null, parent_category_id smallint unsigned null, url varchar(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories';
diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test
index 4924c625d57..45084177570 100644
--- a/mysql-test/t/system_mysql_db_fix50030.test
+++ b/mysql-test/t/system_mysql_db_fix50030.test
@@ -26,7 +26,7 @@ use test;
# create system tables as in mysql-5.0.30
# created by executing "./mysql_create_system_tables real ."
-set table_type=myisam;
+set storage_engine=myisam;
CREATE TABLE db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
@@ -39,9 +39,9 @@ INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','
CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
-CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
+CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
-CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
+CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
CREATE TABLE help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
CREATE TABLE help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url char(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories';
@@ -60,7 +60,7 @@ CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL,
CREATE TABLE proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob DEFAULT '' NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob DEFAULT '' NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures';
-CREATE TABLE procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
+CREATE TABLE procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
CREATE TABLE servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test
index d88c4edba93..bed00239081 100644
--- a/mysql-test/t/system_mysql_db_fix50117.test
+++ b/mysql-test/t/system_mysql_db_fix50117.test
@@ -44,9 +44,9 @@ CREATE TABLE IF NOT EXISTS plugin ( name char(64) binary DEFAULT '' NOT NULL, dl
CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
-CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
+CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
-CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
+CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
@@ -79,7 +79,7 @@ CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint sign
CREATE TABLE IF NOT EXISTS proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures';
-CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
+CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index 460da1c1614..17ffade5f63 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -534,18 +534,6 @@ DROP TABLE b15776;
--error ER_PARSE_ERROR
CREATE TABLE b15776 (a year(-2));
-## For timestamp, we silently rewrite widths to 14 or 19.
-CREATE TABLE b15776 (a timestamp(4294967294));
-DROP TABLE b15776;
-CREATE TABLE b15776 (a timestamp(4294967295));
-DROP TABLE b15776;
---error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a timestamp(4294967296));
---error ER_PARSE_ERROR
-CREATE TABLE b15776 (a timestamp(-1));
---error ER_PARSE_ERROR
-CREATE TABLE b15776 (a timestamp(-2));
-
# We've already tested the case, but this should visually show that
# widths that are too large to be interpreted cause DISPLAYWIDTH errors.
@@ -555,8 +543,6 @@ CREATE TABLE b15776 (a int(99999999999999999999999999999999999999999999999999999
CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
--error ER_TOO_BIG_DISPLAYWIDTH
CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
---error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a timestamp(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
## Do not select, too much memory needed.
CREATE TABLE b15776 select cast(null as char(4294967295));
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index e8374e0ebfc..2a49e0def1a 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -67,17 +67,6 @@ INSERT INTO t1 VALUES ("2030-01-01","2030-01-01 00:00:00",20300101000000);
SELECT * FROM t1;
drop table t1;
-create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
- t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
- t14 timestamp(14));
-insert t1 values (0,0,0,0,0,0,0),
-("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
-"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
-"1997-12-31 23:47:59");
-select * from t1;
-select * from t1;
-drop table t1;
-
#
# Let us check if we properly treat wrong datetimes and produce proper warnings
# (for both strings and numbers)
@@ -298,7 +287,7 @@ drop table t1;
# mode regardless of whether a display width is given.
#
set sql_mode='maxdb';
-create table t1 (a timestamp, b timestamp(19));
+create table t1 (a timestamp, b timestamp);
show create table t1;
# restore default mode
set sql_mode='';
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
index 176f320e390..98e1db62d84 100644
--- a/mysql-test/t/warnings.test
+++ b/mysql-test/t/warnings.test
@@ -112,11 +112,6 @@ show variables like 'max_error_count';
drop table t1;
#
-# Test for deprecated table_type variable
-#
-set table_type=MYISAM;
-
-#
# Tests for show warnings limit a, b
#
create table t1 (a int);
diff --git a/mysys/default.c b/mysys/default.c
index 1c021b4584f..6468cf2b35d 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -41,6 +41,29 @@
#include <winbase.h>
#endif
+/**
+ arguments separator
+
+ load_defaults() loads arguments from config file and put them
+ before the arguments from command line, this separator is used to
+ separate the arguments loaded from config file and arguments user
+ provided on command line.
+
+ Options with value loaded from config file are always in the form
+ '--option=value', while for command line options, the value can be
+ given as the next argument. Thus we used a separator so that
+ handle_options() can distinguish them.
+
+ Note: any other places that does not need to distinguish them
+ should skip the separator.
+
+ The content of arguments separator does not matter, one should only
+ check the pointer, use "----args-separator----" here to ease debug
+ if someone misused it.
+
+ See BUG#25192
+*/
+const char *args_separator= "----args-separator----";
const char *my_defaults_file=0;
const char *my_defaults_group_suffix=0;
char *my_defaults_extra_file=0;
@@ -454,10 +477,11 @@ int my_load_defaults(const char *conf_file, const char **groups,
goto err;
res= (char**) (ptr+sizeof(alloc));
res[0]= **argv; /* Copy program name */
+ /* set arguments separator */
+ res[1]= (char *)args_separator;
for (i=2 ; i < (uint) *argc ; i++)
- res[i-1]=argv[0][i];
- res[i-1]=0; /* End pointer */
- (*argc)--;
+ res[i]=argv[0][i];
+ res[i]=0; /* End pointer */
*argv=res;
*(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
if (default_directories)
@@ -487,7 +511,7 @@ int my_load_defaults(const char *conf_file, const char **groups,
or a forced default file
*/
if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+
- (args.elements + *argc +1) *sizeof(char*))))
+ (args.elements + *argc + 1 + 1) *sizeof(char*))))
goto err;
res= (char**) (ptr+sizeof(alloc));
@@ -508,12 +532,16 @@ int my_load_defaults(const char *conf_file, const char **groups,
--*argc; ++*argv; /* skip argument */
}
+ /* set arguments separator for arguments from config file and
+ command line */
+ res[args.elements+1]= (char *)args_separator;
+
if (*argc)
- memcpy((uchar*) (res+1+args.elements), (char*) ((*argv)+1),
+ memcpy((uchar*) (res+1+args.elements+1), (char*) ((*argv)+1),
(*argc-1)*sizeof(char*));
- res[args.elements+ *argc]=0; /* last null */
+ res[args.elements+ *argc+1]=0; /* last null */
- (*argc)+=args.elements;
+ (*argc)+=args.elements+1;
*argv= (char**) res;
*(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
delete_dynamic(&args);
@@ -523,7 +551,8 @@ int my_load_defaults(const char *conf_file, const char **groups,
printf("%s would have been started with the following arguments:\n",
**argv);
for (i=1 ; i < *argc ; i++)
- printf("%s ", (*argv)[i]);
+ if ((*argv)[i] != args_separator) /* skip arguments separator */
+ printf("%s ", (*argv)[i]);
puts("");
exit(0);
}
diff --git a/mysys/my_delete.c b/mysys/my_delete.c
index 22425ed95fd..474f785e0d5 100644
--- a/mysys/my_delete.c
+++ b/mysys/my_delete.c
@@ -37,7 +37,7 @@ int my_delete(const char *name, myf MyFlags)
} /* my_delete */
#if defined(__WIN__) && defined(__NT__)
-/*
+/**
Delete file which is possibly not closed.
This function is intended to be used exclusively as a temporal solution
@@ -53,6 +53,20 @@ int my_delete(const char *name, myf MyFlags)
renamed to <name>.<num>.deleted where <name> - the initial name of the
file, <num> - a hexadecimal number chosen to make the temporal name to
be unique.
+
+ @param the name of the being deleted file
+ @param the flags instructing how to react on an error internally in
+ the function
+
+ @note The per-thread @c my_errno holds additional info for a caller to
+ decide how critical the error can be.
+
+ @retval
+ 0 ok
+ @retval
+ 1 error
+
+
*/
int nt_share_delete(const char *name, myf MyFlags)
{
@@ -63,6 +77,7 @@ int nt_share_delete(const char *name, myf MyFlags)
for (cnt= GetTickCount(); cnt; cnt--)
{
+ errno= 0;
sprintf(buf, "%s.%08X.deleted", name, cnt);
if (MoveFile(name, buf))
break;
@@ -78,15 +93,23 @@ int nt_share_delete(const char *name, myf MyFlags)
name, buf, errno));
break;
}
-
- if (DeleteFile(buf))
- DBUG_RETURN(0);
-
- my_errno= GetLastError();
+
+ if (errno == ERROR_FILE_NOT_FOUND)
+ {
+ my_errno= ENOENT; // marking, that `name' doesn't exist
+ }
+ else if (errno == 0)
+ {
+ if (DeleteFile(buf))
+ DBUG_RETURN(0);
+ else if ((my_errno= GetLastError()) == 0)
+ my_errno= ENOENT; // marking, that `buf' doesn't exist
+ } else
+ my_errno= errno;
+
if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
- name, my_errno);
-
+ my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
+ name, my_errno);
DBUG_RETURN(-1);
}
#endif
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index e561d74f4d1..d24f328cdf0 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -121,6 +121,7 @@ int handle_options(int *argc, char ***argv,
const struct my_option *optp;
uchar* *value;
int error, i;
+ my_bool is_cmdline_arg= 1;
LINT_INIT(opt_found);
/* handle_options() assumes arg0 (program name) always exists */
@@ -130,10 +131,34 @@ int handle_options(int *argc, char ***argv,
(*argv)++; /* --- || ---- */
init_variables(longopts, init_one_value);
+ /*
+ Search for args_separator, if found, then the first part of the
+ arguments are loaded from configs
+ */
+ for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
+ {
+ if (*pos == args_separator)
+ {
+ is_cmdline_arg= 0;
+ break;
+ }
+ }
+
for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
{
char **first= pos;
char *cur_arg= *pos;
+ if (!is_cmdline_arg && (cur_arg == args_separator))
+ {
+ is_cmdline_arg= 1;
+
+ /* save the separator too if skip unkown options */
+ if (my_getopt_skip_unknown)
+ (*argv)[argvpos++]= cur_arg;
+ else
+ (*argc)--;
+ continue;
+ }
if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */
{
char *argument= 0;
@@ -426,8 +451,12 @@ invalid value '%s'",
}
else if (optp->arg_type == REQUIRED_ARG && !optend)
{
- /* Check if there are more arguments after this one */
- if (!*++pos)
+ /* Check if there are more arguments after this one,
+
+ Note: options loaded from config file that requires value
+ should always be in the form '--option=value'.
+ */
+ if (!is_cmdline_arg || !*++pos)
{
if (my_getopt_print_errors)
my_getopt_error_reporter(ERROR_LEVEL,
diff --git a/mysys/my_handler_errors.h b/mysys/my_handler_errors.h
index c239cabb168..e4e62f47fed 100644
--- a/mysys/my_handler_errors.h
+++ b/mysys/my_handler_errors.h
@@ -1,3 +1,5 @@
+#ifndef MYSYS_MY_HANDLER_ERRORS_INCLUDED
+#define MYSYS_MY_HANDLER_ERRORS_INCLUDED
/*
Errors a handler can give you
@@ -66,3 +68,4 @@ static const char *handler_error_messages[]=
"Too many active concurrent transactions"
};
+#endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */
diff --git a/mysys/my_static.h b/mysys/my_static.h
index 90168b099a8..c336115bc35 100644
--- a/mysys/my_static.h
+++ b/mysys/my_static.h
@@ -1,3 +1,6 @@
+#ifndef MYSYS_MY_STATIC_INCLUDED
+#define MYSYS_MY_STATIC_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -72,3 +75,5 @@ extern ulonglong query_performance_frequency, query_performance_offset;
extern sigset_t my_signals; /* signals blocked by mf_brkhant */
#endif
C_MODE_END
+
+#endif /* MYSYS_MY_STATIC_INCLUDED */
diff --git a/plugin/semisync/CMakeLists.txt b/plugin/semisync/CMakeLists.txt
new file mode 100644
index 00000000000..d42510fab18
--- /dev/null
+++ b/plugin/semisync/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Copyright (C) 2006 MySQL AB
+#
+# 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 Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is CMakeLists.txt for semi-sync replication plugins
+
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+# Add common include directories
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
+ ${CMAKE_SOURCE_DIR}/sql
+ ${CMAKE_SOURCE_DIR}/regex
+ ${CMAKE_SOURCE_DIR}/extra/yassl/include)
+
+SET(SEMISYNC_MASTER_SOURCES semisync.cc semisync_master.cc semisync_master_plugin.cc)
+SET(SEMISYNC_SLAVE_SOURCES semisync.cc semisync_slave.cc semisync_slave_plugin.cc)
+
+ADD_DEFINITIONS(-DMYSQL_DYNAMIC_PLUGIN)
+ADD_LIBRARY(semisync_master SHARED ${SEMISYNC_MASTER_SOURCES})
+TARGET_LINK_LIBRARIES(semisync_master mysqld)
+ADD_LIBRARY(semisync_slave SHARED ${SEMISYNC_SLAVE_SOURCES})
+TARGET_LINK_LIBRARIES(semisync_slave mysqld)
+MESSAGE("build SEMISYNC as DLL")
diff --git a/plugin/semisync/Makefile.am b/plugin/semisync/Makefile.am
new file mode 100644
index 00000000000..25949485987
--- /dev/null
+++ b/plugin/semisync/Makefile.am
@@ -0,0 +1,38 @@
+# Copyright (C) 2006 MySQL AB
+#
+# 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 Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+## Makefile.am for semi-synchronous replication
+
+pkgplugindir = $(pkglibdir)/plugin
+INCLUDES = -I$(top_srcdir)/include \
+ -I$(top_srcdir)/sql \
+ -I$(top_srcdir)/regex \
+ -I$(srcdir)
+
+noinst_HEADERS = semisync.h semisync_master.h semisync_slave.h
+
+pkgplugin_LTLIBRARIES = libsemisync_master.la libsemisync_slave.la
+
+libsemisync_master_la_LDFLAGS = -module
+libsemisync_master_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+libsemisync_master_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+libsemisync_master_la_SOURCES = semisync.cc semisync_master.cc semisync_master_plugin.cc
+
+libsemisync_slave_la_LDFLAGS = -module
+libsemisync_slave_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+libsemisync_slave_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+libsemisync_slave_la_SOURCES = semisync.cc semisync_slave.cc semisync_slave_plugin.cc
+
+EXTRA_DIST= CMakeLists.txt plug.in
diff --git a/plugin/semisync/configure.in b/plugin/semisync/configure.in
new file mode 100644
index 00000000000..894251258db
--- /dev/null
+++ b/plugin/semisync/configure.in
@@ -0,0 +1,9 @@
+# configure.in for semi-synchronous replication
+
+AC_INIT(mysql-semi-sync-plugin, 0.2)
+AM_INIT_AUTOMAKE
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+
diff --git a/plugin/semisync/plug.in b/plugin/semisync/plug.in
new file mode 100644
index 00000000000..917c8950f02
--- /dev/null
+++ b/plugin/semisync/plug.in
@@ -0,0 +1,3 @@
+MYSQL_PLUGIN(semisync,[Semi-synchronous Replication Plugin],
+ [Semi-synchronous replication plugin.])
+MYSQL_PLUGIN_DYNAMIC(semisync, [libsemisync_master.la libsemisync_slave.la])
diff --git a/plugin/semisync/semisync.cc b/plugin/semisync/semisync.cc
new file mode 100644
index 00000000000..83c7791c14b
--- /dev/null
+++ b/plugin/semisync/semisync.cc
@@ -0,0 +1,30 @@
+/* Copyright (C) 2007 Google Inc.
+ Copyright (C) 2008 MySQL AB
+
+ 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+
+#include "semisync.h"
+
+const unsigned char ReplSemiSyncBase::kPacketMagicNum = 0xef;
+const unsigned char ReplSemiSyncBase::kPacketFlagSync = 0x01;
+
+
+const unsigned long Trace::kTraceGeneral = 0x0001;
+const unsigned long Trace::kTraceDetail = 0x0010;
+const unsigned long Trace::kTraceNetWait = 0x0020;
+const unsigned long Trace::kTraceFunction = 0x0040;
+
+const char ReplSemiSyncBase::kSyncHeader[2] =
+ {ReplSemiSyncBase::kPacketMagicNum, 0};
diff --git a/plugin/semisync/semisync.h b/plugin/semisync/semisync.h
new file mode 100644
index 00000000000..ced25c40534
--- /dev/null
+++ b/plugin/semisync/semisync.h
@@ -0,0 +1,91 @@
+/* Copyright (C) 2007 Google Inc.
+ Copyright (C) 2008 MySQL AB
+
+ 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+
+#ifndef SEMISYNC_H
+#define SEMISYNC_H
+
+#define MYSQL_SERVER
+#define HAVE_REPLICATION
+#include <mysql_priv.h>
+#include <my_global.h>
+#include <my_pthread.h>
+#include <mysql/plugin.h>
+#include <replication.h>
+
+typedef struct st_mysql_show_var SHOW_VAR;
+typedef struct st_mysql_sys_var SYS_VAR;
+
+
+/**
+ This class is used to trace function calls and other process
+ information
+*/
+class Trace {
+public:
+ static const unsigned long kTraceFunction;
+ static const unsigned long kTraceGeneral;
+ static const unsigned long kTraceDetail;
+ static const unsigned long kTraceNetWait;
+
+ unsigned long trace_level_; /* the level for tracing */
+
+ inline void function_enter(const char *func_name)
+ {
+ if (trace_level_ & kTraceFunction)
+ sql_print_information("---> %s enter", func_name);
+ }
+ inline int function_exit(const char *func_name, int exit_code)
+ {
+ if (trace_level_ & kTraceFunction)
+ sql_print_information("<--- %s exit (%d)", func_name, exit_code);
+ return exit_code;
+ }
+
+ Trace()
+ :trace_level_(0L)
+ {}
+ Trace(unsigned long trace_level)
+ :trace_level_(trace_level)
+ {}
+};
+
+/**
+ Base class for semi-sync master and slave classes
+*/
+class ReplSemiSyncBase
+ :public Trace {
+public:
+ static const char kSyncHeader[2]; /* three byte packet header */
+
+ /* Constants in network packet header. */
+ static const unsigned char kPacketMagicNum;
+ static const unsigned char kPacketFlagSync;
+};
+
+/* The layout of a semisync slave reply packet:
+ 1 byte for the magic num
+ 8 bytes for the binlog positon
+ n bytes for the binlog filename, terminated with a '\0'
+*/
+#define REPLY_MAGIC_NUM_LEN 1
+#define REPLY_BINLOG_POS_LEN 8
+#define REPLY_BINLOG_NAME_LEN (FN_REFLEN + 1)
+#define REPLY_MAGIC_NUM_OFFSET 0
+#define REPLY_BINLOG_POS_OFFSET (REPLY_MAGIC_NUM_OFFSET + REPLY_MAGIC_NUM_LEN)
+#define REPLY_BINLOG_NAME_OFFSET (REPLY_BINLOG_POS_OFFSET + REPLY_BINLOG_POS_LEN)
+
+#endif /* SEMISYNC_H */
diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc
new file mode 100644
index 00000000000..cc83978ad4e
--- /dev/null
+++ b/plugin/semisync/semisync_master.cc
@@ -0,0 +1,1310 @@
+/* Copyright (C) 2007 Google Inc.
+ Copyright (C) 2008 MySQL AB
+
+ 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+
+#include "semisync_master.h"
+
+#define TIME_THOUSAND 1000
+#define TIME_MILLION 1000000
+#define TIME_BILLION 1000000000
+
+/* This indicates whether semi-synchronous replication is enabled. */
+char rpl_semi_sync_master_enabled;
+unsigned long rpl_semi_sync_master_timeout;
+unsigned long rpl_semi_sync_master_trace_level;
+char rpl_semi_sync_master_status = 0;
+unsigned long rpl_semi_sync_master_yes_transactions = 0;
+unsigned long rpl_semi_sync_master_no_transactions = 0;
+unsigned long rpl_semi_sync_master_off_times = 0;
+unsigned long rpl_semi_sync_master_timefunc_fails = 0;
+unsigned long rpl_semi_sync_master_wait_timeouts = 0;
+unsigned long rpl_semi_sync_master_wait_sessions = 0;
+unsigned long rpl_semi_sync_master_wait_pos_backtraverse = 0;
+unsigned long rpl_semi_sync_master_avg_trx_wait_time = 0;
+unsigned long long rpl_semi_sync_master_trx_wait_num = 0;
+unsigned long rpl_semi_sync_master_avg_net_wait_time = 0;
+unsigned long long rpl_semi_sync_master_net_wait_num = 0;
+unsigned long rpl_semi_sync_master_clients = 0;
+unsigned long long rpl_semi_sync_master_net_wait_time = 0;
+unsigned long long rpl_semi_sync_master_trx_wait_time = 0;
+char rpl_semi_sync_master_wait_no_slave = 1;
+
+
+static int getWaitTime(const struct timeval& start_tv);
+
+#ifdef __WIN__
+static int gettimeofday(struct timeval *tv, void *tz)
+{
+ unsigned int ticks;
+ ticks= GetTickCount();
+ tv->tv_usec= ticks*1000;
+ tv->tv_sec= ticks/1000;
+
+ return 0;
+}
+#endif /* __WIN__ */
+
+/*******************************************************************************
+ *
+ * <ActiveTranx> class : manage all active transaction nodes
+ *
+ ******************************************************************************/
+
+ActiveTranx::ActiveTranx(int max_connections,
+ pthread_mutex_t *lock,
+ unsigned long trace_level)
+ : Trace(trace_level), num_transactions_(max_connections),
+ num_entries_(max_connections << 1),
+ lock_(lock)
+{
+ /* Allocate the memory for the array */
+ node_array_ = new TranxNode[num_transactions_];
+ for (int idx = 0; idx < num_transactions_; ++idx)
+ {
+ node_array_[idx].log_pos_ = 0;
+ node_array_[idx].hash_next_ = NULL;
+ node_array_[idx].next_ = node_array_ + idx + 1;
+
+ node_array_[idx].log_name_ = new char[FN_REFLEN];
+ node_array_[idx].log_name_[0] = '\x0';
+ }
+ node_array_[num_transactions_-1].next_ = NULL;
+
+ /* All nodes in the array go to the pool initially. */
+ free_pool_ = node_array_;
+
+ /* No transactions are in the list initially. */
+ trx_front_ = NULL;
+ trx_rear_ = NULL;
+
+ /* Create the hash table to find a transaction's ending event. */
+ trx_htb_ = new TranxNode *[num_entries_];
+ for (int idx = 0; idx < num_entries_; ++idx)
+ trx_htb_[idx] = NULL;
+
+ sql_print_information("Semi-sync replication initialized for %d "
+ "transactions.", num_transactions_);
+}
+
+ActiveTranx::~ActiveTranx()
+{
+ for (int idx = 0; idx < num_transactions_; ++idx)
+ {
+ delete [] node_array_[idx].log_name_;
+ node_array_[idx].log_name_ = NULL;
+ }
+
+ delete [] node_array_;
+ delete [] trx_htb_;
+
+ node_array_ = NULL;
+ trx_htb_ = NULL;
+ num_transactions_ = 0;
+ num_entries_ = 0;
+}
+
+unsigned int ActiveTranx::calc_hash(const unsigned char *key,
+ unsigned int length)
+{
+ unsigned int nr = 1, nr2 = 4;
+
+ /* The hash implementation comes from calc_hashnr() in mysys/hash.c. */
+ while (length--)
+ {
+ nr ^= (((nr & 63)+nr2)*((unsigned int) (unsigned char) *key++))+ (nr << 8);
+ nr2 += 3;
+ }
+ return((unsigned int) nr);
+}
+
+unsigned int ActiveTranx::get_hash_value(const char *log_file_name,
+ my_off_t log_file_pos)
+{
+ unsigned int hash1 = calc_hash((const unsigned char *)log_file_name,
+ strlen(log_file_name));
+ unsigned int hash2 = calc_hash((const unsigned char *)(&log_file_pos),
+ sizeof(log_file_pos));
+
+ return (hash1 + hash2) % num_entries_;
+}
+
+ActiveTranx::TranxNode* ActiveTranx::alloc_tranx_node()
+{
+ TranxNode *ptr = free_pool_;
+
+ if (free_pool_)
+ {
+ free_pool_ = free_pool_->next_;
+ ptr->next_ = NULL;
+ ptr->hash_next_ = NULL;
+ }
+ else
+ {
+ /*
+ free_pool should never be NULL here, because we have
+ max_connections number of pre-allocated nodes.
+ */
+ sql_print_error("You have encountered a semi-sync bug (free_pool == NULL), "
+ "please report to http://bugs.mysql.com");
+ assert(free_pool_);
+ }
+
+ return ptr;
+}
+
+int ActiveTranx::compare(const char *log_file_name1, my_off_t log_file_pos1,
+ const char *log_file_name2, my_off_t log_file_pos2)
+{
+ int cmp = strcmp(log_file_name1, log_file_name2);
+
+ if (cmp != 0)
+ return cmp;
+
+ if (log_file_pos1 > log_file_pos2)
+ return 1;
+ else if (log_file_pos1 < log_file_pos2)
+ return -1;
+ return 0;
+}
+
+int ActiveTranx::insert_tranx_node(const char *log_file_name,
+ my_off_t log_file_pos)
+{
+ const char *kWho = "ActiveTranx:insert_tranx_node";
+ TranxNode *ins_node;
+ int result = 0;
+ unsigned int hash_val;
+
+ function_enter(kWho);
+
+ ins_node = alloc_tranx_node();
+ if (!ins_node)
+ {
+ sql_print_error("%s: transaction node allocation failed for: (%s, %lu)",
+ kWho, log_file_name, (unsigned long)log_file_pos);
+ result = -1;
+ goto l_end;
+ }
+
+ /* insert the binlog position in the active transaction list. */
+ strcpy(ins_node->log_name_, log_file_name);
+ ins_node->log_pos_ = log_file_pos;
+
+ if (!trx_front_)
+ {
+ /* The list is empty. */
+ trx_front_ = trx_rear_ = ins_node;
+ }
+ else
+ {
+ int cmp = compare(ins_node, trx_rear_);
+ if (cmp > 0)
+ {
+ /* Compare with the tail first. If the transaction happens later in
+ * binlog, then make it the new tail.
+ */
+ trx_rear_->next_ = ins_node;
+ trx_rear_ = ins_node;
+ }
+ else
+ {
+ /* Otherwise, it is an error because the transaction should hold the
+ * mysql_bin_log.LOCK_log when appending events.
+ */
+ sql_print_error("%s: binlog write out-of-order, tail (%s, %lu), "
+ "new node (%s, %lu)", kWho,
+ trx_rear_->log_name_, (unsigned long)trx_rear_->log_pos_,
+ ins_node->log_name_, (unsigned long)ins_node->log_pos_);
+ result = -1;
+ goto l_end;
+ }
+ }
+
+ hash_val = get_hash_value(ins_node->log_name_, ins_node->log_pos_);
+ ins_node->hash_next_ = trx_htb_[hash_val];
+ trx_htb_[hash_val] = ins_node;
+
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: insert (%s, %lu) in entry(%u)", kWho,
+ ins_node->log_name_, (unsigned long)ins_node->log_pos_,
+ hash_val);
+
+ l_end:
+ return function_exit(kWho, result);
+}
+
+bool ActiveTranx::is_tranx_end_pos(const char *log_file_name,
+ my_off_t log_file_pos)
+{
+ const char *kWho = "ActiveTranx::is_tranx_end_pos";
+ function_enter(kWho);
+
+ unsigned int hash_val = get_hash_value(log_file_name, log_file_pos);
+ TranxNode *entry = trx_htb_[hash_val];
+
+ while (entry != NULL)
+ {
+ if (compare(entry, log_file_name, log_file_pos) == 0)
+ break;
+
+ entry = entry->hash_next_;
+ }
+
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: probe (%s, %lu) in entry(%u)", kWho,
+ log_file_name, (unsigned long)log_file_pos, hash_val);
+
+ function_exit(kWho, (entry != NULL));
+ return (entry != NULL);
+}
+
+int ActiveTranx::clear_active_tranx_nodes(const char *log_file_name,
+ my_off_t log_file_pos)
+{
+ const char *kWho = "ActiveTranx::::clear_active_tranx_nodes";
+ TranxNode *new_front;
+
+ function_enter(kWho);
+
+ if (log_file_name != NULL)
+ {
+ new_front = trx_front_;
+
+ while (new_front)
+ {
+ if (compare(new_front, log_file_name, log_file_pos) > 0)
+ break;
+ new_front = new_front->next_;
+ }
+ }
+ else
+ {
+ /* If log_file_name is NULL, clear everything. */
+ new_front = NULL;
+ }
+
+ if (new_front == NULL)
+ {
+ /* No active transaction nodes after the call. */
+
+ /* Clear the hash table. */
+ memset(trx_htb_, 0, num_entries_ * sizeof(TranxNode *));
+
+ /* Clear the active transaction list. */
+ if (trx_front_ != NULL)
+ {
+ trx_rear_->next_ = free_pool_;
+ free_pool_ = trx_front_;
+ trx_front_ = NULL;
+ trx_rear_ = NULL;
+ }
+
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: free all nodes back to free list", kWho);
+ }
+ else if (new_front != trx_front_)
+ {
+ TranxNode *curr_node, *next_node;
+
+ /* Delete all transaction nodes before the confirmation point. */
+ int n_frees = 0;
+ curr_node = trx_front_;
+ while (curr_node != new_front)
+ {
+ next_node = curr_node->next_;
+
+ /* Put the node in the memory pool. */
+ curr_node->next_ = free_pool_;
+ free_pool_ = curr_node;
+ n_frees++;
+
+ /* Remove the node from the hash table. */
+ unsigned int hash_val = get_hash_value(curr_node->log_name_, curr_node->log_pos_);
+ TranxNode **hash_ptr = &(trx_htb_[hash_val]);
+ while ((*hash_ptr) != NULL)
+ {
+ if ((*hash_ptr) == curr_node)
+ {
+ (*hash_ptr) = curr_node->hash_next_;
+ break;
+ }
+ hash_ptr = &((*hash_ptr)->hash_next_);
+ }
+
+ curr_node = next_node;
+ }
+
+ trx_front_ = new_front;
+
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: free %d nodes back until pos (%s, %lu)",
+ kWho, n_frees,
+ trx_front_->log_name_, (unsigned long)trx_front_->log_pos_);
+ }
+
+ return function_exit(kWho, 0);
+}
+
+
+/*******************************************************************************
+ *
+ * <ReplSemiSyncMaster> class: the basic code layer for sync-replication master.
+ * <ReplSemiSyncSlave> class: the basic code layer for sync-replication slave.
+ *
+ * The most important functions during semi-syn replication listed:
+ *
+ * Master:
+ * . reportReplyBinlog(): called by the binlog dump thread when it receives
+ * the slave's status information.
+ * . updateSyncHeader(): based on transaction waiting information, decide
+ * whether to request the slave to reply.
+ * . writeTraxInBinlog(): called by the transaction thread when it finishes
+ * writing all transaction events in binlog.
+ * . commitTrx(): transaction thread wait for the slave reply.
+ *
+ * Slave:
+ * . slaveReadSyncHeader(): read the semi-sync header from the master, get the
+ * sync status and get the payload for events.
+ * . slaveReply(): reply to the master about the replication progress.
+ *
+ ******************************************************************************/
+
+ReplSemiSyncMaster::ReplSemiSyncMaster()
+ : active_tranxs_(NULL),
+ init_done_(false),
+ reply_file_name_inited_(false),
+ reply_file_pos_(0L),
+ wait_file_name_inited_(false),
+ wait_file_pos_(0),
+ master_enabled_(false),
+ wait_timeout_(0L),
+ state_(0),
+ max_transactions_(0L)
+{
+ strcpy(reply_file_name_, "");
+ strcpy(wait_file_name_, "");
+}
+
+int ReplSemiSyncMaster::initObject()
+{
+ int result;
+ const char *kWho = "ReplSemiSyncMaster::initObject";
+
+ if (init_done_)
+ {
+ fprintf(stderr, "%s called twice\n", kWho);
+ return 1;
+ }
+ init_done_ = true;
+
+ /* References to the parameter works after set_options(). */
+ setWaitTimeout(rpl_semi_sync_master_timeout);
+ setTraceLevel(rpl_semi_sync_master_trace_level);
+ max_transactions_ = (int)max_connections;
+
+ /* Mutex initialization can only be done after MY_INIT(). */
+ pthread_mutex_init(&LOCK_binlog_, MY_MUTEX_INIT_FAST);
+ pthread_cond_init(&COND_binlog_send_, NULL);
+
+ if (rpl_semi_sync_master_enabled)
+ result = enableMaster();
+ else
+ result = disableMaster();
+
+ return result;
+}
+
+int ReplSemiSyncMaster::enableMaster()
+{
+ int result = 0;
+
+ /* Must have the lock when we do enable of disable. */
+ lock();
+
+ if (!getMasterEnabled())
+ {
+ active_tranxs_ = new ActiveTranx(max_connections,
+ &LOCK_binlog_,
+ trace_level_);
+ if (active_tranxs_ != NULL)
+ {
+ commit_file_name_inited_ = false;
+ reply_file_name_inited_ = false;
+ wait_file_name_inited_ = false;
+
+ set_master_enabled(true);
+ state_ = true;
+ sql_print_information("Semi-sync replication enabled on the master.");
+ }
+ else
+ {
+ sql_print_error("Cannot allocate memory to enable semi-sync on the master.");
+ result = -1;
+ }
+ }
+
+ unlock();
+
+ return result;
+}
+
+int ReplSemiSyncMaster::disableMaster()
+{
+ /* Must have the lock when we do enable of disable. */
+ lock();
+
+ if (getMasterEnabled())
+ {
+ /* Switch off the semi-sync first so that waiting transaction will be
+ * waken up.
+ */
+ switch_off();
+
+ assert(active_tranxs_ != NULL);
+ delete active_tranxs_;
+ active_tranxs_ = NULL;
+
+ reply_file_name_inited_ = false;
+ wait_file_name_inited_ = false;
+ commit_file_name_inited_ = false;
+
+ set_master_enabled(false);
+ sql_print_information("Semi-sync replication disabled on the master.");
+ }
+
+ unlock();
+
+ return 0;
+}
+
+ReplSemiSyncMaster::~ReplSemiSyncMaster()
+{
+ if (init_done_)
+ {
+ pthread_mutex_destroy(&LOCK_binlog_);
+ pthread_cond_destroy(&COND_binlog_send_);
+ }
+
+ delete active_tranxs_;
+}
+
+void ReplSemiSyncMaster::lock()
+{
+ pthread_mutex_lock(&LOCK_binlog_);
+}
+
+void ReplSemiSyncMaster::unlock()
+{
+ pthread_mutex_unlock(&LOCK_binlog_);
+}
+
+void ReplSemiSyncMaster::cond_broadcast()
+{
+ pthread_cond_broadcast(&COND_binlog_send_);
+}
+
+int ReplSemiSyncMaster::cond_timewait(struct timespec *wait_time)
+{
+ const char *kWho = "ReplSemiSyncMaster::cond_timewait()";
+ int wait_res;
+
+ function_enter(kWho);
+ wait_res = pthread_cond_timedwait(&COND_binlog_send_,
+ &LOCK_binlog_, wait_time);
+ return function_exit(kWho, wait_res);
+}
+
+void ReplSemiSyncMaster::add_slave()
+{
+ lock();
+ rpl_semi_sync_master_clients++;
+ unlock();
+}
+
+void ReplSemiSyncMaster::remove_slave()
+{
+ lock();
+ rpl_semi_sync_master_clients--;
+
+ /* If user has chosen not to wait if no semi-sync slave available
+ and the last semi-sync slave exits, turn off semi-sync on master
+ immediately.
+ */
+ if (!rpl_semi_sync_master_wait_no_slave &&
+ rpl_semi_sync_master_clients == 0)
+ switch_off();
+ unlock();
+}
+
+bool ReplSemiSyncMaster::is_semi_sync_slave()
+{
+ int null_value;
+ long long val= 0;
+ get_user_var_int("rpl_semi_sync_slave", &val, &null_value);
+ return val;
+}
+
+int ReplSemiSyncMaster::reportReplyBinlog(uint32 server_id,
+ const char *log_file_name,
+ my_off_t log_file_pos)
+{
+ const char *kWho = "ReplSemiSyncMaster::reportReplyBinlog";
+ int cmp;
+ bool can_release_threads = false;
+ bool need_copy_send_pos = true;
+
+ if (!(getMasterEnabled()))
+ return 0;
+
+ function_enter(kWho);
+
+ lock();
+
+ /* This is the real check inside the mutex. */
+ if (!getMasterEnabled())
+ goto l_end;
+
+ if (!is_on())
+ /* We check to see whether we can switch semi-sync ON. */
+ try_switch_on(server_id, log_file_name, log_file_pos);
+
+ /* The position should increase monotonically, if there is only one
+ * thread sending the binlog to the slave.
+ * In reality, to improve the transaction availability, we allow multiple
+ * sync replication slaves. So, if any one of them get the transaction,
+ * the transaction session in the primary can move forward.
+ */
+ if (reply_file_name_inited_)
+ {
+ cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+ reply_file_name_, reply_file_pos_);
+
+ /* If the requested position is behind the sending binlog position,
+ * would not adjust sending binlog position.
+ * We based on the assumption that there are multiple semi-sync slave,
+ * and at least one of them shou/ld be up to date.
+ * If all semi-sync slaves are behind, at least initially, the primary
+ * can find the situation after the waiting timeout. After that, some
+ * slaves should catch up quickly.
+ */
+ if (cmp < 0)
+ {
+ /* If the position is behind, do not copy it. */
+ need_copy_send_pos = false;
+ }
+ }
+
+ if (need_copy_send_pos)
+ {
+ strcpy(reply_file_name_, log_file_name);
+ reply_file_pos_ = log_file_pos;
+ reply_file_name_inited_ = true;
+
+ /* Remove all active transaction nodes before this point. */
+ assert(active_tranxs_ != NULL);
+ active_tranxs_->clear_active_tranx_nodes(log_file_name, log_file_pos);
+
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: Got reply at (%s, %lu)", kWho,
+ log_file_name, (unsigned long)log_file_pos);
+ }
+
+ if (rpl_semi_sync_master_wait_sessions > 0)
+ {
+ /* Let us check if some of the waiting threads doing a trx
+ * commit can now proceed.
+ */
+ cmp = ActiveTranx::compare(reply_file_name_, reply_file_pos_,
+ wait_file_name_, wait_file_pos_);
+ if (cmp >= 0)
+ {
+ /* Yes, at least one waiting thread can now proceed:
+ * let us release all waiting threads with a broadcast
+ */
+ can_release_threads = true;
+ wait_file_name_inited_ = false;
+ }
+ }
+
+ l_end:
+ unlock();
+
+ if (can_release_threads)
+ {
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: signal all waiting threads.", kWho);
+
+ cond_broadcast();
+ }
+
+ return function_exit(kWho, 0);
+}
+
+int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
+ my_off_t trx_wait_binlog_pos)
+{
+ const char *kWho = "ReplSemiSyncMaster::commitTrx";
+
+ function_enter(kWho);
+
+ if (getMasterEnabled() && trx_wait_binlog_name)
+ {
+ struct timeval start_tv;
+ struct timespec abstime;
+ int wait_result, start_time_err;
+ const char *old_msg= 0;
+
+ start_time_err = gettimeofday(&start_tv, 0);
+
+ /* Acquire the mutex. */
+ lock();
+
+ /* This must be called after acquired the lock */
+ old_msg= thd_enter_cond(NULL, &COND_binlog_send_, &LOCK_binlog_,
+ "Waiting for semi-sync ACK from slave");
+
+ /* This is the real check inside the mutex. */
+ if (!getMasterEnabled() || !is_on())
+ goto l_end;
+
+ if (trace_level_ & kTraceDetail)
+ {
+ sql_print_information("%s: wait pos (%s, %lu), repl(%d)\n", kWho,
+ trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos,
+ (int)is_on());
+ }
+
+ while (is_on())
+ {
+ if (reply_file_name_inited_)
+ {
+ int cmp = ActiveTranx::compare(reply_file_name_, reply_file_pos_,
+ trx_wait_binlog_name, trx_wait_binlog_pos);
+ if (cmp >= 0)
+ {
+ /* We have already sent the relevant binlog to the slave: no need to
+ * wait here.
+ */
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: Binlog reply is ahead (%s, %lu),",
+ kWho, reply_file_name_, (unsigned long)reply_file_pos_);
+ break;
+ }
+ }
+
+ /* Let us update the info about the minimum binlog position of waiting
+ * threads.
+ */
+ if (wait_file_name_inited_)
+ {
+ int cmp = ActiveTranx::compare(trx_wait_binlog_name, trx_wait_binlog_pos,
+ wait_file_name_, wait_file_pos_);
+ if (cmp <= 0)
+ {
+ /* This thd has a lower position, let's update the minimum info. */
+ strcpy(wait_file_name_, trx_wait_binlog_name);
+ wait_file_pos_ = trx_wait_binlog_pos;
+
+ rpl_semi_sync_master_wait_pos_backtraverse++;
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: move back wait position (%s, %lu),",
+ kWho, wait_file_name_, (unsigned long)wait_file_pos_);
+ }
+ }
+ else
+ {
+ strcpy(wait_file_name_, trx_wait_binlog_name);
+ wait_file_pos_ = trx_wait_binlog_pos;
+ wait_file_name_inited_ = true;
+
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: init wait position (%s, %lu),",
+ kWho, wait_file_name_, (unsigned long)wait_file_pos_);
+ }
+
+ if (start_time_err == 0)
+ {
+ int diff_usecs = start_tv.tv_usec + wait_timeout_ * TIME_THOUSAND;
+
+ /* Calcuate the waiting period. */
+#ifdef __WIN__
+ abstime.tv.i64 = (__int64)start_tv.tv_sec * TIME_MILLION * 10;
+ abstime.tv.i64 += (__int64)diff_usecs * 10;
+ abstime.max_timeout_msec= (long)wait_timeout_;
+#else
+ abstime.tv_sec = start_tv.tv_sec;
+ if (diff_usecs < TIME_MILLION)
+ {
+ abstime.tv_nsec = diff_usecs * TIME_THOUSAND;
+ }
+ else
+ {
+ while (diff_usecs >= TIME_MILLION)
+ {
+ abstime.tv_sec++;
+ diff_usecs -= TIME_MILLION;
+ }
+ abstime.tv_nsec = diff_usecs * TIME_THOUSAND;
+ }
+#endif /* __WIN__ */
+
+ /* In semi-synchronous replication, we wait until the binlog-dump
+ * thread has received the reply on the relevant binlog segment from the
+ * replication slave.
+ *
+ * Let us suspend this thread to wait on the condition;
+ * when replication has progressed far enough, we will release
+ * these waiting threads.
+ */
+ rpl_semi_sync_master_wait_sessions++;
+
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: wait %lu ms for binlog sent (%s, %lu)",
+ kWho, wait_timeout_,
+ wait_file_name_, (unsigned long)wait_file_pos_);
+
+ wait_result = cond_timewait(&abstime);
+ rpl_semi_sync_master_wait_sessions--;
+
+ if (wait_result != 0)
+ {
+ /* This is a real wait timeout. */
+ sql_print_warning("Timeout waiting for reply of binlog (file: %s, pos: %lu), "
+ "semi-sync up to file %s, position %lu.",
+ trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos,
+ reply_file_name_, (unsigned long)reply_file_pos_);
+ rpl_semi_sync_master_wait_timeouts++;
+
+ /* switch semi-sync off */
+ switch_off();
+ }
+ else
+ {
+ int wait_time;
+
+ wait_time = getWaitTime(start_tv);
+ if (wait_time < 0)
+ {
+ if (trace_level_ & kTraceGeneral)
+ {
+ /* This is a time/gettimeofday function call error. */
+ sql_print_error("Replication semi-sync gettimeofday fail1 at "
+ "wait position (%s, %lu)",
+ trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos);
+ }
+ rpl_semi_sync_master_timefunc_fails++;
+ }
+ else
+ {
+ rpl_semi_sync_master_trx_wait_num++;
+ rpl_semi_sync_master_trx_wait_time += wait_time;
+ }
+ }
+ }
+ else
+ {
+ if (trace_level_ & kTraceGeneral)
+ {
+ /* This is a gettimeofday function call error. */
+ sql_print_error("Replication semi-sync gettimeofday fail2 at "
+ "wait position (%s, %lu)",
+ trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos);
+ }
+ rpl_semi_sync_master_timefunc_fails++;
+
+ /* switch semi-sync off */
+ switch_off();
+ }
+ }
+
+ l_end:
+ /*
+ At this point, the binlog file and position of this transaction
+ must have been removed from ActiveTranx.
+ */
+ assert(!active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name,
+ trx_wait_binlog_pos));
+
+ /* Update the status counter. */
+ if (is_on())
+ rpl_semi_sync_master_yes_transactions++;
+ else
+ rpl_semi_sync_master_no_transactions++;
+
+ /* The lock held will be released by thd_exit_cond, so no need to
+ call unlock() here */
+ thd_exit_cond(NULL, old_msg);
+ }
+
+ return function_exit(kWho, 0);
+}
+
+/* Indicate that semi-sync replication is OFF now.
+ *
+ * What should we do when it is disabled? The problem is that we want
+ * the semi-sync replication enabled again when the slave catches up
+ * later. But, it is not that easy to detect that the slave has caught
+ * up. This is caused by the fact that MySQL's replication protocol is
+ * asynchronous, meaning that if the master does not use the semi-sync
+ * protocol, the slave would not send anything to the master.
+ * Still, if the master is sending (N+1)-th event, we assume that it is
+ * an indicator that the slave has received N-th event and earlier ones.
+ *
+ * If semi-sync is disabled, all transactions still update the wait
+ * position with the last position in binlog. But no transactions will
+ * wait for confirmations and the active transaction list would not be
+ * maintained. In binlog dump thread, updateSyncHeader() checks whether
+ * the current sending event catches up with last wait position. If it
+ * does match, semi-sync will be switched on again.
+ */
+int ReplSemiSyncMaster::switch_off()
+{
+ const char *kWho = "ReplSemiSyncMaster::switch_off";
+ int result;
+
+ function_enter(kWho);
+ state_ = false;
+
+ /* Clear the active transaction list. */
+ assert(active_tranxs_ != NULL);
+ result = active_tranxs_->clear_active_tranx_nodes(NULL, 0);
+
+ rpl_semi_sync_master_off_times++;
+ wait_file_name_inited_ = false;
+ reply_file_name_inited_ = false;
+ sql_print_information("Semi-sync replication switched OFF.");
+ cond_broadcast(); /* wake up all waiting threads */
+
+ return function_exit(kWho, result);
+}
+
+int ReplSemiSyncMaster::try_switch_on(int server_id,
+ const char *log_file_name,
+ my_off_t log_file_pos)
+{
+ const char *kWho = "ReplSemiSyncMaster::try_switch_on";
+ bool semi_sync_on = false;
+
+ function_enter(kWho);
+
+ /* If the current sending event's position is larger than or equal to the
+ * 'largest' commit transaction binlog position, the slave is already
+ * catching up now and we can switch semi-sync on here.
+ * If commit_file_name_inited_ indicates there are no recent transactions,
+ * we can enable semi-sync immediately.
+ */
+ if (commit_file_name_inited_)
+ {
+ int cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+ commit_file_name_, commit_file_pos_);
+ semi_sync_on = (cmp >= 0);
+ }
+ else
+ {
+ semi_sync_on = true;
+ }
+
+ if (semi_sync_on)
+ {
+ /* Switch semi-sync replication on. */
+ state_ = true;
+
+ sql_print_information("Semi-sync replication switched ON with slave (server_id: %d) "
+ "at (%s, %lu)",
+ server_id, log_file_name,
+ (unsigned long)log_file_pos);
+ }
+
+ return function_exit(kWho, 0);
+}
+
+int ReplSemiSyncMaster::reserveSyncHeader(unsigned char *header,
+ unsigned long size)
+{
+ const char *kWho = "ReplSemiSyncMaster::reserveSyncHeader";
+ function_enter(kWho);
+
+ int hlen=0;
+ if (!is_semi_sync_slave())
+ {
+ hlen= 0;
+ }
+ else
+ {
+ /* No enough space for the extra header, disable semi-sync master */
+ if (sizeof(kSyncHeader) > size)
+ {
+ sql_print_warning("No enough space in the packet "
+ "for semi-sync extra header, "
+ "semi-sync replication disabled");
+ disableMaster();
+ return 0;
+ }
+
+ /* Set the magic number and the sync status. By default, no sync
+ * is required.
+ */
+ memcpy(header, kSyncHeader, sizeof(kSyncHeader));
+ hlen= sizeof(kSyncHeader);
+ }
+ return function_exit(kWho, hlen);
+}
+
+int ReplSemiSyncMaster::updateSyncHeader(unsigned char *packet,
+ const char *log_file_name,
+ my_off_t log_file_pos,
+ uint32 server_id)
+{
+ const char *kWho = "ReplSemiSyncMaster::updateSyncHeader";
+ int cmp = 0;
+ bool sync = false;
+
+ /* If the semi-sync master is not enabled, or the slave is not a semi-sync
+ * target, do not request replies from the slave.
+ */
+ if (!getMasterEnabled() || !is_semi_sync_slave())
+ {
+ sync = false;
+ return 0;
+ }
+
+ function_enter(kWho);
+
+ lock();
+
+ /* This is the real check inside the mutex. */
+ if (!getMasterEnabled())
+ {
+ sync = false;
+ goto l_end;
+ }
+
+ if (is_on())
+ {
+ /* semi-sync is ON */
+ sync = false; /* No sync unless a transaction is involved. */
+
+ if (reply_file_name_inited_)
+ {
+ cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+ reply_file_name_, reply_file_pos_);
+ if (cmp <= 0)
+ {
+ /* If we have already got the reply for the event, then we do
+ * not need to sync the transaction again.
+ */
+ goto l_end;
+ }
+ }
+
+ if (wait_file_name_inited_)
+ {
+ cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+ wait_file_name_, wait_file_pos_);
+ }
+ else
+ {
+ cmp = 1;
+ }
+
+ /* If we are already waiting for some transaction replies which
+ * are later in binlog, do not wait for this one event.
+ */
+ if (cmp >= 0)
+ {
+ /*
+ * We only wait if the event is a transaction's ending event.
+ */
+ assert(active_tranxs_ != NULL);
+ sync = active_tranxs_->is_tranx_end_pos(log_file_name,
+ log_file_pos);
+ }
+ }
+ else
+ {
+ if (commit_file_name_inited_)
+ {
+ int cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+ commit_file_name_, commit_file_pos_);
+ sync = (cmp >= 0);
+ }
+ else
+ {
+ sync = true;
+ }
+ }
+
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: server(%d), (%s, %lu) sync(%d), repl(%d)",
+ kWho, server_id, log_file_name,
+ (unsigned long)log_file_pos, sync, (int)is_on());
+
+ l_end:
+ unlock();
+
+ /* We do not need to clear sync flag because we set it to 0 when we
+ * reserve the packet header.
+ */
+ if (sync)
+ {
+ (packet)[2] = kPacketFlagSync;
+ }
+
+ return function_exit(kWho, 0);
+}
+
+int ReplSemiSyncMaster::writeTranxInBinlog(const char* log_file_name,
+ my_off_t log_file_pos)
+{
+ const char *kWho = "ReplSemiSyncMaster::writeTranxInBinlog";
+ int result = 0;
+
+ function_enter(kWho);
+
+ lock();
+
+ /* This is the real check inside the mutex. */
+ if (!getMasterEnabled())
+ goto l_end;
+
+ /* Update the 'largest' transaction commit position seen so far even
+ * though semi-sync is switched off.
+ * It is much better that we update commit_file_* here, instead of
+ * inside commitTrx(). This is mostly because updateSyncHeader()
+ * will watch for commit_file_* to decide whether to switch semi-sync
+ * on. The detailed reason is explained in function updateSyncHeader().
+ */
+ if (commit_file_name_inited_)
+ {
+ int cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+ commit_file_name_, commit_file_pos_);
+ if (cmp > 0)
+ {
+ /* This is a larger position, let's update the maximum info. */
+ strcpy(commit_file_name_, log_file_name);
+ commit_file_pos_ = log_file_pos;
+ }
+ }
+ else
+ {
+ strcpy(commit_file_name_, log_file_name);
+ commit_file_pos_ = log_file_pos;
+ commit_file_name_inited_ = true;
+ }
+
+ if (is_on())
+ {
+ assert(active_tranxs_ != NULL);
+ if(active_tranxs_->insert_tranx_node(log_file_name, log_file_pos))
+ {
+ /*
+ if insert tranx_node failed, print a warning message
+ and turn off semi-sync
+ */
+ sql_print_warning("Semi-sync failed to insert tranx_node for binlog file: %s, position: %lu",
+ log_file_name, (ulong)log_file_pos);
+ switch_off();
+ }
+ }
+
+ l_end:
+ unlock();
+
+ return function_exit(kWho, result);
+}
+
+int ReplSemiSyncMaster::readSlaveReply(NET *net, uint32 server_id,
+ const char *event_buf)
+{
+ const char *kWho = "ReplSemiSyncMaster::readSlaveReply";
+ const unsigned char *packet;
+ char log_file_name[FN_REFLEN];
+ my_off_t log_file_pos;
+ ulong packet_len;
+ int result = -1;
+
+ struct timeval start_tv;
+ int start_time_err= 0;
+ ulong trc_level = trace_level_;
+
+ function_enter(kWho);
+
+ assert((unsigned char)event_buf[1] == kPacketMagicNum);
+ if ((unsigned char)event_buf[2] != kPacketFlagSync)
+ {
+ /* current event does not require reply */
+ result = 0;
+ goto l_end;
+ }
+
+ if (trc_level & kTraceNetWait)
+ start_time_err = gettimeofday(&start_tv, 0);
+
+ /* We flush to make sure that the current event is sent to the network,
+ * instead of being buffered in the TCP/IP stack.
+ */
+ if (net_flush(net))
+ {
+ sql_print_error("Semi-sync master failed on net_flush() "
+ "before waiting for slave reply");
+ goto l_end;
+ }
+
+ net_clear(net, 0);
+ if (trc_level & kTraceDetail)
+ sql_print_information("%s: Wait for replica's reply", kWho);
+
+ /* Wait for the network here. Though binlog dump thread can indefinitely wait
+ * here, transactions would not wait indefintely.
+ * Transactions wait on binlog replies detected by binlog dump threads. If
+ * binlog dump threads wait too long, transactions will timeout and continue.
+ */
+ packet_len = my_net_read(net);
+
+ if (trc_level & kTraceNetWait)
+ {
+ if (start_time_err != 0)
+ {
+ sql_print_error("Semi-sync master wait for reply "
+ "gettimeofday fail to get start time");
+ rpl_semi_sync_master_timefunc_fails++;
+ }
+ else
+ {
+ int wait_time;
+
+ wait_time = getWaitTime(start_tv);
+ if (wait_time < 0)
+ {
+ sql_print_error("Semi-sync master wait for reply "
+ "gettimeofday fail to get wait time.");
+ rpl_semi_sync_master_timefunc_fails++;
+ }
+ else
+ {
+ rpl_semi_sync_master_net_wait_num++;
+ rpl_semi_sync_master_net_wait_time += wait_time;
+ }
+ }
+ }
+
+ if (packet_len == packet_error || packet_len < REPLY_BINLOG_NAME_OFFSET)
+ {
+ if (packet_len == packet_error)
+ sql_print_error("Read semi-sync reply network error: %s (errno: %d)",
+ net->last_error, net->last_errno);
+ else
+ sql_print_error("Read semi-sync reply length error: %s (errno: %d)",
+ net->last_error, net->last_errno);
+ goto l_end;
+ }
+
+ packet = net->read_pos;
+ if (packet[REPLY_MAGIC_NUM_OFFSET] != ReplSemiSyncMaster::kPacketMagicNum)
+ {
+ sql_print_error("Read semi-sync reply magic number error");
+ goto l_end;
+ }
+
+ log_file_pos = uint8korr(packet + REPLY_BINLOG_POS_OFFSET);
+ strcpy(log_file_name, (const char*)packet + REPLY_BINLOG_NAME_OFFSET);
+
+ if (trc_level & kTraceDetail)
+ sql_print_information("%s: Got reply (%s, %lu)",
+ kWho, log_file_name, (ulong)log_file_pos);
+
+ result = reportReplyBinlog(server_id, log_file_name, log_file_pos);
+
+ l_end:
+ return function_exit(kWho, result);
+}
+
+
+int ReplSemiSyncMaster::resetMaster()
+{
+ const char *kWho = "ReplSemiSyncMaster::resetMaster";
+ int result = 0;
+
+ function_enter(kWho);
+
+
+ lock();
+
+ state_ = getMasterEnabled()? 1 : 0;
+
+ wait_file_name_inited_ = false;
+ reply_file_name_inited_ = false;
+ commit_file_name_inited_ = false;
+
+ rpl_semi_sync_master_yes_transactions = 0;
+ rpl_semi_sync_master_no_transactions = 0;
+ rpl_semi_sync_master_off_times = 0;
+ rpl_semi_sync_master_timefunc_fails = 0;
+ rpl_semi_sync_master_wait_sessions = 0;
+ rpl_semi_sync_master_wait_pos_backtraverse = 0;
+ rpl_semi_sync_master_trx_wait_num = 0;
+ rpl_semi_sync_master_trx_wait_time = 0;
+ rpl_semi_sync_master_net_wait_num = 0;
+ rpl_semi_sync_master_net_wait_time = 0;
+
+ unlock();
+
+ return function_exit(kWho, result);
+}
+
+void ReplSemiSyncMaster::setExportStats()
+{
+ lock();
+
+ rpl_semi_sync_master_status = state_;
+ rpl_semi_sync_master_avg_trx_wait_time=
+ ((rpl_semi_sync_master_trx_wait_num) ?
+ (unsigned long)((double)rpl_semi_sync_master_trx_wait_time /
+ ((double)rpl_semi_sync_master_trx_wait_num)) : 0);
+ rpl_semi_sync_master_avg_net_wait_time=
+ ((rpl_semi_sync_master_net_wait_num) ?
+ (unsigned long)((double)rpl_semi_sync_master_net_wait_time /
+ ((double)rpl_semi_sync_master_net_wait_num)) : 0);
+
+ unlock();
+}
+
+/* Get the waiting time given the wait's staring time.
+ *
+ * Return:
+ * >= 0: the waiting time in microsecons(us)
+ * < 0: error in gettimeofday or time back traverse
+ */
+static int getWaitTime(const struct timeval& start_tv)
+{
+ unsigned long long start_usecs, end_usecs;
+ struct timeval end_tv;
+ int end_time_err;
+
+ /* Starting time in microseconds(us). */
+ start_usecs = start_tv.tv_sec * TIME_MILLION + start_tv.tv_usec;
+
+ /* Get the wait time interval. */
+ end_time_err = gettimeofday(&end_tv, 0);
+
+ /* Ending time in microseconds(us). */
+ end_usecs = end_tv.tv_sec * TIME_MILLION + end_tv.tv_usec;
+
+ if (end_time_err != 0 || end_usecs < start_usecs)
+ return -1;
+
+ return (int)(end_usecs - start_usecs);
+}
diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h
new file mode 100644
index 00000000000..d2b87745600
--- /dev/null
+++ b/plugin/semisync/semisync_master.h
@@ -0,0 +1,374 @@
+/* Copyright (C) 2007 Google Inc.
+ Copyright (C) 2008 MySQL AB
+
+ 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+
+#ifndef SEMISYNC_MASTER_H
+#define SEMISYNC_MASTER_H
+
+#include "semisync.h"
+
+/**
+ This class manages memory for active transaction list.
+
+ We record each active transaction with a TranxNode. Because each
+ session can only have only one open transaction, the total active
+ transaction nodes can not exceed the maximum sessions. Currently
+ in MySQL, sessions are the same as connections.
+*/
+class ActiveTranx
+ :public Trace {
+private:
+ struct TranxNode {
+ char *log_name_;
+ my_off_t log_pos_;
+ struct TranxNode *next_; /* the next node in the sorted list */
+ struct TranxNode *hash_next_; /* the next node during hash collision */
+ };
+
+ /* The following data structure maintains an active transaction list. */
+ TranxNode *node_array_;
+ TranxNode *free_pool_;
+
+ /* These two record the active transaction list in sort order. */
+ TranxNode *trx_front_, *trx_rear_;
+
+ TranxNode **trx_htb_; /* A hash table on active transactions. */
+
+ int num_transactions_; /* maximum transactions */
+ int num_entries_; /* maximum hash table entries */
+ pthread_mutex_t *lock_; /* mutex lock */
+
+ inline void assert_lock_owner();
+
+ inline TranxNode* alloc_tranx_node();
+
+ inline unsigned int calc_hash(const unsigned char *key,unsigned int length);
+ unsigned int get_hash_value(const char *log_file_name, my_off_t log_file_pos);
+
+ int compare(const char *log_file_name1, my_off_t log_file_pos1,
+ const TranxNode *node2) {
+ return compare(log_file_name1, log_file_pos1,
+ node2->log_name_, node2->log_pos_);
+ }
+ int compare(const TranxNode *node1,
+ const char *log_file_name2, my_off_t log_file_pos2) {
+ return compare(node1->log_name_, node1->log_pos_,
+ log_file_name2, log_file_pos2);
+ }
+ int compare(const TranxNode *node1, const TranxNode *node2) {
+ return compare(node1->log_name_, node1->log_pos_,
+ node2->log_name_, node2->log_pos_);
+ }
+
+public:
+ ActiveTranx(int max_connections, pthread_mutex_t *lock,
+ unsigned long trace_level);
+ ~ActiveTranx();
+
+ /* Insert an active transaction node with the specified position.
+ *
+ * Return:
+ * 0: success; non-zero: error
+ */
+ int insert_tranx_node(const char *log_file_name, my_off_t log_file_pos);
+
+ /* Clear the active transaction nodes until(inclusive) the specified
+ * position.
+ * If log_file_name is NULL, everything will be cleared: the sorted
+ * list and the hash table will be reset to empty.
+ *
+ * Return:
+ * 0: success; non-zero: error
+ */
+ int clear_active_tranx_nodes(const char *log_file_name,
+ my_off_t log_file_pos);
+
+ /* Given a position, check to see whether the position is an active
+ * transaction's ending position by probing the hash table.
+ */
+ bool is_tranx_end_pos(const char *log_file_name, my_off_t log_file_pos);
+
+ /* Given two binlog positions, compare which one is bigger based on
+ * (file_name, file_position).
+ */
+ static int compare(const char *log_file_name1, my_off_t log_file_pos1,
+ const char *log_file_name2, my_off_t log_file_pos2);
+
+};
+
+/**
+ The extension class for the master of semi-synchronous replication
+*/
+class ReplSemiSyncMaster
+ :public ReplSemiSyncBase {
+ private:
+ ActiveTranx *active_tranxs_; /* active transaction list: the list will
+ be cleared when semi-sync switches off. */
+
+ /* True when initObject has been called */
+ bool init_done_;
+
+ /* This cond variable is signaled when enough binlog has been sent to slave,
+ * so that a waiting trx can return the 'ok' to the client for a commit.
+ */
+ pthread_cond_t COND_binlog_send_;
+
+ /* Mutex that protects the following state variables and the active
+ * transaction list.
+ * Under no cirumstances we can acquire mysql_bin_log.LOCK_log if we are
+ * already holding LOCK_binlog_ because it can cause deadlocks.
+ */
+ pthread_mutex_t LOCK_binlog_;
+
+ /* This is set to true when reply_file_name_ contains meaningful data. */
+ bool reply_file_name_inited_;
+
+ /* The binlog name up to which we have received replies from any slaves. */
+ char reply_file_name_[FN_REFLEN];
+
+ /* The position in that file up to which we have the reply from any slaves. */
+ my_off_t reply_file_pos_;
+
+ /* This is set to true when we know the 'smallest' wait position. */
+ bool wait_file_name_inited_;
+
+ /* NULL, or the 'smallest' filename that a transaction is waiting for
+ * slave replies.
+ */
+ char wait_file_name_[FN_REFLEN];
+
+ /* The smallest position in that file that a trx is waiting for: the trx
+ * can proceed and send an 'ok' to the client when the master has got the
+ * reply from the slave indicating that it already got the binlog events.
+ */
+ my_off_t wait_file_pos_;
+
+ /* This is set to true when we know the 'largest' transaction commit
+ * position in the binlog file.
+ * We always maintain the position no matter whether semi-sync is switched
+ * on switched off. When a transaction wait timeout occurs, semi-sync will
+ * switch off. Binlog-dump thread can use the three fields to detect when
+ * slaves catch up on replication so that semi-sync can switch on again.
+ */
+ bool commit_file_name_inited_;
+
+ /* The 'largest' binlog filename that a commit transaction is seeing. */
+ char commit_file_name_[FN_REFLEN];
+
+ /* The 'largest' position in that file that a commit transaction is seeing. */
+ my_off_t commit_file_pos_;
+
+ /* All global variables which can be set by parameters. */
+ volatile bool master_enabled_; /* semi-sync is enabled on the master */
+ unsigned long wait_timeout_; /* timeout period(ms) during tranx wait */
+
+ bool state_; /* whether semi-sync is switched */
+
+ /* The number of maximum active transactions. This should be the same as
+ * maximum connections because MySQL does not do connection sharing now.
+ */
+ int max_transactions_;
+
+ void lock();
+ void unlock();
+ void cond_broadcast();
+ int cond_timewait(struct timespec *wait_time);
+
+ /* Is semi-sync replication on? */
+ bool is_on() {
+ return (state_);
+ }
+
+ void set_master_enabled(bool enabled) {
+ master_enabled_ = enabled;
+ }
+
+ /* Switch semi-sync off because of timeout in transaction waiting. */
+ int switch_off();
+
+ /* Switch semi-sync on when slaves catch up. */
+ int try_switch_on(int server_id,
+ const char *log_file_name, my_off_t log_file_pos);
+
+ public:
+ ReplSemiSyncMaster();
+ ~ReplSemiSyncMaster();
+
+ bool getMasterEnabled() {
+ return master_enabled_;
+ }
+ void setTraceLevel(unsigned long trace_level) {
+ trace_level_ = trace_level;
+ if (active_tranxs_)
+ active_tranxs_->trace_level_ = trace_level;
+ }
+
+ /* Set the transaction wait timeout period, in milliseconds. */
+ void setWaitTimeout(unsigned long wait_timeout) {
+ wait_timeout_ = wait_timeout;
+ }
+
+ /* Initialize this class after MySQL parameters are initialized. this
+ * function should be called once at bootstrap time.
+ */
+ int initObject();
+
+ /* Enable the object to enable semi-sync replication inside the master. */
+ int enableMaster();
+
+ /* Enable the object to enable semi-sync replication inside the master. */
+ int disableMaster();
+
+ /* Add a semi-sync replication slave */
+ void add_slave();
+
+ /* Remove a semi-sync replication slave */
+ void remove_slave();
+
+ /* Is the slave servered by the thread requested semi-sync */
+ bool is_semi_sync_slave();
+
+ /* In semi-sync replication, reports up to which binlog position we have
+ * received replies from the slave indicating that it already get the events.
+ *
+ * Input:
+ * server_id - (IN) master server id number
+ * log_file_name - (IN) binlog file name
+ * end_offset - (IN) the offset in the binlog file up to which we have
+ * the replies from the slave
+ *
+ * Return:
+ * 0: success; non-zero: error
+ */
+ int reportReplyBinlog(uint32 server_id,
+ const char* log_file_name,
+ my_off_t end_offset);
+
+ /* Commit a transaction in the final step. This function is called from
+ * InnoDB before returning from the low commit. If semi-sync is switch on,
+ * the function will wait to see whether binlog-dump thread get the reply for
+ * the events of the transaction. Remember that this is not a direct wait,
+ * instead, it waits to see whether the binlog-dump thread has reached the
+ * point. If the wait times out, semi-sync status will be switched off and
+ * all other transaction would not wait either.
+ *
+ * Input: (the transaction events' ending binlog position)
+ * trx_wait_binlog_name - (IN) ending position's file name
+ * trx_wait_binlog_pos - (IN) ending position's file offset
+ *
+ * Return:
+ * 0: success; non-zero: error
+ */
+ int commitTrx(const char* trx_wait_binlog_name,
+ my_off_t trx_wait_binlog_pos);
+
+ /* Reserve space in the replication event packet header:
+ * . slave semi-sync off: 1 byte - (0)
+ * . slave semi-sync on: 3 byte - (0, 0xef, 0/1}
+ *
+ * Input:
+ * header - (IN) the header buffer
+ * size - (IN) size of the header buffer
+ *
+ * Return:
+ * size of the bytes reserved for header
+ */
+ int reserveSyncHeader(unsigned char *header, unsigned long size);
+
+ /* Update the sync bit in the packet header to indicate to the slave whether
+ * the master will wait for the reply of the event. If semi-sync is switched
+ * off and we detect that the slave is catching up, we switch semi-sync on.
+ *
+ * Input:
+ * packet - (IN) the packet containing the replication event
+ * log_file_name - (IN) the event ending position's file name
+ * log_file_pos - (IN) the event ending position's file offset
+ * server_id - (IN) master server id number
+ *
+ * Return:
+ * 0: success; non-zero: error
+ */
+ int updateSyncHeader(unsigned char *packet,
+ const char *log_file_name,
+ my_off_t log_file_pos,
+ uint32 server_id);
+
+ /* Called when a transaction finished writing binlog events.
+ * . update the 'largest' transactions' binlog event position
+ * . insert the ending position in the active transaction list if
+ * semi-sync is on
+ *
+ * Input: (the transaction events' ending binlog position)
+ * log_file_name - (IN) transaction ending position's file name
+ * log_file_pos - (IN) transaction ending position's file offset
+ *
+ * Return:
+ * 0: success; non-zero: error
+ */
+ int writeTranxInBinlog(const char* log_file_name, my_off_t log_file_pos);
+
+ /* Read the slave's reply so that we know how much progress the slave makes
+ * on receive replication events.
+ *
+ * Input:
+ * net - (IN) the connection to master
+ * server_id - (IN) master server id number
+ * event_buf - (IN) pointer to the event packet
+ *
+ * Return:
+ * 0: success; non-zero: error
+ */
+ int readSlaveReply(NET *net, uint32 server_id, const char *event_buf);
+
+ /* Export internal statistics for semi-sync replication. */
+ void setExportStats();
+
+ /* 'reset master' command is issued from the user and semi-sync need to
+ * go off for that.
+ */
+ int resetMaster();
+};
+
+/* System and status variables for the master component */
+extern char rpl_semi_sync_master_enabled;
+extern char rpl_semi_sync_master_status;
+extern unsigned long rpl_semi_sync_master_clients;
+extern unsigned long rpl_semi_sync_master_timeout;
+extern unsigned long rpl_semi_sync_master_trace_level;
+extern unsigned long rpl_semi_sync_master_yes_transactions;
+extern unsigned long rpl_semi_sync_master_no_transactions;
+extern unsigned long rpl_semi_sync_master_off_times;
+extern unsigned long rpl_semi_sync_master_wait_timeouts;
+extern unsigned long rpl_semi_sync_master_timefunc_fails;
+extern unsigned long rpl_semi_sync_master_num_timeouts;
+extern unsigned long rpl_semi_sync_master_wait_sessions;
+extern unsigned long rpl_semi_sync_master_wait_pos_backtraverse;
+extern unsigned long rpl_semi_sync_master_avg_trx_wait_time;
+extern unsigned long rpl_semi_sync_master_avg_net_wait_time;
+extern unsigned long long rpl_semi_sync_master_net_wait_num;
+extern unsigned long long rpl_semi_sync_master_trx_wait_num;
+extern unsigned long long rpl_semi_sync_master_net_wait_time;
+extern unsigned long long rpl_semi_sync_master_trx_wait_time;
+
+/*
+ This indicates whether we should keep waiting if no semi-sync slave
+ is available.
+ 0 : stop waiting if detected no avaialable semi-sync slave.
+ 1 (default) : keep waiting until timeout even no available semi-sync slave.
+*/
+extern char rpl_semi_sync_master_wait_no_slave;
+
+#endif /* SEMISYNC_MASTER_H */
diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc
new file mode 100644
index 00000000000..efcb7172b28
--- /dev/null
+++ b/plugin/semisync/semisync_master_plugin.cc
@@ -0,0 +1,394 @@
+/* Copyright (C) 2007 Google Inc.
+ Copyright (C) 2008 MySQL AB
+
+ 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+
+#include "semisync_master.h"
+
+ReplSemiSyncMaster repl_semisync;
+
+int repl_semi_report_binlog_update(Binlog_storage_param *param,
+ const char *log_file,
+ my_off_t log_pos, uint32 flags)
+{
+ int error= 0;
+
+ if (repl_semisync.getMasterEnabled())
+ {
+ /*
+ Let us store the binlog file name and the position, so that
+ we know how long to wait for the binlog to the replicated to
+ the slave in synchronous replication.
+ */
+ error= repl_semisync.writeTranxInBinlog(log_file,
+ log_pos);
+ }
+
+ return error;
+}
+
+int repl_semi_request_commit(Trans_param *param)
+{
+ return 0;
+}
+
+int repl_semi_report_commit(Trans_param *param)
+{
+
+ bool is_real_trans= param->flags & TRANS_IS_REAL_TRANS;
+
+ if (is_real_trans && param->log_pos)
+ {
+ const char *binlog_name= param->log_file;
+ return repl_semisync.commitTrx(binlog_name, param->log_pos);
+ }
+ return 0;
+}
+
+int repl_semi_report_rollback(Trans_param *param)
+{
+ return repl_semi_report_commit(param);
+}
+
+int repl_semi_binlog_dump_start(Binlog_transmit_param *param,
+ const char *log_file,
+ my_off_t log_pos)
+{
+ bool semi_sync_slave= repl_semisync.is_semi_sync_slave();
+
+ if (semi_sync_slave)
+ {
+ /* One more semi-sync slave */
+ repl_semisync.add_slave();
+
+ /*
+ Let's assume this semi-sync slave has already received all
+ binlog events before the filename and position it requests.
+ */
+ repl_semisync.reportReplyBinlog(param->server_id, log_file, log_pos);
+ }
+ sql_print_information("Start %s binlog_dump to slave (server_id: %d), pos(%s, %lu)",
+ semi_sync_slave ? "semi-sync" : "asynchronous",
+ param->server_id, log_file, (unsigned long)log_pos);
+
+ return 0;
+}
+
+int repl_semi_binlog_dump_end(Binlog_transmit_param *param)
+{
+ bool semi_sync_slave= repl_semisync.is_semi_sync_slave();
+
+ sql_print_information("Stop %s binlog_dump to slave (server_id: %d)",
+ semi_sync_slave ? "semi-sync" : "asynchronous",
+ param->server_id);
+ if (semi_sync_slave)
+ {
+ /* One less semi-sync slave */
+ repl_semisync.remove_slave();
+ }
+ return 0;
+}
+
+int repl_semi_reserve_header(Binlog_transmit_param *param,
+ unsigned char *header,
+ unsigned long size, unsigned long *len)
+{
+ *len += repl_semisync.reserveSyncHeader(header, size);
+ return 0;
+}
+
+int repl_semi_before_send_event(Binlog_transmit_param *param,
+ unsigned char *packet, unsigned long len,
+ const char *log_file, my_off_t log_pos)
+{
+ return repl_semisync.updateSyncHeader(packet,
+ log_file,
+ log_pos,
+ param->server_id);
+}
+
+int repl_semi_after_send_event(Binlog_transmit_param *param,
+ const char *event_buf, unsigned long len)
+{
+ if (repl_semisync.is_semi_sync_slave())
+ {
+ THD *thd= current_thd;
+ /*
+ Possible errors in reading slave reply are ignored deliberately
+ because we do not want dump thread to quit on this. Error
+ messages are already reported.
+ */
+ (void) repl_semisync.readSlaveReply(&thd->net,
+ param->server_id, event_buf);
+ thd->clear_error();
+ }
+ return 0;
+}
+
+int repl_semi_reset_master(Binlog_transmit_param *param)
+{
+ if (repl_semisync.resetMaster())
+ return 1;
+ return 0;
+}
+
+/*
+ semisync system variables
+ */
+static void fix_rpl_semi_sync_master_timeout(MYSQL_THD thd,
+ SYS_VAR *var,
+ void *ptr,
+ const void *val);
+
+static void fix_rpl_semi_sync_master_trace_level(MYSQL_THD thd,
+ SYS_VAR *var,
+ void *ptr,
+ const void *val);
+
+static void fix_rpl_semi_sync_master_enabled(MYSQL_THD thd,
+ SYS_VAR *var,
+ void *ptr,
+ const void *val);
+
+static MYSQL_SYSVAR_BOOL(enabled, rpl_semi_sync_master_enabled,
+ PLUGIN_VAR_OPCMDARG,
+ "Enable semi-synchronous replication master (disabled by default). ",
+ NULL, // check
+ &fix_rpl_semi_sync_master_enabled, // update
+ 0);
+
+static MYSQL_SYSVAR_ULONG(timeout, rpl_semi_sync_master_timeout,
+ PLUGIN_VAR_OPCMDARG,
+ "The timeout value (in ms) for semi-synchronous replication in the master",
+ NULL, // check
+ fix_rpl_semi_sync_master_timeout, // update
+ 10000, 0, ~0L, 1);
+
+static MYSQL_SYSVAR_BOOL(wait_no_slave, rpl_semi_sync_master_wait_no_slave,
+ PLUGIN_VAR_OPCMDARG,
+ "Wait until timeout when no semi-synchronous replication slave available (enabled by default). ",
+ NULL, // check
+ NULL, // update
+ 1);
+
+static MYSQL_SYSVAR_ULONG(trace_level, rpl_semi_sync_master_trace_level,
+ PLUGIN_VAR_OPCMDARG,
+ "The tracing level for semi-sync replication.",
+ NULL, // check
+ &fix_rpl_semi_sync_master_trace_level, // update
+ 32, 0, ~0L, 1);
+
+static SYS_VAR* semi_sync_master_system_vars[]= {
+ MYSQL_SYSVAR(enabled),
+ MYSQL_SYSVAR(timeout),
+ MYSQL_SYSVAR(wait_no_slave),
+ MYSQL_SYSVAR(trace_level),
+ NULL,
+};
+
+
+static void fix_rpl_semi_sync_master_timeout(MYSQL_THD thd,
+ SYS_VAR *var,
+ void *ptr,
+ const void *val)
+{
+ *(unsigned long *)ptr= *(unsigned long *)val;
+ repl_semisync.setWaitTimeout(rpl_semi_sync_master_timeout);
+ return;
+}
+
+static void fix_rpl_semi_sync_master_trace_level(MYSQL_THD thd,
+ SYS_VAR *var,
+ void *ptr,
+ const void *val)
+{
+ *(unsigned long *)ptr= *(unsigned long *)val;
+ repl_semisync.setTraceLevel(rpl_semi_sync_master_trace_level);
+ return;
+}
+
+static void fix_rpl_semi_sync_master_enabled(MYSQL_THD thd,
+ SYS_VAR *var,
+ void *ptr,
+ const void *val)
+{
+ *(char *)ptr= *(char *)val;
+ if (rpl_semi_sync_master_enabled)
+ {
+ if (repl_semisync.enableMaster() != 0)
+ rpl_semi_sync_master_enabled = false;
+ }
+ else
+ {
+ if (repl_semisync.disableMaster() != 0)
+ rpl_semi_sync_master_enabled = true;
+ }
+
+ return;
+}
+
+Trans_observer trans_observer = {
+ sizeof(Trans_observer), // len
+
+ repl_semi_report_commit, // after_commit
+ repl_semi_report_rollback, // after_rollback
+};
+
+Binlog_storage_observer storage_observer = {
+ sizeof(Binlog_storage_observer), // len
+
+ repl_semi_report_binlog_update, // report_update
+};
+
+Binlog_transmit_observer transmit_observer = {
+ sizeof(Binlog_transmit_observer), // len
+
+ repl_semi_binlog_dump_start, // start
+ repl_semi_binlog_dump_end, // stop
+ repl_semi_reserve_header, // reserve_header
+ repl_semi_before_send_event, // before_send_event
+ repl_semi_after_send_event, // after_send_event
+ repl_semi_reset_master, // reset
+};
+
+
+#define SHOW_FNAME(name) \
+ rpl_semi_sync_master_show_##name
+
+#define DEF_SHOW_FUNC(name, show_type) \
+ static int SHOW_FNAME(name)(MYSQL_THD thd, SHOW_VAR *var, char *buff) \
+ { \
+ repl_semisync.setExportStats(); \
+ var->type= show_type; \
+ var->value= (char *)&rpl_semi_sync_master_##name; \
+ return 0; \
+ }
+
+DEF_SHOW_FUNC(status, SHOW_BOOL)
+DEF_SHOW_FUNC(clients, SHOW_LONG)
+DEF_SHOW_FUNC(wait_sessions, SHOW_LONG)
+DEF_SHOW_FUNC(trx_wait_time, SHOW_LONGLONG)
+DEF_SHOW_FUNC(trx_wait_num, SHOW_LONGLONG)
+DEF_SHOW_FUNC(net_wait_time, SHOW_LONGLONG)
+DEF_SHOW_FUNC(net_wait_num, SHOW_LONGLONG)
+DEF_SHOW_FUNC(avg_net_wait_time, SHOW_LONG)
+DEF_SHOW_FUNC(avg_trx_wait_time, SHOW_LONG)
+
+
+/* plugin status variables */
+static SHOW_VAR semi_sync_master_status_vars[]= {
+ {"Rpl_semi_sync_master_status",
+ (char*) &SHOW_FNAME(status),
+ SHOW_FUNC},
+ {"Rpl_semi_sync_master_clients",
+ (char*) &SHOW_FNAME(clients),
+ SHOW_FUNC},
+ {"Rpl_semi_sync_master_yes_tx",
+ (char*) &rpl_semi_sync_master_yes_transactions,
+ SHOW_LONG},
+ {"Rpl_semi_sync_master_no_tx",
+ (char*) &rpl_semi_sync_master_no_transactions,
+ SHOW_LONG},
+ {"Rpl_semi_sync_master_wait_sessions",
+ (char*) &SHOW_FNAME(wait_sessions),
+ SHOW_FUNC},
+ {"Rpl_semi_sync_master_no_times",
+ (char*) &rpl_semi_sync_master_off_times,
+ SHOW_LONG},
+ {"Rpl_semi_sync_master_timefunc_failures",
+ (char*) &rpl_semi_sync_master_timefunc_fails,
+ SHOW_LONG},
+ {"Rpl_semi_sync_master_wait_pos_backtraverse",
+ (char*) &rpl_semi_sync_master_wait_pos_backtraverse,
+ SHOW_LONG},
+ {"Rpl_semi_sync_master_tx_wait_time",
+ (char*) &SHOW_FNAME(trx_wait_time),
+ SHOW_FUNC},
+ {"Rpl_semi_sync_master_tx_waits",
+ (char*) &SHOW_FNAME(trx_wait_num),
+ SHOW_FUNC},
+ {"Rpl_semi_sync_master_tx_avg_wait_time",
+ (char*) &SHOW_FNAME(avg_trx_wait_time),
+ SHOW_FUNC},
+ {"Rpl_semi_sync_master_net_wait_time",
+ (char*) &SHOW_FNAME(net_wait_time),
+ SHOW_FUNC},
+ {"Rpl_semi_sync_master_net_waits",
+ (char*) &SHOW_FNAME(net_wait_num),
+ SHOW_FUNC},
+ {"Rpl_semi_sync_master_net_avg_wait_time",
+ (char*) &SHOW_FNAME(avg_net_wait_time),
+ SHOW_FUNC},
+ {NULL, NULL, SHOW_LONG},
+};
+
+
+static int semi_sync_master_plugin_init(void *p)
+{
+ if (repl_semisync.initObject())
+ return 1;
+ if (register_trans_observer(&trans_observer, p))
+ return 1;
+ if (register_binlog_storage_observer(&storage_observer, p))
+ return 1;
+ if (register_binlog_transmit_observer(&transmit_observer, p))
+ return 1;
+ return 0;
+}
+
+static int semi_sync_master_plugin_deinit(void *p)
+{
+ if (unregister_trans_observer(&trans_observer, p))
+ {
+ sql_print_error("unregister_trans_observer failed");
+ return 1;
+ }
+ if (unregister_binlog_storage_observer(&storage_observer, p))
+ {
+ sql_print_error("unregister_binlog_storage_observer failed");
+ return 1;
+ }
+ if (unregister_binlog_transmit_observer(&transmit_observer, p))
+ {
+ sql_print_error("unregister_binlog_transmit_observer failed");
+ return 1;
+ }
+ sql_print_information("unregister_replicator OK");
+ return 0;
+}
+
+struct Mysql_replication semi_sync_master_plugin= {
+ MYSQL_REPLICATION_INTERFACE_VERSION
+};
+
+/*
+ Plugin library descriptor
+*/
+mysql_declare_plugin(semi_sync_master)
+{
+ MYSQL_REPLICATION_PLUGIN,
+ &semi_sync_master_plugin,
+ "rpl_semi_sync_master",
+ "He Zhenxing",
+ "Semi-synchronous replication master",
+ PLUGIN_LICENSE_GPL,
+ semi_sync_master_plugin_init, /* Plugin Init */
+ semi_sync_master_plugin_deinit, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+ semi_sync_master_status_vars, /* status variables */
+ semi_sync_master_system_vars, /* system variables */
+ NULL /* config options */
+}
+mysql_declare_plugin_end;
diff --git a/plugin/semisync/semisync_slave.cc b/plugin/semisync/semisync_slave.cc
new file mode 100644
index 00000000000..109577fb688
--- /dev/null
+++ b/plugin/semisync/semisync_slave.cc
@@ -0,0 +1,138 @@
+/* Copyright (C) 2008 MySQL AB
+
+ 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+
+#include "semisync_slave.h"
+
+char rpl_semi_sync_slave_enabled;
+char rpl_semi_sync_slave_status= 0;
+unsigned long rpl_semi_sync_slave_trace_level;
+
+int ReplSemiSyncSlave::initObject()
+{
+ int result= 0;
+ const char *kWho = "ReplSemiSyncSlave::initObject";
+
+ if (init_done_)
+ {
+ fprintf(stderr, "%s called twice\n", kWho);
+ return 1;
+ }
+ init_done_ = true;
+
+ /* References to the parameter works after set_options(). */
+ setSlaveEnabled(rpl_semi_sync_slave_enabled);
+ setTraceLevel(rpl_semi_sync_slave_trace_level);
+
+ return result;
+}
+
+int ReplSemiSyncSlave::slaveReadSyncHeader(const char *header,
+ unsigned long total_len,
+ bool *need_reply,
+ const char **payload,
+ unsigned long *payload_len)
+{
+ const char *kWho = "ReplSemiSyncSlave::slaveReadSyncHeader";
+ int read_res = 0;
+ function_enter(kWho);
+
+ if ((unsigned char)(header[0]) == kPacketMagicNum)
+ {
+ *need_reply = (header[1] & kPacketFlagSync);
+ *payload_len = total_len - 2;
+ *payload = header + 2;
+
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: reply - %d", kWho, *need_reply);
+ }
+ else
+ {
+ sql_print_error("Missing magic number for semi-sync packet, packet "
+ "len: %lu", total_len);
+ read_res = -1;
+ }
+
+ return function_exit(kWho, read_res);
+}
+
+int ReplSemiSyncSlave::slaveStart(Binlog_relay_IO_param *param)
+{
+ bool semi_sync= getSlaveEnabled();
+
+ sql_print_information("Slave I/O thread: Start %s replication to\
+ master '%s@%s:%d' in log '%s' at position %lu",
+ semi_sync ? "semi-sync" : "asynchronous",
+ param->user, param->host, param->port,
+ param->master_log_name[0] ? param->master_log_name : "FIRST",
+ (unsigned long)param->master_log_pos);
+
+ if (semi_sync && !rpl_semi_sync_slave_status)
+ rpl_semi_sync_slave_status= 1;
+ return 0;
+}
+
+int ReplSemiSyncSlave::slaveStop(Binlog_relay_IO_param *param)
+{
+ if (rpl_semi_sync_slave_status)
+ rpl_semi_sync_slave_status= 0;
+ if (mysql_reply)
+ mysql_close(mysql_reply);
+ mysql_reply= 0;
+ return 0;
+}
+
+int ReplSemiSyncSlave::slaveReply(MYSQL *mysql,
+ const char *binlog_filename,
+ my_off_t binlog_filepos)
+{
+ const char *kWho = "ReplSemiSyncSlave::slaveReply";
+ NET *net= &mysql->net;
+ uchar reply_buffer[REPLY_MAGIC_NUM_LEN
+ + REPLY_BINLOG_POS_LEN
+ + REPLY_BINLOG_NAME_LEN];
+ int reply_res, name_len = strlen(binlog_filename);
+
+ function_enter(kWho);
+
+ /* Prepare the buffer of the reply. */
+ reply_buffer[REPLY_MAGIC_NUM_OFFSET] = kPacketMagicNum;
+ int8store(reply_buffer + REPLY_BINLOG_POS_OFFSET, binlog_filepos);
+ memcpy(reply_buffer + REPLY_BINLOG_NAME_OFFSET,
+ binlog_filename,
+ name_len + 1 /* including trailing '\0' */);
+
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: reply (%s, %lu)", kWho,
+ binlog_filename, (ulong)binlog_filepos);
+
+ net_clear(net, 0);
+ /* Send the reply. */
+ reply_res = my_net_write(net, reply_buffer,
+ name_len + REPLY_BINLOG_NAME_OFFSET);
+ if (!reply_res)
+ {
+ reply_res = net_flush(net);
+ if (reply_res)
+ sql_print_error("Semi-sync slave net_flush() reply failed");
+ }
+ else
+ {
+ sql_print_error("Semi-sync slave send reply failed: %s (%d)",
+ net->last_error, net->last_errno);
+ }
+
+ return function_exit(kWho, reply_res);
+}
diff --git a/plugin/semisync/semisync_slave.h b/plugin/semisync/semisync_slave.h
new file mode 100644
index 00000000000..19ea43e2653
--- /dev/null
+++ b/plugin/semisync/semisync_slave.h
@@ -0,0 +1,96 @@
+/* Copyright (C) 2006 MySQL AB
+
+ 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+
+#ifndef SEMISYNC_SLAVE_H
+#define SEMISYNC_SLAVE_H
+
+#include "semisync.h"
+
+/**
+ The extension class for the slave of semi-synchronous replication
+*/
+class ReplSemiSyncSlave
+ :public ReplSemiSyncBase {
+public:
+ ReplSemiSyncSlave()
+ :slave_enabled_(false)
+ {}
+ ~ReplSemiSyncSlave() {}
+
+ void setTraceLevel(unsigned long trace_level) {
+ trace_level_ = trace_level;
+ }
+
+ /* Initialize this class after MySQL parameters are initialized. this
+ * function should be called once at bootstrap time.
+ */
+ int initObject();
+
+ bool getSlaveEnabled() {
+ return slave_enabled_;
+ }
+ void setSlaveEnabled(bool enabled) {
+ slave_enabled_ = enabled;
+ }
+
+ /* A slave reads the semi-sync packet header and separate the metadata
+ * from the payload data.
+ *
+ * Input:
+ * header - (IN) packet header pointer
+ * total_len - (IN) total packet length: metadata + payload
+ * need_reply - (IN) whether the master is waiting for the reply
+ * payload - (IN) payload: the replication event
+ * payload_len - (IN) payload length
+ *
+ * Return:
+ * 0: success; non-zero: error
+ */
+ int slaveReadSyncHeader(const char *header, unsigned long total_len, bool *need_reply,
+ const char **payload, unsigned long *payload_len);
+
+ /* A slave replies to the master indicating its replication process. It
+ * indicates that the slave has received all events before the specified
+ * binlog position.
+ *
+ * Input:
+ * mysql - (IN) the mysql network connection
+ * binlog_filename - (IN) the reply point's binlog file name
+ * binlog_filepos - (IN) the reply point's binlog file offset
+ *
+ * Return:
+ * 0: success; non-zero: error
+ */
+ int slaveReply(MYSQL *mysql, const char *binlog_filename,
+ my_off_t binlog_filepos);
+
+ int slaveStart(Binlog_relay_IO_param *param);
+ int slaveStop(Binlog_relay_IO_param *param);
+
+private:
+ /* True when initObject has been called */
+ bool init_done_;
+ bool slave_enabled_; /* semi-sycn is enabled on the slave */
+ MYSQL *mysql_reply; /* connection to send reply */
+};
+
+
+/* System and status variables for the slave component */
+extern char rpl_semi_sync_slave_enabled;
+extern unsigned long rpl_semi_sync_slave_trace_level;
+extern char rpl_semi_sync_slave_status;
+
+#endif /* SEMISYNC_SLAVE_H */
diff --git a/plugin/semisync/semisync_slave_plugin.cc b/plugin/semisync/semisync_slave_plugin.cc
new file mode 100644
index 00000000000..0bd9e1b8b21
--- /dev/null
+++ b/plugin/semisync/semisync_slave_plugin.cc
@@ -0,0 +1,226 @@
+/* Copyright (C) 2007 Google Inc.
+ Copyright (C) 2008 MySQL AB
+
+ 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+
+#include "semisync_slave.h"
+
+ReplSemiSyncSlave repl_semisync;
+
+/*
+ indicate whether or not the slave should send a reply to the master.
+
+ This is set to true in repl_semi_slave_read_event if the current
+ event read is the last event of a transaction. And the value is
+ checked in repl_semi_slave_queue_event.
+*/
+bool semi_sync_need_reply= false;
+
+int repl_semi_reset_slave(Binlog_relay_IO_param *param)
+{
+ // TODO: reset semi-sync slave status here
+ return 0;
+}
+
+int repl_semi_slave_request_dump(Binlog_relay_IO_param *param,
+ uint32 flags)
+{
+ MYSQL *mysql= param->mysql;
+ MYSQL_RES *res= 0;
+ MYSQL_ROW row;
+ const char *query;
+
+ if (!repl_semisync.getSlaveEnabled())
+ return 0;
+
+ /* Check if master server has semi-sync plugin installed */
+ query= "SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled'";
+ if (mysql_real_query(mysql, query, strlen(query)) ||
+ !(res= mysql_store_result(mysql)))
+ {
+ mysql_free_result(mysql_store_result(mysql));
+ sql_print_error("Execution failed on master: %s", query);
+ return 1;
+ }
+
+ row= mysql_fetch_row(res);
+ if (!row)
+ {
+ /* Master does not support semi-sync */
+ sql_print_warning("Master server does not support semi-sync, "
+ "fallback to asynchronous replication");
+ rpl_semi_sync_slave_status= 0;
+ return 0;
+ }
+
+ /*
+ Tell master dump thread that we want to do semi-sync
+ replication
+ */
+ query= "SET @rpl_semi_sync_slave= 1";
+ if (mysql_real_query(mysql, query, strlen(query)))
+ {
+ sql_print_error("Set 'rpl_semi_sync_slave=1' on master failed");
+ mysql_free_result(mysql_store_result(mysql));
+ return 1;
+ }
+ mysql_free_result(mysql_store_result(mysql));
+ rpl_semi_sync_slave_status= 1;
+ return 0;
+}
+
+int repl_semi_slave_read_event(Binlog_relay_IO_param *param,
+ const char *packet, unsigned long len,
+ const char **event_buf, unsigned long *event_len)
+{
+ if (rpl_semi_sync_slave_status)
+ return repl_semisync.slaveReadSyncHeader(packet, len,
+ &semi_sync_need_reply,
+ event_buf, event_len);
+ *event_buf= packet;
+ *event_len= len;
+ return 0;
+}
+
+int repl_semi_slave_queue_event(Binlog_relay_IO_param *param,
+ const char *event_buf,
+ unsigned long event_len,
+ uint32 flags)
+{
+ if (rpl_semi_sync_slave_status && semi_sync_need_reply)
+ {
+ /*
+ We deliberately ignore the error in slaveReply, such error
+ should not cause the slave IO thread to stop, and the error
+ messages are already reported.
+ */
+ (void) repl_semisync.slaveReply(param->mysql,
+ param->master_log_name,
+ param->master_log_pos);
+ }
+ return 0;
+}
+
+int repl_semi_slave_io_start(Binlog_relay_IO_param *param)
+{
+ return repl_semisync.slaveStart(param);
+}
+
+int repl_semi_slave_io_end(Binlog_relay_IO_param *param)
+{
+ return repl_semisync.slaveStop(param);
+}
+
+
+static void fix_rpl_semi_sync_slave_enabled(MYSQL_THD thd,
+ SYS_VAR *var,
+ void *ptr,
+ const void *val)
+{
+ *(char *)ptr= *(char *)val;
+ repl_semisync.setSlaveEnabled(rpl_semi_sync_slave_enabled != 0);
+ return;
+}
+
+static void fix_rpl_semi_sync_trace_level(MYSQL_THD thd,
+ SYS_VAR *var,
+ void *ptr,
+ const void *val)
+{
+ *(unsigned long *)ptr= *(unsigned long *)val;
+ repl_semisync.setTraceLevel(rpl_semi_sync_slave_trace_level);
+ return;
+}
+
+/* plugin system variables */
+static MYSQL_SYSVAR_BOOL(enabled, rpl_semi_sync_slave_enabled,
+ PLUGIN_VAR_OPCMDARG,
+ "Enable semi-synchronous replication slave (disabled by default). ",
+ NULL, // check
+ &fix_rpl_semi_sync_slave_enabled, // update
+ 0);
+
+static MYSQL_SYSVAR_ULONG(trace_level, rpl_semi_sync_slave_trace_level,
+ PLUGIN_VAR_OPCMDARG,
+ "The tracing level for semi-sync replication.",
+ NULL, // check
+ &fix_rpl_semi_sync_trace_level, // update
+ 32, 0, ~0L, 1);
+
+static SYS_VAR* semi_sync_slave_system_vars[]= {
+ MYSQL_SYSVAR(enabled),
+ MYSQL_SYSVAR(trace_level),
+ NULL,
+};
+
+
+/* plugin status variables */
+static SHOW_VAR semi_sync_slave_status_vars[]= {
+ {"Rpl_semi_sync_slave_status",
+ (char*) &rpl_semi_sync_slave_status, SHOW_BOOL},
+ {NULL, NULL, SHOW_BOOL},
+};
+
+Binlog_relay_IO_observer relay_io_observer = {
+ sizeof(Binlog_relay_IO_observer), // len
+
+ repl_semi_slave_io_start, // start
+ repl_semi_slave_io_end, // stop
+ repl_semi_slave_request_dump, // request_transmit
+ repl_semi_slave_read_event, // after_read_event
+ repl_semi_slave_queue_event, // after_queue_event
+ repl_semi_reset_slave, // reset
+};
+
+static int semi_sync_slave_plugin_init(void *p)
+{
+ if (repl_semisync.initObject())
+ return 1;
+ if (register_binlog_relay_io_observer(&relay_io_observer, p))
+ return 1;
+ return 0;
+}
+
+static int semi_sync_slave_plugin_deinit(void *p)
+{
+ if (unregister_binlog_relay_io_observer(&relay_io_observer, p))
+ return 1;
+ return 0;
+}
+
+
+struct Mysql_replication semi_sync_slave_plugin= {
+ MYSQL_REPLICATION_INTERFACE_VERSION
+};
+
+/*
+ Plugin library descriptor
+*/
+mysql_declare_plugin(semi_sync_slave)
+{
+ MYSQL_REPLICATION_PLUGIN,
+ &semi_sync_slave_plugin,
+ "rpl_semi_sync_slave",
+ "He Zhenxing",
+ "Semi-synchronous replication slave",
+ PLUGIN_LICENSE_GPL,
+ semi_sync_slave_plugin_init, /* Plugin Init */
+ semi_sync_slave_plugin_deinit, /* Plugin Deinit */
+ 0x0100 /* 1.0 */,
+ semi_sync_slave_status_vars, /* status variables */
+ semi_sync_slave_system_vars, /* system variables */
+ NULL /* config options */
+}
+mysql_declare_plugin_end;
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index 923497b0ab2..a81c0964fdd 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -28,9 +28,9 @@ CREATE TABLE IF NOT EXISTS plugin ( name char(64) binary DEFAULT '' NOT NULL, dl
CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
-CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
+CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
-CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
+CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
@@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint sign
CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
-CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
+CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
-- Create general_log if CSV is enabled.
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index 1844860c84d..3ebfc4b1941 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -346,7 +346,7 @@ ALTER TABLE procs_priv
COLLATE utf8_general_ci NOT NULL AFTER Routine_name;
ALTER TABLE procs_priv
- MODIFY Timestamp timestamp(14) AFTER Proc_priv;
+ MODIFY Timestamp timestamp AFTER Proc_priv;
#
# proc
diff --git a/sql-common/client.c b/sql-common/client.c
index 51bbda3bade..a4a2e518edf 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1053,6 +1053,8 @@ void mysql_read_default_options(struct st_mysql_options *options,
char **option=argv;
while (*++option)
{
+ if (option[0] == args_separator) /* skip arguments separator */
+ continue;
/* DBUG_PRINT("info",("option: %s",option[0])); */
if (option[0][0] == '-' && option[0][1] == '-')
{
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 7f6074c903c..46cad441e12 100755
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -76,6 +76,7 @@ SET (SQL_SOURCE
rpl_rli.cc rpl_mi.cc sql_servers.cc
sql_connect.cc scheduler.cc
sql_profile.cc event_parse_data.cc
+ rpl_handler.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
${PROJECT_SOURCE_DIR}/include/mysqld_error.h
diff --git a/sql/Makefile.am b/sql/Makefile.am
index 0b22481f850..d72227f3953 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -77,7 +77,8 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
sql_plugin.h authors.h event_parse_data.h \
event_data_objects.h event_scheduler.h \
sql_partition.h partition_info.h partition_element.h \
- contributors.h sql_servers.h
+ contributors.h sql_servers.h \
+ rpl_handler.h replication.h
mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
item.cc item_sum.cc item_buff.cc item_func.cc \
@@ -122,7 +123,8 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
event_queue.cc event_db_repository.cc events.cc \
sql_plugin.cc sql_binlog.cc \
sql_builtin.cc sql_tablespace.cc partition_info.cc \
- sql_servers.cc event_parse_data.cc
+ sql_servers.cc event_parse_data.cc \
+ rpl_handler.cc
nodist_mysqld_SOURCES = mini_client_errors.c pack.c client.c my_time.c my_user.c
diff --git a/sql/authors.h b/sql/authors.h
index dfe3b143e2f..90cdae9c0a0 100644
--- a/sql/authors.h
+++ b/sql/authors.h
@@ -1,3 +1,6 @@
+#ifndef AUTHORS_INCLUDED
+#define AUTHORS_INCLUDED
+
/* Copyright (C) 2005-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -150,3 +153,5 @@ struct show_table_authors_st show_table_authors[]= {
"SHA1(), AES_ENCRYPT(), AES_DECRYPT(), bug fixing" },
{NULL, NULL, NULL}
};
+
+#endif /* AUTHORS_INCLUDED */
diff --git a/sql/client_settings.h b/sql/client_settings.h
index 4f06c15a29e..fd50bfdbb88 100644
--- a/sql/client_settings.h
+++ b/sql/client_settings.h
@@ -14,6 +14,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#ifndef CLIENT_SETTINGS_INCLUDED
+#define CLIENT_SETTINGS_INCLUDED
+#else
+#error You have already included an client_settings.h and it should not be included twice
+#endif /* CLIENT_SETTINGS_INCLUDED */
+
#include <thr_alarm.h>
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \
diff --git a/sql/contributors.h b/sql/contributors.h
index 87001e29d88..6cf8bb88e3b 100644
--- a/sql/contributors.h
+++ b/sql/contributors.h
@@ -1,3 +1,6 @@
+#ifndef CONTRIBUTORS_INCLUDED
+#define CONTRIBUTORS_INCLUDED
+
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -37,3 +40,5 @@ struct show_table_contributors_st show_table_contributors[]= {
{"Mark Shuttleworth", "London, UK.", "EFF contribution for UC2006 Auction"},
{NULL, NULL, NULL}
};
+
+#endif /* CONTRIBUTORS_INCLUDED */
diff --git a/sql/field.cc b/sql/field.cc
index 01ccc338782..21082550ba7 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -59,6 +59,8 @@ const char field_separator=',';
#define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index)))
#define ASSERT_COLUMN_MARKED_FOR_WRITE DBUG_ASSERT(!table || (!table->write_set || bitmap_is_set(table->write_set, field_index)))
+#define FLAGSTR(S,F) ((S) & (F) ? #F " " : "")
+
/*
Rules for merging different types of fields in UNION
@@ -997,6 +999,22 @@ test_if_important_data(CHARSET_INFO *cs, const char *str, const char *strend)
/**
+ Function to compare two unsigned integers for their relative order.
+ Used below. In an anonymous namespace to not clash with definitions
+ in other files.
+ */
+namespace {
+ int compare(unsigned int a, unsigned int b)
+ {
+ if (a < b)
+ return -1;
+ if (b < a)
+ return 1;
+ return 0;
+}
+}
+
+/**
Detect Item_result by given field type of UNION merge result.
@param field_type given field type
@@ -1367,22 +1385,48 @@ bool Field::send_binary(Protocol *protocol)
/**
Check to see if field size is compatible with destination.
- This method is used in row-based replication to verify that the slave's
- field size is less than or equal to the master's field size. The
- encoded field metadata (from the master or source) is decoded and compared
- to the size of this field (the slave or destination).
+ This method is used in row-based replication to verify that the
+ slave's field size is less than or equal to the master's field
+ size. The encoded field metadata (from the master or source) is
+ decoded and compared to the size of this field (the slave or
+ destination).
+
+ @note
+
+ The comparison is made so that if the source data (from the master)
+ is less than the target data (on the slave), -1 is returned in @c
+ <code>*order_var</code>. This implies that a conversion is
+ necessary, but that it is lossy and can result in truncation of the
+ value.
+
+ If the source data is strictly greater than the target data, 1 is
+ returned in <code>*order_var</code>. This implies that the source
+ type can is contained in the target type and that a conversion is
+ necessary but is non-lossy.
+
+ If no conversion is required to fit the source type in the target
+ type, 0 is returned in <code>*order_var</code>.
@param field_metadata Encoded size in field metadata
+ @param mflags Flags from the table map event for the table.
+ @param order_var Pointer to variable where the order
+ between the source field and this field
+ will be returned.
- @retval 0 if this field's size is < the source field's size
- @retval 1 if this field's size is >= the source field's size
+ @return @c true if this field's size is compatible with the
+ master's field size, @c false otherwise.
*/
-int Field::compatible_field_size(uint field_metadata,
- const Relay_log_info *rli_arg __attribute__((unused)))
+bool Field::compatible_field_size(uint field_metadata,
+ Relay_log_info *rli_arg __attribute__((unused)),
+ uint16 mflags __attribute__((unused)),
+ int *order_var)
{
uint const source_size= pack_length_from_metadata(field_metadata);
uint const destination_size= row_pack_length();
- return (source_size <= destination_size);
+ DBUG_PRINT("debug", ("real_type: %d, source_size: %u, destination_size: %u",
+ real_type(), source_size, destination_size));
+ *order_var = compare(source_size, destination_size);
+ return true;
}
@@ -2866,33 +2910,16 @@ uint Field_new_decimal::pack_length_from_metadata(uint field_metadata)
}
-/**
- Check to see if field size is compatible with destination.
-
- This method is used in row-based replication to verify that the slave's
- field size is less than or equal to the master's field size. The
- encoded field metadata (from the master or source) is decoded and compared
- to the size of this field (the slave or destination).
-
- @param field_metadata Encoded size in field metadata
-
- @retval 0 if this field's size is < the source field's size
- @retval 1 if this field's size is >= the source field's size
-*/
-int Field_new_decimal::compatible_field_size(uint field_metadata,
- const Relay_log_info * __attribute__((unused)))
+bool Field_new_decimal::compatible_field_size(uint field_metadata,
+ Relay_log_info * __attribute__((unused)),
+ uint16 mflags __attribute__((unused)),
+ int *order_var)
{
- int compatible= 0;
uint const source_precision= (field_metadata >> 8U) & 0x00ff;
uint const source_decimal= field_metadata & 0x00ff;
- uint const source_size= my_decimal_get_binary_size(source_precision,
- source_decimal);
- uint const destination_size= row_pack_length();
- compatible= (source_size <= destination_size);
- if (compatible)
- compatible= (source_precision <= precision) &&
- (source_decimal <= decimals());
- return (compatible);
+ int order= compare(source_precision, precision);
+ *order_var= order != 0 ? order : compare(source_decimal, dec);
+ return true;
}
@@ -6655,8 +6682,11 @@ check_field_for_37426(const void *param_arg)
}
#endif
-int Field_string::compatible_field_size(uint field_metadata,
- const Relay_log_info *rli_arg)
+bool
+Field_string::compatible_field_size(uint field_metadata,
+ Relay_log_info *rli_arg,
+ uint16 mflags __attribute__((unused)),
+ int *order_var)
{
#ifdef HAVE_REPLICATION
const Check_field_param check_param = { this };
@@ -6664,7 +6694,7 @@ int Field_string::compatible_field_size(uint field_metadata,
check_field_for_37426, &check_param))
return FALSE; // Not compatible field sizes
#endif
- return Field::compatible_field_size(field_metadata, rli_arg);
+ return Field::compatible_field_size(field_metadata, rli_arg, mflags, order_var);
}
@@ -6726,6 +6756,8 @@ uchar *Field_string::pack(uchar *to, const uchar *from,
{
uint length= min(field_length,max_length);
uint local_char_length= max_length/field_charset->mbmaxlen;
+ DBUG_PRINT("debug", ("Packing field '%s' - length: %u ", field_name, length));
+
if (length > local_char_length)
local_char_length= my_charpos(field_charset, from, from+length,
local_char_length);
@@ -7573,6 +7605,7 @@ Field_blob::Field_blob(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
cs),
packlength(blob_pack_length)
{
+ DBUG_ASSERT(blob_pack_length <= 4); // Only pack lengths 1-4 supported currently
flags|= BLOB_FLAG;
share->blob_fields++;
/* TODO: why do not fill table->s->blob_field array here? */
@@ -7983,8 +8016,10 @@ int Field_blob::key_cmp(const uchar *a,const uchar *b)
*/
int Field_blob::do_save_field_metadata(uchar *metadata_ptr)
{
+ DBUG_ENTER("Field_blob::do_save_field_metadata");
*metadata_ptr= pack_length_no_ptr();
- return 1;
+ DBUG_PRINT("debug", ("metadata: %u (pack_length_no_ptr)", *metadata_ptr));
+ DBUG_RETURN(1);
}
@@ -8925,6 +8960,9 @@ Field_bit::Field_bit(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7),
bytes_in_rec(len_arg / 8)
{
+ DBUG_ENTER("Field_bit::Field_bit");
+ DBUG_PRINT("enter", ("ptr_arg: %p, null_ptr_arg: %p, len_arg: %u, bit_len: %u, bytes_in_rec: %u",
+ ptr_arg, null_ptr_arg, len_arg, bit_len, bytes_in_rec));
flags|= UNSIGNED_FLAG;
/*
Ensure that Field::eq() can distinguish between two different bit fields.
@@ -8932,6 +8970,7 @@ Field_bit::Field_bit(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
*/
if (!null_ptr_arg)
null_bit= bit_ofs_arg;
+ DBUG_VOID_RETURN;
}
@@ -9216,9 +9255,17 @@ uint Field_bit::get_key_image(uchar *buff, uint length, imagetype type_arg)
*/
int Field_bit::do_save_field_metadata(uchar *metadata_ptr)
{
- *metadata_ptr= bit_len;
- *(metadata_ptr + 1)= bytes_in_rec;
- return 2;
+ DBUG_ENTER("Field_bit::do_save_field_metadata");
+ DBUG_PRINT("debug", ("bit_len: %d, bytes_in_rec: %d",
+ bit_len, bytes_in_rec));
+ /*
+ Since this class and Field_bit_as_char have different ideas of
+ what should be stored here, we compute the values of the metadata
+ explicitly using the field_length.
+ */
+ metadata_ptr[0]= field_length % 8;
+ metadata_ptr[1]= field_length / 8;
+ DBUG_RETURN(2);
}
@@ -9243,34 +9290,34 @@ uint Field_bit::pack_length_from_metadata(uint field_metadata)
}
-/**
- Check to see if field size is compatible with destination.
-
- This method is used in row-based replication to verify that the slave's
- field size is less than or equal to the master's field size. The
- encoded field metadata (from the master or source) is decoded and compared
- to the size of this field (the slave or destination).
+bool
+Field_bit::compatible_field_size(uint field_metadata,
+ Relay_log_info * __attribute__((unused)),
+ uint16 mflags,
+ int *order_var)
+{
+ DBUG_ENTER("Field_bit::compatible_field_size");
+ DBUG_ASSERT((field_metadata >> 16) == 0);
+ uint from_bit_len=
+ 8 * (field_metadata >> 8) + (field_metadata & 0xff);
+ uint to_bit_len= max_display_length();
+ DBUG_PRINT("debug", ("from_bit_len: %u, to_bit_len: %u",
+ from_bit_len, to_bit_len));
+ /*
+ If the bit length exact flag is clear, we are dealing with an old
+ master, so we allow some less strict behaviour if replicating by
+ moving both bit lengths to an even multiple of 8.
- @param field_metadata Encoded size in field metadata
+ We do this by computing the number of bytes to store the field
+ instead, and then compare the result.
+ */
+ if (!(mflags & Table_map_log_event::TM_BIT_LEN_EXACT_F)) {
+ from_bit_len= (from_bit_len + 7) / 8;
+ to_bit_len= (to_bit_len + 7) / 8;
+ }
- @retval 0 if this field's size is < the source field's size
- @retval 1 if this field's size is >= the source field's size
-*/
-int Field_bit::compatible_field_size(uint field_metadata,
- const Relay_log_info * __attribute__((unused)))
-{
- int compatible= 0;
- uint const source_size= pack_length_from_metadata(field_metadata);
- uint const destination_size= row_pack_length();
- uint const from_bit_len= field_metadata & 0x00ff;
- uint const from_len= (field_metadata >> 8U) & 0x00ff;
- if ((bit_len == 0) || (from_bit_len == 0))
- compatible= (source_size <= destination_size);
- else if (from_bit_len > bit_len)
- compatible= (from_len < bytes_in_rec);
- else
- compatible= ((from_bit_len <= bit_len) && (from_len <= bytes_in_rec));
- return (compatible);
+ *order_var= compare(from_bit_len, to_bit_len);
+ DBUG_RETURN(TRUE);
}
@@ -9336,8 +9383,15 @@ const uchar *
Field_bit::unpack(uchar *to, const uchar *from, uint param_data,
bool low_byte_first __attribute__((unused)))
{
+ DBUG_ENTER("Field_bit::unpack");
+ DBUG_PRINT("enter", ("to: %p, from: %p, param_data: 0x%x",
+ to, from, param_data));
+ DBUG_PRINT("debug", ("bit_ptr: %p, bit_len: %u, bit_ofs: %u",
+ bit_ptr, bit_len, bit_ofs));
uint const from_len= (param_data >> 8U) & 0x00ff;
uint const from_bit_len= param_data & 0x00ff;
+ DBUG_PRINT("debug", ("from_len: %u, from_bit_len: %u",
+ from_len, from_bit_len));
/*
If the parameter data is zero (i.e., undefined), or if the master
and slave have the same sizes, then use the old unpack() method.
@@ -9358,7 +9412,7 @@ Field_bit::unpack(uchar *to, const uchar *from, uint param_data,
from++;
}
memcpy(to, from, bytes_in_rec);
- return from + bytes_in_rec;
+ DBUG_RETURN(from + bytes_in_rec);
}
/*
@@ -9384,7 +9438,7 @@ Field_bit::unpack(uchar *to, const uchar *from, uint param_data,
bitmap_set_bit(table->write_set,field_index);
store(value, new_len, system_charset_info);
my_afree(value);
- return from + len;
+ DBUG_RETURN(from + len);
}
@@ -9512,8 +9566,11 @@ void Create_field::create_length_to_internal_length(void)
*/
void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
uint32 length_arg, uint32 decimals_arg,
- bool maybe_null, bool is_unsigned)
+ bool maybe_null, bool is_unsigned,
+ uint pack_length)
{
+ DBUG_ENTER("Create_field::init_for_tmp_table");
+
field_name= "";
sql_type= sql_type_arg;
char_length= length= length_arg;;
@@ -9521,10 +9578,92 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
interval= 0;
charset= &my_charset_bin;
geom_type= Field::GEOM_GEOMETRY;
- pack_flag= (FIELDFLAG_NUMBER |
- ((decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT) |
- (maybe_null ? FIELDFLAG_MAYBE_NULL : 0) |
- (is_unsigned ? 0 : FIELDFLAG_DECIMAL));
+
+ DBUG_PRINT("enter", ("sql_type: %d, length: %u, pack_length: %u",
+ sql_type_arg, length_arg, pack_length));
+
+ /*
+ These pack flags are crafted to get it correctly through the
+ branches of make_field().
+ */
+ switch (sql_type_arg)
+ {
+ case MYSQL_TYPE_VARCHAR:
+ case MYSQL_TYPE_VAR_STRING:
+ case MYSQL_TYPE_STRING:
+ case MYSQL_TYPE_SET:
+ pack_flag= 0;
+ break;
+
+ case MYSQL_TYPE_GEOMETRY:
+ pack_flag= FIELDFLAG_GEOM;
+ break;
+
+ case MYSQL_TYPE_ENUM:
+ pack_flag= FIELDFLAG_INTERVAL;
+ break;
+
+ case MYSQL_TYPE_DECIMAL:
+ case MYSQL_TYPE_NEWDECIMAL:
+ case MYSQL_TYPE_FLOAT:
+ case MYSQL_TYPE_DOUBLE:
+ pack_flag= FIELDFLAG_DECIMAL | FIELDFLAG_NUMBER |
+ (decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT;
+ break;
+
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ case MYSQL_TYPE_BLOB:
+ pack_flag= FIELDFLAG_BLOB;
+ break;
+
+ case MYSQL_TYPE_BIT:
+ pack_flag= FIELDFLAG_NUMBER | FIELDFLAG_TREAT_BIT_AS_CHAR;
+ break;
+
+ default:
+ pack_flag= FIELDFLAG_NUMBER;
+ break;
+ }
+
+ /*
+ Set the pack flag correctly for the blob-like types. This sets the
+ packtype to something that make_field can use. If the pack type is
+ not set correctly, the packlength will be reeeeally wierd (like
+ 129 or so).
+ */
+ switch (sql_type_arg)
+ {
+ case MYSQL_TYPE_ENUM:
+ case MYSQL_TYPE_SET:
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_GEOMETRY:
+ // If you are going to use the above types, you have to pass a
+ // pack_length as parameter. Assert that is really done.
+ DBUG_ASSERT(pack_length != ~0U);
+ pack_flag|= pack_length_to_packflag(pack_length);
+ break;
+ default:
+ /* Nothing */
+ break;
+ }
+
+ pack_flag|=
+ (maybe_null ? FIELDFLAG_MAYBE_NULL : 0) |
+ (is_unsigned ? 0 : FIELDFLAG_DECIMAL);
+
+ DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s, pack_type: %d",
+ FLAGSTR(pack_flag, FIELDFLAG_BINARY),
+ FLAGSTR(pack_flag, FIELDFLAG_NUMBER),
+ FLAGSTR(pack_flag, FIELDFLAG_INTERVAL),
+ FLAGSTR(pack_flag, FIELDFLAG_GEOM),
+ FLAGSTR(pack_flag, FIELDFLAG_BLOB),
+ f_packtype(pack_flag)));
+ DBUG_VOID_RETURN;
}
@@ -10031,6 +10170,14 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
default: break;
}
+ DBUG_PRINT("debug", ("field_type: %d, field_length: %u, interval: %p, pack_flag: %s%s%s%s%s",
+ field_type, field_length, interval,
+ FLAGSTR(pack_flag, FIELDFLAG_BINARY),
+ FLAGSTR(pack_flag, FIELDFLAG_INTERVAL),
+ FLAGSTR(pack_flag, FIELDFLAG_NUMBER),
+ FLAGSTR(pack_flag, FIELDFLAG_PACK),
+ FLAGSTR(pack_flag, FIELDFLAG_BLOB)));
+
if (f_is_alpha(pack_flag))
{
if (!f_is_packed(pack_flag))
diff --git a/sql/field.h b/sql/field.h
index ae074cc1a30..041610f5385 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1,3 +1,6 @@
+#ifndef FIELD_INCLUDED
+#define FIELD_INCLUDED
+
/* Copyright 2000-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
@@ -164,22 +167,13 @@ public:
table, which is located on disk).
*/
virtual uint32 pack_length_in_rec() const { return pack_length(); }
- virtual int compatible_field_size(uint field_metadata,
- const Relay_log_info *);
+ virtual bool compatible_field_size(uint metadata, Relay_log_info *rli,
+ uint16 mflags, int *order);
virtual uint pack_length_from_metadata(uint field_metadata)
- { return field_metadata; }
- /*
- This method is used to return the size of the data in a row-based
- replication row record. The default implementation of returning 0 is
- designed to allow fields that do not use metadata to return TRUE (1)
- from compatible_field_size() which uses this function in the comparison.
- The default value for field metadata for fields that do not have
- metadata is 0. Thus, 0 == 0 means the fields are compatible in size.
-
- Note: While most classes that override this method return pack_length(),
- the classes Field_string, Field_varstring, and Field_blob return
- field_length + 1, field_length, and pack_length_no_ptr() respectfully.
- */
+ {
+ DBUG_ENTER("Field::pack_length_from_metadata");
+ DBUG_RETURN(field_metadata);
+ }
virtual uint row_pack_length() { return 0; }
virtual int save_field_metadata(uchar *first_byte)
{ return do_save_field_metadata(first_byte); }
@@ -638,6 +632,13 @@ public:
int store_decimal(const my_decimal *);
my_decimal *val_decimal(my_decimal *);
uint is_equal(Create_field *new_field);
+ uint row_pack_length() { return pack_length(); }
+ uint32 pack_length_from_metadata(uint field_metadata) {
+ uint32 length= pack_length();
+ DBUG_PRINT("result", ("pack_length_from_metadata(%d): %u",
+ field_metadata, length));
+ return length;
+ }
int check_int(CHARSET_INFO *cs, const char *str, int length,
const char *int_end, int error);
bool get_int(CHARSET_INFO *cs, const char *from, uint len,
@@ -802,8 +803,8 @@ public:
uint32 pack_length() const { return (uint32) bin_size; }
uint pack_length_from_metadata(uint field_metadata);
uint row_pack_length() { return pack_length(); }
- int compatible_field_size(uint field_metadata,
- const Relay_log_info *rli);
+ bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
+ uint16 mflags, int *order_var);
uint is_equal(Create_field *new_field);
virtual const uchar *unpack(uchar* to, const uchar *from,
uint param_data, bool low_byte_first);
@@ -1498,9 +1499,9 @@ public:
return row_pack_length();
return (((field_metadata >> 4) & 0x300) ^ 0x300) + (field_metadata & 0x00ff);
}
- int compatible_field_size(uint field_metadata,
- const Relay_log_info *rli);
- uint row_pack_length() { return (field_length + 1); }
+ bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
+ uint16 mflags, int *order_var);
+ uint row_pack_length() { return field_length; }
int pack_cmp(const uchar *a,const uchar *b,uint key_length,
my_bool insert_or_update);
int pack_cmp(const uchar *b,uint key_length,my_bool insert_or_update);
@@ -1962,8 +1963,8 @@ public:
uint pack_length_from_metadata(uint field_metadata);
uint row_pack_length()
{ return (bytes_in_rec + ((bit_len > 0) ? 1 : 0)); }
- int compatible_field_size(uint field_metadata,
- const Relay_log_info *rli);
+ bool compatible_field_size(uint metadata, Relay_log_info *rli,
+ uint16 mflags, int *order_var);
void sql_type(String &str) const;
virtual uchar *pack(uchar *to, const uchar *from,
uint max_length, bool low_byte_first);
@@ -2066,7 +2067,8 @@ public:
/* Init for a tmp table field. To be extended if need be. */
void init_for_tmp_table(enum_field_types sql_type_arg,
uint32 max_length, uint32 decimals,
- bool maybe_null, bool is_unsigned);
+ bool maybe_null, bool is_unsigned,
+ uint pack_length = ~0U);
bool init(THD *thd, char *field_name, enum_field_types type, char *length,
char *decimals, uint type_modifier, Item *default_value,
@@ -2188,3 +2190,5 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions);
#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)
#define f_bit_as_char(x) ((x) & FIELDFLAG_TREAT_BIT_AS_CHAR)
#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE)
+
+#endif /* FIELD_INCLUDED */
diff --git a/sql/gstream.h b/sql/gstream.h
index 1ef90ad5bf0..ea7158ee1a3 100644
--- a/sql/gstream.h
+++ b/sql/gstream.h
@@ -1,3 +1,6 @@
+#ifndef GSTREAM_INCLUDED
+#define GSTREAM_INCLUDED
+
/* Copyright (C) 2000-2004 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -73,3 +76,5 @@ protected:
char *m_err_msg;
CHARSET_INFO *m_charset;
};
+
+#endif /* GSTREAM_INCLUDED */
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index a17323d3fd6..662655c42b9 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -1,3 +1,6 @@
+#ifndef HA_NDBCLUSTER_INCLUDED
+#define HA_NDBCLUSTER_INCLUDED
+
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -581,3 +584,5 @@ static const int ndbcluster_hton_name_length=sizeof(ndbcluster_hton_name)-1;
extern int ndbcluster_terminating;
extern int ndb_util_thread_running;
extern pthread_cond_t COND_ndb_util_ready;
+
+#endif /* HA_NDBCLUSTER_INCLUDED */
diff --git a/sql/ha_ndbcluster_binlog.h b/sql/ha_ndbcluster_binlog.h
index 1cad643e5ec..d80dfe9ee74 100644
--- a/sql/ha_ndbcluster_binlog.h
+++ b/sql/ha_ndbcluster_binlog.h
@@ -1,3 +1,6 @@
+#ifndef HA_NDBCLUSTER_BINLOG_INCLUDED
+#define HA_NDBCLUSTER_BINLOG_INCLUDED
+
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -225,3 +228,5 @@ set_thd_ndb(THD *thd, Thd_ndb *thd_ndb)
{ thd_set_ha_data(thd, ndbcluster_hton, thd_ndb); }
Ndb* check_ndb_in_thd(THD* thd);
+
+#endif /* HA_NDBCLUSTER_BINLOG_INCLUDED */
diff --git a/sql/ha_ndbcluster_cond.h b/sql/ha_ndbcluster_cond.h
index 4401a93c9e1..4ccc7e062ec 100644
--- a/sql/ha_ndbcluster_cond.h
+++ b/sql/ha_ndbcluster_cond.h
@@ -1,3 +1,6 @@
+#ifndef HA_NDBCLUSTER_COND_INCLUDED
+#define HA_NDBCLUSTER_COND_INCLUDED
+
/* Copyright (C) 2000-2007 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -486,3 +489,5 @@ private:
Ndb_cond_stack *m_cond_stack;
};
+
+#endif /* HA_NDBCLUSTER_COND_INCLUDED */
diff --git a/sql/ha_ndbcluster_tables.h b/sql/ha_ndbcluster_tables.h
index c6bc8f577f8..ba2e8ec251b 100644
--- a/sql/ha_ndbcluster_tables.h
+++ b/sql/ha_ndbcluster_tables.h
@@ -1,3 +1,6 @@
+#ifndef HA_NDBCLUSTER_TABLES_INCLUDED
+#define HA_NDBCLUSTER_TABLES_INCLUDED
+
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -21,3 +24,5 @@
#define OLD_NDB_APPLY_TABLE "apply_status"
#define NDB_SCHEMA_TABLE "ndb_schema"
#define OLD_NDB_SCHEMA_TABLE "schema"
+
+#endif /* HA_NDBCLUSTER_TABLES_INCLUDED */
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index c08b1f77eca..96ccabe250b 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1,3 +1,6 @@
+#ifndef HA_PARTITION_INCLUDED
+#define HA_PARTITION_INCLUDED
+
/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
@@ -1101,3 +1104,5 @@ public:
virtual void append_create_info(String *packet)
*/
};
+
+#endif /* HA_PARTITION_INCLUDED */
diff --git a/sql/handler.cc b/sql/handler.cc
index 216228ed509..2414ba64196 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -24,6 +24,7 @@
#endif
#include "mysql_priv.h"
+#include "rpl_handler.h"
#include "rpl_filter.h"
#include <myisampack.h>
#include <errno.h>
@@ -221,6 +222,8 @@ handlerton *ha_checktype(THD *thd, enum legacy_db_type database_type,
return NULL;
}
+ RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+
switch (database_type) {
#ifndef NO_HASH
case DB_TYPE_HASH:
@@ -413,7 +416,13 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
reuse an array slot. Otherwise the number of uninstall/install
cycles would be limited.
*/
- hton2plugin[hton->slot]= NULL;
+ if (hton->slot != HA_SLOT_UNDEF)
+ {
+ /* Make sure we are not unpluging another plugin */
+ DBUG_ASSERT(hton2plugin[hton->slot] == plugin);
+ DBUG_ASSERT(hton->slot < MAX_HA);
+ hton2plugin[hton->slot]= NULL;
+ }
my_free((uchar*)hton, MYF(0));
@@ -430,6 +439,15 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
hton= (handlerton *)my_malloc(sizeof(handlerton),
MYF(MY_WME | MY_ZEROFILL));
+
+ if (hton == NULL)
+ {
+ sql_print_error("Unable to allocate memory for plugin '%s' handlerton.",
+ plugin->name.str);
+ goto err_no_hton_memory;
+ }
+
+ hton->slot= HA_SLOT_UNDEF;
/* Historical Requirement */
plugin->data= hton; // shortcut for the future
if (plugin->plugin->init && plugin->plugin->init(hton))
@@ -540,6 +558,7 @@ err_deinit:
err:
my_free((uchar*) hton, MYF(0));
+err_no_hton_memory:
plugin->data= NULL;
DBUG_RETURN(1);
}
@@ -1190,6 +1209,7 @@ int ha_commit_trans(THD *thd, bool all)
if (cookie)
tc_log->unlog(cookie, xid);
DBUG_EXECUTE_IF("crash_commit_after", abort(););
+ RUN_HOOK(transaction, after_commit, (thd, FALSE));
end:
if (rw_trans)
start_waiting_global_read_lock(thd);
@@ -1338,6 +1358,7 @@ int ha_rollback_trans(THD *thd, bool all)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARNING_NOT_COMPLETE_ROLLBACK,
ER(ER_WARNING_NOT_COMPLETE_ROLLBACK));
+ RUN_HOOK(transaction, after_rollback, (thd, FALSE));
DBUG_RETURN(error);
}
@@ -1372,7 +1393,14 @@ int ha_autocommit_or_rollback(THD *thd, int error)
thd->variables.tx_isolation=thd->session_tx_isolation;
}
+ else
#endif
+ {
+ if (!error)
+ RUN_HOOK(transaction, after_commit, (thd, FALSE));
+ else
+ RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+ }
DBUG_RETURN(error);
}
@@ -3204,36 +3232,6 @@ handler::ha_reset_auto_increment(ulonglong value)
/**
- Backup table: public interface.
-
- @sa handler::backup()
-*/
-
-int
-handler::ha_backup(THD* thd, HA_CHECK_OPT* check_opt)
-{
- mark_trx_read_write();
-
- return backup(thd, check_opt);
-}
-
-
-/**
- Restore table: public interface.
-
- @sa handler::restore()
-*/
-
-int
-handler::ha_restore(THD* thd, HA_CHECK_OPT* check_opt)
-{
- mark_trx_read_write();
-
- return restore(thd, check_opt);
-}
-
-
-/**
Optimize table: public interface.
@sa handler::optimize()
diff --git a/sql/handler.h b/sql/handler.h
index 7fc2bf2fece..4fe38b659bb 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1,3 +1,6 @@
+#ifndef HANDLER_INCLUDED
+#define HANDLER_INCLUDED
+
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
@@ -214,6 +217,13 @@
#define MAX_HA 15
/*
+ Use this instead of 0 as the initial value for the slot number of
+ handlerton, so that we can distinguish uninitialized slot number
+ from slot 0.
+*/
+#define HA_SLOT_UNDEF ((uint)-1)
+
+/*
Parameters for open() (in register form->filestat)
HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED
*/
@@ -1244,8 +1254,6 @@ public:
uint *dup_key_found);
int ha_delete_all_rows();
int ha_reset_auto_increment(ulonglong value);
- int ha_backup(THD* thd, HA_CHECK_OPT* check_opt);
- int ha_restore(THD* thd, HA_CHECK_OPT* check_opt);
int ha_optimize(THD* thd, HA_CHECK_OPT* check_opt);
int ha_analyze(THD* thd, HA_CHECK_OPT* check_opt);
bool ha_check_and_repair(THD *thd);
@@ -1531,9 +1539,7 @@ public:
{ return HA_ADMIN_NOT_IMPLEMENTED; }
/* end of the list of admin commands */
- virtual int dump(THD* thd, int fd = -1) { return HA_ERR_WRONG_COMMAND; }
virtual int indexes_are_disabled(void) {return 0;}
- virtual int net_read_dump(NET* net) { return HA_ERR_WRONG_COMMAND; }
virtual char *update_table_comment(const char * comment)
{ return (char*) comment;}
virtual void append_create_info(String *packet) {}
@@ -1901,14 +1907,6 @@ private:
*/
virtual int reset_auto_increment(ulonglong value)
{ return HA_ERR_WRONG_COMMAND; }
- virtual int backup(THD* thd, HA_CHECK_OPT* check_opt)
- { return HA_ADMIN_NOT_IMPLEMENTED; }
- /**
- Restore assumes .frm file must exist, and that generate_table() has been
- called; It will just copy the data file and run repair.
- */
- virtual int restore(THD* thd, HA_CHECK_OPT* check_opt)
- { return HA_ADMIN_NOT_IMPLEMENTED; }
virtual int optimize(THD* thd, HA_CHECK_OPT* check_opt)
{ return HA_ADMIN_NOT_IMPLEMENTED; }
virtual int analyze(THD* thd, HA_CHECK_OPT* check_opt)
@@ -2072,3 +2070,4 @@ int ha_binlog_end(THD *thd);
#define ha_binlog_wait(a) do {} while (0)
#define ha_binlog_end(a) do {} while (0)
#endif
+#endif /* HANDLER_INCLUDED */
diff --git a/sql/item.h b/sql/item.h
index 2d429ca6cf3..f37938aedbd 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1,3 +1,6 @@
+#ifndef ITEM_INCLUDED
+#define ITEM_INCLUDED
+
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
@@ -3162,3 +3165,5 @@ extern Cached_item *new_Cached_item(THD *thd, Item *item);
extern Item_result item_cmp_type(Item_result a,Item_result b);
extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item);
extern int stored_field_cmp_to_item(THD *thd, Field *field, Item *item);
+#endif /* ITEM_INCLUDED */
+
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 52af6a31c0c..71ed5cf99dd 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1,3 +1,6 @@
+#ifndef ITEM_CMPFUNC_INCLUDED
+#define ITEM_CMPFUNC_INCLUDED
+
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -1743,3 +1746,4 @@ Item *and_expressions(Item *a, Item *b, Item **org_item);
bool get_mysql_time_from_str(THD *thd, String *str, timestamp_type warn_type,
const char *warn_name, MYSQL_TIME *l_time);
+#endif /* ITEM_CMPFUNC_INCLUDED */
diff --git a/sql/item_func.h b/sql/item_func.h
index 1aae0a5abb5..f22bc0c301c 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1,3 +1,6 @@
+#ifndef ITEM_FUNC_INCLUDED
+#define ITEM_FUNC_INCLUDED
+
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
@@ -1706,3 +1709,4 @@ public:
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
+#endif /* ITEM_FUNC_INCLUDED */
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index edbe104e307..9a55ea7d5b1 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -1,3 +1,6 @@
+#ifndef ITEM_GEOFUNC_INCLUDED
+#define ITEM_GEOFUNC_INCLUDED
+
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -386,3 +389,4 @@ public:
#endif
+#endif /* ITEM_GEOFUNC_INCLUDED */
diff --git a/sql/item_row.h b/sql/item_row.h
index 67441f49603..7c08c5888e0 100644
--- a/sql/item_row.h
+++ b/sql/item_row.h
@@ -1,3 +1,6 @@
+#ifndef ITEM_ROW_INCLUDED
+#define ITEM_ROW_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -77,3 +80,5 @@ public:
bool null_inside() { return with_null; };
void bring_value();
};
+
+#endif /* ITEM_ROW_INCLUDED */
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 2cdb45100ae..fc70b04ca68 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -1,3 +1,6 @@
+#ifndef ITEM_STRFUNC_INCLUDED
+#define ITEM_STRFUNC_INCLUDED
+
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -842,3 +845,4 @@ public:
String *val_str(String *);
};
+#endif /* ITEM_STRFUNC_INCLUDED */
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 467e9b22637..3503d42edc0 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -1,3 +1,6 @@
+#ifndef ITEM_SUBSELECT_INCLUDED
+#define ITEM_SUBSELECT_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -580,4 +583,4 @@ inline bool Item_subselect::is_uncacheable() const
return engine->uncacheable();
}
-
+#endif /* ITEM_SUBSELECT_INCLUDED */
diff --git a/sql/item_sum.h b/sql/item_sum.h
index f70da52bcd1..da9ad9963c5 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1,3 +1,6 @@
+#ifndef ITEM_SUM_INCLUDED
+#define ITEM_SUM_INCLUDED
+
/* Copyright (C) 2000-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -1270,3 +1273,5 @@ public:
virtual bool change_context_processor(uchar *cntx)
{ context= (Name_resolution_context *)cntx; return FALSE; }
};
+
+#endif /* ITEM_SUM_INCLUDED */
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 9e3c2e8c89f..7f1b2ed3a53 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -1,3 +1,6 @@
+#ifndef ITEM_TIMEFUNC_INCLUDED
+#define ITEM_TIMEFUNC_INCLUDED
+
/* Copyright (C) 2000-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -1026,3 +1029,5 @@ public:
const char *func_name() const { return "last_day"; }
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
};
+
+#endif /* ITEM_TIMEFUNC_INCLUDED */
diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h
index dadbb5ccf42..6373bde0aab 100644
--- a/sql/item_xmlfunc.h
+++ b/sql/item_xmlfunc.h
@@ -1,3 +1,6 @@
+#ifndef ITEM_XMLFUNC_INCLUDED
+#define ITEM_XMLFUNC_INCLUDED
+
/* Copyright (C) 2000-2005 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -61,3 +64,4 @@ public:
String *val_str(String *);
};
+#endif /* ITEM_XMLFUNC_INCLUDED */
diff --git a/sql/lex.h b/sql/lex.h
index 0a85824f6f7..b1a88b200e6 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -1,3 +1,6 @@
+#ifndef LEX_INCLUDED
+#define LEX_INCLUDED
+
/* Copyright (C) 2000-2002 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -186,6 +189,7 @@ static SYMBOL symbols[] = {
{ "ENGINE", SYM(ENGINE_SYM)},
{ "ENGINES", SYM(ENGINES_SYM)},
{ "ENUM", SYM(ENUM)},
+ { "ERROR", SYM(ERROR_SYM)},
{ "ERRORS", SYM(ERRORS)},
{ "ESCAPE", SYM(ESCAPE_SYM)},
{ "ESCAPED", SYM(ESCAPED)},
@@ -220,6 +224,7 @@ static SYMBOL symbols[] = {
{ "FULL", SYM(FULL)},
{ "FULLTEXT", SYM(FULLTEXT_SYM)},
{ "FUNCTION", SYM(FUNCTION_SYM)},
+ { "GENERAL", SYM(GENERAL)},
{ "GEOMETRY", SYM(GEOMETRY_SYM)},
{ "GEOMETRYCOLLECTION",SYM(GEOMETRYCOLLECTION)},
{ "GET_FORMAT", SYM(GET_FORMAT)},
@@ -241,6 +246,7 @@ static SYMBOL symbols[] = {
{ "IDENTIFIED", SYM(IDENTIFIED_SYM)},
{ "IF", SYM(IF)},
{ "IGNORE", SYM(IGNORE_SYM)},
+ { "IGNORE_SERVER_IDS", SYM(IGNORE_SERVER_IDS_SYM)},
{ "IMPORT", SYM(IMPORT)},
{ "IN", SYM(IN_SYM)},
{ "INDEX", SYM(INDEX_SYM)},
@@ -248,8 +254,6 @@ static SYMBOL symbols[] = {
{ "INFILE", SYM(INFILE)},
{ "INITIAL_SIZE", SYM(INITIAL_SIZE_SYM)},
{ "INNER", SYM(INNER_SYM)},
- { "INNOBASE", SYM(INNOBASE_SYM)},
- { "INNODB", SYM(INNOBASE_SYM)},
{ "INOUT", SYM(INOUT_SYM)},
{ "INSENSITIVE", SYM(INSENSITIVE_SYM)},
{ "INSERT", SYM(INSERT)},
@@ -320,6 +324,7 @@ static SYMBOL symbols[] = {
{ "MASTER_SSL_KEY", SYM(MASTER_SSL_KEY_SYM)},
{ "MASTER_SSL_VERIFY_SERVER_CERT", SYM(MASTER_SSL_VERIFY_SERVER_CERT_SYM)},
{ "MASTER_USER", SYM(MASTER_USER_SYM)},
+ { "MASTER_HEARTBEAT_PERIOD", SYM(MASTER_HEARTBEAT_PERIOD_SYM)},
{ "MATCH", SYM(MATCH)},
{ "MAX_CONNECTIONS_PER_HOUR", SYM(MAX_CONNECTIONS_PER_HOUR)},
{ "MAX_QUERIES_PER_HOUR", SYM(MAX_QUERIES_PER_HOUR)},
@@ -426,6 +431,8 @@ static SYMBOL symbols[] = {
{ "REDUNDANT", SYM(REDUNDANT_SYM)},
{ "REFERENCES", SYM(REFERENCES)},
{ "REGEXP", SYM(REGEXP)},
+ { "RELAY", SYM(RELAY)},
+ { "RELAYLOG", SYM(RELAYLOG_SYM)},
{ "RELAY_LOG_FILE", SYM(RELAY_LOG_FILE_SYM)},
{ "RELAY_LOG_POS", SYM(RELAY_LOG_POS_SYM)},
{ "RELAY_THREAD", SYM(RELAY_THREAD)},
@@ -477,6 +484,7 @@ static SYMBOL symbols[] = {
{ "SIGNED", SYM(SIGNED_SYM)},
{ "SIMPLE", SYM(SIMPLE_SYM)},
{ "SLAVE", SYM(SLAVE)},
+ { "SLOW", SYM(SLOW)},
{ "SNAPSHOT", SYM(SNAPSHOT_SYM)},
{ "SMALLINT", SYM(SMALLINT)},
{ "SOCKET", SYM(SOCKET_SYM)},
@@ -634,3 +642,5 @@ static SYMBOL sql_functions[] = {
{ "VAR_POP", SYM(VARIANCE_SYM)},
{ "VAR_SAMP", SYM(VAR_SAMP_SYM)},
};
+
+#endif /* LEX_INCLUDED */
diff --git a/sql/log.cc b/sql/log.cc
index b4c9e5eb4cc..5a7d3368abd 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -38,6 +38,7 @@
#endif
#include <mysql/plugin.h>
+#include "rpl_handler.h"
/* max size of the log message */
#define MAX_LOG_BUFFER_SIZE 1024
@@ -49,11 +50,10 @@
LOGGER logger;
-MYSQL_BIN_LOG mysql_bin_log;
-ulong sync_binlog_counter= 0;
+MYSQL_BIN_LOG mysql_bin_log(&sync_binlog_period);
static bool test_if_number(const char *str,
- long *res, bool allow_wildcards);
+ ulong *res, bool allow_wildcards);
static int binlog_init(void *p);
static int binlog_close_connection(handlerton *hton, THD *thd);
static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv);
@@ -63,6 +63,35 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all);
static int binlog_prepare(handlerton *hton, THD *thd, bool all);
/**
+ purge logs, master and slave sides both, related error code
+ convertor.
+ Called from @c purge_error_message(), @c MYSQL_BIN_LOG::reset_logs()
+
+ @param res an internal to purging routines error code
+
+ @return the user level error code ER_*
+*/
+uint purge_log_get_error_code(int res)
+{
+ uint errcode= 0;
+
+ switch (res) {
+ case 0: break;
+ case LOG_INFO_EOF: errcode= ER_UNKNOWN_TARGET_BINLOG; break;
+ case LOG_INFO_IO: errcode= ER_IO_ERR_LOG_INDEX_READ; break;
+ case LOG_INFO_INVALID:errcode= ER_BINLOG_PURGE_PROHIBITED; break;
+ case LOG_INFO_SEEK: errcode= ER_FSEEK_FAIL; break;
+ case LOG_INFO_MEM: errcode= ER_OUT_OF_RESOURCES; break;
+ case LOG_INFO_FATAL: errcode= ER_BINLOG_PURGE_FATAL_ERR; break;
+ case LOG_INFO_IN_USE: errcode= ER_LOG_IN_USE; break;
+ case LOG_INFO_EMFILE: errcode= ER_BINLOG_PURGE_EMFILE; break;
+ default: errcode= ER_LOG_PURGE_UNKNOWN_ERR; break;
+ }
+
+ return errcode;
+}
+
+/**
Silence all errors and warnings reported when performing a write
to a log table.
Errors and warnings are not reported to the client or SQL exception
@@ -936,6 +965,54 @@ bool LOGGER::flush_logs(THD *thd)
}
+/**
+ Close and reopen the slow log (with locks).
+
+ @returns FALSE.
+*/
+bool LOGGER::flush_slow_log()
+{
+ /*
+ Now we lock logger, as nobody should be able to use logging routines while
+ log tables are closed
+ */
+ logger.lock_exclusive();
+
+ /* Reopen slow log file */
+ if (opt_slow_log)
+ file_log_handler->get_mysql_slow_log()->reopen_file();
+
+ /* End of log flush */
+ logger.unlock();
+
+ return 0;
+}
+
+
+/**
+ Close and reopen the general log (with locks).
+
+ @returns FALSE.
+*/
+bool LOGGER::flush_general_log()
+{
+ /*
+ Now we lock logger, as nobody should be able to use logging routines while
+ log tables are closed
+ */
+ logger.lock_exclusive();
+
+ /* Reopen general log file */
+ if (opt_log)
+ file_log_handler->get_mysql_log()->reopen_file();
+
+ /* End of log flush */
+ logger.unlock();
+
+ return 0;
+}
+
+
/*
Log slow query with all enabled log event handlers
@@ -964,6 +1041,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length,
uint user_host_len= 0;
ulonglong query_utime, lock_utime;
+ DBUG_ASSERT(thd->enable_slow_log);
/*
Print the message to the buffer if we have slow log enabled
*/
@@ -1839,22 +1917,27 @@ static void setup_windows_event_source()
/**
Find a unique filename for 'filename.#'.
- Set '#' to a number as low as possible.
+ Set '#' to the number next to the maximum found in the most
+ recent log file extension.
+
+ This function will return nonzero if: (i) the generated name
+ exceeds FN_REFLEN; (ii) if the number of extensions is exhausted;
+ or (iii) some other error happened while examining the filesystem.
@return
- nonzero if not possible to get unique filename
+ nonzero if not possible to get unique filename.
*/
static int find_uniq_filename(char *name)
{
- long number;
uint i;
- char buff[FN_REFLEN];
+ char buff[FN_REFLEN], ext_buf[FN_REFLEN];
struct st_my_dir *dir_info;
reg1 struct fileinfo *file_info;
- ulong max_found=0;
+ ulong max_found= 0, next= 0, number= 0;
size_t buf_length, length;
char *start, *end;
+ int error= 0;
DBUG_ENTER("find_uniq_filename");
length= dirname_part(buff, name, &buf_length);
@@ -1862,15 +1945,15 @@ static int find_uniq_filename(char *name)
end= strend(start);
*end='.';
- length= (size_t) (end-start+1);
+ length= (size_t) (end - start + 1);
- if (!(dir_info = my_dir(buff,MYF(MY_DONT_SORT))))
+ if (!(dir_info= my_dir(buff,MYF(MY_DONT_SORT))))
{ // This shouldn't happen
strmov(end,".1"); // use name+1
- DBUG_RETURN(0);
+ DBUG_RETURN(1);
}
file_info= dir_info->dir_entry;
- for (i=dir_info->number_off_files ; i-- ; file_info++)
+ for (i= dir_info->number_off_files ; i-- ; file_info++)
{
if (bcmp((uchar*) file_info->name, (uchar*) start, length) == 0 &&
test_if_number(file_info->name+length, &number,0))
@@ -1880,9 +1963,44 @@ static int find_uniq_filename(char *name)
}
my_dirend(dir_info);
+ /* check if reached the maximum possible extension number */
+ if ((max_found == MAX_LOG_UNIQUE_FN_EXT))
+ {
+ sql_print_error("Log filename extension number exhausted: %06lu. \
+Please fix this by archiving old logs and \
+updating the index files.", max_found);
+ error= 1;
+ goto end;
+ }
+
+ next= max_found + 1;
+ sprintf(ext_buf, "%06lu", next);
*end++='.';
- sprintf(end,"%06ld",max_found+1);
- DBUG_RETURN(0);
+
+ /*
+ Check if the generated extension size + the file name exceeds the
+ buffer size used. If one did not check this, then the filename might be
+ truncated, resulting in error.
+ */
+ if (((strlen(ext_buf) + (end - name)) >= FN_REFLEN))
+ {
+ sql_print_error("Log filename too large: %s%s (%lu). \
+Please fix this by archiving old logs and updating the \
+index files.", name, ext_buf, (strlen(ext_buf) + (end - name)));
+ error= 1;
+ goto end;
+ }
+
+ sprintf(end, "%06lu", next);
+
+ /* print warning if reaching the end of available extensions. */
+ if ((next > (MAX_LOG_UNIQUE_FN_EXT - LOG_WARN_UNIQUE_FN_EXT_LEFT)))
+ sql_print_warning("Next log extension: %lu. \
+Remaining log filename extensions: %lu. \
+Please consider archiving some logs.", next, (MAX_LOG_UNIQUE_FN_EXT - next));
+
+end:
+ DBUG_RETURN(error);
}
@@ -2081,6 +2199,13 @@ int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name)
{
if (find_uniq_filename(new_name))
{
+ /*
+ This should be treated as error once propagation of error further
+ up in the stack gets proper handling.
+ */
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_NO_UNIQUE_LOGFILE, ER(ER_NO_UNIQUE_LOGFILE),
+ log_name);
sql_print_error(ER(ER_NO_UNIQUE_LOGFILE), log_name);
return 1;
}
@@ -2415,10 +2540,11 @@ const char *MYSQL_LOG::generate_name(const char *log_name,
-MYSQL_BIN_LOG::MYSQL_BIN_LOG()
+MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period)
:bytes_written(0), prepared_xids(0), file_id(1), open_count(1),
need_start_event(TRUE), m_table_map_version(0),
- is_relay_log(0),
+ sync_period_ptr(sync_period),
+ is_relay_log(0), signal_cnt(0),
description_event_for_exec(0), description_event_for_queue(0)
{
/*
@@ -2775,8 +2901,10 @@ int MYSQL_BIN_LOG::find_log_pos(LOG_INFO *linfo, const char *log_name,
{
uint length;
my_off_t offset= my_b_tell(&index_file);
- /* If we get 0 or 1 characters, this is the end of the file */
+ DBUG_EXECUTE_IF("simulate_find_log_pos_error",
+ error= LOG_INFO_EOF; break;);
+ /* If we get 0 or 1 characters, this is the end of the file */
if ((length= my_b_gets(&index_file, fname, FN_REFLEN)) <= 1)
{
/* Did not find the given entry; Return not found or error */
@@ -2878,6 +3006,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
{
LOG_INFO linfo;
bool error=0;
+ int err;
const char* save_name;
DBUG_ENTER("reset_logs");
@@ -2904,9 +3033,12 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
/* First delete all old log files */
- if (find_log_pos(&linfo, NullS, 0))
+ if ((err= find_log_pos(&linfo, NullS, 0)) != 0)
{
- error=1;
+ uint errcode= purge_log_get_error_code(err);
+ sql_print_error("Failed to locate old binlog or relay log files");
+ my_message(errcode, ER(errcode), MYF(0));
+ error= 1;
goto err;
}
@@ -2975,6 +3107,8 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
my_free((uchar*) save_name, MYF(0));
err:
+ if (error == 1)
+ name= const_cast<char*>(save_name);
VOID(pthread_mutex_unlock(&LOCK_thread_count));
pthread_mutex_unlock(&LOCK_index);
pthread_mutex_unlock(&LOCK_log);
@@ -3650,6 +3784,8 @@ bool MYSQL_BIN_LOG::append(Log_event* ev)
}
bytes_written+= ev->data_written;
DBUG_PRINT("info",("max_size: %lu",max_size));
+ if (flush_and_sync(0))
+ goto err;
if ((uint) my_b_append_tell(&log_file) > max_size)
new_file_without_locking();
@@ -3680,6 +3816,8 @@ bool MYSQL_BIN_LOG::appendv(const char* buf, uint len,...)
bytes_written += len;
} while ((buf=va_arg(args,const char*)) && (len=va_arg(args,uint)));
DBUG_PRINT("info",("max_size: %lu",max_size));
+ if (flush_and_sync(0))
+ goto err;
if ((uint) my_b_append_tell(&log_file) > max_size)
new_file_without_locking();
@@ -3689,17 +3827,21 @@ err:
DBUG_RETURN(error);
}
-
-bool MYSQL_BIN_LOG::flush_and_sync()
+bool MYSQL_BIN_LOG::flush_and_sync(bool *synced)
{
int err=0, fd=log_file.file;
+ if (synced)
+ *synced= 0;
safe_mutex_assert_owner(&LOCK_log);
if (flush_io_cache(&log_file))
return 1;
- if (++sync_binlog_counter >= sync_binlog_period && sync_binlog_period)
+ uint sync_period= get_sync_period();
+ if (sync_period && ++sync_counter >= sync_period)
{
- sync_binlog_counter= 0;
+ sync_counter= 0;
err=my_sync(fd, MYF(MY_WME));
+ if (synced)
+ *synced= 1;
}
return err;
}
@@ -3847,11 +3989,8 @@ int THD::binlog_write_table_map(TABLE *table, bool is_trans)
DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open());
DBUG_ASSERT(table->s->table_map_id != ULONG_MAX);
- Table_map_log_event::flag_set const
- flags= Table_map_log_event::TM_NO_FLAGS;
-
Table_map_log_event
- the_event(this, table, table->s->table_map_id, is_trans, flags);
+ the_event(this, table, table->s->table_map_id, is_trans);
if (is_trans && binlog_table_maps == 0)
binlog_start_trans_and_stmt();
@@ -3990,7 +4129,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
if (file == &log_file)
{
- error= flush_and_sync();
+ error= flush_and_sync(0);
if (!error)
{
signal_update();
@@ -4176,8 +4315,16 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
if (file == &log_file) // we are writing to the real log (disk)
{
- if (flush_and_sync())
+ bool synced= 0;
+ if (flush_and_sync(&synced))
goto err;
+
+ if (RUN_HOOK(binlog_storage, after_flush,
+ (thd, log_file_name, file->pos_in_file, synced))) {
+ sql_print_error("Failed to run 'after_flush' hooks");
+ goto err;
+ }
+
signal_update();
rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
}
@@ -4432,7 +4579,7 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log)
DBUG_ASSERT(carry == 0);
if (sync_log)
- flush_and_sync();
+ return flush_and_sync(0);
return 0; // All OK
}
@@ -4479,7 +4626,7 @@ bool MYSQL_BIN_LOG::write_incident(THD *thd, bool lock)
ev.write(&log_file);
if (lock)
{
- if (!error && !(error= flush_and_sync()))
+ if (!error && !(error= flush_and_sync(0)))
{
signal_update();
rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
@@ -4567,7 +4714,8 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event,
if (incident && write_incident(thd, FALSE))
goto err;
- if (flush_and_sync())
+ bool synced= 0;
+ if (flush_and_sync(&synced))
goto err;
DBUG_EXECUTE_IF("half_binlogged_transaction", abort(););
if (cache->error) // Error on read
@@ -4576,6 +4724,15 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event,
write_error=1; // Don't give more errors
goto err;
}
+
+ if (RUN_HOOK(binlog_storage, after_flush,
+ (thd, log_file_name, log_file.pos_in_file, synced)))
+ {
+ sql_print_error("Failed to run 'after_flush' hooks");
+ write_error=1;
+ goto err;
+ }
+
signal_update();
}
@@ -4612,12 +4769,9 @@ err:
/**
- Wait until we get a signal that the binary log has been updated.
+ Wait until we get a signal that the relay log has been updated.
@param thd Thread variable
- @param is_slave If 0, the caller is the Binlog_dump thread from master;
- if 1, the caller is the SQL thread from the slave. This
- influences only thd->proc_info.
@note
One must have a lock on LOCK_log before calling this function.
@@ -4625,22 +4779,53 @@ err:
THD::enter_cond() (see NOTES in sql_class.h).
*/
-void MYSQL_BIN_LOG::wait_for_update(THD* thd, bool is_slave)
+void MYSQL_BIN_LOG::wait_for_update_relay_log(THD* thd)
{
const char *old_msg;
- DBUG_ENTER("wait_for_update");
+ DBUG_ENTER("wait_for_update_relay_log");
old_msg= thd->enter_cond(&update_cond, &LOCK_log,
- is_slave ?
- "Has read all relay log; waiting for the slave I/O "
- "thread to update it" :
- "Has sent all binlog to slave; waiting for binlog "
- "to be updated");
+ "Slave has read all relay log; "
+ "waiting for the slave I/O "
+ "thread to update it" );
pthread_cond_wait(&update_cond, &LOCK_log);
thd->exit_cond(old_msg);
DBUG_VOID_RETURN;
}
+/**
+ Wait until we get a signal that the binary log has been updated.
+ Applies to master only.
+
+ NOTES
+ @param[in] thd a THD struct
+ @param[in] timeout a pointer to a timespec;
+ NULL means to wait w/o timeout.
+ @retval 0 if got signalled on update
+ @retval non-0 if wait timeout elapsed
+ @note
+ LOCK_log must be taken before calling this function.
+ LOCK_log is being released while the thread is waiting.
+ LOCK_log is released by the caller.
+*/
+
+int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd,
+ const struct timespec *timeout)
+{
+ int ret= 0;
+ const char* old_msg = thd->proc_info;
+ DBUG_ENTER("wait_for_update_bin_log");
+ old_msg= thd->enter_cond(&update_cond, &LOCK_log,
+ "Master has sent all binlog to slave; "
+ "waiting for binlog to be updated");
+ if (!timeout)
+ pthread_cond_wait(&update_cond, &LOCK_log);
+ else
+ ret= pthread_cond_timedwait(&update_cond, &LOCK_log,
+ const_cast<struct timespec *>(timeout));
+ DBUG_RETURN(ret);
+}
+
/**
Close the log file.
@@ -4745,11 +4930,11 @@ void MYSQL_BIN_LOG::set_max_size(ulong max_size_arg)
@retval
1 String is a number
@retval
- 0 Error
+ 0 String is not a number
*/
static bool test_if_number(register const char *str,
- long *res, bool allow_wildcards)
+ ulong *res, bool allow_wildcards)
{
reg2 int flag;
const char *start;
@@ -4853,6 +5038,7 @@ bool flush_error_log()
void MYSQL_BIN_LOG::signal_update()
{
DBUG_ENTER("MYSQL_BIN_LOG::signal_update");
+ signal_cnt++;
pthread_cond_broadcast(&update_cond);
DBUG_VOID_RETURN;
}
diff --git a/sql/log.h b/sql/log.h
index d306d6f7182..76ca18c8288 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -121,6 +121,19 @@ extern TC_LOG_DUMMY tc_log_dummy;
#define LOG_CLOSE_TO_BE_OPENED 2
#define LOG_CLOSE_STOP_EVENT 4
+/*
+ Maximum unique log filename extension.
+ Note: setting to 0x7FFFFFFF due to atol windows
+ overflow/truncate.
+ */
+#define MAX_LOG_UNIQUE_FN_EXT 0x7FFFFFFF
+
+/*
+ Number of warnings that will be printed to error log
+ before extension number is exhausted.
+*/
+#define LOG_WARN_UNIQUE_FN_EXT_LEFT 1000
+
class Relay_log_info;
typedef struct st_log_info
@@ -269,6 +282,18 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
ulonglong m_table_map_version;
+ /* pointer to the sync period variable, for binlog this will be
+ sync_binlog_period, for relay log this will be
+ sync_relay_log_period
+ */
+ uint *sync_period_ptr;
+ uint sync_counter;
+
+ inline uint get_sync_period()
+ {
+ return *sync_period_ptr;
+ }
+
int write_to_file(IO_CACHE *cache);
/*
This is used to start writing to a new log file. The difference from
@@ -284,7 +309,7 @@ public:
/* This is relay log */
bool is_relay_log;
-
+ ulong signal_cnt; // update of the counter is checked by heartbeat
/*
These describe the log's format. This is used only for relay logs.
_for_exec is used by the SQL thread, _for_queue by the I/O thread. It's
@@ -296,7 +321,7 @@ public:
Format_description_log_event *description_event_for_exec,
*description_event_for_queue;
- MYSQL_BIN_LOG();
+ MYSQL_BIN_LOG(uint *sync_period);
/*
note that there's no destructor ~MYSQL_BIN_LOG() !
The reason is that we don't want it to be automatically called
@@ -339,7 +364,8 @@ public:
}
void set_max_size(ulong max_size_arg);
void signal_update();
- void wait_for_update(THD* thd, bool master_or_slave);
+ void wait_for_update_relay_log(THD* thd);
+ int wait_for_update_bin_log(THD* thd, const struct timespec * timeout);
void set_need_start_event() { need_start_event = 1; }
void init(bool no_auto_events_arg, ulong max_size);
void init_pthread_objects();
@@ -378,7 +404,20 @@ public:
bool is_active(const char* log_file_name);
int update_log_index(LOG_INFO* linfo, bool need_update_threads);
void rotate_and_purge(uint flags);
- bool flush_and_sync();
+ /**
+ Flush binlog cache and synchronize to disk.
+
+ This function flushes events in binlog cache to binary log file,
+ it will do synchronizing according to the setting of system
+ variable 'sync_binlog'. If file is synchronized, @c synced will
+ be set to 1, otherwise 0.
+
+ @param[out] synced if not NULL, set to 1 if file is synchronized, otherwise 0
+
+ @retval 0 Success
+ @retval other Failure
+ */
+ bool flush_and_sync(bool *synced);
int purge_logs(const char *to_log, bool included,
bool need_mutex, bool need_update_threads,
ulonglong *decrease_log_space);
@@ -531,6 +570,8 @@ public:
void init_base();
void init_log_tables();
bool flush_logs(THD *thd);
+ bool flush_slow_log();
+ bool flush_general_log();
/* Perform basic logger cleanup. this will leave e.g. error log open. */
void cleanup_base();
/* Free memory. Nothing could be logged after this function is called */
@@ -585,5 +626,6 @@ enum enum_binlog_format {
extern TYPELIB binlog_format_typelib;
int query_error_code(THD *thd, bool not_killed);
+uint purge_log_get_error_code(int res);
#endif /* LOG_H */
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 5e49f7b3312..d0c8c245175 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -29,7 +29,6 @@
#include "rpl_rli.h"
#include "rpl_mi.h"
#include "rpl_filter.h"
-#include "rpl_utility.h"
#include "rpl_record.h"
#include <my_dir.h>
@@ -37,6 +36,7 @@
#include <base64.h>
#include <my_bitmap.h>
+#include "rpl_utility.h"
#define log_cs &my_charset_latin1
@@ -1570,37 +1570,14 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
/* a long CHAR() field: see #37426 */
length= byte1 | (((byte0 & 0x30) ^ 0x30) << 4);
type= byte0 | 0x30;
- goto beg;
- }
-
- switch (byte0)
- {
- case MYSQL_TYPE_SET:
- case MYSQL_TYPE_ENUM:
- case MYSQL_TYPE_STRING:
- type= byte0;
- length= byte1;
- break;
-
- default:
-
- {
- char tmp[5];
- my_snprintf(tmp, sizeof(tmp), "%04X", meta);
- my_b_printf(file,
- "!! Don't know how to handle column type=%d meta=%d (%s)",
- type, meta, tmp);
- return 0;
- }
}
+ else
+ length = meta & 0xFF;
}
else
length= meta;
}
-
-beg:
-
switch (type) {
case MYSQL_TYPE_LONG:
{
@@ -1737,6 +1714,33 @@ beg:
return 3;
}
+ case MYSQL_TYPE_NEWDATE:
+ {
+ uint32 tmp= uint3korr(ptr);
+ int part;
+ char buf[10];
+ char *pos= &buf[10];
+
+ /* Copied from field.cc */
+ *pos--=0; // End NULL
+ part=(int) (tmp & 31);
+ *pos--= (char) ('0'+part%10);
+ *pos--= (char) ('0'+part/10);
+ *pos--= ':';
+ part=(int) (tmp >> 5 & 15);
+ *pos--= (char) ('0'+part%10);
+ *pos--= (char) ('0'+part/10);
+ *pos--= ':';
+ part=(int) (tmp >> 9);
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos--= (char) ('0'+part%10); part/=10;
+ *pos= (char) ('0'+part);
+ my_b_printf(file , "'%s'", buf);
+ my_snprintf(typestr, typestr_length, "DATE");
+ return 3;
+ }
+
case MYSQL_TYPE_DATE:
{
uint i32= uint3korr(ptr);
@@ -1755,7 +1759,7 @@ beg:
}
case MYSQL_TYPE_ENUM:
- switch (length) {
+ switch (meta & 0xFF) {
case 1:
my_b_printf(file, "%d", (int) *ptr);
my_snprintf(typestr, typestr_length, "ENUM(1 byte)");
@@ -1768,15 +1772,15 @@ beg:
return 2;
}
default:
- my_b_printf(file, "!! Unknown ENUM packlen=%d", length);
+ my_b_printf(file, "!! Unknown ENUM packlen=%d", meta & 0xFF);
return 0;
}
break;
case MYSQL_TYPE_SET:
- my_b_write_bit(file, ptr , length * 8);
- my_snprintf(typestr, typestr_length, "SET(%d bytes)", length);
- return length;
+ my_b_write_bit(file, ptr , (meta & 0xFF) * 8);
+ my_snprintf(typestr, typestr_length, "SET(%d bytes)", meta & 0xFF);
+ return meta & 0xFF;
case MYSQL_TYPE_BLOB:
switch (meta) {
@@ -2393,13 +2397,29 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
charset_database_number= thd_arg->variables.collation_database->number;
/*
- If we don't use flags2 for anything else than options contained in
- thd_arg->options, it would be more efficient to flags2=thd_arg->options
- (OPTIONS_WRITTEN_TO_BIN_LOG would be used only at reading time).
- But it's likely that we don't want to use 32 bits for 3 bits; in the future
- we will probably want to reclaim the 29 bits. So we need the &.
+ We only replicate over the bits of flags2 that we need: the rest
+ are masked out by "& OPTIONS_WRITTEN_TO_BINLOG".
+
+ We also force AUTOCOMMIT=1. Rationale (cf. BUG#29288): After
+ fixing BUG#26395, we always write BEGIN and COMMIT around all
+ transactions (even single statements in autocommit mode). This is
+ so that replication from non-transactional to transactional table
+ and error recovery from XA to non-XA table should work as
+ expected. The BEGIN/COMMIT are added in log.cc. However, there is
+ one exception: MyISAM bypasses log.cc and writes directly to the
+ binlog. So if autocommit is off, master has MyISAM, and slave has
+ a transactional engine, then the slave will just see one long
+ never-ending transaction. The only way to bypass explicit
+ BEGIN/COMMIT in the binlog is by using a non-transactional table.
+ So setting AUTOCOMMIT=1 will make this work as expected.
+
+ Note: explicitly replicate AUTOCOMMIT=1 from master. We do not
+ assume AUTOCOMMIT=1 on slave; the slave still reads the state of
+ the autocommit flag as written by the master to the binlog. This
+ behavior may change after WL#4162 has been implemented.
*/
- flags2= (uint32) (thd_arg->options & OPTIONS_WRITTEN_TO_BIN_LOG);
+ flags2= (uint32) (thd_arg->options &
+ (OPTIONS_WRITTEN_TO_BIN_LOG & ~OPTION_NOT_AUTOCOMMIT));
DBUG_ASSERT(thd_arg->variables.character_set_client->number < 256*256);
DBUG_ASSERT(thd_arg->variables.collation_connection->number < 256*256);
DBUG_ASSERT(thd_arg->variables.collation_server->number < 256*256);
@@ -3260,6 +3280,21 @@ Default database: '%s'. Query: '%s'",
*/
} /* End of if (db_ok(... */
+ {/**
+ The following failure injecion works in cooperation with tests
+ setting @@global.debug= 'd,stop_slave_middle_group'.
+ The sql thread receives the killed status and will proceed
+ to shutdown trying to finish incomplete events group.
+ */
+ DBUG_EXECUTE_IF("stop_slave_middle_group",
+ if (strcmp("COMMIT", query) != 0 &&
+ strcmp("BEGIN", query) != 0)
+ {
+ if (thd->transaction.all.modified_non_trans_table)
+ const_cast<Relay_log_info*>(rli)->abort_slave= 1;
+ };);
+ }
+
end:
/*
Probably we have set thd->query, thd->db, thd->catalog to point to places
@@ -3631,6 +3666,7 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver)
post_header_len[UPDATE_ROWS_EVENT-1]=
post_header_len[DELETE_ROWS_EVENT-1]= 6;);
post_header_len[INCIDENT_EVENT-1]= INCIDENT_HEADER_LEN;
+ post_header_len[HEARTBEAT_LOG_EVENT-1]= 0;
// Sanity-check that all post header lengths are initialized.
IF_DBUG({
@@ -7309,11 +7345,18 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
*/
{
+ DBUG_PRINT("debug", ("Checking compability of tables to lock - tables_to_lock: %p",
+ rli->tables_to_lock));
RPL_TABLE_LIST *ptr= rli->tables_to_lock;
for ( ; ptr ; ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global))
{
- if (ptr->m_tabledef.compatible_with(rli, ptr->table))
+ TABLE *conv_table;
+ if (!ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli),
+ ptr->table, &conv_table))
{
+ DBUG_PRINT("debug", ("Table: %s.%s is not compatible with master",
+ ptr->table->s->db.str,
+ ptr->table->s->table_name.str));
/*
We should not honour --slave-skip-errors at this point as we are
having severe errors which should not be skiped.
@@ -7324,12 +7367,17 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(ERR_BAD_TABLE_DEF);
}
+ DBUG_PRINT("debug", ("Table: %s.%s is compatible with master"
+ " - conv_table: %p",
+ ptr->table->s->db.str,
+ ptr->table->s->table_name.str, conv_table));
+ ptr->m_conv_table= conv_table;
}
}
/*
- ... and then we add all the tables to the table map and remove
- them from tables to lock.
+ ... and then we add all the tables to the table map and but keep
+ them in the tables to lock list.
We also invalidate the query cache for all the tables, since
they will now be changed.
@@ -7474,8 +7522,16 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
thd->transaction.stmt.modified_non_trans_table= TRUE;
} // row processing loop
- DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event",
- const_cast<Relay_log_info*>(rli)->abort_slave= 1;);
+ {/**
+ The following failure injecion works in cooperation with tests
+ setting @@global.debug= 'd,stop_slave_middle_group'.
+ The sql thread receives the killed status and will proceed
+ to shutdown trying to finish incomplete events group.
+ */
+ DBUG_EXECUTE_IF("stop_slave_middle_group",
+ if (thd->transaction.all.modified_non_trans_table)
+ const_cast<Relay_log_info*>(rli)->abort_slave= 1;);
+ }
if ((error= do_after_row_operations(rli, error)) &&
ignored_error_code(convert_handler_error(error, thd, table)))
@@ -7513,32 +7569,6 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
thd->is_slave_error= 1;
DBUG_RETURN(error);
}
- /*
- This code would ideally be placed in do_update_pos() instead, but
- since we have no access to table there, we do the setting of
- last_event_start_time here instead.
- */
- else if (table && (table->s->primary_key == MAX_KEY) &&
- !cache_stmt && get_flags(STMT_END_F) == RLE_NO_FLAGS)
- {
- /*
- ------------ Temporary fix until WL#2975 is implemented ---------
-
- This event is not the last one (no STMT_END_F). If we stop now
- (in case of terminate_slave_thread()), how will we restart? We
- have to restart from Table_map_log_event, but as this table is
- not transactional, the rows already inserted will still be
- present, and idempotency is not guaranteed (no PK) so we risk
- that repeating leads to double insert. So we desperately try to
- continue, hope we'll eventually leave this buggy situation (by
- executing the final Rows_log_event). If we are in a hopeless
- wait (reached end of last relay log and nothing gets appended
- there), we timeout after one minute, and notify DBA about the
- problem. When WL#2975 is implemented, just remove the member
- Relay_log_info::last_event_start_time and all its occurrences.
- */
- const_cast<Relay_log_info*>(rli)->last_event_start_time= my_time(0);
- }
if (get_flags(STMT_END_F))
if ((error= rows_event_stmt_cleanup(rli, thd)))
@@ -7825,7 +7855,10 @@ int Table_map_log_event::save_field_metadata()
DBUG_ENTER("Table_map_log_event::save_field_metadata");
int index= 0;
for (unsigned int i= 0 ; i < m_table->s->fields ; i++)
+ {
+ DBUG_PRINT("debug", ("field_type: %d", m_coltype[i]));
index+= m_table->s->field[i]->save_field_metadata(&m_field_metadata[index]);
+ }
DBUG_RETURN(index);
}
#endif /* !defined(MYSQL_CLIENT) */
@@ -7837,7 +7870,7 @@ int Table_map_log_event::save_field_metadata()
*/
#if !defined(MYSQL_CLIENT)
Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
- bool is_transactional, uint16 flags)
+ bool is_transactional)
: Log_event(thd, 0, true),
m_table(tbl),
m_dbnam(tbl->s->db.str),
@@ -7847,7 +7880,7 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
m_colcnt(tbl->s->fields),
m_memory(NULL),
m_table_id(tid),
- m_flags(flags),
+ m_flags(TM_BIT_LEN_EXACT_F),
m_data_size(0),
m_field_metadata(0),
m_field_metadata_size(0),
@@ -8105,8 +8138,10 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
inside Relay_log_info::clear_tables_to_lock() by calling the
table_def destructor explicitly.
*/
- new (&table_list->m_tabledef) table_def(m_coltype, m_colcnt,
- m_field_metadata, m_field_metadata_size, m_null_bits);
+ new (&table_list->m_tabledef)
+ table_def(m_coltype, m_colcnt,
+ m_field_metadata, m_field_metadata_size,
+ m_null_bits, m_flags);
table_list->m_tabledef_valid= TRUE;
/*
@@ -9441,3 +9476,16 @@ st_print_event_info::st_print_event_info()
open_cached_file(&body_cache, NULL, NULL, 0, flags);
}
#endif
+
+
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
+Heartbeat_log_event::Heartbeat_log_event(const char* buf, uint event_len,
+ const Format_description_log_event* description_event)
+ :Log_event(buf, description_event)
+{
+ uint8 header_size= description_event->common_header_len;
+ ident_len = event_len - header_size;
+ set_if_smaller(ident_len,FN_REFLEN-1);
+ log_ident= buf + header_size;
+}
+#endif
diff --git a/sql/log_event.h b/sql/log_event.h
index 0b4c63a73af..d4168a87331 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -250,6 +250,7 @@ struct sql_ex_info
#define EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN (4 + 4 + 4 + 1)
#define EXECUTE_LOAD_QUERY_HEADER_LEN (QUERY_HEADER_LEN + EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN)
#define INCIDENT_HEADER_LEN 2
+#define HEARTBEAT_HEADER_LEN 0
/*
Max number of possible extra bytes in a replication event compared to a
packet (i.e. a query) sent from client to master;
@@ -575,6 +576,12 @@ enum Log_event_type
INCIDENT_EVENT= 26,
/*
+ Heartbeat event to be send by master at its idle time
+ to ensure master's online status to slave
+ */
+ HEARTBEAT_LOG_EVENT= 27,
+
+ /*
Add new events here - right above this comment!
Existing events (except ENUM_END_EVENT) should never change their numbers
*/
@@ -689,6 +696,20 @@ typedef struct st_print_event_info
} PRINT_EVENT_INFO;
#endif
+/**
+ the struct aggregates two paramenters that identify an event
+ uniquely in scope of communication of a particular master and slave couple.
+ I.e there can not be 2 events from the same staying connected master which
+ have the same coordinates.
+ @note
+ Such identifier is not yet unique generally as the event originating master
+ is resetable. Also the crashed master can be replaced with some other.
+*/
+struct event_coordinates
+{
+ char * file_name; // binlog file name (directories stripped)
+ my_off_t pos; // event's position in the binlog file
+};
/**
@class Log_event
@@ -3283,16 +3304,14 @@ public:
/* Special constants representing sets of flags */
enum
{
- TM_NO_FLAGS = 0U
+ TM_NO_FLAGS = 0U,
+ TM_BIT_LEN_EXACT_F = (1U << 0)
};
- void set_flags(flag_set flag) { m_flags |= flag; }
- void clear_flags(flag_set flag) { m_flags &= ~flag; }
flag_set get_flags(flag_set flag) const { return m_flags & flag; }
#ifndef MYSQL_CLIENT
- Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
- bool is_transactional, uint16 flags);
+ Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, bool is_transactional);
#endif
#ifdef HAVE_REPLICATION
Table_map_log_event(const char *buf, uint event_len,
@@ -3305,7 +3324,7 @@ public:
table_def *create_table_def()
{
return new table_def(m_coltype, m_colcnt, m_field_metadata,
- m_field_metadata_size, m_null_bits);
+ m_field_metadata_size, m_null_bits, m_flags);
}
ulong get_table_id() const { return m_table_id; }
const char *get_table_name() const { return m_tblnam; }
@@ -3920,6 +3939,42 @@ static inline bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache,
reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
}
+#ifndef MYSQL_CLIENT
+/*****************************************************************************
+
+ Heartbeat Log Event class
+
+ Replication event to ensure to slave that master is alive.
+ The event is originated by master's dump thread and sent straight to
+ slave without being logged. Slave itself does not store it in relay log
+ but rather uses a data for immediate checks and throws away the event.
+
+ Two members of the class log_ident and Log_event::log_pos comprise
+ @see the event_coordinates instance. The coordinates that a heartbeat
+ instance carries correspond to the last event master has sent from
+ its binlog.
+
+ ****************************************************************************/
+class Heartbeat_log_event: public Log_event
+{
+public:
+ Heartbeat_log_event(const char* buf, uint event_len,
+ const Format_description_log_event* description_event);
+ Log_event_type get_type_code() { return HEARTBEAT_LOG_EVENT; }
+ bool is_valid() const
+ {
+ return (log_ident != NULL &&
+ log_pos >= BIN_LOG_HEADER_SIZE);
+ }
+ const char * get_log_ident() { return log_ident; }
+ uint get_ident_len() { return ident_len; }
+
+private:
+ const char* log_ident;
+ uint ident_len;
+};
+#endif
+
/**
@} (end of group Replication)
*/
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 357bc78b1cd..4edf060450c 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -107,14 +107,24 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info
RPL_TABLE_LIST *ptr= rli->tables_to_lock;
for ( ; ptr ; ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global))
{
- if (ptr->m_tabledef.compatible_with(rli, ptr->table))
+ TABLE *conv_table;
+ if (!ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli),
+ ptr->table, &conv_table))
{
+ DBUG_PRINT("debug", ("Table: %s.%s is not compatible with master",
+ ptr->table->s->db.str,
+ ptr->table->s->table_name.str));
mysql_unlock_tables(thd, thd->lock);
thd->lock= 0;
thd->is_slave_error= 1;
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(Old_rows_log_event::ERR_BAD_TABLE_DEF);
}
+ DBUG_PRINT("debug", ("Table: %s.%s is compatible with master"
+ " - conv_table: %p",
+ ptr->table->s->db.str,
+ ptr->table->s->table_name.str, conv_table));
+ ptr->m_conv_table= conv_table;
}
}
@@ -226,7 +236,7 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info
row_start= row_end;
}
- DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event",
+ DBUG_EXECUTE_IF("stop_slave_middle_group",
const_cast<Relay_log_info*>(rli)->abort_slave= 1;);
error= do_after_row_operations(table, error);
if (!ev->cache_stmt)
@@ -269,34 +279,6 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info
DBUG_RETURN(error);
}
- /*
- This code would ideally be placed in do_update_pos() instead, but
- since we have no access to table there, we do the setting of
- last_event_start_time here instead.
- */
- if (table && (table->s->primary_key == MAX_KEY) &&
- !ev->cache_stmt &&
- ev->get_flags(Old_rows_log_event::STMT_END_F) == Old_rows_log_event::RLE_NO_FLAGS)
- {
- /*
- ------------ Temporary fix until WL#2975 is implemented ---------
-
- This event is not the last one (no STMT_END_F). If we stop now
- (in case of terminate_slave_thread()), how will we restart? We
- have to restart from Table_map_log_event, but as this table is
- not transactional, the rows already inserted will still be
- present, and idempotency is not guaranteed (no PK) so we risk
- that repeating leads to double insert. So we desperately try to
- continue, hope we'll eventually leave this buggy situation (by
- executing the final Old_rows_log_event). If we are in a hopeless
- wait (reached end of last relay log and nothing gets appended
- there), we timeout after one minute, and notify DBA about the
- problem. When WL#2975 is implemented, just remove the member
- st_relay_log_info::last_event_start_time and all its occurences.
- */
- const_cast<Relay_log_info*>(rli)->last_event_start_time= my_time(0);
- }
-
DBUG_RETURN(0);
}
#endif
@@ -1578,7 +1560,9 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
RPL_TABLE_LIST *ptr= rli->tables_to_lock;
for ( ; ptr ; ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global))
{
- if (ptr->m_tabledef.compatible_with(rli, ptr->table))
+ TABLE *conv_table;
+ if (ptr->m_tabledef.compatible_with(thd, const_cast<Relay_log_info*>(rli),
+ ptr->table, &conv_table))
{
mysql_unlock_tables(thd, thd->lock);
thd->lock= 0;
@@ -1586,12 +1570,14 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(ERR_BAD_TABLE_DEF);
}
+ ptr->m_conv_table= conv_table;
}
}
/*
- ... and then we add all the tables to the table map and remove
- them from tables to lock.
+ ... and then we add all the tables to the table map but keep
+ them in the tables to lock list.
+
We also invalidate the query cache for all the tables, since
they will now be changed.
@@ -1744,7 +1730,7 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
} // row processing loop
- DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event",
+ DBUG_EXECUTE_IF("stop_slave_middle_group",
const_cast<Relay_log_info*>(rli)->abort_slave= 1;);
error= do_after_row_operations(rli, error);
if (!cache_stmt)
diff --git a/sql/message.h b/sql/message.h
index 0e7c282d5a1..97d039352b4 100644
--- a/sql/message.h
+++ b/sql/message.h
@@ -1,3 +1,6 @@
+#ifndef MESSAGE_INCLUDED
+#define MESSAGE_INCLUDED
+
/*
To change or add messages mysqld writes to the Windows error log, run
mc.exe message.mc
@@ -6,6 +9,8 @@
mc.exe can be installed with Windows SDK, some Visual Studio distributions
do not include it.
*/
+
+
//
// Values are 32 bit values layed out as follows:
//
@@ -53,3 +58,5 @@
//
#define MSG_DEFAULT 0xC0000064L
+#endif /* MESSAGE_INCLUDED */
+
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index c04b1f5ae38..abd1d58d4e9 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -111,16 +111,35 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
#define all_bits_set(A,B) ((A) & (B) != (B))
-#define WARN_DEPRECATED(Thd,Ver,Old,New) \
- do { \
- DBUG_ASSERT(strncmp(Ver, MYSQL_SERVER_VERSION, sizeof(Ver)-1) > 0); \
- if (((uchar*)Thd) != NULL) \
- push_warning_printf(((THD *)Thd), MYSQL_ERROR::WARN_LEVEL_WARN, \
- ER_WARN_DEPRECATED_SYNTAX, ER(ER_WARN_DEPRECATED_SYNTAX_WITH_VER), \
- (Old), (Ver), (New)); \
- else \
- sql_print_warning("The syntax '%s' is deprecated and will be removed " \
- "in MySQL %s. Please use %s instead.", (Old), (Ver), (New)); \
+/*
+ Generates a warning that a feature is deprecated. After a specified
+ version asserts that the feature is removed.
+
+ Using it as
+
+ WARN_DEPRECATED(thd, 6,2, "BAD", "'GOOD'");
+
+ Will result in a warning
+
+ "The syntax 'BAD' is deprecated and will be removed in MySQL 6.2. Please
+ use 'GOOD' instead"
+
+ Note that in macro arguments BAD is not quoted, while 'GOOD' is.
+ Note that the version is TWO numbers, separated with a comma
+ (two macro arguments, that is)
+*/
+#define WARN_DEPRECATED(Thd,VerHi,VerLo,Old,New) \
+ do { \
+ compile_time_assert(MYSQL_VERSION_ID < VerHi * 10000 + VerLo * 100); \
+ if (((THD *) Thd) != NULL) \
+ push_warning_printf(((THD *) Thd), MYSQL_ERROR::WARN_LEVEL_WARN, \
+ ER_WARN_DEPRECATED_SYNTAX, \
+ ER(ER_WARN_DEPRECATED_SYNTAX_WITH_VER), \
+ (Old), #VerHi "." #VerLo, (New)); \
+ else \
+ sql_print_warning("The syntax '%s' is deprecated and will be removed " \
+ "in MySQL %s. Please use %s instead.", \
+ (Old), #VerHi "." #VerLo, (New)); \
} while(0)
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info;
@@ -938,100 +957,6 @@ struct Query_cache_query_flags
#define query_cache_is_cacheable_query(L) 0
#endif /*HAVE_QUERY_CACHE*/
-/*
- Error injector Macros to enable easy testing of recovery after failures
- in various error cases.
-*/
-#ifndef ERROR_INJECT_SUPPORT
-
-#define ERROR_INJECT(x) 0
-#define ERROR_INJECT_ACTION(x,action) 0
-#define ERROR_INJECT_CRASH(x) 0
-#define ERROR_INJECT_VALUE(x) 0
-#define ERROR_INJECT_VALUE_ACTION(x,action) 0
-#define ERROR_INJECT_VALUE_CRASH(x) 0
-#define SET_ERROR_INJECT_VALUE(x)
-
-#else
-
-inline bool check_and_unset_keyword(const char *dbug_str)
-{
- const char *extra_str= "-d,";
- char total_str[200];
- if (_db_strict_keyword_ (dbug_str))
- {
- strxmov(total_str, extra_str, dbug_str, NullS);
- DBUG_SET(total_str);
- return 1;
- }
- return 0;
-}
-
-
-inline bool
-check_and_unset_inject_value(int value)
-{
- THD *thd= current_thd;
- if (thd->error_inject_value == (uint)value)
- {
- thd->error_inject_value= 0;
- return 1;
- }
- return 0;
-}
-
-/*
- ERROR INJECT MODULE:
- --------------------
- These macros are used to insert macros from the application code.
- The event that activates those error injections can be activated
- from SQL by using:
- SET SESSION dbug=+d,code;
-
- After the error has been injected, the macros will automatically
- remove the debug code, thus similar to using:
- SET SESSION dbug=-d,code
- from SQL.
-
- ERROR_INJECT_CRASH will inject a crash of the MySQL Server if code
- is set when macro is called. ERROR_INJECT_CRASH can be used in
- if-statements, it will always return FALSE unless of course it
- crashes in which case it doesn't return at all.
-
- ERROR_INJECT_ACTION will inject the action specified in the action
- parameter of the macro, before performing the action the code will
- be removed such that no more events occur. ERROR_INJECT_ACTION
- can also be used in if-statements and always returns FALSE.
- ERROR_INJECT can be used in a normal if-statement, where the action
- part is performed in the if-block. The macro returns TRUE if the
- error was activated and otherwise returns FALSE. If activated the
- code is removed.
-
- Sometimes it is necessary to perform error inject actions as a serie
- of events. In this case one can use one variable on the THD object.
- Thus one sets this value by using e.g. SET_ERROR_INJECT_VALUE(100).
- Then one can later test for it by using ERROR_INJECT_CRASH_VALUE,
- ERROR_INJECT_ACTION_VALUE and ERROR_INJECT_VALUE. This have the same
- behaviour as the above described macros except that they use the
- error inject value instead of a code used by DBUG macros.
-*/
-#define SET_ERROR_INJECT_VALUE(x) \
- current_thd->error_inject_value= (x)
-#define ERROR_INJECT_CRASH(code) \
- DBUG_EVALUATE_IF(code, (abort(), 0), 0)
-#define ERROR_INJECT_ACTION(code, action) \
- (check_and_unset_keyword(code) ? ((action), 0) : 0)
-#define ERROR_INJECT(code) \
- check_and_unset_keyword(code)
-#define ERROR_INJECT_VALUE(value) \
- check_and_unset_inject_value(value)
-#define ERROR_INJECT_VALUE_ACTION(value,action) \
- (check_and_unset_inject_value(value) ? (action) : 0)
-#define ERROR_INJECT_VALUE_CRASH(value) \
- ERROR_INJECT_VALUE_ACTION(value, (abort(), 0))
-
-#endif
-
void write_bin_log(THD *thd, bool clear_error,
char const *query, ulong query_length);
@@ -1962,10 +1887,13 @@ extern ulong MYSQL_PLUGIN_IMPORT specialflag;
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
extern ulong current_pid;
-extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter;
+extern ulong expire_logs_days;
+extern uint sync_binlog_period, sync_relaylog_period,
+ sync_relayloginfo_period, sync_masterinfo_period;
extern ulong opt_tc_log_size, tc_log_max_pages_used, tc_log_page_size;
extern ulong tc_log_page_waits;
extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb;
+extern my_bool relay_log_recovery;
extern uint test_flags,select_errors,ha_open_options;
extern uint protocol_version, mysqld_port, dropping_tables;
extern uint delay_key_write_options;
@@ -1998,6 +1926,7 @@ extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types;
extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern ulong slave_exec_mode_options;
+extern ulong slave_type_conversions_options;
extern my_bool opt_readonly, lower_case_file_system;
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
extern my_bool opt_secure_auth;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5c643b03798..ce471f42aaa 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -32,6 +32,8 @@
#include "rpl_injector.h"
+#include "rpl_handler.h"
+
#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
#endif
@@ -448,7 +450,6 @@ my_bool opt_local_infile, opt_slave_compressed_protocol;
my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0;
-bool slave_warning_issued = false;
/*
Legacy global handlerton. These will be removed (please do not add more).
@@ -478,6 +479,7 @@ extern const char *opt_ndb_distribution;
extern enum ndb_distribution opt_ndb_distribution_id;
#endif
my_bool opt_readonly, use_temp_pool, relay_log_purge;
+my_bool relay_log_recovery;
my_bool opt_sync_frm, opt_allow_suspicious_udfs;
my_bool opt_secure_auth= 0;
char* opt_secure_file_priv= 0;
@@ -525,6 +527,8 @@ ulong open_files_limit, max_binlog_size, max_relay_log_size;
ulong slave_net_timeout, slave_trans_retries;
ulong slave_exec_mode_options;
const char *slave_exec_mode_str= "STRICT";
+ulong slave_type_conversions_options;
+const char *slave_type_conversions_default= "";
ulong thread_cache_size=0, thread_pool_size= 0;
ulong binlog_cache_size=0;
ulonglong max_binlog_cache_size=0;
@@ -556,7 +560,9 @@ ulong max_prepared_stmt_count;
*/
ulong prepared_stmt_count=0;
ulong thread_id=1L,current_pid;
-ulong slow_launch_threads = 0, sync_binlog_period;
+ulong slow_launch_threads = 0;
+uint sync_binlog_period= 0, sync_relaylog_period= 0,
+ sync_relayloginfo_period= 0, sync_masterinfo_period= 0;
ulong expire_logs_days = 0;
ulong rpl_recovery_rank=0;
const char *log_output_str= "FILE";
@@ -664,15 +670,11 @@ int mysqld_server_started= 0;
File_parser_dummy_hook file_parser_dummy_hook;
/* replication parameters, if master_host is not NULL, we are a slave */
-uint master_port= MYSQL_PORT, master_connect_retry = 60;
uint report_port= MYSQL_PORT;
ulong master_retry_count=0;
-char *master_user, *master_password, *master_host, *master_info_file;
+char *master_info_file;
char *relay_log_info_file, *report_user, *report_password, *report_host;
char *opt_relay_logname = 0, *opt_relaylog_index_name=0;
-my_bool master_ssl;
-char *master_ssl_key, *master_ssl_cert;
-char *master_ssl_ca, *master_ssl_capath, *master_ssl_cipher;
char *opt_logname, *opt_slow_logname;
/* Static variables */
@@ -1298,6 +1300,7 @@ void clean_up(bool print_message)
ha_end();
if (tc_log)
tc_log->close();
+ delegates_destroy();
xid_cache_free();
delete_elements(&key_caches, (void (*)(const char*, uchar*)) free_key_cache);
multi_keycache_free();
@@ -3048,7 +3051,6 @@ SHOW_VAR com_status_vars[]= {
{"alter_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS},
{"alter_tablespace", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLESPACE]), SHOW_LONG_STATUS},
{"analyze", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ANALYZE]), SHOW_LONG_STATUS},
- {"backup_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BACKUP_TABLE]), SHOW_LONG_STATUS},
{"begin", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BEGIN]), SHOW_LONG_STATUS},
{"binlog", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BINLOG_BASE64_EVENT]), SHOW_LONG_STATUS},
{"call_procedure", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CALL]), SHOW_LONG_STATUS},
@@ -3095,8 +3097,6 @@ SHOW_VAR com_status_vars[]= {
{"install_plugin", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_INSTALL_PLUGIN]), SHOW_LONG_STATUS},
{"kill", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_KILL]), SHOW_LONG_STATUS},
{"load", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOAD]), SHOW_LONG_STATUS},
- {"load_master_data", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOAD_MASTER_DATA]), SHOW_LONG_STATUS},
- {"load_master_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOAD_MASTER_TABLE]), SHOW_LONG_STATUS},
{"lock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOCK_TABLES]), SHOW_LONG_STATUS},
{"optimize", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_OPTIMIZE]), SHOW_LONG_STATUS},
{"preload_keys", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PRELOAD_KEYS]), SHOW_LONG_STATUS},
@@ -3110,7 +3110,6 @@ SHOW_VAR com_status_vars[]= {
{"replace", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE]), SHOW_LONG_STATUS},
{"replace_select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE_SELECT]), SHOW_LONG_STATUS},
{"reset", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RESET]), SHOW_LONG_STATUS},
- {"restore_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RESTORE_TABLE]), SHOW_LONG_STATUS},
{"revoke", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REVOKE]), SHOW_LONG_STATUS},
{"revoke_all", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REVOKE_ALL]), SHOW_LONG_STATUS},
{"rollback", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK]), SHOW_LONG_STATUS},
@@ -3156,6 +3155,7 @@ SHOW_VAR com_status_vars[]= {
{"show_processlist", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROCESSLIST]), SHOW_LONG_STATUS},
{"show_profile", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROFILE]), SHOW_LONG_STATUS},
{"show_profiles", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROFILES]), SHOW_LONG_STATUS},
+ {"show_relaylog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_RELAYLOG_EVENTS]), SHOW_LONG_STATUS},
{"show_slave_hosts", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_HOSTS]), SHOW_LONG_STATUS},
{"show_slave_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS},
{"show_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
@@ -3788,6 +3788,13 @@ static int init_server_components()
unireg_abort(1);
}
+ /* initialize delegates for extension observers */
+ if (delegates_init())
+ {
+ sql_print_error("Initialize extension delegates failed");
+ unireg_abort(1);
+ }
+
/* need to configure logging before initializing storage engines */
if (opt_update_log)
{
@@ -3846,17 +3853,17 @@ with --log-bin instead.");
}
if (opt_log_slave_updates && !opt_bin_log)
{
- sql_print_error("You need to use --log-bin to make "
+ sql_print_warning("You need to use --log-bin to make "
"--log-slave-updates work.");
- unireg_abort(1);
}
if (!opt_bin_log)
{
if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC)
{
- sql_print_error("You need to use --log-bin to make "
- "--binlog-format work.");
- unireg_abort(1);
+ sql_print_warning("You need to use --log-bin to make "
+ "--binlog-format work.");
+
+ global_system_variables.binlog_format= opt_binlog_format_id;
}
else
{
@@ -3878,11 +3885,17 @@ with --log-bin instead.");
#ifdef HAVE_REPLICATION
if (opt_log_slave_updates && replicate_same_server_id)
{
- sql_print_error("\
-using --replicate-same-server-id in conjunction with \
+ if (opt_bin_log)
+ {
+ sql_print_error("using --replicate-same-server-id in conjunction with \
--log-slave-updates is impossible, it would lead to infinite loops in this \
server.");
- unireg_abort(1);
+ unireg_abort(1);
+ }
+ else
+ sql_print_warning("using --replicate-same-server-id in conjunction with \
+--log-slave-updates would lead to infinite loops in this server. However this \
+will be ignored as the --log-bin option is not defined.");
}
#endif
@@ -4399,21 +4412,12 @@ int main(int argc, char **argv)
if (opt_bin_log && !server_id)
{
- server_id= !master_host ? 1 : 2;
+ server_id= 1;
#ifdef EXTRA_DEBUG
- switch (server_id) {
- case 1:
- sql_print_warning("\
-You have enabled the binary log, but you haven't set server-id to \
-a non-zero value: we force server id to 1; updates will be logged to the \
-binary log, but connections from slaves will not be accepted.");
- break;
- case 2:
- sql_print_warning("\
-You should set server-id to a non-0 value if master_host is set; \
-we force server id to 2, but this MySQL server will not act as a slave.");
- break;
- }
+ sql_print_warning("You have enabled the binary log, but you haven't set "
+ "server-id to a non-zero value: we force server id to 1; "
+ "updates will be logged to the binary log, but "
+ "connections from slaves will not be accepted.");
#endif
}
@@ -5579,13 +5583,8 @@ enum options_mysqld
OPT_STORAGE_ENGINE, OPT_INIT_FILE,
OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG,
OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR,
- OPT_MASTER_HOST, OPT_MASTER_USER,
- OPT_MASTER_PASSWORD, OPT_MASTER_PORT,
- OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY,
+ OPT_MASTER_INFO_FILE,
OPT_MASTER_RETRY_COUNT, OPT_LOG_TC, OPT_LOG_TC_SIZE,
- OPT_MASTER_SSL, OPT_MASTER_SSL_KEY,
- OPT_MASTER_SSL_CERT, OPT_MASTER_SSL_CAPATH,
- OPT_MASTER_SSL_CIPHER, OPT_MASTER_SSL_CA,
OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB,
OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES,
OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB,
@@ -5661,6 +5660,7 @@ enum options_mysqld
OPT_QUERY_CACHE_TYPE, OPT_QUERY_CACHE_WLOCK_INVALIDATE, OPT_RECORD_BUFFER,
OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT, OPT_RELAY_LOG_SPACE_LIMIT,
OPT_RELAY_LOG_PURGE,
+ OPT_RELAY_LOG_RECOVERY,
OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME,
OPT_SLAVE_TRANS_RETRIES, OPT_READONLY, OPT_DEBUGGING,
OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE,
@@ -5725,9 +5725,13 @@ enum options_mysqld
#endif /* defined(ENABLED_DEBUG_SYNC) */
OPT_OLD_MODE,
OPT_SLAVE_EXEC_MODE,
+ OPT_SLAVE_TYPE_CONVERSIONS,
OPT_GENERAL_LOG_FILE,
OPT_SLOW_QUERY_LOG_FILE,
- OPT_IGNORE_BUILTIN_INNODB
+ OPT_IGNORE_BUILTIN_INNODB,
+ OPT_SYNC_RELAY_LOG,
+ OPT_SYNC_RELAY_LOG_INFO,
+ OPT_SYNC_MASTER_INFO
};
@@ -6078,60 +6082,15 @@ log and this option justs turns on --log-bin instead.",
(uchar**) &global_system_variables.low_priority_updates,
(uchar**) &max_system_variables.low_priority_updates,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"master-connect-retry", OPT_MASTER_CONNECT_RETRY,
- "The number of seconds the slave thread will sleep before retrying to connect to the master in case the master goes down or the connection is lost.",
- (uchar**) &master_connect_retry, (uchar**) &master_connect_retry, 0, GET_UINT,
- REQUIRED_ARG, 60, 0, 0, 0, 0, 0},
- {"master-host", OPT_MASTER_HOST,
- "Master hostname or IP address for replication. If not set, the slave thread will not be started. Note that the setting of master-host will be ignored if there exists a valid master.info file.",
- (uchar**) &master_host, (uchar**) &master_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
- 0, 0, 0, 0},
{"master-info-file", OPT_MASTER_INFO_FILE,
"The location and name of the file that remembers the master and where the I/O replication \
thread is in the master's binlogs.",
(uchar**) &master_info_file, (uchar**) &master_info_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"master-password", OPT_MASTER_PASSWORD,
- "The password the slave thread will authenticate with when connecting to the master. If not set, an empty password is assumed.The value in master.info will take precedence if it can be read.",
- (uchar**)&master_password, (uchar**)&master_password, 0,
- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"master-port", OPT_MASTER_PORT,
- "The port the master is listening on. If not set, the compiled setting of MYSQL_PORT is assumed. If you have not tinkered with configure options, this should be 3306. The value in master.info will take precedence if it can be read.",
- (uchar**) &master_port, (uchar**) &master_port, 0, GET_UINT, REQUIRED_ARG,
- MYSQL_PORT, 0, 0, 0, 0, 0},
{"master-retry-count", OPT_MASTER_RETRY_COUNT,
"The number of tries the slave will make to connect to the master before giving up.",
(uchar**) &master_retry_count, (uchar**) &master_retry_count, 0, GET_ULONG,
REQUIRED_ARG, 3600*24, 0, 0, 0, 0, 0},
- {"master-ssl", OPT_MASTER_SSL,
- "Enable the slave to connect to the master using SSL.",
- (uchar**) &master_ssl, (uchar**) &master_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
- 0, 0},
- {"master-ssl-ca", OPT_MASTER_SSL_CA,
- "Master SSL CA file. Only applies if you have enabled master-ssl.",
- (uchar**) &master_ssl_ca, (uchar**) &master_ssl_ca, 0, GET_STR, OPT_ARG,
- 0, 0, 0, 0, 0, 0},
- {"master-ssl-capath", OPT_MASTER_SSL_CAPATH,
- "Master SSL CA path. Only applies if you have enabled master-ssl.",
- (uchar**) &master_ssl_capath, (uchar**) &master_ssl_capath, 0, GET_STR, OPT_ARG,
- 0, 0, 0, 0, 0, 0},
- {"master-ssl-cert", OPT_MASTER_SSL_CERT,
- "Master SSL certificate file name. Only applies if you have enabled \
-master-ssl",
- (uchar**) &master_ssl_cert, (uchar**) &master_ssl_cert, 0, GET_STR, OPT_ARG,
- 0, 0, 0, 0, 0, 0},
- {"master-ssl-cipher", OPT_MASTER_SSL_CIPHER,
- "Master SSL cipher. Only applies if you have enabled master-ssl.",
- (uchar**) &master_ssl_cipher, (uchar**) &master_ssl_capath, 0, GET_STR, OPT_ARG,
- 0, 0, 0, 0, 0, 0},
- {"master-ssl-key", OPT_MASTER_SSL_KEY,
- "Master SSL keyfile name. Only applies if you have enabled master-ssl.",
- (uchar**) &master_ssl_key, (uchar**) &master_ssl_key, 0, GET_STR, OPT_ARG,
- 0, 0, 0, 0, 0, 0},
- {"master-user", OPT_MASTER_USER,
- "The username the slave thread will use for authentication when connecting to the master. The user must have FILE privilege. If the master user is not set, user test is assumed. The value in master.info will take precedence if it can be read.",
- (uchar**) &master_user, (uchar**) &master_user, 0, GET_STR, REQUIRED_ARG, 0, 0,
- 0, 0, 0, 0},
#ifdef HAVE_REPLICATION
{"max-binlog-dump-events", OPT_MAX_BINLOG_DUMP_EVENTS,
"Option used by mysql-test for debugging and testing of replication.",
@@ -6448,6 +6407,15 @@ replicating a LOAD DATA INFILE command.",
{"slave-exec-mode", OPT_SLAVE_EXEC_MODE,
"Modes for how replication events should be executed. Legal values are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, replication will not stop for operations that are idempotent. In STRICT mode, replication will stop on any unexpected difference between the master and the slave.",
(uchar**) &slave_exec_mode_str, (uchar**) &slave_exec_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"slave-type-conversions", OPT_SLAVE_TYPE_CONVERSIONS,
+ "Set of slave type conversions that are enabled. Legal values are:"
+ " ALL_LOSSY to enable lossy conversions and"
+ " ALL_NON_LOSSY to enable non-lossy conversions."
+ " If the variable is assigned the empty set, no conversions are"
+ " allowed and it is expected that the types match exactly.",
+ (uchar**) &slave_type_conversions_default,
+ (uchar**) &slave_type_conversions_default,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"slow-query-log", OPT_SLOW_LOG,
"Enable|disable slow query log", (uchar**) &opt_slow_log,
@@ -6955,6 +6923,13 @@ The minimum value for this variable is 4096.",
(uchar**) &relay_log_purge,
(uchar**) &relay_log_purge, 0, GET_BOOL, NO_ARG,
1, 0, 1, 0, 1, 0},
+ {"relay_log_recovery", OPT_RELAY_LOG_RECOVERY,
+ "Enables automatic relay log recovery right after the database startup, "
+ "which means that the IO Thread starts re-fetching from the master "
+ "right after the last transaction processed.",
+ (uchar**) &relay_log_recovery,
+ (uchar**) &relay_log_recovery, 0, GET_BOOL, NO_ARG,
+ 0, 0, 1, 0, 1, 0},
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
"Maximum space to use for all relay logs.",
(uchar**) &relay_log_space_limit,
@@ -6989,8 +6964,23 @@ The minimum value for this variable is 4096.",
{"sync-binlog", OPT_SYNC_BINLOG,
"Synchronously flush binary log to disk after every #th event. "
"Use 0 (default) to disable synchronous flushing.",
- (uchar**) &sync_binlog_period, (uchar**) &sync_binlog_period, 0, GET_ULONG,
- REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0},
+ (uchar**) &sync_binlog_period, (uchar**) &sync_binlog_period, 0, GET_UINT,
+ REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0},
+ {"sync-relay-log", OPT_SYNC_RELAY_LOG,
+ "Synchronously flush relay log to disk after every #th event. "
+ "Use 0 (default) to disable synchronous flushing.",
+ (uchar**) &sync_relaylog_period, (uchar**) &sync_relaylog_period, 0, GET_UINT,
+ REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0},
+ {"sync-relay-log-info", OPT_SYNC_RELAY_LOG_INFO,
+ "Synchronously flush relay log info to disk after #th transaction. "
+ "Use 0 (default) to disable synchronous flushing.",
+ (uchar**) &sync_relayloginfo_period, (uchar**) &sync_relayloginfo_period, 0, GET_UINT,
+ REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0},
+ {"sync-master-info", OPT_SYNC_MASTER_INFO,
+ "Synchronously flush master info to disk after every #th event. "
+ "Use 0 (default) to disable synchronous flushing.",
+ (uchar**) &sync_masterinfo_period, (uchar**) &sync_masterinfo_period, 0, GET_UINT,
+ REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0},
{"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.",
(uchar**) &opt_sync_frm, (uchar**) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0,
0, 0, 0, 0},
@@ -7116,7 +7106,8 @@ static int show_slave_running(THD *thd, SHOW_VAR *var, char *buff)
var->type= SHOW_MY_BOOL;
pthread_mutex_lock(&LOCK_active_mi);
var->value= buff;
- *((my_bool *)buff)= (my_bool) (active_mi && active_mi->slave_running &&
+ *((my_bool *)buff)= (my_bool) (active_mi &&
+ active_mi->slave_running == MYSQL_SLAVE_RUN_CONNECT &&
active_mi->rli.slave_running);
pthread_mutex_unlock(&LOCK_active_mi);
return 0;
@@ -7142,6 +7133,40 @@ static int show_slave_retried_trans(THD *thd, SHOW_VAR *var, char *buff)
pthread_mutex_unlock(&LOCK_active_mi);
return 0;
}
+
+static int show_slave_received_heartbeats(THD *thd, SHOW_VAR *var, char *buff)
+{
+ pthread_mutex_lock(&LOCK_active_mi);
+ if (active_mi)
+ {
+ var->type= SHOW_LONGLONG;
+ var->value= buff;
+ pthread_mutex_lock(&active_mi->rli.data_lock);
+ *((longlong *)buff)= active_mi->received_heartbeats;
+ pthread_mutex_unlock(&active_mi->rli.data_lock);
+ }
+ else
+ var->type= SHOW_UNDEF;
+ pthread_mutex_unlock(&LOCK_active_mi);
+ return 0;
+}
+
+static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff)
+{
+ pthread_mutex_lock(&LOCK_active_mi);
+ if (active_mi)
+ {
+ var->type= SHOW_CHAR;
+ var->value= buff;
+ my_sprintf(buff, (buff, "%.3f",active_mi->heartbeat_period));
+ }
+ else
+ var->type= SHOW_UNDEF;
+ pthread_mutex_unlock(&LOCK_active_mi);
+ return 0;
+}
+
+
#endif /* HAVE_REPLICATION */
static int show_open_tables(THD *thd, SHOW_VAR *var, char *buff)
@@ -7506,6 +7531,8 @@ SHOW_VAR status_vars[]= {
{"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_LONG},
#ifdef HAVE_REPLICATION
{"Slave_retried_transactions",(char*) &show_slave_retried_trans, SHOW_FUNC},
+ {"Slave_heartbeat_period", (char*) &show_heartbeat_period, SHOW_FUNC},
+ {"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats, SHOW_FUNC},
{"Slave_running", (char*) &show_slave_running, SHOW_FUNC},
#endif
{"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG},
@@ -7706,6 +7733,11 @@ static int mysql_init_variables(void)
slave_exec_mode_options= (uint)
find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL,
&error);
+ /* Slave type conversions */
+ slave_type_conversions_options= 0;
+ slave_type_conversions_options=
+ find_bit_type_or_exit(slave_type_conversions_default, &slave_type_conversions_typelib,
+ NULL, &error);
if (error)
return 1;
opt_specialflag= SPECIAL_ENGLISH;
@@ -7746,12 +7778,8 @@ static int mysql_init_variables(void)
mysql_data_home_len= 2;
/* Replication parameters */
- master_user= (char*) "test";
- master_password= master_host= 0;
master_info_file= (char*) "master.info",
relay_log_info_file= (char*) "relay-log.info";
- master_ssl_key= master_ssl_cert= master_ssl_ca=
- master_ssl_capath= master_ssl_cipher= 0;
report_user= report_password = report_host= 0; /* TO BE DELETED */
opt_relay_logname= opt_relaylog_index_name= 0;
@@ -7907,7 +7935,7 @@ mysqld_get_one_option(int optid,
default_collation_name= 0;
break;
case 'l':
- WARN_DEPRECATED(NULL, "7.0", "--log", "'--general_log'/'--general_log_file'");
+ WARN_DEPRECATED(NULL, 7, 0, "--log", "'--general-log'/'--general-log-file'");
opt_log=1;
break;
case 'h':
@@ -7935,6 +7963,12 @@ mysqld_get_one_option(int optid,
if (error)
return 1;
break;
+ case OPT_SLAVE_TYPE_CONVERSIONS:
+ slave_type_conversions_options= (uint)
+ find_bit_type_or_exit(argument, &slave_type_conversions_typelib, "", &error);
+ if (error)
+ return 1;
+ break;
#endif
case OPT_SAFEMALLOC_MEM_LIMIT:
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
@@ -8081,7 +8115,7 @@ mysqld_get_one_option(int optid,
}
#endif /* HAVE_REPLICATION */
case (int) OPT_SLOW_QUERY_LOG:
- WARN_DEPRECATED(NULL, "7.0", "--log_slow_queries", "'--slow_query_log'/'--slow_query_log_file'");
+ WARN_DEPRECATED(NULL, 7, 0, "--log-slow-queries", "'--slow-query-log'/'--slow-query-log-file'");
opt_slow_log= 1;
break;
#ifdef WITH_CSV_STORAGE_ENGINE
@@ -8196,29 +8230,6 @@ mysqld_get_one_option(int optid,
case (int) OPT_STANDALONE: /* Dummy option for NT */
break;
#endif
- /*
- The following change issues a deprecation warning if the slave
- configuration is specified either in the my.cnf file or on
- the command-line. See BUG#21490.
- */
- case OPT_MASTER_HOST:
- case OPT_MASTER_USER:
- case OPT_MASTER_PASSWORD:
- case OPT_MASTER_PORT:
- case OPT_MASTER_CONNECT_RETRY:
- case OPT_MASTER_SSL:
- case OPT_MASTER_SSL_KEY:
- case OPT_MASTER_SSL_CERT:
- case OPT_MASTER_SSL_CAPATH:
- case OPT_MASTER_SSL_CIPHER:
- case OPT_MASTER_SSL_CA:
- if (!slave_warning_issued) //only show the warning once
- {
- slave_warning_issued = true;
- WARN_DEPRECATED(NULL, "6.0", "for replication startup options",
- "'CHANGE MASTER'");
- }
- break;
case OPT_CONSOLE:
if (opt_console)
opt_error_log= 0; // Force logs to stdout
diff --git a/sql/mysqld_suffix.h b/sql/mysqld_suffix.h
index 654d7cf88c1..c7ab212f2a2 100644
--- a/sql/mysqld_suffix.h
+++ b/sql/mysqld_suffix.h
@@ -1,3 +1,6 @@
+#ifndef MYSQLD_SUFFIX_INCLUDED
+#define MYSQLD_SUFFIX_INCLUDED
+
/* Copyright (C) 2000-2004 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -27,3 +30,4 @@
#else
#define MYSQL_SERVER_SUFFIX_STR MYSQL_SERVER_SUFFIX_DEF
#endif
+#endif /* MYSQLD_SUFFIX_INCLUDED */
diff --git a/sql/nt_servc.h b/sql/nt_servc.h
index 2f0d07df543..5bee42dedf0 100644
--- a/sql/nt_servc.h
+++ b/sql/nt_servc.h
@@ -1,3 +1,6 @@
+#ifndef NT_SERVC_INCLUDED
+#define NT_SERVC_INCLUDED
+
/**
@file
@@ -98,3 +101,5 @@ class NTService
};
/* ------------------------- the end -------------------------------------- */
+
+#endif /* NT_SERVC_INCLUDED */
diff --git a/sql/partition_element.h b/sql/partition_element.h
index 905bc38165b..d67259b9605 100644
--- a/sql/partition_element.h
+++ b/sql/partition_element.h
@@ -1,3 +1,6 @@
+#ifndef PARTITION_ELEMENT_INCLUDED
+#define PARTITION_ELEMENT_INCLUDED
+
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -97,3 +100,5 @@ public:
}
~partition_element() {}
};
+
+#endif /* PARTITION_ELEMENT_INCLUDED */
diff --git a/sql/partition_info.h b/sql/partition_info.h
index 9f438e8260b..b5a6c4a0961 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -1,3 +1,6 @@
+#ifndef PARTITION_INFO_INCLUDED
+#define PARTITION_INFO_INCLUDED
+
/* Copyright 2006-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
@@ -314,3 +317,5 @@ void init_all_partitions_iterator(partition_info *part_info,
part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE;
part_iter->get_next= get_next_partition_id_range;
}
+
+#endif /* PARTITION_INFO_INCLUDED */
diff --git a/sql/procedure.h b/sql/procedure.h
index ceb586766b1..c6f50493876 100644
--- a/sql/procedure.h
+++ b/sql/procedure.h
@@ -1,3 +1,6 @@
+#ifndef PROCEDURE_INCLUDED
+#define PROCEDURE_INCLUDED
+
/* Copyright (C) 2000-2005 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -149,3 +152,5 @@ public:
Procedure *setup_procedure(THD *thd,ORDER *proc_param,select_result *result,
List<Item> &field_list,int *error);
+
+#endif /* PROCEDURE_INCLUDED */
diff --git a/sql/protocol.h b/sql/protocol.h
index 251ba6fbc33..a39636a1595 100644
--- a/sql/protocol.h
+++ b/sql/protocol.h
@@ -1,3 +1,6 @@
+#ifndef PROTOCOL_INCLUDED
+#define PROTOCOL_INCLUDED
+
/* Copyright (C) 2002-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -180,3 +183,4 @@ uchar *net_store_data(uchar *to,const uchar *from, size_t length);
uchar *net_store_data(uchar *to,int32 from);
uchar *net_store_data(uchar *to,longlong from);
+#endif /* PROTOCOL_INCLUDED */
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index c6a05e93bf4..8a8403d1725 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -183,12 +183,11 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
get_object(p,si->host, "Failed to register slave: too long 'report-host'");
get_object(p,si->user, "Failed to register slave: too long 'report-user'");
get_object(p,si->password, "Failed to register slave; too long 'report-password'");
- if (p+10 > p_end)
+ /*6 is the total length of port and master_id*/
+ if (p+6 != p_end)
goto err;
si->port= uint2korr(p);
p += 2;
- si->rpl_recovery_rank= uint4korr(p);
- p += 4;
if (!(si->master_id= uint4korr(p)))
si->master_id= server_id;
si->thd= thd;
@@ -676,8 +675,6 @@ bool show_slave_hosts(THD* thd)
field_list.push_back(new Item_empty_string("Password",20));
}
field_list.push_back(new Item_return_int("Port", 7, MYSQL_TYPE_LONG));
- field_list.push_back(new Item_return_int("Rpl_recovery_rank", 7,
- MYSQL_TYPE_LONG));
field_list.push_back(new Item_return_int("Master_id", 10,
MYSQL_TYPE_LONG));
@@ -699,7 +696,6 @@ bool show_slave_hosts(THD* thd)
protocol->store(si->password, &my_charset_bin);
}
protocol->store((uint32) si->port);
- protocol->store((uint32) si->rpl_recovery_rank);
protocol->store((uint32) si->master_id);
if (protocol->write())
{
@@ -712,329 +708,5 @@ bool show_slave_hosts(THD* thd)
DBUG_RETURN(FALSE);
}
-
-int connect_to_master(THD *thd, MYSQL* mysql, Master_info* mi)
-{
- DBUG_ENTER("connect_to_master");
-
- if (!mi->host || !*mi->host) /* empty host */
- {
- strmov(mysql->net.last_error, "Master is not configured");
- DBUG_RETURN(1);
- }
- mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout);
- mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout);
-
-#ifdef HAVE_OPENSSL
- if (mi->ssl)
- {
- mysql_ssl_set(mysql,
- mi->ssl_key[0]?mi->ssl_key:0,
- mi->ssl_cert[0]?mi->ssl_cert:0,
- mi->ssl_ca[0]?mi->ssl_ca:0,
- mi->ssl_capath[0]?mi->ssl_capath:0,
- mi->ssl_cipher[0]?mi->ssl_cipher:0);
- mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
- &mi->ssl_verify_server_cert);
- }
-#endif
-
- mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname);
- mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir);
- if (!mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0,
- mi->port, 0, 0))
- DBUG_RETURN(1);
- mysql->reconnect= 1;
- DBUG_RETURN(0);
-}
-
-
-static inline void cleanup_mysql_results(MYSQL_RES* db_res,
- MYSQL_RES** cur, MYSQL_RES** start)
-{
- for (; cur >= start; --cur)
- {
- if (*cur)
- mysql_free_result(*cur);
- }
- mysql_free_result(db_res);
-}
-
-
-static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db,
- MYSQL_RES *table_res, Master_info *mi)
-{
- MYSQL_ROW row;
- for (row = mysql_fetch_row(table_res); row;
- row = mysql_fetch_row(table_res))
- {
- TABLE_LIST table;
- const char* table_name= row[0];
- int error;
- if (rpl_filter->is_on())
- {
- bzero((char*) &table, sizeof(table)); //just for safe
- table.db= (char*) db;
- table.table_name= (char*) table_name;
- table.updating= 1;
-
- if (!rpl_filter->tables_ok(thd->db, &table))
- continue;
- }
- /* download master's table and overwrite slave's table */
- if ((error= fetch_master_table(thd, db, table_name, mi, mysql, 1)))
- return error;
- }
- return 0;
-}
-
-/**
- Load all MyISAM tables from master to this slave.
-
- REQUIREMENTS
- - No active transaction (flush_relay_log_info would not work in this case).
-
- @todo
- - add special option, not enabled
- by default, to allow inclusion of mysql database into load
- data from master
-*/
-
-bool load_master_data(THD* thd)
-{
- MYSQL mysql;
- MYSQL_RES* master_status_res = 0;
- int error = 0;
- const char* errmsg=0;
- int restart_thread_mask;
- HA_CREATE_INFO create_info;
-
- mysql_init(&mysql);
-
- /*
- We do not want anyone messing with the slave at all for the entire
- duration of the data load.
- */
- pthread_mutex_lock(&LOCK_active_mi);
- lock_slave_threads(active_mi);
- init_thread_mask(&restart_thread_mask,active_mi,0 /*not inverse*/);
- if (restart_thread_mask &&
- (error=terminate_slave_threads(active_mi,restart_thread_mask,
- 1 /*skip lock*/)))
- {
- my_message(error, ER(error), MYF(0));
- unlock_slave_threads(active_mi);
- pthread_mutex_unlock(&LOCK_active_mi);
- return TRUE;
- }
-
- if (connect_to_master(thd, &mysql, active_mi))
- {
- my_error(error= ER_CONNECT_TO_MASTER, MYF(0), mysql_error(&mysql));
- goto err;
- }
-
- // now that we are connected, get all database and tables in each
- {
- MYSQL_RES *db_res, **table_res, **table_res_end, **cur_table_res;
- uint num_dbs;
-
- if (mysql_real_query(&mysql, STRING_WITH_LEN("SHOW DATABASES")) ||
- !(db_res = mysql_store_result(&mysql)))
- {
- my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
- goto err;
- }
-
- if (!(num_dbs = (uint) mysql_num_rows(db_res)))
- goto err;
- /*
- In theory, the master could have no databases at all
- and run with skip-grant
- */
-
- if (!(table_res = (MYSQL_RES**)thd->alloc(num_dbs * sizeof(MYSQL_RES*))))
- {
- my_message(error = ER_OUTOFMEMORY, ER(ER_OUTOFMEMORY), MYF(0));
- goto err;
- }
-
- /*
- This is a temporary solution until we have online backup
- capabilities - to be replaced once online backup is working
- we wait to issue FLUSH TABLES WITH READ LOCK for as long as we
- can to minimize the lock time.
- */
- if (mysql_real_query(&mysql,
- STRING_WITH_LEN("FLUSH TABLES WITH READ LOCK")) ||
- mysql_real_query(&mysql, STRING_WITH_LEN("SHOW MASTER STATUS")) ||
- !(master_status_res = mysql_store_result(&mysql)))
- {
- my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
- goto err;
- }
-
- /*
- Go through every table in every database, and if the replication
- rules allow replicating it, get it
- */
-
- table_res_end = table_res + num_dbs;
-
- for (cur_table_res = table_res; cur_table_res < table_res_end;
- cur_table_res++)
- {
- // since we know how many rows we have, this can never be NULL
- MYSQL_ROW row = mysql_fetch_row(db_res);
- char* db = row[0];
-
- /*
- Do not replicate databases excluded by rules. We also test
- replicate_wild_*_table rules (replicate_wild_ignore_table='db1.%' will
- be considered as "ignore the 'db1' database as a whole, as it already
- works for CREATE DATABASE and DROP DATABASE).
- Also skip 'mysql' database - in most cases the user will
- mess up and not exclude mysql database with the rules when
- he actually means to - in this case, he is up for a surprise if
- his priv tables get dropped and downloaded from master
- TODO - add special option, not enabled
- by default, to allow inclusion of mysql database into load
- data from master
- */
-
- if (!rpl_filter->db_ok(db) ||
- !rpl_filter->db_ok_with_wild_table(db) ||
- !strcmp(db,"mysql") ||
- is_schema_db(db))
- {
- *cur_table_res = 0;
- continue;
- }
-
- bzero((char*) &create_info, sizeof(create_info));
- create_info.options= HA_LEX_CREATE_IF_NOT_EXISTS;
-
- if (mysql_create_db(thd, db, &create_info, 1))
- {
- cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
- goto err;
- }
- /* Clear the result of mysql_create_db(). */
- thd->main_da.reset_diagnostics_area();
-
- if (mysql_select_db(&mysql, db) ||
- mysql_real_query(&mysql, STRING_WITH_LEN("SHOW TABLES")) ||
- !(*cur_table_res = mysql_store_result(&mysql)))
- {
- my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
- cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
- goto err;
- }
-
- if ((error = fetch_db_tables(thd,&mysql,db,*cur_table_res,active_mi)))
- {
- // we do not report the error - fetch_db_tables handles it
- cleanup_mysql_results(db_res, cur_table_res, table_res);
- goto err;
- }
- }
-
- cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
-
- // adjust replication coordinates from the master
- if (master_status_res)
- {
- MYSQL_ROW row = mysql_fetch_row(master_status_res);
-
- /*
- We need this check because the master may not be running with
- log-bin, but it will still allow us to do all the steps
- of LOAD DATA FROM MASTER - no reason to forbid it, really,
- although it does not make much sense for the user to do it
- */
- if (row && row[0] && row[1])
- {
- /*
- If the slave's master info is not inited, we init it, then we write
- the new coordinates to it. Must call init_master_info() *before*
- setting active_mi, because init_master_info() sets active_mi with
- defaults.
- */
- int error_2;
-
- if (init_master_info(active_mi, master_info_file, relay_log_info_file,
- 0, (SLAVE_IO | SLAVE_SQL)))
- my_message(ER_MASTER_INFO, ER(ER_MASTER_INFO), MYF(0));
- strmake(active_mi->master_log_name, row[0],
- sizeof(active_mi->master_log_name) -1);
- active_mi->master_log_pos= my_strtoll10(row[1], (char**) 0, &error_2);
- /* at least in recent versions, the condition below should be false */
- if (active_mi->master_log_pos < BIN_LOG_HEADER_SIZE)
- active_mi->master_log_pos = BIN_LOG_HEADER_SIZE;
- /*
- Relay log's IO_CACHE may not be inited (even if we are sure that some
- host was specified; there could have been a problem when replication
- started, which led to relay log's IO_CACHE to not be inited.
- */
- if (flush_master_info(active_mi, 0))
- sql_print_error("Failed to flush master info file");
- }
- mysql_free_result(master_status_res);
- }
-
- if (mysql_real_query(&mysql, STRING_WITH_LEN("UNLOCK TABLES")))
- {
- my_error(error= ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
- goto err;
- }
- }
- thd_proc_info(thd, "purging old relay logs");
- if (purge_relay_logs(&active_mi->rli,thd,
- 0 /* not only reset, but also reinit */,
- &errmsg))
- {
- my_error(ER_RELAY_LOG_FAIL, MYF(0), errmsg);
- unlock_slave_threads(active_mi);
- pthread_mutex_unlock(&LOCK_active_mi);
- return TRUE;
- }
- pthread_mutex_lock(&active_mi->rli.data_lock);
- active_mi->rli.group_master_log_pos = active_mi->master_log_pos;
- strmake(active_mi->rli.group_master_log_name,active_mi->master_log_name,
- sizeof(active_mi->rli.group_master_log_name)-1);
- /*
- Cancel the previous START SLAVE UNTIL, as the fact to download
- a new copy logically makes UNTIL irrelevant.
- */
- active_mi->rli.clear_until_condition();
-
- /*
- No need to update rli.event* coordinates, they will be when the slave
- threads start ; only rli.group* coordinates are necessary here.
- */
- flush_relay_log_info(&active_mi->rli);
- pthread_cond_broadcast(&active_mi->rli.data_cond);
- pthread_mutex_unlock(&active_mi->rli.data_lock);
- thd_proc_info(thd, "starting slave");
- if (restart_thread_mask)
- {
- error=start_slave_threads(0 /* mutex not needed */,
- 1 /* wait for start */,
- active_mi,master_info_file,relay_log_info_file,
- restart_thread_mask);
- }
-
-err:
- unlock_slave_threads(active_mi);
- pthread_mutex_unlock(&LOCK_active_mi);
- thd_proc_info(thd, 0);
-
- mysql_close(&mysql); // safe to call since we always do mysql_init()
- if (!error)
- my_ok(thd);
-
- return error;
-}
-
#endif /* HAVE_REPLICATION */
diff --git a/sql/repl_failsafe.h b/sql/repl_failsafe.h
index 6ff78067aca..bce2c727050 100644
--- a/sql/repl_failsafe.h
+++ b/sql/repl_failsafe.h
@@ -1,3 +1,6 @@
+#ifndef REPL_FAILSAFE_INCLUDED
+#define REPL_FAILSAFE_INCLUDED
+
/* Copyright (C) 2001-2005 MySQL AB & Sasha
This program is free software; you can redistribute it and/or modify
@@ -49,3 +52,4 @@ int register_slave(THD* thd, uchar* packet, uint packet_length);
void unregister_slave(THD* thd, bool only_mine, bool need_mutex);
#endif /* HAVE_REPLICATION */
+#endif /* REPL_FAILSAFE_INCLUDED */
diff --git a/sql/replication.h b/sql/replication.h
new file mode 100644
index 00000000000..6b7be58a5b1
--- /dev/null
+++ b/sql/replication.h
@@ -0,0 +1,490 @@
+/* Copyright (C) 2008 MySQL AB
+
+ 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef REPLICATION_H
+#define REPLICATION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ Transaction observer flags.
+*/
+enum Trans_flags {
+ /** Transaction is a real transaction */
+ TRANS_IS_REAL_TRANS = 1
+};
+
+/**
+ Transaction observer parameter
+*/
+typedef struct Trans_param {
+ uint32 server_id;
+ uint32 flags;
+
+ /*
+ The latest binary log file name and position written by current
+ transaction, if binary log is disabled or no log event has been
+ written into binary log file by current transaction (events
+ written into transaction log cache are not counted), these two
+ member will be zero.
+ */
+ const char *log_file;
+ my_off_t log_pos;
+} Trans_param;
+
+/**
+ Observes and extends transaction execution
+*/
+typedef struct Trans_observer {
+ uint32 len;
+
+ /**
+ This callback is called after transaction commit
+
+ This callback is called right after commit to storage engines for
+ transactional tables.
+
+ For non-transactional tables, this is called at the end of the
+ statement, before sending statement status, if the statement
+ succeeded.
+
+ @note The return value is currently ignored by the server.
+
+ @param param The parameter for transaction observers
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*after_commit)(Trans_param *param);
+
+ /**
+ This callback is called after transaction rollback
+
+ This callback is called right after rollback to storage engines
+ for transactional tables.
+
+ For non-transactional tables, this is called at the end of the
+ statement, before sending statement status, if the statement
+ failed.
+
+ @note The return value is currently ignored by the server.
+
+ @param param The parameter for transaction observers
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*after_rollback)(Trans_param *param);
+} Trans_observer;
+
+/**
+ Binlog storage flags
+*/
+enum Binlog_storage_flags {
+ /** Binary log was sync:ed */
+ BINLOG_STORAGE_IS_SYNCED = 1
+};
+
+/**
+ Binlog storage observer parameters
+ */
+typedef struct Binlog_storage_param {
+ uint32 server_id;
+} Binlog_storage_param;
+
+/**
+ Observe binlog logging storage
+*/
+typedef struct Binlog_storage_observer {
+ uint32 len;
+
+ /**
+ This callback is called after binlog has been flushed
+
+ This callback is called after cached events have been flushed to
+ binary log file. Whether the binary log file is synchronized to
+ disk is indicated by the bit BINLOG_STORAGE_IS_SYNCED in @a flags.
+
+ @param param Observer common parameter
+ @param log_file Binlog file name been updated
+ @param log_pos Binlog position after update
+ @param flags flags for binlog storage
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*after_flush)(Binlog_storage_param *param,
+ const char *log_file, my_off_t log_pos,
+ uint32 flags);
+} Binlog_storage_observer;
+
+/**
+ Replication binlog transmitter (binlog dump) observer parameter.
+*/
+typedef struct Binlog_transmit_param {
+ uint32 server_id;
+ uint32 flags;
+} Binlog_transmit_param;
+
+/**
+ Observe and extends the binlog dumping thread.
+*/
+typedef struct Binlog_transmit_observer {
+ uint32 len;
+
+ /**
+ This callback is called when binlog dumping starts
+
+
+ @param param Observer common parameter
+ @param log_file Binlog file name to transmit from
+ @param log_pos Binlog position to transmit from
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*transmit_start)(Binlog_transmit_param *param,
+ const char *log_file, my_off_t log_pos);
+
+ /**
+ This callback is called when binlog dumping stops
+
+ @param param Observer common parameter
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*transmit_stop)(Binlog_transmit_param *param);
+
+ /**
+ This callback is called to reserve bytes in packet header for event transmission
+
+ This callback is called when resetting transmit packet header to
+ reserve bytes for this observer in packet header.
+
+ The @a header buffer is allocated by the server code, and @a size
+ is the size of the header buffer. Each observer can only reserve
+ a maximum size of @a size in the header.
+
+ @param param Observer common parameter
+ @param header Pointer of the header buffer
+ @param size Size of the header buffer
+ @param len Header length reserved by this observer
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*reserve_header)(Binlog_transmit_param *param,
+ unsigned char *header,
+ unsigned long size,
+ unsigned long *len);
+
+ /**
+ This callback is called before sending an event packet to slave
+
+ @param param Observer common parameter
+ @param packet Binlog event packet to send
+ @param len Length of the event packet
+ @param log_file Binlog file name of the event packet to send
+ @param log_pos Binlog position of the event packet to send
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*before_send_event)(Binlog_transmit_param *param,
+ unsigned char *packet, unsigned long len,
+ const char *log_file, my_off_t log_pos );
+
+ /**
+ This callback is called after sending an event packet to slave
+
+ @param param Observer common parameter
+ @param event_buf Binlog event packet buffer sent
+ @param len length of the event packet buffer
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*after_send_event)(Binlog_transmit_param *param,
+ const char *event_buf, unsigned long len);
+
+ /**
+ This callback is called after resetting master status
+
+ This is called when executing the command RESET MASTER, and is
+ used to reset status variables added by observers.
+
+ @param param Observer common parameter
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*after_reset_master)(Binlog_transmit_param *param);
+} Binlog_transmit_observer;
+
+/**
+ Binlog relay IO flags
+*/
+enum Binlog_relay_IO_flags {
+ /** Binary relay log was sync:ed */
+ BINLOG_RELAY_IS_SYNCED = 1
+};
+
+
+/**
+ Replication binlog relay IO observer parameter
+*/
+typedef struct Binlog_relay_IO_param {
+ uint32 server_id;
+
+ /* Master host, user and port */
+ char *host;
+ char *user;
+ unsigned int port;
+
+ char *master_log_name;
+ my_off_t master_log_pos;
+
+ MYSQL *mysql; /* the connection to master */
+} Binlog_relay_IO_param;
+
+/**
+ Observes and extends the service of slave IO thread.
+*/
+typedef struct Binlog_relay_IO_observer {
+ uint32 len;
+
+ /**
+ This callback is called when slave IO thread starts
+
+ @param param Observer common parameter
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*thread_start)(Binlog_relay_IO_param *param);
+
+ /**
+ This callback is called when slave IO thread stops
+
+ @param param Observer common parameter
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*thread_stop)(Binlog_relay_IO_param *param);
+
+ /**
+ This callback is called before slave requesting binlog transmission from master
+
+ This is called before slave issuing BINLOG_DUMP command to master
+ to request binlog.
+
+ @param param Observer common parameter
+ @param flags binlog dump flags
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*before_request_transmit)(Binlog_relay_IO_param *param, uint32 flags);
+
+ /**
+ This callback is called after read an event packet from master
+
+ @param param Observer common parameter
+ @param packet The event packet read from master
+ @param len Length of the event packet read from master
+ @param event_buf The event packet return after process
+ @param event_len The length of event packet return after process
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*after_read_event)(Binlog_relay_IO_param *param,
+ const char *packet, unsigned long len,
+ const char **event_buf, unsigned long *event_len);
+
+ /**
+ This callback is called after written an event packet to relay log
+
+ @param param Observer common parameter
+ @param event_buf Event packet written to relay log
+ @param event_len Length of the event packet written to relay log
+ @param flags flags for relay log
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*after_queue_event)(Binlog_relay_IO_param *param,
+ const char *event_buf, unsigned long event_len,
+ uint32 flags);
+
+ /**
+ This callback is called after reset slave relay log IO status
+
+ @param param Observer common parameter
+
+ @retval 0 Sucess
+ @retval 1 Failure
+ */
+ int (*after_reset_slave)(Binlog_relay_IO_param *param);
+} Binlog_relay_IO_observer;
+
+
+/**
+ Register a transaction observer
+
+ @param observer The transaction observer to register
+ @param p pointer to the internal plugin structure
+
+ @retval 0 Sucess
+ @retval 1 Observer already exists
+*/
+int register_trans_observer(Trans_observer *observer, void *p);
+
+/**
+ Unregister a transaction observer
+
+ @param observer The transaction observer to unregister
+ @param p pointer to the internal plugin structure
+
+ @retval 0 Sucess
+ @retval 1 Observer not exists
+*/
+int unregister_trans_observer(Trans_observer *observer, void *p);
+
+/**
+ Register a binlog storage observer
+
+ @param observer The binlog storage observer to register
+ @param p pointer to the internal plugin structure
+
+ @retval 0 Sucess
+ @retval 1 Observer already exists
+*/
+int register_binlog_storage_observer(Binlog_storage_observer *observer, void *p);
+
+/**
+ Unregister a binlog storage observer
+
+ @param observer The binlog storage observer to unregister
+ @param p pointer to the internal plugin structure
+
+ @retval 0 Sucess
+ @retval 1 Observer not exists
+*/
+int unregister_binlog_storage_observer(Binlog_storage_observer *observer, void *p);
+
+/**
+ Register a binlog transmit observer
+
+ @param observer The binlog transmit observer to register
+ @param p pointer to the internal plugin structure
+
+ @retval 0 Sucess
+ @retval 1 Observer already exists
+*/
+int register_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p);
+
+/**
+ Unregister a binlog transmit observer
+
+ @param observer The binlog transmit observer to unregister
+ @param p pointer to the internal plugin structure
+
+ @retval 0 Sucess
+ @retval 1 Observer not exists
+*/
+int unregister_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p);
+
+/**
+ Register a binlog relay IO (slave IO thread) observer
+
+ @param observer The binlog relay IO observer to register
+ @param p pointer to the internal plugin structure
+
+ @retval 0 Sucess
+ @retval 1 Observer already exists
+*/
+int register_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p);
+
+/**
+ Unregister a binlog relay IO (slave IO thread) observer
+
+ @param observer The binlog relay IO observer to unregister
+ @param p pointer to the internal plugin structure
+
+ @retval 0 Sucess
+ @retval 1 Observer not exists
+*/
+int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p);
+
+/**
+ Connect to master
+
+ This function can only used in the slave I/O thread context, and
+ will use the same master information to do the connection.
+
+ @code
+ MYSQL *mysql = mysql_init(NULL);
+ if (rpl_connect_master(mysql))
+ {
+ // do stuff with the connection
+ }
+ mysql_close(mysql); // close the connection
+ @endcode
+
+ @param mysql address of MYSQL structure to use, pass NULL will
+ create a new one
+
+ @return address of MYSQL structure on success, NULL on failure
+*/
+MYSQL *rpl_connect_master(MYSQL *mysql);
+
+/**
+ Set thread entering a condition
+
+ This function should be called before putting a thread to wait for
+ a condition. @a mutex should be held before calling this
+ function. After being waken up, @f thd_exit_cond should be called.
+
+ @param thd The thread entering the condition, NULL means current thread
+ @param cond The condition the thread is going to wait for
+ @param mutex The mutex associated with the condition, this must be
+ held before call this function
+ @param msg The new process message for the thread
+*/
+const char* thd_enter_cond(MYSQL_THD thd, pthread_cond_t *cond,
+ pthread_mutex_t *mutex, const char *msg);
+
+/**
+ Set thread leaving a condition
+
+ This function should be called after a thread being waken up for a
+ condition.
+
+ @param thd The thread entering the condition, NULL means current thread
+ @param old_msg The process message, ususally this should be the old process
+ message before calling @f thd_enter_cond
+*/
+void thd_exit_cond(MYSQL_THD thd, const char *old_msg);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* REPLICATION_H */
diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc
new file mode 100644
index 00000000000..da7aade5b99
--- /dev/null
+++ b/sql/rpl_handler.cc
@@ -0,0 +1,493 @@
+/* Copyright (C) 2008 MySQL AB
+
+ 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "mysql_priv.h"
+
+#include "rpl_mi.h"
+#include "sql_repl.h"
+#include "log_event.h"
+#include "rpl_filter.h"
+#include <my_dir.h>
+#include "rpl_handler.h"
+
+Trans_delegate *transaction_delegate;
+Binlog_storage_delegate *binlog_storage_delegate;
+#ifdef HAVE_REPLICATION
+Binlog_transmit_delegate *binlog_transmit_delegate;
+Binlog_relay_IO_delegate *binlog_relay_io_delegate;
+#endif /* HAVE_REPLICATION */
+
+/*
+ structure to save transaction log filename and position
+*/
+typedef struct Trans_binlog_info {
+ my_off_t log_pos;
+ char log_file[FN_REFLEN];
+} Trans_binlog_info;
+
+static pthread_key(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO);
+
+int get_user_var_int(const char *name,
+ long long int *value, int *null_value)
+{
+ my_bool null_val;
+ user_var_entry *entry=
+ (user_var_entry*) hash_search(&current_thd->user_vars,
+ (uchar*) name, strlen(name));
+ if (!entry)
+ return 1;
+ *value= entry->val_int(&null_val);
+ if (null_value)
+ *null_value= null_val;
+ return 0;
+}
+
+int get_user_var_real(const char *name,
+ double *value, int *null_value)
+{
+ my_bool null_val;
+ user_var_entry *entry=
+ (user_var_entry*) hash_search(&current_thd->user_vars,
+ (uchar*) name, strlen(name));
+ if (!entry)
+ return 1;
+ *value= entry->val_real(&null_val);
+ if (null_value)
+ *null_value= null_val;
+ return 0;
+}
+
+int get_user_var_str(const char *name, char *value,
+ size_t len, unsigned int precision, int *null_value)
+{
+ String str;
+ my_bool null_val;
+ user_var_entry *entry=
+ (user_var_entry*) hash_search(&current_thd->user_vars,
+ (uchar*) name, strlen(name));
+ if (!entry)
+ return 1;
+ entry->val_str(&null_val, &str, precision);
+ strncpy(value, str.c_ptr(), len);
+ if (null_value)
+ *null_value= null_val;
+ return 0;
+}
+
+int delegates_init()
+{
+ static unsigned long trans_mem[sizeof(Trans_delegate) / sizeof(unsigned long) + 1];
+ static unsigned long storage_mem[sizeof(Binlog_storage_delegate) / sizeof(unsigned long) + 1];
+#ifdef HAVE_REPLICATION
+ static unsigned long transmit_mem[sizeof(Binlog_transmit_delegate) / sizeof(unsigned long) + 1];
+ static unsigned long relay_io_mem[sizeof(Binlog_relay_IO_delegate)/ sizeof(unsigned long) + 1];
+#endif
+
+ if (!(transaction_delegate= new (trans_mem) Trans_delegate)
+ || (!transaction_delegate->is_inited())
+ || !(binlog_storage_delegate= new (storage_mem) Binlog_storage_delegate)
+ || (!binlog_storage_delegate->is_inited())
+#ifdef HAVE_REPLICATION
+ || !(binlog_transmit_delegate= new (transmit_mem) Binlog_transmit_delegate)
+ || (!binlog_transmit_delegate->is_inited())
+ || !(binlog_relay_io_delegate= new (relay_io_mem) Binlog_relay_IO_delegate)
+ || (!binlog_relay_io_delegate->is_inited())
+#endif /* HAVE_REPLICATION */
+ )
+ return 1;
+
+ if (pthread_key_create(&RPL_TRANS_BINLOG_INFO, NULL))
+ return 1;
+ return 0;
+}
+
+void delegates_destroy()
+{
+ if (transaction_delegate)
+ transaction_delegate->~Trans_delegate();
+ if (binlog_storage_delegate)
+ binlog_storage_delegate->~Binlog_storage_delegate();
+#ifdef HAVE_REPLICATION
+ if (binlog_transmit_delegate)
+ binlog_transmit_delegate->~Binlog_transmit_delegate();
+ if (binlog_relay_io_delegate)
+ binlog_relay_io_delegate->~Binlog_relay_IO_delegate();
+#endif /* HAVE_REPLICATION */
+}
+
+/*
+ This macro is used by almost all the Delegate methods to iterate
+ over all the observers running given callback function of the
+ delegate .
+
+ Add observer plugins to the thd->lex list, after each statement, all
+ plugins add to thd->lex will be automatically unlocked.
+ */
+#define FOREACH_OBSERVER(r, f, thd, args) \
+ param.server_id= thd->server_id; \
+ read_lock(); \
+ Observer_info_iterator iter= observer_info_iter(); \
+ Observer_info *info= iter++; \
+ for (; info; info= iter++) \
+ { \
+ plugin_ref plugin= \
+ my_plugin_lock(thd, &info->plugin); \
+ if (!plugin) \
+ { \
+ r= 1; \
+ break; \
+ } \
+ if (((Observer *)info->observer)->f \
+ && ((Observer *)info->observer)->f args) \
+ { \
+ r= 1; \
+ plugin_unlock(thd, plugin); \
+ break; \
+ } \
+ plugin_unlock(thd, plugin); \
+ } \
+ unlock()
+
+
+int Trans_delegate::after_commit(THD *thd, bool all)
+{
+ Trans_param param;
+ bool is_real_trans= (all || thd->transaction.all.ha_list == 0);
+ if (is_real_trans)
+ param.flags |= TRANS_IS_REAL_TRANS;
+
+ Trans_binlog_info *log_info=
+ my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO);
+
+ param.log_file= log_info ? log_info->log_file : 0;
+ param.log_pos= log_info ? log_info->log_pos : 0;
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, after_commit, thd, (&param));
+
+ /*
+ This is the end of a real transaction or autocommit statement, we
+ can free the memory allocated for binlog file and position.
+ */
+ if (is_real_trans && log_info)
+ {
+ my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL);
+ my_free(log_info, MYF(0));
+ }
+ return ret;
+}
+
+int Trans_delegate::after_rollback(THD *thd, bool all)
+{
+ Trans_param param;
+ bool is_real_trans= (all || thd->transaction.all.ha_list == 0);
+ if (is_real_trans)
+ param.flags |= TRANS_IS_REAL_TRANS;
+
+ Trans_binlog_info *log_info=
+ my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO);
+
+ param.log_file= log_info ? log_info->log_file : 0;
+ param.log_pos= log_info ? log_info->log_pos : 0;
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, after_commit, thd, (&param));
+
+ /*
+ This is the end of a real transaction or autocommit statement, we
+ can free the memory allocated for binlog file and position.
+ */
+ if (is_real_trans && log_info)
+ {
+ my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL);
+ my_free(log_info, MYF(0));
+ }
+ return ret;
+}
+
+int Binlog_storage_delegate::after_flush(THD *thd,
+ const char *log_file,
+ my_off_t log_pos,
+ bool synced)
+{
+ Binlog_storage_param param;
+ uint32 flags=0;
+ if (synced)
+ flags |= BINLOG_STORAGE_IS_SYNCED;
+
+ Trans_binlog_info *log_info=
+ my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO);
+
+ if (!log_info)
+ {
+ if(!(log_info=
+ (Trans_binlog_info *)my_malloc(sizeof(Trans_binlog_info), MYF(0))))
+ return 1;
+ my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, log_info);
+ }
+
+ strcpy(log_info->log_file, log_file+dirname_length(log_file));
+ log_info->log_pos = log_pos;
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, after_flush, thd,
+ (&param, log_info->log_file, log_info->log_pos, flags));
+ return ret;
+}
+
+#ifdef HAVE_REPLICATION
+int Binlog_transmit_delegate::transmit_start(THD *thd, ushort flags,
+ const char *log_file,
+ my_off_t log_pos)
+{
+ Binlog_transmit_param param;
+ param.flags= flags;
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, transmit_start, thd, (&param, log_file, log_pos));
+ return ret;
+}
+
+int Binlog_transmit_delegate::transmit_stop(THD *thd, ushort flags)
+{
+ Binlog_transmit_param param;
+ param.flags= flags;
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, transmit_stop, thd, (&param));
+ return ret;
+}
+
+int Binlog_transmit_delegate::reserve_header(THD *thd, ushort flags,
+ String *packet)
+{
+ /* NOTE2ME: Maximum extra header size for each observer, I hope 32
+ bytes should be enough for each Observer to reserve their extra
+ header. If later found this is not enough, we can increase this
+ /HEZX
+ */
+#define RESERVE_HEADER_SIZE 32
+ unsigned char header[RESERVE_HEADER_SIZE];
+ ulong hlen;
+ Binlog_transmit_param param;
+ param.flags= flags;
+ param.server_id= thd->server_id;
+
+ int ret= 0;
+ read_lock();
+ Observer_info_iterator iter= observer_info_iter();
+ Observer_info *info= iter++;
+ for (; info; info= iter++)
+ {
+ plugin_ref plugin=
+ my_plugin_lock(thd, &info->plugin);
+ if (!plugin)
+ {
+ ret= 1;
+ break;
+ }
+ hlen= 0;
+ if (((Observer *)info->observer)->reserve_header
+ && ((Observer *)info->observer)->reserve_header(&param,
+ header,
+ RESERVE_HEADER_SIZE,
+ &hlen))
+ {
+ ret= 1;
+ plugin_unlock(thd, plugin);
+ break;
+ }
+ plugin_unlock(thd, plugin);
+ if (hlen == 0)
+ continue;
+ if (hlen > RESERVE_HEADER_SIZE || packet->append((char *)header, hlen))
+ {
+ ret= 1;
+ break;
+ }
+ }
+ unlock();
+ return ret;
+}
+
+int Binlog_transmit_delegate::before_send_event(THD *thd, ushort flags,
+ String *packet,
+ const char *log_file,
+ my_off_t log_pos)
+{
+ Binlog_transmit_param param;
+ param.flags= flags;
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, before_send_event, thd,
+ (&param, (uchar *)packet->c_ptr(),
+ packet->length(),
+ log_file+dirname_length(log_file), log_pos));
+ return ret;
+}
+
+int Binlog_transmit_delegate::after_send_event(THD *thd, ushort flags,
+ String *packet)
+{
+ Binlog_transmit_param param;
+ param.flags= flags;
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, after_send_event, thd,
+ (&param, packet->c_ptr(), packet->length()));
+ return ret;
+}
+
+int Binlog_transmit_delegate::after_reset_master(THD *thd, ushort flags)
+
+{
+ Binlog_transmit_param param;
+ param.flags= flags;
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, after_reset_master, thd, (&param));
+ return ret;
+}
+
+void Binlog_relay_IO_delegate::init_param(Binlog_relay_IO_param *param,
+ Master_info *mi)
+{
+ param->mysql= mi->mysql;
+ param->user= mi->user;
+ param->host= mi->host;
+ param->port= mi->port;
+ param->master_log_name= mi->master_log_name;
+ param->master_log_pos= mi->master_log_pos;
+}
+
+int Binlog_relay_IO_delegate::thread_start(THD *thd, Master_info *mi)
+{
+ Binlog_relay_IO_param param;
+ init_param(&param, mi);
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, thread_start, thd, (&param));
+ return ret;
+}
+
+
+int Binlog_relay_IO_delegate::thread_stop(THD *thd, Master_info *mi)
+{
+
+ Binlog_relay_IO_param param;
+ init_param(&param, mi);
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, thread_stop, thd, (&param));
+ return ret;
+}
+
+int Binlog_relay_IO_delegate::before_request_transmit(THD *thd,
+ Master_info *mi,
+ ushort flags)
+{
+ Binlog_relay_IO_param param;
+ init_param(&param, mi);
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, before_request_transmit, thd, (&param, (uint32)flags));
+ return ret;
+}
+
+int Binlog_relay_IO_delegate::after_read_event(THD *thd, Master_info *mi,
+ const char *packet, ulong len,
+ const char **event_buf,
+ ulong *event_len)
+{
+ Binlog_relay_IO_param param;
+ init_param(&param, mi);
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, after_read_event, thd,
+ (&param, packet, len, event_buf, event_len));
+ return ret;
+}
+
+int Binlog_relay_IO_delegate::after_queue_event(THD *thd, Master_info *mi,
+ const char *event_buf,
+ ulong event_len,
+ bool synced)
+{
+ Binlog_relay_IO_param param;
+ init_param(&param, mi);
+
+ uint32 flags=0;
+ if (synced)
+ flags |= BINLOG_STORAGE_IS_SYNCED;
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, after_queue_event, thd,
+ (&param, event_buf, event_len, flags));
+ return ret;
+}
+
+int Binlog_relay_IO_delegate::after_reset_slave(THD *thd, Master_info *mi)
+
+{
+ Binlog_relay_IO_param param;
+ init_param(&param, mi);
+
+ int ret= 0;
+ FOREACH_OBSERVER(ret, after_reset_slave, thd, (&param));
+ return ret;
+}
+#endif /* HAVE_REPLICATION */
+
+int register_trans_observer(Trans_observer *observer, void *p)
+{
+ return transaction_delegate->add_observer(observer, (st_plugin_int *)p);
+}
+
+int unregister_trans_observer(Trans_observer *observer, void *p)
+{
+ return transaction_delegate->remove_observer(observer, (st_plugin_int *)p);
+}
+
+int register_binlog_storage_observer(Binlog_storage_observer *observer, void *p)
+{
+ return binlog_storage_delegate->add_observer(observer, (st_plugin_int *)p);
+}
+
+int unregister_binlog_storage_observer(Binlog_storage_observer *observer, void *p)
+{
+ return binlog_storage_delegate->remove_observer(observer, (st_plugin_int *)p);
+}
+
+#ifdef HAVE_REPLICATION
+int register_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p)
+{
+ return binlog_transmit_delegate->add_observer(observer, (st_plugin_int *)p);
+}
+
+int unregister_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p)
+{
+ return binlog_transmit_delegate->remove_observer(observer, (st_plugin_int *)p);
+}
+
+int register_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p)
+{
+ return binlog_relay_io_delegate->add_observer(observer, (st_plugin_int *)p);
+}
+
+int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p)
+{
+ return binlog_relay_io_delegate->remove_observer(observer, (st_plugin_int *)p);
+}
+#endif /* HAVE_REPLICATION */
diff --git a/sql/rpl_handler.h b/sql/rpl_handler.h
new file mode 100644
index 00000000000..4fb7b4e035b
--- /dev/null
+++ b/sql/rpl_handler.h
@@ -0,0 +1,213 @@
+/* Copyright (C) 2008 MySQL AB
+
+ 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 Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef RPL_HANDLER_H
+#define RPL_HANDLER_H
+
+#include "mysql_priv.h"
+#include "rpl_mi.h"
+#include "rpl_rli.h"
+#include "sql_plugin.h"
+#include "replication.h"
+
+class Observer_info {
+public:
+ void *observer;
+ st_plugin_int *plugin_int;
+ plugin_ref plugin;
+
+ Observer_info(void *ob, st_plugin_int *p)
+ :observer(ob), plugin_int(p)
+ {
+ plugin= plugin_int_to_ref(plugin_int);
+ }
+};
+
+class Delegate {
+public:
+ typedef List<Observer_info> Observer_info_list;
+ typedef List_iterator<Observer_info> Observer_info_iterator;
+
+ int add_observer(void *observer, st_plugin_int *plugin)
+ {
+ int ret= FALSE;
+ if (!inited)
+ return TRUE;
+ write_lock();
+ Observer_info_iterator iter(observer_info_list);
+ Observer_info *info= iter++;
+ while (info && info->observer != observer)
+ info= iter++;
+ if (!info)
+ {
+ info= new Observer_info(observer, plugin);
+ if (!info || observer_info_list.push_back(info, &memroot))
+ ret= TRUE;
+ }
+ else
+ ret= TRUE;
+ unlock();
+ return ret;
+ }
+
+ int remove_observer(void *observer, st_plugin_int *plugin)
+ {
+ int ret= FALSE;
+ if (!inited)
+ return TRUE;
+ write_lock();
+ Observer_info_iterator iter(observer_info_list);
+ Observer_info *info= iter++;
+ while (info && info->observer != observer)
+ info= iter++;
+ if (info)
+ iter.remove();
+ else
+ ret= TRUE;
+ unlock();
+ return ret;
+ }
+
+ inline Observer_info_iterator observer_info_iter()
+ {
+ return Observer_info_iterator(observer_info_list);
+ }
+
+ inline bool is_empty()
+ {
+ return observer_info_list.is_empty();
+ }
+
+ inline int read_lock()
+ {
+ if (!inited)
+ return TRUE;
+ return rw_rdlock(&lock);
+ }
+
+ inline int write_lock()
+ {
+ if (!inited)
+ return TRUE;
+ return rw_wrlock(&lock);
+ }
+
+ inline int unlock()
+ {
+ if (!inited)
+ return TRUE;
+ return rw_unlock(&lock);
+ }
+
+ inline bool is_inited()
+ {
+ return inited;
+ }
+
+ Delegate()
+ {
+ inited= FALSE;
+ if (my_rwlock_init(&lock, NULL))
+ return;
+ init_sql_alloc(&memroot, 1024, 0);
+ inited= TRUE;
+ }
+ ~Delegate()
+ {
+ inited= FALSE;
+ rwlock_destroy(&lock);
+ free_root(&memroot, MYF(0));
+ }
+
+private:
+ Observer_info_list observer_info_list;
+ rw_lock_t lock;
+ MEM_ROOT memroot;
+ bool inited;
+};
+
+class Trans_delegate
+ :public Delegate {
+public:
+ typedef Trans_observer Observer;
+ int before_commit(THD *thd, bool all);
+ int before_rollback(THD *thd, bool all);
+ int after_commit(THD *thd, bool all);
+ int after_rollback(THD *thd, bool all);
+};
+
+class Binlog_storage_delegate
+ :public Delegate {
+public:
+ typedef Binlog_storage_observer Observer;
+ int after_flush(THD *thd, const char *log_file,
+ my_off_t log_pos, bool synced);
+};
+
+#ifdef HAVE_REPLICATION
+class Binlog_transmit_delegate
+ :public Delegate {
+public:
+ typedef Binlog_transmit_observer Observer;
+ int transmit_start(THD *thd, ushort flags,
+ const char *log_file, my_off_t log_pos);
+ int transmit_stop(THD *thd, ushort flags);
+ int reserve_header(THD *thd, ushort flags, String *packet);
+ int before_send_event(THD *thd, ushort flags,
+ String *packet, const
+ char *log_file, my_off_t log_pos );
+ int after_send_event(THD *thd, ushort flags,
+ String *packet);
+ int after_reset_master(THD *thd, ushort flags);
+};
+
+class Binlog_relay_IO_delegate
+ :public Delegate {
+public:
+ typedef Binlog_relay_IO_observer Observer;
+ int thread_start(THD *thd, Master_info *mi);
+ int thread_stop(THD *thd, Master_info *mi);
+ int before_request_transmit(THD *thd, Master_info *mi, ushort flags);
+ int after_read_event(THD *thd, Master_info *mi,
+ const char *packet, ulong len,
+ const char **event_buf, ulong *event_len);
+ int after_queue_event(THD *thd, Master_info *mi,
+ const char *event_buf, ulong event_len,
+ bool synced);
+ int after_reset_slave(THD *thd, Master_info *mi);
+private:
+ void init_param(Binlog_relay_IO_param *param, Master_info *mi);
+};
+#endif /* HAVE_REPLICATION */
+
+int delegates_init();
+void delegates_destroy();
+
+extern Trans_delegate *transaction_delegate;
+extern Binlog_storage_delegate *binlog_storage_delegate;
+#ifdef HAVE_REPLICATION
+extern Binlog_transmit_delegate *binlog_transmit_delegate;
+extern Binlog_relay_IO_delegate *binlog_relay_io_delegate;
+#endif /* HAVE_REPLICATION */
+
+/*
+ if there is no observers in the delegate, we can return 0
+ immediately.
+*/
+#define RUN_HOOK(group, hook, args) \
+ (group ##_delegate->is_empty() ? \
+ 0 : group ##_delegate->hook args)
+
+#endif /* RPL_HANDLER_H */
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index 5e46837e948..4f8c3f50ded 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -21,22 +21,28 @@
#ifdef HAVE_REPLICATION
+#define DEFAULT_CONNECT_RETRY 60
// Defined in slave.cc
int init_intvar_from_file(int* var, IO_CACHE* f, int default_val);
int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
const char *default_val);
+int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val);
+int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f);
-Master_info::Master_info()
+Master_info::Master_info(bool is_slave_recovery)
:Slave_reporting_capability("I/O"),
- ssl(0), ssl_verify_server_cert(0), fd(-1), io_thd(0), inited(0),
- abort_slave(0),slave_running(0),
- slave_run_id(0)
+ ssl(0), ssl_verify_server_cert(0), fd(-1), io_thd(0),
+ port(MYSQL_PORT), connect_retry(DEFAULT_CONNECT_RETRY), inited(0),
+ rli(is_slave_recovery), abort_slave(0),
+ slave_running(0), slave_run_id(0), sync_counter(0),
+ heartbeat_period(0), received_heartbeats(0), master_id(0)
{
host[0] = 0; user[0] = 0; password[0] = 0;
ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0;
ssl_cipher[0]= 0; ssl_key[0]= 0;
+ my_init_dynamic_array(&ignore_server_ids, sizeof(::server_id), 16, 16);
bzero((char*) &file, sizeof(file));
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
@@ -47,6 +53,7 @@ Master_info::Master_info()
Master_info::~Master_info()
{
+ delete_dynamic(&ignore_server_ids);
pthread_mutex_destroy(&run_lock);
pthread_mutex_destroy(&data_lock);
pthread_cond_destroy(&data_cond);
@@ -54,36 +61,64 @@ Master_info::~Master_info()
pthread_cond_destroy(&stop_cond);
}
+/**
+ A comparison function to be supplied as argument to @c sort_dynamic()
+ and @c bsearch()
-void init_master_info_with_options(Master_info* mi)
+ @return -1 if first argument is less, 0 if it equal to, 1 if it is greater
+ than the second
+*/
+int change_master_server_id_cmp(ulong *id1, ulong *id2)
+{
+ return *id1 < *id2? -1 : (*id1 > *id2? 1 : 0);
+}
+
+
+/**
+ Reports if the s_id server has been configured to ignore events
+ it generates with
+
+ CHANGE MASTER IGNORE_SERVER_IDS= ( list of server ids )
+
+ Method is called from the io thread event receiver filtering.
+
+ @param s_id the master server identifier
+
+ @retval TRUE if s_id is in the list of ignored master servers,
+ @retval FALSE otherwise.
+ */
+bool Master_info::shall_ignore_server_id(ulong s_id)
{
- DBUG_ENTER("init_master_info_with_options");
+ if (likely(ignore_server_ids.elements == 1))
+ return (* (ulong*) dynamic_array_ptr(&ignore_server_ids, 0)) == s_id;
+ else
+ return bsearch((const ulong *) &s_id,
+ ignore_server_ids.buffer,
+ ignore_server_ids.elements, sizeof(ulong),
+ (int (*) (const void*, const void*)) change_master_server_id_cmp)
+ != NULL;
+}
+
+void init_master_log_pos(Master_info* mi)
+{
+ DBUG_ENTER("init_master_log_pos");
mi->master_log_name[0] = 0;
mi->master_log_pos = BIN_LOG_HEADER_SIZE; // skip magic number
- if (master_host)
- strmake(mi->host, master_host, sizeof(mi->host) - 1);
- if (master_user)
- strmake(mi->user, master_user, sizeof(mi->user) - 1);
- if (master_password)
- strmake(mi->password, master_password, MAX_PASSWORD_LENGTH);
- mi->port = master_port;
- mi->connect_retry = master_connect_retry;
-
- mi->ssl= master_ssl;
- if (master_ssl_ca)
- strmake(mi->ssl_ca, master_ssl_ca, sizeof(mi->ssl_ca)-1);
- if (master_ssl_capath)
- strmake(mi->ssl_capath, master_ssl_capath, sizeof(mi->ssl_capath)-1);
- if (master_ssl_cert)
- strmake(mi->ssl_cert, master_ssl_cert, sizeof(mi->ssl_cert)-1);
- if (master_ssl_cipher)
- strmake(mi->ssl_cipher, master_ssl_cipher, sizeof(mi->ssl_cipher)-1);
- if (master_ssl_key)
- strmake(mi->ssl_key, master_ssl_key, sizeof(mi->ssl_key)-1);
/* Intentionally init ssl_verify_server_cert to 0, no option available */
mi->ssl_verify_server_cert= 0;
+ /*
+ always request heartbeat unless master_heartbeat_period is set
+ explicitly zero. Here is the default value for heartbeat period
+ if CHANGE MASTER did not specify it. (no data loss in conversion
+ as hb period has a max)
+ */
+ mi->heartbeat_period= (float) min(SLAVE_MAX_HEARTBEAT_PERIOD,
+ (slave_net_timeout/2.0));
+ DBUG_ASSERT(mi->heartbeat_period > (float) 0.001
+ || mi->heartbeat_period == 0);
+
DBUG_VOID_RETURN;
}
@@ -93,9 +128,12 @@ enum {
/* 5.1.16 added value of master_ssl_verify_server_cert */
LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT= 15,
-
+ /* 6.0 added value of master_heartbeat_period */
+ LINE_FOR_MASTER_HEARTBEAT_PERIOD= 16,
+ /* 6.0 added value of master_ignore_server_id */
+ LINE_FOR_REPLICATE_IGNORE_SERVER_IDS= 17,
/* Number of lines currently used when saving master info file */
- LINES_IN_MASTER_INFO= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT
+ LINES_IN_MASTER_INFO= LINE_FOR_REPLICATE_IGNORE_SERVER_IDS
};
int init_master_info(Master_info* mi, const char* master_info_fname,
@@ -170,7 +208,7 @@ file '%s')", fname);
}
mi->fd = fd;
- init_master_info_with_options(mi);
+ init_master_log_pos(mi);
}
else // file exists
@@ -197,6 +235,7 @@ file '%s')", fname);
mi->fd = fd;
int port, connect_retry, master_log_pos, lines;
int ssl= 0, ssl_verify_server_cert= 0;
+ float master_heartbeat_period= 0.0;
char *first_non_digit;
/*
@@ -242,36 +281,34 @@ file '%s')", fname);
lines= 7;
if (init_intvar_from_file(&master_log_pos, &mi->file, 4) ||
- init_strvar_from_file(mi->host, sizeof(mi->host), &mi->file,
- master_host) ||
- init_strvar_from_file(mi->user, sizeof(mi->user), &mi->file,
- master_user) ||
+ init_strvar_from_file(mi->host, sizeof(mi->host), &mi->file, 0) ||
+ init_strvar_from_file(mi->user, sizeof(mi->user), &mi->file, "test") ||
init_strvar_from_file(mi->password, SCRAMBLED_PASSWORD_CHAR_LENGTH+1,
- &mi->file, master_password) ||
- init_intvar_from_file(&port, &mi->file, master_port) ||
+ &mi->file, 0) ||
+ init_intvar_from_file(&port, &mi->file, MYSQL_PORT) ||
init_intvar_from_file(&connect_retry, &mi->file,
- master_connect_retry))
+ DEFAULT_CONNECT_RETRY))
goto errwithmsg;
/*
If file has ssl part use it even if we have server without
- SSL support. But these option will be ignored later when
+ SSL support. But these options will be ignored later when
slave will try connect to master, so in this case warning
is printed.
*/
if (lines >= LINES_IN_MASTER_INFO_WITH_SSL)
{
- if (init_intvar_from_file(&ssl, &mi->file, master_ssl) ||
+ if (init_intvar_from_file(&ssl, &mi->file, 0) ||
init_strvar_from_file(mi->ssl_ca, sizeof(mi->ssl_ca),
- &mi->file, master_ssl_ca) ||
+ &mi->file, 0) ||
init_strvar_from_file(mi->ssl_capath, sizeof(mi->ssl_capath),
- &mi->file, master_ssl_capath) ||
+ &mi->file, 0) ||
init_strvar_from_file(mi->ssl_cert, sizeof(mi->ssl_cert),
- &mi->file, master_ssl_cert) ||
+ &mi->file, 0) ||
init_strvar_from_file(mi->ssl_cipher, sizeof(mi->ssl_cipher),
- &mi->file, master_ssl_cipher) ||
+ &mi->file, 0) ||
init_strvar_from_file(mi->ssl_key, sizeof(mi->ssl_key),
- &mi->file, master_ssl_key))
+ &mi->file, 0))
goto errwithmsg;
/*
@@ -281,14 +318,30 @@ file '%s')", fname);
if (lines >= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT &&
init_intvar_from_file(&ssl_verify_server_cert, &mi->file, 0))
goto errwithmsg;
-
+ /*
+ Starting from 6.0 master_heartbeat_period might be
+ in the file
+ */
+ if (lines >= LINE_FOR_MASTER_HEARTBEAT_PERIOD &&
+ init_floatvar_from_file(&master_heartbeat_period, &mi->file, 0.0))
+ goto errwithmsg;
+ /*
+ Starting from 6.0 list of server_id of ignorable servers might be
+ in the file
+ */
+ if (lines >= LINE_FOR_REPLICATE_IGNORE_SERVER_IDS &&
+ init_dynarray_intvar_from_file(&mi->ignore_server_ids, &mi->file))
+ {
+ sql_print_error("Failed to initialize master info ignore_server_ids");
+ goto errwithmsg;
+ }
}
#ifndef HAVE_OPENSSL
if (ssl)
sql_print_warning("SSL information in the master info file "
- "('%s') are ignored because this MySQL slave was compiled "
- "without SSL support.", fname);
+ "('%s') are ignored because this MySQL slave was "
+ "compiled without SSL support.", fname);
#endif /* HAVE_OPENSSL */
/*
@@ -300,6 +353,7 @@ file '%s')", fname);
mi->connect_retry= (uint) connect_retry;
mi->ssl= (my_bool) ssl;
mi->ssl_verify_server_cert= ssl_verify_server_cert;
+ mi->heartbeat_period= master_heartbeat_period;
}
DBUG_PRINT("master_info",("log_file_name: %s position: %ld",
mi->master_log_name,
@@ -310,6 +364,7 @@ file '%s')", fname);
goto err;
mi->inited = 1;
+ mi->rli.is_relay_log_recovery= FALSE;
// now change cache READ -> WRITE - must do this before flush_master_info
reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1);
if ((error=test(flush_master_info(mi, 1))))
@@ -342,6 +397,7 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache)
{
IO_CACHE* file = &mi->file;
char lbuf[22];
+ int err= 0;
DBUG_ENTER("flush_master_info");
DBUG_PRINT("enter",("master_pos: %ld", (long) mi->master_log_pos));
@@ -358,9 +414,35 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache)
When we come to this place in code, relay log may or not be initialized;
the caller is responsible for setting 'flush_relay_log_cache' accordingly.
*/
- if (flush_relay_log_cache &&
- flush_io_cache(mi->rli.relay_log.get_log_file()))
- DBUG_RETURN(2);
+ if (flush_relay_log_cache)
+ {
+ IO_CACHE *log_file= mi->rli.relay_log.get_log_file();
+ if (flush_io_cache(log_file))
+ DBUG_RETURN(2);
+ }
+
+ /*
+ produce a line listing the total number and all the ignored server_id:s
+ */
+ char* ignore_server_ids_buf;
+ {
+ ignore_server_ids_buf=
+ (char *) my_malloc((sizeof(::server_id) * 3 + 1) *
+ (1 + mi->ignore_server_ids.elements), MYF(MY_WME));
+ if (!ignore_server_ids_buf)
+ DBUG_RETURN(1);
+ for (ulong i= 0, cur_len= my_sprintf(ignore_server_ids_buf,
+ (ignore_server_ids_buf, "%u",
+ mi->ignore_server_ids.elements));
+ i < mi->ignore_server_ids.elements; i++)
+ {
+ ulong s_id;
+ get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i);
+ cur_len +=my_sprintf(ignore_server_ids_buf + cur_len,
+ (ignore_server_ids_buf + cur_len,
+ " %lu", s_id));
+ }
+ }
/*
We flushed the relay log BEFORE the master.info file, because if we crash
@@ -378,17 +460,27 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache)
contents of file). But because of number of lines in the first line
of file we don't care about this garbage.
*/
-
+ char heartbeat_buf[sizeof(mi->heartbeat_period) * 4]; // buffer to suffice always
+ my_sprintf(heartbeat_buf, (heartbeat_buf, "%.3f", mi->heartbeat_period));
my_b_seek(file, 0L);
my_b_printf(file,
- "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n",
+ "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n",
LINES_IN_MASTER_INFO,
mi->master_log_name, llstr(mi->master_log_pos, lbuf),
mi->host, mi->user,
mi->password, mi->port, mi->connect_retry,
(int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert,
- mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert);
- DBUG_RETURN(-flush_io_cache(file));
+ mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert,
+ heartbeat_buf, ignore_server_ids_buf);
+ my_free(ignore_server_ids_buf, MYF(0));
+ err= flush_io_cache(file);
+ if (sync_masterinfo_period && !err &&
+ ++(mi->sync_counter) >= sync_masterinfo_period)
+ {
+ err= my_sync(mi->fd, MYF(MY_WME));
+ mi->sync_counter= 0;
+ }
+ DBUG_RETURN(-err);
}
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index 93fb0a98198..6e4e2f9cdc7 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -20,6 +20,7 @@
#include "rpl_rli.h"
#include "rpl_reporting.h"
+#include "my_sys.h"
/*****************************************************************************
@@ -58,8 +59,9 @@
class Master_info : public Slave_reporting_capability
{
public:
- Master_info();
+ Master_info(bool is_slave_recovery);
~Master_info();
+ bool shall_ignore_server_id(ulong s_id);
/* the variables below are needed because we can change masters on the fly */
char master_log_name[FN_REFLEN];
@@ -100,15 +102,25 @@ class Master_info : public Slave_reporting_capability
*/
long clock_diff_with_master;
+ /*
+ Keeps track of the number of events before fsyncing.
+ The option --sync-master-info determines how many
+ events should happen before fsyncing.
+ */
+ uint sync_counter;
+ float heartbeat_period; // interface with CHANGE MASTER or master.info
+ ulonglong received_heartbeats; // counter of received heartbeat events
+ DYNAMIC_ARRAY ignore_server_ids;
+ ulong master_id;
};
-
-void init_master_info_with_options(Master_info* mi);
+void init_master_log_pos(Master_info* mi);
int init_master_info(Master_info* mi, const char* master_info_fname,
const char* slave_info_fname,
bool abort_if_no_master_info_file,
int thread_mask);
void end_master_info(Master_info* mi);
int flush_master_info(Master_info* mi, bool flush_relay_log_cache);
+int change_master_server_id_cmp(ulong *id1, ulong *id2);
#endif /* HAVE_REPLICATION */
#endif /* RPL_MI_H */
diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc
index 8e80620dd2c..00f586cfdd8 100644
--- a/sql/rpl_record.cc
+++ b/sql/rpl_record.cc
@@ -104,10 +104,10 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
#endif
pack_ptr= field->pack(pack_ptr, field->ptr + offset,
field->max_data_length(), TRUE);
- DBUG_PRINT("debug", ("field: %s; pack_ptr: 0x%lx;"
+ DBUG_PRINT("debug", ("field: %s; real_type: %d, pack_ptr: 0x%lx;"
" pack_ptr':0x%lx; bytes: %d",
- field->field_name, (ulong) old_pack_ptr,
- (ulong) pack_ptr,
+ field->field_name, field->real_type(),
+ (ulong) old_pack_ptr, (ulong) pack_ptr,
(int) (pack_ptr - old_pack_ptr)));
}
@@ -202,10 +202,30 @@ unpack_row(Relay_log_info const *rli,
// The "current" null bits
unsigned int null_bits= *null_ptr++;
uint i= 0;
- table_def *tabledef= ((Relay_log_info*)rli)->get_tabledef(table);
+ table_def *tabledef;
+ TABLE *conv_table;
+ bool table_found= rli->get_table_data(table, &tabledef, &conv_table);
+ DBUG_PRINT("debug", ("Table data: table_found: %d, tabldef: %p, conv_table: %p",
+ table_found, tabledef, conv_table));
+ DBUG_ASSERT(table_found);
+ if (!table_found)
+ return HA_ERR_GENERIC;
+
for (field_ptr= begin_ptr ; field_ptr < end_ptr && *field_ptr ; ++field_ptr)
{
- Field *const f= *field_ptr;
+ /*
+ If there is a conversion table, we pick up the field pointer to
+ the conversion table. If the conversion table or the field
+ pointer is NULL, no conversions are necessary.
+ */
+ Field *conv_field=
+ conv_table ? conv_table->field[field_ptr - begin_ptr] : NULL;
+ Field *const f=
+ conv_field ? conv_field : *field_ptr;
+ DBUG_PRINT("debug", ("Conversion %srequired for field '%s' (#%d)",
+ conv_field ? "" : "not ",
+ (*field_ptr)->field_name, field_ptr - begin_ptr));
+ DBUG_ASSERT(f != NULL);
/*
No need to bother about columns that does not exist: they have
@@ -275,6 +295,39 @@ unpack_row(Relay_log_info const *rli,
(int) (pack_ptr - old_pack_ptr)));
}
+ /*
+ If conv_field is set, then we are doing a conversion. In this
+ case, we have unpacked the master data to the conversion
+ table, so we need to copy the value stored in the conversion
+ table into the final table and do the conversion at the same time.
+ */
+ if (conv_field)
+ {
+ Copy_field copy;
+#ifndef DBUG_OFF
+ char source_buf[MAX_FIELD_WIDTH];
+ char value_buf[MAX_FIELD_WIDTH];
+ String source_type(source_buf, sizeof(source_buf), system_charset_info);
+ String value_string(value_buf, sizeof(value_buf), system_charset_info);
+ conv_field->sql_type(source_type);
+ conv_field->val_str(&value_string);
+ DBUG_PRINT("debug", ("Copying field '%s' of type '%s' with value '%s'",
+ (*field_ptr)->field_name,
+ source_type.c_ptr(), value_string.c_ptr()));
+#endif
+ copy.set(*field_ptr, f, TRUE);
+ (*copy.do_copy)(&copy);
+#ifndef DBUG_OFF
+ char target_buf[MAX_FIELD_WIDTH];
+ String target_type(target_buf, sizeof(target_buf), system_charset_info);
+ (*field_ptr)->sql_type(target_type);
+ (*field_ptr)->val_str(&value_string);
+ DBUG_PRINT("debug", ("Value of field '%s' of type '%s' is now '%s'",
+ (*field_ptr)->field_name,
+ target_type.c_ptr(), value_string.c_ptr()));
+#endif
+ }
+
null_mask <<= 1;
}
i++;
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index a26717d7acf..e35ca613d23 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -28,15 +28,16 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val);
int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
const char *default_val);
-
-Relay_log_info::Relay_log_info()
+Relay_log_info::Relay_log_info(bool is_slave_recovery)
:Slave_reporting_capability("SQL"),
no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id),
- info_fd(-1), cur_log_fd(-1), save_temporary_tables(0),
- cur_log_old_open_count(0), group_relay_log_pos(0), event_relay_log_pos(0),
+ info_fd(-1), cur_log_fd(-1), relay_log(&sync_relaylog_period),
+ sync_counter(0), is_relay_log_recovery(is_slave_recovery),
+ save_temporary_tables(0),
#if HAVE_purify
is_fake(FALSE),
#endif
+ cur_log_old_open_count(0), group_relay_log_pos(0), event_relay_log_pos(0),
group_master_log_pos(0), log_space_total(0), ignore_log_space_limit(0),
last_master_timestamp(0), slave_skip_counter(0),
abort_pos_wait(0), slave_run_id(0), sql_thd(0),
@@ -282,6 +283,9 @@ Failed to open the existing relay log info file '%s' (errno %d)",
rli->group_relay_log_pos= rli->event_relay_log_pos= relay_log_pos;
rli->group_master_log_pos= master_log_pos;
+ if (rli->is_relay_log_recovery && init_recovery(rli->mi, &msg))
+ goto err;
+
if (init_relay_log_pos(rli,
rli->group_relay_log_name,
rli->group_relay_log_pos,
@@ -313,7 +317,10 @@ Failed to open the existing relay log info file '%s' (errno %d)",
*/
reinit_io_cache(&rli->info_file, WRITE_CACHE,0L,0,1);
if ((error= flush_relay_log_info(rli)))
- sql_print_error("Failed to flush relay log info file");
+ {
+ msg= "Failed to flush relay log info file";
+ goto err;
+ }
if (count_relay_log_space(rli))
{
msg="Error counting relay log space";
@@ -1212,7 +1219,6 @@ void Relay_log_info::cleanup_context(THD *thd, bool error)
*/
thd->options&= ~OPTION_NO_FOREIGN_KEY_CHECKS;
thd->options&= ~OPTION_RELAXED_UNIQUE_CHECKS;
- last_event_start_time= 0;
DBUG_VOID_RETURN;
}
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index 171778d9675..7c43f821295 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -96,6 +96,19 @@ public:
LOG_INFO linfo;
IO_CACHE cache_buf,*cur_log;
+ /*
+ Keeps track of the number of transactions that commits
+ before fsyncing. The option --sync-relay-log-info determines
+ how many transactions should commit before fsyncing.
+ */
+ uint sync_counter;
+
+ /*
+ Identifies when the recovery process is going on.
+ See sql/slave.cc:init_recovery for further details.
+ */
+ bool is_relay_log_recovery;
+
/* The following variables are safe to read any time */
/* IO_CACHE of the info file - set only during init or end */
@@ -208,8 +221,14 @@ public:
int events_till_abort;
#endif
- /* if not set, the value of other members of the structure are undefined */
- bool inited;
+ /*
+ inited changes its value within LOCK_active_mi-guarded critical
+ sections at times of start_slave_threads() (0->1) and end_slave() (1->0).
+ Readers may not acquire the mutex while they realize potential concurrency
+ issue.
+ If not set, the value of other members of the structure are undefined.
+ */
+ volatile bool inited;
volatile bool abort_slave;
volatile uint slave_running;
@@ -267,7 +286,7 @@ public:
char slave_patternload_file[FN_REFLEN];
size_t slave_patternload_file_size;
- Relay_log_info();
+ Relay_log_info(bool is_slave_recovery);
~Relay_log_info();
/*
@@ -314,13 +333,21 @@ public:
uint tables_to_lock_count; /* RBR: Count of tables to lock */
table_mapping m_table_map; /* RBR: Mapping table-id to table */
- inline table_def *get_tabledef(TABLE *tbl)
+ bool get_table_data(TABLE *table_arg, table_def **tabledef_var, TABLE **conv_table_var) const
{
- table_def *td= 0;
- for (TABLE_LIST *ptr= tables_to_lock; ptr && !td; ptr= ptr->next_global)
- if (ptr->table == tbl)
- td= &((RPL_TABLE_LIST *)ptr)->m_tabledef;
- return (td);
+ DBUG_ASSERT(tabledef_var && conv_table_var);
+ for (TABLE_LIST *ptr= tables_to_lock ; ptr != NULL ; ptr= ptr->next_global)
+ if (ptr->table == table_arg)
+ {
+ *tabledef_var= &static_cast<RPL_TABLE_LIST*>(ptr)->m_tabledef;
+ *conv_table_var= static_cast<RPL_TABLE_LIST*>(ptr)->m_conv_table;
+ DBUG_PRINT("debug", ("Fetching table data for table %s.%s:"
+ " tabledef: %p, conv_table: %p",
+ table_arg->s->db.str, table_arg->s->table_name.str,
+ *tabledef_var, *conv_table_var));
+ return true;
+ }
+ return false;
}
/*
@@ -336,12 +363,10 @@ public:
void clear_tables_to_lock();
/*
- Used by row-based replication to detect that it should not stop at
- this event, but give it a chance to send more events. The time
- where the last event inside a group started is stored here. If the
- variable is zero, we are not in a group (but may be in a
- transaction).
- */
+ Used to defer stopping the SQL thread to give it a chance
+ to finish up the current group of events.
+ The timestamp is set and reset in @c sql_slave_killed().
+ */
time_t last_event_start_time;
/**
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index e34f8561051..3a69c71b34c 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -14,8 +14,176 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "rpl_utility.h"
+
+#ifndef MYSQL_CLIENT
#include "rpl_rli.h"
+/**
+ Function to compare two size_t integers for their relative
+ order. Used below.
+ */
+int compare(size_t a, size_t b)
+{
+ if (a < b)
+ return -1;
+ if (b < a)
+ return 1;
+ return 0;
+}
+
+
+/**
+ Max value for an unsigned integer of 'bits' bits.
+
+ The somewhat contorted expression is to avoid overflow.
+ */
+uint32 uint_max(int bits) {
+ return (((1UL << (bits - 1)) - 1) << 1) | 1;
+}
+
+
+/**
+ Compute the maximum display length of a field.
+
+ @param sql_type Type of the field
+ @param metadata The metadata from the master for the field.
+ @return Maximum length of the field in bytes.
+ */
+static uint32
+max_display_length_for_field(enum_field_types sql_type, unsigned int metadata)
+{
+ DBUG_PRINT("debug", ("sql_type: %d, metadata: 0x%x", sql_type, metadata));
+ DBUG_ASSERT(metadata >> 16 == 0);
+
+ switch (sql_type) {
+ case MYSQL_TYPE_NEWDECIMAL:
+ return metadata >> 8;
+
+ case MYSQL_TYPE_FLOAT:
+ return 12;
+
+ case MYSQL_TYPE_DOUBLE:
+ return 22;
+
+ case MYSQL_TYPE_SET:
+ case MYSQL_TYPE_ENUM:
+ return metadata & 0x00ff;
+
+ case MYSQL_TYPE_STRING:
+ {
+ uchar type= metadata >> 8;
+ if (type == MYSQL_TYPE_SET || type == MYSQL_TYPE_ENUM)
+ return metadata & 0xff;
+ else
+ /* This is taken from Field_string::unpack. */
+ return (((metadata >> 4) & 0x300) ^ 0x300) + (metadata & 0x00ff);
+ }
+
+ case MYSQL_TYPE_YEAR:
+ case MYSQL_TYPE_TINY:
+ return 4;
+
+ case MYSQL_TYPE_SHORT:
+ return 6;
+
+ case MYSQL_TYPE_INT24:
+ return 9;
+
+ case MYSQL_TYPE_LONG:
+ return 11;
+
+#ifdef HAVE_LONG_LONG
+ case MYSQL_TYPE_LONGLONG:
+ return 20;
+
+#endif
+ case MYSQL_TYPE_NULL:
+ return 0;
+
+ case MYSQL_TYPE_NEWDATE:
+ return 3;
+
+ case MYSQL_TYPE_DATE:
+ case MYSQL_TYPE_TIME:
+ return 3;
+
+ case MYSQL_TYPE_TIMESTAMP:
+ return 4;
+
+ case MYSQL_TYPE_DATETIME:
+ return 8;
+
+ case MYSQL_TYPE_BIT:
+ /*
+ Decode the size of the bit field from the master.
+ */
+ DBUG_ASSERT((metadata & 0xff) <= 7);
+ return 8 * (metadata >> 8U) + (metadata & 0x00ff);
+
+ case MYSQL_TYPE_VAR_STRING:
+ case MYSQL_TYPE_VARCHAR:
+ return metadata;
+
+ /*
+ The actual length for these types does not really matter since
+ they are used to calc_pack_length, which ignores the given
+ length for these types.
+
+ Since we want this to be accurate for other uses, we return the
+ maximum size in bytes of these BLOBs.
+ */
+
+ case MYSQL_TYPE_TINY_BLOB:
+ return uint_max(1 * 8);
+
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ return uint_max(3 * 8);
+
+ case MYSQL_TYPE_BLOB:
+ /*
+ For the blob type, Field::real_type() lies and say that all
+ blobs are of type MYSQL_TYPE_BLOB. In that case, we have to look
+ at the length instead to decide what the max display size is.
+ */
+ return uint_max(metadata * 8);
+
+ case MYSQL_TYPE_LONG_BLOB:
+ case MYSQL_TYPE_GEOMETRY:
+ return uint_max(4 * 8);
+
+ default:
+ return ~(uint32) 0;
+ }
+}
+
+
+/*
+ Compare the pack lengths of a source field (on the master) and a
+ target field (on the slave).
+
+ @param field Target field.
+ @param type Source field type.
+ @param metadata Source field metadata.
+
+ @retval -1 The length of the source field is smaller than the target field.
+ @retval 0 The length of the source and target fields are the same.
+ @retval 1 The length of the source field is greater than the target field.
+ */
+int compare_lengths(Field *field, enum_field_types source_type, uint16 metadata)
+{
+ DBUG_ENTER("compare_lengths");
+ size_t const source_length=
+ max_display_length_for_field(source_type, metadata);
+ size_t const target_length= field->max_display_length();
+ DBUG_PRINT("debug", ("source_length: %lu, source_type: %u,"
+ " target_length: %lu, target_type: %u",
+ (unsigned long) source_length, source_type,
+ (unsigned long) target_length, field->real_type()));
+ int result= compare(source_length, target_length);
+ DBUG_PRINT("result", ("%d", result));
+ DBUG_RETURN(result);
+}
+
/*********************************************************************
* table_def member definitions *
*********************************************************************/
@@ -169,58 +337,704 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data) const
return length;
}
-/*
+
+/**
+ */
+void show_sql_type(enum_field_types type, uint16 metadata, String *str)
+{
+ DBUG_ENTER("show_sql_type");
+ DBUG_PRINT("enter", ("type: %d, metadata: 0x%x", type, metadata));
+
+ switch (type)
+ {
+ case MYSQL_TYPE_TINY:
+ str->set_ascii(STRING_WITH_LEN("tinyint"));
+ break;
+
+ case MYSQL_TYPE_SHORT:
+ str->set_ascii(STRING_WITH_LEN("smallint"));
+ break;
+
+ case MYSQL_TYPE_LONG:
+ str->set_ascii(STRING_WITH_LEN("int"));
+ break;
+
+ case MYSQL_TYPE_FLOAT:
+ str->set_ascii(STRING_WITH_LEN("float"));
+ break;
+
+ case MYSQL_TYPE_DOUBLE:
+ str->set_ascii(STRING_WITH_LEN("double"));
+ break;
+
+ case MYSQL_TYPE_NULL:
+ str->set_ascii(STRING_WITH_LEN("null"));
+ break;
+
+ case MYSQL_TYPE_TIMESTAMP:
+ str->set_ascii(STRING_WITH_LEN("timestamp"));
+ break;
+
+ case MYSQL_TYPE_LONGLONG:
+ str->set_ascii(STRING_WITH_LEN("bigint"));
+ break;
+
+ case MYSQL_TYPE_INT24:
+ str->set_ascii(STRING_WITH_LEN("mediumint"));
+ break;
+
+ case MYSQL_TYPE_NEWDATE:
+ case MYSQL_TYPE_DATE:
+ str->set_ascii(STRING_WITH_LEN("date"));
+ break;
+
+ case MYSQL_TYPE_TIME:
+ str->set_ascii(STRING_WITH_LEN("time"));
+ break;
+
+ case MYSQL_TYPE_DATETIME:
+ str->set_ascii(STRING_WITH_LEN("datetime"));
+ break;
+
+ case MYSQL_TYPE_YEAR:
+ str->set_ascii(STRING_WITH_LEN("year"));
+ break;
+
+ case MYSQL_TYPE_VAR_STRING:
+ case MYSQL_TYPE_VARCHAR:
+ {
+ CHARSET_INFO *cs= str->charset();
+ uint32 length=
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
+ "varchar(%u)", metadata);
+ str->length(length);
+ }
+ break;
+
+ case MYSQL_TYPE_BIT:
+ {
+ CHARSET_INFO *cs= str->charset();
+ int bit_length= 8 * (metadata >> 8) + (metadata & 0xFF);
+ uint32 length=
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
+ "bit(%d)", bit_length);
+ str->length(length);
+ }
+ break;
+
+ case MYSQL_TYPE_DECIMAL:
+ {
+ CHARSET_INFO *cs= str->charset();
+ uint32 length=
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
+ "decimal(%d,?)", metadata);
+ str->length(length);
+ }
+ break;
+
+ case MYSQL_TYPE_NEWDECIMAL:
+ {
+ CHARSET_INFO *cs= str->charset();
+ uint32 length=
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
+ "decimal(%d,%d)", metadata >> 8, metadata & 0xff);
+ str->length(length);
+ }
+ break;
+
+ case MYSQL_TYPE_ENUM:
+ str->set_ascii(STRING_WITH_LEN("enum"));
+ break;
+
+ case MYSQL_TYPE_SET:
+ str->set_ascii(STRING_WITH_LEN("set"));
+ break;
+
+ case MYSQL_TYPE_BLOB:
+ /*
+ Field::real_type() lies regarding the actual type of a BLOB, so
+ it is necessary to check the pack length to figure out what kind
+ of blob it really is.
+ */
+ switch (get_blob_type_from_length(metadata))
+ {
+ case MYSQL_TYPE_TINY_BLOB:
+ str->set_ascii(STRING_WITH_LEN("tinyblob"));
+ break;
+
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ str->set_ascii(STRING_WITH_LEN("mediumblob"));
+ break;
+
+ case MYSQL_TYPE_LONG_BLOB:
+ str->set_ascii(STRING_WITH_LEN("longblob"));
+ break;
+
+ case MYSQL_TYPE_BLOB:
+ str->set_ascii(STRING_WITH_LEN("blob"));
+ break;
+
+ default:
+ DBUG_ASSERT(0);
+ break;
+ }
+ break;
+
+ case MYSQL_TYPE_STRING:
+ {
+ /*
+ This is taken from Field_string::unpack.
+ */
+ CHARSET_INFO *cs= str->charset();
+ uint bytes= (((metadata >> 4) & 0x300) ^ 0x300) + (metadata & 0x00ff);
+ uint32 length=
+ cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
+ "char(%d)", bytes / cs->mbmaxlen);
+ str->length(length);
+ }
+ break;
+
+ case MYSQL_TYPE_GEOMETRY:
+ str->set_ascii(STRING_WITH_LEN("geometry"));
+ break;
+
+ default:
+ str->set_ascii(STRING_WITH_LEN("<unknown type>"));
+ }
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ Check the order variable and print errors if the order is not
+ acceptable according to the current settings.
+
+ @param order The computed order of the conversion needed.
+ @param rli The relay log info data structure: for error reporting.
+ */
+bool is_conversion_ok(int order, Relay_log_info *rli)
+{
+ DBUG_ENTER("is_conversion_ok");
+ bool allow_non_lossy=
+ bit_is_set(slave_type_conversions_options, SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY);
+ bool allow_lossy=
+ bit_is_set(slave_type_conversions_options, SLAVE_TYPE_CONVERSIONS_ALL_LOSSY);
+
+ DBUG_PRINT("enter", ("order: %d, flags:%s%s", order,
+ allow_non_lossy ? " ALL_NON_LOSSY" : "",
+ allow_lossy ? " ALL_LOSSY" : ""));
+ if (order < 0 && !allow_non_lossy)
+ {
+ /* !!! Add error message saying that non-lossy conversions need to be allowed. */
+ DBUG_RETURN(false);
+ }
+
+ if (order > 0 && !allow_lossy)
+ {
+ /* !!! Add error message saying that lossy conversions need to be allowed. */
+ DBUG_RETURN(false);
+ }
+
+ DBUG_RETURN(true);
+}
+
+
+/**
+ Can a type potentially be converted to another type?
+
+ This function check if the types are convertible and what
+ conversion is required.
+
+ If conversion is not possible, and error is printed.
+
+ If conversion is possible:
+
+ - *order will be set to -1 if source type is smaller than target
+ type and a non-lossy conversion can be required. This includes
+ the case where the field types are different but types could
+ actually be converted in either direction.
+
+ - *order will be set to 0 if no conversion is required.
+
+ - *order will be set to 1 if the source type is strictly larger
+ than the target type and that conversion is potentially lossy.
+
+ @param[in] field Target field
+ @param[in] type Source field type
+ @param[in] metadata Source field metadata
+ @param[in] rli Relay log info (for error reporting)
+ @param[in] mflags Flags from the table map event
+ @param[out] order Order between source field and target field
+
+ @return @c true if conversion is possible according to the current
+ settings, @c false if conversion is not possible according to the
+ current setting.
+ */
+static bool
+can_convert_field_to(Field *field,
+ enum_field_types source_type, uint16 metadata,
+ Relay_log_info *rli, uint16 mflags,
+ int *order_var)
+{
+ DBUG_ENTER("can_convert_field_to");
+#ifndef DBUG_OFF
+ char field_type_buf[MAX_FIELD_WIDTH];
+ String field_type(field_type_buf, sizeof(field_type_buf), field->charset());
+ field->sql_type(field_type);
+ DBUG_PRINT("enter", ("field_type: %s, target_type: %d, source_type: %d, source_metadata: 0x%x",
+ field_type.c_ptr(), field->real_type(), source_type, metadata));
+#endif
+ /*
+ If the real type is the same, we need to check the metadata to
+ decide if conversions are allowed.
+ */
+ if (field->real_type() == source_type)
+ {
+ DBUG_PRINT("debug", ("Base types are identical, doing field size comparison"));
+ if (field->compatible_field_size(metadata, rli, mflags, order_var))
+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
+ else
+ DBUG_RETURN(false);
+ }
+ else if (!slave_type_conversions_options)
+ DBUG_RETURN(false);
+
+ /*
+ Here, from and to will always be different. Since the types are
+ different, we cannot use the compatible_field_size() function, but
+ have to rely on hard-coded max-sizes for fields.
+ */
+
+ DBUG_PRINT("debug", ("Base types are different, checking conversion"));
+ switch (source_type) // Source type (on master)
+ {
+ case MYSQL_TYPE_DECIMAL:
+ case MYSQL_TYPE_NEWDECIMAL:
+ case MYSQL_TYPE_FLOAT:
+ case MYSQL_TYPE_DOUBLE:
+ switch (field->real_type())
+ {
+ case MYSQL_TYPE_NEWDECIMAL:
+ /*
+ Then the other type is either FLOAT, DOUBLE, or old style
+ DECIMAL, so we require lossy conversion.
+ */
+ *order_var= 1;
+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
+
+ case MYSQL_TYPE_DECIMAL:
+ case MYSQL_TYPE_FLOAT:
+ case MYSQL_TYPE_DOUBLE:
+ {
+ if (source_type == MYSQL_TYPE_NEWDECIMAL ||
+ source_type == MYSQL_TYPE_DECIMAL)
+ *order_var = 1; // Always require lossy conversions
+ else
+ *order_var= compare_lengths(field, source_type, metadata);
+ DBUG_ASSERT(*order_var != 0);
+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
+ }
+
+ default:
+ DBUG_RETURN(false);
+ }
+ break;
+
+ /*
+ The length comparison check will do the correct job of comparing
+ the field lengths (in bytes) of two integer types.
+ */
+ case MYSQL_TYPE_TINY:
+ case MYSQL_TYPE_SHORT:
+ case MYSQL_TYPE_INT24:
+ case MYSQL_TYPE_LONG:
+ case MYSQL_TYPE_LONGLONG:
+ switch (field->real_type())
+ {
+ case MYSQL_TYPE_TINY:
+ case MYSQL_TYPE_SHORT:
+ case MYSQL_TYPE_INT24:
+ case MYSQL_TYPE_LONG:
+ case MYSQL_TYPE_LONGLONG:
+ *order_var= compare_lengths(field, source_type, metadata);
+ DBUG_ASSERT(*order_var != 0);
+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
+
+ default:
+ DBUG_RETURN(false);
+ }
+ break;
+
+ /*
+ Since source and target type is different, and it is not possible
+ to convert bit types to anything else, this will return false.
+ */
+ case MYSQL_TYPE_BIT:
+ DBUG_RETURN(false);
+
+ /*
+ If all conversions are disabled, it is not allowed to convert
+ between these types. Since the TEXT vs. BINARY is distinguished by
+ the charset, and the charset is not replicated, we cannot
+ currently distinguish between , e.g., TEXT and BLOB.
+ */
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_STRING:
+ case MYSQL_TYPE_VAR_STRING:
+ case MYSQL_TYPE_VARCHAR:
+ switch (field->real_type())
+ {
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_STRING:
+ case MYSQL_TYPE_VAR_STRING:
+ case MYSQL_TYPE_VARCHAR:
+ *order_var= compare_lengths(field, source_type, metadata);
+ /*
+ Here we know that the types are different, so if the order
+ gives that they do not require any conversion, we still need
+ to have non-lossy conversion enabled to allow conversion
+ between different (string) types of the same length.
+ */
+ if (*order_var == 0)
+ *order_var= -1;
+ DBUG_RETURN(is_conversion_ok(*order_var, rli));
+
+ default:
+ DBUG_RETURN(false);
+ }
+ break;
+
+ case MYSQL_TYPE_GEOMETRY:
+ case MYSQL_TYPE_TIMESTAMP:
+ case MYSQL_TYPE_DATE:
+ case MYSQL_TYPE_TIME:
+ case MYSQL_TYPE_DATETIME:
+ case MYSQL_TYPE_YEAR:
+ case MYSQL_TYPE_NEWDATE:
+ case MYSQL_TYPE_NULL:
+ case MYSQL_TYPE_ENUM:
+ case MYSQL_TYPE_SET:
+ DBUG_RETURN(false);
+ }
+ DBUG_RETURN(false); // To keep GCC happy
+}
+
+
+/**
Is the definition compatible with a table?
+ This function will compare the master table with an existing table
+ on the slave and see if they are compatible with respect to the
+ current settings of @c SLAVE_TYPE_CONVERSIONS.
+
+ If the tables are compatible and conversions are required, @c
+ *tmp_table_var will be set to a virtual temporary table with field
+ pointers for the fields that require conversions. This allow simple
+ checking of whether a conversion are to be applied or not.
+
+ If tables are compatible, but no conversions are necessary, @c
+ *tmp_table_var will be set to NULL.
+
+ @param rli_arg[in]
+ Relay log info, for error reporting.
+
+ @param table[in]
+ Table to compare with
+
+ @param tmp_table_var[out]
+ Virtual temporary table for performing conversions, if necessary.
+
+ @retval true Master table is compatible with slave table.
+ @retval false Master table is not compatible with slave table.
*/
-int
-table_def::compatible_with(Relay_log_info const *rli_arg, TABLE *table)
+bool
+table_def::compatible_with(THD *thd, Relay_log_info *rli,
+ TABLE *table, TABLE **conv_table_var)
const
{
/*
We only check the initial columns for the tables.
*/
uint const cols_to_check= min(table->s->fields, size());
- int error= 0;
- Relay_log_info const *rli= const_cast<Relay_log_info*>(rli_arg);
-
- TABLE_SHARE const *const tsh= table->s;
+ TABLE *tmp_table= NULL;
for (uint col= 0 ; col < cols_to_check ; ++col)
{
Field *const field= table->field[col];
- if (field->type() != type(col))
+ int order;
+ if (can_convert_field_to(field, type(col), field_metadata(col), rli, m_flags, &order))
{
- DBUG_ASSERT(col < size() && col < tsh->fields);
- DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
- error= 1;
- char buf[256];
- my_snprintf(buf, sizeof(buf), "Column %d type mismatch - "
- "received type %d, %s.%s has type %d",
- col, type(col), tsh->db.str, tsh->table_name.str,
- field->type());
- rli->report(ERROR_LEVEL, ER_BINLOG_ROW_WRONG_TABLE_DEF,
- ER(ER_BINLOG_ROW_WRONG_TABLE_DEF), buf);
+ DBUG_PRINT("debug", ("Checking column %d -"
+ " field '%s' can be converted - order: %d",
+ col, field->field_name, order));
+ DBUG_ASSERT(order >= -1 && order <= 1);
+
+ /*
+ If order is not 0, a conversion is required, so we need to set
+ up the conversion table.
+ */
+ if (order != 0 && tmp_table == NULL)
+ {
+ /*
+ This will create the full table with all fields. This is
+ necessary to ge the correct field lengths for the record.
+ */
+ tmp_table= create_conversion_table(thd, rli, table);
+ if (tmp_table == NULL)
+ return false;
+ /*
+ Clear all fields up to, but not including, this column.
+ */
+ for (unsigned int i= 0; i < col; ++i)
+ tmp_table->field[i]= NULL;
+ }
+
+ if (order == 0 && tmp_table != NULL)
+ tmp_table->field[col]= NULL;
}
- /*
- Check the slave's field size against that of the master.
- */
- if (!error &&
- !field->compatible_field_size(field_metadata(col), rli_arg))
+ else
{
- error= 1;
- char buf[256];
- my_snprintf(buf, sizeof(buf), "Column %d size mismatch - "
- "master has size %d, %s.%s on slave has size %d."
- " Master's column size should be <= the slave's "
- "column size.", col,
- field->pack_length_from_metadata(m_field_metadata[col]),
- tsh->db.str, tsh->table_name.str,
- field->row_pack_length());
- rli->report(ERROR_LEVEL, ER_BINLOG_ROW_WRONG_TABLE_DEF,
- ER(ER_BINLOG_ROW_WRONG_TABLE_DEF), buf);
+ DBUG_PRINT("debug", ("Checking column %d -"
+ " field '%s' can not be converted",
+ col, field->field_name));
+ DBUG_ASSERT(col < size() && col < table->s->fields);
+ DBUG_ASSERT(table->s->db.str && table->s->table_name.str);
+ const char *db_name= table->s->db.str;
+ const char *tbl_name= table->s->table_name.str;
+ char source_buf[MAX_FIELD_WIDTH];
+ char target_buf[MAX_FIELD_WIDTH];
+ String source_type(source_buf, sizeof(source_buf), field->charset());
+ String target_type(target_buf, sizeof(target_buf), field->charset());
+ show_sql_type(type(col), field_metadata(col), &source_type);
+ field->sql_type(target_type);
+ rli->report(ERROR_LEVEL, ER_SLAVE_CONVERSION_FAILED,
+ ER(ER_SLAVE_CONVERSION_FAILED),
+ col, db_name, tbl_name,
+ source_type.c_ptr(), target_type.c_ptr());
+ return false;
}
}
- return error;
+#ifndef DBUG_OFF
+ if (tmp_table)
+ {
+ for (unsigned int col= 0; col < tmp_table->s->fields; ++col)
+ if (tmp_table->field[col])
+ {
+ char source_buf[MAX_FIELD_WIDTH];
+ char target_buf[MAX_FIELD_WIDTH];
+ String source_type(source_buf, sizeof(source_buf), table->field[col]->charset());
+ String target_type(target_buf, sizeof(target_buf), table->field[col]->charset());
+ tmp_table->field[col]->sql_type(source_type);
+ table->field[col]->sql_type(target_type);
+ DBUG_PRINT("debug", ("Field %s - conversion required."
+ " Source type: '%s', Target type: '%s'",
+ tmp_table->field[col]->field_name,
+ source_type.c_ptr(), target_type.c_ptr()));
+ }
+ }
+#endif
+
+ *conv_table_var= tmp_table;
+ return true;
}
+
+/**
+ Create a conversion table.
+
+ If the function is unable to create the conversion table, an error
+ will be printed and NULL will be returned.
+
+ @return Pointer to conversion table, or NULL if unable to create
+ conversion table.
+ */
+
+TABLE *table_def::create_conversion_table(THD *thd, Relay_log_info *rli, TABLE *target_table) const
+{
+ DBUG_ENTER("table_def::create_conversion_table");
+
+ List<Create_field> field_list;
+
+ for (uint col= 0 ; col < size() ; ++col)
+ {
+ Create_field *field_def=
+ (Create_field*) alloc_root(thd->mem_root, sizeof(Create_field));
+ if (field_list.push_back(field_def))
+ DBUG_RETURN(NULL);
+
+ uint decimals= 0;
+ TYPELIB* interval= NULL;
+ uint pack_length= 0;
+ uint32 max_length=
+ max_display_length_for_field(type(col), field_metadata(col));
+
+ switch(type(col))
+ {
+ int precision;
+ case MYSQL_TYPE_ENUM:
+ case MYSQL_TYPE_SET:
+ interval= static_cast<Field_enum*>(target_table->field[col])->typelib;
+ pack_length= field_metadata(col) & 0x00ff;
+ break;
+
+ case MYSQL_TYPE_NEWDECIMAL:
+ /*
+ The display length of a DECIMAL type is not the same as the
+ length that should be supplied to make_field, so we correct
+ the length here.
+ */
+ precision= field_metadata(col) >> 8;
+ decimals= field_metadata(col) & 0x00ff;
+ max_length=
+ my_decimal_precision_to_length(precision, decimals, FALSE);
+ break;
+
+ case MYSQL_TYPE_DECIMAL:
+ precision= field_metadata(col);
+ decimals= static_cast<Field_num*>(target_table->field[col])->dec;
+ max_length= field_metadata(col);
+ break;
+
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_GEOMETRY:
+ pack_length= field_metadata(col) & 0x00ff;
+ break;
+
+ default:
+ break;
+ }
+
+ DBUG_PRINT("debug", ("sql_type: %d, target_field: '%s', max_length: %d, decimals: %d,"
+ " maybe_null: %d, unsigned_flag: %d, pack_length: %u",
+ type(col), target_table->field[col]->field_name,
+ max_length, decimals, TRUE, FALSE, pack_length));
+ field_def->init_for_tmp_table(type(col),
+ max_length,
+ decimals,
+ maybe_null(col), // maybe_null
+ FALSE, // unsigned_flag
+ pack_length);
+ field_def->charset= target_table->field[col]->charset();
+ field_def->interval= interval;
+ }
+
+ TABLE *conv_table= create_virtual_tmp_table(thd, field_list);
+ if (conv_table == NULL)
+ rli->report(ERROR_LEVEL, ER_SLAVE_CANT_CREATE_CONVERSION,
+ ER(ER_SLAVE_CANT_CREATE_CONVERSION),
+ target_table->s->db.str,
+ target_table->s->table_name.str);
+ DBUG_RETURN(conv_table);
+}
+
+#endif /* MYSQL_CLIENT */
+
+table_def::table_def(unsigned char *types, ulong size,
+ uchar *field_metadata, int metadata_size,
+ uchar *null_bitmap, uint16 flags)
+ : m_size(size), m_type(0), m_field_metadata_size(metadata_size),
+ m_field_metadata(0), m_null_bits(0), m_flags(flags),
+ m_memory(NULL)
+{
+ m_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
+ &m_type, size,
+ &m_field_metadata,
+ size * sizeof(uint16),
+ &m_null_bits, (size + 7) / 8,
+ NULL);
+
+ bzero(m_field_metadata, size * sizeof(uint16));
+
+ if (m_type)
+ memcpy(m_type, types, size);
+ else
+ m_size= 0;
+ /*
+ Extract the data from the table map into the field metadata array
+ iff there is field metadata. The variable metadata_size will be
+ 0 if we are replicating from an older version server since no field
+ metadata was written to the table map. This can also happen if
+ there were no fields in the master that needed extra metadata.
+ */
+ if (m_size && metadata_size)
+ {
+ int index= 0;
+ for (unsigned int i= 0; i < m_size; i++)
+ {
+ switch (m_type[i]) {
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ case MYSQL_TYPE_DOUBLE:
+ case MYSQL_TYPE_FLOAT:
+ {
+ /*
+ These types store a single byte.
+ */
+ m_field_metadata[i]= field_metadata[index];
+ index++;
+ break;
+ }
+ case MYSQL_TYPE_SET:
+ case MYSQL_TYPE_ENUM:
+ case MYSQL_TYPE_STRING:
+ {
+ uint16 x= field_metadata[index++] << 8U; // real_type
+ x+= field_metadata[index++]; // pack or field length
+ m_field_metadata[i]= x;
+ break;
+ }
+ case MYSQL_TYPE_BIT:
+ {
+ uint16 x= field_metadata[index++];
+ x = x + (field_metadata[index++] << 8U);
+ m_field_metadata[i]= x;
+ break;
+ }
+ case MYSQL_TYPE_VARCHAR:
+ {
+ /*
+ These types store two bytes.
+ */
+ char *ptr= (char *)&field_metadata[index];
+ m_field_metadata[i]= uint2korr(ptr);
+ index= index + 2;
+ break;
+ }
+ case MYSQL_TYPE_NEWDECIMAL:
+ {
+ uint16 x= field_metadata[index++] << 8U; // precision
+ x+= field_metadata[index++]; // decimals
+ m_field_metadata[i]= x;
+ break;
+ }
+ default:
+ m_field_metadata[i]= 0;
+ break;
+ }
+ }
+ }
+ if (m_size && null_bitmap)
+ memcpy(m_null_bits, null_bitmap, (m_size + 7) / 8);
+}
+
+
+table_def::~table_def()
+{
+ my_free(m_memory, MYF(0));
+#ifndef DBUG_OFF
+ m_type= 0;
+ m_size= 0;
+#endif
+}
+
diff --git a/sql/rpl_utility.h b/sql/rpl_utility.h
index 1f4ca246ff1..4b9bf3be93f 100644
--- a/sql/rpl_utility.h
+++ b/sql/rpl_utility.h
@@ -21,6 +21,7 @@
#endif
#include "mysql_priv.h"
+#include "mysql_com.h"
class Relay_log_info;
@@ -32,127 +33,24 @@ class Relay_log_info;
- Extract and decode table definition data from the table map event
- Check if table definition in table map is compatible with table
definition on slave
-
- Currently, the only field type data available is an array of the
- type operators that are present in the table map event.
-
- @todo Add type operands to this structure to allow detection of
- difference between, e.g., BIT(5) and BIT(10).
*/
class table_def
{
public:
/**
- Convenience declaration of the type of the field type data in a
- table map event.
- */
- typedef unsigned char field_type;
-
- /**
Constructor.
- @param types Array of types
+ @param types Array of types, each stored as a byte
@param size Number of elements in array 'types'
@param field_metadata Array of extra information about fields
@param metadata_size Size of the field_metadata array
@param null_bitmap The bitmap of fields that can be null
*/
- table_def(field_type *types, ulong size, uchar *field_metadata,
- int metadata_size, uchar *null_bitmap)
- : m_size(size), m_type(0), m_field_metadata_size(metadata_size),
- m_field_metadata(0), m_null_bits(0), m_memory(NULL)
- {
- m_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
- &m_type, size,
- &m_field_metadata,
- size * sizeof(uint16),
- &m_null_bits, (size + 7) / 8,
- NULL);
-
- bzero(m_field_metadata, size * sizeof(uint16));
-
- if (m_type)
- memcpy(m_type, types, size);
- else
- m_size= 0;
- /*
- Extract the data from the table map into the field metadata array
- iff there is field metadata. The variable metadata_size will be
- 0 if we are replicating from an older version server since no field
- metadata was written to the table map. This can also happen if
- there were no fields in the master that needed extra metadata.
- */
- if (m_size && metadata_size)
- {
- int index= 0;
- for (unsigned int i= 0; i < m_size; i++)
- {
- switch (m_type[i]) {
- case MYSQL_TYPE_TINY_BLOB:
- case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_MEDIUM_BLOB:
- case MYSQL_TYPE_LONG_BLOB:
- case MYSQL_TYPE_DOUBLE:
- case MYSQL_TYPE_FLOAT:
- {
- /*
- These types store a single byte.
- */
- m_field_metadata[i]= field_metadata[index];
- index++;
- break;
- }
- case MYSQL_TYPE_SET:
- case MYSQL_TYPE_ENUM:
- case MYSQL_TYPE_STRING:
- {
- uint16 x= field_metadata[index++] << 8U; // real_type
- x+= field_metadata[index++]; // pack or field length
- m_field_metadata[i]= x;
- break;
- }
- case MYSQL_TYPE_BIT:
- {
- uint16 x= field_metadata[index++];
- x = x + (field_metadata[index++] << 8U);
- m_field_metadata[i]= x;
- break;
- }
- case MYSQL_TYPE_VARCHAR:
- {
- /*
- These types store two bytes.
- */
- char *ptr= (char *)&field_metadata[index];
- m_field_metadata[i]= uint2korr(ptr);
- index= index + 2;
- break;
- }
- case MYSQL_TYPE_NEWDECIMAL:
- {
- uint16 x= field_metadata[index++] << 8U; // precision
- x+= field_metadata[index++]; // decimals
- m_field_metadata[i]= x;
- break;
- }
- default:
- m_field_metadata[i]= 0;
- break;
- }
- }
- }
- if (m_size && null_bitmap)
- memcpy(m_null_bits, null_bitmap, (m_size + 7) / 8);
- }
+ table_def(unsigned char *types, ulong size, uchar *field_metadata,
+ int metadata_size, uchar *null_bitmap, uint16 flags);
- ~table_def() {
- my_free(m_memory, MYF(0));
-#ifndef DBUG_OFF
- m_type= 0;
- m_size= 0;
-#endif
- }
+ ~table_def();
/**
Return the number of fields there is type data for.
@@ -171,10 +69,40 @@ public:
<code>index</code>. Currently, only the type identifier is
returned.
*/
- field_type type(ulong index) const
+ enum_field_types type(ulong index) const
{
DBUG_ASSERT(index < m_size);
- return m_type[index];
+ /*
+ If the source type is MYSQL_TYPE_STRING, it can in reality be
+ either MYSQL_TYPE_STRING, MYSQL_TYPE_ENUM, or MYSQL_TYPE_SET, so
+ we might need to modify the type to get the real type.
+ */
+ enum_field_types source_type= static_cast<enum_field_types>(m_type[index]);
+ uint16 source_metadata= m_field_metadata[index];
+ switch (source_type)
+ {
+ case MYSQL_TYPE_STRING:
+ {
+ int real_type= source_metadata >> 8;
+ if (real_type == MYSQL_TYPE_ENUM || real_type == MYSQL_TYPE_SET)
+ source_type= static_cast<enum_field_types>(real_type);
+ break;
+ }
+
+ /*
+ This type has not been used since before row-based replication,
+ so we can safely assume that it really is MYSQL_TYPE_NEWDATE.
+ */
+ case MYSQL_TYPE_DATE:
+ source_type= MYSQL_TYPE_NEWDATE;
+ break;
+
+ default:
+ /* Do nothing */
+ break;
+ }
+
+ return source_type;
}
@@ -226,26 +154,62 @@ public:
with it.
A table definition is compatible with a table if:
- - the columns types of the table definition is a (not
- necessarily proper) prefix of the column type of the table, or
- - the other way around
+ - The columns types of the table definition is a (not
+ necessarily proper) prefix of the column type of the table.
+
+ - The other way around.
+ - Each column on the master that also exists on the slave can be
+ converted according to the current settings of @c
+ SLAVE_TYPE_CONVERSIONS.
+
+ @param thd
@param rli Pointer to relay log info
@param table Pointer to table to compare with.
+ @param[out] tmp_table_var Pointer to temporary table for holding
+ conversion table.
+
@retval 1 if the table definition is not compatible with @c table
@retval 0 if the table definition is compatible with @c table
*/
#ifndef MYSQL_CLIENT
- int compatible_with(Relay_log_info const *rli, TABLE *table) const;
+ bool compatible_with(THD *thd, Relay_log_info *rli, TABLE *table,
+ TABLE **conv_table_var) const;
+
+ /**
+ Create a virtual in-memory temporary table structure.
+
+ The table structure has records and field array so that a row can
+ be unpacked into the record for further processing.
+
+ In the virtual table, each field that requires conversion will
+ have a non-NULL value, while fields that do not require
+ conversion will have a NULL value.
+
+ Some information that is missing in the events, such as the
+ character set for string types, are taken from the table that the
+ field is going to be pushed into, so the target table that the data
+ eventually need to be pushed into need to be supplied.
+
+ @param thd Thread to allocate memory from.
+ @param rli Relay log info structure, for error reporting.
+ @param target_table Target table for fields.
+
+ @return A pointer to a temporary table with memory allocated in the
+ thread's memroot, NULL if the table could not be created
+ */
+ TABLE *create_conversion_table(THD *thd, Relay_log_info *rli, TABLE *target_table) const;
#endif
+
private:
ulong m_size; // Number of elements in the types array
- field_type *m_type; // Array of type descriptors
+ unsigned char *m_type; // Array of type descriptors
uint m_field_metadata_size;
uint16 *m_field_metadata;
uchar *m_null_bits;
+ uint16 m_flags; // Table flags
uchar *m_memory;
};
@@ -260,6 +224,7 @@ struct RPL_TABLE_LIST
{
bool m_tabledef_valid;
table_def m_tabledef;
+ TABLE *m_conv_table;
};
diff --git a/sql/scheduler.h b/sql/scheduler.h
index 46bbd300cbb..e7916031a27 100644
--- a/sql/scheduler.h
+++ b/sql/scheduler.h
@@ -1,3 +1,6 @@
+#ifndef SCHEDULER_INCLUDED
+#define SCHEDULER_INCLUDED
+
/* Copyright (C) 2007 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -58,3 +61,5 @@ enum pool_command_op
class thd_scheduler
{};
+
+#endif /* SCHEDULER_INCLUDED */
diff --git a/sql/set_var.cc b/sql/set_var.cc
index b80bdde9670..54c305fa236 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -92,6 +92,33 @@ TYPELIB delay_key_write_typelib=
delay_key_write_type_names, NULL
};
+/**
+ SLAVE_TYPE_CONVERSIONS variable.
+
+ Definition is equivalent to
+ @code
+ SET('ALL_NON_LOSSY', 'ALL_LOSSY')
+ @endcode
+ */
+const char *slave_type_conversions_type_name[]= {
+ "ALL_LOSSY",
+ "ALL_NON_LOSSY",
+ NullS
+};
+
+unsigned int slave_type_conversions_type_length[]= {
+ sizeof("ALL_LOSSY")-1,
+ sizeof("ALL_NON_LOSSY")-1,
+ 0
+};
+
+TYPELIB slave_type_conversions_typelib=
+{
+ array_elements(slave_type_conversions_type_name)-1, "",
+ slave_type_conversions_type_name,
+ slave_type_conversions_type_length
+};
+
const char *slave_exec_mode_names[]=
{ "STRICT", "IDEMPOTENT", NullS };
static const unsigned int slave_exec_mode_names_len[]=
@@ -324,9 +351,6 @@ static sys_var_const sys_locked_in_memory(&vars, "locked_in_memory",
static sys_var_const sys_log_bin(&vars, "log_bin",
OPT_GLOBAL, SHOW_BOOL,
(uchar*) &opt_bin_log);
-static sys_var_trust_routine_creators
-sys_trust_routine_creators(&vars, "log_bin_trust_routine_creators",
- &trust_function_creators);
static sys_var_bool_ptr
sys_trust_function_creators(&vars, "log_bin_trust_function_creators",
&trust_function_creators);
@@ -580,6 +604,12 @@ static sys_var_set_slave_mode slave_exec_mode(&vars,
&slave_exec_mode_options,
&slave_exec_mode_typelib,
0);
+static sys_var_set slave_type_conversions(&vars,
+ "slave_type_conversions",
+ &slave_type_conversions_options,
+ &slave_type_conversions_typelib,
+ 0);
+
static sys_var_long_ptr sys_slow_launch_time(&vars, "slow_launch_time",
&slow_launch_time);
static sys_var_thd_ulong sys_sort_buffer(&vars, "sort_buffer_size",
@@ -612,8 +642,6 @@ sys_updatable_views_with_limit(&vars, "updatable_views_with_limit",
&SV::updatable_views_with_limit,
&updatable_views_with_limit_typelib);
-static sys_var_thd_table_type sys_table_type(&vars, "table_type",
- &SV::table_plugin);
static sys_var_thd_storage_engine sys_storage_engine(&vars, "storage_engine",
&SV::table_plugin);
static sys_var_bool_ptr sys_sync_frm(&vars, "sync_frm", &opt_sync_frm);
@@ -1261,7 +1289,6 @@ bool sys_var_thd_binlog_format::check(THD *thd, set_var *var) {
return result;
}
-
bool sys_var_thd_binlog_format::is_readonly() const
{
/*
@@ -1541,6 +1568,23 @@ static bool get_unsigned(THD *thd, set_var *var, ulonglong user_max,
}
+bool sys_var_uint_ptr::check(THD *thd, set_var *var)
+{
+ var->save_result.ulong_value= (ulong) var->value->val_uint();
+ return 0;
+}
+
+bool sys_var_uint_ptr::update(THD *thd, set_var *var)
+{
+ *value= (uint) var->save_result.ulong_value;
+ return 0;
+}
+
+void sys_var_uint_ptr::set_default(THD *thd, enum_var_type type)
+{
+ *value= (uint) option_limits->def_value;
+}
+
sys_var_long_ptr::
sys_var_long_ptr(sys_var_chain *chain, const char *name_arg, ulong *value_ptr_arg,
sys_after_update_func after_update_arg)
@@ -2446,9 +2490,9 @@ bool sys_var_log_state::update(THD *thd, set_var *var)
bool res;
if (this == &sys_var_log)
- WARN_DEPRECATED(thd, "7.0", "@@log", "'@@general_log'");
+ WARN_DEPRECATED(thd, 7, 0, "@@log", "'@@general_log'");
else if (this == &sys_var_log_slow)
- WARN_DEPRECATED(thd, "7.0", "@@log_slow_queries", "'@@slow_query_log'");
+ WARN_DEPRECATED(thd, 7, 0, "@@log_slow_queries", "'@@slow_query_log'");
pthread_mutex_lock(&LOCK_global_system_variables);
if (!var->save_result.ulong_value)
@@ -2465,9 +2509,9 @@ bool sys_var_log_state::update(THD *thd, set_var *var)
void sys_var_log_state::set_default(THD *thd, enum_var_type type)
{
if (this == &sys_var_log)
- WARN_DEPRECATED(thd, "7.0", "@@log", "'@@general_log'");
+ WARN_DEPRECATED(thd, 7, 0, "@@log", "'@@general_log'");
else if (this == &sys_var_log_slow)
- WARN_DEPRECATED(thd, "7.0", "@@log_slow_queries", "'@@slow_query_log'");
+ WARN_DEPRECATED(thd, 7, 0, "@@log_slow_queries", "'@@slow_query_log'");
pthread_mutex_lock(&LOCK_global_system_variables);
logger.deactivate_log_handler(thd, log_type);
@@ -3061,6 +3105,15 @@ static bool set_option_autocommit(THD *thd, set_var *var)
ulonglong org_options= thd->options;
+ /*
+ If we are setting AUTOCOMMIT=1 and it was not already 1, then we
+ need to commit any outstanding transactions.
+ */
+ if (var->save_result.ulong_value != 0 &&
+ (thd->options & OPTION_NOT_AUTOCOMMIT) &&
+ ha_commit(thd))
+ return 1;
+
if (var->save_result.ulong_value != 0)
thd->options&= ~((sys_var_thd_bit*) var->var)->bit_flag;
else
@@ -3074,8 +3127,6 @@ static bool set_option_autocommit(THD *thd, set_var *var)
thd->options&= ~(ulonglong) (OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
- if (ha_commit(thd))
- return 1;
}
else
{
@@ -3771,24 +3822,6 @@ bool sys_var_thd_storage_engine::update(THD *thd, set_var *var)
return 0;
}
-void sys_var_thd_table_type::warn_deprecated(THD *thd)
-{
- WARN_DEPRECATED(thd, "6.0", "@@table_type", "'@@storage_engine'");
-}
-
-void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type)
-{
- warn_deprecated(thd);
- sys_var_thd_storage_engine::set_default(thd, type);
-}
-
-bool sys_var_thd_table_type::update(THD *thd, set_var *var)
-{
- warn_deprecated(thd);
- return sys_var_thd_storage_engine::update(thd, var);
-}
-
-
/****************************************************************************
Functions to handle sql_mode
****************************************************************************/
@@ -4123,25 +4156,6 @@ bool process_key_caches(process_key_cache_t func)
return 0;
}
-
-void sys_var_trust_routine_creators::warn_deprecated(THD *thd)
-{
- WARN_DEPRECATED(thd, "6.0", "@@log_bin_trust_routine_creators",
- "'@@log_bin_trust_function_creators'");
-}
-
-void sys_var_trust_routine_creators::set_default(THD *thd, enum_var_type type)
-{
- warn_deprecated(thd);
- sys_var_bool_ptr::set_default(thd, type);
-}
-
-bool sys_var_trust_routine_creators::update(THD *thd, set_var *var)
-{
- warn_deprecated(thd);
- return sys_var_bool_ptr::update(thd, var);
-}
-
bool sys_var_opt_readonly::update(THD *thd, set_var *var)
{
bool result;
diff --git a/sql/set_var.h b/sql/set_var.h
index fa747107870..1bc97916876 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -1,3 +1,6 @@
+#ifndef SET_VAR_INCLUDED
+#define SET_VAR_INCLUDED
+
/* Copyright (C) 2002-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -32,6 +35,7 @@ typedef struct my_locale_st MY_LOCALE;
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib,
optimizer_switch_typelib, slave_exec_mode_typelib;
+extern TYPELIB slave_type_conversions_typelib;
typedef int (*sys_check_func)(THD *, set_var *);
typedef bool (*sys_update_func)(THD *, set_var *);
@@ -172,6 +176,27 @@ public:
{ return (uchar*) value; }
};
+/**
+ Unsigned int system variable class
+ */
+class sys_var_uint_ptr :public sys_var
+{
+public:
+ sys_var_uint_ptr(sys_var_chain *chain, const char *name_arg,
+ uint *value_ptr_arg,
+ sys_after_update_func after_update_arg= NULL)
+ :sys_var(name_arg, after_update_arg),
+ value(value_ptr_arg)
+ { chain_sys_var(chain); }
+ bool check(THD *thd, set_var *var);
+ bool update(THD *thd, set_var *var);
+ void set_default(THD *thd, enum_var_type type);
+ SHOW_TYPE show_type() { return SHOW_INT; }
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ { return (uchar*) value; }
+private:
+ uint *value;
+};
/*
A global ulong variable that is protected by LOCK_global_system_variables
@@ -587,18 +612,6 @@ public:
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
-class sys_var_thd_table_type :public sys_var_thd_storage_engine
-{
-public:
- sys_var_thd_table_type(sys_var_chain *chain, const char *name_arg,
- plugin_ref SV::*offset_arg)
- :sys_var_thd_storage_engine(chain, name_arg, offset_arg)
- {}
- void warn_deprecated(THD *thd);
- void set_default(THD *thd, enum_var_type type);
- bool update(THD *thd, set_var *var);
-};
-
class sys_var_thd_bit :public sys_var_thd
{
sys_check_func check_func;
@@ -1188,19 +1201,6 @@ public:
};
-class sys_var_trust_routine_creators :public sys_var_bool_ptr
-{
- /* We need a derived class only to have a warn_deprecated() */
-public:
- sys_var_trust_routine_creators(sys_var_chain *chain,
- const char *name_arg, my_bool *value_arg) :
- sys_var_bool_ptr(chain, name_arg, value_arg) {};
- void warn_deprecated(THD *thd);
- void set_default(THD *thd, enum_var_type type);
- bool update(THD *thd, set_var *var);
-};
-
-
/**
Handler for setting the system variable --read-only.
*/
@@ -1465,3 +1465,5 @@ void free_key_cache(const char *name, KEY_CACHE *key_cache);
bool process_key_caches(process_key_cache_t func);
void delete_elements(I_List<NAMED_LIST> *list,
void (*free_element)(const char*, uchar*));
+
+#endif /* SET_VAR_INCLUDED */
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index a17ad94ba82..c3d9235bc30 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -4299,16 +4299,16 @@ ER_SLAVE_NOT_RUNNING
ER_BAD_SLAVE
dan "Denne server er ikke konfigureret som slave. Ret in config-filen eller brug kommandoen CHANGE MASTER TO"
nla "De server is niet geconfigureerd als slave, fix in configuratie bestand of met CHANGE MASTER TO"
- eng "The server is not configured as slave; fix in config file or with CHANGE MASTER TO"
+ eng "The server is not configured as slave; fix with CHANGE MASTER TO"
fre "Le server n'est pas configuré comme un esclave, changez le fichier de configuration ou utilisez CHANGE MASTER TO"
- ger "Der Server ist nicht als Slave konfiguriert. Bitte in der Konfigurationsdatei oder mittels CHANGE MASTER TO beheben"
+ ger "Der Server ist nicht als Slave konfiguriert. Bitte mittels CHANGE MASTER TO beheben"
ita "Il server non e' configurato come 'slave', correggere il file di configurazione cambiando CHANGE MASTER TO"
por "O servidor não está configurado como 'slave'. Acerte o arquivo de configuração ou use CHANGE MASTER TO"
- rus "üÔÏÔ ÓÅÒ×ÅÒ ÎÅ ÎÁÓÔÒÏÅÎ ËÁË ÐÏÄÞÉÎÅÎÎÙÊ. ÷ÎÅÓÉÔÅ ÉÓÐÒÁ×ÌÅÎÉÑ × ËÏÎÆÉÇÕÒÁÃÉÏÎÎÏÍ ÆÁÊÌÅ ÉÌÉ Ó ÐÏÍÏÝØÀ CHANGE MASTER TO"
+ rus "üÔÏÔ ÓÅÒ×ÅÒ ÎÅ ÎÁÓÔÒÏÅÎ ËÁË ÐÏÄÞÉÎÅÎÎÙÊ. éÓÐÒÁ×ØÔÅ Ó ÐÏÍÏÝØÀ CHANGE MASTER TO"
serbian "Server nije konfigurisan kao podreðeni server, ispravite konfiguracioni file ili na njemu izvršite komandu 'CHANGE MASTER TO'"
spa "El servidor no está configurado como esclavo, edite el archivo config file o con CHANGE MASTER TO"
swe "Servern är inte konfigurerade som en replikationsslav. Ändra konfigurationsfilen eller gör CHANGE MASTER TO"
- ukr "óÅÒ×ÅÒ ÎÅ ÚËÏÎƦÇÕÒÏ×ÁÎÏ ÑË Ð¦ÄÌÅÇÌÉÊ, ×ÉÐÒÁ×ÔÅ ÃÅ Õ ÆÁÊ̦ ËÏÎƦÇÕÒÁæ§ ÁÂÏ Ú CHANGE MASTER TO"
+ ukr "óÅÒ×ÅÒ ÎÅ ÚËÏÎƦÇÕÒÏ×ÁÎÏ ÑË Ð¦ÄÌÅÇÌÉÊ, ×ÉÐÒÁ×ÔÅ ÃÅ ÚÁ ÄÏÐÏÍÏÇÏÀ CHANGE MASTER TO"
ER_MASTER_INFO
eng "Could not initialize master info structure; more error messages can be found in the MySQL error log"
fre "Impossible d'initialiser les structures d'information de maître, vous trouverez des messages d'erreur supplémentaires dans le journal des erreurs de MySQL"
@@ -4620,7 +4620,7 @@ ER_USER_LIMIT_REACHED 42000
swe "Användare '%-.64s' har överskridit '%s' (nuvarande värde: %ld)"
ER_SPECIFIC_ACCESS_DENIED_ERROR 42000
nla "Toegang geweigerd. U moet het %-.128s privilege hebben voor deze operatie"
- eng "Access denied; you need the %-.128s privilege for this operation"
+ eng "Access denied; you need (at least one of) the %-.128s privilege(s) for this operation"
ger "Kein Zugriff. Hierfür wird die Berechtigung %-.128s benötigt"
ita "Accesso non consentito. Serve il privilegio %-.128s per questa operazione"
por "Acesso negado. Você precisa o privilégio %-.128s para essa operação"
@@ -6163,6 +6163,9 @@ ER_SLAVE_HEARTBEAT_FAILURE
ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
eng "The requested value for the heartbeat period %s %s"
+ER_SLAVE_IGNORE_SERVER_IDS
+ eng "The requested server id %d clashes with the slave startup option --replicate-same-server-id"
+
ER_NDB_REPLICATION_SCHEMA_ERROR
eng "Bad schema for mysql.ndb_replication table. Message: %-.64s"
ER_CONFLICT_FN_PARSE_ERROR
@@ -6213,3 +6216,8 @@ ER_DEBUG_SYNC_TIMEOUT
ER_DEBUG_SYNC_HIT_LIMIT
eng "debug sync point hit limit reached"
ger "Debug Sync Point Hit Limit erreicht"
+
+ER_SLAVE_CONVERSION_FAILED
+ eng "Column %d of table '%-.192s.%-.192s' cannot be converted from type '%-.32s' to type '%-.32s'"
+ER_SLAVE_CANT_CREATE_CONVERSION
+ eng "Can't create conversion table for table '%-.192s.%-.192s'"
diff --git a/sql/slave.cc b/sql/slave.cc
index f6660e5a5c8..8e69066ed9b 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -40,6 +40,7 @@
#include <errmsg.h>
#include <mysqld_error.h>
#include <mysys_err.h>
+#include "rpl_handler.h"
#ifdef HAVE_REPLICATION
@@ -48,6 +49,10 @@
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
#define MAX_SLAVE_RETRY_PAUSE 5
+/*
+ a parameter of sql_slave_killed() to defer the killed status
+*/
+#define SLAVE_WAIT_GROUP_DONE 60
bool use_slave_mask = 0;
MY_BITMAP slave_error_mask;
char slave_skip_error_names[SHOW_VAR_FUNC_BUFF_SIZE];
@@ -69,6 +74,8 @@ ulonglong relay_log_space_limit = 0;
int disconnect_slave_event_count = 0, abort_slave_event_count = 0;
int events_till_abort = -1;
+static pthread_key(Master_info*, RPL_MASTER_INFO);
+
enum enum_slave_reconnect_actions
{
SLAVE_RECON_ACT_REG= 0,
@@ -137,9 +144,6 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
bool reconnect, bool suppress_warnings);
static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
void* thread_killed_arg);
-static int request_table_dump(MYSQL* mysql, const char* db, const char* table);
-static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
- const char* table_name, bool overwrite);
static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi);
static Log_event* next_event(Relay_log_info* rli);
static int queue_event(Master_info* mi,const char* buf,ulong event_len);
@@ -220,6 +224,7 @@ void unlock_slave_threads(Master_info* mi)
int init_slave()
{
DBUG_ENTER("init_slave");
+ int error= 0;
/*
This is called when mysqld starts. Before client connections are
@@ -231,7 +236,10 @@ int init_slave()
TODO: re-write this to interate through the list of files
for multi-master
*/
- active_mi= new Master_info;
+ active_mi= new Master_info(relay_log_recovery);
+
+ if (pthread_key_create(&RPL_MASTER_INFO, NULL))
+ goto err;
/*
If --slave-skip-errors=... was not used, the string value for the
@@ -250,22 +258,21 @@ int init_slave()
if (!active_mi)
{
sql_print_error("Failed to allocate memory for the master info structure");
+ error= 1;
goto err;
}
if (init_master_info(active_mi,master_info_file,relay_log_info_file,
- !master_host, (SLAVE_IO | SLAVE_SQL)))
+ 1, (SLAVE_IO | SLAVE_SQL)))
{
sql_print_error("Failed to initialize the master info structure");
+ error= 1;
goto err;
}
- if (server_id && !master_host && active_mi->host[0])
- master_host= active_mi->host;
-
/* If server id is not set, start_slave_thread() will say it */
- if (master_host && !opt_skip_slave_start)
+ if (active_mi->host[0] && !opt_skip_slave_start)
{
if (start_slave_threads(1 /* need mutex */,
0 /* no wait for start*/,
@@ -275,18 +282,69 @@ int init_slave()
SLAVE_IO | SLAVE_SQL))
{
sql_print_error("Failed to create slave threads");
+ error= 1;
goto err;
}
}
- pthread_mutex_unlock(&LOCK_active_mi);
- DBUG_RETURN(0);
err:
pthread_mutex_unlock(&LOCK_active_mi);
- DBUG_RETURN(1);
+ DBUG_RETURN(error);
}
+/*
+ Updates the master info based on the information stored in the
+ relay info and ignores relay logs previously retrieved by the IO
+ thread, which thus starts fetching again based on to the
+ group_master_log_pos and group_master_log_name. Eventually, the old
+ relay logs will be purged by the normal purge mechanism.
+
+ In the feature, we should improve this routine in order to avoid throwing
+ away logs that are safely stored in the disk. Note also that this recovery
+ routine relies on the correctness of the relay-log.info and only tolerates
+ coordinate problems in master.info.
+
+ In this function, there is no need for a mutex as the caller
+ (i.e. init_slave) already has one acquired.
+
+ Specifically, the following structures are updated:
+
+ 1 - mi->master_log_pos <-- rli->group_master_log_pos
+ 2 - mi->master_log_name <-- rli->group_master_log_name
+ 3 - It moves the relay log to the new relay log file, by
+ rli->group_relay_log_pos <-- BIN_LOG_HEADER_SIZE;
+ rli->event_relay_log_pos <-- BIN_LOG_HEADER_SIZE;
+ rli->group_relay_log_name <-- rli->relay_log.get_log_fname();
+ rli->event_relay_log_name <-- rli->relay_log.get_log_fname();
+
+ If there is an error, it returns (1), otherwise returns (0).
+ */
+int init_recovery(Master_info* mi, const char** errmsg)
+{
+ DBUG_ENTER("init_recovery");
+
+ Relay_log_info *rli= &mi->rli;
+ if (rli->group_master_log_name[0])
+ {
+ mi->master_log_pos= max(BIN_LOG_HEADER_SIZE,
+ rli->group_master_log_pos);
+ strmake(mi->master_log_name, rli->group_master_log_name,
+ sizeof(mi->master_log_name)-1);
+
+ sql_print_warning("Recovery from master pos %ld and file %s.",
+ (ulong) mi->master_log_pos, mi->master_log_name);
+
+ strmake(rli->group_relay_log_name, rli->relay_log.get_log_fname(),
+ sizeof(rli->group_relay_log_name)-1);
+ strmake(rli->event_relay_log_name, rli->relay_log.get_log_fname(),
+ sizeof(mi->rli.event_relay_log_name)-1);
+
+ rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE;
+ }
+ DBUG_RETURN(0);
+}
+
/**
Convert slave skip errors bitmap into a printable string.
*/
@@ -595,11 +653,15 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock,
DBUG_PRINT("sleep",("Waiting for slave thread to start"));
const char* old_msg = thd->enter_cond(start_cond,cond_lock,
"Waiting for slave thread to start");
- pthread_cond_wait(start_cond,cond_lock);
+ pthread_cond_wait(start_cond, cond_lock);
thd->exit_cond(old_msg);
pthread_mutex_lock(cond_lock); // re-acquire it as exit_cond() released
if (thd->killed)
+ {
+ if (start_lock)
+ pthread_mutex_unlock(start_lock);
DBUG_RETURN(thd->killed_errno());
+ }
}
}
if (start_lock)
@@ -730,44 +792,92 @@ static bool io_slave_killed(THD* thd, Master_info* mi)
DBUG_RETURN(mi->abort_slave || abort_loop || thd->killed);
}
+/**
+ The function analyzes a possible killed status and makes
+ a decision whether to accept it or not.
+ Normally upon accepting the sql thread goes to shutdown.
+ In the event of deffering decision @rli->last_event_start_time waiting
+ timer is set to force the killed status be accepted upon its expiration.
+
+ @param thd pointer to a THD instance
+ @param rli pointer to Relay_log_info instance
+ @return TRUE the killed status is recognized, FALSE a possible killed
+ status is deferred.
+*/
static bool sql_slave_killed(THD* thd, Relay_log_info* rli)
{
+ bool ret= FALSE;
DBUG_ENTER("sql_slave_killed");
DBUG_ASSERT(rli->sql_thd == thd);
DBUG_ASSERT(rli->slave_running == 1);// tracking buffer overrun
if (abort_loop || thd->killed || rli->abort_slave)
{
- if (rli->abort_slave && rli->is_in_group() &&
- thd->transaction.all.modified_non_trans_table)
- DBUG_RETURN(0);
- /*
- If we are in an unsafe situation (stopping could corrupt replication),
- we give one minute to the slave SQL thread of grace before really
- terminating, in the hope that it will be able to read more events and
- the unsafe situation will soon be left. Note that this one minute starts
- from the last time anything happened in the slave SQL thread. So it's
- really one minute of idleness, we don't timeout if the slave SQL thread
- is actively working.
- */
- if (rli->last_event_start_time == 0)
- DBUG_RETURN(1);
- DBUG_PRINT("info", ("Slave SQL thread is in an unsafe situation, giving "
- "it some grace period"));
- if (difftime(time(0), rli->last_event_start_time) > 60)
+ if (thd->transaction.all.modified_non_trans_table && rli->is_in_group())
{
- rli->report(ERROR_LEVEL, 0,
- "SQL thread had to stop in an unsafe situation, in "
- "the middle of applying updates to a "
- "non-transactional table without any primary key. "
- "There is a risk of duplicate updates when the slave "
- "SQL thread is restarted. Please check your tables' "
- "contents after restart.");
- DBUG_RETURN(1);
+ char msg_stopped[]=
+ "... The slave SQL is stopped, leaving the current group "
+ "of events unfinished with a non-transaction table changed. "
+ "If the group consists solely of Row-based events, you can try "
+ "restarting the slave with --slave-exec-mode=IDEMPOTENT, which "
+ "ignores duplicate key, key not found, and similar errors (see "
+ "documentation for details).";
+
+ if (rli->abort_slave)
+ {
+ DBUG_PRINT("info", ("Slave SQL thread is being stopped in the middle of"
+ " a group having updated a non-trans table, giving"
+ " it some grace period"));
+
+ /*
+ Slave sql thread shutdown in face of unfinished group modified
+ Non-trans table is handled via a timer. The slave may eventually
+ give out to complete the current group and in that case there
+ might be issues at consequent slave restart, see the error message.
+ WL#2975 offers a robust solution requiring to store the last exectuted
+ event's coordinates along with the group's coordianates
+ instead of waiting with @c last_event_start_time the timer.
+ */
+
+ if (rli->last_event_start_time == 0)
+ rli->last_event_start_time= my_time(0);
+ ret= difftime(my_time(0), rli->last_event_start_time) <=
+ SLAVE_WAIT_GROUP_DONE ? FALSE : TRUE;
+
+ DBUG_EXECUTE_IF("stop_slave_middle_group",
+ DBUG_EXECUTE_IF("incomplete_group_in_relay_log",
+ ret= TRUE;);); // time is over
+
+ if (ret == 0)
+ {
+ rli->report(WARNING_LEVEL, 0,
+ "slave SQL thread is being stopped in the middle "
+ "of applying of a group having updated a non-transaction "
+ "table; waiting for the group completion ... ");
+ }
+ else
+ {
+ rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER(ER_SLAVE_FATAL_ERROR), msg_stopped);
+ }
+ }
+ else
+ {
+ ret= TRUE;
+ rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, ER(ER_SLAVE_FATAL_ERROR),
+ msg_stopped);
+ }
+ }
+ else
+ {
+ ret= TRUE;
}
}
- DBUG_RETURN(0);
+ if (ret)
+ rli->last_event_start_time= 0;
+
+ DBUG_RETURN(ret);
}
@@ -860,6 +970,115 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val)
DBUG_RETURN(1);
}
+int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val)
+{
+ char buf[16];
+ DBUG_ENTER("init_floatvar_from_file");
+
+
+ if (my_b_gets(f, buf, sizeof(buf)))
+ {
+ if (sscanf(buf, "%f", var) != 1)
+ DBUG_RETURN(1);
+ else
+ DBUG_RETURN(0);
+ }
+ else if (default_val != 0.0)
+ {
+ *var = default_val;
+ DBUG_RETURN(0);
+ }
+ DBUG_RETURN(1);
+}
+
+
+/**
+ A master info read method
+
+ This function is called from @c init_master_info() along with
+ relatives to restore some of @c active_mi members.
+ Particularly, this function is responsible for restoring
+ IGNORE_SERVER_IDS list of servers whose events the slave is
+ going to ignore (to not log them in the relay log).
+ Items being read are supposed to be decimal output of values of a
+ type shorter or equal of @c long and separated by the single space.
+
+ @param arr @c DYNAMIC_ARRAY pointer to storage for servers id
+ @param f @c IO_CACHE pointer to the source file
+
+ @retval 0 All OK
+ @retval non-zero An error
+*/
+
+int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f)
+{
+ int ret= 0;
+ char buf[16 * (sizeof(long)*4 + 1)]; // static buffer to use most of times
+ char *buf_act= buf; // actual buffer can be dynamic if static is short
+ char *token, *last;
+ uint num_items; // number of items of `arr'
+ size_t read_size;
+ DBUG_ENTER("init_dynarray_intvar_from_file");
+
+ if ((read_size= my_b_gets(f, buf_act, sizeof(buf))) == 0)
+ {
+ return 0; // no line in master.info
+ }
+ if (read_size + 1 == sizeof(buf) && buf[sizeof(buf) - 2] != '\n')
+ {
+ /*
+ short read happend; allocate sufficient memory and make the 2nd read
+ */
+ char buf_work[(sizeof(long)*3 + 1)*16];
+ memcpy(buf_work, buf, sizeof(buf_work));
+ num_items= atoi(strtok_r(buf_work, " ", &last));
+ size_t snd_size;
+ /*
+ max size lower bound approximate estimation bases on the formula:
+ (the items number + items themselves) *
+ (decimal size + space) - 1 + `\n' + '\0'
+ */
+ size_t max_size= (1 + num_items) * (sizeof(long)*3 + 1) + 1;
+ buf_act= (char*) my_malloc(max_size, MYF(MY_WME));
+ memcpy(buf_act, buf, read_size);
+ snd_size= my_b_gets(f, buf_act + read_size, max_size - read_size);
+ if (snd_size == 0 ||
+ (snd_size + 1 == max_size - read_size) && buf[max_size - 2] != '\n')
+ {
+ /*
+ failure to make the 2nd read or short read again
+ */
+ ret= 1;
+ goto err;
+ }
+ }
+ token= strtok_r(buf_act, " ", &last);
+ if (token == NULL)
+ {
+ ret= 1;
+ goto err;
+ }
+ num_items= atoi(token);
+ for (uint i=0; i < num_items; i++)
+ {
+ token= strtok_r(NULL, " ", &last);
+ if (token == NULL)
+ {
+ ret= 1;
+ goto err;
+ }
+ else
+ {
+ ulong val= atol(token);
+ insert_dynamic(arr, (uchar *) &val);
+ }
+ }
+err:
+ if (buf_act != buf)
+ my_free(buf_act, MYF(0));
+ DBUG_RETURN(ret);
+}
+
/*
Check if the error is caused by network.
@@ -1028,7 +1247,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
(master_res= mysql_store_result(mysql)) &&
(master_row= mysql_fetch_row(master_res)))
{
- if ((::server_id == strtoul(master_row[1], 0, 10)) &&
+ if ((::server_id == (mi->master_id= strtoul(master_row[1], 0, 10))) &&
!mi->rli.replicate_same_server_id)
{
errmsg= "The slave I/O thread stops because master and slave have equal \
@@ -1066,6 +1285,13 @@ maybe it is a *VERY OLD MASTER*.");
mysql_free_result(master_res);
master_res= NULL;
}
+ if (mi->master_id == 0 && mi->ignore_server_ids.elements > 0)
+ {
+ errmsg= "Slave configured with server id filtering could not detect the master server id.";
+ err_code= ER_SLAVE_FATAL_ERROR;
+ sprintf(err_buff, ER(err_code), errmsg);
+ goto err;
+ }
/*
Check that the master's global character_set_server and ours are the same.
@@ -1189,6 +1415,31 @@ when it try to get the value of TIME_ZONE global variable from master.";
}
}
+ if (mi->heartbeat_period != 0.0)
+ {
+ char llbuf[22];
+ const char query_format[]= "SET @master_heartbeat_period= %s";
+ char query[sizeof(query_format) - 2 + sizeof(llbuf)];
+ /*
+ the period is an ulonglong of nano-secs.
+ */
+ llstr((ulonglong) (mi->heartbeat_period*1000000000UL), llbuf);
+ my_sprintf(query, (query, query_format, llbuf));
+
+ if (mysql_real_query(mysql, query, strlen(query))
+ && !check_io_slave_killed(mi->io_thd, mi, NULL))
+ {
+ errmsg= "The slave I/O thread stops because SET @master_heartbeat_period "
+ "on master failed.";
+ err_code= ER_SLAVE_FATAL_ERROR;
+ sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
+ mysql_free_result(mysql_store_result(mysql));
+ goto err;
+ }
+ mysql_free_result(mysql_store_result(mysql));
+ }
+
+
err:
if (errmsg)
{
@@ -1207,199 +1458,6 @@ network_err:
DBUG_RETURN(2);
}
-/*
- Used by fetch_master_table (used by LOAD TABLE tblname FROM MASTER and LOAD
- DATA FROM MASTER). Drops the table (if 'overwrite' is true) and recreates it
- from the dump. Honours replication inclusion/exclusion rules.
- db must be non-zero (guarded by assertion).
-
- RETURN VALUES
- 0 success
- 1 error
-*/
-
-static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
- const char* table_name, bool overwrite)
-{
- ulong packet_len;
- char *query, *save_db;
- uint32 save_db_length;
- Vio* save_vio;
- HA_CHECK_OPT check_opt;
- TABLE_LIST tables;
- int error= 1;
- handler *file;
- ulonglong save_options;
- NET *net= &mysql->net;
- const char *found_semicolon= NULL;
- DBUG_ENTER("create_table_from_dump");
-
- packet_len= my_net_read(net); // read create table statement
- if (packet_len == packet_error)
- {
- my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0));
- DBUG_RETURN(1);
- }
- if (net->read_pos[0] == 255) // error from master
- {
- char *err_msg;
- err_msg= (char*) net->read_pos + ((mysql->server_capabilities &
- CLIENT_PROTOCOL_41) ?
- 3+SQLSTATE_LENGTH+1 : 3);
- my_error(ER_MASTER, MYF(0), err_msg);
- DBUG_RETURN(1);
- }
- thd->command = COM_TABLE_DUMP;
- if (!(query = thd->strmake((char*) net->read_pos, packet_len)))
- {
- sql_print_error("create_table_from_dump: out of memory");
- my_message(ER_GET_ERRNO, "Out of memory", MYF(0));
- DBUG_RETURN(1);
- }
- thd->set_query(query, packet_len);
- thd->is_slave_error = 0;
-
- bzero((char*) &tables,sizeof(tables));
- tables.db = (char*)db;
- tables.alias= tables.table_name= (char*)table_name;
-
- /* Drop the table if 'overwrite' is true */
- if (overwrite)
- {
- if (mysql_rm_table(thd,&tables,1,0)) /* drop if exists */
- {
- sql_print_error("create_table_from_dump: failed to drop the table");
- goto err;
- }
- else
- {
- /* Clear the OK result of mysql_rm_table(). */
- thd->main_da.reset_diagnostics_area();
- }
- }
-
- /* Create the table. We do not want to log the "create table" statement */
- save_options = thd->options;
- thd->options &= ~ (OPTION_BIN_LOG);
- thd_proc_info(thd, "Creating table from master dump");
- // save old db in case we are creating in a different database
- save_db = thd->db;
- save_db_length= thd->db_length;
- thd->db = (char*)db;
- DBUG_ASSERT(thd->db != 0);
- thd->db_length= strlen(thd->db);
- /* run create table */
- mysql_parse(thd, thd->query(), packet_len, &found_semicolon);
- thd->db = save_db; // leave things the way the were before
- thd->db_length= save_db_length;
- thd->options = save_options;
-
- if (thd->is_slave_error)
- goto err; // mysql_parse took care of the error send
-
- thd_proc_info(thd, "Opening master dump table");
- thd->main_da.reset_diagnostics_area(); /* cleanup from CREATE_TABLE */
- /*
- Note: If this function starts to fail for MERGE tables,
- change the next two lines to these:
- tables.table= NULL; // was set by mysql_rm_table()
- if (!open_n_lock_single_table(thd, &tables, TL_WRITE))
- */
- tables.lock_type = TL_WRITE;
- if (!open_ltable(thd, &tables, TL_WRITE, 0))
- {
- sql_print_error("create_table_from_dump: could not open created table");
- goto err;
- }
-
- file = tables.table->file;
- thd_proc_info(thd, "Reading master dump table data");
- /* Copy the data file */
- if (file->net_read_dump(net))
- {
- my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0));
- sql_print_error("create_table_from_dump: failed in\
- handler::net_read_dump()");
- goto err;
- }
-
- check_opt.init();
- check_opt.flags|= T_VERY_SILENT | T_CALC_CHECKSUM | T_QUICK;
- thd_proc_info(thd, "Rebuilding the index on master dump table");
- /*
- We do not want repair() to spam us with messages
- just send them to the error log, and report the failure in case of
- problems.
- */
- save_vio = thd->net.vio;
- thd->net.vio = 0;
- /* Rebuild the index file from the copied data file (with REPAIR) */
- error=file->ha_repair(thd,&check_opt) != 0;
- thd->net.vio = save_vio;
- if (error)
- my_error(ER_INDEX_REBUILD, MYF(0), tables.table->s->table_name.str);
-
-err:
- close_thread_tables(thd);
- DBUG_RETURN(error);
-}
-
-
-int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
- Master_info *mi, MYSQL *mysql, bool overwrite)
-{
- int error= 1;
- const char *errmsg=0;
- bool called_connected= (mysql != NULL);
- DBUG_ENTER("fetch_master_table");
- DBUG_PRINT("enter", ("db_name: '%s' table_name: '%s'",
- db_name,table_name));
-
- if (!called_connected)
- {
- if (!(mysql = mysql_init(NULL)))
- {
- DBUG_RETURN(1);
- }
- if (connect_to_master(thd, mysql, mi))
- {
- my_error(ER_CONNECT_TO_MASTER, MYF(0), mysql_error(mysql));
- /*
- We need to clear the active VIO since, theoretically, somebody
- might issue an awake() on this thread. If we are then in the
- middle of closing and destroying the VIO inside the
- mysql_close(), we will have a problem.
- */
-#ifdef SIGNAL_WITH_VIO_CLOSE
- thd->clear_active_vio();
-#endif
- mysql_close(mysql);
- DBUG_RETURN(1);
- }
- if (thd->killed)
- goto err;
- }
-
- if (request_table_dump(mysql, db_name, table_name))
- {
- error= ER_UNKNOWN_ERROR;
- errmsg= "Failed on table dump request";
- goto err;
- }
- if (create_table_from_dump(thd, mysql, db_name,
- table_name, overwrite))
- goto err; // create_table_from_dump have sent the error already
- error = 0;
-
- err:
- if (!called_connected)
- mysql_close(mysql);
- if (errmsg && thd->vio_ok())
- my_message(error, errmsg, MYF(0));
- DBUG_RETURN(test(error)); // Return 1 on error
-}
-
-
static bool wait_for_relay_log_space(Relay_log_info* rli)
{
bool slave_killed=0;
@@ -1482,28 +1540,48 @@ int register_slave_on_master(MYSQL* mysql, Master_info *mi,
bool *suppress_warnings)
{
uchar buf[1024], *pos= buf;
- uint report_host_len, report_user_len=0, report_password_len=0;
+ uint report_host_len=0, report_user_len=0, report_password_len=0;
DBUG_ENTER("register_slave_on_master");
*suppress_warnings= FALSE;
- if (!report_host)
+ if (report_host)
+ report_host_len= strlen(report_host);
+ if (report_host_len > HOSTNAME_LENGTH)
+ {
+ sql_print_warning("The length of report_host is %d. "
+ "It is larger than the max length(%d), so this "
+ "slave cannot be registered to the master.",
+ report_host_len, HOSTNAME_LENGTH);
DBUG_RETURN(0);
- report_host_len= strlen(report_host);
+ }
+
if (report_user)
report_user_len= strlen(report_user);
+ if (report_user_len > USERNAME_LENGTH)
+ {
+ sql_print_warning("The length of report_user is %d. "
+ "It is larger than the max length(%d), so this "
+ "slave cannot be registered to the master.",
+ report_user_len, USERNAME_LENGTH);
+ DBUG_RETURN(0);
+ }
+
if (report_password)
report_password_len= strlen(report_password);
- /* 30 is a good safety margin */
- if (report_host_len + report_user_len + report_password_len + 30 >
- sizeof(buf))
- DBUG_RETURN(0); // safety
+ if (report_password_len > MAX_PASSWORD_LENGTH)
+ {
+ sql_print_warning("The length of report_password is %d. "
+ "It is larger than the max length(%d), so this "
+ "slave cannot be registered to the master.",
+ report_password_len, MAX_PASSWORD_LENGTH);
+ DBUG_RETURN(0);
+ }
int4store(pos, server_id); pos+= 4;
pos= net_store_data(pos, (uchar*) report_host, report_host_len);
pos= net_store_data(pos, (uchar*) report_user, report_user_len);
pos= net_store_data(pos, (uchar*) report_password, report_password_len);
int2store(pos, (uint16) report_port); pos+= 2;
- int4store(pos, rpl_recovery_rank); pos+= 4;
/* The master will fill in master_id */
int4store(pos, 0); pos+= 4;
@@ -1605,6 +1683,10 @@ bool show_master_info(THD* thd, Master_info* mi)
field_list.push_back(new Item_empty_string("Last_IO_Error", 20));
field_list.push_back(new Item_return_int("Last_SQL_Errno", 4, MYSQL_TYPE_LONG));
field_list.push_back(new Item_empty_string("Last_SQL_Error", 20));
+ field_list.push_back(new Item_empty_string("Replicate_Ignore_Server_Ids",
+ FN_REFLEN));
+ field_list.push_back(new Item_return_int("Master_Server_Id", sizeof(ulong),
+ MYSQL_TYPE_LONG));
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -1640,7 +1722,8 @@ bool show_master_info(THD* thd, Master_info* mi)
protocol->store((ulonglong) mi->rli.group_relay_log_pos);
protocol->store(mi->rli.group_master_log_name, &my_charset_bin);
protocol->store(mi->slave_running == MYSQL_SLAVE_RUN_CONNECT ?
- "Yes" : "No", &my_charset_bin);
+ "Yes" : (mi->slave_running == MYSQL_SLAVE_RUN_NOT_CONNECT ?
+ "Connecting" : "No"), &my_charset_bin);
protocol->store(mi->rli.slave_running ? "Yes":"No", &my_charset_bin);
protocol->store(rpl_filter->get_do_db());
protocol->store(rpl_filter->get_ignore_db());
@@ -1726,6 +1809,32 @@ bool show_master_info(THD* thd, Master_info* mi)
protocol->store(mi->rli.last_error().number);
// Last_SQL_Error
protocol->store(mi->rli.last_error().message, &my_charset_bin);
+ // Replicate_Ignore_Server_Ids
+ {
+ char buff[FN_REFLEN];
+ ulong i, cur_len;
+ for (i= 0, buff[0]= 0, cur_len= 0;
+ i < mi->ignore_server_ids.elements; i++)
+ {
+ ulong s_id, slen;
+ char sbuff[FN_REFLEN];
+ get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i);
+ slen= my_sprintf(sbuff, (sbuff, (i==0? "%lu" : ", %lu"), s_id));
+ if (cur_len + slen + 4 > FN_REFLEN)
+ {
+ /*
+ break the loop whenever remained space could not fit
+ ellipses on the next cycle
+ */
+ my_sprintf(buff + cur_len, (buff + cur_len, "..."));
+ break;
+ }
+ cur_len += my_sprintf(buff + cur_len, (buff + cur_len, "%s", sbuff));
+ }
+ protocol->store(buff, &my_charset_bin);
+ }
+ // Master_Server_id
+ protocol->store((uint32) mi->master_id);
pthread_mutex_unlock(&mi->rli.err_lock);
pthread_mutex_unlock(&mi->err_lock);
@@ -1869,17 +1978,22 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
}
-static int request_dump(MYSQL* mysql, Master_info* mi,
- bool *suppress_warnings)
+static int request_dump(THD *thd, MYSQL* mysql, Master_info* mi,
+ bool *suppress_warnings)
{
uchar buf[FN_REFLEN + 10];
int len;
- int binlog_flags = 0; // for now
+ ushort binlog_flags = 0; // for now
char* logname = mi->master_log_name;
DBUG_ENTER("request_dump");
*suppress_warnings= FALSE;
+ if (RUN_HOOK(binlog_relay_io,
+ before_request_transmit,
+ (thd, mi, binlog_flags)))
+ DBUG_RETURN(1);
+
// TODO if big log files: Change next to int8store()
int4store(buf, (ulong) mi->master_log_pos);
int2store(buf + 4, binlog_flags);
@@ -1898,37 +2012,7 @@ static int request_dump(MYSQL* mysql, Master_info* mi,
else
sql_print_error("Error on COM_BINLOG_DUMP: %d %s, will retry in %d secs",
mysql_errno(mysql), mysql_error(mysql),
- master_connect_retry);
- DBUG_RETURN(1);
- }
-
- DBUG_RETURN(0);
-}
-
-
-static int request_table_dump(MYSQL* mysql, const char* db, const char* table)
-{
- uchar buf[1024], *p = buf;
- DBUG_ENTER("request_table_dump");
-
- uint table_len = (uint) strlen(table);
- uint db_len = (uint) strlen(db);
- if (table_len + db_len > sizeof(buf) - 2)
- {
- sql_print_error("request_table_dump: Buffer overrun");
- DBUG_RETURN(1);
- }
-
- *p++ = db_len;
- memcpy(p, db, db_len);
- p += db_len;
- *p++ = table_len;
- memcpy(p, table, table_len);
-
- if (simple_command(mysql, COM_TABLE_DUMP, buf, p - buf + table_len, 1))
- {
- sql_print_error("request_table_dump: Error sending the table dump \
-command");
+ mi->connect_retry);
DBUG_RETURN(1);
}
@@ -2274,6 +2358,27 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
delete ev;
DBUG_RETURN(1);
}
+
+ { /**
+ The following failure injecion works in cooperation with tests
+ setting @@global.debug= 'd,incomplete_group_in_relay_log'.
+ Xid or Commit events are not executed to force the slave sql
+ read hanging if the realy log does not have any more events.
+ */
+ DBUG_EXECUTE_IF("incomplete_group_in_relay_log",
+ if ((ev->get_type_code() == XID_EVENT) ||
+ ((ev->get_type_code() == QUERY_EVENT) &&
+ strcmp("COMMIT", ((Query_log_event *) ev)->query) == 0))
+ {
+ DBUG_ASSERT(thd->transaction.all.modified_non_trans_table);
+ rli->abort_slave= 1;
+ pthread_mutex_unlock(&rli->data_lock);
+ delete ev;
+ rli->inc_event_relay_log_pos();
+ DBUG_RETURN(0);
+ };);
+ }
+
exec_res= apply_event_and_update_pos(ev, thd, rli);
/*
@@ -2388,7 +2493,6 @@ static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info)
return FALSE;
}
-
/**
@brief Try to reconnect slave IO thread.
@@ -2528,6 +2632,16 @@ pthread_handler_t handle_slave_io(void *arg)
mi->master_log_name,
llstr(mi->master_log_pos,llbuff)));
+ /* This must be called before run any binlog_relay_io hooks */
+ my_pthread_setspecific_ptr(RPL_MASTER_INFO, mi);
+
+ if (RUN_HOOK(binlog_relay_io, thread_start, (thd, mi)))
+ {
+ mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER(ER_SLAVE_FATAL_ERROR), "Failed to run 'thread_start' hook");
+ goto err;
+ }
+
if (!(mi->mysql = mysql = mysql_init(NULL)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
@@ -2617,7 +2731,7 @@ connected:
while (!io_slave_killed(thd,mi))
{
thd_proc_info(thd, "Requesting binlog dump");
- if (request_dump(mysql, mi, &suppress_warnings))
+ if (request_dump(thd, mysql, mi, &suppress_warnings))
{
sql_print_error("Failed on request_dump()");
if (check_io_slave_killed(thd, mi, "Slave I/O thread killed while \
@@ -2637,6 +2751,7 @@ requesting master dump") ||
goto err;
goto connected;
});
+ const char *event_buf;
DBUG_ASSERT(mi->last_error().number == 0);
while (!io_slave_killed(thd,mi))
@@ -2697,14 +2812,37 @@ Stopping slave I/O thread due to out-of-memory error from master");
retry_count=0; // ok event, reset retry counter
thd_proc_info(thd, "Queueing master event to the relay log");
- if (queue_event(mi,(const char*)mysql->net.read_pos + 1,
- event_len))
+ event_buf= (const char*)mysql->net.read_pos + 1;
+ if (RUN_HOOK(binlog_relay_io, after_read_event,
+ (thd, mi,(const char*)mysql->net.read_pos + 1,
+ event_len, &event_buf, &event_len)))
+ {
+ mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER(ER_SLAVE_FATAL_ERROR),
+ "Failed to run 'after_read_event' hook");
+ goto err;
+ }
+
+ /* XXX: 'synced' should be updated by queue_event to indicate
+ whether event has been synced to disk */
+ bool synced= 0;
+ if (queue_event(mi, event_buf, event_len))
{
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE,
ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
"could not queue event from master");
goto err;
}
+
+ if (RUN_HOOK(binlog_relay_io, after_queue_event,
+ (thd, mi, event_buf, event_len, synced)))
+ {
+ mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER(ER_SLAVE_FATAL_ERROR),
+ "Failed to run 'after_queue_event' hook");
+ goto err;
+ }
+
if (flush_master_info(mi, 1))
{
sql_print_error("Failed to flush master info file");
@@ -2750,6 +2888,7 @@ err:
// print the current replication position
sql_print_information("Slave I/O thread exiting, read up to log '%s', position %s",
IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff));
+ RUN_HOOK(binlog_relay_io, thread_stop, (thd, mi));
thd->set_query(NULL, 0);
thd->reset_db(NULL, 0);
if (mysql)
@@ -3555,9 +3694,11 @@ static int queue_old_event(Master_info *mi, const char *buf,
static int queue_event(Master_info* mi,const char* buf, ulong event_len)
{
int error= 0;
+ String error_msg;
ulong inc_pos;
Relay_log_info *rli= &mi->rli;
pthread_mutex_t *log_lock= rli->relay_log.get_log_lock();
+ ulong s_id;
DBUG_ENTER("queue_event");
LINT_INIT(inc_pos);
@@ -3589,7 +3730,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
Rotate_log_event rev(buf,event_len,mi->rli.relay_log.description_event_for_queue);
if (unlikely(process_io_rotate(mi,&rev)))
{
- error= 1;
+ error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
goto err;
}
/*
@@ -3616,7 +3757,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
Log_event::read_log_event(buf, event_len, &errmsg,
mi->rli.relay_log.description_event_for_queue)))
{
- error= 2;
+ error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
goto err;
}
delete mi->rli.relay_log.description_event_for_queue;
@@ -3635,6 +3776,56 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
}
break;
+
+ case HEARTBEAT_LOG_EVENT:
+ {
+ /*
+ HB (heartbeat) cannot come before RL (Relay)
+ */
+ char llbuf[22];
+ Heartbeat_log_event hb(buf, event_len, mi->rli.relay_log.description_event_for_queue);
+ if (!hb.is_valid())
+ {
+ error= ER_SLAVE_HEARTBEAT_FAILURE;
+ error_msg.append(STRING_WITH_LEN("inconsistent heartbeat event content;"));
+ error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
+ error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident()));
+ error_msg.append(STRING_WITH_LEN(" log_pos "));
+ llstr(hb.log_pos, llbuf);
+ error_msg.append(llbuf, strlen(llbuf));
+ goto err;
+ }
+ mi->received_heartbeats++;
+ /*
+ compare local and event's versions of log_file, log_pos.
+
+ Heartbeat is sent only after an event corresponding to the corrdinates
+ the heartbeat carries.
+ Slave can not have a difference in coordinates except in the only
+ special case when mi->master_log_name, master_log_pos have never
+ been updated by Rotate event i.e when slave does not have any history
+ with the master (and thereafter mi->master_log_pos is NULL).
+
+ TODO: handling `when' for SHOW SLAVE STATUS' snds behind
+ */
+ if ((memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len())
+ && mi->master_log_name != NULL)
+ || mi->master_log_pos != hb.log_pos)
+ {
+ /* missed events of heartbeat from the past */
+ error= ER_SLAVE_HEARTBEAT_FAILURE;
+ error_msg.append(STRING_WITH_LEN("heartbeat is not compatible with local info;"));
+ error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
+ error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident()));
+ error_msg.append(STRING_WITH_LEN(" log_pos "));
+ llstr(hb.log_pos, llbuf);
+ error_msg.append(llbuf, strlen(llbuf));
+ goto err;
+ }
+ goto skip_relay_logging;
+ }
+ break;
+
default:
inc_pos= event_len;
break;
@@ -3654,9 +3845,20 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
*/
pthread_mutex_lock(log_lock);
-
- if ((uint4korr(buf + SERVER_ID_OFFSET) == ::server_id) &&
- !mi->rli.replicate_same_server_id)
+ s_id= uint4korr(buf + SERVER_ID_OFFSET);
+ if ((s_id == ::server_id && !mi->rli.replicate_same_server_id) ||
+ /*
+ the following conjunction deals with IGNORE_SERVER_IDS, if set
+ If the master is on the ignore list, execution of
+ format description log events and rotate events is necessary.
+ */
+ (mi->ignore_server_ids.elements > 0 &&
+ mi->shall_ignore_server_id(s_id) &&
+ /* everything is filtered out from non-master */
+ (s_id != mi->master_id ||
+ /* for the master meta information is necessary */
+ buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT &&
+ buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT)))
{
/*
Do not write it to the relay log.
@@ -3671,10 +3873,14 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
But events which were generated by this slave and which do not exist in
the master's binlog (i.e. Format_desc, Rotate & Stop) should not increment
mi->master_log_pos.
+ If the event is originated remotely and is being filtered out by
+ IGNORE_SERVER_IDS it increments mi->master_log_pos
+ as well as rli->group_relay_log_pos.
*/
- if (buf[EVENT_TYPE_OFFSET]!=FORMAT_DESCRIPTION_EVENT &&
- buf[EVENT_TYPE_OFFSET]!=ROTATE_EVENT &&
- buf[EVENT_TYPE_OFFSET]!=STOP_EVENT)
+ if (!(s_id == ::server_id && !mi->rli.replicate_same_server_id) ||
+ buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT &&
+ buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT &&
+ buf[EVENT_TYPE_OFFSET] != STOP_EVENT)
{
mi->master_log_pos+= inc_pos;
memcpy(rli->ign_master_log_name_end, mi->master_log_name, FN_REFLEN);
@@ -3682,8 +3888,8 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
rli->ign_master_log_pos_end= mi->master_log_pos;
}
rli->relay_log.signal_update(); // the slave SQL thread needs to re-check
- DBUG_PRINT("info", ("master_log_pos: %lu, event originating from the same server, ignored",
- (ulong) mi->master_log_pos));
+ DBUG_PRINT("info", ("master_log_pos: %lu, event originating from %u server, ignored",
+ (ulong) mi->master_log_pos, uint4korr(buf + SERVER_ID_OFFSET)));
}
else
{
@@ -3695,15 +3901,23 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
}
else
- error= 3;
+ {
+ error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
+ }
rli->ign_master_log_name_end[0]= 0; // last event is not ignored
}
pthread_mutex_unlock(log_lock);
-
+skip_relay_logging:
+
err:
pthread_mutex_unlock(&mi->data_lock);
DBUG_PRINT("info", ("error: %d", error));
+ if (error)
+ mi->report(ERROR_LEVEL, error, ER(error),
+ (error == ER_SLAVE_RELAY_LOG_WRITE_FAILURE)?
+ "could not queue event from master" :
+ error_msg.ptr());
DBUG_RETURN(error);
}
@@ -3909,6 +4123,71 @@ static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi,
}
+MYSQL *rpl_connect_master(MYSQL *mysql)
+{
+ THD *thd= current_thd;
+ Master_info *mi= my_pthread_getspecific_ptr(Master_info*, RPL_MASTER_INFO);
+ if (!mi)
+ {
+ sql_print_error("'rpl_connect_master' must be called in slave I/O thread context.");
+ return NULL;
+ }
+
+ bool allocated= false;
+
+ if (!mysql)
+ {
+ if(!(mysql= mysql_init(NULL)))
+ {
+ sql_print_error("rpl_connect_master: failed in mysql_init()");
+ return NULL;
+ }
+ allocated= true;
+ }
+
+ /*
+ XXX: copied from connect_to_master, this function should not
+ change the slave status, so we cannot use connect_to_master
+ directly
+
+ TODO: make this part a seperate function to eliminate duplication
+ */
+ mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout);
+ mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout);
+
+#ifdef HAVE_OPENSSL
+ if (mi->ssl)
+ {
+ mysql_ssl_set(mysql,
+ mi->ssl_key[0]?mi->ssl_key:0,
+ mi->ssl_cert[0]?mi->ssl_cert:0,
+ mi->ssl_ca[0]?mi->ssl_ca:0,
+ mi->ssl_capath[0]?mi->ssl_capath:0,
+ mi->ssl_cipher[0]?mi->ssl_cipher:0);
+ mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
+ &mi->ssl_verify_server_cert);
+ }
+#endif
+
+ mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname);
+ /* This one is not strictly needed but we have it here for completeness */
+ mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir);
+
+ if (io_slave_killed(thd, mi)
+ || !mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0,
+ mi->port, 0, 0))
+ {
+ if (!io_slave_killed(thd, mi))
+ sql_print_error("rpl_connect_master: error connecting to master: %s (server_error: %d)",
+ mysql_error(mysql), mysql_errno(mysql));
+
+ if (allocated)
+ mysql_close(mysql); // this will free the object
+ return NULL;
+ }
+ return mysql;
+}
+
/*
Store the file and position where the execute-slave thread are in the
relay log.
@@ -3962,7 +4241,14 @@ bool flush_relay_log_info(Relay_log_info* rli)
error=1;
if (flush_io_cache(file))
error=1;
-
+ if (sync_relayloginfo_period &&
+ !error &&
+ ++(rli->sync_counter) >= sync_relayloginfo_period)
+ {
+ if (my_sync(rli->info_fd, MYF(MY_WME)))
+ error=1;
+ rli->sync_counter= 0;
+ }
/* Flushing the relay log is done by the slave I/O thread */
DBUG_RETURN(error);
}
@@ -4211,8 +4497,8 @@ static Log_event* next_event(Relay_log_info* rli)
*/
pthread_mutex_unlock(&rli->log_space_lock);
pthread_cond_broadcast(&rli->log_space_cond);
- // Note that wait_for_update unlocks lock_log !
- rli->relay_log.wait_for_update(rli->sql_thd, 1);
+ // Note that wait_for_update_relay_log unlocks lock_log !
+ rli->relay_log.wait_for_update_relay_log(rli->sql_thd);
// re-acquire data lock since we released it earlier
pthread_mutex_lock(&rli->data_lock);
rli->last_master_timestamp= save_timestamp;
@@ -4369,8 +4655,7 @@ void rotate_relay_log(Master_info* mi)
DBUG_ENTER("rotate_relay_log");
Relay_log_info* rli= &mi->rli;
- /* We don't lock rli->run_lock. This would lead to deadlocks. */
- pthread_mutex_lock(&mi->run_lock);
+ DBUG_EXECUTE_IF("crash_before_rotate_relaylog", abort(););
/*
We need to test inited because otherwise, new_file() will attempt to lock
@@ -4400,7 +4685,6 @@ void rotate_relay_log(Master_info* mi)
*/
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
end:
- pthread_mutex_unlock(&mi->run_lock);
DBUG_VOID_RETURN;
}
diff --git a/sql/slave.h b/sql/slave.h
index f356d28b626..eff0fa49f61 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -22,6 +22,17 @@
@file
*/
+
+/**
+ Some of defines are need in parser even though replication is not
+ compiled in (embedded).
+*/
+
+/**
+ The maximum is defined as (ULONG_MAX/1000) with 4 bytes ulong
+*/
+#define SLAVE_MAX_HEARTBEAT_PERIOD 4294967
+
#ifdef HAVE_REPLICATION
#include "log.h"
@@ -33,7 +44,6 @@
#define MAX_SLAVE_ERROR 2000
-
// Forward declarations
class Relay_log_info;
class Master_info;
@@ -134,6 +144,7 @@ extern ulonglong relay_log_space_limit;
#define SLAVE_FORCE_ALL 4
int init_slave();
+int init_recovery(Master_info* mi, const char** errmsg);
void init_slave_skip_errors(const char* arg);
bool flush_relay_log_info(Relay_log_info* rli);
int register_slave_on_master(MYSQL* mysql);
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 51a731138ca..4320f037ac6 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -164,7 +164,6 @@ sp_get_flags_for_command(LEX *lex)
}
/* fallthrough */
case SQLCOM_ANALYZE:
- case SQLCOM_BACKUP_TABLE:
case SQLCOM_OPTIMIZE:
case SQLCOM_PRELOAD_KEYS:
case SQLCOM_ASSIGN_TO_KEYCACHE:
@@ -174,6 +173,7 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_AUTHORS:
case SQLCOM_SHOW_BINLOGS:
case SQLCOM_SHOW_BINLOG_EVENTS:
+ case SQLCOM_SHOW_RELAYLOG_EVENTS:
case SQLCOM_SHOW_CHARSETS:
case SQLCOM_SHOW_COLLATIONS:
case SQLCOM_SHOW_COLUMN_TYPES:
@@ -211,7 +211,6 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_VARIABLES:
case SQLCOM_SHOW_WARNS:
case SQLCOM_REPAIR:
- case SQLCOM_RESTORE_TABLE:
flags= sp_head::MULTI_RESULTS;
break;
/*
@@ -266,7 +265,6 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_COMMIT:
case SQLCOM_ROLLBACK:
case SQLCOM_LOAD:
- case SQLCOM_LOAD_MASTER_DATA:
case SQLCOM_LOCK_TABLES:
case SQLCOM_CREATE_PROCEDURE:
case SQLCOM_CREATE_SPFUNCTION:
diff --git a/sql/sql_acl.h b/sql/sql_acl.h
index 4c835e2718c..3104c2ff1a7 100644
--- a/sql/sql_acl.h
+++ b/sql/sql_acl.h
@@ -1,3 +1,6 @@
+#ifndef SQL_ACL_INCLUDED
+#define SQL_ACL_INCLUDED
+
/* Copyright (C) 2000-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -272,3 +275,4 @@ bool is_acl_user(const char *host, const char *user);
#define check_grant(A,B,C,D,E,F) 0
#define check_grant_db(A,B) 0
#endif
+#endif /* SQL_ACL_INCLUDED */
diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h
index 8807b40857e..8f52b90c874 100644
--- a/sql/sql_analyse.h
+++ b/sql/sql_analyse.h
@@ -1,3 +1,6 @@
+#ifndef SQL_ANALYSE_INCLUDED
+#define SQL_ANALYSE_INCLUDED
+
/* Copyright (C) 2000-2003, 2005 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -355,3 +358,5 @@ public:
select_result *result,
List<Item> &field_list);
};
+
+#endif /* SQL_ANALYSE_INCLUDED */
diff --git a/sql/sql_array.h b/sql/sql_array.h
index e1b22921519..dfaa9b02947 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -1,3 +1,6 @@
+#ifndef SQL_ARRAY_INCLUDED
+#define SQL_ARRAY_INCLUDED
+
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -66,3 +69,4 @@ public:
}
};
+#endif /* SQL_ARRAY_INCLUDED */
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index cf8a0b32764..d1dc86b9f07 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -5302,9 +5302,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
We can solve these problems in mixed mode by switching to binlogging
if at least one updated table is used by sub-statement
*/
- /* The BINLOG_FORMAT_MIXED judgement is saved for suppressing
- warnings, but it will be removed by fixing bug#45827 */
- if (thd->variables.binlog_format == BINLOG_FORMAT_MIXED && tables &&
+ if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables &&
has_write_table_with_auto_increment(thd->lex->first_not_own_table()))
{
thd->lex->set_stmt_unsafe();
diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc
index ee51480411b..58c309ef57b 100644
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@ -61,7 +61,7 @@ void mysql_client_binlog_statement(THD* thd)
rli= thd->rli_fake;
if (!rli)
{
- rli= thd->rli_fake= new Relay_log_info;
+ rli= thd->rli_fake= new Relay_log_info(FALSE);
#ifdef HAVE_purify
rli->is_fake= TRUE;
#endif
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 7b37a3f6e93..10cea24a8e7 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -279,6 +279,42 @@ const char *set_thd_proc_info(THD *thd, const char *info,
}
extern "C"
+const char* thd_enter_cond(MYSQL_THD thd, pthread_cond_t *cond,
+ pthread_mutex_t *mutex, const char *msg)
+{
+ if (!thd)
+ thd= current_thd;
+
+ const char* old_msg = thd->proc_info;
+ safe_mutex_assert_owner(mutex);
+ thd->mysys_var->current_mutex = mutex;
+ thd->mysys_var->current_cond = cond;
+ thd->proc_info = msg;
+ return old_msg;
+}
+
+extern "C"
+void thd_exit_cond(MYSQL_THD thd, const char *old_msg)
+{
+ if (!thd)
+ thd= current_thd;
+
+ /*
+ Putting the mutex unlock in thd_exit_cond() ensures that
+ mysys_var->current_mutex is always unlocked _before_ mysys_var->mutex is
+ locked (if that would not be the case, you'll get a deadlock if someone
+ does a THD::awake() on you).
+ */
+ pthread_mutex_unlock(thd->mysys_var->current_mutex);
+ pthread_mutex_lock(&thd->mysys_var->mutex);
+ thd->mysys_var->current_mutex = 0;
+ thd->mysys_var->current_cond = 0;
+ thd->proc_info = old_msg;
+ pthread_mutex_unlock(&thd->mysys_var->mutex);
+ return;
+}
+
+extern "C"
void **thd_ha_data(const THD *thd, const struct handlerton *hton)
{
return (void **) &thd->ha_data[hton->slot].ha_ptr;
@@ -620,9 +656,6 @@ THD::THD()
limit_found_rows= 0;
row_count_func= -1;
statement_id_counter= 0UL;
-#ifdef ERROR_INJECT_SUPPORT
- error_inject_value= 0UL;
-#endif
// Must be reset to handle error with THD's created for init of mysqld
lex->current_select= 0;
start_time=(time_t) 0;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index f74524de60e..0ea1930c2d2 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -14,6 +14,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#ifndef SQL_CLASS_INCLUDED
+#define SQL_CLASS_INCLUDED
+
/* Classes in mysql */
#ifdef USE_PRAGMA_INTERFACE
@@ -22,6 +25,7 @@
#include "log.h"
#include "rpl_tblmap.h"
+#include "replication.h"
/**
An interface that is used to take an action when
@@ -86,6 +90,12 @@ enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
SLAVE_EXEC_MODE_IDEMPOTENT,
SLAVE_EXEC_MODE_LAST_BIT};
+enum enum_slave_type_conversions {
+ SLAVE_TYPE_CONVERSIONS_ALL_LOSSY,
+ SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY,
+ SLAVE_TYPE_CONVERSIONS_COUNT
+};
+
enum enum_mark_columns
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
@@ -1747,9 +1757,6 @@ public:
query_id_t query_id, warn_id;
ulong col_access;
-#ifdef ERROR_INJECT_SUPPORT
- ulong error_inject_value;
-#endif
/* Statement id is thread-wide. This counter is used to generate ids */
ulong statement_id_counter;
ulong rand_saved_seed1, rand_saved_seed2;
@@ -1975,27 +1982,11 @@ public:
inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex,
const char* msg)
{
- const char* old_msg = proc_info;
- safe_mutex_assert_owner(mutex);
- mysys_var->current_mutex = mutex;
- mysys_var->current_cond = cond;
- proc_info = msg;
- return old_msg;
+ return thd_enter_cond(this, cond, mutex, msg);
}
inline void exit_cond(const char* old_msg)
{
- /*
- Putting the mutex unlock in exit_cond() ensures that
- mysys_var->current_mutex is always unlocked _before_ mysys_var->mutex is
- locked (if that would not be the case, you'll get a deadlock if someone
- does a THD::awake() on you).
- */
- pthread_mutex_unlock(mysys_var->current_mutex);
- pthread_mutex_lock(&mysys_var->mutex);
- mysys_var->current_mutex = 0;
- mysys_var->current_cond = 0;
- proc_info = old_msg;
- pthread_mutex_unlock(&mysys_var->mutex);
+ thd_exit_cond(this, old_msg);
}
inline time_t query_start() { query_start_used=1; return start_time; }
inline void set_time()
@@ -3068,3 +3059,4 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
void mark_transaction_to_rollback(THD *thd, bool all);
#endif /* MYSQL_SERVER */
+#endif /* SQL_CLASS_INCLUDED */
diff --git a/sql/sql_crypt.h b/sql/sql_crypt.h
index a5a6bee8a58..8d5a761cbdf 100644
--- a/sql/sql_crypt.h
+++ b/sql/sql_crypt.h
@@ -1,3 +1,6 @@
+#ifndef SQL_CRYPT_INCLUDED
+#define SQL_CRYPT_INCLUDED
+
/* Copyright (C) 2000-2001, 2005 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -35,3 +38,5 @@ class SQL_CRYPT :public Sql_alloc
void encode(char *str, uint length);
void decode(char *str, uint length);
};
+
+#endif /* SQL_CRYPT_INCLUDED */
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 4e4794ef2cf..bd4612a8819 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -17,6 +17,9 @@
@defgroup Semantic_Analysis Semantic Analysis
*/
+#ifndef SQL_LEX_INCLUDED
+#define SQL_LEX_INCLUDED
+
/* YACC and LEX Definitions */
/* These may not be declared yet */
@@ -86,10 +89,10 @@ enum enum_sql_command {
SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT,
SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT,
SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
- SQLCOM_BEGIN, SQLCOM_LOAD_MASTER_TABLE, SQLCOM_CHANGE_MASTER,
- SQLCOM_RENAME_TABLE, SQLCOM_BACKUP_TABLE, SQLCOM_RESTORE_TABLE,
+ SQLCOM_BEGIN, SQLCOM_CHANGE_MASTER,
+ SQLCOM_RENAME_TABLE,
SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_PURGE_BEFORE, SQLCOM_SHOW_BINLOGS,
- SQLCOM_SHOW_OPEN_TABLES, SQLCOM_LOAD_MASTER_DATA,
+ SQLCOM_SHOW_OPEN_TABLES,
SQLCOM_HA_OPEN, SQLCOM_HA_CLOSE, SQLCOM_HA_READ,
SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI,
SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO,
@@ -118,7 +121,7 @@ enum enum_sql_command {
SQLCOM_SHOW_CREATE_TRIGGER,
SQLCOM_ALTER_DB_UPGRADE,
SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES,
-
+ SQLCOM_SHOW_RELAYLOG_EVENTS,
/*
When a command is added here, be sure it's also added in mysqld.cc
in "struct show_var_st status_vars[]= {" ...
@@ -203,17 +206,19 @@ typedef struct st_lex_master_info
{
char *host, *user, *password, *log_file_name;
uint port, connect_retry;
+ float heartbeat_period;
ulonglong pos;
ulong server_id;
/*
Enum is used for making it possible to detect if the user
changed variable or if it should be left at old value
*/
- enum {SSL_UNCHANGED, SSL_DISABLE, SSL_ENABLE}
- ssl, ssl_verify_server_cert;
+ enum {LEX_MI_UNCHANGED, LEX_MI_DISABLE, LEX_MI_ENABLE}
+ ssl, ssl_verify_server_cert, heartbeat_opt, repl_ignore_server_ids_opt;
char *ssl_key, *ssl_cert, *ssl_ca, *ssl_capath, *ssl_cipher;
char *relay_log_name;
ulong relay_log_pos;
+ DYNAMIC_ARRAY repl_ignore_server_ids;
} LEX_MASTER_INFO;
@@ -1972,3 +1977,4 @@ extern bool is_lex_native_function(const LEX_STRING *name);
int my_missing_function_error(const LEX_STRING &token, const char *name);
#endif /* MYSQL_SERVER */
+#endif /* SQL_LEX_INCLUDED */
diff --git a/sql/sql_map.h b/sql/sql_map.h
index a1efba0da6f..5ae260841e0 100644
--- a/sql/sql_map.h
+++ b/sql/sql_map.h
@@ -1,3 +1,6 @@
+#ifndef SQL_MAP_INCLUDED
+#define SQL_MAP_INCLUDED
+
/* Copyright (C) 2000-2001, 2005 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -60,3 +63,5 @@ public:
return file->map;
}
};
+
+#endif /* SQL_MAP_INCLUDED */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 4f1524c1dc8..2210fd87070 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -21,6 +21,7 @@
#include <m_ctype.h>
#include <myisam.h>
#include <my_dir.h>
+#include "rpl_handler.h"
#include "sp_head.h"
#include "sp.h"
@@ -261,8 +262,6 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_CREATE_DB]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_DROP_DB]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_RENAME_TABLE]= CF_CHANGES_DATA;
- sql_command_flags[SQLCOM_BACKUP_TABLE]= CF_CHANGES_DATA;
- sql_command_flags[SQLCOM_RESTORE_TABLE]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_DROP_INDEX]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_CREATE_VIEW]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE;
sql_command_flags[SQLCOM_DROP_VIEW]= CF_CHANGES_DATA;
@@ -626,72 +625,6 @@ void cleanup_items(Item *item)
}
/**
- Handle COM_TABLE_DUMP command.
-
- @param thd thread handle
- @param db database name or an empty string. If empty,
- the current database of the connection is used
- @param tbl_name name of the table to dump
-
- @note
- This function is written to handle one specific command only.
-
- @retval
- 0 success
- @retval
- 1 error, the error message is set in THD
-*/
-
-static
-int mysql_table_dump(THD *thd, LEX_STRING *db, char *tbl_name)
-{
- TABLE* table;
- TABLE_LIST* table_list;
- int error = 0;
- DBUG_ENTER("mysql_table_dump");
- if (db->length == 0)
- {
- db->str= thd->db; /* purecov: inspected */
- db->length= thd->db_length; /* purecov: inspected */
- }
- if (!(table_list = (TABLE_LIST*) thd->calloc(sizeof(TABLE_LIST))))
- DBUG_RETURN(1); // out of memory
- table_list->db= db->str;
- table_list->table_name= table_list->alias= tbl_name;
- table_list->lock_type= TL_READ_NO_INSERT;
- table_list->prev_global= &table_list; // can be removed after merge with 4.1
-
- if (check_db_name(db))
- {
- /* purecov: begin inspected */
- my_error(ER_WRONG_DB_NAME ,MYF(0), db->str ? db->str : "NULL");
- goto err;
- /* purecov: end */
- }
- if (lower_case_table_names)
- my_casedn_str(files_charset_info, tbl_name);
-
- if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT, 0)))
- DBUG_RETURN(1);
-
- if (check_one_table_access(thd, SELECT_ACL, table_list))
- goto err;
- thd->free_list = 0;
- thd->set_query(tbl_name, (uint) strlen(tbl_name));
- if ((error = mysqld_dump_create_info(thd, table_list, -1)))
- {
- my_error(ER_GET_ERRNO, MYF(0), my_errno);
- goto err;
- }
- net_flush(&thd->net);
- if ((error= table->file->dump(thd,-1)))
- my_error(ER_GET_ERRNO, MYF(0), error);
-
-err:
- DBUG_RETURN(error);
-}
-
-/**
Ends the current transaction and (maybe) begin the next.
@param thd Current thread
@@ -1035,40 +968,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
}
#endif
- case COM_TABLE_DUMP:
- {
- char *tbl_name;
- LEX_STRING db;
- /* Safe because there is always a trailing \0 at the end of the packet */
- uint db_len= *(uchar*) packet;
- if (db_len + 1 > packet_length || db_len > NAME_LEN)
- {
- my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
- break;
- }
- /* Safe because there is always a trailing \0 at the end of the packet */
- uint tbl_len= *(uchar*) (packet + db_len + 1);
- if (db_len + tbl_len + 2 > packet_length || tbl_len > NAME_LEN)
- {
- my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
- break;
- }
-
- status_var_increment(thd->status_var.com_other);
- thd->enable_slow_log= opt_log_slow_admin_statements;
- db.str= (char*) thd->alloc(db_len + tbl_len + 2);
- if (!db.str)
- {
- my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
- break;
- }
- db.length= db_len;
- tbl_name= strmake(db.str, packet + 1, db_len)+1;
- strmake(tbl_name, packet + db_len + 2, tbl_len);
- if (mysql_table_dump(thd, &db, tbl_name) == 0)
- thd->main_da.disable_status();
- break;
- }
case COM_CHANGE_USER:
{
status_var_increment(thd->status_var.com_other);
@@ -1654,9 +1553,9 @@ void log_slow_statement(THD *thd)
/*
Do not log administrative statements unless the appropriate option is
- set; do not log into slow log if reading from backup.
+ set.
*/
- if (thd->enable_slow_log && !thd->user_time)
+ if (thd->enable_slow_log)
{
ulonglong end_utime_of_query= thd->current_utime();
thd_proc_info(thd, "logging slow query");
@@ -2359,6 +2258,7 @@ mysql_execute_command(THD *thd)
res = show_slave_hosts(thd);
break;
}
+ case SQLCOM_SHOW_RELAYLOG_EVENTS: /* fall through */
case SQLCOM_SHOW_BINLOG_EVENTS:
{
if (check_global_access(thd, REPL_SLAVE_ACL))
@@ -2368,30 +2268,6 @@ mysql_execute_command(THD *thd)
}
#endif
- case SQLCOM_BACKUP_TABLE:
- {
- DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE) ||
- check_global_access(thd, FILE_ACL))
- goto error; /* purecov: inspected */
- thd->enable_slow_log= opt_log_slow_admin_statements;
- res = mysql_backup_table(thd, first_table);
- select_lex->table_list.first= (uchar*) first_table;
- lex->query_tables=all_tables;
- break;
- }
- case SQLCOM_RESTORE_TABLE:
- {
- DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (check_table_access(thd, INSERT_ACL, all_tables, UINT_MAX, FALSE) ||
- check_global_access(thd, FILE_ACL))
- goto error; /* purecov: inspected */
- thd->enable_slow_log= opt_log_slow_admin_statements;
- res = mysql_restore_table(thd, first_table);
- select_lex->table_list.first= (uchar*) first_table;
- lex->query_tables=all_tables;
- break;
- }
case SQLCOM_ASSIGN_TO_KEYCACHE:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
@@ -2450,13 +2326,6 @@ mysql_execute_command(THD *thd)
break;
}
- case SQLCOM_LOAD_MASTER_DATA: // sync with master
- if (check_global_access(thd, SUPER_ACL))
- goto error;
- if (end_active_trans(thd))
- goto error;
- res = load_master_data(thd);
- break;
#endif /* HAVE_REPLICATION */
case SQLCOM_SHOW_ENGINE_STATUS:
{
@@ -2472,36 +2341,7 @@ mysql_execute_command(THD *thd)
res = ha_show_status(thd, lex->create_info.db_type, HA_ENGINE_MUTEX);
break;
}
-#ifdef HAVE_REPLICATION
- case SQLCOM_LOAD_MASTER_TABLE:
- {
- DBUG_ASSERT(first_table == all_tables && first_table != 0);
- DBUG_ASSERT(first_table->db); /* Must be set in the parser */
-
- if (check_access(thd, CREATE_ACL, first_table->db,
- &first_table->grant.privilege, 0, 0,
- test(first_table->schema_table)))
- goto error; /* purecov: inspected */
- /* Check that the first table has CREATE privilege */
- if (check_grant(thd, CREATE_ACL, all_tables, 0, 1, 0))
- goto error;
-
- pthread_mutex_lock(&LOCK_active_mi);
- /*
- fetch_master_table will send the error to the client on failure.
- Give error if the table already exists.
- */
- if (!fetch_master_table(thd, first_table->db, first_table->table_name,
- active_mi, 0, 0))
- {
- my_ok(thd);
- }
- pthread_mutex_unlock(&LOCK_active_mi);
- break;
- }
-#endif /* HAVE_REPLICATION */
-
- case SQLCOM_CREATE_TABLE:
+ case SQLCOM_CREATE_TABLE:
{
/* If CREATE TABLE of non-temporary table, do implicit commit */
if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE))
@@ -2966,6 +2806,7 @@ end_with_restore_list:
if (check_table_access(thd, SELECT_ACL | EXTRA_ACL, all_tables,
UINT_MAX, FALSE))
goto error; /* purecov: inspected */
+
res = mysql_checksum_table(thd, first_table, &lex->check_opt);
break;
}
@@ -6118,17 +5959,6 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
DBUG_RETURN(1);
}
- if (type == MYSQL_TYPE_TIMESTAMP && length)
- {
- /* Display widths are no longer supported for TIMSTAMP as of MySQL 4.1.
- In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4),
- and so on, the display width is ignored.
- */
- char buf[32];
- my_snprintf(buf, sizeof(buf), "TIMESTAMP(%s)", length);
- WARN_DEPRECATED(thd, "6.0", buf, "'TIMESTAMP'");
- }
-
if (!(new_field= new Create_field()) ||
new_field->init(thd, field_name->str, type, length, decimals, type_modifier,
default_value, on_update_value, comment, change,
@@ -6834,6 +6664,30 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
tables.
*/
+ options|= REFRESH_BINARY_LOG;
+ options|= REFRESH_RELAY_LOG;
+ options|= REFRESH_SLOW_LOG;
+ options|= REFRESH_GENERAL_LOG;
+ options|= REFRESH_ENGINE_LOG;
+ options|= REFRESH_ERROR_LOG;
+ }
+
+ if (options & REFRESH_ERROR_LOG)
+ if (flush_error_log())
+ result= 1;
+
+ if ((options & REFRESH_SLOW_LOG) && opt_slow_log)
+ logger.flush_slow_log();
+
+ if ((options & REFRESH_GENERAL_LOG) && opt_log)
+ logger.flush_general_log();
+
+ if (options & REFRESH_ENGINE_LOG)
+ if (ha_flush_logs(NULL))
+ result= 1;
+
+ if (options & REFRESH_BINARY_LOG)
+ {
/*
Writing this command to the binlog may result in infinite loops
when doing mysqlbinlog|mysql, and anyway it does not really make
@@ -6841,23 +6695,16 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
than it would help them)
*/
tmp_write_to_binlog= 0;
- if( mysql_bin_log.is_open() )
- {
+ if (mysql_bin_log.is_open())
mysql_bin_log.rotate_and_purge(RP_FORCE_ROTATE);
- }
+ }
+ if (options & REFRESH_RELAY_LOG)
+ {
#ifdef HAVE_REPLICATION
pthread_mutex_lock(&LOCK_active_mi);
rotate_relay_log(active_mi);
pthread_mutex_unlock(&LOCK_active_mi);
#endif
-
- /* flush slow and general logs */
- logger.flush_logs(thd);
-
- if (ha_flush_logs(NULL))
- result=1;
- if (flush_error_log())
- result=1;
}
#ifdef HAVE_QUERY_CACHE
if (options & REFRESH_QUERY_CACHE_FREE)
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 0decd3e1a91..251e695f79b 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -40,6 +40,10 @@
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
+
+#define ERROR_INJECT_CRASH(code) \
+ DBUG_EVALUATE_IF(code, (abort(), 0), 0)
+
/*
Partition related functions declarations and some static constants;
*/
diff --git a/sql/sql_partition.h b/sql/sql_partition.h
index 282e24f1853..0c47340016c 100644
--- a/sql/sql_partition.h
+++ b/sql/sql_partition.h
@@ -1,3 +1,6 @@
+#ifndef SQL_PARTITION_INCLUDED
+#define SQL_PARTITION_INCLUDED
+
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -209,3 +212,4 @@ typedef int (*get_partitions_in_range_iter)(partition_info *part_info,
#include "partition_info.h"
+#endif /* SQL_PARTITION_INCLUDED */
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index bafc601d142..e4cecdecc7e 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -19,14 +19,6 @@
#define REPORT_TO_LOG 1
#define REPORT_TO_USER 2
-#ifdef DBUG_OFF
-#define plugin_ref_to_int(A) A
-#define plugin_int_to_ref(A) A
-#else
-#define plugin_ref_to_int(A) (A ? A[0] : NULL)
-#define plugin_int_to_ref(A) &(A)
-#endif
-
extern struct st_mysql_plugin *mysqld_builtins[];
/**
@@ -54,7 +46,8 @@ const LEX_STRING plugin_type_names[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{ C_STRING_WITH_LEN("STORAGE ENGINE") },
{ C_STRING_WITH_LEN("FTPARSER") },
{ C_STRING_WITH_LEN("DAEMON") },
- { C_STRING_WITH_LEN("INFORMATION SCHEMA") }
+ { C_STRING_WITH_LEN("INFORMATION SCHEMA") },
+ { C_STRING_WITH_LEN("REPLICATION") },
};
extern int initialize_schema_table(st_plugin_int *plugin);
@@ -93,7 +86,8 @@ static int min_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
MYSQL_HANDLERTON_INTERFACE_VERSION,
MYSQL_FTPARSER_INTERFACE_VERSION,
MYSQL_DAEMON_INTERFACE_VERSION,
- MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
+ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION,
+ MYSQL_REPLICATION_INTERFACE_VERSION,
};
static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
@@ -101,7 +95,8 @@ static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
MYSQL_HANDLERTON_INTERFACE_VERSION,
MYSQL_FTPARSER_INTERFACE_VERSION,
MYSQL_DAEMON_INTERFACE_VERSION,
- MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
+ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION,
+ MYSQL_REPLICATION_INTERFACE_VERSION,
};
static bool initialized= 0;
diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h
index 004d0d5abb7..c6ad846943c 100644
--- a/sql/sql_plugin.h
+++ b/sql/sql_plugin.h
@@ -18,6 +18,14 @@
class sys_var;
+#ifdef DBUG_OFF
+#define plugin_ref_to_int(A) A
+#define plugin_int_to_ref(A) A
+#else
+#define plugin_ref_to_int(A) (A ? A[0] : NULL)
+#define plugin_int_to_ref(A) &(A)
+#endif
+
/*
the following flags are valid for plugin_init()
*/
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index b8f2e1e39bf..8eb6115d3d7 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -21,6 +21,7 @@
#include "log_event.h"
#include "rpl_filter.h"
#include <my_dir.h>
+#include "rpl_handler.h"
int max_binlog_dump_events = 0; // unlimited
my_bool opt_sporadic_binlog_dump_fail = 0;
@@ -80,6 +81,32 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name,
DBUG_RETURN(0);
}
+/*
+ Reset thread transmit packet buffer for event sending
+
+ This function allocates header bytes for event transmission, and
+ should be called before store the event data to the packet buffer.
+*/
+static int reset_transmit_packet(THD *thd, ushort flags,
+ ulong *ev_offset, const char **errmsg)
+{
+ int ret= 0;
+ String *packet= &thd->packet;
+
+ /* reserve and set default header */
+ packet->length(0);
+ packet->set("\0", 1, &my_charset_bin);
+
+ if (RUN_HOOK(binlog_transmit, reserve_header, (thd, flags, packet)))
+ {
+ *errmsg= "Failed to run hook 'reserve_header'";
+ my_errno= ER_UNKNOWN_ERROR;
+ ret= 1;
+ }
+ *ev_offset= packet->length();
+ return ret;
+}
+
static int send_file(THD *thd)
{
NET* net = &thd->net;
@@ -232,24 +259,11 @@ bool log_in_use(const char* log_name)
bool purge_error_message(THD* thd, int res)
{
- uint errmsg= 0;
-
- switch (res) {
- case 0: break;
- case LOG_INFO_EOF: errmsg= ER_UNKNOWN_TARGET_BINLOG; break;
- case LOG_INFO_IO: errmsg= ER_IO_ERR_LOG_INDEX_READ; break;
- case LOG_INFO_INVALID:errmsg= ER_BINLOG_PURGE_PROHIBITED; break;
- case LOG_INFO_SEEK: errmsg= ER_FSEEK_FAIL; break;
- case LOG_INFO_MEM: errmsg= ER_OUT_OF_RESOURCES; break;
- case LOG_INFO_FATAL: errmsg= ER_BINLOG_PURGE_FATAL_ERR; break;
- case LOG_INFO_IN_USE: errmsg= ER_LOG_IN_USE; break;
- case LOG_INFO_EMFILE: errmsg= ER_BINLOG_PURGE_EMFILE; break;
- default: errmsg= ER_LOG_PURGE_UNKNOWN_ERR; break;
- }
+ uint errcode;
- if (errmsg)
+ if ((errcode= purge_log_get_error_code(res)) != 0)
{
- my_message(errmsg, ER(errmsg), MYF(0));
+ my_message(errcode, ER(errcode), MYF(0));
return TRUE;
}
my_ok(thd);
@@ -336,6 +350,73 @@ Increase max_allowed_packet on master";
}
+/**
+ An auxiliary function for calling in mysql_binlog_send
+ to initialize the heartbeat timeout in waiting for a binlogged event.
+
+ @param[in] thd THD to access a user variable
+
+ @return heartbeat period an ulonglong of nanoseconds
+ or zero if heartbeat was not demanded by slave
+*/
+static ulonglong get_heartbeat_period(THD * thd)
+{
+ my_bool null_value;
+ LEX_STRING name= { C_STRING_WITH_LEN("master_heartbeat_period")};
+ user_var_entry *entry=
+ (user_var_entry*) hash_search(&thd->user_vars, (uchar*) name.str,
+ name.length);
+ return entry? entry->val_int(&null_value) : 0;
+}
+
+/*
+ Function prepares and sends repliation heartbeat event.
+
+ @param net net object of THD
+ @param packet buffer to store the heartbeat instance
+ @param event_coordinates binlog file name and position of the last
+ real event master sent from binlog
+
+ @note
+ Among three essential pieces of heartbeat data Log_event::when
+ is computed locally.
+ The error to send is serious and should force terminating
+ the dump thread.
+*/
+static int send_heartbeat_event(NET* net, String* packet,
+ const struct event_coordinates *coord)
+{
+ DBUG_ENTER("send_heartbeat_event");
+ char header[LOG_EVENT_HEADER_LEN];
+ /*
+ 'when' (the timestamp) is set to 0 so that slave could distinguish between
+ real and fake Rotate events (if necessary)
+ */
+ memset(header, 0, 4); // when
+
+ header[EVENT_TYPE_OFFSET] = HEARTBEAT_LOG_EVENT;
+
+ char* p= coord->file_name + dirname_length(coord->file_name);
+
+ uint ident_len = strlen(p);
+ ulong event_len = ident_len + LOG_EVENT_HEADER_LEN;
+ int4store(header + SERVER_ID_OFFSET, server_id);
+ int4store(header + EVENT_LEN_OFFSET, event_len);
+ int2store(header + FLAGS_OFFSET, 0);
+
+ int4store(header + LOG_POS_OFFSET, coord->pos); // log_pos
+
+ packet->append(header, sizeof(header));
+ packet->append(p, ident_len); // log_file_name
+
+ if (my_net_write(net, (uchar*) packet->ptr(), packet->length()) ||
+ net_flush(net))
+ {
+ DBUG_RETURN(-1);
+ }
+ DBUG_RETURN(0);
+}
+
/*
TODO: Clean up loop to only have one call to send_file()
*/
@@ -346,6 +427,9 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
LOG_INFO linfo;
char *log_file_name = linfo.log_file_name;
char search_file_name[FN_REFLEN], *name;
+
+ ulong ev_offset;
+
IO_CACHE log;
File file = -1;
String* packet = &thd->packet;
@@ -361,6 +445,30 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
DBUG_PRINT("enter",("log_ident: '%s' pos: %ld", log_ident, (long) pos));
bzero((char*) &log,sizeof(log));
+ /*
+ heartbeat_period from @master_heartbeat_period user variable
+ */
+ ulonglong heartbeat_period= get_heartbeat_period(thd);
+ struct timespec heartbeat_buf;
+ struct event_coordinates coord_buf;
+ struct timespec *heartbeat_ts= NULL;
+ struct event_coordinates *coord= NULL;
+ if (heartbeat_period != LL(0))
+ {
+ heartbeat_ts= &heartbeat_buf;
+ set_timespec_nsec(*heartbeat_ts, 0);
+ coord= &coord_buf;
+ coord->file_name= log_file_name; // initialization basing on what slave remembers
+ coord->pos= pos;
+ }
+ sql_print_information("Start binlog_dump to slave_server(%d), pos(%s, %lu)",
+ thd->server_id, log_ident, (ulong)pos);
+ if (RUN_HOOK(binlog_transmit, transmit_start, (thd, flags, log_ident, pos)))
+ {
+ errmsg= "Failed to run hook 'transmit_start'";
+ my_errno= ER_UNKNOWN_ERROR;
+ goto err;
+ }
#ifndef DBUG_OFF
if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2))
@@ -416,11 +524,9 @@ impossible position";
goto err;
}
- /*
- We need to start a packet with something other than 255
- to distinguish it from error
- */
- packet->set("\0", 1, &my_charset_bin); /* This is the start of a new packet */
+ /* reset transmit packet for the fake rotate event below */
+ if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
+ goto err;
/*
Tell the client about the log name with a fake Rotate event;
@@ -460,7 +566,7 @@ impossible position";
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
goto err;
}
- packet->set("\0", 1, &my_charset_bin);
+
/*
Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become
this larger than the corresponding packet (query) sent
@@ -476,6 +582,11 @@ impossible position";
log_lock = mysql_bin_log.get_log_lock();
if (pos > BIN_LOG_HEADER_SIZE)
{
+ /* reset transmit packet for the event read from binary log
+ file */
+ if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
+ goto err;
+
/*
Try to find a Format_description_log_event at the beginning of
the binlog
@@ -483,29 +594,30 @@ impossible position";
if (!(error = Log_event::read_log_event(&log, packet, log_lock)))
{
/*
- The packet has offsets equal to the normal offsets in a binlog
- event +1 (the first character is \0).
+ The packet has offsets equal to the normal offsets in a
+ binlog event + ev_offset (the first ev_offset characters are
+ the header (default \0)).
*/
DBUG_PRINT("info",
("Looked for a Format_description_log_event, found event type %d",
- (*packet)[EVENT_TYPE_OFFSET+1]));
- if ((*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT)
+ (*packet)[EVENT_TYPE_OFFSET+ev_offset]));
+ if ((*packet)[EVENT_TYPE_OFFSET+ev_offset] == FORMAT_DESCRIPTION_EVENT)
{
- binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+1] &
+ binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+ev_offset] &
LOG_EVENT_BINLOG_IN_USE_F);
- (*packet)[FLAGS_OFFSET+1] &= ~LOG_EVENT_BINLOG_IN_USE_F;
+ (*packet)[FLAGS_OFFSET+ev_offset] &= ~LOG_EVENT_BINLOG_IN_USE_F;
/*
mark that this event with "log_pos=0", so the slave
should not increment master's binlog position
(rli->group_master_log_pos)
*/
- int4store((char*) packet->ptr()+LOG_POS_OFFSET+1, 0);
+ int4store((char*) packet->ptr()+LOG_POS_OFFSET+ev_offset, 0);
/*
if reconnect master sends FD event with `created' as 0
to avoid destroying temp tables.
*/
int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+
- ST_CREATED_OFFSET+1, (ulong) 0);
+ ST_CREATED_OFFSET+ev_offset, (ulong) 0);
/* send it */
if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
{
@@ -531,8 +643,6 @@ impossible position";
Format_description_log_event will be found naturally if it is written.
*/
}
- /* reset the packet as we wrote to it in any case */
- packet->set("\0", 1, &my_charset_bin);
} /* end of if (pos > BIN_LOG_HEADER_SIZE); */
else
{
@@ -544,6 +654,12 @@ impossible position";
while (!net->error && net->vio != 0 && !thd->killed)
{
+ Log_event_type event_type= UNKNOWN_EVENT;
+
+ /* reset the transmit packet for the event read from binary log
+ file */
+ if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
+ goto err;
while (!(error = Log_event::read_log_event(&log, packet, log_lock)))
{
#ifndef DBUG_OFF
@@ -555,16 +671,31 @@ impossible position";
goto err;
}
#endif
+ /*
+ log's filename does not change while it's active
+ */
+ if (coord)
+ coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET);
- if ((*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT)
+ event_type= (Log_event_type)((*packet)[LOG_EVENT_OFFSET+ev_offset]);
+ if (event_type == FORMAT_DESCRIPTION_EVENT)
{
- binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+1] &
+ binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+ev_offset] &
LOG_EVENT_BINLOG_IN_USE_F);
- (*packet)[FLAGS_OFFSET+1] &= ~LOG_EVENT_BINLOG_IN_USE_F;
+ (*packet)[FLAGS_OFFSET+ev_offset] &= ~LOG_EVENT_BINLOG_IN_USE_F;
}
- else if ((*packet)[EVENT_TYPE_OFFSET+1] == STOP_EVENT)
+ else if (event_type == STOP_EVENT)
binlog_can_be_corrupted= FALSE;
+ pos = my_b_tell(&log);
+ if (RUN_HOOK(binlog_transmit, before_send_event,
+ (thd, flags, packet, log_file_name, pos)))
+ {
+ my_errno= ER_UNKNOWN_ERROR;
+ errmsg= "run 'before_send_event' hook failed";
+ goto err;
+ }
+
if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
{
errmsg = "Failed on my_net_write()";
@@ -572,9 +703,8 @@ impossible position";
goto err;
}
- DBUG_PRINT("info", ("log event code %d",
- (*packet)[LOG_EVENT_OFFSET+1] ));
- if ((*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT)
+ DBUG_PRINT("info", ("log event code %d", event_type));
+ if (event_type == LOAD_EVENT)
{
if (send_file(thd))
{
@@ -583,7 +713,17 @@ impossible position";
goto err;
}
}
- packet->set("\0", 1, &my_charset_bin);
+
+ if (RUN_HOOK(binlog_transmit, after_send_event, (thd, flags, packet)))
+ {
+ errmsg= "Failed to run hook 'after_send_event'";
+ my_errno= ER_UNKNOWN_ERROR;
+ goto err;
+ }
+
+ /* reset transmit packet for next loop */
+ if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
+ goto err;
}
/*
@@ -634,6 +774,11 @@ impossible position";
}
#endif
+ /* reset the transmit packet for the event read from binary log
+ file */
+ if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
+ goto err;
+
/*
No one will update the log while we are reading
now, but we'll be quick and just read one record
@@ -650,34 +795,84 @@ impossible position";
/* we read successfully, so we'll need to send it to the slave */
pthread_mutex_unlock(log_lock);
read_packet = 1;
+ if (coord)
+ coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET);
+ event_type= (Log_event_type)((*packet)[LOG_EVENT_OFFSET+ev_offset]);
break;
case LOG_READ_EOF:
+ {
+ int ret;
+ ulong signal_cnt;
DBUG_PRINT("wait",("waiting for data in binary log"));
if (thd->server_id==0) // for mysqlbinlog (mysqlbinlog.server_id==0)
{
pthread_mutex_unlock(log_lock);
goto end;
}
- if (!thd->killed)
- {
- /* Note that the following call unlocks lock_log */
- mysql_bin_log.wait_for_update(thd, 0);
- }
- else
- pthread_mutex_unlock(log_lock);
- DBUG_PRINT("wait",("binary log received update"));
- break;
- default:
+#ifndef DBUG_OFF
+ ulong hb_info_counter= 0;
+#endif
+ signal_cnt= mysql_bin_log.signal_cnt;
+ do
+ {
+ if (coord)
+ {
+ DBUG_ASSERT(heartbeat_ts && heartbeat_period != LL(0));
+ set_timespec_nsec(*heartbeat_ts, heartbeat_period);
+ }
+ ret= mysql_bin_log.wait_for_update_bin_log(thd, heartbeat_ts);
+ DBUG_ASSERT(ret == 0 || heartbeat_period != LL(0) && coord != NULL);
+ if (ret == ETIMEDOUT || ret == ETIME)
+ {
+#ifndef DBUG_OFF
+ if (hb_info_counter < 3)
+ {
+ sql_print_information("master sends heartbeat message");
+ hb_info_counter++;
+ if (hb_info_counter == 3)
+ sql_print_information("the rest of heartbeat info skipped ...");
+ }
+#endif
+ /* reset transmit packet for the heartbeat event */
+ if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
+ goto err;
+ if (send_heartbeat_event(net, packet, coord))
+ {
+ errmsg = "Failed on my_net_write()";
+ my_errno= ER_UNKNOWN_ERROR;
+ pthread_mutex_unlock(log_lock);
+ goto err;
+ }
+ }
+ else
+ {
+ DBUG_PRINT("wait",("binary log received update or a broadcast signal caught"));
+ }
+ } while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed);
+ pthread_mutex_unlock(log_lock);
+ }
+ break;
+
+ default:
pthread_mutex_unlock(log_lock);
test_for_non_eof_log_read_errors(error, &errmsg);
goto err;
}
if (read_packet)
- {
- thd_proc_info(thd, "Sending binlog event to slave");
+ {
+ thd_proc_info(thd, "Sending binlog event to slave");
+ pos = my_b_tell(&log);
+ if (RUN_HOOK(binlog_transmit, before_send_event,
+ (thd, flags, packet, log_file_name, pos)))
+ {
+ my_errno= ER_UNKNOWN_ERROR;
+ errmsg= "run 'before_send_event' hook failed";
+ goto err;
+ }
+
if (my_net_write(net, (uchar*) packet->ptr(), packet->length()) )
{
errmsg = "Failed on my_net_write()";
@@ -685,7 +880,7 @@ impossible position";
goto err;
}
- if ((*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT)
+ if (event_type == LOAD_EVENT)
{
if (send_file(thd))
{
@@ -694,11 +889,13 @@ impossible position";
goto err;
}
}
- packet->set("\0", 1, &my_charset_bin);
- /*
- No need to net_flush because we will get to flush later when
- we hit EOF pretty quick
- */
+
+ if (RUN_HOOK(binlog_transmit, after_send_event, (thd, flags, packet)))
+ {
+ my_errno= ER_UNKNOWN_ERROR;
+ errmsg= "Failed to run hook 'after_send_event'";
+ goto err;
+ }
}
log.error=0;
@@ -728,6 +925,10 @@ impossible position";
end_io_cache(&log);
(void) my_close(file, MYF(MY_WME));
+ /* reset transmit packet for the possible fake rotate event */
+ if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
+ goto err;
+
/*
Call fake_rotate_event() in case the previous log (the one which
we have just finished reading) did not contain a Rotate event
@@ -745,8 +946,8 @@ impossible position";
goto err;
}
- packet->length(0);
- packet->append('\0');
+ if (coord)
+ coord->file_name= log_file_name; // reset to the next
}
}
@@ -754,6 +955,7 @@ end:
end_io_cache(&log);
(void)my_close(file, MYF(MY_WME));
+ RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
my_eof(thd);
thd_proc_info(thd, "Waiting to finalize termination");
pthread_mutex_lock(&LOCK_thread_count);
@@ -764,6 +966,7 @@ end:
err:
thd_proc_info(thd, "Waiting to finalize termination");
end_io_cache(&log);
+ RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
/*
Exclude iteration through thread list
this is needed for purge_logs() - it will iterate through
@@ -1025,14 +1228,8 @@ int reset_slave(THD *thd, Master_info* mi)
goto err;
}
- /*
- Clear master's log coordinates and reset host/user/etc to the values
- specified in mysqld's options (only for good display of SHOW SLAVE STATUS;
- next init_master_info() (in start_slave() for example) would have set them
- the same way; but here this is for the case where the user does SHOW SLAVE
- STATUS; before doing START SLAVE;
- */
- init_master_info_with_options(mi);
+ /* Clear master's log coordinates */
+ init_master_log_pos(mi);
/*
Reset errors (the idea is that we forget about the
old master).
@@ -1058,6 +1255,7 @@ int reset_slave(THD *thd, Master_info* mi)
goto err;
}
+ RUN_HOOK(binlog_relay_io, after_reset_slave, (thd, mi));
err:
unlock_slave_threads(mi);
if (error)
@@ -1131,26 +1329,40 @@ bool change_master(THD* thd, Master_info* mi)
int thread_mask;
const char* errmsg= 0;
bool need_relay_log_purge= 1;
+ bool ret= FALSE;
DBUG_ENTER("change_master");
lock_slave_threads(mi);
init_thread_mask(&thread_mask,mi,0 /*not inverse*/);
+ LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
if (thread_mask) // We refuse if any slave thread is running
{
my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0));
- unlock_slave_threads(mi);
- DBUG_RETURN(TRUE);
+ ret= TRUE;
+ goto err;
}
thd_proc_info(thd, "Changing master");
- LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
+ /*
+ We need to check if there is an empty master_host. Otherwise
+ change master succeeds, a master.info file is created containing
+ empty master_host string and when issuing: start slave; an error
+ is thrown stating that the server is not configured as slave.
+ (See BUG#28796).
+ */
+ if(lex_mi->host && !*lex_mi->host)
+ {
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "MASTER_HOST");
+ unlock_slave_threads(mi);
+ DBUG_RETURN(TRUE);
+ }
// TODO: see if needs re-write
if (init_master_info(mi, master_info_file, relay_log_info_file, 0,
thread_mask))
{
my_message(ER_MASTER_INFO, ER(ER_MASTER_INFO), MYF(0));
- unlock_slave_threads(mi);
- DBUG_RETURN(TRUE);
+ ret= TRUE;
+ goto err;
}
/*
@@ -1189,13 +1401,46 @@ bool change_master(THD* thd, Master_info* mi)
mi->port = lex_mi->port;
if (lex_mi->connect_retry)
mi->connect_retry = lex_mi->connect_retry;
+ if (lex_mi->heartbeat_opt != LEX_MASTER_INFO::LEX_MI_UNCHANGED)
+ mi->heartbeat_period = lex_mi->heartbeat_period;
+ else
+ mi->heartbeat_period= (float) min(SLAVE_MAX_HEARTBEAT_PERIOD,
+ (slave_net_timeout/2.0));
+ mi->received_heartbeats= LL(0); // counter lives until master is CHANGEd
+ /*
+ reset the last time server_id list if the current CHANGE MASTER
+ is mentioning IGNORE_SERVER_IDS= (...)
+ */
+ if (lex_mi->repl_ignore_server_ids_opt == LEX_MASTER_INFO::LEX_MI_ENABLE)
+ reset_dynamic(&mi->ignore_server_ids);
+ for (uint i= 0; i < lex_mi->repl_ignore_server_ids.elements; i++)
+ {
+ ulong s_id;
+ get_dynamic(&lex_mi->repl_ignore_server_ids, (uchar*) &s_id, i);
+ if (s_id == ::server_id && replicate_same_server_id)
+ {
+ my_error(ER_SLAVE_IGNORE_SERVER_IDS, MYF(0), s_id);
+ ret= TRUE;
+ goto err;
+ }
+ else
+ {
+ if (bsearch((const ulong *) &s_id,
+ mi->ignore_server_ids.buffer,
+ mi->ignore_server_ids.elements, sizeof(ulong),
+ (int (*) (const void*, const void*))
+ change_master_server_id_cmp) == NULL)
+ insert_dynamic(&mi->ignore_server_ids, (uchar*) &s_id);
+ }
+ }
+ sort_dynamic(&mi->ignore_server_ids, (qsort_cmp) change_master_server_id_cmp);
- if (lex_mi->ssl != LEX_MASTER_INFO::SSL_UNCHANGED)
- mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::SSL_ENABLE);
+ if (lex_mi->ssl != LEX_MASTER_INFO::LEX_MI_UNCHANGED)
+ mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::LEX_MI_ENABLE);
- if (lex_mi->ssl_verify_server_cert != LEX_MASTER_INFO::SSL_UNCHANGED)
+ if (lex_mi->ssl_verify_server_cert != LEX_MASTER_INFO::LEX_MI_UNCHANGED)
mi->ssl_verify_server_cert=
- (lex_mi->ssl_verify_server_cert == LEX_MASTER_INFO::SSL_ENABLE);
+ (lex_mi->ssl_verify_server_cert == LEX_MASTER_INFO::LEX_MI_ENABLE);
if (lex_mi->ssl_ca)
strmake(mi->ssl_ca, lex_mi->ssl_ca, sizeof(mi->ssl_ca)-1);
@@ -1218,9 +1463,11 @@ bool change_master(THD* thd, Master_info* mi)
if (lex_mi->relay_log_name)
{
need_relay_log_purge= 0;
- strmake(mi->rli.group_relay_log_name,lex_mi->relay_log_name,
+ char relay_log_name[FN_REFLEN];
+ mi->rli.relay_log.make_log_name(relay_log_name, lex_mi->relay_log_name);
+ strmake(mi->rli.group_relay_log_name, relay_log_name,
sizeof(mi->rli.group_relay_log_name)-1);
- strmake(mi->rli.event_relay_log_name,lex_mi->relay_log_name,
+ strmake(mi->rli.event_relay_log_name, relay_log_name,
sizeof(mi->rli.event_relay_log_name)-1);
}
@@ -1267,8 +1514,8 @@ bool change_master(THD* thd, Master_info* mi)
if (flush_master_info(mi, 0))
{
my_error(ER_RELAY_LOG_INIT, MYF(0), "Failed to flush master info file");
- unlock_slave_threads(mi);
- DBUG_RETURN(TRUE);
+ ret= TRUE;
+ goto err;
}
if (need_relay_log_purge)
{
@@ -1279,8 +1526,8 @@ bool change_master(THD* thd, Master_info* mi)
&errmsg))
{
my_error(ER_RELAY_LOG_FAIL, MYF(0), errmsg);
- unlock_slave_threads(mi);
- DBUG_RETURN(TRUE);
+ ret= TRUE;
+ goto err;
}
}
else
@@ -1295,8 +1542,8 @@ bool change_master(THD* thd, Master_info* mi)
&msg, 0))
{
my_error(ER_RELAY_LOG_INIT, MYF(0), msg);
- unlock_slave_threads(mi);
- DBUG_RETURN(TRUE);
+ ret= TRUE;
+ goto err;
}
}
/*
@@ -1333,10 +1580,13 @@ bool change_master(THD* thd, Master_info* mi)
pthread_cond_broadcast(&mi->data_cond);
pthread_mutex_unlock(&mi->rli.data_lock);
+err:
unlock_slave_threads(mi);
thd_proc_info(thd, 0);
- my_ok(thd);
- DBUG_RETURN(FALSE);
+ if (ret == FALSE)
+ my_ok(thd);
+ delete_dynamic(&lex_mi->repl_ignore_server_ids); //freeing of parser-time alloc
+ DBUG_RETURN(ret);
}
@@ -1357,7 +1607,11 @@ int reset_master(THD* thd)
ER(ER_FLUSH_MASTER_BINLOG_CLOSED), MYF(ME_BELL+ME_WAITTANG));
return 1;
}
- return mysql_bin_log.reset_logs(thd);
+
+ if (mysql_bin_log.reset_logs(thd))
+ return 1;
+ RUN_HOOK(binlog_transmit, after_reset_master, (thd, 0 /* flags */));
+ return 0;
}
int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
@@ -1395,6 +1649,7 @@ bool mysql_show_binlog_events(THD* thd)
bool ret = TRUE;
IO_CACHE log;
File file = -1;
+ MYSQL_BIN_LOG *binary_log= NULL;
DBUG_ENTER("mysql_show_binlog_events");
Log_event::init_show_field_list(&field_list);
@@ -1405,14 +1660,30 @@ bool mysql_show_binlog_events(THD* thd)
Format_description_log_event *description_event= new
Format_description_log_event(3); /* MySQL 4.0 by default */
- /*
- Wait for handlers to insert any pending information
- into the binlog. For e.g. ndb which updates the binlog asynchronously
- this is needed so that the uses sees all its own commands in the binlog
- */
- ha_binlog_wait(thd);
+ DBUG_ASSERT(thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS ||
+ thd->lex->sql_command == SQLCOM_SHOW_RELAYLOG_EVENTS);
- if (mysql_bin_log.is_open())
+ /* select wich binary log to use: binlog or relay */
+ if ( thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS )
+ {
+ /*
+ Wait for handlers to insert any pending information
+ into the binlog. For e.g. ndb which updates the binlog asynchronously
+ this is needed so that the uses sees all its own commands in the binlog
+ */
+ ha_binlog_wait(thd);
+
+ binary_log= &mysql_bin_log;
+ }
+ else /* showing relay log contents */
+ {
+ if (!active_mi)
+ DBUG_RETURN(TRUE);
+
+ binary_log= &(active_mi->rli.relay_log);
+ }
+
+ if (binary_log->is_open())
{
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
SELECT_LEX_UNIT *unit= &thd->lex->unit;
@@ -1420,7 +1691,7 @@ bool mysql_show_binlog_events(THD* thd)
my_off_t pos = max(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
char search_file_name[FN_REFLEN], *name;
const char *log_file_name = lex_mi->log_file_name;
- pthread_mutex_t *log_lock = mysql_bin_log.get_log_lock();
+ pthread_mutex_t *log_lock = binary_log->get_log_lock();
LOG_INFO linfo;
Log_event* ev;
@@ -1430,13 +1701,13 @@ bool mysql_show_binlog_events(THD* thd)
name= search_file_name;
if (log_file_name)
- mysql_bin_log.make_log_name(search_file_name, log_file_name);
+ binary_log->make_log_name(search_file_name, log_file_name);
else
name=0; // Find first log
linfo.index_file_offset = 0;
- if (mysql_bin_log.find_log_pos(&linfo, name, 1))
+ if (binary_log->find_log_pos(&linfo, name, 1))
{
errmsg = "Could not find target log";
goto err;
@@ -1739,6 +2010,26 @@ public:
bool update(THD *thd, set_var *var);
};
+static void fix_slave_net_timeout(THD *thd, enum_var_type type)
+{
+ DBUG_ENTER("fix_slave_net_timeout");
+#ifdef HAVE_REPLICATION
+ pthread_mutex_lock(&LOCK_active_mi);
+ DBUG_PRINT("info",("slave_net_timeout=%lu mi->heartbeat_period=%.3f",
+ slave_net_timeout,
+ (active_mi? active_mi->heartbeat_period : 0.0)));
+ if (active_mi && slave_net_timeout < active_mi->heartbeat_period)
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
+ "The currect value for master_heartbeat_period"
+ " exceeds the new value of `slave_net_timeout' sec."
+ " A sensible value for the period should be"
+ " less than the timeout.");
+ pthread_mutex_unlock(&LOCK_active_mi);
+#endif
+ DBUG_VOID_RETURN;
+}
+
static sys_var_chain vars = { NULL, NULL };
static sys_var_const sys_log_slave_updates(&vars, "log_slave_updates",
@@ -1755,6 +2046,16 @@ static sys_var_const sys_relay_log_info_file(&vars, "relay_log_info_file",
(uchar*) &relay_log_info_file);
static sys_var_bool_ptr sys_relay_log_purge(&vars, "relay_log_purge",
&relay_log_purge);
+static sys_var_bool_ptr sys_relay_log_recovery(&vars, "relay_log_recovery",
+ &relay_log_recovery);
+static sys_var_uint_ptr sys_sync_binlog_period(&vars, "sync_binlog",
+ &sync_binlog_period);
+static sys_var_uint_ptr sys_sync_relaylog_period(&vars, "sync_relay_log",
+ &sync_relaylog_period);
+static sys_var_uint_ptr sys_sync_relayloginfo_period(&vars, "sync_relay_log_info",
+ &sync_relayloginfo_period);
+static sys_var_uint_ptr sys_sync_masterinfo_period(&vars, "sync_master_info",
+ &sync_masterinfo_period);
static sys_var_const sys_relay_log_space_limit(&vars,
"relay_log_space_limit",
OPT_GLOBAL, SHOW_LONGLONG,
@@ -1764,13 +2065,13 @@ static sys_var_const sys_slave_load_tmpdir(&vars, "slave_load_tmpdir",
OPT_GLOBAL, SHOW_CHAR_PTR,
(uchar*) &slave_load_tmpdir);
static sys_var_long_ptr sys_slave_net_timeout(&vars, "slave_net_timeout",
- &slave_net_timeout);
+ &slave_net_timeout,
+ fix_slave_net_timeout);
static sys_var_const sys_slave_skip_errors(&vars, "slave_skip_errors",
OPT_GLOBAL, SHOW_CHAR,
(uchar*) slave_skip_error_names);
static sys_var_long_ptr sys_slave_trans_retries(&vars, "slave_transaction_retries",
&slave_trans_retries);
-static sys_var_sync_binlog_period sys_sync_binlog_period(&vars, "sync_binlog", &sync_binlog_period);
static sys_var_slave_skip_counter sys_slave_skip_counter(&vars, "sql_slave_skip_counter");
@@ -1812,12 +2113,6 @@ bool sys_var_slave_skip_counter::update(THD *thd, set_var *var)
}
-bool sys_var_sync_binlog_period::update(THD *thd, set_var *var)
-{
- sync_binlog_period= (ulong) var->save_result.ulonglong_value;
- return 0;
-}
-
int init_replication_sys_vars()
{
if (mysql_add_sys_var_chain(vars.first, my_long_options))
@@ -1829,6 +2124,5 @@ int init_replication_sys_vars()
return 0;
}
-#endif /* HAVE_REPLICATION */
-
+#endif /* HAVE_REPLICATION */
diff --git a/sql/sql_repl.h b/sql/sql_repl.h
index d5c9040f8dc..aa71ac96ff8 100644
--- a/sql/sql_repl.h
+++ b/sql/sql_repl.h
@@ -13,6 +13,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#ifndef SQL_REPL_INCLUDED
+#define SQL_REPL_INCLUDED
+
#include "rpl_filter.h"
#ifdef HAVE_REPLICATION
@@ -65,3 +68,4 @@ int init_replication_sys_vars();
#endif /* HAVE_REPLICATION */
+#endif /* SQL_REPL_INCLUDED */
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 569d8183ab6..0e3b3511283 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -10518,6 +10518,18 @@ TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list)
null_bit= 1;
}
}
+ if (cur_field->type() == MYSQL_TYPE_BIT &&
+ cur_field->key_type() == HA_KEYTYPE_BIT)
+ {
+ /* This is a Field_bit since key_type is HA_KEYTYPE_BIT */
+ static_cast<Field_bit*>(cur_field)->set_bit_ptr(null_pos, null_bit);
+ null_bit+= cur_field->field_length & 7;
+ if (null_bit > 7)
+ {
+ null_pos++;
+ null_bit-= 8;
+ }
+ }
cur_field->reset();
field_pos+= cur_field->pack_length();
diff --git a/sql/sql_select.h b/sql/sql_select.h
index c9cd3ecba42..e44d416380e 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -1,3 +1,6 @@
+#ifndef SQL_SELECT_INCLUDED
+#define SQL_SELECT_INCLUDED
+
/* Copyright (C) 2000-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -759,3 +762,4 @@ inline bool optimizer_flag(THD *thd, uint flag)
return (thd->variables.optimizer_switch & flag);
}
+#endif /* SQL_SELECT_INCLUDED */
diff --git a/sql/sql_servers.h b/sql/sql_servers.h
index 63c691893d1..12855f8473c 100644
--- a/sql/sql_servers.h
+++ b/sql/sql_servers.h
@@ -1,3 +1,6 @@
+#ifndef SQL_SERVERS_INCLUDED
+#define SQL_SERVERS_INCLUDED
+
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -41,3 +44,5 @@ int alter_server(THD *thd, LEX_SERVER_OPTIONS *server_options);
/* lookup functions */
FOREIGN_SERVER *get_server_by_name(MEM_ROOT *mem, const char *server_name,
FOREIGN_SERVER *server_buffer);
+
+#endif /* SQL_SERVERS_INCLUDED */
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 2c1f360104b..413733c0148 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -920,35 +920,6 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
DBUG_VOID_RETURN;
}
-
-int
-mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd)
-{
- Protocol *protocol= thd->protocol;
- String *packet= protocol->storage_packet();
- DBUG_ENTER("mysqld_dump_create_info");
- DBUG_PRINT("enter",("table: %s",table_list->table->s->table_name.str));
-
- protocol->prepare_for_resend();
- if (store_create_info(thd, table_list, packet, NULL,
- FALSE /* show_database */))
- DBUG_RETURN(-1);
-
- if (fd < 0)
- {
- if (protocol->write())
- DBUG_RETURN(-1);
- protocol->flush();
- }
- else
- {
- if (my_write(fd, (const uchar*) packet->ptr(), packet->length(),
- MYF(MY_WME)))
- DBUG_RETURN(-1);
- }
- DBUG_RETURN(0);
-}
-
/*
Go through all character combinations and ensure that sql_lex.cc can
parse it as an identifier.
diff --git a/sql/sql_sort.h b/sql/sql_sort.h
index 1e9322f7f5b..102b3ef0a11 100644
--- a/sql/sql_sort.h
+++ b/sql/sql_sort.h
@@ -1,3 +1,6 @@
+#ifndef SQL_SORT_INCLUDED
+#define SQL_SORT_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -87,3 +90,5 @@ int merge_buffers(SORTPARAM *param,IO_CACHE *from_file,
BUFFPEK *lastbuff,BUFFPEK *Fb,
BUFFPEK *Tb,int flag);
void reuse_freed_buff(QUEUE *queue, BUFFPEK *reuse, uint key_length);
+
+#endif /* SQL_SORT_INCLUDED */
diff --git a/sql/sql_string.h b/sql/sql_string.h
index d62908e5d66..7b10aafbff1 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -1,3 +1,6 @@
+#ifndef SQL_STRING_INCLUDED
+#define SQL_STRING_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -389,3 +392,5 @@ static inline bool check_if_only_end_space(CHARSET_INFO *cs, char *str,
{
return str+ cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end;
}
+
+#endif /* SQL_STRING_INCLUDED */
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 869ae42c98c..ca4f5c9f1bc 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4262,73 +4262,6 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table,
return 1;
}
-
-static int prepare_for_restore(THD* thd, TABLE_LIST* table,
- HA_CHECK_OPT *check_opt)
-{
- DBUG_ENTER("prepare_for_restore");
-
- if (table->table) // do not overwrite existing tables on restore
- {
- DBUG_RETURN(send_check_errmsg(thd, table, "restore",
- "table exists, will not overwrite on restore"
- ));
- }
- else
- {
- char* backup_dir= thd->lex->backup_dir;
- char src_path[FN_REFLEN], dst_path[FN_REFLEN + 1], uname[FN_REFLEN];
- char* table_name= table->table_name;
- char* db= table->db;
-
- VOID(tablename_to_filename(table->table_name, uname, sizeof(uname) - 1));
-
- if (fn_format_relative_to_data_home(src_path, uname, backup_dir, reg_ext))
- DBUG_RETURN(-1); // protect buffer overflow
-
- build_table_filename(dst_path, sizeof(dst_path) - 1,
- db, table_name, reg_ext, 0);
-
- if (lock_and_wait_for_table_name(thd,table))
- DBUG_RETURN(-1);
-
- if (my_copy(src_path, dst_path, MYF(MY_WME)))
- {
- pthread_mutex_lock(&LOCK_open);
- unlock_table_name(thd, table);
- pthread_mutex_unlock(&LOCK_open);
- DBUG_RETURN(send_check_errmsg(thd, table, "restore",
- "Failed copying .frm file"));
- }
- if (mysql_truncate(thd, table, 1))
- {
- pthread_mutex_lock(&LOCK_open);
- unlock_table_name(thd, table);
- pthread_mutex_unlock(&LOCK_open);
- DBUG_RETURN(send_check_errmsg(thd, table, "restore",
- "Failed generating table from .frm file"));
- }
- }
-
- /*
- Now we should be able to open the partially restored table
- to finish the restore in the handler later on
- */
- pthread_mutex_lock(&LOCK_open);
- if (reopen_name_locked_table(thd, table, TRUE))
- {
- unlock_table_name(thd, table);
- pthread_mutex_unlock(&LOCK_open);
- DBUG_RETURN(send_check_errmsg(thd, table, "restore",
- "Failed to open partially restored table"));
- }
- /* A MERGE table must not come here. */
- DBUG_ASSERT(!table->table || !table->table->child_l);
- pthread_mutex_unlock(&LOCK_open);
- DBUG_RETURN(0);
-}
-
-
static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
HA_CHECK_OPT *check_opt)
{
@@ -4994,29 +4927,6 @@ err:
}
-bool mysql_backup_table(THD* thd, TABLE_LIST* table_list)
-{
- DBUG_ENTER("mysql_backup_table");
- WARN_DEPRECATED(thd, "6.0", "BACKUP TABLE",
- "MySQL Administrator (mysqldump, mysql)");
- DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
- "backup", TL_READ, 0, 0, 0, 0,
- &handler::ha_backup, 0));
-}
-
-
-bool mysql_restore_table(THD* thd, TABLE_LIST* table_list)
-{
- DBUG_ENTER("mysql_restore_table");
- WARN_DEPRECATED(thd, "6.0", "RESTORE TABLE",
- "MySQL Administrator (mysqldump, mysql)");
- DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
- "restore", TL_WRITE, 1, 1, 0,
- &prepare_for_restore,
- &handler::ha_restore, 0));
-}
-
-
bool mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{
DBUG_ENTER("mysql_repair_table");
diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h
index f6754a75284..b411acf2ac5 100644
--- a/sql/sql_trigger.h
+++ b/sql/sql_trigger.h
@@ -1,3 +1,6 @@
+#ifndef SQL_TRIGGER_INCLUDED
+#define SQL_TRIGGER_INCLUDED
+
/* Copyright (C) 2004-2005 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -174,3 +177,4 @@ bool load_table_name_for_trigger(THD *thd,
const LEX_STRING *trn_path,
LEX_STRING *tbl_name);
+#endif /* SQL_TRIGGER_INCLUDED */
diff --git a/sql/sql_udf.h b/sql/sql_udf.h
index 4b8b492698e..95cb167869e 100644
--- a/sql/sql_udf.h
+++ b/sql/sql_udf.h
@@ -1,3 +1,6 @@
+#ifndef SQL_UDF_INCLUDED
+#define SQL_UDF_INCLUDED
+
/* Copyright (C) 2000-2001, 2003-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -140,3 +143,4 @@ void free_udf(udf_func *udf);
int mysql_create_function(THD *thd,udf_func *udf);
int mysql_drop_function(THD *thd,const LEX_STRING *name);
#endif
+#endif /* SQL_UDF_INCLUDED */
diff --git a/sql/sql_view.h b/sql/sql_view.h
index e08c2168e14..3de51c3264e 100644
--- a/sql/sql_view.h
+++ b/sql/sql_view.h
@@ -1,3 +1,6 @@
+#ifndef SQL_VIEW_INCLUDED
+#define SQL_VIEW_INCLUDED
+
/* -*- C++ -*- */
/* Copyright (C) 2004 MySQL AB
@@ -42,3 +45,4 @@ bool mysql_rename_view(THD *thd, const char *new_db, const char *new_name,
#define VIEW_ANY_ACL (SELECT_ACL | UPDATE_ACL | INSERT_ACL | DELETE_ACL)
+#endif /* SQL_VIEW_INCLUDED */
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 72b8aa32e30..d0bf24bd02b 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -650,7 +650,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
Currently there are 169 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 169
+%expect 168
/*
Comments for TOKENS.
@@ -813,6 +813,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token ENUM
%token EQ /* OPERATOR */
%token EQUAL_SYM /* OPERATOR */
+%token ERROR_SYM
%token ERRORS
%token ESCAPED
%token ESCAPE_SYM /* SQL-2003-R */
@@ -846,6 +847,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token FULLTEXT_SYM
%token FUNCTION_SYM /* SQL-2003-R */
%token GE
+%token GENERAL
%token GEOMETRYCOLLECTION
%token GEOMETRY_SYM
%token GET_FORMAT /* MYSQL-FUNC */
@@ -872,13 +874,13 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token IDENT_QUOTED
%token IF
%token IGNORE_SYM
+%token IGNORE_SERVER_IDS_SYM
%token IMPORT
%token INDEXES
%token INDEX_SYM
%token INFILE
%token INITIAL_SIZE_SYM
%token INNER_SYM /* SQL-2003-R */
-%token INNOBASE_SYM
%token INOUT_SYM /* SQL-2003-R */
%token INSENSITIVE_SYM /* SQL-2003-R */
%token INSERT /* SQL-2003-R */
@@ -946,6 +948,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token MASTER_SSL_VERIFY_SERVER_CERT_SYM
%token MASTER_SYM
%token MASTER_USER_SYM
+%token MASTER_HEARTBEAT_PERIOD_SYM
%token MATCH /* SQL-2003-R */
%token MAX_CONNECTIONS_PER_HOUR
%token MAX_QUERIES_PER_HOUR
@@ -1062,6 +1065,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token REDUNDANT_SYM
%token REFERENCES /* SQL-2003-R */
%token REGEXP
+%token RELAY
+%token RELAYLOG_SYM
%token RELAY_LOG_FILE_SYM
%token RELAY_LOG_POS_SYM
%token RELAY_THREAD
@@ -1115,6 +1120,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token SIGNED_SYM
%token SIMPLE_SYM /* SQL-2003-N */
%token SLAVE
+%token SLOW
%token SMALLINT /* SQL-2003-R */
%token SNAPSHOT_SYM
%token SOCKET_SYM
@@ -1391,7 +1397,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
show describe load alter optimize keycache preload flush
reset purge begin commit rollback savepoint release
slave master_def master_defs master_file_def slave_until_opts
- repair restore backup analyze check start checksum
+ repair analyze check start checksum
field_list field_list_item field_spec kill column_def key_def
keycache_list assign_to_keycache preload_list preload_keys
select_item_list select_item values_list no_braces
@@ -1422,7 +1428,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
prepare prepare_src execute deallocate
statement sp_suid
sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa
- load_data opt_field_or_var_spec fields_or_vars opt_load_data_set_spec
+ opt_field_or_var_spec fields_or_vars opt_load_data_set_spec
view_replace_or_algorithm view_replace
view_algorithm view_or_trigger_or_sp_or_event
definer_tail no_definer_tail
@@ -1538,7 +1544,6 @@ verb_clause:
statement:
alter
| analyze
- | backup
| binlog_base64_event
| call
| change
@@ -1572,7 +1577,6 @@ statement:
| repair
| replace
| reset
- | restore
| revoke
| rollback
| savepoint
@@ -1690,6 +1694,12 @@ change:
LEX *lex = Lex;
lex->sql_command = SQLCOM_CHANGE_MASTER;
bzero((char*) &lex->mi, sizeof(lex->mi));
+ /*
+ resetting flags that can left from the previous CHANGE MASTER
+ */
+ lex->mi.repl_ignore_server_ids_opt= LEX_MASTER_INFO::LEX_MI_UNCHANGED;
+ my_init_dynamic_array(&Lex->mi.repl_ignore_server_ids,
+ sizeof(::server_id), 16, 16);
}
master_defs
{}
@@ -1724,7 +1734,7 @@ master_def:
| MASTER_SSL_SYM EQ ulong_num
{
Lex->mi.ssl= $3 ?
- LEX_MASTER_INFO::SSL_ENABLE : LEX_MASTER_INFO::SSL_DISABLE;
+ LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
}
| MASTER_SSL_CA_SYM EQ TEXT_STRING_sys
{
@@ -1749,11 +1759,69 @@ master_def:
| MASTER_SSL_VERIFY_SERVER_CERT_SYM EQ ulong_num
{
Lex->mi.ssl_verify_server_cert= $3 ?
- LEX_MASTER_INFO::SSL_ENABLE : LEX_MASTER_INFO::SSL_DISABLE;
+ LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
}
- | master_file_def
+
+ | MASTER_HEARTBEAT_PERIOD_SYM EQ NUM_literal
+ {
+ Lex->mi.heartbeat_period= (float) $3->val_real();
+ if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD ||
+ Lex->mi.heartbeat_period < 0.0)
+ {
+ const char format[]= "%d seconds";
+ char buf[4*sizeof(SLAVE_MAX_HEARTBEAT_PERIOD) + sizeof(format)];
+ my_sprintf(buf, (buf, format, SLAVE_MAX_HEARTBEAT_PERIOD));
+ my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
+ MYF(0),
+ " is negative or exceeds the maximum ",
+ buf);
+ MYSQL_YYABORT;
+ }
+ if (Lex->mi.heartbeat_period > slave_net_timeout)
+ {
+ push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
+ ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE),
+ " exceeds the value of `slave_net_timeout' sec.",
+ " A sensible value for the period should be"
+ " less than the timeout.");
+ }
+ if (Lex->mi.heartbeat_period < 0.001)
+ {
+ if (Lex->mi.heartbeat_period != 0.0)
+ {
+ push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
+ ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE),
+ " is less than 1 msec.",
+ " The period is reset to zero which means"
+ " no heartbeats will be sending");
+ Lex->mi.heartbeat_period= 0.0;
+ }
+ Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_DISABLE;
+ }
+ Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
+ }
+ | IGNORE_SERVER_IDS_SYM EQ '(' ignore_server_id_list ')'
+ {
+ Lex->mi.repl_ignore_server_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
+ }
+ |
+ master_file_def
;
+ignore_server_id_list:
+ /* Empty */
+ | ignore_server_id
+ | ignore_server_id_list ',' ignore_server_id
+ ;
+
+ignore_server_id:
+ ulong_num
+ {
+ insert_dynamic(&Lex->mi.repl_ignore_server_ids, (uchar*) &($1));
+ }
+
master_file_def:
MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
{
@@ -4559,13 +4627,6 @@ create_table_option:
Lex->create_info.db_type= $3;
Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE;
}
- | TYPE_SYM opt_equal storage_engines
- {
- Lex->create_info.db_type= $3;
- WARN_DEPRECATED(yythd, "6.0", "TYPE=storage_engine",
- "'ENGINE=storage_engine'");
- Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE;
- }
| MAX_ROWS opt_equal ulonglong_num
{
Lex->create_info.max_rows= $3;
@@ -4982,7 +5043,7 @@ type:
{ $$=MYSQL_TYPE_DATE; }
| TIME_SYM
{ $$=MYSQL_TYPE_TIME; }
- | TIMESTAMP opt_field_length
+ | TIMESTAMP
{
if (YYTHD->variables.sql_mode & MODE_MAXDB)
$$=MYSQL_TYPE_DATETIME;
@@ -6252,28 +6313,6 @@ slave_until_opts:
| slave_until_opts ',' master_file_def
;
-restore:
- RESTORE_SYM table_or_tables
- {
- Lex->sql_command = SQLCOM_RESTORE_TABLE;
- }
- table_list FROM TEXT_STRING_sys
- {
- Lex->backup_dir = $6.str;
- }
- ;
-
-backup:
- BACKUP_SYM table_or_tables
- {
- Lex->sql_command = SQLCOM_BACKUP_TABLE;
- }
- table_list TO_SYM TEXT_STRING_sys
- {
- Lex->backup_dir = $6.str;
- }
- ;
-
checksum:
CHECKSUM_SYM table_or_tables
{
@@ -8879,7 +8918,7 @@ interval_time_stamp:
implementation without changing its
resolution.
*/
- WARN_DEPRECATED(yythd, "6.2", "FRAC_SECOND", "MICROSECOND");
+ WARN_DEPRECATED(yythd, 6, 2, "FRAC_SECOND", "MICROSECOND");
}
;
@@ -10050,14 +10089,6 @@ show_param:
if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES))
MYSQL_YYABORT;
}
- | opt_full PLUGIN_SYM
- {
- LEX *lex= Lex;
- WARN_DEPRECATED(yythd, "6.0", "SHOW PLUGIN", "'SHOW PLUGINS'");
- lex->sql_command= SQLCOM_SHOW_PLUGINS;
- if (prepare_schema_table(YYTHD, lex, 0, SCH_PLUGINS))
- MYSQL_YYABORT;
- }
| PLUGINS_SYM
{
LEX *lex= Lex;
@@ -10104,6 +10135,11 @@ show_param:
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_BINLOG_EVENTS;
} opt_limit_clause_init
+ | RELAYLOG_SYM EVENTS_SYM binlog_in binlog_from
+ {
+ LEX *lex= Lex;
+ lex->sql_command= SQLCOM_SHOW_RELAYLOG_EVENTS;
+ } opt_limit_clause_init
| keys_or_index from_or_in table_ident opt_db where_clause
{
LEX *lex= Lex;
@@ -10118,14 +10154,6 @@ show_param:
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_COLUMN_TYPES;
}
- | TABLE_SYM TYPES_SYM
- {
- LEX *lex=Lex;
- lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
- WARN_DEPRECATED(yythd, "6.0", "SHOW TABLE TYPES", "'SHOW [STORAGE] ENGINES'");
- if (prepare_schema_table(YYTHD, lex, 0, SCH_ENGINES))
- MYSQL_YYABORT;
- }
| opt_storage ENGINES_SYM
{
LEX *lex=Lex;
@@ -10173,30 +10201,6 @@ show_param:
if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS))
MYSQL_YYABORT;
}
- | INNOBASE_SYM STATUS_SYM
- {
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_SHOW_ENGINE_STATUS;
- if (!(lex->create_info.db_type=
- ha_resolve_by_legacy_type(YYTHD, DB_TYPE_INNODB)))
- {
- my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB");
- MYSQL_YYABORT;
- }
- WARN_DEPRECATED(yythd, "6.0", "SHOW INNODB STATUS", "'SHOW ENGINE INNODB STATUS'");
- }
- | MUTEX_SYM STATUS_SYM
- {
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_SHOW_ENGINE_MUTEX;
- if (!(lex->create_info.db_type=
- ha_resolve_by_legacy_type(YYTHD, DB_TYPE_INNODB)))
- {
- my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB");
- MYSQL_YYABORT;
- }
- WARN_DEPRECATED(yythd, "6.0", "SHOW MUTEX STATUS", "'SHOW ENGINE INNODB MUTEX'");
- }
| opt_full PROCESSLIST_SYM
{ Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
| opt_var_type VARIABLES wild_and_where
@@ -10465,6 +10469,18 @@ flush_option:
opt_table_list {}
| TABLES WITH READ_SYM LOCK_SYM
{ Lex->type|= REFRESH_TABLES | REFRESH_READ_LOCK; }
+ | ERROR_SYM LOGS_SYM
+ { Lex->type|= REFRESH_ERROR_LOG; }
+ | ENGINE_SYM LOGS_SYM
+ { Lex->type|= REFRESH_ENGINE_LOG; }
+ | GENERAL LOGS_SYM
+ { Lex->type|= REFRESH_GENERAL_LOG; }
+ | SLOW LOGS_SYM
+ { Lex->type|= REFRESH_SLOW_LOG; }
+ | BINARY LOGS_SYM
+ { Lex->type|= REFRESH_BINARY_LOG; }
+ | RELAY LOGS_SYM
+ { Lex->type|= REFRESH_RELAY_LOG; }
| QUERY_SYM CACHE_SYM
{ Lex->type|= REFRESH_QUERY_CACHE_FREE; }
| HOSTS_SYM
@@ -10583,40 +10599,21 @@ load:
MYSQL_YYABORT;
}
}
- load_data
- {}
- | LOAD TABLE_SYM table_ident FROM MASTER_SYM
- {
- LEX *lex=Lex;
- WARN_DEPRECATED(yythd, "6.0", "LOAD TABLE FROM MASTER",
- "MySQL Administrator (mysqldump, mysql)");
- if (lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD TABLE");
- MYSQL_YYABORT;
- }
- lex->sql_command = SQLCOM_LOAD_MASTER_TABLE;
- if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING))
- MYSQL_YYABORT;
- }
- ;
-
-load_data:
load_data_lock opt_local INFILE TEXT_STRING_filesystem
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_LOAD;
- lex->lock_option= $1;
- lex->local_file= $2;
+ lex->lock_option= $4;
+ lex->local_file= $5;
lex->duplicates= DUP_ERROR;
lex->ignore= 0;
- if (!(lex->exchange= new sql_exchange($4.str, 0)))
+ if (!(lex->exchange= new sql_exchange($7.str, 0)))
MYSQL_YYABORT;
}
opt_duplicate INTO TABLE_SYM table_ident
{
LEX *lex=Lex;
- if (!Select->add_table_to_list(YYTHD, $9, NULL, TL_OPTION_UPDATING,
+ if (!Select->add_table_to_list(YYTHD, $12, NULL, TL_OPTION_UPDATING,
lex->lock_option))
MYSQL_YYABORT;
lex->field_list.empty();
@@ -10624,18 +10621,11 @@ load_data:
lex->value_list.empty();
}
opt_load_data_charset
- { Lex->exchange->cs= $11; }
+ { Lex->exchange->cs= $14; }
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
opt_load_data_set_spec
{}
- | FROM MASTER_SYM
- {
- Lex->sql_command = SQLCOM_LOAD_MASTER_DATA;
- WARN_DEPRECATED(yythd, "6.0", "LOAD DATA FROM MASTER",
- "mysqldump or future "
- "BACKUP/RESTORE DATABASE facility");
- }
- ;
+ ;
opt_local:
/* empty */ { $$=0;}
@@ -11614,6 +11604,7 @@ keyword_sp:
| ENUM {}
| ENGINE_SYM {}
| ENGINES_SYM {}
+ | ERROR_SYM {}
| ERRORS {}
| ESCAPE_SYM {}
| EVENT_SYM {}
@@ -11648,7 +11639,6 @@ keyword_sp:
| IPC_SYM {}
| ISOLATION {}
| ISSUER_SYM {}
- | INNOBASE_SYM {}
| INSERT_METHOD {}
| KEY_BLOCK_SIZE {}
| LAST_SYM {}
@@ -11739,6 +11729,8 @@ keyword_sp:
| REDO_BUFFER_SIZE_SYM {}
| REDOFILE_SYM {}
| REDUNDANT_SYM {}
+ | RELAY {}
+ | RELAYLOG_SYM {}
| RELAY_LOG_FILE_SYM {}
| RELAY_LOG_POS_SYM {}
| RELAY_THREAD {}
diff --git a/sql/structs.h b/sql/structs.h
index 2546d241059..d54921791a1 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -1,3 +1,6 @@
+#ifndef STRUCTS_INCLUDED
+#define STRUCTS_INCLUDED
+
/* Copyright (C) 2000-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -386,3 +389,5 @@ public:
Discrete_interval* get_tail() const { return tail; };
Discrete_interval* get_current() const { return current; };
};
+
+#endif /* STRUCTS_INCLUDED */
diff --git a/sql/table.h b/sql/table.h
index eae261cc97d..cc4257c826d 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1,3 +1,6 @@
+#ifndef TABLE_INCLUDED
+#define TABLE_INCLUDED
+
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
@@ -1772,3 +1775,4 @@ static inline void dbug_tmp_restore_column_maps(MY_BITMAP *read_set,
size_t max_row_length(TABLE *table, const uchar *data);
+#endif /* TABLE_INCLUDED */
diff --git a/sql/tzfile.h b/sql/tzfile.h
index 1ff82d62329..1c1800ba1ed 100644
--- a/sql/tzfile.h
+++ b/sql/tzfile.h
@@ -1,3 +1,6 @@
+#ifndef TZFILE_INCLUDED
+#define TZFILE_INCLUDED
+
/* Copyright (C) 2004 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -134,3 +137,5 @@ struct tzhead {
*/
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
+
+#endif
diff --git a/sql/tztime.h b/sql/tztime.h
index 9bf103519c4..9990e91f17b 100644
--- a/sql/tztime.h
+++ b/sql/tztime.h
@@ -1,3 +1,6 @@
+#ifndef TZTIME_INCLUDED
+#define TZTIME_INCLUDED
+
/* Copyright (C) 2004 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -79,3 +82,4 @@ static const int MY_TZ_TABLES_COUNT= 4;
#endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */
+#endif /* TZTIME_INCLUDED */
diff --git a/sql/unireg.h b/sql/unireg.h
index 3ff7f058e3c..6c9080aea79 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -1,3 +1,6 @@
+#ifndef UNIREG_INCLUDED
+#define UNIREG_INCLUDED
+
/* Copyright (C) 2000-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -16,8 +19,6 @@
/* Extra functions used by unireg library */
-#ifndef _unireg_h
-
#ifndef NO_ALARM_LOOP
#define NO_ALARM_LOOP /* lib5 and popen can't use alarm */
#endif
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 9c913b4f14d..cdfbf16db99 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -584,90 +584,6 @@ const char *ha_myisam::index_type(uint key_number)
"BTREE");
}
-#ifdef HAVE_REPLICATION
-int ha_myisam::net_read_dump(NET* net)
-{
- int data_fd = file->dfile;
- int error = 0;
-
- my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME));
- for (;;)
- {
- ulong packet_len = my_net_read(net);
- if (!packet_len)
- break ; // end of file
- if (packet_len == packet_error)
- {
- sql_print_error("ha_myisam::net_read_dump - read error ");
- error= -1;
- goto err;
- }
- if (my_write(data_fd, (uchar*)net->read_pos, (uint) packet_len,
- MYF(MY_WME|MY_FNABP)))
- {
- error = errno;
- goto err;
- }
- }
-err:
- return error;
-}
-
-
-int ha_myisam::dump(THD* thd, int fd)
-{
- MYISAM_SHARE* share = file->s;
- NET* net = &thd->net;
- uint blocksize = share->blocksize;
- my_off_t bytes_to_read = share->state.state.data_file_length;
- int data_fd = file->dfile;
- uchar *buf = (uchar*) my_malloc(blocksize, MYF(MY_WME));
- if (!buf)
- return ENOMEM;
-
- int error = 0;
- my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME));
- for (; bytes_to_read > 0;)
- {
- size_t bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME));
- if (bytes == MY_FILE_ERROR)
- {
- error = errno;
- goto err;
- }
-
- if (fd >= 0)
- {
- if (my_write(fd, buf, bytes, MYF(MY_WME | MY_FNABP)))
- {
- error = errno ? errno : EPIPE;
- goto err;
- }
- }
- else
- {
- if (my_net_write(net, buf, bytes))
- {
- error = errno ? errno : EPIPE;
- goto err;
- }
- }
- bytes_to_read -= bytes;
- }
-
- if (fd < 0)
- {
- if (my_net_write(net, (uchar*) "", 0))
- error = errno ? errno : EPIPE;
- net_flush(net);
- }
-
-err:
- my_free((uchar*) buf, MYF(0));
- return error;
-}
-#endif /* HAVE_REPLICATION */
-
/* Name is here without an extension */
int ha_myisam::open(const char *name, int mode, uint test_if_locked)
@@ -905,113 +821,6 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
}
-int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
-{
- HA_CHECK_OPT tmp_check_opt;
- char *backup_dir= thd->lex->backup_dir;
- char src_path[FN_REFLEN], dst_path[FN_REFLEN];
- char table_name[FN_REFLEN];
- int error;
- const char* errmsg;
- DBUG_ENTER("restore");
-
- VOID(tablename_to_filename(table->s->table_name.str, table_name,
- sizeof(table_name)));
-
- if (fn_format_relative_to_data_home(src_path, table_name, backup_dir,
- MI_NAME_DEXT))
- DBUG_RETURN(HA_ADMIN_INVALID);
-
- strxmov(dst_path, table->s->normalized_path.str, MI_NAME_DEXT, NullS);
- if (my_copy(src_path, dst_path, MYF(MY_WME)))
- {
- error= HA_ADMIN_FAILED;
- errmsg= "Failed in my_copy (Error %d)";
- goto err;
- }
-
- tmp_check_opt.init();
- tmp_check_opt.flags |= T_VERY_SILENT | T_CALC_CHECKSUM | T_QUICK;
- DBUG_RETURN(repair(thd, &tmp_check_opt));
-
- err:
- {
- MI_CHECK param;
- myisamchk_init(&param);
- param.thd= thd;
- param.op_name= "restore";
- param.db_name= table->s->db.str;
- param.table_name= table->s->table_name.str;
- param.testflag= 0;
- mi_check_print_error(&param, errmsg, my_errno);
- DBUG_RETURN(error);
- }
-}
-
-
-int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
-{
- char *backup_dir= thd->lex->backup_dir;
- char src_path[FN_REFLEN], dst_path[FN_REFLEN];
- char table_name[FN_REFLEN];
- int error;
- const char *errmsg;
- DBUG_ENTER("ha_myisam::backup");
-
- VOID(tablename_to_filename(table->s->table_name.str, table_name,
- sizeof(table_name)));
-
- if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir,
- reg_ext))
- {
- errmsg= "Failed in fn_format() for .frm file (errno: %d)";
- error= HA_ADMIN_INVALID;
- goto err;
- }
-
- strxmov(src_path, table->s->normalized_path.str, reg_ext, NullS);
- if (my_copy(src_path, dst_path,
- MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
- {
- error = HA_ADMIN_FAILED;
- errmsg = "Failed copying .frm file (errno: %d)";
- goto err;
- }
-
- /* Change extension */
- if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir,
- MI_NAME_DEXT))
- {
- errmsg = "Failed in fn_format() for .MYD file (errno: %d)";
- error = HA_ADMIN_INVALID;
- goto err;
- }
-
- strxmov(src_path, table->s->normalized_path.str, MI_NAME_DEXT, NullS);
- if (my_copy(src_path, dst_path,
- MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
- {
- errmsg = "Failed copying .MYD file (errno: %d)";
- error= HA_ADMIN_FAILED;
- goto err;
- }
- DBUG_RETURN(HA_ADMIN_OK);
-
- err:
- {
- MI_CHECK param;
- myisamchk_init(&param);
- param.thd= thd;
- param.op_name= "backup";
- param.db_name= table->s->db.str;
- param.table_name= table->s->table_name.str;
- param.testflag = 0;
- mi_check_print_error(&param,errmsg, my_errno);
- DBUG_RETURN(error);
- }
-}
-
-
int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
{
int error;
diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
index 55a5eac92de..5bb46b03650 100644
--- a/storage/myisam/ha_myisam.h
+++ b/storage/myisam/ha_myisam.h
@@ -125,15 +125,9 @@ class ha_myisam: public handler
bool is_crashed() const;
bool auto_repair() const { return myisam_recover_options != 0; }
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
- int restore(THD* thd, HA_CHECK_OPT* check_opt);
- int backup(THD* thd, HA_CHECK_OPT* check_opt);
int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt);
int preload_keys(THD* thd, HA_CHECK_OPT* check_opt);
bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes);
-#ifdef HAVE_REPLICATION
- int dump(THD* thd, int fd);
- int net_read_dump(NET* net);
-#endif
#ifdef HAVE_QUERY_CACHE
my_bool register_query_cache_table(THD *thd, char *table_key,
uint key_length,
diff --git a/storage/ndb/test/run-test/setup.cpp b/storage/ndb/test/run-test/setup.cpp
index cbb7a34f171..60f8285888c 100644
--- a/storage/ndb/test/run-test/setup.cpp
+++ b/storage/ndb/test/run-test/setup.cpp
@@ -105,6 +105,8 @@ setup_config(atrt_config& config)
*/
for (j = 0; j<(size_t)argc; j++)
{
+ if (tmp[j] == args_separator) /* skip arguments separator */
+ continue;
for (k = 0; proc_args[k].name; k++)
{
if (!strncmp(tmp[j], proc_args[k].name, strlen(proc_args[k].name)))
@@ -369,6 +371,12 @@ load_options(int argc, char** argv, int type, atrt_options& opts)
{
for (size_t i = 0; i<(size_t)argc; i++)
{
+ /**
+ * Skip the separator for arguments from config file and command
+ * line
+ */
+ if (argv[i] == args_separator)
+ continue;
for (size_t j = 0; f_options[j].name; j++)
{
const char * name = f_options[j].name;
diff --git a/strings/strings-not-used.h b/strings/strings-not-used.h
index 3efaa8ab6eb..8311545f22f 100644
--- a/strings/strings-not-used.h
+++ b/strings/strings-not-used.h
@@ -1,3 +1,6 @@
+#ifndef STRINGS_NOT_USED_INCLUDED
+#define STRINGS_NOT_USED_INCLUDED
+
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -35,3 +38,4 @@
#define _AlphabetSize 256
#endif /* NullS */
+#endif /* STRINGS_NOT_USED_INCLUDED */
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index f65e549fd96..a7b10f5d587 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -1532,7 +1532,7 @@ static void test_prepare_field_result()
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE test_prepare_field_result(int_c int, "
- "var_c varchar(50), ts_c timestamp(14), "
+ "var_c varchar(50), ts_c timestamp, "
"char_c char(4), date_c date, extra tinyint)");
myquery(rc);
@@ -4293,11 +4293,11 @@ static void test_fetch_date()
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE test_bind_result(c1 date, c2 time, \
- c3 timestamp(14), \
+ c3 timestamp, \
c4 year, \
c5 datetime, \
- c6 timestamp(4), \
- c7 timestamp(6))");
+ c6 timestamp, \
+ c7 timestamp)");
myquery(rc);
rc= mysql_query(mysql, "SET SQL_MODE=''");
@@ -4611,7 +4611,7 @@ static void test_prepare_ext()
" c12 numeric(8, 4),"
" c13 date,"
" c14 datetime,"
- " c15 timestamp(14),"
+ " c15 timestamp,"
" c16 time,"
" c17 year,"
" c18 bit,"
@@ -5645,7 +5645,7 @@ static void test_manual_sample()
}
if (mysql_query(mysql, "CREATE TABLE test_table(col1 int, col2 varchar(50), \
col3 smallint, \
- col4 timestamp(14))"))
+ col4 timestamp)"))
{
fprintf(stderr, "\n create table failed");
fprintf(stderr, "\n %s", mysql_error(mysql));
@@ -6555,7 +6555,7 @@ static void test_date()
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_date");
myquery(rc);
- rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIMESTAMP(14), \
+ rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIMESTAMP, \
c2 TIME, \
c3 DATETIME, \
c4 DATE)");
@@ -6621,10 +6621,10 @@ static void test_date_ts()
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_date");
myquery(rc);
- rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIMESTAMP(10), \
- c2 TIMESTAMP(14), \
+ rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIMESTAMP, \
+ c2 TIMESTAMP, \
c3 TIMESTAMP, \
- c4 TIMESTAMP(6))");
+ c4 TIMESTAMP)");
myquery(rc);
@@ -8312,7 +8312,7 @@ static void test_fetch_seek()
myquery(rc);
- rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10), c3 timestamp(14))");
+ rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10), c3 timestamp)");
myquery(rc);
rc= mysql_query(mysql, "insert into t1(c2) values('venu'), ('mysql'), ('open'), ('source')");
diff --git a/vio/vio_priv.h b/vio/vio_priv.h
index b662a616eef..21fa80143cd 100644
--- a/vio/vio_priv.h
+++ b/vio/vio_priv.h
@@ -1,3 +1,6 @@
+#ifndef VIO_PRIV_INCLUDED
+#define VIO_PRIV_INCLUDED
+
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -41,3 +44,4 @@ void vio_ssl_delete(Vio *vio);
int vio_ssl_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode);
#endif /* HAVE_OPENSSL */
+#endif /* VIO_PRIV_INCLUDED */