summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-08-05 22:56:11 +0300
committerMichael Widenius <monty@askmonty.org>2010-08-05 22:56:11 +0300
commitd042146e5b41b6222df3e6b4c16a44f3ef2939b7 (patch)
treee40f5b435f7d17ed1c24dfb787ab8cd5f4f7d5d8
parent3e610bc58d0ba325fdca3b06dfa976ecc513dc1e (diff)
parentf0f21036951f6fed2fddeb58375425f957751fd5 (diff)
downloadmariadb-git-d042146e5b41b6222df3e6b4c16a44f3ef2939b7.tar.gz
Merge with MariaDB 5.1.49
Removed references to HA_END_SPACE_KEY (which has been 0 for a long time)
-rwxr-xr-xBUILD/SETUP.sh4
-rwxr-xr-xBUILD/build_mccge.sh1
-rwxr-xr-xBUILD/compile-amd64-valgrind-max2
-rwxr-xr-xBUILD/compile-pentium-icc-valgrind-max2
-rwxr-xr-xBUILD/compile-pentium-valgrind-max2
-rwxr-xr-xBUILD/compile-pentium-valgrind-max-no-ndb2
-rwxr-xr-xBUILD/compile-pentium64-valgrind-max2
-rw-r--r--Makefile.am4
-rw-r--r--client/mysql.cc177
-rw-r--r--client/mysql_upgrade.c24
-rw-r--r--client/mysqladmin.cc60
-rw-r--r--client/mysqlbinlog.cc67
-rw-r--r--client/mysqlcheck.c58
-rw-r--r--client/mysqldump.c146
-rw-r--r--client/mysqlimport.c72
-rw-r--r--client/mysqlshow.c39
-rw-r--r--client/mysqlslap.c113
-rw-r--r--client/mysqltest.cc67
-rw-r--r--config/ac-macros/ssl.m411
-rw-r--r--configure.in17
-rw-r--r--extra/comp_err.c33
-rw-r--r--extra/my_print_defaults.c27
-rw-r--r--extra/mysql_waitpid.c2
-rw-r--r--extra/perror.c10
-rw-r--r--extra/resolve_stack_dump.c6
-rw-r--r--extra/resolveip.c2
-rwxr-xr-xextra/yassl/CMakeLists.txt2
-rw-r--r--extra/yassl/certs/ca-cert.pem42
-rw-r--r--extra/yassl/certs/client-cert.derbin699 -> 699 bytes
-rw-r--r--extra/yassl/certs/client-cert.pem18
-rw-r--r--extra/yassl/certs/dsa-cert.pem18
-rw-r--r--extra/yassl/certs/server-cert.pem20
-rw-r--r--extra/yassl/include/lock.hpp16
-rw-r--r--extra/yassl/src/Makefile.am2
-rw-r--r--extra/yassl/src/lock.cpp4
-rwxr-xr-xextra/yassl/taocrypt/CMakeLists.txt2
-rw-r--r--extra/yassl/taocrypt/benchmark/Makefile.am2
-rw-r--r--extra/yassl/taocrypt/src/Makefile.am3
-rw-r--r--extra/yassl/taocrypt/test/Makefile.am2
-rw-r--r--extra/yassl/taocrypt/test/memory.cpp2
-rw-r--r--extra/yassl/testsuite/Makefile.am2
-rw-r--r--include/m_string.h3
-rw-r--r--include/my_alarm.h4
-rw-r--r--include/my_base.h11
-rw-r--r--include/my_bitmap.h2
-rw-r--r--include/my_getopt.h21
-rw-r--r--include/my_global.h8
-rw-r--r--include/my_sys.h2
-rw-r--r--include/my_valgrind.h24
-rw-r--r--include/myisam.h2
-rw-r--r--include/sslopt-longopts.h21
-rw-r--r--libmysql/libmysql.c30
-rw-r--r--mysql-test/Makefile.am2
-rw-r--r--mysql-test/collections/default.experimental5
-rw-r--r--mysql-test/extra/binlog_tests/binlog.test25
-rw-r--r--mysql-test/extra/binlog_tests/blackhole.test24
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_deadlock.test7
-rw-r--r--mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test67
-rw-r--r--mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test118
-rw-r--r--mysql-test/extra/rpl_tests/rpl_flsh_tbls.test12
-rw-r--r--mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test20
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_delayed.test17
-rw-r--r--mysql-test/extra/rpl_tests/rpl_log.test57
-rw-r--r--mysql-test/extra/rpl_tests/rpl_max_relay_size.test19
-rw-r--r--mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test38
-rw-r--r--mysql-test/extra/rpl_tests/rpl_record_compare.test68
-rw-r--r--mysql-test/extra/rpl_tests/rpl_reset_slave.test59
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_basic.test32
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_tabledefs.test38
-rw-r--r--mysql-test/include/check_concurrent_insert.inc96
-rw-r--r--mysql-test/include/check_no_concurrent_insert.inc81
-rw-r--r--mysql-test/include/check_no_row_lock.inc71
-rw-r--r--mysql-test/include/check_shared_row_lock.inc61
-rw-r--r--mysql-test/include/check_slave_is_running.inc18
-rw-r--r--mysql-test/include/check_slave_no_error.inc17
-rw-r--r--mysql-test/include/check_slave_param.inc16
-rw-r--r--mysql-test/include/get_relay_log_pos.inc70
-rw-r--r--mysql-test/include/have_innodb_plugin.inc2
-rw-r--r--mysql-test/include/have_real_innodb_plugin.inc4
-rw-r--r--mysql-test/include/have_xtradb.inc4
-rw-r--r--mysql-test/include/mysqlhotcopy.inc121
-rw-r--r--mysql-test/include/percona_query_cache_with_comments.inc95
-rw-r--r--mysql-test/include/percona_query_cache_with_comments_begin.inc12
-rw-r--r--mysql-test/include/percona_query_cache_with_comments_clear.inc5
-rw-r--r--mysql-test/include/percona_query_cache_with_comments_end.inc3
-rw-r--r--mysql-test/include/percona_query_cache_with_comments_eval.inc7
-rw-r--r--mysql-test/include/percona_query_cache_with_comments_show.inc8
-rw-r--r--mysql-test/include/rpl_stmt_seq.inc30
-rw-r--r--mysql-test/include/show_binlog_events.inc41
-rw-r--r--mysql-test/include/show_rpl_debug_info.inc2
-rw-r--r--mysql-test/include/show_slave_status.inc25
-rw-r--r--mysql-test/include/show_slave_status2.inc8
-rw-r--r--mysql-test/include/test_fieldsize.inc7
-rw-r--r--mysql-test/include/wait_for_binlog_event.inc2
-rw-r--r--mysql-test/include/wait_for_slave_io_error.inc48
-rw-r--r--mysql-test/include/wait_for_slave_param.inc2
-rw-r--r--mysql-test/include/wait_for_slave_sql_error.inc17
-rw-r--r--mysql-test/include/wait_for_slave_sql_error_and_skip.inc27
-rw-r--r--mysql-test/include/wait_for_status_var.inc4
-rw-r--r--mysql-test/include/wait_until_count_sessions.inc1
-rw-r--r--mysql-test/lib/mtr_cases.pm50
-rw-r--r--mysql-test/lib/mtr_misc.pl22
-rw-r--r--mysql-test/lib/v1/mtr_process.pl3
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl2
-rwxr-xr-xmysql-test/mysql-test-run.pl74
-rw-r--r--mysql-test/r/alter_table-big.result32
-rw-r--r--mysql-test/r/bug39022.result6
-rw-r--r--mysql-test/r/create-big.result54
-rw-r--r--mysql-test/r/ctype_cp932_binlog_stm.result12
-rw-r--r--mysql-test/r/delete.result9
-rw-r--r--mysql-test/r/error_simulation.result44
-rw-r--r--mysql-test/r/events_scheduling.result19
-rw-r--r--mysql-test/r/explain.result13
-rw-r--r--mysql-test/r/flush_block_commit_notembedded.result10
-rw-r--r--mysql-test/r/func_in.result20
-rw-r--r--mysql-test/r/func_isnull.result14
-rw-r--r--mysql-test/r/func_like.result14
-rw-r--r--mysql-test/r/group_by.result20
-rw-r--r--mysql-test/r/group_min_max.result13
-rw-r--r--mysql-test/r/handler_myisam.result93
-rw-r--r--mysql-test/r/information_schema.result10
-rw-r--r--mysql-test/r/information_schema_all_engines.result4
-rw-r--r--mysql-test/r/innodb-index.result1173
-rw-r--r--mysql-test/r/innodb-use-sys-malloc.result48
-rw-r--r--mysql-test/r/innodb.result8
-rw-r--r--mysql-test/r/innodb_mysql_lock2.result601
-rw-r--r--mysql-test/r/innodb_xtradb_bug317074.result31
-rw-r--r--mysql-test/r/join_outer.result89
-rw-r--r--mysql-test/r/loaddata.result7
-rw-r--r--mysql-test/r/lock_sync.result631
-rw-r--r--mysql-test/r/log_state.result33
-rw-r--r--mysql-test/r/multi_update.result6
-rw-r--r--mysql-test/r/mysqldump.result15
-rw-r--r--mysql-test/r/mysqlhotcopy_archive.result118
-rw-r--r--mysql-test/r/mysqlhotcopy_myisam.result164
-rw-r--r--mysql-test/r/outfile_loaddata.result20
-rw-r--r--mysql-test/r/partition_error.result24
-rw-r--r--mysql-test/r/renamedb.result2
-rw-r--r--mysql-test/r/schema.result19
-rw-r--r--mysql-test/r/select.result15
-rw-r--r--mysql-test/r/select_pkeycache.result15
-rw-r--r--mysql-test/r/sp_trans_log.result12
-rw-r--r--mysql-test/r/subselect.result17
-rw-r--r--mysql-test/r/type_time.result10
-rw-r--r--mysql-test/r/upgrade.result28
-rw-r--r--mysql-test/r/variables.result9
-rw-r--r--mysql-test/r/variables_debug.result2
-rw-r--r--mysql-test/std_data/intersect-bug50389.tsv441
-rw-r--r--mysql-test/suite/binlog/r/binlog_base64_flag.result11
-rw-r--r--mysql-test/suite/binlog/r/binlog_innodb.result12
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_binlog.result2069
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_binlog.result1070
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_blackhole.result12
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result5
-rw-r--r--mysql-test/suite/binlog/t/binlog_base64_flag.test13
-rw-r--r--mysql-test/suite/binlog/t/binlog_innodb.test6
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_binlog.test3
-rw-r--r--mysql-test/suite/bugs/r/rpl_bug12691.result9
-rw-r--r--mysql-test/suite/bugs/r/rpl_bug36391.result3
-rw-r--r--mysql-test/suite/bugs/t/rpl_bug12691.test4
-rw-r--r--mysql-test/suite/bugs/t/rpl_bug36391.test4
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_000015.result143
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result3
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_change_master.result6
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result2
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result41
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result2
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_log_pos.result28
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result51
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_drop.result9
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result40
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result239
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result179
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_until.result188
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_server_id1.result4
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_server_id2.result3
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_slave_status.result39
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result239
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result179
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result4
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_000015.test26
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test12
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_change_master.test25
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test3
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test7
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test4
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_log_pos.test45
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test16
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_drop.test5
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test10
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_until.test49
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_server_id1.test9
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_server_id2.test3
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_slave_status.test12
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test8
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result22
-rw-r--r--mysql-test/suite/funcs_1/r/is_engines.result6
-rw-r--r--mysql-test/suite/funcs_1/t/is_columns_is.test1
-rw-r--r--mysql-test/suite/funcs_1/t/is_engines_innodb.test1
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc-44030.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc-optimize.result (renamed from mysql-test/r/innodb-autoinc-optimize.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb-ucs2.result (renamed from mysql-test/r/innodb-ucs2.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb.result2359
-rw-r--r--mysql-test/suite/innodb/r/innodb_autoinc_lock_mode_zero.result (renamed from mysql-test/r/innodb_autoinc_lock_mode_zero.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug21704.result12
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug30919.result (renamed from mysql-test/r/innodb_bug30919.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug42419.result (renamed from mysql-test/r/innodb_bug42419.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug48024.result10
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug49164.result42
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug53674.result11
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug54044.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb_gis.result (renamed from mysql-test/r/innodb_gis.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result (renamed from mysql-test/r/innodb_lock_wait_timeout_1.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_misc1.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_multi_update.result76
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result2510
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql_rbk.result (renamed from mysql-test/r/innodb_mysql_rbk.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_notembedded.result (renamed from mysql-test/r/innodb_notembedded.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_timeout_rollback.result (renamed from mysql-test/r/innodb_timeout_rollback.result)0
-rw-r--r--mysql-test/suite/innodb/t/disabled.def6
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc-44030.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc-optimize.test (renamed from mysql-test/t/innodb-autoinc-optimize.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb-ucs2.test (renamed from mysql-test/t/innodb-ucs2.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb.test1392
-rw-r--r--mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero-master.opt (renamed from mysql-test/t/innodb_autoinc_lock_mode_zero-master.opt)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero.test (renamed from mysql-test/t/innodb_autoinc_lock_mode_zero.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug30919-master.opt (renamed from mysql-test/t/innodb_bug30919-master.opt)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug30919.test (renamed from mysql-test/t/innodb_bug30919.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug42419.test (renamed from mysql-test/t/innodb_bug42419.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug48024.test22
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug49164.test47
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug53674-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug53674.test8
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug54044.test11
-rw-r--r--mysql-test/suite/innodb/t/innodb_gis.test (renamed from mysql-test/t/innodb_gis.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1-master.opt (renamed from mysql-test/t/innodb_lock_wait_timeout_1-master.opt)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1.test (renamed from mysql-test/t/innodb_lock_wait_timeout_1.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_misc1.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_multi_update.test29
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql-master.opt (renamed from mysql-test/t/innodb_mysql-master.opt)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql.test755
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql_rbk-master.opt (renamed from mysql-test/t/innodb_mysql_rbk-master.opt)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql_rbk.test (renamed from mysql-test/t/innodb_mysql_rbk.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_notembedded.test (renamed from mysql-test/t/innodb_notembedded.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_timeout_rollback-master.opt (renamed from mysql-test/t/innodb_timeout_rollback-master.opt)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_timeout_rollback.test (renamed from mysql-test/t/innodb_timeout_rollback.test)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-autoinc-optimize.result9
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-ucs2.result314
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb.result94
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_autoinc_lock_mode_zero.result39
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug30919.result1043
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug42419.result17
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug46000.result1
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug48024.result10
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug49164-xb.result42
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug49164.result42
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug53290.result17
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug53591.result15
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug53592.result26
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug53674.result11
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug54044.result3
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug54679.result91
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_gis.result589
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_lock_wait_timeout_1.result375
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_multi_update.result76
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_mysql.result (renamed from mysql-test/r/innodb_mysql.result)64
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_mysql_rbk.result21
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_notembedded.result23
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_timeout_rollback.result36
-rw-r--r--mysql-test/suite/innodb_plugin/t/disabled.def20
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-autoinc-optimize.test19
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-ucs2.test230
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb.test29
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero.test44
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug30919.test68
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug42419.test78
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug48024.test22
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug49164.test47
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug52745.test2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug53290.test22
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug53591.test25
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug53592.test59
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug53674.test8
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug54044.test11
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug54679.test97
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_gis.test10
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1.test264
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_multi_update.test29
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_mysql.test (renamed from mysql-test/t/innodb_mysql.test)69
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk.test35
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_notembedded.test50
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback.test5
-rw-r--r--mysql-test/suite/manual/r/rpl_replication_delay.result117
-rw-r--r--mysql-test/suite/manual/t/rpl_replication_delay.test16
-rw-r--r--mysql-test/suite/maria/r/maria-recovery2.result2
-rw-r--r--mysql-test/suite/maria/r/maria.result7
-rw-r--r--mysql-test/suite/maria/t/maria.test8
-rw-r--r--mysql-test/suite/ndb_team/r/rpl_ndb_extraColMaster.result612
-rw-r--r--mysql-test/suite/ndb_team/r/rpl_ndb_mix_innodb.result22
-rw-r--r--mysql-test/suite/parts/r/optimizer.result45
-rw-r--r--mysql-test/suite/parts/r/partition_debug_sync_innodb.result61
-rw-r--r--mysql-test/suite/parts/r/rpl_partition.result40
-rw-r--r--mysql-test/suite/parts/t/optimizer.test47
-rw-r--r--mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt1
-rw-r--r--mysql-test/suite/parts/t/partition_debug_sync_innodb.test44
-rw-r--r--mysql-test/suite/parts/t/rpl_partition.test4
-rw-r--r--mysql-test/suite/pbxt/r/join_nested.result4
-rw-r--r--mysql-test/suite/pbxt/r/renamedb.result2
-rw-r--r--mysql-test/suite/pbxt/t/check.test2
-rw-r--r--mysql-test/suite/pbxt/t/count_distinct2.test4
-rw-r--r--mysql-test/suite/pbxt/t/derived.test2
-rw-r--r--mysql-test/suite/pbxt/t/renamedb.test2
-rw-r--r--mysql-test/suite/percona/disabled.def13
-rw-r--r--mysql-test/suite/percona/percona_innodb_deadlock_count.result28
-rw-r--r--mysql-test/suite/percona/percona_innodb_deadlock_count.test49
-rw-r--r--mysql-test/suite/percona/percona_innodb_doublewrite_file-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_innodb_doublewrite_file.result4
-rw-r--r--mysql-test/suite/percona/percona_innodb_doublewrite_file.test2
-rw-r--r--mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-slave.opt1
-rw-r--r--mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.result103
-rw-r--r--mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test139
-rw-r--r--mysql-test/suite/percona/percona_log_slow_slave_statements-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_log_slow_slave_statements-slave.opt1
-rw-r--r--mysql-test/suite/percona/percona_log_slow_slave_statements.result86
-rw-r--r--mysql-test/suite/percona/percona_log_slow_slave_statements.test160
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments.inc.backup88
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments.result866
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments.test4
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments_crash.result21
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments_crash.test22
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments_disable.result865
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments_disable.test3
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments_prepared_statements.result396
-rw-r--r--mysql-test/suite/percona/percona_query_cache_with_comments_prepared_statements.test208
-rw-r--r--mysql-test/suite/percona/percona_show_temp_tables.result58
-rw-r--r--mysql-test/suite/percona/percona_show_temp_tables.test65
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-control_global_slow-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-control_global_slow.result12
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test12
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-log_slow_filter-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.result25
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test33
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.result9
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test13
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-long_query_time-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-long_query_time.result22
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-long_query_time.test19
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.result12
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test20
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.result25
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test33
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.result24
-rw-r--r--mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test21
-rw-r--r--mysql-test/suite/percona/percona_suppress_log_warning_1592-master.opt1
-rw-r--r--mysql-test/suite/percona/percona_suppress_log_warning_1592.result28
-rw-r--r--mysql-test/suite/percona/percona_suppress_log_warning_1592.test46
-rw-r--r--mysql-test/suite/percona/percona_xtradb_admin_command.result6
-rw-r--r--mysql-test/suite/percona/percona_xtradb_admin_command.test3
-rw-r--r--mysql-test/suite/percona/percona_xtradb_bug317074.result4
-rw-r--r--mysql-test/suite/percona/percona_xtradb_bug317074.test (renamed from mysql-test/t/innodb_xtradb_bug317074.test)11
-rw-r--r--mysql-test/suite/rpl/include/rpl_mixed_ddl.inc4
-rw-r--r--mysql-test/suite/rpl/include/rpl_mixed_dml.inc5
-rw-r--r--mysql-test/suite/rpl/r/rpl_000015.result141
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_grant.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug33931.result40
-rw-r--r--mysql-test/suite/rpl/r/rpl_change_master.result80
-rw-r--r--mysql-test/suite/rpl/r/rpl_deadlock_innodb.result122
-rw-r--r--mysql-test/suite/rpl/r/rpl_do_grant.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_dual_pos_advance.result14
-rw-r--r--mysql-test/suite/rpl/r/rpl_empty_master_crash.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_extraCol_innodb.result409
-rw-r--r--mysql-test/suite/rpl/r/rpl_extraCol_myisam.result409
-rw-r--r--mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result906
-rw-r--r--mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result906
-rw-r--r--mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_flushlog_loop.result44
-rw-r--r--mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_grant.result39
-rw-r--r--mysql-test/suite/rpl/r/rpl_incident.result80
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result39
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result527
-rw-r--r--mysql-test/suite/rpl/r/rpl_known_bugs_detection.result84
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_fatal.result82
-rw-r--r--mysql-test/suite/rpl/r/rpl_log_pos.result86
-rw-r--r--mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result69
-rw-r--r--mysql-test/suite/rpl/r/rpl_replicate_do.result38
-rw-r--r--mysql-test/suite/rpl/r/rpl_rotate_logs.result114
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result13
-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.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_colSize.result520
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_create_table.result151
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_drop.result9
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_find_row.result (renamed from mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result)12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log.result138
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log_innodb.result138
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_max_relay_size.result239
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result46
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result60
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_reset_slave.result179
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result215
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result215
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_until.result166
-rw-r--r--mysql-test/suite/rpl/r/rpl_skip_error.result80
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result39
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_skip.result82
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result178
-rw-r--r--mysql-test/suite/rpl/r/rpl_ssl.result74
-rw-r--r--mysql-test/suite/rpl/r/rpl_ssl1.result111
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_log.result110
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result239
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result21
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_reset_slave.result179
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_until.result177
-rw-r--r--mysql-test/suite/rpl/r/rpl_temporary_errors.result97
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015.cnf2
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015.test40
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_grant.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug33931.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_change_master.test22
-rw-r--r--mysql-test/suite/rpl/t/rpl_critical_errors.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_do_grant.test23
-rw-r--r--mysql-test/suite/rpl/t/rpl_dual_pos_advance.test54
-rw-r--r--mysql-test/suite/rpl/t/rpl_empty_master_crash.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop.test26
-rw-r--r--mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_grant.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_incident.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_known_bugs_detection.test14
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_fatal.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_log_pos.test23
-rw-r--r--mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test14
-rw-r--r--mysql-test/suite/rpl/t/rpl_replicate_do.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_create_table.test32
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_drop.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_find_row.test (renamed from mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test)31
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test31
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_until.test41
-rw-r--r--mysql-test/suite/rpl/t/rpl_skip_error.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_skip.test19
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl1.test17
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test38
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_until.test49
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporary_errors.test43
-rw-r--r--mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test1
-rw-r--r--mysql-test/suite/rpl_ndb/my.cnf4
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result40
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result80
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result80
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result409
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result11
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result162
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result29
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result286
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result4
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result23
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result40
-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.result70
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test9
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test16
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test12
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test14
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test23
-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.test349
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test2
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test4
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test6
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test9
-rw-r--r--mysql-test/suite/sys_vars/r/slow_query_log_func.result73
-rw-r--r--mysql-test/suite/sys_vars/r/tx_isolation_func.result25
-rw-r--r--mysql-test/suite/sys_vars/t/slow_query_log_func.test87
-rw-r--r--mysql-test/suite/sys_vars/t/tx_isolation_func.test3
-rw-r--r--mysql-test/t/alter_table-big.test8
-rw-r--r--mysql-test/t/bug39022.test6
-rw-r--r--mysql-test/t/create-big.test12
-rw-r--r--mysql-test/t/ctype_cp932_binlog_stm.test3
-rw-r--r--mysql-test/t/delete.test12
-rw-r--r--mysql-test/t/disabled.def5
-rw-r--r--mysql-test/t/error_simulation.test43
-rw-r--r--mysql-test/t/events_scheduling.test26
-rw-r--r--mysql-test/t/events_time_zone.test4
-rw-r--r--mysql-test/t/explain.test15
-rw-r--r--mysql-test/t/flush_block_commit_notembedded.test4
-rw-r--r--mysql-test/t/func_in.test15
-rw-r--r--mysql-test/t/func_isnull.test15
-rw-r--r--mysql-test/t/func_like.test18
-rw-r--r--mysql-test/t/group_by.test15
-rw-r--r--mysql-test/t/group_min_max.test15
-rw-r--r--mysql-test/t/handler_myisam.test49
-rw-r--r--mysql-test/t/information_schema.test9
-rw-r--r--mysql-test/t/innodb-index.test550
-rw-r--r--mysql-test/t/innodb-use-sys-malloc-master.opt1
-rw-r--r--mysql-test/t/innodb.test8
-rw-r--r--mysql-test/t/innodb_mysql_lock2.test803
-rw-r--r--mysql-test/t/join_outer.test68
-rw-r--r--mysql-test/t/loaddata.test20
-rw-r--r--mysql-test/t/lock_sync.test867
-rw-r--r--mysql-test/t/log_state.test38
-rw-r--r--mysql-test/t/multi_update.test6
-rw-r--r--mysql-test/t/mysqldump.test29
-rw-r--r--mysql-test/t/mysqlhotcopy_archive.test8
-rw-r--r--mysql-test/t/mysqlhotcopy_myisam.test7
-rw-r--r--mysql-test/t/outfile_loaddata.test34
-rw-r--r--mysql-test/t/partition_error.test32
-rw-r--r--mysql-test/t/renamedb.test2
-rw-r--r--mysql-test/t/schema.test47
-rw-r--r--mysql-test/t/select.test11
-rw-r--r--mysql-test/t/sp_trans_log.test4
-rw-r--r--mysql-test/t/subselect.test25
-rw-r--r--mysql-test/t/type_time.test12
-rw-r--r--mysql-test/t/upgrade.test34
-rw-r--r--mysql-test/t/variables.test17
-rw-r--r--mysql-test/t/variables_debug.test3
-rw-r--r--mysql-test/valgrind.supp6
-rw-r--r--mysys/mf_wfile.c2
-rw-r--r--mysys/my_alloc.c18
-rw-r--r--mysys/my_bitmap.c18
-rw-r--r--mysys/my_getopt.c39
-rw-r--r--mysys/my_malloc.c12
-rw-r--r--mysys/safemalloc.c12
-rw-r--r--mysys/stacktrace.c2
-rw-r--r--mysys/thr_alarm.c10
-rw-r--r--scripts/make_binary_distribution.sh8
-rw-r--r--scripts/mysql_install_db.sh2
-rw-r--r--server-tools/instance-manager/options.cc74
-rw-r--r--sql-common/client.c27
-rw-r--r--sql/authors.h1
-rw-r--r--sql/event_data_objects.cc10
-rw-r--r--sql/field.cc15
-rw-r--r--sql/ha_partition.cc17
-rw-r--r--sql/handler.cc1
-rw-r--r--sql/handler.h2
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item_cmpfunc.cc17
-rw-r--r--sql/item_cmpfunc.h4
-rw-r--r--sql/item_subselect.cc17
-rw-r--r--sql/item_sum.cc4
-rw-r--r--sql/item_sum.h2
-rw-r--r--sql/log.cc153
-rw-r--r--sql/log.h15
-rw-r--r--sql/log_event.cc99
-rw-r--r--sql/log_event.h6
-rw-r--r--sql/log_event_old.cc77
-rw-r--r--sql/mysql_priv.h53
-rw-r--r--sql/mysqld.cc1128
-rw-r--r--sql/net_serv.cc14
-rw-r--r--sql/opt_range.cc139
-rw-r--r--sql/opt_range.h86
-rw-r--r--sql/opt_sum.cc338
-rw-r--r--sql/opt_table_elimination.cc2
-rw-r--r--sql/repl_failsafe.cc2
-rw-r--r--sql/rpl_mi.cc27
-rw-r--r--sql/rpl_mi.h5
-rw-r--r--sql/rpl_rli.cc2
-rw-r--r--sql/set_var.cc29
-rw-r--r--sql/set_var.h1
-rw-r--r--sql/slave.cc4
-rw-r--r--sql/sp.cc31
-rw-r--r--sql/sp_head.cc45
-rw-r--r--sql/sql_base.cc158
-rw-r--r--sql/sql_binlog.cc29
-rw-r--r--sql/sql_class.cc27
-rw-r--r--sql/sql_class.h19
-rw-r--r--sql/sql_connect.cc1
-rw-r--r--sql/sql_db.cc36
-rw-r--r--sql/sql_delete.cc14
-rw-r--r--sql/sql_derived.cc6
-rw-r--r--sql/sql_handler.cc23
-rw-r--r--sql/sql_insert.cc2
-rw-r--r--sql/sql_lex.cc67
-rw-r--r--sql/sql_lex.h71
-rw-r--r--sql/sql_list.h67
-rw-r--r--sql/sql_load.cc12
-rw-r--r--sql/sql_olap.cc4
-rw-r--r--sql/sql_parse.cc138
-rw-r--r--sql/sql_partition.cc42
-rw-r--r--sql/sql_plugin.cc60
-rw-r--r--sql/sql_prepare.cc60
-rw-r--r--sql/sql_repl.cc2
-rw-r--r--sql/sql_select.cc154
-rw-r--r--sql/sql_show.cc89
-rw-r--r--sql/sql_table.cc54
-rw-r--r--sql/sql_trigger.cc13
-rw-r--r--sql/sql_union.cc38
-rw-r--r--sql/sql_update.cc25
-rw-r--r--sql/sql_view.cc14
-rw-r--r--sql/sql_yacc.yy27
-rw-r--r--sql/table.cc175
-rw-r--r--sql/table.h25
-rw-r--r--sql/thr_malloc.cc8
-rw-r--r--sql/unireg.cc14
-rw-r--r--storage/archive/archive_reader.c5
-rw-r--r--storage/heap/hp_create.c6
-rw-r--r--storage/heap/hp_rkey.c2
-rw-r--r--storage/innobase/CMakeLists.txt.disabled (renamed from storage/innobase/CMakeLists.txt)0
-rw-r--r--storage/innobase/buf/buf0flu.c3
-rw-r--r--storage/innobase/dict/dict0dict.c58
-rw-r--r--storage/innobase/fsp/fsp0fsp.c7
-rw-r--r--storage/innobase/handler/ha_innodb.cc65
-rw-r--r--storage/innobase/handler/ha_innodb.h2
-rw-r--r--storage/innobase/include/db0err.h5
-rw-r--r--storage/innobase/include/dict0dict.h1
-rw-r--r--storage/innobase/include/lock0lock.h12
-rw-r--r--storage/innobase/include/mach0data.ic23
-rw-r--r--storage/innobase/include/row0mysql.h44
-rw-r--r--storage/innobase/include/sync0sync.h2
-rw-r--r--storage/innobase/include/trx0trx.h2
-rw-r--r--storage/innobase/include/univ.i9
-rw-r--r--storage/innobase/lock/lock0lock.c138
-rw-r--r--storage/innobase/row/row0ins.c146
-rw-r--r--storage/innobase/row/row0mysql.c26
-rw-r--r--storage/innobase/row/row0sel.c146
-rw-r--r--storage/innobase/row/row0undo.c4
-rw-r--r--storage/innobase/srv/srv0srv.c10
-rw-r--r--storage/innobase/srv/srv0start.c14
-rw-r--r--storage/innobase/trx/trx0trx.c3
-rw-r--r--storage/innodb_plugin/ChangeLog143
-rw-r--r--storage/innodb_plugin/btr/btr0btr.c21
-rw-r--r--storage/innodb_plugin/btr/btr0cur.c14
-rw-r--r--storage/innodb_plugin/btr/btr0sea.c1
-rw-r--r--storage/innodb_plugin/buf/buf0buddy.c19
-rw-r--r--storage/innodb_plugin/buf/buf0buf.c7
-rw-r--r--storage/innodb_plugin/buf/buf0flu.c26
-rw-r--r--storage/innodb_plugin/buf/buf0lru.c19
-rw-r--r--storage/innodb_plugin/dict/dict0boot.c46
-rw-r--r--storage/innodb_plugin/dict/dict0crea.c28
-rw-r--r--storage/innodb_plugin/dict/dict0dict.c97
-rw-r--r--storage/innodb_plugin/dict/dict0load.c8
-rw-r--r--storage/innodb_plugin/dict/dict0mem.c4
-rw-r--r--storage/innodb_plugin/fil/fil0fil.c150
-rw-r--r--storage/innodb_plugin/fsp/fsp0fsp.c4
-rw-r--r--storage/innodb_plugin/handler/ha_innodb.cc393
-rw-r--r--storage/innodb_plugin/handler/ha_innodb.h4
-rw-r--r--storage/innodb_plugin/handler/handler0alter.cc2
-rw-r--r--storage/innodb_plugin/include/buf0buf.ic5
-rw-r--r--storage/innodb_plugin/include/buf0lru.h2
-rw-r--r--storage/innodb_plugin/include/db0err.h2
-rw-r--r--storage/innodb_plugin/include/dict0boot.h12
-rw-r--r--storage/innodb_plugin/include/dict0dict.h1
-rw-r--r--storage/innodb_plugin/include/dict0mem.h2
-rw-r--r--storage/innodb_plugin/include/fil0fil.h24
-rw-r--r--storage/innodb_plugin/include/ha_prototypes.h12
-rw-r--r--storage/innodb_plugin/include/lock0lock.h12
-rw-r--r--storage/innodb_plugin/include/log0log.ic5
-rw-r--r--storage/innodb_plugin/include/mach0data.ic23
-rw-r--r--storage/innodb_plugin/include/rem0cmp.h4
-rw-r--r--storage/innodb_plugin/include/row0mysql.h64
-rw-r--r--storage/innodb_plugin/include/sync0rw.h5
-rw-r--r--storage/innodb_plugin/include/sync0sync.h2
-rw-r--r--storage/innodb_plugin/include/trx0trx.h3
-rw-r--r--storage/innodb_plugin/include/univ.i16
-rw-r--r--storage/innodb_plugin/lock/lock0lock.c178
-rw-r--r--storage/innodb_plugin/os/os0file.c12
-rw-r--r--storage/innodb_plugin/page/page0zip.c8
-rw-r--r--storage/innodb_plugin/rem/rem0cmp.c7
-rw-r--r--storage/innodb_plugin/row/row0ins.c139
-rw-r--r--storage/innodb_plugin/row/row0merge.c131
-rw-r--r--storage/innodb_plugin/row/row0mysql.c81
-rw-r--r--storage/innodb_plugin/row/row0purge.c11
-rw-r--r--storage/innodb_plugin/row/row0sel.c161
-rw-r--r--storage/innodb_plugin/row/row0uins.c13
-rw-r--r--storage/innodb_plugin/row/row0umod.c82
-rw-r--r--storage/innodb_plugin/row/row0undo.c4
-rw-r--r--storage/innodb_plugin/row/row0upd.c16
-rwxr-xr-xstorage/innodb_plugin/setup.sh2
-rw-r--r--storage/innodb_plugin/srv/srv0srv.c10
-rw-r--r--storage/innodb_plugin/sync/sync0arr.c4
-rw-r--r--storage/innodb_plugin/sync/sync0rw.c24
-rw-r--r--storage/innodb_plugin/trx/trx0i_s.c38
-rw-r--r--storage/innodb_plugin/trx/trx0trx.c2
-rw-r--r--storage/maria/ha_maria.cc27
-rw-r--r--storage/maria/ha_maria.h1
-rw-r--r--storage/maria/ma_blockrec.c44
-rw-r--r--storage/maria/ma_check.c5
-rw-r--r--storage/maria/ma_open.c6
-rw-r--r--storage/maria/ma_recovery.c70
-rw-r--r--storage/maria/ma_recovery.h2
-rw-r--r--storage/maria/ma_recovery_util.c10
-rw-r--r--storage/maria/ma_write.c84
-rw-r--r--storage/maria/maria_chk.c102
-rw-r--r--storage/maria/maria_def.h11
-rw-r--r--storage/maria/maria_ftdump.c2
-rw-r--r--storage/maria/maria_pack.c12
-rw-r--r--storage/maria/maria_read_log.c34
-rw-r--r--storage/maria/trnman.c1
-rw-r--r--storage/myisam/mi_test1.c34
-rw-r--r--storage/myisam/myisamchk.c68
-rw-r--r--storage/myisam/myisamlog.c8
-rw-r--r--storage/myisam/myisampack.c12
-rw-r--r--storage/myisammrg/ha_myisammrg.cc6
-rw-r--r--storage/xtradb/CMakeLists.txt22
-rw-r--r--storage/xtradb/ChangeLog271
-rw-r--r--storage/xtradb/Makefile.am2
-rw-r--r--storage/xtradb/btr/btr0btr.c139
-rw-r--r--storage/xtradb/btr/btr0cur.c56
-rw-r--r--storage/xtradb/btr/btr0pcur.c27
-rw-r--r--storage/xtradb/buf/buf0buddy.c9
-rw-r--r--storage/xtradb/buf/buf0buf.c101
-rw-r--r--storage/xtradb/buf/buf0flu.c284
-rw-r--r--storage/xtradb/buf/buf0lru.c141
-rw-r--r--storage/xtradb/buf/buf0rea.c54
-rw-r--r--storage/xtradb/data/data0data.c15
-rw-r--r--storage/xtradb/dict/dict0boot.c10
-rw-r--r--storage/xtradb/dict/dict0crea.c128
-rw-r--r--storage/xtradb/dict/dict0dict.c89
-rw-r--r--storage/xtradb/dict/dict0load.c120
-rw-r--r--storage/xtradb/dict/dict0mem.c2
-rw-r--r--storage/xtradb/fil/fil0fil.c90
-rw-r--r--storage/xtradb/fsp/fsp0fsp.c46
-rw-r--r--storage/xtradb/ha/ha0ha.c16
-rw-r--r--storage/xtradb/ha/hash0hash.c6
-rw-r--r--storage/xtradb/handler/ha_innodb.cc1149
-rw-r--r--storage/xtradb/handler/ha_innodb.h37
-rw-r--r--storage/xtradb/handler/handler0alter.cc97
-rw-r--r--storage/xtradb/handler/i_s.cc77
-rw-r--r--storage/xtradb/handler/innodb_patch_info.h2
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.c37
-rw-r--r--storage/xtradb/include/btr0btr.h14
-rw-r--r--storage/xtradb/include/btr0btr.ic6
-rw-r--r--storage/xtradb/include/btr0cur.h20
-rw-r--r--storage/xtradb/include/btr0pcur.h52
-rw-r--r--storage/xtradb/include/btr0pcur.ic49
-rw-r--r--storage/xtradb/include/buf0buf.h38
-rw-r--r--storage/xtradb/include/buf0buf.ic15
-rw-r--r--storage/xtradb/include/buf0flu.h32
-rw-r--r--storage/xtradb/include/data0type.ic6
-rw-r--r--storage/xtradb/include/dict0boot.h3
-rw-r--r--storage/xtradb/include/dict0dict.h21
-rw-r--r--storage/xtradb/include/dict0mem.h24
-rw-r--r--storage/xtradb/include/fil0fil.h9
-rw-r--r--storage/xtradb/include/hash0hash.h5
-rw-r--r--storage/xtradb/include/hash0hash.ic20
-rw-r--r--storage/xtradb/include/lock0lock.h12
-rw-r--r--storage/xtradb/include/log0log.h31
-rw-r--r--storage/xtradb/include/log0log.ic11
-rw-r--r--storage/xtradb/include/log0recv.h14
-rw-r--r--storage/xtradb/include/mem0dbg.h9
-rw-r--r--storage/xtradb/include/mem0dbg.ic5
-rw-r--r--storage/xtradb/include/mem0mem.h5
-rw-r--r--storage/xtradb/include/mem0mem.ic10
-rw-r--r--storage/xtradb/include/mtr0log.ic5
-rw-r--r--storage/xtradb/include/mtr0mtr.ic5
-rw-r--r--storage/xtradb/include/os0file.h19
-rw-r--r--storage/xtradb/include/que0que.h13
-rw-r--r--storage/xtradb/include/que0que.ic16
-rw-r--r--storage/xtradb/include/row0mysql.h23
-rw-r--r--storage/xtradb/include/row0sel.h13
-rw-r--r--storage/xtradb/include/srv0srv.h65
-rw-r--r--storage/xtradb/include/sync0rw.h5
-rw-r--r--storage/xtradb/include/sync0sync.h26
-rw-r--r--storage/xtradb/include/trx0rseg.h2
-rw-r--r--storage/xtradb/include/trx0sys.h29
-rw-r--r--storage/xtradb/include/trx0sys.ic34
-rw-r--r--storage/xtradb/include/trx0trx.h81
-rw-r--r--storage/xtradb/include/trx0types.h9
-rw-r--r--storage/xtradb/include/univ.i20
-rw-r--r--storage/xtradb/include/ut0rbt.h309
-rw-r--r--storage/xtradb/include/ut0rnd.ic1
-rw-r--r--storage/xtradb/lock/lock0lock.c267
-rw-r--r--storage/xtradb/log/log0log.c23
-rw-r--r--storage/xtradb/log/log0recv.c85
-rw-r--r--storage/xtradb/mem/mem0dbg.c6
-rw-r--r--storage/xtradb/mem/mem0mem.c20
-rw-r--r--storage/xtradb/os/os0file.c32
-rw-r--r--storage/xtradb/page/page0page.c50
-rw-r--r--storage/xtradb/page/page0zip.c5
-rw-r--r--storage/xtradb/plug.in2
-rw-r--r--storage/xtradb/rem/rem0rec.c86
-rw-r--r--storage/xtradb/row/row0ins.c10
-rw-r--r--storage/xtradb/row/row0merge.c157
-rw-r--r--storage/xtradb/row/row0mysql.c285
-rw-r--r--storage/xtradb/row/row0row.c17
-rw-r--r--storage/xtradb/row/row0sel.c87
-rw-r--r--storage/xtradb/row/row0umod.c33
-rw-r--r--storage/xtradb/row/row0upd.c3
-rw-r--r--storage/xtradb/srv/srv0srv.c248
-rw-r--r--storage/xtradb/srv/srv0start.c250
-rw-r--r--storage/xtradb/sync/sync0sync.c87
-rw-r--r--storage/xtradb/trx/trx0i_s.c13
-rw-r--r--storage/xtradb/trx/trx0rec.c24
-rw-r--r--storage/xtradb/trx/trx0rseg.c2
-rw-r--r--storage/xtradb/trx/trx0sys.c272
-rw-r--r--storage/xtradb/trx/trx0trx.c5
-rw-r--r--storage/xtradb/ut/ut0rbt.c1249
-rw-r--r--strings/decimal.c2
-rw-r--r--support-files/compiler_warnings.supp1
-rw-r--r--support-files/mysql.spec.sh130
-rw-r--r--tests/mysql_client_test.c211
-rw-r--r--unittest/examples/Makefile.am3
-rw-r--r--unittest/examples/no_plan-t.c11
-rw-r--r--unittest/mytap/tap.c11
-rw-r--r--unittest/mytap/tap.h13
820 files changed, 37150 insertions, 19196 deletions
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index f38ecf6d8b9..0ad5351f545 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -127,8 +127,12 @@ fi
# Set flags for various build configurations.
# Used in -valgrind builds
+# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
+# LINT_INIT(), which is only useful for silencing spurious warnings
+# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_valgrind "
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
+valgrind_configs="--with-valgrind"
#
# Used in -debug builds
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
diff --git a/BUILD/build_mccge.sh b/BUILD/build_mccge.sh
index bf0596239cd..f04caef8df8 100755
--- a/BUILD/build_mccge.sh
+++ b/BUILD/build_mccge.sh
@@ -941,6 +941,7 @@ set_valgrind_flags()
loc_valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_valgrind "
loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
compiler_flags="$compiler_flags $loc_valgrind_flags"
+ with_flags="$with_flags --with-valgrind"
fi
}
diff --git a/BUILD/compile-amd64-valgrind-max b/BUILD/compile-amd64-valgrind-max
index 962d0f17b04..fb8dce38df3 100755
--- a/BUILD/compile-amd64-valgrind-max
+++ b/BUILD/compile-amd64-valgrind-max
@@ -4,7 +4,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $debug_cflags $valgrind_flags"
-extra_configs="$amd64_configs $debug_configs $max_configs"
+extra_configs="$amd64_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
diff --git a/BUILD/compile-pentium-icc-valgrind-max b/BUILD/compile-pentium-icc-valgrind-max
index 58acf892f5a..0babf9ee881 100755
--- a/BUILD/compile-pentium-icc-valgrind-max
+++ b/BUILD/compile-pentium-icc-valgrind-max
@@ -29,6 +29,6 @@ extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
c_warnings="-Wall -Wcheck -wd161,444,279,810,981,1292,1469,1572"
cxx_warnings="$c_warnings -wd869,874"
base_cxxflags="-fno-exceptions -fno-rtti"
-extra_configs="$pentium_configs $debug_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs"
. "$path/FINISH.sh"
diff --git a/BUILD/compile-pentium-valgrind-max b/BUILD/compile-pentium-valgrind-max
index 09cc162d2be..8ef47bfbc17 100755
--- a/BUILD/compile-pentium-valgrind-max
+++ b/BUILD/compile-pentium-valgrind-max
@@ -4,7 +4,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
-extra_configs="$pentium_configs $debug_configs $max_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
diff --git a/BUILD/compile-pentium-valgrind-max-no-ndb b/BUILD/compile-pentium-valgrind-max-no-ndb
index 66f6ae08a7f..f480f83ebf7 100755
--- a/BUILD/compile-pentium-valgrind-max-no-ndb
+++ b/BUILD/compile-pentium-valgrind-max-no-ndb
@@ -4,7 +4,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
-extra_configs="$pentium_configs $debug_configs $max_no_ndb_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_no_ndb_configs"
. "$path/FINISH.sh"
diff --git a/BUILD/compile-pentium64-valgrind-max b/BUILD/compile-pentium64-valgrind-max
index fa476cbb50a..eb3d20c874d 100755
--- a/BUILD/compile-pentium64-valgrind-max
+++ b/BUILD/compile-pentium64-valgrind-max
@@ -4,7 +4,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags $valgrind_flags"
-extra_configs="$pentium_configs $debug_configs $max_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
diff --git a/Makefile.am b/Makefile.am
index 78a023df225..7474177f5f5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -161,8 +161,8 @@ test-bt:
-if [ -e bin/ndbd -o -e storage/ndb/src/kernel/ndbd ] ; then \
cd mysql-test ; \
MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl $(MTR_EXTRA_OPTIONS) --comment=ndb+rpl_ndb+ps --force --timer \
- --ps-protocol --mysqld=--binlog-format=row --suite=ndb,rpl_ndb ; \
+ @PERL@ ./mysql-test-run.pl $(MTR_EXTRA_OPTIONS) --comment=ndb+ps --force --timer \
+ --ps-protocol --mysqld=--binlog-format=row --suite=ndb ; \
MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl $(MTR_EXTRA_OPTIONS) --comment=ndb --force --timer \
--with-ndbcluster-only ; \
diff --git a/client/mysql.cc b/client/mysql.cc
index db3da9dcbdb..71a9e44fa23 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1348,65 +1348,73 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0},
{"abort-source-on-error", OPT_ABORT_SOURCE_ON_ERROR,
"Abort 'source filename' operations in case of errors",
- (uchar**) &batch_abort_on_error, (uchar**) &batch_abort_on_error, 0,
+ &batch_abort_on_error, &batch_abort_on_error, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NETWARE__
{"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"auto-rehash", OPT_AUTO_REHASH,
- "Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
- (uchar**) &opt_rehash, (uchar**) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
+ "Enable automatic rehashing. One doesn't need to use 'rehash' to get table "
+ "and field completion, but startup and reconnecting may take a longer time. "
+ "Disable with --disable-auto-rehash.",
+ &opt_rehash, &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
{"no-auto-rehash", 'A',
- "No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect.",
+ "No automatic rehashing. One has to use 'rehash' to get table and field "
+ "completion. This gives a quicker start of mysql and disables rehashing "
+ "on reconnect.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"batch", 'B',
- "Don't use history file. Disable interactive behavior. (Enables --silent.)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "Don't use history file. Disable interactive behavior. (Enables --silent.)",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory for character set files.", (uchar**) &charsets_dir,
- (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory for character set files.", &charsets_dir,
+ &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"column-type-info", OPT_COLUMN_TYPES, "Display column type information.",
- (uchar**) &column_types_flag, (uchar**) &column_types_flag,
+ &column_types_flag, &column_types_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"comments", 'c', "Preserve comments. Send comments to the server."
" The default is --skip-comments (discard comments), enable with --comments.",
- (uchar**) &preserve_comments, (uchar**) &preserve_comments,
+ &preserve_comments, &preserve_comments,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
-
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit.",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log.", (uchar**) &default_dbug_option,
- (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log.", &default_dbug_option,
+ &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
- (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+ &debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
- (uchar**) &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"database", 'D', "Database to use.", (uchar**) &current_db,
- (uchar**) &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag,
+ &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"database", 'D', "Database to use.", &current_db,
+ &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (uchar**) &default_charset,
- (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"delimiter", OPT_DELIMITER, "Delimiter to be used.", (uchar**) &delimiter_str,
- (uchar**) &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", &default_charset,
+ &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"delimiter", OPT_DELIMITER, "Delimiter to be used.", &delimiter_str,
+ &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"execute", 'e', "Execute command and quit. (Disables --force and history file.)", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E', "Print the output of a query (rows) vertically.",
- (uchar**) &vertical, (uchar**) &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ &vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"force", 'f', "Continue even if we get an SQL error. Sets abort-source-on-error to 0",
- (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
+ &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"named-commands", 'G',
- "Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
- (uchar**) &named_cmds, (uchar**) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ "Enable named commands. Named commands mean this program's internal "
+ "commands; see mysql> help . When enabled, the named commands can be "
+ "used from any line of the query, otherwise only from the first line, "
+ "before an enter. Disable with --disable-named-commands. This option "
+ "is disabled by default.",
+ &named_cmds, &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"no-named-commands", 'g',
"Named commands are disabled. Use \\* form only, or use named commands "
@@ -1416,47 +1424,54 @@ static struct my_option my_long_options[] =
"WARNING: option deprecated; use --disable-named-commands instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-spaces", 'i', "Ignore space after function names.",
- (uchar**) &ignore_spaces, (uchar**) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
+ &ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
- (uchar**) &opt_local_infile,
- (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"no-beep", 'b', "Turn off beep on error.", (uchar**) &opt_nobeep,
- (uchar**) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (uchar**) &current_host,
- (uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"html", 'H', "Produce HTML output.", (uchar**) &opt_html, (uchar**) &opt_html,
+ &opt_local_infile,
+ &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-beep", 'b', "Turn off beep on error.", &opt_nobeep,
+ &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"host", 'h', "Connect to host.", &current_host,
+ &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"html", 'H', "Produce HTML output.", &opt_html, &opt_html,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"xml", 'X', "Produce XML output.", (uchar**) &opt_xml, (uchar**) &opt_xml, 0,
+ {"xml", 'X', "Produce XML output.", &opt_xml, &opt_xml, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
- (uchar**) &line_numbers, (uchar**) &line_numbers, 0, GET_BOOL,
+ &line_numbers, &line_numbers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"unbuffered", 'n', "Flush buffer after each query.", (uchar**) &unbuffered,
- (uchar**) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"unbuffered", 'n', "Flush buffer after each query.", &unbuffered,
+ &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
- (uchar**) &column_names, (uchar**) &column_names, 0, GET_BOOL,
+ &column_names, &column_names, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-column-names", 'N',
"Don't write column names in results.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
- "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
+ "Change the value of a variable. Please note that this option is "
+ "deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"sigint-ignore", OPT_SIGINT_IGNORE, "Ignore SIGINT (CTRL-C).",
- (uchar**) &opt_sigint_ignore, (uchar**) &opt_sigint_ignore, 0, GET_BOOL,
+ &opt_sigint_ignore, &opt_sigint_ignore, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"one-database", 'o',
- "Only update the default database. This is useful for skipping updates to other database in the update log.",
+ "Only update the default database. This is useful for skipping updates "
+ "to other database in the update log.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef USE_POPEN
{"pager", OPT_PAGER,
- "Pager to use to display results. If you don't supply an option, the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode. Disable with --disable-pager. This option is disabled by default.",
+ "Pager to use to display results. If you don't supply an option, the "
+ "default pager is taken from your ENV variable PAGER. Valid pagers are "
+ "less, more, cat [> filename], etc. See interactive help (\\h) also. "
+ "This option does not work in batch mode. Disable with --disable-pager. "
+ "This option is disabled by default.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"no-pager", OPT_NOPAGER,
- "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.",
+ "Disable pager and print to stdout. See interactive help (\\h) also. "
+ "WARNING: option deprecated; use --disable-pager instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"password", 'p',
@@ -1472,48 +1487,53 @@ static struct my_option my_long_options[] =
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
- (uchar**) &opt_mysql_port,
- (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ &opt_mysql_port,
+ &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"prompt", OPT_PROMPT, "Set the mysql prompt to this value.",
- (uchar**) &current_prompt, (uchar**) &current_prompt, 0, GET_STR_ALLOC,
+ &current_prompt, &current_prompt, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q',
- "Don't cache result, print it row by row. This may slow down the server if the output is suspended. Doesn't use history file.",
- (uchar**) &quick, (uchar**) &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "Don't cache result, print it row by row. This may slow down the server "
+ "if the output is suspended. Doesn't use history file.",
+ &quick, &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"raw", 'r', "Write fields without conversion. Used with --batch.",
- (uchar**) &opt_raw_data, (uchar**) &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
- {"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable with --disable-reconnect. This option is enabled by default.",
- (uchar**) &opt_reconnect, (uchar**) &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
- {"silent", 's', "Be more silent. Print results with a tab as separator, each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
- 0, 0},
+ {"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable "
+ "with --disable-reconnect. This option is enabled by default.",
+ &opt_reconnect, &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ {"silent", 's', "Be more silent. Print results with a tab as separator, "
+ "each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
- 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Base name of shared memory.", &shared_memory_base_name,
+ &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"socket", 'S', "The socket file to use for connection.",
- (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR_ALLOC,
+ &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include "sslopt-longopts.h"
- {"table", 't', "Output in table format.", (uchar**) &output_tables,
- (uchar**) &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"table", 't', "Output in table format.", &output_tables,
+ &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"tee", OPT_TEE,
- "Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default.",
+ "Append everything into outfile. See interactive help (\\h) also. "
+ "Does not work in batch mode. Disable with --disable-tee. "
+ "This option is disabled by default.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: Option deprecated; use --disable-tee instead.", 0, 0, 0, GET_NO_ARG,
- NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. "
+ "WARNING: Option deprecated; use --disable-tee instead.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (uchar**) &current_user,
- (uchar**) &current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", &current_user,
+ &current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.",
- (uchar**) &safe_updates, (uchar**) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
+ &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.",
- (uchar**) &safe_updates, (uchar**) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
+ &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"verbose", 'v', "Write more. (-v -v -v gives the table output format).", 0,
0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -1523,35 +1543,32 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT,
"Number of seconds before connection timeout.",
- (uchar**) &opt_connect_timeout,
- (uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
- 0, 0},
+ &opt_connect_timeout, &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG,
+ 0, 0, 3600*12, 0, 0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"The maximum packet length to send to or receive from server.",
- (uchar**) &opt_max_allowed_packet, (uchar**) &opt_max_allowed_packet, 0,
+ &opt_max_allowed_packet, &opt_max_allowed_packet, 0,
GET_ULONG, REQUIRED_ARG, 16 *1024L*1024L, 4096,
(longlong) 2*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
"The buffer size for TCP/IP and socket communication.",
- (uchar**) &opt_net_buffer_length, (uchar**) &opt_net_buffer_length, 0, GET_ULONG,
+ &opt_net_buffer_length, &opt_net_buffer_length, 0, GET_ULONG,
REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
{"select_limit", OPT_SELECT_LIMIT,
"Automatic limit for SELECT when using --safe-updates.",
- (uchar**) &select_limit,
- (uchar**) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ULONG_MAX,
- 0, 1, 0},
+ &select_limit, &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L,
+ 1, ULONG_MAX, 0, 1, 0},
{"max_join_size", OPT_MAX_JOIN_SIZE,
"Automatic limit for rows in a join when using --safe-updates.",
- (uchar**) &max_join_size,
- (uchar**) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, 1, ULONG_MAX,
- 0, 1, 0},
+ &max_join_size, &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L,
+ 1, ULONG_MAX, 0, 1, 0},
{"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it"
- " uses old (pre-4.1.1) protocol.", (uchar**) &opt_secure_auth,
- (uchar**) &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ " uses old (pre-4.1.1) protocol.", &opt_secure_auth,
+ &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.",
- (uchar**) &show_warnings, (uchar**) &show_warnings, 0, GET_BOOL, NO_ARG,
+ &show_warnings, &show_warnings, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
(uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 9f9d349c507..a61b67d67c8 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -68,7 +68,7 @@ static struct my_option my_long_options[]=
"Directory for character set files.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
- (uchar**)&not_used, (uchar**)&not_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ &not_used, &not_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"datadir", 'd',
"Not used by mysql_upgrade. Only for backward compatibility.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -76,26 +76,26 @@ static struct my_option my_long_options[]=
{"debug", '#', "This is a non-debug version. Catch this and exit.",
0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log.", (uchar* *) & default_dbug_option,
- (uchar* *) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log.", &default_dbug_option,
+ &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
- (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+ &debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
- (uchar**) &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag,
+ &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade "
"has already been executed for the current version of MySQL.",
- (uchar**)&opt_force, (uchar**)&opt_force, 0,
+ &opt_force, &opt_force, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host",'h', "Connect to host.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given,"
- " it's solicited on the tty.", (uchar**) &opt_password,(uchar**) &opt_password,
+ " it's solicited on the tty.", &opt_password,&opt_password,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __WIN__
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0,
@@ -121,15 +121,15 @@ static struct my_option my_long_options[]=
#include <sslopt-longopts.h>
{"tmpdir", 't', "Directory for temporary files.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"user", 'u', "User for login if not current user.", (uchar**) &opt_user,
- (uchar**) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", &opt_user,
+ &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process.",
- (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
+ &opt_verbose, &opt_verbose, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG,
"All commands including mysqlcheck are binlogged. Enabled by default;"
"use --skip-write-binlog when commands should not be sent to replication slaves.",
- (uchar**) &opt_write_binlog, (uchar**) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
+ &opt_write_binlog, &opt_write_binlog, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index f6de2e6bdb1..018b07690e3 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -128,37 +128,37 @@ static struct my_option my_long_options[] =
#endif
{"count", 'c',
"Number of iterations to make. This works with -i (--sleep) only.",
- (uchar**) &nr_iterations, (uchar**) &nr_iterations, 0, GET_UINT,
+ &nr_iterations, &nr_iterations, 0, GET_UINT,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
- (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+ &debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
- (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+ &debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
"Don't ask for confirmation on drop database; with multiple commands, continue even if an error occurs.",
- (uchar**) &option_force, (uchar**) &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
+ &option_force, &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory for character set files.", (uchar**) &charsets_dir,
- (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory for character set files.", &charsets_dir,
+ &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (uchar**) &default_charset,
- (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", &default_charset,
+ &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
+ {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"no-beep", 'b', "Turn off beep on error.", (uchar**) &opt_nobeep,
- (uchar**) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-beep", 'b', "Turn off beep on error.", &opt_nobeep,
+ &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -172,50 +172,52 @@ static struct my_option my_long_options[] =
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
- (uchar**) &tcp_port,
- (uchar**) &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ &tcp_port,
+ &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relative", 'r',
- "Show difference between current and previous values when used with -i. Currently only works with extended-status.",
- (uchar**) &opt_relative, (uchar**) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ "Show difference between current and previous values when used with -i. "
+ "Currently only works with extended-status.",
+ &opt_relative, &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"set-variable", 'O',
- "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
+ "Change the value of a variable. Please note that this option is "
+ "deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
+ "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Silently exit if one can't connect to server.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "The socket file to use for connection.",
- (uchar**) &unix_port, (uchar**) &unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ &unix_port, &unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"sleep", 'i', "Execute commands repeatedly with a sleep between.",
- (uchar**) &interval, (uchar**) &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0,
+ &interval, &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (uchar**) &user,
- (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", &user,
+ &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"verbose", 'v', "Write more information.", (uchar**) &opt_verbose,
- (uchar**) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Write more information.", &opt_verbose,
+ &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E',
"Print output vertically. Is similar to --relative, but prints output vertically.",
- (uchar**) &opt_vertical, (uchar**) &opt_vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_vertical, &opt_vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_UINT,
OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (uchar**) &opt_connect_timeout,
- (uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0,
+ {"connect_timeout", OPT_CONNECT_TIMEOUT, "", &opt_connect_timeout,
+ &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0,
3600*12, 0, 1, 0},
- {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", (uchar**) &opt_shutdown_timeout,
- (uchar**) &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
+ {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", &opt_shutdown_timeout,
+ &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index d5e6799d1c9..420042e6055 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1062,9 +1062,8 @@ static struct my_option my_long_options[] =
"events); 'always' prints base64 whenever possible. 'always' is for "
"debugging only and should not be used in a production system. If this "
"argument is not given, the default is 'auto'; if it is given with no "
- "argument, 'always' is used."
- ,(uchar**) &opt_base64_output_mode_str,
- (uchar**) &opt_base64_output_mode_str,
+ "argument, 'always' is used.",
+ &opt_base64_output_mode_str, &opt_base64_output_mode_str,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
/*
mysqlbinlog needs charsets knowledge, to be able to convert a charset
@@ -1073,43 +1072,43 @@ static struct my_option my_long_options[] =
SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`;
*/
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory for character set files.", (uchar**) &charsets_dir,
- (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory for character set files.", &charsets_dir,
+ &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'd', "List entries for just this database (local log only).",
- (uchar**) &database, (uchar**) &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
+ &database, &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
- {"debug", '#', "Output debug log.", (uchar**) &default_dbug_option,
- (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log.", &default_dbug_option,
+ &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
- (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+ &debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
- (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+ &debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
"enabled --to-last-log and are sending the output to the same MySQL server. "
"This way you could avoid an endless loop. You would also like to use it "
"when restoring after a crash to avoid duplication of the statements you "
"already have. NOTE: you will need a SUPER privilege to use this option.",
- (uchar**) &disable_log_bin, (uchar**) &disable_log_bin, 0, GET_BOOL,
+ &disable_log_bin, &disable_log_bin, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"force-if-open", 'F', "Force if binlog was not closed properly.",
- (uchar**) &force_if_open_opt, (uchar**) &force_if_open_opt, 0, GET_BOOL, NO_ARG,
+ &force_if_open_opt, &force_if_open_opt, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"force-read", 'f', "Force reading unknown binlog events.",
- (uchar**) &force_opt, (uchar**) &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &force_opt, &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"hexdump", 'H', "Augment output with hexadecimal and ASCII event dump.",
- (uchar**) &opt_hexdump, (uchar**) &opt_hexdump, 0, GET_BOOL, NO_ARG,
+ &opt_hexdump, &opt_hexdump, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"host", 'h', "Get the binlog from server.", (uchar**) &host, (uchar**) &host,
+ {"host", 'h', "Get the binlog from server.", &host, &host,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"local-load", 'l', "Prepare local temporary files for LOAD DATA INFILE in the specified directory.",
- (uchar**) &dirname_for_local_load, (uchar**) &dirname_for_local_load, 0,
+ &dirname_for_local_load, &dirname_for_local_load, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"offset", 'o', "Skip the first N entries.", (uchar**) &offset, (uchar**) &offset,
+ {"offset", 'o', "Skip the first N entries.", &offset, &offset,
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p', "Password to connect to remote server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -1119,10 +1118,10 @@ static struct my_option my_long_options[] =
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
- (uchar**) &port, (uchar**) &port, 0, GET_INT, REQUIRED_ARG,
+ &port, &port, 0, GET_INT, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"position", OPT_POSITION, "Deprecated. Use --start-position instead.",
- (uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL,
+ &start_position, &start_position, 0, GET_ULL,
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
(ulonglong)(~(uint32)0), 0, 0, 0},
@@ -1130,31 +1129,31 @@ static struct my_option my_long_options[] =
"The protocol to use for connection (tcp, socket, pipe, memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"read-from-remote-server", 'R', "Read binary logs from a MySQL server.",
- (uchar**) &remote_opt, (uchar**) &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &remote_opt, &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID,
"Extract only binlog entries created by the server having the given id.",
- (uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG,
+ &server_id, &server_id, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
- "Add 'SET NAMES character_set' to the output.", (uchar**) &charset,
- (uchar**) &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Add 'SET NAMES character_set' to the output.", &charset,
+ &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (uchar**) &shared_memory_base_name,
- (uchar**) &shared_memory_base_name,
+ "Base name of shared memory.", &shared_memory_base_name,
+ &shared_memory_base_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"short-form", 's', "Just show regular queries: no extra info and no "
"row-based events. This is for testing only, and should not be used in "
"production systems. If you want to suppress base64-output, consider "
"using --base64-output=never instead.",
- (uchar**) &short_form, (uchar**) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &short_form, &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"socket", 'S', "The socket file to use for connection.",
- (uchar**) &sock, (uchar**) &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
+ &sock, &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"start-datetime", OPT_START_DATETIME,
"Start reading the binlog at first event having a datetime equal or "
@@ -1162,12 +1161,12 @@ static struct my_option my_long_options[] =
"in the local time zone, in any format accepted by the MySQL server "
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
"(you should probably use quotes for your shell to set it properly).",
- (uchar**) &start_datetime_str, (uchar**) &start_datetime_str,
+ &start_datetime_str, &start_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"start-position", 'j',
"Start reading the binlog at position N. Applies to the first binlog "
"passed on the command line.",
- (uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL,
+ &start_position, &start_position, 0, GET_ULL,
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
(ulonglong)(~(uint32)0), 0, 0, 0},
@@ -1177,22 +1176,22 @@ static struct my_option my_long_options[] =
"in the local time zone, in any format accepted by the MySQL server "
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
"(you should probably use quotes for your shell to set it properly).",
- (uchar**) &stop_datetime_str, (uchar**) &stop_datetime_str,
+ &stop_datetime_str, &stop_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"stop-position", OPT_STOP_POSITION,
"Stop reading the binlog at position N. Applies to the last binlog "
"passed on the command line.",
- (uchar**) &stop_position, (uchar**) &stop_position, 0, GET_ULL,
+ &stop_position, &stop_position, 0, GET_ULL,
REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
(ulonglong)(~(my_off_t)0), 0, 0, 0},
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \
requested binlog but rather continue printing until the end of the last \
binlog of the MySQL server. If you send the output to the same MySQL server, \
that may lead to an endless loop.",
- (uchar**) &to_last_remote_log, (uchar**) &to_last_remote_log, 0, GET_BOOL,
+ &to_last_remote_log, &to_last_remote_log, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "Connect to the remote server as username.",
- (uchar**) &user, (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
+ &user, &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"verbose", 'v', "Reconstruct SQL statements out of row events. "
"-v -v adds comments on column data types.",
@@ -1201,7 +1200,7 @@ that may lead to an endless loop.",
0, 0, 0, 0, 0},
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
"Used to reserve file descriptors for use by this program.",
- (uchar**) &open_files_limit, (uchar**) &open_files_limit, 0, GET_ULONG,
+ &open_files_limit, &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
{"rewrite-db", OPT_REWRITE_DB,
"Updates to a database with a different name than the original. \
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 0785c33cf26..fd067e8a8ad 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -54,13 +54,13 @@ static struct my_option my_long_options[] =
{
{"all-databases", 'A',
"Check all the databases. This is the same as --databases with all databases selected.",
- (uchar**) &opt_alldbs, (uchar**) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &opt_alldbs, &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"analyze", 'a', "Analyze given tables.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"all-in-1", '1',
"Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.",
- (uchar**) &opt_all_in_1, (uchar**) &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_all_in_1, &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
#ifdef __NETWARE__
{"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
@@ -68,11 +68,11 @@ static struct my_option my_long_options[] =
#endif
{"auto-repair", OPT_AUTO_REPAIR,
"If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found.",
- (uchar**) &opt_auto_repair, (uchar**) &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0,
+ &opt_auto_repair, &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0,
0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory for character set files.", (uchar**) &charsets_dir,
- (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory for character set files.", &charsets_dir,
+ &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"check", 'c', "Check table for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"check-only-changed", 'C',
@@ -82,11 +82,11 @@ static struct my_option my_long_options[] =
"Check tables for version-dependent changes. May be used with --auto-repair to correct tables requiring version-dependent updates.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
- (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"databases", 'B',
"Check several databases. Note the difference in usage; in this case no tables are given. All name arguments are regarded as database names.",
- (uchar**) &opt_databases, (uchar**) &opt_databases, 0, GET_BOOL, NO_ARG,
+ &opt_databases, &opt_databases, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit.",
@@ -96,40 +96,40 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
- (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+ &debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
- (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+ &debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (uchar**) &default_charset,
- (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", &default_charset,
+ &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fast",'F', "Check only tables that haven't been closed properly.",
- (uchar**) &opt_fast, (uchar**) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ &opt_fast, &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"fix-db-names", OPT_FIX_DB_NAMES, "Fix database names.",
- (uchar**) &opt_fix_db_names, (uchar**) &opt_fix_db_names,
+ &opt_fix_db_names, &opt_fix_db_names,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fix-table-names", OPT_FIX_TABLE_NAMES, "Fix table names.",
- (uchar**) &opt_fix_table_names, (uchar**) &opt_fix_table_names,
+ &opt_fix_table_names, &opt_fix_table_names,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Continue even if we get an SQL error.",
- (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
+ &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"extended", 'e',
"If you are using this option with CHECK TABLE, it will ensure that the table is 100 percent consistent, but will take a long time. If you are using this option with REPAIR TABLE, it will force using old slow repair with keycache method, instead of much faster repair by sorting.",
- (uchar**) &opt_extended, (uchar**) &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_extended, &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"host",'h', "Connect to host.", (uchar**) &current_host,
- (uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"host",'h', "Connect to host.", &current_host,
+ &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"medium-check", 'm',
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG,
"Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Enabled by default; use --skip-write-binlog when commands should not be sent to replication slaves.",
- (uchar**) &opt_write_binlog, (uchar**) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
+ &opt_write_binlog, &opt_write_binlog, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
0, 0},
@@ -146,38 +146,38 @@ static struct my_option my_long_options[] =
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
- (uchar**) &opt_mysql_port,
- (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+ &opt_mysql_port,
+ &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q',
"If you are using this option with CHECK TABLE, it prevents the check from scanning the rows to check for wrong links. This is the fastest check. If you are using this option with REPAIR TABLE, it will try to repair only the index tree. This is the fastest repair method for a table.",
- (uchar**) &opt_quick, (uchar**) &opt_quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ &opt_quick, &opt_quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"repair", 'r',
"Can fix almost anything except unique keys that aren't unique.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
+ "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"silent", 's', "Print only error messages.", (uchar**) &opt_silent,
- (uchar**) &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"silent", 's', "Print only error messages.", &opt_silent,
+ &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "The socket file to use for connection.",
- (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
+ &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"tables", OPT_TABLES, "Overrides option --databases (-B).", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"use-frm", OPT_FRM,
"When used with REPAIR, get table structure from .frm file, so the table can be repaired even if .MYI header is corrupted.",
- (uchar**) &opt_frm, (uchar**) &opt_frm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ &opt_frm, &opt_frm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (uchar**) &current_user,
- (uchar**) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", &current_user,
+ &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v', "Print info about the various stages.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/client/mysqldump.c b/client/mysqldump.c
index a9fe3f8e1fa..0045faa2229 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -180,115 +180,115 @@ HASH ignore_table;
static struct my_option my_long_options[] =
{
{"all", OPT_ALL, "Deprecated. Use --create-options instead.",
- (uchar**) &create_options, (uchar**) &create_options, 0, GET_BOOL, NO_ARG, 1,
+ &create_options, &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"all-databases", 'A',
"Dump all the databases. This will be same as --databases with all databases selected.",
- (uchar**) &opt_alldbs, (uchar**) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &opt_alldbs, &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"all-tablespaces", 'Y',
"Dump all the tablespaces.",
- (uchar**) &opt_alltspcs, (uchar**) &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &opt_alltspcs, &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"no-tablespaces", 'y',
"Do not dump any tablespace information.",
- (uchar**) &opt_notspcs, (uchar**) &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &opt_notspcs, &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"add-drop-database", OPT_DROP_DATABASE, "Add a DROP DATABASE before each create.",
- (uchar**) &opt_drop_database, (uchar**) &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ &opt_drop_database, &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"add-drop-table", OPT_DROP, "Add a DROP TABLE before each create.",
- (uchar**) &opt_drop, (uchar**) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
+ &opt_drop, &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
{"add-locks", OPT_LOCKS, "Add locks around INSERT statements.",
- (uchar**) &opt_lock, (uchar**) &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
+ &opt_lock, &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
{"allow-keywords", OPT_KEYWORDS,
- "Allow creation of column names that are keywords.", (uchar**) &opt_keywords,
- (uchar**) &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "Allow creation of column names that are keywords.", &opt_keywords,
+ &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NETWARE__
{"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory for character set files.", (uchar**) &charsets_dir,
- (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory for character set files.", &charsets_dir,
+ &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"comments", 'i', "Write additional information.",
- (uchar**) &opt_comments, (uchar**) &opt_comments, 0, GET_BOOL, NO_ARG,
+ &opt_comments, &opt_comments, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"compatible", OPT_COMPATIBLE,
"Change the dump to be compatible with a given mode. By default tables are dumped in a format optimized for MySQL. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option is ignored with earlier server versions.",
- (uchar**) &opt_compatible_mode_str, (uchar**) &opt_compatible_mode_str, 0,
+ &opt_compatible_mode_str, &opt_compatible_mode_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compact", OPT_COMPACT,
"Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --skip-add-locks --skip-comments --skip-disable-keys --skip-set-charset.",
- (uchar**) &opt_compact, (uchar**) &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &opt_compact, &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"complete-insert", 'c', "Use complete insert statements.",
- (uchar**) &opt_complete_insert, (uchar**) &opt_complete_insert, 0, GET_BOOL,
+ &opt_complete_insert, &opt_complete_insert, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"create-options", 'a',
"Include all MySQL specific create options.",
- (uchar**) &create_options, (uchar**) &create_options, 0, GET_BOOL, NO_ARG, 1,
+ &create_options, &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"databases", 'B',
"Dump several databases. Note the difference in usage; in this case no tables are given. All name arguments are regarded as database names. 'USE db_name;' will be included in the output.",
- (uchar**) &opt_databases, (uchar**) &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0,
+ &opt_databases, &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit.",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log.", (uchar**) &default_dbug_option,
- (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log.", &default_dbug_option,
+ &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
- (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+ &debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
- (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+ &debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (uchar**) &default_charset,
- (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", &default_charset,
+ &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED.",
- (uchar**) &opt_delayed, (uchar**) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &opt_delayed, &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"delete-master-logs", OPT_DELETE_MASTER_LOGS,
"Delete logs on master after backup. This automatically enables --master-data.",
- (uchar**) &opt_delete_master_logs, (uchar**) &opt_delete_master_logs, 0,
+ &opt_delete_master_logs, &opt_delete_master_logs, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-keys", 'K',
- "'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (uchar**) &opt_disable_keys,
- (uchar**) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ "'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", &opt_disable_keys,
+ &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"events", 'E', "Dump events.",
- (uchar**) &opt_events, (uchar**) &opt_events, 0, GET_BOOL,
+ &opt_events, &opt_events, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"extended-insert", 'e',
"Use multiple-row INSERT syntax that include several VALUES lists.",
- (uchar**) &extended_insert, (uchar**) &extended_insert, 0, GET_BOOL, NO_ARG,
+ &extended_insert, &extended_insert, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB,
"Fields in the output file are terminated by the given string.",
- (uchar**) &fields_terminated, (uchar**) &fields_terminated, 0,
+ &fields_terminated, &fields_terminated, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-enclosed-by", OPT_ENC,
"Fields in the output file are enclosed by the given character.",
- (uchar**) &enclosed, (uchar**) &enclosed, 0,
+ &enclosed, &enclosed, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
{"fields-optionally-enclosed-by", OPT_O_ENC,
"Fields in the output file are optionally enclosed by the given character.",
- (uchar**) &opt_enclosed, (uchar**) &opt_enclosed, 0,
+ &opt_enclosed, &opt_enclosed, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
{"fields-escaped-by", OPT_ESC,
"Fields in the output file are escaped by the given character.",
- (uchar**) &escaped, (uchar**) &escaped, 0,
+ &escaped, &escaped, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"first-slave", OPT_FIRST_SLAVE, "Deprecated, renamed to --lock-all-tables.",
- (uchar**) &opt_lock_all_tables, (uchar**) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
+ &opt_lock_all_tables, &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"flush-logs", 'F', "Flush logs file in server before starting dump. "
"Note that if you dump many databases at once (using the option "
@@ -299,24 +299,24 @@ static struct my_option my_long_options[] =
"to the moment all tables are locked. So if you want your dump and "
"the log flush to happen at the same exact moment you should use "
"--lock-all-tables or --master-data with --flush-logs.",
- (uchar**) &flush_logs, (uchar**) &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &flush_logs, &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"flush-privileges", OPT_ESC, "Emit a FLUSH PRIVILEGES statement "
"after dumping the mysql database. This option should be used any "
"time the dump contains the mysql database and any other database "
"that depends on the data in the mysql database for proper restore. ",
- (uchar**) &flush_privileges, (uchar**) &flush_privileges, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &flush_privileges, &flush_privileges, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"force", 'f', "Continue even if we get an SQL error.",
- (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG,
+ &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"hex-blob", OPT_HEXBLOB, "Dump binary strings (BINARY, "
"VARBINARY, BLOB) in hexadecimal format.",
- (uchar**) &opt_hex_blob, (uchar**) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (uchar**) &current_host,
- (uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ &opt_hex_blob, &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"host", 'h', "Connect to host.", &current_host,
+ &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-table", OPT_IGNORE_TABLE,
"Do not dump the specified table. To specify more than one table to ignore, "
"use the directive multiple times, once for each table. Each table must "
@@ -324,21 +324,21 @@ static struct my_option my_long_options[] =
"--ignore-table=database.table.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.",
- (uchar**) &opt_ignore, (uchar**) &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &opt_ignore, &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"lines-terminated-by", OPT_LTB,
"Lines in the output file are terminated by the given string.",
- (uchar**) &lines_terminated, (uchar**) &lines_terminated, 0, GET_STR,
+ &lines_terminated, &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lock-all-tables", 'x', "Locks all tables across all databases. This "
"is achieved by taking a global read lock for the duration of the whole "
"dump. Automatically turns --single-transaction and --lock-tables off.",
- (uchar**) &opt_lock_all_tables, (uchar**) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
+ &opt_lock_all_tables, &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"lock-tables", 'l', "Lock all tables for read.", (uchar**) &lock_tables,
- (uchar**) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ {"lock-tables", 'l', "Lock all tables for read.", &lock_tables,
+ &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.",
- (uchar**) &log_error_file, (uchar**) &log_error_file, 0, GET_STR,
+ &log_error_file, &log_error_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"master-data", OPT_MASTER_DATA,
"This causes the binary log position and filename to be appended to the "
@@ -350,33 +350,33 @@ static struct my_option my_long_options[] =
"don't forget to read about --single-transaction below). In all cases, "
"any action on logs will happen at the exact moment of the dump. "
"Option automatically turns --lock-tables off.",
- (uchar**) &opt_master_data, (uchar**) &opt_master_data, 0,
+ &opt_master_data, &opt_master_data, 0,
GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"The maximum packet length to send to or receive from server.",
- (uchar**) &opt_max_allowed_packet, (uchar**) &opt_max_allowed_packet, 0,
+ &opt_max_allowed_packet, &opt_max_allowed_packet, 0,
GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
(longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
"The buffer size for TCP/IP and socket communication.",
- (uchar**) &opt_net_buffer_length, (uchar**) &opt_net_buffer_length, 0,
+ &opt_net_buffer_length, &opt_net_buffer_length, 0,
GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L,
MALLOC_OVERHEAD-1024, 1024, 0},
{"no-autocommit", OPT_AUTOCOMMIT,
"Wrap tables with autocommit/commit statements.",
- (uchar**) &opt_autocommit, (uchar**) &opt_autocommit, 0, GET_BOOL, NO_ARG,
+ &opt_autocommit, &opt_autocommit, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"no-create-db", 'n',
"Suppress the CREATE DATABASE ... IF EXISTS statement that normally is "
"output for each dumped database if --all-databases or --databases is "
"given.",
- (uchar**) &opt_create_db, (uchar**) &opt_create_db, 0,
+ &opt_create_db, &opt_create_db, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-create-info", 't', "Don't write table creation info.",
- (uchar**) &opt_no_create_info, (uchar**) &opt_no_create_info, 0, GET_BOOL,
+ &opt_no_create_info, &opt_no_create_info, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"no-data", 'd', "No row information.", (uchar**) &opt_no_data,
- (uchar**) &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-data", 'd', "No row information.", &opt_no_data,
+ &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-set-names", 'N',"Suppress the SET NAMES statement",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"opt", OPT_OPTIMIZE,
@@ -384,7 +384,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"order-by-primary", OPT_ORDER_BY_PRIMARY,
"Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.",
- (uchar**) &opt_order_by_primary, (uchar**) &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ &opt_order_by_primary, &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's solicited on the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -392,36 +392,36 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
- (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+ {"port", 'P', "Port number to use for connection.", &opt_mysql_port,
+ &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL,
"The protocol to use for connection (tcp, socket, pipe, memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q', "Don't buffer query, dump directly to stdout.",
- (uchar**) &quick, (uchar**) &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ &quick, &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"quote-names",'Q', "Quote table and column names with backticks (`).",
- (uchar**) &opt_quoted, (uchar**) &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
+ &opt_quoted, &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
{"replace", OPT_MYSQL_REPLACE_INTO, "Use REPLACE INTO instead of INSERT INTO.",
- (uchar**) &opt_replace_into, (uchar**) &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &opt_replace_into, &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"result-file", 'r',
"Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"routines", 'R', "Dump stored routines (functions and procedures).",
- (uchar**) &opt_routines, (uchar**) &opt_routines, 0, GET_BOOL,
+ &opt_routines, &opt_routines, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
"Add 'SET NAMES default_character_set' to the output. Enabled by default; suppress with --skip-set-charset.",
- (uchar**) &opt_set_charset, (uchar**) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
+ &opt_set_charset, &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
+ "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
/*
@@ -439,42 +439,42 @@ static struct my_option my_long_options[] =
"connection should use the following statements: ALTER TABLE, DROP "
"TABLE, RENAME TABLE, TRUNCATE TABLE, as consistent snapshot is not "
"isolated from them. Option automatically turns off --lock-tables.",
- (uchar**) &opt_single_transaction, (uchar**) &opt_single_transaction, 0,
+ &opt_single_transaction, &opt_single_transaction, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"dump-date", OPT_DUMP_DATE, "Put a dump date to the end of the output.",
- (uchar**) &opt_dump_date, (uchar**) &opt_dump_date, 0,
+ &opt_dump_date, &opt_dump_date, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-opt", OPT_SKIP_OPTIMIZATION,
"Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "The socket file to use for connection.",
- (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0,
+ &opt_mysql_unix_port, &opt_mysql_unix_port, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"tab",'T',
"Create tab-separated textfile for each table to given path. (Create .sql "
"and .txt files.) NOTE: This only works if mysqldump is run on the same "
"machine as the mysqld server.",
- (uchar**) &path, (uchar**) &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ &path, &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tables", OPT_TABLES, "Overrides option --databases (-B).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"triggers", OPT_TRIGGERS, "Dump triggers for each dumped table.",
- (uchar**) &opt_dump_triggers, (uchar**) &opt_dump_triggers, 0, GET_BOOL,
+ &opt_dump_triggers, &opt_dump_triggers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"tz-utc", OPT_TZ_UTC,
"SET TIME_ZONE='+00:00' at top of dump to allow dumping of TIMESTAMP data when a server has data in different time zones or data is being moved between servers with different time zones.",
- (uchar**) &opt_tz_utc, (uchar**) &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ &opt_tz_utc, &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.",
- (uchar**) &current_user, (uchar**) &current_user, 0, GET_STR, REQUIRED_ARG,
+ &current_user, &current_user, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v', "Print info about the various stages.",
- (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ &verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version",'V', "Output version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"where", 'w', "Dump only selected records. Quotes are mandatory.",
- (uchar**) &where, (uchar**) &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ &where, &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index d346cd567e7..404106560c1 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -73,68 +73,68 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory for character set files.", (uchar**) &charsets_dir,
- (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory for character set files.", &charsets_dir,
+ &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (uchar**) &default_charset,
- (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", &default_charset,
+ &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"columns", 'c',
"Use only these columns to import the data to. Give the column names in a comma separated list. This is same as giving columns to LOAD DATA INFILE.",
- (uchar**) &opt_columns, (uchar**) &opt_columns, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ &opt_columns, &opt_columns, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
- (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+ &debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
- (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+ &debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"delete", 'd', "First delete all rows from table.", (uchar**) &opt_delete,
- (uchar**) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"delete", 'd', "First delete all rows from table.", &opt_delete,
+ &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB,
"Fields in the input file are terminated by the given string.",
- (uchar**) &fields_terminated, (uchar**) &fields_terminated, 0,
+ &fields_terminated, &fields_terminated, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-enclosed-by", OPT_ENC,
"Fields in the import file are enclosed by the given character.",
- (uchar**) &enclosed, (uchar**) &enclosed, 0,
+ &enclosed, &enclosed, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-optionally-enclosed-by", OPT_O_ENC,
"Fields in the input file are optionally enclosed by the given character.",
- (uchar**) &opt_enclosed, (uchar**) &opt_enclosed, 0,
+ &opt_enclosed, &opt_enclosed, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-escaped-by", OPT_ESC,
"Fields in the input file are escaped by the given character.",
- (uchar**) &escaped, (uchar**) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
+ &escaped, &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"force", 'f', "Continue even if we get an SQL error.",
- (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
+ &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (uchar**) &current_host,
- (uchar**) &current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"host", 'h', "Connect to host.", &current_host,
+ &current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ignore", 'i', "If duplicate unique key was found, keep old row.",
- (uchar**) &ignore, (uchar**) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ &ignore, &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.",
- (uchar**) &opt_ignore_lines, (uchar**) &opt_ignore_lines, 0, GET_LL,
+ &opt_ignore_lines, &opt_ignore_lines, 0, GET_LL,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lines-terminated-by", OPT_LTB,
"Lines in the input file are terminated by the given string.",
- (uchar**) &lines_terminated, (uchar**) &lines_terminated, 0, GET_STR,
+ &lines_terminated, &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"local", 'L', "Read all files through the client.", (uchar**) &opt_local_file,
- (uchar**) &opt_local_file, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"local", 'L', "Read all files through the client.", &opt_local_file,
+ &opt_local_file, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"lock-tables", 'l', "Lock all tables for write (this disables threads).",
- (uchar**) &lock_tables, (uchar**) &lock_tables, 0, GET_BOOL, NO_ARG,
+ &lock_tables, &lock_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"low-priority", OPT_LOW_PRIORITY,
- "Use LOW_PRIORITY when updating the table.", (uchar**) &opt_low_priority,
- (uchar**) &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "Use LOW_PRIORITY when updating the table.", &opt_low_priority,
+ &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -148,35 +148,35 @@ static struct my_option my_long_options[] =
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
- (uchar**) &opt_mysql_port,
- (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+ &opt_mysql_port,
+ &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replace", 'r', "If duplicate unique key was found, replace old row.",
- (uchar**) &replace, (uchar**) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ &replace, &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
+ "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"silent", 's', "Be more silent.", (uchar**) &silent, (uchar**) &silent, 0,
+ {"silent", 's', "Be more silent.", &silent, &silent, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "The socket file to use for connection.",
- (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
+ &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"use-threads", OPT_USE_THREADS,
"Load files in parallel. The argument is the number "
"of threads to use for loading data.",
- (uchar**) &opt_use_threads, (uchar**) &opt_use_threads, 0,
+ &opt_use_threads, &opt_use_threads, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (uchar**) &current_user,
- (uchar**) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", &current_user,
+ &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"verbose", 'v', "Print info about the various stages.", (uchar**) &verbose,
- (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Print info about the various stages.", &verbose,
+ &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 370efe83f10..2f5582cb668 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -164,35 +164,35 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"character-sets-dir", 'c', "Directory for character set files.",
- (uchar**) &charsets_dir, (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
+ &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (uchar**) &default_charset,
- (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Set the default character set.", &default_charset,
+ &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"count", OPT_COUNT,
"Show number of rows per table (may be slow for non-MyISAM tables).",
- (uchar**) &opt_count, (uchar**) &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_count, &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
- (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+ &debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
- (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+ &debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
+ {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"status", 'i', "Shows a lot of extra information about each table.",
- (uchar**) &opt_status, (uchar**) &opt_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ &opt_status, &opt_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
- {"keys", 'k', "Show keys for table.", (uchar**) &opt_show_keys,
- (uchar**) &opt_show_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"keys", 'k', "Show keys for table.", &opt_show_keys,
+ &opt_show_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given, it's "
"solicited on the tty.",
@@ -203,8 +203,8 @@ static struct my_option my_long_options[] =
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
- (uchar**) &opt_mysql_port,
- (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+ &opt_mysql_port,
+ &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
#ifdef __WIN__
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
@@ -215,19 +215,20 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
- 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Base name of shared memory.", &shared_memory_base_name,
+ &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG,
+ 0, 0, 0, 0, 0, 0},
#endif
{"show-table-type", 't', "Show table type column.",
- (uchar**) &opt_table_type, (uchar**) &opt_table_type, 0, GET_BOOL,
+ &opt_table_type, &opt_table_type, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "The socket file to use for connection.",
- (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
+ &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (uchar**) &user,
- (uchar**) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", &user,
+ &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v',
"More verbose output; you can use this multiple times to get even more "
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index ad5db7735be..1d1fe4c27ed 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -525,62 +525,62 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0, 0},
{"auto-generate-sql", 'a',
"Generate SQL where not supplied by file or command line.",
- (uchar**) &auto_generate_sql, (uchar**) &auto_generate_sql,
+ &auto_generate_sql, &auto_generate_sql,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-add-autoincrement", OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
"Add an AUTO_INCREMENT column to auto-generated tables.",
- (uchar**) &auto_generate_sql_autoincrement,
- (uchar**) &auto_generate_sql_autoincrement,
+ &auto_generate_sql_autoincrement,
+ &auto_generate_sql_autoincrement,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-execute-number", OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES,
"Set this number to generate a set number of queries to run.",
- (uchar**) &auto_actual_queries, (uchar**) &auto_actual_queries,
+ &auto_actual_queries, &auto_actual_queries,
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-guid-primary", OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY,
"Add GUID based primary keys to auto-generated tables.",
- (uchar**) &auto_generate_sql_guid_primary,
- (uchar**) &auto_generate_sql_guid_primary,
+ &auto_generate_sql_guid_primary,
+ &auto_generate_sql_guid_primary,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE,
"Specify test load type: mixed, update, write, key, or read; default is mixed.",
- (uchar**) &auto_generate_sql_type, (uchar**) &auto_generate_sql_type,
+ &auto_generate_sql_type, &auto_generate_sql_type,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-secondary-indexes",
OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES,
"Number of secondary indexes to add to auto-generated tables.",
- (uchar**) &auto_generate_sql_secondary_indexes,
- (uchar**) &auto_generate_sql_secondary_indexes, 0,
+ &auto_generate_sql_secondary_indexes,
+ &auto_generate_sql_secondary_indexes, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-unique-query-number",
OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM,
"Number of unique queries to generate for automatic tests.",
- (uchar**) &auto_generate_sql_unique_query_number,
- (uchar**) &auto_generate_sql_unique_query_number,
+ &auto_generate_sql_unique_query_number,
+ &auto_generate_sql_unique_query_number,
0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
{"auto-generate-sql-unique-write-number",
OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM,
"Number of unique queries to generate for auto-generate-sql-write-number.",
- (uchar**) &auto_generate_sql_unique_write_number,
- (uchar**) &auto_generate_sql_unique_write_number,
+ &auto_generate_sql_unique_write_number,
+ &auto_generate_sql_unique_write_number,
0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
{"auto-generate-sql-write-number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
"Number of row inserts to perform for each thread (default is 100).",
- (uchar**) &auto_generate_sql_number, (uchar**) &auto_generate_sql_number,
+ &auto_generate_sql_number, &auto_generate_sql_number,
0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
{"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.",
- (uchar**) &commit_rate, (uchar**) &commit_rate, 0, GET_UINT, REQUIRED_ARG,
+ &commit_rate, &commit_rate, 0, GET_UINT, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
- (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"concurrency", 'c', "Number of clients to simulate for query to run.",
- (uchar**) &concurrency_str, (uchar**) &concurrency_str, 0, GET_STR,
+ &concurrency_str, &concurrency_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.",
- (uchar**) &create_string, (uchar**) &create_string, 0, GET_STR, REQUIRED_ARG,
+ &create_string, &create_string, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.",
- (uchar**) &create_schema_string, (uchar**) &create_schema_string, 0, GET_STR,
+ &create_schema_string, &create_schema_string, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"csv", OPT_SLAP_CSV,
"Generate CSV output to named file or to stdout if no file is named.",
@@ -590,47 +590,48 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
- (uchar**) &default_dbug_option, (uchar**) &default_dbug_option, 0, GET_STR,
+ &default_dbug_option, &default_dbug_option, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
- (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+ &debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
- (uchar**) &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag,
+ &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", 'F',
"Delimiter to use in SQL statements supplied in file or command line.",
- (uchar**) &delimiter, (uchar**) &delimiter, 0, GET_STR, REQUIRED_ARG,
+ &delimiter, &delimiter, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"detach", OPT_SLAP_DETACH,
"Detach (close and reopen) connections after X number of requests.",
- (uchar**) &detach_rate, (uchar**) &detach_rate, 0, GET_UINT, REQUIRED_ARG,
+ &detach_rate, &detach_rate, 0, GET_UINT, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
- {"engine", 'e', "Comma separated list of storage engines to use for creating the table."
- " The test is run for each engine. You can also specify an option for an engine"
- " after a `:', like memory:max_row=2300",
- (uchar**) &default_engine, (uchar**) &default_engine, 0,
+ {"engine", 'e',
+ "Comma separated list of storage engines to use for creating the table."
+ " The test is run for each engine. You can also specify an option for an "
+ "engine after a `:', like memory:max_row=2300",
+ &default_engine, &default_engine, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
+ {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"iterations", 'i', "Number of times to run the tests.", (uchar**) &iterations,
- (uchar**) &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
+ {"iterations", 'i', "Number of times to run the tests.", &iterations,
+ &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
{"number-char-cols", 'x',
"Number of VARCHAR columns to create in table if specifying --auto-generate-sql.",
- (uchar**) &num_char_cols_opt, (uchar**) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
+ &num_char_cols_opt, &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"number-int-cols", 'y',
"Number of INT columns to create in table if specifying --auto-generate-sql.",
- (uchar**) &num_int_cols_opt, (uchar**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG,
+ &num_int_cols_opt, &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY,
"Limit each client to this number of queries (this is not exact).",
- (uchar**) &num_of_query, (uchar**) &num_of_query, 0,
+ &num_of_query, &num_of_query, 0,
GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"only-print", OPT_MYSQL_ONLY_PRINT,
"Do not connect to the databases, but instead print out what would have "
"been done.",
- (uchar**) &opt_only_print, (uchar**) &opt_only_print, 0, GET_BOOL, NO_ARG,
+ &opt_only_print, &opt_only_print, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's "
@@ -639,58 +640,54 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
- (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
+ {"port", 'P', "Port number to use for connection.", &opt_mysql_port,
+ &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
0},
{"post-query", OPT_SLAP_POST_QUERY,
"Query to run or file containing query to execute after tests have completed.",
- (uchar**) &user_supplied_post_statements,
- (uchar**) &user_supplied_post_statements,
+ &user_supplied_post_statements, &user_supplied_post_statements,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"post-system", OPT_SLAP_POST_SYSTEM,
"system() string to execute after tests have completed.",
- (uchar**) &post_system,
- (uchar**) &post_system,
+ &post_system, &post_system,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"pre-query", OPT_SLAP_PRE_QUERY,
"Query to run or file containing query to execute before running tests.",
- (uchar**) &user_supplied_pre_statements,
- (uchar**) &user_supplied_pre_statements,
+ &user_supplied_pre_statements, &user_supplied_pre_statements,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"pre-system", OPT_SLAP_PRE_SYSTEM,
"system() string to execute before running tests.",
- (uchar**) &pre_system,
- (uchar**) &pre_system,
+ &pre_system, &pre_system,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL,
"The protocol to use for connection (tcp, socket, pipe, memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"query", 'q', "Query to run or file containing query to run.",
- (uchar**) &user_supplied_query, (uchar**) &user_supplied_query,
+ &user_supplied_query, &user_supplied_query,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (uchar**) &shared_memory_base_name,
- (uchar**) &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG,
+ "Base name of shared memory.", &shared_memory_base_name,
+ &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Run program in silent mode - no output.",
- (uchar**) &opt_silent, (uchar**) &opt_silent, 0, GET_BOOL, NO_ARG,
+ &opt_silent, &opt_silent, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"socket", 'S', "The socket file to use for connection.",
- (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
+ &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user.", (uchar**) &user,
- (uchar**) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user.", &user,
+ &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v',
- "More verbose output; you can use this multiple times to get even more "
- "verbose output.", (uchar**) &verbose, (uchar**) &verbose, 0,
- GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
- NO_ARG, 0, 0, 0, 0, 0, 0},
+ "More verbose output; you can use this multiple times to get even more "
+ "verbose output.", &verbose, &verbose, 0, GET_NO_ARG, NO_ARG,
+ 0, 0, 0, 0, 0, 0},
+ {"version", 'V', "Output version information and exit.", 0, 0, 0,
+ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index bc6582156fa..466de547a26 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -5884,18 +5884,18 @@ static struct my_option my_long_options[] =
{
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"basedir", 'b', "Basedir for tests.", (uchar**) &opt_basedir,
- (uchar**) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"basedir", 'b', "Basedir for tests.", &opt_basedir,
+ &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory for character set files.", (uchar**) &opt_charsets_dir,
- (uchar**) &opt_charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory for character set files.", &opt_charsets_dir,
+ &opt_charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use the compressed server/client protocol.",
- (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.",
- (uchar**) &cursor_protocol, (uchar**) &cursor_protocol, 0,
+ &cursor_protocol, &cursor_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"database", 'D', "Database to use.", (uchar**) &opt_db, (uchar**) &opt_db, 0,
+ {"database", 'D', "Database to use.", &opt_db, &opt_db, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
@@ -5905,33 +5905,33 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
- (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+ &debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
- (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+ &debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"global-subst", OPT_GLOBAL_SUBST, "argument should be 'X,Y' ;"
" substitute string X with another Y accross the whole test's current"
" result before comparing with expected result file",
- (uchar**) &global_subst, (uchar**) &global_subst, 0,
+ &global_subst, &global_subst, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host.", (uchar**) &opt_host, (uchar**) &opt_host, 0,
+ {"host", 'h', "Connect to host.", &opt_host, &opt_host, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"include", 'i', "Include SQL before each test case.", (uchar**) &opt_include,
- (uchar**) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"logdir", OPT_LOG_DIR, "Directory for log files", (uchar**) &opt_logdir,
- (uchar**) &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"include", 'i', "Include SQL before each test case.", &opt_include,
+ &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"logdir", OPT_LOG_DIR, "Directory for log files", &opt_logdir,
+ &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"mark-progress", OPT_MARK_PROGRESS,
"Write line number and elapsed time to <testname>.progress.",
- (uchar**) &opt_mark_progress, (uchar**) &opt_mark_progress, 0,
+ &opt_mark_progress, &opt_mark_progress, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"max-connect-retries", OPT_MAX_CONNECT_RETRIES,
"Maximum number of attempts to connect to server.",
- (uchar**) &opt_max_connect_retries, (uchar**) &opt_max_connect_retries, 0,
+ &opt_max_connect_retries, &opt_max_connect_retries, 0,
GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
{"max-connections", OPT_MAX_CONNECTIONS,
"Max number of open connections to server",
- (uchar**) &opt_max_connections, (uchar**) &opt_max_connections, 0,
+ &opt_max_connections, &opt_max_connections, 0,
GET_INT, REQUIRED_ARG, 128, 8, 5120, 0, 0, 0},
{"password", 'p', "Password to use when connecting to server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -5941,18 +5941,17 @@ static struct my_option my_long_options[] =
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
- (uchar**) &opt_port,
- (uchar**) &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ &opt_port, &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ps-protocol", OPT_PS_PROTOCOL,
"Use prepared-statement protocol for communication.",
- (uchar**) &ps_protocol, (uchar**) &ps_protocol, 0,
+ &ps_protocol, &ps_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"quiet", 's', "Suppress all normal output.", (uchar**) &silent,
- (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"quiet", 's', "Suppress all normal output.", &silent,
+ &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"record", 'r', "Record output of test_file into result file.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"result-file", 'R', "Read/store result from/in this file.",
- (uchar**) &result_file_name, (uchar**) &result_file_name, 0,
+ &result_file_name, &result_file_name, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-arg", 'A', "Send option value to embedded server as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -5960,28 +5959,28 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (uchar**) &shared_memory_base_name,
- (uchar**) &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ "Base name of shared memory.", &shared_memory_base_name,
+ &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
#endif
{"silent", 's', "Suppress all normal output. Synonym for --quiet.",
- (uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ &silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
"Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"sleep", 'T', "Always sleep this many seconds on sleep commands.",
- (uchar**) &opt_sleep, (uchar**) &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, -1, 0,
+ &opt_sleep, &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, -1, 0,
0, 0, 0},
{"socket", 'S', "The socket file to use for connection.",
- (uchar**) &unix_sock, (uchar**) &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ &unix_sock, &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"sp-protocol", OPT_SP_PROTOCOL, "Use stored procedures for select.",
- (uchar**) &sp_protocol, (uchar**) &sp_protocol, 0,
+ &sp_protocol, &sp_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#include "sslopt-longopts.h"
{"tail-lines", OPT_TAIL_LINES,
"Number of lines of the result to include in a failure report.",
- (uchar**) &opt_tail_lines, (uchar**) &opt_tail_lines, 0,
+ &opt_tail_lines, &opt_tail_lines, 0,
GET_INT, REQUIRED_ARG, 0, 0, 10000, 0, 0, 0},
{"test-file", 'x', "Read test from/in this file (default stdin).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -5992,14 +5991,14 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't', "Temporary directory where sockets are put.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"user", 'u', "User for login.", (uchar**) &opt_user, (uchar**) &opt_user, 0,
+ {"user", 'u', "User for login.", &opt_user, &opt_user, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"verbose", 'v', "Write more.", (uchar**) &verbose, (uchar**) &verbose, 0,
+ {"verbose", 'v', "Write more.", &verbose, &verbose, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select.",
- (uchar**) &view_protocol, (uchar**) &view_protocol, 0,
+ &view_protocol, &view_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/config/ac-macros/ssl.m4 b/config/ac-macros/ssl.m4
index 729115ffe88..fc55f93d8d6 100644
--- a/config/ac-macros/ssl.m4
+++ b/config/ac-macros/ssl.m4
@@ -38,11 +38,20 @@ AC_DEFUN([MYSQL_USE_BUNDLED_YASSL], [
esac
AC_SUBST([yassl_taocrypt_extra_cxxflags])
+ # Thread safe check
+ yassl_thread_cxxflags=""
+ yassl_thread_safe=""
+ if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no"; then
+ yassl_thread_cxxflags="-DYASSL_THREAD_SAFE"
+ yassl_thread_safe="(thread-safe)"
+ fi
+ AC_SUBST([yassl_thread_cxxflags])
+
# Link extra/yassl/include/openssl subdir to include/
yassl_h_ln_cmd="\$(LN) -s \$(top_srcdir)/extra/yassl/include/openssl openssl"
AC_SUBST(yassl_h_ln_cmd)
- AC_MSG_RESULT([using bundled yaSSL])
+ AC_MSG_RESULT([using bundled yaSSL $yassl_thread_safe])
])
diff --git a/configure.in b/configure.in
index b524dcee702..673146f64f9 100644
--- a/configure.in
+++ b/configure.in
@@ -834,9 +834,9 @@ AC_TYPE_SIZE_T
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h ieeefp.h limits.h \
- memory.h pwd.h select.h fnmatch.h \
- stdlib.h stddef.h sys/stat.h valgrind/memcheck.h \
+AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h fpu_control.h \
+ ieeefp.h limits.h memory.h pwd.h select.h fnmatch.h \
+ stdlib.h stddef.h sys/stat.h \
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
@@ -1727,6 +1727,17 @@ else
CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
fi
+AC_ARG_WITH([valgrind],
+ [AS_HELP_STRING([--with-valgrind],
+ [Valgrind instrumentation @<:@default=no@:>@])],
+ [], [with_valgrind=no])
+
+if test "$with_valgrind" != "no"
+then
+ AC_CHECK_HEADERS([valgrind/valgrind.h valgrind/memcheck.h],
+ [AC_DEFINE([HAVE_VALGRIND], [1], [Define for Valgrind support])])
+fi
+
# Debug Sync Facility. NOTE: depends on 'with_debug'. Must be behind it.
AC_MSG_CHECKING(if Debug Sync Facility should be enabled.)
AC_ARG_ENABLE(debug_sync,
diff --git a/extra/comp_err.c b/extra/comp_err.c
index bca8d3895cb..58395cd6344 100644
--- a/extra/comp_err.c
+++ b/extra/comp_err.c
@@ -99,31 +99,30 @@ static struct my_option my_long_options[]=
{"debug", '#', "This is a non-debug version. Catch this and exit",
0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log", (uchar**) & default_dbug_option,
- (uchar**) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", &default_dbug_option,
+ &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"debug-info", 'T', "Print some debug info at exit.", (uchar**) & info_flag,
- (uchar**) & info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", 'T', "Print some debug info at exit.", &info_flag,
+ &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Prints version", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"charset", 'C', "Charset dir", (uchar**) & charsets_dir,
- (uchar**) & charsets_dir,
+ {"charset", 'C', "Charset dir",
+ (char**) &charsets_dir, (char**) &charsets_dir,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"in_file", 'F', "Input file", (uchar**) & TXTFILE, (uchar**) & TXTFILE,
+ {"in_file", 'F', "Input file", &TXTFILE, &TXTFILE,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"out_dir", 'D', "Output base directory", (uchar**) & DATADIRECTORY,
- (uchar**) & DATADIRECTORY,
+ {"out_dir", 'D', "Output base directory", &DATADIRECTORY, &DATADIRECTORY,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"out_file", 'O', "Output filename (errmsg.sys)", (uchar**) & OUTFILE,
- (uchar**) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"header_file", 'H', "mysqld_error.h file ", (uchar**) & HEADERFILE,
- (uchar**) & HEADERFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"name_file", 'N', "mysqld_ername.h file ", (uchar**) & NAMEFILE,
- (uchar**) & NAMEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"state_file", 'S', "sql_state.h file", (uchar**) & STATEFILE,
- (uchar**) & STATEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"out_file", 'O', "Output filename (errmsg.sys)", &OUTFILE,
+ &OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"header_file", 'H', "mysqld_error.h file ", &HEADERFILE,
+ &HEADERFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"name_file", 'N', "mysqld_ername.h file ", &NAMEFILE,
+ &NAMEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"state_file", 'S', "sql_state.h file", &STATEFILE,
+ &STATEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index 06f7e51c380..da7061471fa 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -46,31 +46,36 @@ static struct my_option my_long_options[] =
searched for a file of this name (and standard filename extensions are
added if the file has no extension)
*/
- {"config-file", 'c', "Deprecated, please use --defaults-file instead. Name of config file to read; if no extension is given, default extension (e.g., .ini or .cnf) will be added",
- (uchar**) &config_file, (uchar**) &config_file, 0, GET_STR, REQUIRED_ARG,
+ {"config-file", 'c', "Deprecated, please use --defaults-file instead. "
+ "Name of config file to read; if no extension is given, default "
+ "extension (e.g., .ini or .cnf) will be added",
+ (char**) &config_file, (char**) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
- (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", &default_dbug_option,
+ &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"defaults-file", 'c', "Like --config-file, except: if first option, then read this file only, do not read global or per-user config files; should be the first option",
- (uchar**) &config_file, (uchar**) &config_file, 0, GET_STR, REQUIRED_ARG,
+ {"defaults-file", 'c', "Like --config-file, except: if first option, "
+ "then read this file only, do not read global or per-user config "
+ "files; should be the first option",
+ (char**) &config_file, (char*) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"defaults-extra-file", 'e',
- "Read this file after the global config file and before the config file in the users home directory; should be the first option",
- (uchar**) &my_defaults_extra_file, (uchar**) &my_defaults_extra_file, 0,
+ "Read this file after the global config file and before the config "
+ "file in the users home directory; should be the first option",
+ &my_defaults_extra_file, &my_defaults_extra_file, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"defaults-group-suffix", 'g',
"In addition to the given groups, read also groups with this suffix",
- (uchar**) &my_defaults_group_suffix, (uchar**) &my_defaults_group_suffix,
+ (char**) &my_defaults_group_suffix, (char**) &my_defaults_group_suffix,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extra-file", 'e',
"Deprecated. Synonym for --defaults-extra-file.",
- (uchar**) &my_defaults_extra_file,
- (uchar**) &my_defaults_extra_file, 0, GET_STR,
+ &my_defaults_extra_file,
+ &my_defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-defaults", 'n', "Return an empty string (useful for scripts).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c
index 42465998862..e5c06ac9857 100644
--- a/extra/mysql_waitpid.c
+++ b/extra/mysql_waitpid.c
@@ -38,7 +38,7 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0},
{"verbose", 'v',
"Be more verbose. Give a warning, if kill can't handle signal 0.",
- (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ &verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Print version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
diff --git a/extra/perror.c b/extra/perror.c
index a98a4fc3d1b..c32ad2bc791 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -60,18 +60,18 @@ static struct my_option my_long_options[] =
{"info", 'I', "Synonym for --help.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
- {"ndb", 257, "Ndbcluster storage engine specific error codes.", (uchar**) &ndb_code,
- (uchar**) &ndb_code, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"ndb", 257, "Ndbcluster storage engine specific error codes.", &ndb_code,
+ &ndb_code, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
#ifdef HAVE_SYS_ERRLIST
{"all", 'a', "Print all the error messages and the number.",
- (uchar**) &print_all_codes, (uchar**) &print_all_codes, 0, GET_BOOL, NO_ARG,
+ &print_all_codes, &print_all_codes, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Only print the error message.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"verbose", 'v', "Print error code and message (default).", (uchar**) &verbose,
- (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Print error code and message (default).", &verbose,
+ &verbose, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"version", 'V', "Displays version information and exits.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c
index 447d63890bd..4faca1653b2 100644
--- a/extra/resolve_stack_dump.c
+++ b/extra/resolve_stack_dump.c
@@ -53,10 +53,10 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"symbols-file", 's', "Use specified symbols file.", (uchar**) &sym_fname,
- (uchar**) &sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"symbols-file", 's', "Use specified symbols file.", &sym_fname,
+ &sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"numeric-dump-file", 'n', "Read the dump from specified file.",
- (uchar**) &dump_fname, (uchar**) &dump_fname, 0, GET_STR, REQUIRED_ARG,
+ &dump_fname, &dump_fname, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/extra/resolveip.c b/extra/resolveip.c
index 5f2a9269f62..90fda977848 100644
--- a/extra/resolveip.c
+++ b/extra/resolveip.c
@@ -45,7 +45,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"info", 'I', "Synonym for --help.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"silent", 's', "Be more silent.", (uchar**) &silent, (uchar**) &silent,
+ {"silent", 's', "Be more silent.", &silent, &silent,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Displays version information and exits.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt
index ffb72b831af..3407aa7d0dc 100755
--- a/extra/yassl/CMakeLists.txt
+++ b/extra/yassl/CMakeLists.txt
@@ -17,7 +17,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extra/yassl/include
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
-ADD_DEFINITIONS("-D_LIB -DYASSL_PREFIX")
+ADD_DEFINITIONS("-D_LIB -DYASSL_PREFIX -DYASSL_THREAD_SAFE")
SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
diff --git a/extra/yassl/certs/ca-cert.pem b/extra/yassl/certs/ca-cert.pem
index 981dd004fc6..e353d118712 100644
--- a/extra/yassl/certs/ca-cert.pem
+++ b/extra/yassl/certs/ca-cert.pem
@@ -5,49 +5,49 @@ Certificate:
Signature Algorithm: md5WithRSAEncryption
Issuer: C=US, ST=Oregon, L=Portland, O=sawtooth, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
Validity
- Not Before: Jan 18 20:12:32 2005 GMT
- Not After : Oct 15 20:12:32 2007 GMT
+ Not Before: Mar 7 03:10:11 2005 GMT
+ Not After : Apr 1 03:10:11 2046 GMT
Subject: C=US, ST=Oregon, L=Portland, O=sawtooth, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public Key: (512 bit)
Modulus (512 bit):
- 00:cf:2b:14:00:b0:3c:df:6f:9e:91:40:ec:c8:f6:
- 90:b2:5b:b4:70:80:a5:a4:0a:73:c7:44:f3:2a:26:
- c4:2f:f1:3a:f1:c3:c4:ac:fc:c3:d2:c3:bf:f5:d7:
- 6a:38:42:ad:22:ab:c8:c4:4b:4c:1d:16:af:05:34:
- 7d:79:97:5e:e1
+ 00:ef:c1:e3:9a:3c:6e:6e:cb:26:6f:05:be:e0:cb:
+ 57:a0:4b:68:e6:1b:f9:95:db:01:92:aa:6e:a6:b5:
+ 2d:b1:2b:50:fd:db:13:f2:c5:d8:b8:4f:75:28:53:
+ 72:e8:e5:11:9d:bb:c3:4f:4f:09:fd:4c:e7:46:d5:
+ 1d:bb:35:02:af
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
- CB:0F:1F:E9:A2:76:71:C9:E6:E8:23:A6:C1:18:B7:CC:44:CF:B9:84
+ 1D:EF:A1:B8:81:78:12:47:E8:57:06:08:74:18:F7:D3:AA:D8:F7:BD
X509v3 Authority Key Identifier:
- keyid:CB:0F:1F:E9:A2:76:71:C9:E6:E8:23:A6:C1:18:B7:CC:44:CF:B9:84
+ keyid:1D:EF:A1:B8:81:78:12:47:E8:57:06:08:74:18:F7:D3:AA:D8:F7:BD
DirName:/C=US/ST=Oregon/L=Portland/O=sawtooth/CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
serial:00
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: md5WithRSAEncryption
- 27:f7:3d:fb:39:6f:73:a4:86:f3:a0:48:22:60:84:e9:5c:3d:
- 28:36:05:16:44:98:07:87:e1:5d:b5:f3:a7:bc:33:5f:f4:29:
- a9:5f:87:33:df:e6:8e:bd:e2:f3:0a:c8:00:69:ae:3d:41:47:
- 03:ea:0b:4c:67:45:4b:ab:f3:39
+ d9:77:e3:07:d9:2e:ec:2f:9b:8e:9e:ca:b4:00:0b:ef:c7:74:
+ cb:f4:f6:44:2f:02:75:17:a5:74:3e:26:b2:26:fd:1f:ab:3a:
+ df:d5:e3:05:14:08:d0:8c:1d:c9:3e:e1:59:6f:b3:38:5d:af:
+ 78:60:e3:c5:6a:69:96:80:7d:00
-----BEGIN CERTIFICATE-----
MIIC7zCCApmgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBiTELMAkGA1UEBhMCVVMx
DzANBgNVBAgTBk9yZWdvbjERMA8GA1UEBxMIUG9ydGxhbmQxETAPBgNVBAoTCHNh
d3Rvb3RoMSQwIgYDVQQDExt3d3cuc2F3dG9vdGgtY29uc3VsdGluZy5jb20xHTAb
-BgkqhkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMB4XDTA1MDExODIwMTIzMloXDTA3
-MTAxNTIwMTIzMlowgYkxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIEwZPcmVnb24xETAP
+BgkqhkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMB4XDTA1MDMwNzAzMTAxMVoXDTQ2
+MDQwMTAzMTAxMVowgYkxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIEwZPcmVnb24xETAP
BgNVBAcTCFBvcnRsYW5kMREwDwYDVQQKEwhzYXd0b290aDEkMCIGA1UEAxMbd3d3
LnNhd3Rvb3RoLWNvbnN1bHRpbmcuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlh
-c3NsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDPKxQAsDzfb56RQOzI9pCy
-W7RwgKWkCnPHRPMqJsQv8Trxw8Ss/MPSw7/112o4Qq0iq8jES0wdFq8FNH15l17h
-AgMBAAGjgekwgeYwHQYDVR0OBBYEFMsPH+midnHJ5ugjpsEYt8xEz7mEMIG2BgNV
-HSMEga4wgauAFMsPH+midnHJ5ugjpsEYt8xEz7mEoYGPpIGMMIGJMQswCQYDVQQG
+c3NsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDvweOaPG5uyyZvBb7gy1eg
+S2jmG/mV2wGSqm6mtS2xK1D92xPyxdi4T3UoU3Lo5RGdu8NPTwn9TOdG1R27NQKv
+AgMBAAGjgekwgeYwHQYDVR0OBBYEFB3vobiBeBJH6FcGCHQY99Oq2Pe9MIG2BgNV
+HSMEga4wgauAFB3vobiBeBJH6FcGCHQY99Oq2Pe9oYGPpIGMMIGJMQswCQYDVQQG
EwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDERMA8GA1UE
ChMIc2F3dG9vdGgxJDAiBgNVBAMTG3d3dy5zYXd0b290aC1jb25zdWx0aW5nLmNv
bTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb22CAQAwDAYDVR0TBAUwAwEB
-/zANBgkqhkiG9w0BAQQFAANBACf3Pfs5b3OkhvOgSCJghOlcPSg2BRZEmAeH4V21
-86e8M1/0KalfhzPf5o694vMKyABprj1BRwPqC0xnRUur8zk=
+/zANBgkqhkiG9w0BAQQFAANBANl34wfZLuwvm46eyrQAC+/HdMv09kQvAnUXpXQ+
+JrIm/R+rOt/V4wUUCNCMHck+4Vlvszhdr3hg48VqaZaAfQA=
-----END CERTIFICATE-----
diff --git a/extra/yassl/certs/client-cert.der b/extra/yassl/certs/client-cert.der
index b28e2753376..c2a75119e54 100644
--- a/extra/yassl/certs/client-cert.der
+++ b/extra/yassl/certs/client-cert.der
Binary files differ
diff --git a/extra/yassl/certs/client-cert.pem b/extra/yassl/certs/client-cert.pem
index 81110f17252..4d2bbff7ca5 100644
--- a/extra/yassl/certs/client-cert.pem
+++ b/extra/yassl/certs/client-cert.pem
@@ -5,8 +5,8 @@ Certificate:
Signature Algorithm: md5WithRSAEncryption
Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL, CN=www.yassl.com/emailAddress=info@yassl.com
Validity
- Not Before: Jan 18 19:33:15 2005 GMT
- Not After : Oct 15 19:33:15 2007 GMT
+ Not Before: Mar 7 03:00:31 2005 GMT
+ Not After : Apr 1 03:00:31 2046 GMT
Subject: C=US, ST=Oregon, L=Portland, O=yaSSL, CN=www.yassl.com/emailAddress=info@yassl.com
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
@@ -29,15 +29,15 @@ Certificate:
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: md5WithRSAEncryption
- c5:82:26:0c:1f:61:01:14:b0:ce:18:99:64:91:0e:f1:f8:90:
- 3e:a3:0e:be:38:7c:97:ba:05:c9:2a:dc:dd:62:2d:12:61:79:
- 7a:86:b1:97:5d:1e:e8:f7:e8:32:34:f7:8f:b1:08:3d:13:71:
- a6:3c:15:91:85:12:35:6e:78:87
+ 59:19:ae:1b:4e:65:9e:ca:f1:b8:3d:ff:c7:5e:15:86:10:97:
+ 8c:3e:22:32:ab:4e:75:a7:70:83:f2:fb:2f:af:fe:26:28:e9:
+ 4f:d4:c9:49:7c:6f:51:7e:2a:ff:a0:5b:25:45:2e:66:d9:0d:
+ 92:94:e5:b8:60:c6:67:1a:f3:03
-----BEGIN CERTIFICATE-----
MIICtzCCAmGgAwIBAgIBADANBgkqhkiG9w0BAQQFADB4MQswCQYDVQQGEwJVUzEP
MA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDEOMAwGA1UEChMFeWFT
U0wxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkqhkiG9w0BCQEWDmluZm9A
-eWFzc2wuY29tMB4XDTA1MDExODE5MzMxNVoXDTA3MTAxNTE5MzMxNVoweDELMAkG
+eWFzc2wuY29tMB4XDTA1MDMwNzAzMDAzMVoXDTQ2MDQwMTAzMDAzMVoweDELMAkG
A1UEBhMCVVMxDzANBgNVBAgTBk9yZWdvbjERMA8GA1UEBxMIUG9ydGxhbmQxDjAM
BgNVBAoTBXlhU1NMMRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJKoZIhvcN
AQkBFg5pbmZvQHlhc3NsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDNH3hH
@@ -47,6 +47,6 @@ wP/OtbStMIGiBgNVHSMEgZowgZeAFK4lXvpNo1srh97xKvVCwP/OtbStoXykejB4
MQswCQYDVQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFu
ZDEOMAwGA1UEChMFeWFTU0wxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkq
hkiG9w0BCQEWDmluZm9AeWFzc2wuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZI
-hvcNAQEEBQADQQDFgiYMH2EBFLDOGJlkkQ7x+JA+ow6+OHyXugXJKtzdYi0SYXl6
-hrGXXR7o9+gyNPePsQg9E3GmPBWRhRI1bniH
+hvcNAQEEBQADQQBZGa4bTmWeyvG4Pf/HXhWGEJeMPiIyq051p3CD8vsvr/4mKOlP
+1MlJfG9Rfir/oFslRS5m2Q2SlOW4YMZnGvMD
-----END CERTIFICATE-----
diff --git a/extra/yassl/certs/dsa-cert.pem b/extra/yassl/certs/dsa-cert.pem
index ecca18dae82..788d263bb9f 100644
--- a/extra/yassl/certs/dsa-cert.pem
+++ b/extra/yassl/certs/dsa-cert.pem
@@ -5,8 +5,8 @@ Certificate:
Signature Algorithm: dsaWithSHA1
Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL DSA, CN=yaSSL DSA/emailAddress=info@yassl.com
Validity
- Not Before: Jan 23 22:54:51 2005 GMT
- Not After : Oct 20 22:54:51 2007 GMT
+ Not Before: Mar 7 03:22:00 2005 GMT
+ Not After : Apr 1 03:22:00 2046 GMT
Subject: C=US, ST=Oregon, L=Portland, O=yaSSL DSA, CN=yaSSL DSA/emailAddress=info@yassl.com
Subject Public Key Info:
Public Key Algorithm: dsaEncryption
@@ -43,14 +43,14 @@ Certificate:
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: dsaWithSHA1
- 30:2b:02:14:74:46:9f:91:7b:24:17:3b:ee:0f:10:e3:76:62:
- f4:dc:81:e6:fd:fe:02:13:08:f4:87:0a:ab:ba:9c:de:3a:69:
- 72:59:b8:ec:e9:57:f4:bf:37
+ 30:2c:02:14:7e:5e:94:fc:7f:ca:81:ab:b3:32:f7:21:83:48:
+ 48:5f:0a:f1:13:ca:02:14:73:54:32:14:51:22:bf:0b:ec:d7:
+ 6a:6a:fa:a7:1d:46:b4:c2:a3:b5
-----BEGIN CERTIFICATE-----
-MIIDMTCCAvKgAwIBAgIBADAJBgcqhkjOOAQDMHgxCzAJBgNVBAYTAlVTMQ8wDQYD
+MIIDMjCCAvKgAwIBAgIBADAJBgcqhkjOOAQDMHgxCzAJBgNVBAYTAlVTMQ8wDQYD
VQQIEwZPcmVnb24xETAPBgNVBAcTCFBvcnRsYW5kMRIwEAYDVQQKEwl5YVNTTCBE
U0ExEjAQBgNVBAMTCXlhU1NMIERTQTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5YXNz
-bC5jb20wHhcNMDUwMTIzMjI1NDUxWhcNMDcxMDIwMjI1NDUxWjB4MQswCQYDVQQG
+bC5jb20wHhcNMDUwMzA3MDMyMjAwWhcNNDYwNDAxMDMyMjAwWjB4MQswCQYDVQQG
EwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDESMBAGA1UE
ChMJeWFTU0wgRFNBMRIwEAYDVQQDEwl5YVNTTCBEU0ExHTAbBgkqhkiG9w0BCQEW
DmluZm9AeWFzc2wuY29tMIHwMIGoBgcqhkjOOAQBMIGcAkEAmSlpgMk8mGhFqYL+
@@ -63,6 +63,6 @@ IeRhRHPp4jCBogYDVR0jBIGaMIGXgBS++Yxd1hy07oHdNlYKIeRhRHPp4qF8pHow
eDELMAkGA1UEBhMCVVMxDzANBgNVBAgTBk9yZWdvbjERMA8GA1UEBxMIUG9ydGxh
bmQxEjAQBgNVBAoTCXlhU1NMIERTQTESMBAGA1UEAxMJeWFTU0wgRFNBMR0wGwYJ
KoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbYIBADAMBgNVHRMEBTADAQH/MAkGByqG
-SM44BAMDLgAwKwIUdEafkXskFzvuDxDjdmL03IHm/f4CEwj0hwqrupzeOmlyWbjs
-6Vf0vzc=
+SM44BAMDLwAwLAIUfl6U/H/KgauzMvchg0hIXwrxE8oCFHNUMhRRIr8L7Ndqavqn
+HUa0wqO1
-----END CERTIFICATE-----
diff --git a/extra/yassl/certs/server-cert.pem b/extra/yassl/certs/server-cert.pem
index 403dabdf5fa..30608f5f65b 100644
--- a/extra/yassl/certs/server-cert.pem
+++ b/extra/yassl/certs/server-cert.pem
@@ -5,8 +5,8 @@ Certificate:
Signature Algorithm: md5WithRSAEncryption
Issuer: C=US, ST=Oregon, L=Portland, O=sawtooth, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
Validity
- Not Before: Jan 18 20:50:59 2005 GMT
- Not After : Oct 15 20:50:59 2007 GMT
+ Not Before: Mar 8 03:00:47 2005 GMT
+ Not After : Apr 2 03:00:47 2046 GMT
Subject: C=US, ST=Oregon, L=Portland, O=taoSoftDev, CN=www.taosoftdev.com/emailAddress=info@yassl.com
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
@@ -19,20 +19,20 @@ Certificate:
f2:25:93:22:e7
Exponent: 65537 (0x10001)
Signature Algorithm: md5WithRSAEncryption
- 08:36:07:8c:3a:7f:f9:91:0a:82:d1:6a:c1:34:be:bc:2d:b2:
- 20:98:dc:45:50:53:9c:66:e6:26:71:bd:fa:d2:b4:91:d3:53:
- c0:20:05:c0:b6:84:9a:5f:3f:61:75:f5:fd:c6:ec:e2:f6:9f:
- a2:13:17:a9:b7:83:60:cc:cb:eb
+ 36:72:12:3b:ac:e4:58:83:09:86:4f:71:2a:3a:0d:8a:05:27:
+ 75:f3:3e:62:4f:ab:b8:70:20:cd:ad:70:ab:91:11:68:f8:82:
+ 33:e2:78:85:a8:16:f5:66:bd:68:2c:5a:26:15:12:1e:6e:83:
+ c7:6d:62:b9:c3:ff:e1:86:e4:e6
-----BEGIN CERTIFICATE-----
MIIB9zCCAaECAQEwDQYJKoZIhvcNAQEEBQAwgYkxCzAJBgNVBAYTAlVTMQ8wDQYD
VQQIEwZPcmVnb24xETAPBgNVBAcTCFBvcnRsYW5kMREwDwYDVQQKEwhzYXd0b290
aDEkMCIGA1UEAxMbd3d3LnNhd3Rvb3RoLWNvbnN1bHRpbmcuY29tMR0wGwYJKoZI
-hvcNAQkBFg5pbmZvQHlhc3NsLmNvbTAeFw0wNTAxMTgyMDUwNTlaFw0wNzEwMTUy
-MDUwNTlaMIGCMQswCQYDVQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQH
+hvcNAQkBFg5pbmZvQHlhc3NsLmNvbTAeFw0wNTAzMDgwMzAwNDdaFw00NjA0MDIw
+MzAwNDdaMIGCMQswCQYDVQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQH
EwhQb3J0bGFuZDETMBEGA1UEChMKdGFvU29mdERldjEbMBkGA1UEAxMSd3d3LnRh
b3NvZnRkZXYuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTBcMA0G
CSqGSIb3DQEBAQUAA0sAMEgCQQCkaLu8tydfPPV4xhqvuZX8fmEfqIEKykOImgPg
0KZ5cBY0uXx1VMpwGWY4vm4ofqX/azyDLzlCwxXzvfIlkyLnAgMBAAEwDQYJKoZI
-hvcNAQEEBQADQQAINgeMOn/5kQqC0WrBNL68LbIgmNxFUFOcZuYmcb360rSR01PA
-IAXAtoSaXz9hdfX9xuzi9p+iExept4NgzMvr
+hvcNAQEEBQADQQA2chI7rORYgwmGT3EqOg2KBSd18z5iT6u4cCDNrXCrkRFo+IIz
+4niFqBb1Zr1oLFomFRIeboPHbWK5w//hhuTm
-----END CERTIFICATE-----
diff --git a/extra/yassl/include/lock.hpp b/extra/yassl/include/lock.hpp
index 0525943e45d..99829b0b6de 100644
--- a/extra/yassl/include/lock.hpp
+++ b/extra/yassl/include/lock.hpp
@@ -23,13 +23,21 @@
#ifndef yaSSL_LOCK_HPP
#define yaSSL_LOCK_HPP
+/*
+ Visual Studio Source Annotations header (sourceannotations.h) fails
+ to compile if outside of the global namespace.
+*/
+#ifdef YASSL_THREAD_SAFE
+#ifdef _WIN32
+#include <windows.h>
+#endif
+#endif
namespace yaSSL {
-#ifdef MULTI_THREADED
+#ifdef YASSL_THREAD_SAFE
#ifdef _WIN32
- #include <windows.h>
class Mutex {
CRITICAL_SECTION cs_;
@@ -69,7 +77,7 @@ namespace yaSSL {
};
#endif // _WIN32
-#else // MULTI_THREADED (WE'RE SINGLE)
+#else // YASSL_THREAD_SAFE (WE'RE SINGLE)
class Mutex {
public:
@@ -79,7 +87,7 @@ namespace yaSSL {
};
};
-#endif // MULTI_THREADED
+#endif // YASSL_THREAD_SAFE
diff --git a/extra/yassl/src/Makefile.am b/extra/yassl/src/Makefile.am
index bc57e7d05ba..d192eb03b49 100644
--- a/extra/yassl/src/Makefile.am
+++ b/extra/yassl/src/Makefile.am
@@ -5,7 +5,7 @@ libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \
handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \
template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp
EXTRA_DIST = $(wildcard ../include/*.hpp) $(wildcard ../include/openssl/*.h)
-AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX
+AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX @yassl_thread_cxxflags@
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/extra/yassl/src/lock.cpp b/extra/yassl/src/lock.cpp
index 6d8e9c17477..6e85fefa14d 100644
--- a/extra/yassl/src/lock.cpp
+++ b/extra/yassl/src/lock.cpp
@@ -26,7 +26,7 @@
namespace yaSSL {
-#ifdef MULTI_THREADED
+#ifdef YASSL_THREAD_SAFE
#ifdef _WIN32
Mutex::Mutex()
@@ -79,7 +79,7 @@ namespace yaSSL {
#endif // _WIN32
-#endif // MULTI_THREADED
+#endif // YASSL_THREAD_SAFE
diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt
index e91fa021de5..c8faeac3b77 100755
--- a/extra/yassl/taocrypt/CMakeLists.txt
+++ b/extra/yassl/taocrypt/CMakeLists.txt
@@ -16,6 +16,8 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include)
+ADD_DEFINITIONS("-DYASSL_THREAD_SAFE")
+
SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp
src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp
src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp
diff --git a/extra/yassl/taocrypt/benchmark/Makefile.am b/extra/yassl/taocrypt/benchmark/Makefile.am
index 2fe1c90c90d..1f082f22f40 100644
--- a/extra/yassl/taocrypt/benchmark/Makefile.am
+++ b/extra/yassl/taocrypt/benchmark/Makefile.am
@@ -2,7 +2,7 @@ INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL
noinst_PROGRAMS = benchmark
benchmark_SOURCES = benchmark.cpp
benchmark_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
-benchmark_CXXFLAGS = -DYASSL_PURE_C
+benchmark_CXXFLAGS = -DYASSL_PURE_C @yassl_thread_cxxflags@
EXTRA_DIST = benchmark.dsp rsa1024.der dh1024.der dsa1024.der make.bat
# Don't update the files from bitkeeper
diff --git a/extra/yassl/taocrypt/src/Makefile.am b/extra/yassl/taocrypt/src/Makefile.am
index 61032d4c381..6ca969ad686 100644
--- a/extra/yassl/taocrypt/src/Makefile.am
+++ b/extra/yassl/taocrypt/src/Makefile.am
@@ -8,7 +8,8 @@ libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp \
random.cpp ripemd.cpp rsa.cpp sha.cpp template_instnt.cpp \
tftables.cpp twofish.cpp
-libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C
+libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C \
+ @yassl_thread_cxxflags@
EXTRA_DIST = $(wildcard ../include/*.hpp)
diff --git a/extra/yassl/taocrypt/test/Makefile.am b/extra/yassl/taocrypt/test/Makefile.am
index 73e7f729bdb..aa325ff9b75 100644
--- a/extra/yassl/taocrypt/test/Makefile.am
+++ b/extra/yassl/taocrypt/test/Makefile.am
@@ -2,7 +2,7 @@ INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL
noinst_PROGRAMS = test
test_SOURCES = test.cpp
test_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
-test_CXXFLAGS = -DYASSL_PURE_C
+test_CXXFLAGS = -DYASSL_PURE_C @yassl_thread_cxxflags@
EXTRA_DIST = make.bat
# Don't update the files from bitkeeper
diff --git a/extra/yassl/taocrypt/test/memory.cpp b/extra/yassl/taocrypt/test/memory.cpp
index 726c9c0ef54..a879a497800 100644
--- a/extra/yassl/taocrypt/test/memory.cpp
+++ b/extra/yassl/taocrypt/test/memory.cpp
@@ -13,7 +13,7 @@
To use MemoryTracker merely add this file to your project
No need to instantiate anything
-If your app is multi threaded define MULTI_THREADED
+If your app is multi threaded define YASSL_THREAD_SAFE
*********************************************************************/
diff --git a/extra/yassl/testsuite/Makefile.am b/extra/yassl/testsuite/Makefile.am
index cae34e7bbc0..e626b1822ec 100644
--- a/extra/yassl/testsuite/Makefile.am
+++ b/extra/yassl/testsuite/Makefile.am
@@ -4,7 +4,7 @@ testsuite_SOURCES = testsuite.cpp ../taocrypt/test/test.cpp \
../examples/client/client.cpp ../examples/server/server.cpp \
../examples/echoclient/echoclient.cpp \
../examples/echoserver/echoserver.cpp
-testsuite_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX -DNO_MAIN_DRIVER
+testsuite_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX -DNO_MAIN_DRIVER @yassl_thread_cxxflags@
testsuite_LDADD = $(top_builddir)/extra/yassl/src/libyassl.la \
$(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
EXTRA_DIST = testsuite.dsp test.hpp input quit make.bat
diff --git a/include/m_string.h b/include/m_string.h
index dc7b7c414c5..31719781a48 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -124,9 +124,6 @@ extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len);
extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
#undef bcmp
#define bcmp(A,B,C) my_bcmp((A),(B),(C))
-#define bzero_if_valgrind(A,B) bzero(A,B)
-#else
-#define bzero_if_valgrind(A,B)
#endif /* HAVE_valgrind */
#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
diff --git a/include/my_alarm.h b/include/my_alarm.h
index 750135d64ed..c41c1d65e27 100644
--- a/include/my_alarm.h
+++ b/include/my_alarm.h
@@ -36,14 +36,14 @@ extern ulong my_time_to_wait_for_lock;
#define ALARM_END VOID(signal(SIGALRM,alarm_signal)); \
VOID(alarm(alarm_old));
#define ALARM_TEST my_have_got_alarm
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
#define ALARM_REINIT VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \
VOID(signal(SIGALRM,my_set_alarm_variable));\
my_have_got_alarm=0;
#else
#define ALARM_REINIT VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \
my_have_got_alarm=0;
-#endif /* DONT_REMEMBER_SIGNAL */
+#endif /* SIGNAL_HANDLER_RESET_ON_DELIVERY */
#else
#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1
#define ALARM_INIT
diff --git a/include/my_base.h b/include/my_base.h
index 2aa49bd1787..8065441d4d7 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -272,17 +272,6 @@ enum ha_base_keytype {
#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */
#define HA_USES_BLOCK_SIZE ((uint) 32768)
#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */
-#if MYSQL_VERSION_ID < 0x50200
-/*
- Key has a part that can have end space. If this is an unique key
- we have to handle it differently from other unique keys as we can find
- many matching rows for one key (because end space are not compared)
-*/
-#define HA_END_SPACE_KEY 0 /* was: 4096 */
-#else
-#error HA_END_SPACE_KEY is obsolete, please remove it
-#endif
-
/* These flags can be added to key-seg-flag */
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index 78642df3362..2c50ca3ec75 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -53,6 +53,8 @@ extern my_bool bitmap_is_overlapping(const MY_BITMAP *map1,
extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit);
extern my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit);
extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit);
+extern my_bool bitmap_union_is_set_all(const MY_BITMAP *map1,
+ const MY_BITMAP *map2);
extern uint bitmap_set_next(MY_BITMAP *map);
extern uint bitmap_get_first(const MY_BITMAP *map);
extern uint bitmap_get_first_set(const MY_BITMAP *map);
diff --git a/include/my_getopt.h b/include/my_getopt.h
index 7cbad607aac..d7c996302fd 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -45,10 +45,10 @@ struct my_option
const char *name; /* Name of the option */
int id; /* unique id or short option */
const char *comment; /* option comment, for autom. --help */
- uchar **value; /* The variable value */
- uchar **u_max_value; /* The user def. max variable value */
+ void *value; /* The variable value */
+ void *u_max_value; /* The user def. max variable value */
struct st_typelib *typelib; /* Pointer to possible values */
- ulong var_type;
+ ulong var_type; /* Must match the variable type */
enum get_opt_arg_type arg_type;
longlong def_value; /* Default value */
longlong min_value; /* Min allowed value */
@@ -58,8 +58,16 @@ struct my_option
void *app_type; /* To be used by an application */
};
-typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
-typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
+typedef my_bool (*my_get_one_option)(int, const struct my_option *, char *);
+typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...);
+/**
+ Used to retrieve a reference to the object (variable) that holds the value
+ for the given option. For example, if var_type is GET_UINT, the function
+ must return a pointer to a variable of type uint. A argument is stored in
+ the location pointed to by the returned pointer.
+*/
+typedef void *(*my_getopt_value)(const char *, uint, const struct my_option *,
+ int *);
extern char *disabled_my_option;
extern my_bool my_getopt_print_errors;
@@ -71,8 +79,7 @@ extern int handle_options (int *argc, char ***argv,
extern void my_cleanup_options(const struct my_option *options);
extern void my_print_help(const struct my_option *options);
extern void my_print_variables(const struct my_option *options);
-extern void my_getopt_register_get_addr(uchar ** (*func_addr)(const char *, uint,
- const struct my_option *, int *));
+extern void my_getopt_register_get_addr(my_getopt_value);
ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
my_bool *fix);
diff --git a/include/my_global.h b/include/my_global.h
index 8910990a148..6add808ed55 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -55,6 +55,10 @@
#define USE_PRAGMA_INTERFACE
#endif
+#if defined(__OpenBSD__) && (OpenBSD >= 200411)
+#define HAVE_ERRNO_AS_DEFINE
+#endif
+
#if defined(i386) && !defined(__i386__)
#define __i386__
#endif
@@ -548,8 +552,8 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#endif
/* Does the system remember a signal handler after a signal ? */
-#ifndef HAVE_BSD_SIGNALS
-#define DONT_REMEMBER_SIGNAL
+#if !defined(HAVE_BSD_SIGNALS) && !defined(HAVE_SIGACTION)
+#define SIGNAL_HANDLER_RESET_ON_DELIVERY
#endif
/* Define void to stop lint from generating "null effekt" comments */
diff --git a/include/my_sys.h b/include/my_sys.h
index 3c492e661d3..81917c48acd 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -37,7 +37,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; }
#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;}
-#define MY_INIT(name); { my_progname= name; my_init(); }
+#define MY_INIT(name) { my_progname= name; my_init(); }
#define MY_FILE_ERROR ((size_t) -1)
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
index 301f9f85464..da434454565 100644
--- a/include/my_valgrind.h
+++ b/include/my_valgrind.h
@@ -24,15 +24,19 @@
#if defined(HAVE_valgrind)&& defined(HAVE_VALGRIND_MEMCHECK_H)
#include <valgrind/memcheck.h>
-#else
-#define VALGRIND_MAKE_MEM_DEFINED(addr, size) do { } while(0)
-#define VALGRIND_MAKE_MEM_NOACCESS(addr, size) do { } while(0)
+#define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
+#define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
+#define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len)
+#define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
+#else /* HAVE_VALGRIND */
+# define MEM_UNDEFINED(a,len) ((void) 0)
+# define MEM_NOACCESS(a,len) ((void) 0)
+# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
+# define MEM_CHECK_DEFINED(a,len) ((void) 0)
+#endif /* HAVE_VALGRIND */
+
#ifdef SAFEMALLOC
-#define VALGRIND_MAKE_MEM_UNDEFINED(addr, size) bfill(addr, size, 0x8F)
+#define TRASH(A,B) do { bfill(A, B, 0x8F); MEM_UNDEFINED(A, B); } while (0)
#else
-#define VALGRIND_MAKE_MEM_UNDEFINED(addr, size) do { } while(0)
-#endif /* SAFEMALLOC */
-#endif /* HAVE_valgrind */
-
-/* Compatibility with old source */
-#define TRASH(A,B) VALGRIND_MAKE_MEM_UNDEFINED(A, B)
+#define TRASH(A,B) do{MEM_CHECK_ADDRESSABLE(A,B);MEM_UNDEFINED(A,B);} while (0)
+#endif
diff --git a/include/myisam.h b/include/myisam.h
index 3d2a326363d..8413b7936e3 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -48,8 +48,6 @@ extern "C" {
#define MI_NAME_IEXT ".MYI"
#define MI_NAME_DEXT ".MYD"
-/* Max extra space to use when sorting keys */
-#define MI_MAX_TEMP_LENGTH 2*1024L*1024L*1024L
/* Possible values for myisam_block_size (must be power of 2) */
#define MI_KEY_BLOCK_LENGTH 1024 /* default key block length */
diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h
index c76b5dcd252..c038ece1644 100644
--- a/include/sslopt-longopts.h
+++ b/include/sslopt-longopts.h
@@ -16,30 +16,31 @@
#ifdef HAVE_OPENSSL
{"ssl", OPT_SSL_SSL,
- "Enable SSL for connection (automatically enabled with other flags). Disable with --skip-ssl.",
- (uchar **) &opt_use_ssl, (uchar **) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0,
- 0, 0, 0},
+ "Enable SSL for connection (automatically enabled with other flags)."
+ "Disable with --skip-ssl.", &opt_use_ssl, &opt_use_ssl, 0, GET_BOOL,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
{"ssl-ca", OPT_SSL_CA,
"CA file in PEM format (check OpenSSL docs, implies --ssl).",
- (uchar **) &opt_ssl_ca, (uchar **) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
+ &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-capath", OPT_SSL_CAPATH,
"CA directory (check OpenSSL docs, implies --ssl).",
- (uchar **) &opt_ssl_capath, (uchar **) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
+ &opt_ssl_capath, &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).",
- (uchar **) &opt_ssl_cert, (uchar **) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
+ &opt_ssl_cert, &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl).",
- (uchar **) &opt_ssl_cipher, (uchar **) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
+ &opt_ssl_cipher, &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).",
- (uchar **) &opt_ssl_key, (uchar **) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
+ &opt_ssl_key, &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifdef MYSQL_CLIENT
{"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT,
- "Verify server's \"Common Name\" in its cert against hostname used when connecting. This option is disabled by default.",
- (uchar **) &opt_ssl_verify_server_cert, (uchar **) &opt_ssl_verify_server_cert,
+ "Verify server's \"Common Name\" in its cert against hostname used "
+ "when connecting. This option is disabled by default.",
+ &opt_ssl_verify_server_cert, &opt_ssl_verify_server_cert,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
#endif /* HAVE_OPENSSL */
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index ff392ff1f07..8ce7f0ee69b 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -332,7 +332,7 @@ sig_handler
my_pipe_sig_handler(int sig __attribute__((unused)))
{
DBUG_PRINT("info",("Hit by signal %d",sig));
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
(void) signal(SIGPIPE, my_pipe_sig_handler);
#endif
}
@@ -2447,7 +2447,12 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
stmt->insert_id= mysql->insert_id;
if (res)
{
- set_stmt_errmsg(stmt, net);
+ /*
+ Don't set stmt error if stmt->mysql is NULL, as the error in this case
+ has already been set by mysql_prune_stmt_list().
+ */
+ if (stmt->mysql)
+ set_stmt_errmsg(stmt, net);
DBUG_RETURN(1);
}
DBUG_RETURN(0);
@@ -2658,7 +2663,12 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row)
buff, sizeof(buff), (uchar*) 0, 0,
1, stmt))
{
- set_stmt_errmsg(stmt, net);
+ /*
+ Don't set stmt error if stmt->mysql is NULL, as the error in this case
+ has already been set by mysql_prune_stmt_list().
+ */
+ if (stmt->mysql)
+ set_stmt_errmsg(stmt, net);
return 1;
}
if ((*mysql->methods->read_rows_from_cursor)(stmt))
@@ -3339,7 +3349,12 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
buff, sizeof(buff), (uchar*) data,
length, 1, stmt))
{
- set_stmt_errmsg(stmt, &mysql->net);
+ /*
+ Don't set stmt error if stmt->mysql is NULL, as the error in this case
+ has already been set by mysql_prune_stmt_list().
+ */
+ if (stmt->mysql)
+ set_stmt_errmsg(stmt, &mysql->net);
DBUG_RETURN(1);
}
}
@@ -4774,7 +4789,12 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff),
(uchar*) 0, 0, 1, stmt))
{
- set_stmt_errmsg(stmt, net);
+ /*
+ Don't set stmt error if stmt->mysql is NULL, as the error in this case
+ has already been set by mysql_prune_stmt_list().
+ */
+ if (stmt->mysql)
+ set_stmt_errmsg(stmt, net);
DBUG_RETURN(1);
}
}
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 20a030cae1e..991c8116f1b 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -105,6 +105,8 @@ TEST_DIRS = t r include std_data std_data/parts collections \
suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include \
suite/vcol suite/vcol/t suite/vcol/r suite/vcol/inc \
suite/oqgraph suite/oqgraph/t suite/oqgraph/r suite/oqgraph/include \
+ suite/innodb_plugin suite/innodb_plugin/t suite/innodb_plugin/r suite/innodb_plugin/include \
+ suite/percona \
suite/engines suite/engines/funcs suite/engines/iuds suite/engines/rr_trx \
suite/engines/funcs/r suite/engines/funcs/t suite/engines/iuds/r \
suite/engines/iuds/t suite/engines/rr_trx/include suite/engines/rr_trx/r \
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index d791686cd62..f84337660ea 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -13,12 +13,15 @@ funcs_1.ndb* # joro : NDB tests marked as experiment
funcs_2.ndb_charset # joro : NDB tests marked as experimental as agreed with bochklin
main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
+main.func_str @solaris # joro: Bug#40928
main.plugin_load @solaris # Bug#42144
+main.sp @solaris # joro : Bug#54138
main.outfile_loaddata @solaris # joro : Bug #46895
ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
rpl.rpl_innodb_bug28430* @solaris # Bug#46029
+rpl.rpl_row_sp011 @solaris # Joro : Bug #54138
rpl_ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
rpl_ndb.rpl_ndb_log # Bug#38998
@@ -39,3 +42,5 @@ parts.partition_mgm_lc1_ndb # joro : NDB tests marked as experiment
parts.partition_mgm_lc2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
parts.partition_syntax_ndb # joro : NDB tests marked as experimental as agreed with bochklin
parts.partition_value_ndb # joro : NDB tests marked as experimental as agreed with bochklin
+main.mysqlhotcopy_myisam # horst: due to bug#54129
+main.mysqlhotcopy_archive # horst: due to bug#54129
diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test
index b819996acb0..7f48341077e 100644
--- a/mysql-test/extra/binlog_tests/binlog.test
+++ b/mysql-test/extra/binlog_tests/binlog.test
@@ -41,13 +41,10 @@ while ($1)
--enable_query_log
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;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events in 'master-bin.000002' from 106;
-
+--source include/show_binlog_events.inc
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--source include/show_binlog_events.inc
+--let $binlog_file=
#
# Bug#22540 - Incorrect value in column End_log_pos of
@@ -77,8 +74,7 @@ insert into t1 values (2);
insert into t1 values (3);
commit;
drop table t1;
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
-show binlog events from 0;
+--source include/show_binlog_events.inc
# now show that nothing breaks if we need to read from the cache more
# than once, resulting in split event-headers
@@ -100,8 +96,7 @@ while ($1)
commit;
enable_query_log;
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
-show binlog events from 0;
+--source include/show_binlog_events.inc
drop table t1;
@@ -122,8 +117,7 @@ set @b= 14632475938453979136;
execute stmt using @a, @b;
deallocate prepare stmt;
drop table t1;
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
-show binlog events from 0;
+--source include/show_binlog_events.inc
#
@@ -249,14 +243,15 @@ reset master;
drop table if exists t3;
--enable_warnings
create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb;
-show master status;
+source include/show_master_status.inc;
let $it=4;
while ($it)
{
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
dec $it;
}
-show master status /* must show new binlog index after rotating */;
+# must show new binlog index after rotating;
+source include/show_master_status.inc;
drop table t3;
--echo #
diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test
index 14c15a58e18..da63a7a8619 100644
--- a/mysql-test/extra/binlog_tests/blackhole.test
+++ b/mysql-test/extra/binlog_tests/blackhole.test
@@ -125,12 +125,7 @@ select * from t1;
select * from t2;
select * from t3;
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 4 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---replace_regex /file_id=[0-9]+/file_id=#/
-show binlog events;
+--source include/show_binlog_events.inc
drop table t1,t2,t3;
@@ -168,18 +163,21 @@ set autocommit=0;
start transaction;
insert into t1 values(1);
commit;
+
+let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
+
start transaction;
insert into t1 values(2);
rollback;
-set autocommit=1;
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 4 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---replace_regex /file_id=[0-9]+/file_id=#/
-show binlog events;
+let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
+if (`SELECT $master_log_pos_2 <> $master_log_pos_1`)
+{
+ echo $master_log_pos_1 $master_log_pos_2;
+ die Rollbacked transaction has been binlogged;
+}
+set autocommit=1;
drop table if exists t1;
#
diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test
index 26a70c4319e..68aa949a7c7 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test
@@ -214,7 +214,7 @@ CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
# execute
--error ER_DUP_ENTRY
- UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
+ UPDATE t3,t4 SET t3.a = t4.a + bug27417(1) where t3.a = 1;
# check
select count(*) from t1 /* must be 1 */;
diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test
index 1b331cc948b..607348ae97b 100644
--- a/mysql-test/extra/rpl_tests/rpl_deadlock.test
+++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test
@@ -61,7 +61,7 @@ sync_with_master;
SELECT * FROM t1;
SELECT * FROM t3;
# Check that no error is reported
---source include/show_slave_status2.inc
+source include/check_slave_is_running.inc;
--echo
# 2) Test lock wait timeout
@@ -89,7 +89,7 @@ sync_with_master;
SELECT * FROM t1;
SELECT * FROM t3;
# Check that no error is reported
---source include/show_slave_status2.inc
+source include/check_slave_is_running.inc;
--echo
# 3) Test lock wait timeout and purged relay log
@@ -103,6 +103,7 @@ SET global max_relay_log_size=0;
--source include/stop_slave.inc
DELETE FROM t2;
# Set slave position to the BEGIN log event
+--replace_result $master_pos_begin MASTER_POS_BEGIN
eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin;
BEGIN;
# Hold lock
@@ -119,7 +120,7 @@ sync_with_master;
SELECT * FROM t1;
SELECT * FROM t3;
# Check that no error is reported
---source include/show_slave_status2.inc
+source include/check_slave_is_running.inc;
--echo
# Clean up
diff --git a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
index c426ac1fae8..16c4bc8e2da 100644
--- a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
+++ b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
@@ -146,12 +146,7 @@ SELECT COUNT(*) FROM t1;
--echo
SELECT * FROM t1 ORDER BY f3 LIMIT 20;
---echo
---echo * Show Slave Status *
---echo
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical show slave status;
---echo
+--source include/check_slave_is_running.inc
### Altering table def scenario
--echo
@@ -431,16 +426,14 @@ connection master;
delete from t4;
delete from t31;
---echo
---echo ** Check slave status **
---echo
#connection slave;
sync_slave_with_master;
select * from t31;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical show slave status;
+--echo
+--echo ** Check slave status **
+--echo
+--source include/check_slave_is_running.inc
#### Clean Up ####
@@ -493,16 +486,15 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
--echo
--echo ********************************************
---echo *** Expect slave to fail with Error 1523 ***
+--echo *** Expect slave to fail with Error 1535 ***
--echo ********************************************
--echo
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
+--let $slave_sql_errno= 1535
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
--echo
--echo *** Drop t10 ***
@@ -550,16 +542,15 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
--echo
--echo ********************************************
---echo *** Expect slave to fail with Error 1523 ***
+--echo *** Expect slave to fail with Error 1535 ***
--echo ********************************************
--echo
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
+--let $slave_sql_errno= 1535
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
--echo
--echo *** Drop t11 ***
@@ -697,10 +688,10 @@ SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDER BY c1;
# Remove below once fixed
#***************************
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+# 1091 = ER_CANT_DROP_FIELD_OR_KEY
+--let $slave_sql_errno= 1091
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
#***************************
STOP SLAVE;
@@ -763,10 +754,10 @@ SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 ORDER BY c1;
--echo ********************************************
--echo
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+# 1054 = ER_BAD_FIELD_ERROR
+--let $slave_sql_errno= 1054
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
STOP SLAVE;
RESET SLAVE;
@@ -840,10 +831,10 @@ SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1;
--echo *****************
--echo
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+# 1072 = ER_KEY_COLUMN_DOES_NOT_EXITS
+--let $slave_sql_errno= 1072
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
STOP SLAVE;
RESET 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..3b8e7663ec7 100644
--- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
+++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
@@ -96,10 +96,9 @@ SELECT * FROM t2 ORDER BY a;
--echo *** Start Slave ***
connection slave;
START SLAVE;
-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
+--let $slave_sql_errno= 1535
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
@@ -146,15 +145,13 @@ set @b1 = concat(@b1,@b1);
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
--echo ********************************************
---echo *** Expect slave to fail with Error 1522 ***
+--echo *** Expect slave to fail with Error 1535 ***
--echo ********************************************
connection slave;
---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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1535
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
--echo *** Drop t3 ***
connection master;
@@ -191,15 +188,13 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
(30000.22,4,'QA TESTING');
--echo ********************************************
---echo *** Expect slave to fail with Error 1522 ***
+--echo *** Expect slave to fail with Error 1535 ***
--echo ********************************************
connection slave;
---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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1535
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
--echo *** Drop t4 ***
connection master;
@@ -236,15 +231,13 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
(2,'JOE',300.01,0,'b2b2',1.0000009);
--echo ********************************************
---echo *** Expect slave to fail with Error 1522 ***
+--echo *** Expect slave to fail with Error 1535 ***
--echo ********************************************
connection slave;
---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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1535
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
--echo *** Drop t5 ***
connection master;
@@ -282,13 +275,12 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
(2,'JOE',300.01,0);
--echo ********************************************
---echo *** Expect slave to fail with Error 1522 ***
+--echo *** Expect slave to fail with Error 1535 ***
--echo ********************************************
connection slave;
---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
+--let $slave_sql_errno= 1535
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
#START SLAVE;
@@ -387,12 +379,10 @@ INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
### Uncomment once bug is fixed
#connection slave;
-#wait_for_slave_to_stop;
-#--replace_result $MASTER_MYPORT MASTER_PORT
-#--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
-#--query_vertical SHOW SLAVE STATUS
-#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-#START SLAVE;
+#--let $slave_sql_errno= SOMETHING
+#--let $slave_skip_counter= 2
+#--let $show_slave_sql_error= 1
+#--source include/wait_for_slave_sql_error_and_skip.inc
--echo *** Drop t8 ***
connection master;
@@ -451,12 +441,10 @@ if (`SELECT $engine_type != 'NDB'`)
# todo: fix Bug #43992 slave sql thread can't tune own sql_mode ...
# and add/restore waiting for stop test
- #--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
- #SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
- #START SLAVE;
+ #--let $slave_sql_errno= SOMETHING
+ #--let $slave_skip_counter= 2
+ #--let $show_slave_sql_error= 1
+ #--source include/wait_for_slave_sql_error_and_skip.inc
}
#--echo *** Drop t9 ***
@@ -491,15 +479,13 @@ set @b1 = concat(@b1,@b1);
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
--echo ********************************************
---echo *** Expect slave to fail with Error 1522 ***
+--echo *** Expect slave to fail with Error 1535 ***
--echo ********************************************
connection slave;
---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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1535
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
--echo *** Drop t10 ***
connection master;
@@ -535,15 +521,13 @@ set @b1 = concat(@b1,@b1);
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
--echo ********************************************
---echo *** Expect slave to fail with Error 1522 ***
+--echo *** Expect slave to fail with Error 1535 ***
--echo ********************************************
connection slave;
---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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1535
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
--echo *** Drop t11 ***
connection master;
@@ -810,12 +794,10 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
--echo *** Expect slave to fail with Error 1060 ***
--echo ********************************************
connection slave;
---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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+--let $slave_sql_errno= 1060
+--let $slave_skip_counter= 1
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
--echo *** Try to insert in master ****
connection master;
@@ -918,15 +900,13 @@ connection master;
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
--echo ********************************************
---echo *** Expect slave to fail with Error 1522 ***
+--echo *** Expect slave to fail with Error 1535 ***
--echo ********************************************
connection slave;
---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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1535
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
--echo ** DROP table t17 ***
connection master;
diff --git a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
index 5ed2f1ac2b8..fd51601176e 100644
--- a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
+++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
@@ -20,19 +20,15 @@ rename table t1 to t5, t2 to t1;
# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
flush no_write_to_binlog tables;
# Check that it's not in the binlog.
---replace_result $SERVER_VERSION SERVER_VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
+let $binlog_start= $rename_event_pos;
+source include/show_binlog_events.inc;
# Check that the master is not confused.
select * from t3;
# This FLUSH should go into the binlog to not confuse the slave.
flush tables;
# Check that it's in the binlog.
---replace_result $SERVER_VERSION SERVER_VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
+let $wait_binlog_event= flush tables;
+source include/wait_for_binlog_event.inc;
sync_slave_with_master;
# Check that the slave is not confused.
diff --git a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
index c392686454d..66bd61a8ea9 100644
--- a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
+++ b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
@@ -68,19 +68,15 @@ eval SET DEBUG_SYNC=$debug_sync_action;
# Show slave last IO errno
connection slave;
-source include/wait_for_slave_io_error.inc;
-let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1);
--echo Check network error happened here
-if (`SELECT '$last_io_errno' = '2013' || # CR_SERVER_LOST
- '$last_io_errno' = '2003' || # CR_CONN_HOST_ERROR
- '$last_io_errno' = '2002' || # CR_CONNECTION_ERROR
- '$last_io_errno' = '2006' || # CR_SERVER_GONE_ERROR
- '$last_io_errno' = '1040' || # ER_CON_COUNT_ERROR
- '$last_io_errno' = '1053' # ER_SERVER_SHUTDOWN
- `)
-{
- --echo NETWORK ERROR
-}
+# '2013' CR_SERVER_LOST
+# '2003' CR_CONN_HOST_ERROR
+# '2002' CR_CONNECTION_ERROR
+# '2006' CR_SERVER_GONE_ERROR
+# '1040' ER_CON_COUNT_ERROR
+# '1053' ER_SERVER_SHUTDOWN
+let $slave_io_errno= 1040, 1053, 2002, 2003, 2006, 2013;
+source include/wait_for_slave_io_error.inc;
# deactivate the sync point of get_master_version_and_clock()
# now to avoid restarting IO-thread to re-enter it.
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
index 16e6bb3c960..4d611c15acf 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
@@ -90,7 +90,7 @@ connection master;
# Bug #29571: INSERT DELAYED IGNORE written to binary log on the master but
# on the slave
#
-if (`SELECT @@global.binlog_format != 'ROW'`)
+if ($binlog_format_statement)
{
#flush the logs before the test
connection slave;
@@ -103,22 +103,23 @@ CREATE TABLE t1(a int, UNIQUE(a));
INSERT DELAYED IGNORE INTO t1 VALUES(1);
INSERT DELAYED IGNORE INTO t1 VALUES(1);
flush table t1; # to wait for INSERT DELAYED to be done
-
-if (`SELECT @@global.binlog_format != 'ROW'`)
+if ($binlog_format_statement)
{
#must show two INSERT DELAYED
- --replace_column 1 x 2 x 3 x 4 x 5 x
- show binlog events in 'master-bin.000002' LIMIT 2,2;
+ --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+ --let $binlog_limit= 1,2
+ --source include/show_binlog_events.inc
}
select * from t1;
sync_slave_with_master;
echo On slave;
-if (`SELECT @@global.binlog_format != 'ROW'`)
+if ($binlog_format_statement)
{
#must show two INSERT DELAYED
- --replace_column 1 x 2 x 3 x 4 x 5 x
- show binlog events in 'slave-bin.000002' LIMIT 2,2;
+ --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+ --let $binlog_limit= 1,2
+ --source include/show_binlog_events.inc
}
select * from t1;
diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test
index e4ebfd68761..e714d84a51b 100644
--- a/mysql-test/extra/rpl_tests/rpl_log.test
+++ b/mysql-test/extra/rpl_tests/rpl_log.test
@@ -11,11 +11,9 @@
# (otherwise RESET MASTER may come too early).
sync_slave_with_master;
source include/stop_slave.inc;
---source include/wait_for_slave_to_stop.inc
reset master;
reset slave;
-start slave;
---source include/wait_for_slave_to_start.inc
+source include/start_slave.inc;
let $VERSION=`select version()`;
@@ -31,19 +29,17 @@ eval create table t1 (word char(20) not null)ENGINE=$engine_type;
--replace_result $LOAD_FILE LOAD_FILE
eval load data infile '$LOAD_FILE' into table t1 ignore 1 lines;
select count(*) from t1;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events;
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 106 limit 1;
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 106 limit 2;
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 106 limit 2,1;
+source include/show_binlog_events.inc;
+
+let $binlog_limit= 1;
+source include/show_binlog_events.inc;
+
+let $binlog_limit= 2;
+source include/show_binlog_events.inc;
+
+let $binlog_limit= 2,1;
+source include/show_binlog_events.inc;
+let $binlog_limit=;
flush logs;
# We need an extra update before doing save_master_pos.
@@ -84,27 +80,24 @@ connection master;
eval create table t2 (n int)ENGINE=$engine_type;
insert into t2 values (1);
source include/show_binlog_events.inc;
---replace_result $VERSION VERSION
---replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /infile '.+'/infile 'words.dat'/
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events in 'master-bin.000002';
+
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+source include/show_binlog_events.inc;
+
--replace_column 2 #
show binary logs;
sync_slave_with_master;
---source include/wait_for_slave_to_start.inc
--replace_column 2 #
show binary logs;
---replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /INFILE '.+'/INFILE 'words.dat'/
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events in 'slave-bin.000001' from 4;
---replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events in 'slave-bin.000002' from 4;
-source include/show_slave_status.inc;
+
+let $binlog_file=;
+source include/show_binlog_events.inc;
+
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+source include/show_binlog_events.inc;
+let $binlog_file=;
+
+source include/check_slave_is_running.inc;
# Need to recode the following
diff --git a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
index 5b546bbd891..8415522ec92 100644
--- a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
+++ b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
@@ -43,7 +43,7 @@ set global max_relay_log_size=8192-1; # mapped to 4096
select @@global.max_relay_log_size;
start slave;
sync_with_master;
-source include/show_slave_status2.inc;
+--source include/check_slave_is_running.inc
--echo #
--echo # Test 2
@@ -55,7 +55,7 @@ set global max_relay_log_size=(5*4096);
query_vertical select @@global.max_relay_log_size;
start slave;
sync_with_master;
-source include/show_slave_status2.inc;
+--source include/check_slave_is_running.inc
--echo #
--echo # Test 3: max_relay_log_size = 0
@@ -67,7 +67,7 @@ set global max_relay_log_size=0;
query_vertical select @@global.max_relay_log_size;
start slave;
sync_with_master;
-source include/show_slave_status2.inc;
+--source include/check_slave_is_running.inc
--echo #
--echo # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
@@ -78,7 +78,6 @@ reset slave;
# test of relay log rotation when the slave is stopped
# (to make sure it does not crash).
flush logs;
-source include/show_slave_status2.inc;
--echo #
--echo # Test 5
@@ -93,10 +92,8 @@ flush logs;
# log we just closed. But a trick to achieve this is do an update on the master.
connection master;
create table t1 (a int);
-save_master_pos;
-connection slave;
-sync_with_master;
-source include/show_slave_status2.inc;
+sync_slave_with_master;
+--source include/check_slave_is_running.inc
--echo #
--echo # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
@@ -105,10 +102,8 @@ source include/show_slave_status2.inc;
flush logs;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-source include/show_slave_status2.inc;
+sync_slave_with_master;
+--source include/check_slave_is_running.inc
connection master;
# test that the absence of relay logs does not make a master crash
diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test
index 4677f6da25d..3de1d42c34f 100644
--- a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test
+++ b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test
@@ -56,24 +56,23 @@ connection master;
--echo # since insert is done with transactional engine, expect a BEGIN
--echo # at <start_pos>
--echo
---replace_result $start_pos <start_pos>
---replace_column 5 #
---eval show binlog events from $start_pos limit 1
+--let $binlog_start= $start_pos
+--let $binlog_limit= 1
+--source include/show_binlog_events.inc
--echo
--echo # Now the insert, one step after
--echo
---replace_result $start_pos <start_pos>
---replace_column 2 # 5 #
---eval show binlog events from $start_pos limit 1,1
+--let $binlog_start= $start_pos
+--let $binlog_limit= 1,1
+--source include/show_binlog_events.inc
--echo
--echo # and the COMMIT should be at <end_pos>
--echo
---replace_result $start_pos <start_pos> $end_pos <end_pos>
---replace_column 2 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---eval show binlog events from $start_pos limit 2,1
+--let $binlog_start= $start_pos
+--let $binlog_limit= 2,1
+--source include/show_binlog_events.inc
--echo
@@ -89,18 +88,17 @@ commit;
--source include/select_ndb_apply_status.inc
connection master;
---replace_result $start_pos <start_pos>
---replace_column 5 #
---eval show binlog events from $start_pos limit 1
+--let $binlog_start= $start_pos
+--let $binlog_limit= 1
+--source include/show_binlog_events.inc
--echo
---replace_result $start_pos <start_pos>
---replace_column 2 # 4 # 5 #
---eval show binlog events from $start_pos limit 1,2
+--let $binlog_start= $start_pos
+--let $binlog_limit= 1,2
+--source include/show_binlog_events.inc
--echo
---replace_result $start_pos <start_pos> $end_pos <end_pos>
---replace_column 2 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---eval show binlog events from $start_pos limit 3,1
+--let $binlog_start= $start_pos
+--let $binlog_limit= 3,1
+--source include/show_binlog_events.inc
--echo
diff --git a/mysql-test/extra/rpl_tests/rpl_record_compare.test b/mysql-test/extra/rpl_tests/rpl_record_compare.test
new file mode 100644
index 00000000000..dc27dcb1f9d
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_record_compare.test
@@ -0,0 +1,68 @@
+
+#
+# BUG#52868: Wrong handling of NULL value during update, replication out of sync
+#
+-- echo ## case #1 - last_null_bit_pos==0 in record_compare without X bit
+
+-- source include/master-slave-reset.inc
+-- connection master
+
+-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1
+
+INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 );
+INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 );
+-- disable_warnings
+UPDATE t1 SET c5 = 'a';
+-- enable_warnings
+-- 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
+
+-- echo ## case #1.1 - last_null_bit_pos==0 in record_compare with X bit
+-- echo ## (1 column less and no varchar)
+-- source include/master-slave-reset.inc
+-- connection master
+
+-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1
+
+INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 );
+INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 );
+-- disable_warnings
+UPDATE t1 SET c5 = 'a';
+-- enable_warnings
+-- 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
+
+-- echo ## case #2 - X bit is wrongly set.
+
+-- source include/master-slave-reset.inc
+-- connection master
+
+-- eval CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=$engine DEFAULT CHARSET= latin1
+INSERT INTO t1(c1) VALUES (10);
+INSERT INTO t1(c1) VALUES (NULL);
+UPDATE t1 SET c1= 0;
+-- 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
+
+
diff --git a/mysql-test/extra/rpl_tests/rpl_reset_slave.test b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
index 1f88c792fce..5c7d33d519e 100644
--- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test
+++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
@@ -9,36 +9,32 @@
# RESET SLAVE.
-- source include/master-slave.inc
-connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
-source include/show_slave_status2.inc;
+sync_slave_with_master;
+let $status_items= Master_User, Master_Host;
+source include/show_slave_status.inc;
-stop slave;
+source include/stop_slave.inc;
change master to master_user='test';
-source include/show_slave_status2.inc;
+source include/show_slave_status.inc;
reset slave;
-source include/show_slave_status2.inc;
+source include/show_slave_status.inc;
-start slave;
+source include/start_slave.inc;
sync_with_master;
-source include/show_slave_status2.inc;
+source include/show_slave_status.inc;
# test of crash with temp tables & RESET SLAVE
# (test to see if RESET SLAVE clears temp tables in memory and disk)
-stop slave;
+source include/stop_slave.inc;
reset slave;
-start slave;
+source include/start_slave.inc;
connection master;
create temporary table t1 (a int);
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
+sync_slave_with_master;
+source include/stop_slave.inc;
reset slave;
-start slave;
+source include/start_slave.inc;
sync_with_master;
show status like 'slave_open_temp_tables';
@@ -47,10 +43,9 @@ show status like 'slave_open_temp_tables';
#
# clearing the status
-stop slave;
+source include/stop_slave.inc;
reset slave;
-let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
-echo *** errno must be zero: $last_io_errno ***;
+source include/check_slave_no_error.inc;
#
# verifying start slave resets Last_IO_Error and Last_IO_Errno.
@@ -58,19 +53,13 @@ echo *** errno must be zero: $last_io_errno ***;
change master to master_user='impossible_user_name';
start slave;
+let $slave_io_errno= 1045;
source include/wait_for_slave_io_error.inc;
-let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
---disable_query_log
-eval SELECT $last_io_errno > 0 as ONE;
---enable_query_log
source include/stop_slave.inc;
change master to master_user='root';
source include/start_slave.inc;
-let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
-let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
---echo *** last errno must be zero: $last_io_errno ***
---echo *** last error must be blank: $last_io_error ***
+source include/check_slave_no_error.inc;
#
# verifying reset slave resets Last_{IO,SQL}_Err{or,no}
@@ -79,19 +68,9 @@ let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
source include/stop_slave.inc;
change master to master_user='impossible_user_name';
start slave;
+let $slave_io_errno= 1045;
source include/wait_for_slave_io_error.inc;
-let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
---disable_query_log
-eval SELECT $last_io_errno > 0 as ONE;
---enable_query_log
source include/stop_slave.inc;
reset slave;
-let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
-let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
-let $last_sql_errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
-let $last_sql_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
---echo *** io last errno must be zero: $last_io_errno ***
---echo *** io last error must be blank: $last_io_error ***
---echo *** sql last errno must be zero: $last_sql_errno ***
---echo *** sql last error must be blank: $last_sql_error ***
+source include/check_slave_no_error.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..84f7b79e733 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_basic.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test
@@ -259,10 +259,7 @@ DELETE FROM t1;
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
sync_slave_with_master;
set @@global.slave_exec_mode= default;
-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;
+source include/check_slave_is_running.inc;
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
# BUG#37076: TIMESTAMP/DATETIME values are not replicated correctly
@@ -376,11 +373,10 @@ 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;
+# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
+--let $slave_sql_errno= 1535
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
connection master;
RESET MASTER;
connection slave;
@@ -405,11 +401,10 @@ INSERT INTO t5 VALUES (1, "", 1);
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 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;
+# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
+--let $slave_sql_errno= 1535
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
connection master;
RESET MASTER;
connection slave;
@@ -424,11 +419,10 @@ INSERT INTO t6 VALUES (1, "", 1);
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 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;
+# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
+--let $slave_sql_errno= 1535
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
connection master;
RESET MASTER;
connection slave;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
index 083088f12ff..ee6205c79d8 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
@@ -138,9 +138,7 @@ SELECT * FROM t2;
sync_slave_with_master;
--echo **** On Slave ****
SELECT * FROM t2;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS
+--source include/check_slave_is_running.inc
connection master;
INSERT INTO t9 VALUES (4);
@@ -149,12 +147,10 @@ sync_slave_with_master;
connection master;
INSERT INTO t4 VALUES (4);
connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_skip_counter= 2
+--let $slave_sql_errno= 1535
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
connection master;
INSERT INTO t9 VALUES (5);
@@ -163,12 +159,10 @@ sync_slave_with_master;
connection master;
INSERT INTO t5 VALUES (5,10,25);
connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_skip_counter= 2
+--let $slave_sql_errno= 1535
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
connection master;
INSERT INTO t9 VALUES (6);
@@ -177,19 +171,15 @@ sync_slave_with_master;
connection master;
INSERT INTO t6 VALUES (6,12,36);
connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_skip_counter= 2
+--let $slave_sql_errno= 1535
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
connection master;
INSERT INTO t9 VALUES (6);
sync_slave_with_master;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS
+--source include/check_slave_is_running.inc
# Testing some tables extra field that can be null and cannot be null
# (but have default values)
diff --git a/mysql-test/include/check_concurrent_insert.inc b/mysql-test/include/check_concurrent_insert.inc
new file mode 100644
index 00000000000..f4bec3c9cdb
--- /dev/null
+++ b/mysql-test/include/check_concurrent_insert.inc
@@ -0,0 +1,96 @@
+#
+# SUMMARY
+# Check if statement reading table '$table' allows concurrent
+# inserts in it.
+#
+# PARAMETERS
+# $table Table in which concurrent inserts should be allowed.
+# $con_aux1 Name of the first auxiliary connection to be used by this
+# script.
+# $con_aux2 Name of the second auxiliary connection to be used by this
+# script.
+# $statement Statement to be checked.
+# $restore_table Table which might be modified by statement to be checked
+# and thus needs backing up before its execution and
+# restoring after it (can be empty).
+#
+# EXAMPLE
+# lock_sync.test
+#
+--disable_result_log
+--disable_query_log
+
+# Reset DEBUG_SYNC facility for safety.
+set debug_sync= "RESET";
+
+if (`SELECT '$restore_table' <> ''`)
+{
+--eval create temporary table t_backup select * from $restore_table;
+}
+
+connection $con_aux1;
+set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go';
+--send_eval $statement;
+
+connection $con_aux2;
+set debug_sync='now WAIT_FOR parked';
+--send_eval insert into $table (i) values (0);
+
+--enable_result_log
+--enable_query_log
+connection default;
+# Wait until concurrent insert is successfully executed while
+# statement being checked has its tables locked.
+# We use wait_condition.inc instead of simply reaping
+# concurrent insert here in order to avoid deadlocks if test
+# fails and to time out gracefully instead.
+let $wait_condition=
+ select count(*) = 0 from information_schema.processlist
+ where info = "insert into $table (i) values (0)";
+--source include/wait_condition.inc
+
+--disable_result_log
+--disable_query_log
+
+if ($success)
+{
+# Apparently concurrent insert was successfully executed.
+# To be safe against wait_condition.inc succeeding due to
+# races let us first reap concurrent insert to ensure that
+# it has really been successfully executed.
+connection $con_aux2;
+--reap
+connection default;
+set debug_sync= 'now SIGNAL go';
+connection $con_aux1;
+--reap
+connection default;
+--echo Success: '$statement' allows concurrent inserts into '$table'.
+}
+if (!$success)
+{
+# Waiting has timed out. Apparently concurrent insert was blocked.
+# So to be able to continue we need to end our statement first.
+set debug_sync= 'now SIGNAL go';
+connection $con_aux1;
+--reap
+connection $con_aux2;
+--reap
+connection default;
+--echo Error: '$statement' doesn't allow concurrent inserts into '$table'!
+}
+
+--eval delete from $table where i = 0;
+
+if (`SELECT '$restore_table' <> ''`)
+{
+--eval truncate table $restore_table;
+--eval insert into $restore_table select * from t_backup;
+drop temporary table t_backup;
+}
+
+# Clean-up. Reset DEBUG_SYNC facility after use.
+set debug_sync= "RESET";
+
+--enable_result_log
+--enable_query_log
diff --git a/mysql-test/include/check_no_concurrent_insert.inc b/mysql-test/include/check_no_concurrent_insert.inc
new file mode 100644
index 00000000000..f60401bcad1
--- /dev/null
+++ b/mysql-test/include/check_no_concurrent_insert.inc
@@ -0,0 +1,81 @@
+#
+# SUMMARY
+# Check that statement reading table '$table' doesn't allow concurrent
+# inserts in it.
+#
+# PARAMETERS
+# $table Table in which concurrent inserts should be disallowed.
+# $con_aux1 Name of the first auxiliary connection to be used by this
+# script.
+# $con_aux2 Name of the second auxiliary connection to be used by this
+# script.
+# $statement Statement to be checked.
+# $restore_table Table which might be modified by statement to be checked
+# and thus needs backing up before its execution and
+# restoring after it (can be empty).
+#
+# EXAMPLE
+# lock_sync.test
+#
+--disable_result_log
+--disable_query_log
+
+# Reset DEBUG_SYNC facility for safety.
+set debug_sync= "RESET";
+
+if (`SELECT '$restore_table' <> ''`)
+{
+--eval create temporary table t_backup select * from $restore_table;
+}
+
+connection $con_aux1;
+set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go';
+--send_eval $statement;
+
+connection $con_aux2;
+set debug_sync='now WAIT_FOR parked';
+--send_eval insert into $table (i) values (0);
+
+--enable_result_log
+--enable_query_log
+connection default;
+# Wait until concurrent insert is successfully blocked because
+# of our statement.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Locked" and info = "insert into $table (i) values (0)";
+--source include/wait_condition.inc
+
+--disable_result_log
+--disable_query_log
+
+set debug_sync= 'now SIGNAL go';
+connection $con_aux1;
+--reap
+connection $con_aux2;
+--reap
+connection default;
+
+if ($success)
+{
+--echo Success: '$statement' doesn't allow concurrent inserts into '$table'.
+}
+if (!$success)
+{
+--echo Error: '$statement' allows concurrent inserts into '$table'!
+}
+
+--eval delete from $table where i = 0;
+
+if (`SELECT '$restore_table' <> ''`)
+{
+--eval truncate table $restore_table;
+--eval insert into $restore_table select * from t_backup;
+drop temporary table t_backup;
+}
+
+# Clean-up. Reset DEBUG_SYNC facility after use.
+set debug_sync= "RESET";
+
+--enable_result_log
+--enable_query_log
diff --git a/mysql-test/include/check_no_row_lock.inc b/mysql-test/include/check_no_row_lock.inc
new file mode 100644
index 00000000000..c08e7f35b10
--- /dev/null
+++ b/mysql-test/include/check_no_row_lock.inc
@@ -0,0 +1,71 @@
+#
+# SUMMARY
+# Check if statement affecting or reading table '$table' doesn't
+# take any kind of locks on its rows.
+#
+# PARAMETERS
+# $table Table for which presence of row locks should be checked.
+# $con_aux Name of auxiliary connection to be used by this script.
+# $statement Statement to be checked.
+#
+# EXAMPLE
+# innodb_mysql_lock2.test
+#
+--disable_result_log
+--disable_query_log
+
+connection default;
+begin;
+--eval select * from $table for update;
+
+connection $con_aux;
+begin;
+--send_eval $statement;
+
+--enable_result_log
+--enable_query_log
+
+connection default;
+# Wait until statement is successfully executed while
+# all rows in table are X-locked. This means that it
+# does not acquire any row locks.
+# We use wait_condition.inc instead of simply reaping
+# statement here in order to avoid deadlocks if test
+# fails and to time out gracefully instead.
+let $wait_condition=
+ select count(*) = 0 from information_schema.processlist
+ where info = "$statement";
+--source include/wait_condition.inc
+
+--disable_result_log
+--disable_query_log
+
+if ($success)
+{
+# Apparently statement was successfully executed and thus it
+# has not required any row locks.
+# To be safe against wait_condition.inc succeeding due to
+# races let us first reap the statement being checked to
+# ensure that it has been successfully executed.
+connection $con_aux;
+--reap
+rollback;
+connection default;
+rollback;
+--echo Success: '$statement' doesn't take row locks on '$table'.
+}
+if (!$success)
+{
+# Waiting has timed out. Apparently statement was blocked on
+# some row lock. So to be able to continue we need to unlock
+# rows first.
+rollback;
+connection $con_aux;
+--reap
+rollback;
+connection default;
+--echo Error: '$statement' takes some row locks on '$table'!
+}
+
+--enable_result_log
+--enable_query_log
diff --git a/mysql-test/include/check_shared_row_lock.inc b/mysql-test/include/check_shared_row_lock.inc
new file mode 100644
index 00000000000..efc7e13b3aa
--- /dev/null
+++ b/mysql-test/include/check_shared_row_lock.inc
@@ -0,0 +1,61 @@
+#
+# SUMMARY
+# Check if statement reading table '$table' takes shared locks
+# on some of its rows.
+#
+# PARAMETERS
+# $table Table for which presence of row locks should be checked.
+# $con_aux Name of auxiliary connection to be used by this script.
+# $statement Statement to be checked.
+# $wait_statement Sub-statement which is supposed to acquire locks (should
+# be the same as $statement for ordinary statements).
+#
+# EXAMPLE
+# innodb_mysql_lock2.test
+#
+--disable_result_log
+--disable_query_log
+
+connection default;
+begin;
+--eval select * from $table for update;
+
+connection $con_aux;
+begin;
+--send_eval $statement;
+
+--enable_result_log
+--enable_query_log
+
+connection default;
+# Wait until statement is successfully blocked because
+# all rows in table are X-locked. This means that at
+# least it acquires S-locks on some of rows.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state in ("Sending data","statistics", "preparing") and
+ info = "$wait_statement";
+--source include/wait_condition.inc
+
+--disable_result_log
+--disable_query_log
+
+rollback;
+
+connection $con_aux;
+--reap
+rollback;
+
+connection default;
+--enable_result_log
+--enable_query_log
+
+if ($success)
+{
+--echo Success: '$statement' takes shared row locks on '$table'.
+}
+
+if (!$success)
+{
+--echo Error: '$statement' hasn't taken shared row locks on '$table'!
+}
diff --git a/mysql-test/include/check_slave_is_running.inc b/mysql-test/include/check_slave_is_running.inc
new file mode 100644
index 00000000000..5fbbe0d684c
--- /dev/null
+++ b/mysql-test/include/check_slave_is_running.inc
@@ -0,0 +1,18 @@
+# ==== Purpose ====
+#
+# Assert that the slave threads are running and don't have any errors.
+#
+# ==== Usage ====
+#
+# --source include/check_slave_running.inc
+
+--echo Checking that both slave threads are running.
+
+--let $slave_sql_running = query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1)
+--let $slave_io_running = query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1)
+
+if (`SELECT '$slave_sql_running' != 'Yes' OR '$slave_io_running' != 'Yes'`) {
+ --echo Slave not running: Slave_SQL_Running = $slave_sql_running Slave_IO_Running = $slave_io_running
+ --source include/show_rpl_debug_info.inc
+ --die Expected slave to be running, but it was not running.
+}
diff --git a/mysql-test/include/check_slave_no_error.inc b/mysql-test/include/check_slave_no_error.inc
new file mode 100644
index 00000000000..371db5ed6a0
--- /dev/null
+++ b/mysql-test/include/check_slave_no_error.inc
@@ -0,0 +1,17 @@
+# ==== Purpose ====
+#
+# Assert that Slave_SQL_Error and Slave_IO_Error are empty.
+#
+# ==== Usage ====
+#
+# --let $slave_param= Exec_Master_Log_Pos
+# --let $slave_param_value= 4711
+# --source include/check_slave_running.inc
+
+--let $slave_param= Last_SQL_Errno
+--let $slave_param_value= 0
+--source include/check_slave_param.inc
+
+--let $slave_param= Last_IO_Errno
+--let $slave_param_value= 0
+--source include/check_slave_param.inc
diff --git a/mysql-test/include/check_slave_param.inc b/mysql-test/include/check_slave_param.inc
new file mode 100644
index 00000000000..d82c26851ea
--- /dev/null
+++ b/mysql-test/include/check_slave_param.inc
@@ -0,0 +1,16 @@
+# ==== Purpose ====
+#
+# Assert that a given column in SHOW SLAVE STATUS has a given value.
+#
+# ==== Usage ====
+#
+# --let $slave_param= Exec_Master_Log_Pos
+# --let $slave_param_value= 4711
+# --source include/check_slave_param.inc
+
+--let $_param_value= query_get_value(SHOW SLAVE STATUS, $slave_param, 1)
+if (`SELECT '$_param_value' != '$slave_param_value'`) {
+ --echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value'
+ --source include/show_rpl_debug_info.inc
+ --die Wrong value for slave parameter
+}
diff --git a/mysql-test/include/get_relay_log_pos.inc b/mysql-test/include/get_relay_log_pos.inc
new file mode 100644
index 00000000000..7ce36fd3c50
--- /dev/null
+++ b/mysql-test/include/get_relay_log_pos.inc
@@ -0,0 +1,70 @@
+# For a given event which is at position $master_log_pos in the the master's
+# binary log, returns its position in the slave's relay log file
+# $relay_log_file.
+# The position is stored in the variable $relay_log_pos.
+
+# Usage:
+# let $relay_log_file= 'relay-log-bin.000001';
+# let $master_log_pos= 106;
+# source include/get_relay_log_pos.inc;
+# # at this point, get_relay_log_pos.inc sets $relay_log_pos. echo position
+# # in $relay_log_file: $relay_log_pos.
+
+if (`SELECT '$relay_log_file' = ''`)
+{
+ --die 'variable $relay_log_file is null'
+}
+
+if (`SELECT '$master_log_pos' = ''`)
+{
+ --die 'variable $master_log_pos is null'
+}
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $_suffix= `SELECT UUID()`;
+let $_tmp_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.$_suffix;
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$relay_log_file > $_tmp_file
+
+# All queries in this file should not be logged.
+--disable_query_log
+
+--disable_warnings
+DROP TEMPORARY TABLE IF EXISTS mysqlbinlog_events;
+DROP TEMPORARY TABLE IF EXISTS events_at;
+DROP TEMPORARY TABLE IF EXISTS events_pos;
+CREATE TEMPORARY TABLE mysqlbinlog_events(c1 INT AUTO_INCREMENT KEY, c2 varchar(256));
+
+# Event position is in the comments output by mysqlbinlog, we load this
+# comments into the table
+# '# at 106'
+# '# .... end_log_pos 46'
+eval LOAD DATA LOCAL INFILE '$_tmp_file' INTO TABLE mysqlbinlog_events
+ LINES STARTING BY '#' (c2) SET c1 = NULL;
+--enable_warnings
+
+# Event pos in relay log file is inserted into table events_at
+CREATE TEMPORARY TABLE events_at(c1 INT AUTO_INCREMENT KEY, c2 varchar(256))
+ SELECT c2 FROM mysqlbinlog_events WHERE c2 LIKE ' at%' ORDER BY c1;
+
+# Event pos in master log file is inserted into table events_pos
+CREATE TEMPORARY TABLE events_pos(c1 INT AUTO_INCREMENT KEY, c2 varchar(256))
+ SELECT c2 FROM mysqlbinlog_events WHERE c2 LIKE '% end_log_pos %' ORDER BY c1;
+
+# events_at events_pos
+# c1------c2-------------------------- c1------c2------------------------
+# 1 ev1's begin pos in relay log 1 ev1's end pos in master log
+# 2 ev2's begin pos in relay log 2 ev2's end pos in master log
+# 3 ev3's begin pos in relay log 3 ev3's end pos in master log
+# events always keep the same sequence.
+# Because event[N]'s end pos is equal to event[N+1]'s begin pos we want to
+# find event's end pos in relay log, we can find the right relay_log_pos
+# using the relationship that 'events_pos.c1 = events_at.c1 + 1'
+#
+# There is a fault that we can't get the relay log position of the last event,
+# as it is not output by mysqlbinlog
+let $relay_log_pos= `SELECT SUBSTRING(a.c2, 5)
+ FROM events_at a, events_pos b
+ WHERE a.c1=b.c1+1 and b.c2 LIKE '% $master_log_pos%'`;
+DROP TEMPORARY TABLE mysqlbinlog_events, events_at, events_pos;
+--remove_file $_tmp_file
+--enable_query_log
diff --git a/mysql-test/include/have_innodb_plugin.inc b/mysql-test/include/have_innodb_plugin.inc
index 99a79465f52..6b5fc29d459 100644
--- a/mysql-test/include/have_innodb_plugin.inc
+++ b/mysql-test/include/have_innodb_plugin.inc
@@ -1,4 +1,4 @@
disable_query_log;
--require r/true.require
-SELECT (plugin_library LIKE 'ha_innodb_plugin%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
+SELECT (plugin_library LIKE 'ha_innodb_plugin%' OR plugin_description LIKE '%xtradb%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
enable_query_log;
diff --git a/mysql-test/include/have_real_innodb_plugin.inc b/mysql-test/include/have_real_innodb_plugin.inc
new file mode 100644
index 00000000000..99a79465f52
--- /dev/null
+++ b/mysql-test/include/have_real_innodb_plugin.inc
@@ -0,0 +1,4 @@
+disable_query_log;
+--require r/true.require
+SELECT (plugin_library LIKE 'ha_innodb_plugin%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
+enable_query_log;
diff --git a/mysql-test/include/have_xtradb.inc b/mysql-test/include/have_xtradb.inc
new file mode 100644
index 00000000000..6c2fc5155a9
--- /dev/null
+++ b/mysql-test/include/have_xtradb.inc
@@ -0,0 +1,4 @@
+disable_query_log;
+--require r/true.require
+SELECT (plugin_description LIKE '%xtradb%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
+enable_query_log;
diff --git a/mysql-test/include/mysqlhotcopy.inc b/mysql-test/include/mysqlhotcopy.inc
new file mode 100644
index 00000000000..b3fd5e47179
--- /dev/null
+++ b/mysql-test/include/mysqlhotcopy.inc
@@ -0,0 +1,121 @@
+# Test of mysqlhotcopy (perl script)
+# Author: Horst Hunger
+# Created: 2010-05-10
+
+--source include/not_windows.inc
+--source include/not_embedded.inc
+
+if ($MYSQLHOTCOPY)
+{
+ die due to missing mysqlhotcopy tool;
+}
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+--disable_warnings
+DROP DATABASE IF EXISTS hotcopy_test;
+--enable_warnings
+CREATE DATABASE hotcopy_test;
+USE hotcopy_test;
+eval CREATE TABLE t1 (c1 int, c2 varchar(20)) ENGINE=$engine;
+eval CREATE TABLE t2 (c1 int, c2 varchar(20)) ENGINE=$engine;
+eval CREATE TABLE t3 (c1 int, c2 varchar(20)) ENGINE=$engine;
+
+INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_test
+
+# backup into another database in the same directory
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+USE hotcopy_save;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+# restore data into the original database with mysqlhotcopy
+if(`SELECT engine= 'MyISAM' FROM information_schema.tables WHERE table_name='t1'`)
+{
+USE hotcopy_test;
+DELETE FROM t1;
+SELECT * FROM t1;
+
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --addtodest -S $MASTER_MYSOCK -u root hotcopy_save hotcopy_test
+
+USE hotcopy_save;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+}
+
+USE hotcopy_test;
+DROP TABLE t2;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_test
+
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --addtodest -S $MASTER_MYSOCK -u root hotcopy_save hotcopy_test
+
+FLUSH TABLES;
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+# backup of db into a directory
+USE hotcopy_test;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test $MYSQLTEST_VARDIR/tmp
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--list_files $MYSQLTEST_VARDIR/tmp/hotcopy_test
+#--exec rm -rf $MYSQLTEST_VARDIR/tmp/hotcopy_test
+--remove_files_wildcard $MYSQLTEST_VARDIR/tmp/hotcopy_test *
+--rmdir $MYSQLTEST_VARDIR/tmp/hotcopy_test
+
+# backup without full index files
+# reproduction of bug#53556, "--list_files" shows MYI files, which is wrong.
+DROP DATABASE hotcopy_save;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --noindices -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+# test of option "allowold"
+DROP DATABASE hotcopy_save;
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--error 9,2304
+--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --allowold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+# test of option "keepold"
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --keepold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save_old
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_save
+
+# test of option "suffix"
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK
+--exec $MYSQLHOTCOPY --quiet --suffix=_cpy -S $MASTER_MYSOCK -u root hotcopy_test
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--list_files $MYSQLD_DATADIR/hotcopy_test_cpy
+DROP DATABASE hotcopy_test_cpy;
+
+DROP DATABASE hotcopy_test;
+DROP DATABASE hotcopy_save;
+DROP DATABASE hotcopy_save_old;
+
diff --git a/mysql-test/include/percona_query_cache_with_comments.inc b/mysql-test/include/percona_query_cache_with_comments.inc
new file mode 100644
index 00000000000..bed87bd4c22
--- /dev/null
+++ b/mysql-test/include/percona_query_cache_with_comments.inc
@@ -0,0 +1,95 @@
+--source include/percona_query_cache_with_comments_clear.inc
+let $query=/* with comment first */select * from t1;
+eval $query;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=# with comment first
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=-- with comment first
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=/* with comment first and "quote" */select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=# with comment first and "quote"
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=-- with comment first and "quote"
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=
+ /* with comment and whitespaces first */select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=
+ # with comment and whitespaces first
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=
+ -- with comment and whitespaces first
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $internal=* internal comment *;
+
+let $query=select * /$internal/ from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/ from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $internal=* internal comment with "quote" *;
+
+let $query=select * /$internal/ from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/ from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1
+;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 ;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 ;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1
+/* comment in the end */;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1
+/* *\/ */;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1
+/* comment in the end */
+;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 #comment in the end;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 #comment in the end
+;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 -- comment in the end;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 -- comment in the end
+;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select ' \' ' from t1;
+--source include/percona_query_cache_with_comments_eval.inc
diff --git a/mysql-test/include/percona_query_cache_with_comments_begin.inc b/mysql-test/include/percona_query_cache_with_comments_begin.inc
new file mode 100644
index 00000000000..38bfce20263
--- /dev/null
+++ b/mysql-test/include/percona_query_cache_with_comments_begin.inc
@@ -0,0 +1,12 @@
+-- source include/have_query_cache.inc
+
+set GLOBAL query_cache_size=1355776;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+
+--source include/percona_query_cache_with_comments_clear.inc
diff --git a/mysql-test/include/percona_query_cache_with_comments_clear.inc b/mysql-test/include/percona_query_cache_with_comments_clear.inc
new file mode 100644
index 00000000000..728a19a3c97
--- /dev/null
+++ b/mysql-test/include/percona_query_cache_with_comments_clear.inc
@@ -0,0 +1,5 @@
+# Reset query cache variables.
+flush query cache; # This crashed in some versions
+flush query cache; # This crashed in some versions
+reset query cache;
+flush status;
diff --git a/mysql-test/include/percona_query_cache_with_comments_end.inc b/mysql-test/include/percona_query_cache_with_comments_end.inc
new file mode 100644
index 00000000000..d5356359d7e
--- /dev/null
+++ b/mysql-test/include/percona_query_cache_with_comments_end.inc
@@ -0,0 +1,3 @@
+DROP TABLE t1;
+SET GLOBAL query_cache_size=default;
+set global query_cache_strip_comments=OFF;
diff --git a/mysql-test/include/percona_query_cache_with_comments_eval.inc b/mysql-test/include/percona_query_cache_with_comments_eval.inc
new file mode 100644
index 00000000000..a409786d554
--- /dev/null
+++ b/mysql-test/include/percona_query_cache_with_comments_eval.inc
@@ -0,0 +1,7 @@
+echo -----------------------------------------------------;
+echo $query;
+echo -----------------------------------------------------;
+--source include/percona_query_cache_with_comments_show.inc
+eval $query;
+eval $query;
+--source include/percona_query_cache_with_comments_show.inc
diff --git a/mysql-test/include/percona_query_cache_with_comments_show.inc b/mysql-test/include/percona_query_cache_with_comments_show.inc
new file mode 100644
index 00000000000..71aa5211cfd
--- /dev/null
+++ b/mysql-test/include/percona_query_cache_with_comments_show.inc
@@ -0,0 +1,8 @@
+let $show=show status like "Qcache_queries_in_cache";
+eval $show;
+let $show=show status like "Qcache_inserts";
+eval $show;
+let $show=show status like "Qcache_hits";
+eval $show;
+
+
diff --git a/mysql-test/include/rpl_stmt_seq.inc b/mysql-test/include/rpl_stmt_seq.inc
index 6c944dc4729..08f6e44aba0 100644
--- a/mysql-test/include/rpl_stmt_seq.inc
+++ b/mysql-test/include/rpl_stmt_seq.inc
@@ -80,9 +80,8 @@ eval INSERT INTO t1 SET f1= $MAX + 1;
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
+ --let $binlog_file= master-bin.$_log_num_s
+ --source include/show_binlog_events.inc
}
sync_slave_with_master;
@@ -93,9 +92,8 @@ connection slave;
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
+ --let $binlog_file= slave-bin.$_log_num_s
+ --source include/show_binlog_events.inc
}
###############################################################
@@ -111,9 +109,8 @@ let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT;
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
+ --let $binlog_file= master-bin.$_log_num_s
+ --source include/show_binlog_events.inc
}
sync_slave_with_master;
@@ -124,9 +121,8 @@ connection slave;
SELECT MAX(f1) FROM t1;
if ($show_binlog)
{
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
+ --let $binlog_file= slave-bin.$_log_num_s
+ --source include/show_binlog_events.inc
}
###############################################################
@@ -150,9 +146,8 @@ eval SELECT CONCAT(CONCAT('TEST-INFO: MASTER: The INSERT is ',
--enable_query_log
if ($show_binlog)
{
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
+ --let $binlog_file= master-bin.$_log_num_s
+ --source include/show_binlog_events.inc
}
sync_slave_with_master;
@@ -171,9 +166,8 @@ eval SELECT CONCAT(CONCAT('TEST-INFO: SLAVE: The INSERT is ',
--enable_query_log
if ($show_binlog)
{
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
+ --let $binlog_file= slave-bin.$_log_num_s
+ --source include/show_binlog_events.inc
}
###############################################################
diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc
index 68f913a16a3..8649f31ad9f 100644
--- a/mysql-test/include/show_binlog_events.inc
+++ b/mysql-test/include/show_binlog_events.inc
@@ -1,10 +1,45 @@
-# $binlog_start can be set by caller or take a default value
+##############################################################################
+# Show binary log events
+#
+# Useage:
+# let $binlog_file= master-bin.000002;
+# let $binlog_start= 106;
+# let $binlog_limit= 1, 3;
+# source include/show_binlog_events.inc;
+#
+# It shows the first binary log file if $binlog_file is not given.
+#
+# It shows events from the end position of the description event if
+# $binlog_start is not given.
+#
+# It shows all of the events if $binlog_limit is not given.
+# $binlog_format has the same semantic with 'LIMIT' option.
+#
+##############################################################################
if (!$binlog_start)
{
- let $binlog_start=106;
+ # If $binlog_start is not set, we will set it as the second event's position.
+ # The first event(Description Event) is always ignored. For description
+ # event's length might be changed because of adding new events, 'SHOW BINLOG
+ # EVENTS LIMIT 1' is used to get the right value.
+ --let $binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
}
+
+--let $_statement=show binlog events
+if (`SELECT '$binlog_file' <> ''`)
+{
+ --let $_statement= $_statement in '$binlog_file'
+}
+
+--let $_statement= $_statement from $binlog_start
+
+if (`SELECT '$binlog_limit' <> ''`)
+{
+ --let $_statement= $_statement limit $binlog_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 $_statement
diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc
index 252d63f1bf4..148d11f3b02 100644
--- a/mysql-test/include/show_rpl_debug_info.inc
+++ b/mysql-test/include/show_rpl_debug_info.inc
@@ -36,6 +36,7 @@ let $_con= $CURRENT_CONNECTION;
--echo
--echo [on $_con]
--echo
+SELECT NOW();
--echo **** SHOW SLAVE STATUS on $_con ****
query_vertical SHOW SLAVE STATUS;
--echo
@@ -70,6 +71,7 @@ if (`SELECT '$_master_con' != ''`)
--echo [on $_master_con]
connection $_master_con;
--echo
+ SELECT NOW();
--echo **** SHOW MASTER STATUS on $_master_con ****
query_vertical SHOW MASTER STATUS;
--echo
diff --git a/mysql-test/include/show_slave_status.inc b/mysql-test/include/show_slave_status.inc
index b315b9e45ca..d66c068e19b 100644
--- a/mysql-test/include/show_slave_status.inc
+++ b/mysql-test/include/show_slave_status.inc
@@ -1,6 +1,25 @@
# Include file to show the slave status, masking out some information
# that varies depending on where the test is executed.
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+--let $_items=$status_items
+if (`SELECT "XX$status_items" = "XX"`)
+{
+ --die 'Variable status_items is NULL'
+}
+
+--disable_query_log
+--vertical_results
+
+while (`SELECT "XX$_items" <> "XX"`)
+{
+ --let $_name= `SELECT SUBSTRING_INDEX('$_items', ',', 1)`
+ --let $_items= `SELECT LTRIM(SUBSTRING('$_items', LENGTH('$_name') + 2))`
+
+ --let $_value= query_get_value(SHOW SLAVE STATUS, $_name, 1)
+
+ --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+ --eval SELECT "$_value" AS $_name
+}
+
+--horizontal_results
+--enable_query_log
diff --git a/mysql-test/include/show_slave_status2.inc b/mysql-test/include/show_slave_status2.inc
deleted file mode 100644
index 9c4e14c62c2..00000000000
--- a/mysql-test/include/show_slave_status2.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-# Include file to show the slave status, masking out some information
-# that varies depending on where the test is executed.
-
-# masked out log positions
-
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
diff --git a/mysql-test/include/test_fieldsize.inc b/mysql-test/include/test_fieldsize.inc
index 606bc63779d..57dba4d1cc0 100644
--- a/mysql-test/include/test_fieldsize.inc
+++ b/mysql-test/include/test_fieldsize.inc
@@ -22,10 +22,9 @@ eval $test_insert;
connection slave;
START SLAVE;
---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
+--let $slave_sql_errno= 1535
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
# The following should be 0
SELECT COUNT(*) FROM t1;
diff --git a/mysql-test/include/wait_for_binlog_event.inc b/mysql-test/include/wait_for_binlog_event.inc
index 2a57c191413..7a55c8c2182 100644
--- a/mysql-test/include/wait_for_binlog_event.inc
+++ b/mysql-test/include/wait_for_binlog_event.inc
@@ -18,7 +18,7 @@ while (`SELECT INSTR("$_last_event","$wait_binlog_event") = 0`)
dec $_loop_count;
if (!$_loop_count)
{
- SHOW BINLOG EVENTS;
+ --source include/show_rpl_debug_info.inc
--die ERROR: failed while waiting for $wait_binlog_event in binlog
}
real_sleep 0.1;
diff --git a/mysql-test/include/wait_for_slave_io_error.inc b/mysql-test/include/wait_for_slave_io_error.inc
index 094406e02b2..34cbf20a73b 100644
--- a/mysql-test/include/wait_for_slave_io_error.inc
+++ b/mysql-test/include/wait_for_slave_io_error.inc
@@ -1,23 +1,59 @@
# ==== Purpose ====
#
# Waits until the IO thread of the current connection has got an
-# error, or until a timeout is reached.
+# error, or until a timeout is reached. Also waits until the IO
+# thread has completely stopped.
#
# ==== Usage ====
#
+# # Wait several errors.
+# let $slave_io_errno= 1, 2, 3;
# source include/wait_for_slave_io_error.inc;
#
-# Parameters to this macro are $slave_timeout and
-# $slave_keep_connection. See wait_for_slave_param.inc for
-# descriptions.
+# # Print error message
+# let $slave_io_errno= 1;
+# let $show_slave_io_error= 1;
+# source include/wait_for_slave_io_error.inc;
+#
+# Parameters:
+#
+# $slave_io_errno
+# The expected IO error numbers. This is required.
+# (After BUG#41956 has been fixed, this will be required to be a
+# symbolic name instead of a numbers.)
+#
+# $show_slave_io_error
+# If set, will print the error to the query log.
+#
+# $slave_timeout
+# See wait_for_slave_param.inc for description.
+#
+# $master_connection
+# See wait_for_slave_param.inc for description.
-let $old_slave_param_comparison= $slave_param_comparison;
+if (`SELECT '$slave_io_errno' = ''`) {
+ --die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc
+}
+let $old_slave_param_comparison= $slave_param_comparison;
let $slave_param= Last_IO_Errno;
let $slave_param_comparison= !=;
let $slave_param_value= 0;
let $slave_error_message= Failed while waiting for slave to produce an error in its sql thread;
source include/wait_for_slave_param.inc;
let $slave_error_message= ;
-
let $slave_param_comparison= $old_slave_param_comparison;
+
+let $_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
+if (`SELECT $_error NOT IN ($slave_io_errno)`) {
+ --echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) ****
+ source include/show_rpl_debug_info.inc;
+ --echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) ****
+ --die Slave stopped with wrong error code
+}
+
+if ($show_slave_io_error)
+{
+ let $error= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1);
+ echo Last_IO_Error = $error;
+}
diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc
index 82e57922913..ef864f9245e 100644
--- a/mysql-test/include/wait_for_slave_param.inc
+++ b/mysql-test/include/wait_for_slave_param.inc
@@ -78,5 +78,5 @@ if (!$_slave_timeout_counter)
--echo Current connection is '$CURRENT_CONNECTION'
echo Note: the following output may have changed since the failure was detected;
source include/show_rpl_debug_info.inc;
- exit;
+ die;
}
diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc
index ad1d7a9e639..aab04036eea 100644
--- a/mysql-test/include/wait_for_slave_sql_error.inc
+++ b/mysql-test/include/wait_for_slave_sql_error.inc
@@ -14,6 +14,9 @@
# The expected SQL error number. This is required.
# (After BUG#41956 has been fixed, this will be required to be a
# symbolic name instead of a number.)
+#
+# $show_slave_sql_error
+# If set, will print the error to the query log.
#
# $slave_timeout
# See wait_for_slave_param.inc for description.
@@ -22,8 +25,7 @@
# See wait_for_slave_param.inc for description.
if (`SELECT '$slave_sql_errno' = ''`) {
- --echo !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_fro_slave_sql_error.inc
- exit;
+ --die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc
}
let $slave_param= Slave_SQL_Running;
@@ -33,7 +35,14 @@ source include/wait_for_slave_param.inc;
let $_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
if (`SELECT '$_error' != '$slave_sql_errno'`) {
- --echo Slave stopped with wrong error code: $_error (expected $slave_sql_errno)
+ --echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) ****
source include/show_rpl_debug_info.inc;
- exit;
+ --echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) ****
+ --die Slave stopped with wrong error code
+}
+
+if ($show_slave_sql_error)
+{
+ let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+ echo Last_SQL_Error = $error;
}
diff --git a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
index 247de3a41a1..11c02c0b490 100644
--- a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
+++ b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
@@ -22,17 +22,30 @@
#
# $master_connection
# See wait_for_slave_param.inc for description.
+#
+# $slave_skip_counter
+# If set, skip this number of events. If not set, skip one event.
+#
+# $not_switch_connection If set, don't switch to slave and don't switch back
+# master.
+#
echo --source include/wait_for_slave_sql_error_and_skip.inc;
-connection slave;
-source include/wait_for_slave_sql_error.inc;
-if ($show_sql_error)
+if (!$not_switch_connection)
{
- let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
- echo Last_SQL_Error = $error;
+ connection slave;
}
+source include/wait_for_slave_sql_error.inc;
# skip the erroneous statement
-set global sql_slave_skip_counter=1;
+if ($slave_skip_counter) {
+ eval SET GLOBAL SQL_SLAVE_SKIP_COUNTER= $slave_skip_counter;
+}
+if (!$slave_skip_counter) {
+ SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
+}
source include/start_slave.inc;
-connection master;
+if (!$not_switch_connection)
+{
+ connection master;
+}
diff --git a/mysql-test/include/wait_for_status_var.inc b/mysql-test/include/wait_for_status_var.inc
index 6ba632ce46b..b8b4fa20b86 100644
--- a/mysql-test/include/wait_for_status_var.inc
+++ b/mysql-test/include/wait_for_status_var.inc
@@ -35,7 +35,7 @@
if (`SELECT STRCMP('$status_type', '') * STRCMP(UPPER('$status_type'), 'SESSION') * STRCMP(UPPER('$status_type'), 'GLOBAL')`)
{
--echo **** ERROR: Unknown type of variable status_type: allowed values are: SESSION or GLOBAL ****
- exit;
+ die;
}
let $_status_timeout_counter= $status_timeout;
@@ -61,7 +61,7 @@ while (`SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_va
--echo **** Showing STATUS, PROCESSLIST ****
eval SHOW $status_type STATUS LIKE '$status_var';
SHOW PROCESSLIST;
- exit;
+ die;
}
dec $_status_timeout_counter;
sleep 0.1;
diff --git a/mysql-test/include/wait_until_count_sessions.inc b/mysql-test/include/wait_until_count_sessions.inc
index de4f0eeb652..26b0d8f2633 100644
--- a/mysql-test/include/wait_until_count_sessions.inc
+++ b/mysql-test/include/wait_until_count_sessions.inc
@@ -122,5 +122,6 @@ if (!$success)
--echo # Timeout in wait_until_count_sessions.inc
--echo # Number of sessions expected: <= $count_sessions found: $current_sessions
SHOW PROCESSLIST;
+ --die Timeout in wait_until_count_sessions.inc
}
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index 7d404621f85..7bdb0e37604 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -68,9 +68,22 @@ require "mtr_misc.pl";
my $do_test_reg;
my $skip_test_reg;
+# Related to adding InnoDB plugin combinations
+my $lib_innodb_plugin;
+
# If "Quick collect", set to 1 once a test to run has been found.
my $some_test_found;
+sub find_innodb_plugin {
+ $lib_innodb_plugin=
+ my_find_file($::basedir,
+ ["storage/innodb_plugin", "storage/innodb_plugin/.libs",
+ "lib/mysql/plugin", "lib/plugin"],
+ ["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
+ "ha_innodb_plugin.sl"],
+ NOT_REQUIRED);
+}
+
sub init_pattern {
my ($from, $what)= @_;
return undef unless defined $from;
@@ -103,6 +116,8 @@ sub collect_test_cases ($$$) {
$do_test_reg= init_pattern($do_test, "--do-test");
$skip_test_reg= init_pattern($skip_test, "--skip-test");
+ &find_innodb_plugin;
+
# If not reordering, we also shouldn't group by suites, unless
# no test cases were named.
# This also effects some logic in the loop following this.
@@ -775,11 +790,13 @@ sub collect_one_test_case {
# Check for disabled tests
# ----------------------------------------------------------------------
my $marked_as_disabled= 0;
- if ( $disabled->{$tname} )
+ if ( $disabled->{$tname} or $disabled->{"$suitename.$tname"} )
{
# Test was marked as disabled in suites disabled.def file
$marked_as_disabled= 1;
- $tinfo->{'comment'}= $disabled->{$tname};
+ # Test name may have been disabled with or without suite name part
+ $tinfo->{'comment'}= $disabled->{$tname} ||
+ $disabled->{"$suitename.$tname"};
}
my $disabled_file= "$testdir/$tname.disabled";
@@ -951,6 +968,30 @@ sub collect_one_test_case {
return $tinfo;
}
}
+ elsif ( $tinfo->{'innodb_plugin_test'} )
+ {
+ # This is a test that needs the innodb plugin
+ if (&find_innodb_plugin)
+ {
+ my $sep= (IS_WINDOWS) ? ';' : ':';
+ my $plugin_filename= basename($lib_innodb_plugin);
+ my $plugin_list=
+ "innodb=$plugin_filename$sep" .
+ "innodb_trx=$plugin_filename$sep" .
+ "innodb_locks=$plugin_filename$sep" .
+ "innodb_lock_waits=$plugin_filename$sep" .
+ "innodb_cmp=$plugin_filename$sep" .
+ "innodb_cmp_reset=$plugin_filename$sep" .
+ "innodb_cmpmem=$plugin_filename$sep" .
+ "innodb_cmpmem_reset=$plugin_filename";
+
+ foreach my $k ('master_opt', 'slave_opt') {
+ push(@{$tinfo->{$k}}, '--ignore-builtin-innodb');
+ push(@{$tinfo->{$k}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
+ push(@{$tinfo->{$k}}, "--plugin-load=$plugin_list");
+ }
+ }
+ }
else
{
push(@{$tinfo->{'master_opt'}}, "--loose-skip-innodb");
@@ -1129,8 +1170,11 @@ my @tags=
["include/have_log_bin.inc", "need_binlog", 1],
["include/have_innodb.inc", "innodb_test", 1],
+ ["include/have_innodb_plugin.inc", "innodb_plugin_test", 1],
+ ["include/have_real.inc", "innodb_test", 1],
+ ["include/have_real_innodb_plugin.inc", "innodb_plugin_test", 1],
+ ["include/have_xtradb.inc", "innodb_test", 1],
["include/have_pbxt.inc", "pbxt_test", 1],
- ["include/have_innodb_plugin.inc", "innodb_test", 1],
["include/big_test.inc", "big_test", 1],
["include/have_debug.inc", "need_debug", 1],
["include/have_ndb.inc", "ndb_test", 1],
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 6838435bbde..388d252502a 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -149,6 +149,28 @@ sub mtr_exe_maybe_exists (@) {
#
# NOTE! More specific paths should be given before less specific.
+#
+sub mtr_pl_maybe_exists (@) {
+ my @path= @_;
+
+ map {$_.= ".pl"} @path if IS_WINDOWS;
+ foreach my $path ( @path )
+ {
+ if(IS_WINDOWS)
+ {
+ return $path if -f $path;
+ }
+ else
+ {
+ return $path if -x $path;
+ }
+ }
+ return "";
+}
+
+
+#
+# NOTE! More specific paths should be given before less specific.
# For example /client/debug should be listed before /client
#
sub mtr_exe_exists (@) {
diff --git a/mysql-test/lib/v1/mtr_process.pl b/mysql-test/lib/v1/mtr_process.pl
index 566ccfe0778..33a39d1f0b6 100644
--- a/mysql-test/lib/v1/mtr_process.pl
+++ b/mysql-test/lib/v1/mtr_process.pl
@@ -264,8 +264,9 @@ sub spawn_parent_impl {
if ( $timer_name eq "suite" )
{
# We give up here
- # FIXME we should only give up the suite, not all of the run?
print STDERR "\n";
+ kill(9, $pid); # Kill mysqltest
+ mtr_kill_leftovers(); # Kill servers the hard way
mtr_error("Test suite timeout");
}
elsif ( $timer_name eq "testcase" )
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index 174de23c530..ddd6e6d936a 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -3970,7 +3970,7 @@ sub mysqld_arguments ($$$$) {
}
}
- mtr_add_arg($args, "%s--character-set-server-set=latin1", $prefix);
+ mtr_add_arg($args, "%s--character-set-server=latin1", $prefix);
mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 6b5ac7fc81e..cd61ad47883 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -130,7 +130,7 @@ my $path_config_file; # The generated config file, var/my.cnf
# executables will be used by the test suite.
our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
-my $DEFAULT_SUITES= "main,binlog,federated,rpl,maria,parts,innodb,vcol,oqgraph";
+my $DEFAULT_SUITES= "main,binlog,federated,rpl,maria,parts,innodb,innodb_plugin,percona,vcol,oqgraph";
my $opt_suites;
our $opt_verbose= 0; # Verbose output, enable with --verbose
@@ -234,10 +234,12 @@ my $opt_strace_client;
our $opt_user = "root";
my $opt_valgrind= 0;
-our $opt_valgrind_mysqld= 0;
-my $opt_valgrind_mysqltest= 0;
my @default_valgrind_args= ("--show-reachable=yes");
my @valgrind_args;
+our $opt_valgrind_mysqld= 0;
+my $opt_valgrind_mysqltest= 0;
+my $opt_strace= 0;
+my @strace_args;
my $opt_valgrind_path;
my $opt_callgrind;
my %mysqld_logs;
@@ -929,7 +931,9 @@ sub command_line_setup {
'manual-ddd' => \$opt_manual_ddd,
'debugger=s' => \$opt_debugger,
'client-debugger=s' => \$opt_client_debugger,
+ 'strace' => \$opt_strace,
'strace-client:s' => \$opt_strace_client,
+ 'strace-option=s' => \@strace_args,
'max-save-core=i' => \$opt_max_save_core,
'max-save-datadir=i' => \$opt_max_save_datadir,
'max-test-fail=i' => \$opt_max_test_fail,
@@ -1470,6 +1474,11 @@ sub command_line_setup {
join(" ", @valgrind_args), "\"");
}
+ if (@strace_args)
+ {
+ $opt_strace=1;
+ }
+
# InnoDB does not bother to do individual de-allocations at exit. Instead it
# relies on a custom allocator to track every allocation, and frees all at
# once during exit.
@@ -1598,7 +1607,7 @@ sub collect_mysqld_features {
#print "Major: $1 Minor: $2 Build: $3\n";
$mysql_version_id= $1*10000 + $2*100 + $3;
#print "mysql_version_id: $mysql_version_id\n";
- mtr_report("MySQL Version $1.$2.$3");
+ mtr_report("MariaDB Version $1.$2.$3");
}
}
else
@@ -1721,9 +1730,9 @@ sub executable_setup () {
if ( -x "../libtool")
{
$exe_libtool= "../libtool";
- if ($opt_valgrind or $glob_debugger)
+ if ($opt_valgrind or $glob_debugger or $opt_strace)
{
- mtr_report("Using \"$exe_libtool\" when running valgrind or debugger");
+ mtr_report("Using \"$exe_libtool\" when running valgrind, strace or debugger");
}
}
@@ -2119,6 +2128,15 @@ sub environment_setup {
}
# ----------------------------------------------------
+ # mysqlhotcopy
+ # ----------------------------------------------------
+ my $mysqlhotcopy=
+ mtr_pl_maybe_exists("$basedir/scripts/mysqlhotcopy");
+ # Since mysqltest interprets the real path as "false" in an if,
+ # use 1 ("true") to indicate "not exists" so it can be tested for
+ $ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy || 1;
+
+ # ----------------------------------------------------
# perror
# ----------------------------------------------------
my $exe_perror= mtr_exe_exists("$basedir/extra$opt_vs_config/perror",
@@ -4032,6 +4050,7 @@ sub extract_warning_lines ($) {
qr/Slave: Can't drop database.* database doesn't exist/,
qr/Slave: Operation DROP USER failed for 'create_rout_db'/,
qr|Checking table: '\./mtr/test_suppressions'|,
+ qr|Table \./test/bug53592 has a primary key in InnoDB data dictionary, but not in MySQL|,
qr|mysqld: Table '\./mtr/test_suppressions' is marked as crashed and should be repaired|
);
@@ -4623,6 +4642,10 @@ sub mysqld_start ($$) {
{
valgrind_arguments($args, \$exe);
}
+ if ( $opt_strace)
+ {
+ strace_arguments($args, \$exe, $mysqld->name());
+ }
mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
mysqld_arguments($args,$mysqld,$extra_opts);
@@ -5546,6 +5569,33 @@ sub valgrind_arguments {
}
}
+#
+# Modify the exe and args so that program is run in strace
+#
+sub strace_arguments {
+ my $args= shift;
+ my $exe= shift;
+ my $mysqld_name= shift;
+
+ mtr_add_arg($args, "-f");
+ mtr_add_arg($args, "-o%s/var/log/%s.strace", $glob_mysql_test_dir, $mysqld_name);
+
+ # Add strace options, can be overriden by user
+ mtr_add_arg($args, '%s', $_) for (@strace_args);
+
+ mtr_add_arg($args, $$exe);
+
+ $$exe= "strace";
+
+ if ($exe_libtool)
+ {
+ # Add "libtool --mode-execute" before the test to execute
+ # if running in valgrind(to avoid valgrinding bash)
+ unshift(@$args, "--mode=execute", $$exe);
+ $$exe= $exe_libtool;
+ }
+}
+
#
# Usage
@@ -5673,9 +5723,6 @@ Options for debugging the product
test(s)
manual-ddd Let user manually start mysqld in ddd, before running
test(s)
- strace-client=[path] Create strace output for mysqltest client, optionally
- specifying name and path to the trace program to use.
- Example: $0 --strace-client=ktrace
max-save-core Limit the number of core files saved (to avoid filling
up disks for heavily crashing server). Defaults to
$opt_max_save_core, set to 0 for no limit. Set
@@ -5703,6 +5750,15 @@ Options for valgrind
valgrind-path=<EXE> Path to the valgrind executable
callgrind Instruct valgrind to use callgrind
+Options for strace
+
+ strace Run the "mysqld" executables using strace. Default
+ options are -f -o var/log/'mysqld-name'.strace
+ strace-option=ARGS Option to give strace, replaces default option(s),
+ strace-client=[path] Create strace output for mysqltest client, optionally
+ specifying name and path to the trace program to use.
+ Example: $0 --strace-client=ktrace
+
Misc options
user=USER User for connecting to mysqld(default: $opt_user)
comment=STR Write STR to the output
diff --git a/mysql-test/r/alter_table-big.result b/mysql-test/r/alter_table-big.result
index 9761754a02f..d6b936bd5d7 100644
--- a/mysql-test/r/alter_table-big.result
+++ b/mysql-test/r/alter_table-big.result
@@ -12,11 +12,11 @@ alter table t1 enable keys;;
insert into t2 values (1);
insert into t1 values (1, 1, 1);
set session debug="-d,sleep_alter_enable_indexes";
-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 # use `test`; insert into t2 values (1)
-master-bin.000001 # Query 1 # use `test`; alter table t1 enable keys
-master-bin.000001 # Query 1 # use `test`; insert into t1 values (1, 1, 1)
+master-bin.000001 # Query # # use `test`; insert into t2 values (1)
+master-bin.000001 # Query # # use `test`; alter table t1 enable keys
+master-bin.000001 # Query # # use `test`; insert into t1 values (1, 1, 1)
drop tables t1, t2;
End of 5.0 tests
drop table if exists t1, t2, t3;
@@ -41,17 +41,17 @@ alter table t2 change c vc varchar(100) default 'Test2', rename to t1;;
rename table t1 to t3;
drop table t3;
set session debug="-d,sleep_alter_before_main_binlog";
-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 # use `test`; alter table t1 change i c char(10) default 'Test1'
-master-bin.000001 # Query 1 # use `test`; insert into t1 values ()
-master-bin.000001 # Query 1 # use `test`; alter table t1 change c vc varchar(100) default 'Test2'
-master-bin.000001 # Query 1 # use `test`; rename table t1 to t2
-master-bin.000001 # Query 1 # use `test`; drop table t2
-master-bin.000001 # Query 1 # use `test`; create table t1 (i int)
-master-bin.000001 # Query 1 # use `test`; alter table t1 change i c char(10) default 'Test3', rename to t2
-master-bin.000001 # Query 1 # use `test`; insert into t2 values ()
-master-bin.000001 # Query 1 # use `test`; alter table t2 change c vc varchar(100) default 'Test2', rename to t1
-master-bin.000001 # Query 1 # use `test`; rename table t1 to t3
-master-bin.000001 # Query 1 # use `test`; drop table t3
+master-bin.000001 # Query # # use `test`; alter table t1 change i c char(10) default 'Test1'
+master-bin.000001 # Query # # use `test`; insert into t1 values ()
+master-bin.000001 # Query # # use `test`; alter table t1 change c vc varchar(100) default 'Test2'
+master-bin.000001 # Query # # use `test`; rename table t1 to t2
+master-bin.000001 # Query # # use `test`; drop table t2
+master-bin.000001 # Query # # use `test`; create table t1 (i int)
+master-bin.000001 # Query # # use `test`; alter table t1 change i c char(10) default 'Test3', rename to t2
+master-bin.000001 # Query # # use `test`; insert into t2 values ()
+master-bin.000001 # Query # # use `test`; alter table t2 change c vc varchar(100) default 'Test2', rename to t1
+master-bin.000001 # Query # # use `test`; rename table t1 to t3
+master-bin.000001 # Query # # use `test`; drop table t3
End of 5.1 tests
diff --git a/mysql-test/r/bug39022.result b/mysql-test/r/bug39022.result
index 5963709aa2a..75899ed686b 100644
--- a/mysql-test/r/bug39022.result
+++ b/mysql-test/r/bug39022.result
@@ -12,7 +12,7 @@ INSERT INTO t2 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
START TRANSACTION;
# in thread2
REPLACE INTO t2 VALUES (-17);
-SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d);
+SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
d
# in thread1
REPLACE INTO t1(a,b) VALUES (67,20);
@@ -21,10 +21,10 @@ COMMIT;
START TRANSACTION;
REPLACE INTO t1(a,b) VALUES (65,-50);
REPLACE INTO t2 VALUES (-91);
-SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d);
+SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
# in thread1
# should not crash
-SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d);
+SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# in thread2
d
diff --git a/mysql-test/r/create-big.result b/mysql-test/r/create-big.result
index eb57bf59084..d062b59a008 100644
--- a/mysql-test/r/create-big.result
+++ b/mysql-test/r/create-big.result
@@ -175,12 +175,12 @@ t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
-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 # use `test`; insert into t1 values (1)
-master-bin.000001 # Query 1 # use `test`; create table t2 like t1
-master-bin.000001 # Query 1 # use `test`; drop table t1
-master-bin.000001 # Query 1 # use `test`; drop table t2
+master-bin.000001 # Query # # use `test`; insert into t1 values (1)
+master-bin.000001 # Query # # use `test`; create table t2 like t1
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; drop table t2
create table t1 (i int);
set session debug="-d,sleep_create_like_before_check_if_exists:+d,sleep_create_like_before_copy";
create table t2 like t1;;
@@ -197,11 +197,11 @@ reset master;
create table t2 like t1;;
drop table t1;
drop table t2;
-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 # use `test`; create table t2 like t1
-master-bin.000001 # Query 1 # use `test`; drop table t1
-master-bin.000001 # Query 1 # use `test`; drop table t2
+master-bin.000001 # Query # # use `test`; create table t2 like t1
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; drop table t2
create table t1 (i int);
set session debug="-d,sleep_create_like_before_copy:+d,sleep_create_like_before_ha_create";
reset master;
@@ -213,16 +213,16 @@ drop table t2;
create table t2 like t1;;
drop table t1;
drop table t2;
-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 # use `test`; create table t2 like t1
-master-bin.000001 # Query 1 # use `test`; insert into t2 values (1)
-master-bin.000001 # Query 1 # use `test`; drop table t2
-master-bin.000001 # Query 1 # use `test`; create table t2 like t1
-master-bin.000001 # Query 1 # use `test`; drop table t2
-master-bin.000001 # Query 1 # use `test`; create table t2 like t1
-master-bin.000001 # Query 1 # use `test`; drop table t1
-master-bin.000001 # Query 1 # use `test`; drop table t2
+master-bin.000001 # Query # # use `test`; create table t2 like t1
+master-bin.000001 # Query # # use `test`; insert into t2 values (1)
+master-bin.000001 # Query # # use `test`; drop table t2
+master-bin.000001 # Query # # use `test`; create table t2 like t1
+master-bin.000001 # Query # # use `test`; drop table t2
+master-bin.000001 # Query # # use `test`; create table t2 like t1
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; drop table t2
create table t1 (i int);
set session debug="-d,sleep_create_like_before_ha_create:+d,sleep_create_like_before_binlogging";
reset master;
@@ -234,14 +234,14 @@ drop table t2;
create table t2 like t1;;
drop table t1;
drop table t2;
-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 # use `test`; create table t2 like t1
-master-bin.000001 # Query 1 # use `test`; insert into t2 values (1)
-master-bin.000001 # Query 1 # use `test`; drop table t2
-master-bin.000001 # Query 1 # use `test`; create table t2 like t1
-master-bin.000001 # Query 1 # use `test`; drop table t2
-master-bin.000001 # Query 1 # use `test`; create table t2 like t1
-master-bin.000001 # Query 1 # use `test`; drop table t1
-master-bin.000001 # Query 1 # use `test`; drop table t2
+master-bin.000001 # Query # # use `test`; create table t2 like t1
+master-bin.000001 # Query # # use `test`; insert into t2 values (1)
+master-bin.000001 # Query # # use `test`; drop table t2
+master-bin.000001 # Query # # use `test`; create table t2 like t1
+master-bin.000001 # Query # # use `test`; drop table t2
+master-bin.000001 # Query # # use `test`; create table t2 like t1
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; drop table t2
set session debug="-d,sleep_create_like_before_binlogging";
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index 044885d1ea7..8854a835e25 100644
--- a/mysql-test/r/ctype_cp932_binlog_stm.result
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
@@ -29,20 +29,20 @@ HEX(s1) HEX(s2) d
466F6F2773206120426172 ED40ED41ED42 47.93
DROP PROCEDURE bug18293|
DROP TABLE t4|
-SHOW BINLOG EVENTS FROM 370|
+show binlog events from <binlog_start>|
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 # Query # # 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 # Query # # 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 # Query # # 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 # Query # # use `test`; DROP PROCEDURE bug18293
+master-bin.000001 # Query # # use `test`; DROP TABLE t4
End of 5.0 tests
SHOW BINLOG EVENTS FROM 365;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index 77b2071494d..36025cbfb35 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -349,4 +349,13 @@ END |
DELETE IGNORE FROM t1;
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
DROP TABLE t1;
+#
+# Bug #53450: Crash/assertion
+# "virtual int ha_myisam::index_first(uchar*)") at assert.c:81
+#
+CREATE TABLE t1 (a INT, b INT, c INT,
+INDEX(a), INDEX(b), INDEX(c));
+INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9);
+DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result
index 27e51a33112..b6b79cb596b 100644
--- a/mysql-test/r/error_simulation.result
+++ b/mysql-test/r/error_simulation.result
@@ -39,5 +39,49 @@ a
2
DROP TABLE t1;
#
+# Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string
+#
+CREATE TABLE t1(a BLOB);
+SET SESSION debug="+d,bug42064_simulate_oom";
+INSERT INTO t1 VALUES("");
+Got one of the listed errors
+SET SESSION debug=DEFAULT;
+DROP TABLE t1;
+#
+# Bug#41660: Sort-index_merge for non-first join table may require
+# O(#scans) memory
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b));
+INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C;
+INSERT INTO t2 VALUES (1, 1, 'data');
+# the example query uses LEFT JOIN only for the sake of being able to
+# demonstrate the issue with a very small dataset. (left outer join
+# disables the use of join buffering, so we get the second table
+# re-scanned for every record in the outer table. if we used inner join,
+# we would need to have thousands of records and/or more columns in both
+# tables so that the join buffer is filled and re-scans are triggered).
+SET SESSION debug = '+d,only_one_Unique_may_be_created';
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+id select_type table type possible_keys key key_len ref rows Extra
+x x x x x x x x x
+x x x x x x x x x Using sort_union(a,b); Using where
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+a a b filler
+0 1 1 data
+1 1 1 data
+2 1 1 data
+3 1 1 data
+4 1 1 data
+5 1 1 data
+6 1 1 data
+7 1 1 data
+8 1 1 data
+9 1 1 data
+SET SESSION debug = DEFAULT;
+DROP TABLE t1, t2;
+#
# End of 5.1 tests
#
diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result
index 7dfd10a53f8..262caea3d7f 100644
--- a/mysql-test/r/events_scheduling.result
+++ b/mysql-test/r/events_scheduling.result
@@ -82,5 +82,24 @@ DROP TABLE table_1;
DROP TABLE table_2;
DROP TABLE table_3;
DROP TABLE table_4;
+
+Bug #50087 Interval arithmetic for Event_queue_element is not portable.
+
+CREATE TABLE t1(a int);
+CREATE EVENT e1 ON SCHEDULE EVERY 1 MONTH
+STARTS NOW() - INTERVAL 1 MONTH
+ENDS NOW() + INTERVAL 2 MONTH
+ON COMPLETION PRESERVE
+DO
+INSERT INTO t1 VALUES (1);
+CREATE EVENT e2 ON SCHEDULE EVERY 1 MONTH
+STARTS NOW()
+ENDS NOW() + INTERVAL 11 MONTH
+ON COMPLETION PRESERVE
+DO
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+DROP EVENT e1;
+DROP EVENT e2;
DROP DATABASE events_test;
SET GLOBAL event_scheduler=@event_scheduler;
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index 8f2d704b312..f46fe8daaad 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -238,4 +238,17 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t1, t2;
+#
+# Bug #48573: difference of index selection between rpm binary and
+# .tar.gz, windows vs linux..
+#
+CREATE TABLE t1(c1 INT, c2 INT, c4 INT, c5 INT, KEY(c2, c5), KEY(c2, c4, c5));
+INSERT INTO t1 VALUES(4, 1, 1, 1);
+INSERT INTO t1 VALUES(3, 1, 1, 1);
+INSERT INTO t1 VALUES(2, 1, 1, 1);
+INSERT INTO t1 VALUES(1, 1, 1, 1);
+EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c2,c2_2 c2 10 const,const 3 Using where
+DROP TABLE t1;
End of 5.1 tests.
diff --git a/mysql-test/r/flush_block_commit_notembedded.result b/mysql-test/r/flush_block_commit_notembedded.result
index c7fd7a11877..a81b1ce1e3a 100644
--- a/mysql-test/r/flush_block_commit_notembedded.result
+++ b/mysql-test/r/flush_block_commit_notembedded.result
@@ -7,15 +7,13 @@ SET AUTOCOMMIT=0;
INSERT t1 VALUES (1);
# Switch to connection con2
FLUSH TABLES WITH READ LOCK;
-SHOW MASTER STATUS;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 106
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
# Switch to connection con1
COMMIT;
# Switch to connection con2
-SHOW MASTER STATUS;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 106
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
UNLOCK TABLES;
# Switch to connection con1
DROP TABLE t1;
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index ffdacc43735..fdeec2755ca 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -750,4 +750,24 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t1;
#
+# Bug#54477: Crash on IN / CASE with NULL arguments
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT 1 IN (NULL, a) FROM t1;
+1 IN (NULL, a)
+1
+NULL
+SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP;
+a IN (a, a)
+1
+1
+NULL
+SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP;
+CASE a WHEN a THEN a END
+1
+2
+NULL
+DROP TABLE t1;
+#
End of 5.1 tests
diff --git a/mysql-test/r/func_isnull.result b/mysql-test/r/func_isnull.result
index 20ddc87ee78..c1f5849c091 100644
--- a/mysql-test/r/func_isnull.result
+++ b/mysql-test/r/func_isnull.result
@@ -5,3 +5,17 @@ flush tables;
select * from t1 where isnull(to_days(mydate));
id mydate
drop table t1;
+#
+# Bug#53933 crash when using uncacheable subquery in the having clause of outer query
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (0),(0);
+SELECT ISNULL((SELECT GET_LOCK('Bug#53933', 0) FROM t1 GROUP BY f1)) AS f2
+FROM t1 GROUP BY f1 HAVING f2 = f2;
+f2
+0
+SELECT RELEASE_LOCK('Bug#53933');
+RELEASE_LOCK('Bug#53933')
+1
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index 9338a76e320..21da211160b 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -169,3 +169,17 @@ select 'andre%' like 'andreÊ%' escape 'Ê';
select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê';
_cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê'
1
+End of 4.1 tests
+#
+# Bug #54575: crash when joining tables with unique set column
+#
+CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a));
+CREATE TABLE t2(b INT PRIMARY KEY);
+INSERT INTO t1 VALUES ();
+Warnings:
+Warning 1364 Field 'a' doesn't have a default value
+INSERT INTO t2 VALUES (1), (2), (3);
+SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a;
+1
+DROP TABLE t1, t2;
+End of 5.1 tests
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 90503300065..645dd460735 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1790,4 +1790,24 @@ aa b COUNT( b)
1 10 1
DROP TABLE t1, t2;
#
+# Bug#52051: Aggregate functions incorrectly returns NULL from outer
+# join query
+#
+CREATE TABLE t1 (a INT PRIMARY KEY);
+CREATE TABLE t2 (a INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1), (2);
+EXPLAIN SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+MIN(t2.a)
+1
+EXPLAIN SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+MAX(t2.a)
+2
+DROP TABLE t1, t2;
+#
# End of 5.1 tests
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index 01f27a498ef..6fef66b9d93 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2767,4 +2767,17 @@ SELECT MIN( a ) FROM t1 WHERE a IS NULL;
MIN( a )
NULL
DROP TABLE t1;
+#
+# Bug#53859: Valgrind: opt_sum_query(TABLE_LIST*, List<Item>&, Item*) at
+# opt_sum.cc:305
+#
+CREATE TABLE t1 ( a INT, KEY (a) );
+INSERT INTO t1 VALUES (1), (2), (3);
+SELECT MIN( a ) AS min_a
+FROM t1
+WHERE a > 1 AND a IS NULL
+ORDER BY min_a;
+min_a
+NULL
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/handler_myisam.result b/mysql-test/r/handler_myisam.result
index a970e20a2c0..b20b8dbb138 100644
--- a/mysql-test/r/handler_myisam.result
+++ b/mysql-test/r/handler_myisam.result
@@ -769,4 +769,97 @@ a
1
HANDLER t1 CLOSE;
DROP TABLE t1;
+#
+# Bug #54007: assert in ha_myisam::index_next , HANDLER
+#
+CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a), KEY b(b), KEY ab(a, b));
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+a b
+HANDLER t1 READ `PRIMARY` NEXT;
+a b
+HANDLER t1 READ ab NEXT;
+a b
+HANDLER t1 READ b NEXT;
+a b
+HANDLER t1 READ NEXT;
+a b
+HANDLER t1 CLOSE;
+INSERT INTO t1 VALUES (2, 20), (1, 10), (4, 40), (3, 30);
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+a b
+2 20
+HANDLER t1 READ NEXT;
+a b
+1 10
+HANDLER t1 READ `PRIMARY` NEXT;
+a b
+1 10
+HANDLER t1 READ `PRIMARY` NEXT;
+a b
+2 20
+HANDLER t1 READ ab NEXT;
+a b
+1 10
+HANDLER t1 READ ab NEXT;
+a b
+2 20
+HANDLER t1 READ b NEXT;
+a b
+1 10
+HANDLER t1 READ b NEXT;
+a b
+2 20
+HANDLER t1 READ b NEXT;
+a b
+3 30
+HANDLER t1 READ b NEXT;
+a b
+4 40
+HANDLER t1 READ b NEXT;
+a b
+HANDLER t1 READ NEXT;
+a b
+4 40
+HANDLER t1 READ NEXT;
+a b
+3 30
+HANDLER t1 READ NEXT;
+a b
+HANDLER t1 CLOSE;
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+a b
+2 20
+HANDLER t1 READ `PRIMARY` PREV;
+a b
+4 40
+HANDLER t1 READ `PRIMARY` PREV;
+a b
+3 30
+HANDLER t1 READ b PREV;
+a b
+4 40
+HANDLER t1 READ b PREV;
+a b
+3 30
+HANDLER t1 CLOSE;
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+a b
+2 20
+HANDLER t1 READ `PRIMARY` PREV LIMIT 3;
+a b
+4 40
+3 30
+2 20
+HANDLER t1 READ b NEXT LIMIT 5;
+a b
+1 10
+2 20
+3 30
+4 40
+HANDLER t1 CLOSE;
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 9d5b6b25ff4..ee8b91631bb 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1654,4 +1654,14 @@ COUNT(*)
DROP USER nonpriv;
DROP TABLE db1.t1;
DROP DATABASE db1;
+
+Bug#54422 query with = 'variables'
+
+CREATE TABLE variables(f1 INT);
+SELECT COLUMN_DEFAULT, TABLE_NAME
+FROM INFORMATION_SCHEMA.COLUMNS
+WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables';
+COLUMN_DEFAULT TABLE_NAME
+NULL variables
+DROP TABLE variables;
End of 5.1 tests.
diff --git a/mysql-test/r/information_schema_all_engines.result b/mysql-test/r/information_schema_all_engines.result
index d3ff92544f2..dfe7570266c 100644
--- a/mysql-test/r/information_schema_all_engines.result
+++ b/mysql-test/r/information_schema_all_engines.result
@@ -108,7 +108,7 @@ XTRADB_ENHANCEMENTS name
INNODB_BUFFER_POOL_PAGES_INDEX schema_name
XTRADB_ADMIN_COMMAND result_message
INNODB_TRX trx_id
-INNODB_SYS_TABLES NAME
+INNODB_SYS_TABLES SCHEMA
INNODB_LOCK_WAITS requesting_trx_id
INNODB_CMPMEM_RESET page_size
INNODB_LOCKS lock_id
@@ -174,7 +174,7 @@ XTRADB_ENHANCEMENTS name
INNODB_BUFFER_POOL_PAGES_INDEX schema_name
XTRADB_ADMIN_COMMAND result_message
INNODB_TRX trx_id
-INNODB_SYS_TABLES NAME
+INNODB_SYS_TABLES SCHEMA
INNODB_LOCK_WAITS requesting_trx_id
INNODB_CMPMEM_RESET page_size
INNODB_LOCKS lock_id
diff --git a/mysql-test/r/innodb-index.result b/mysql-test/r/innodb-index.result
deleted file mode 100644
index 9d199bb7260..00000000000
--- a/mysql-test/r/innodb-index.result
+++ /dev/null
@@ -1,1173 +0,0 @@
-create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
-insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak');
-commit;
-alter table t1 add index b (b), add index b (b);
-ERROR 42000: Duplicate key name 'b'
-alter table t1 add index (b,b);
-ERROR 42S21: Duplicate column name 'b'
-alter table t1 add index d2 (d);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- KEY `d2` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-explain select * from t1 force index(d2) order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL d2 23 NULL 4
-select * from t1 force index (d2) order by d;
-a b c d
-3 4 ad ad
-2 3 ak ak
-5 5 oo oo
-4 4 tr tr
-alter table t1 add unique index (b);
-ERROR 23000: Duplicate entry '4' for key 'b'
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- KEY `d2` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 add index (b);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- KEY `d2` (`d`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB;
-call mtr.add_suppression(" table `test`\\.`t1#[12]` already exists in InnoDB internal");
-alter table t1 add unique index (c), add index (d);
-ERROR HY000: Table 'test.t1#1' already exists
-rename table `t1#1` to `t1#2`;
-alter table t1 add unique index (c), add index (d);
-ERROR HY000: Table 'test.t1#2' already exists
-drop table `t1#2`;
-alter table t1 add unique index (c), add index (d);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- UNIQUE KEY `c` (`c`),
- KEY `d2` (`d`),
- KEY `b` (`b`),
- KEY `d` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 10 NULL 4
-alter table t1 add primary key (a), drop index c;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `d2` (`d`),
- KEY `b` (`b`),
- KEY `d` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 add primary key (c);
-ERROR 42000: Multiple primary key defined
-alter table t1 drop primary key, add primary key (b);
-ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
-create unique index c on t1 (c);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `c` (`c`),
- KEY `d2` (`d`),
- KEY `b` (`b`),
- KEY `d` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 10 NULL 4
-select * from t1 force index(c) order by c;
-a b c d
-3 4 ad ad
-2 3 ak ak
-5 5 oo oo
-4 4 tr tr
-alter table t1 drop index b, add index (b);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `c` (`c`),
- KEY `d2` (`d`),
- KEY `d` (`d`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-insert into t1 values(6,1,'ggg','ggg');
-select * from t1;
-a b c d
-2 3 ak ak
-3 4 ad ad
-4 4 tr tr
-5 5 oo oo
-6 1 ggg ggg
-select * from t1 force index(b) order by b;
-a b c d
-6 1 ggg ggg
-2 3 ak ak
-3 4 ad ad
-4 4 tr tr
-5 5 oo oo
-select * from t1 force index(c) order by c;
-a b c d
-3 4 ad ad
-2 3 ak ak
-6 1 ggg ggg
-5 5 oo oo
-4 4 tr tr
-select * from t1 force index(d) order by d;
-a b c d
-3 4 ad ad
-2 3 ak ak
-6 1 ggg ggg
-5 5 oo oo
-4 4 tr tr
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 5 NULL 5
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 10 NULL 5
-explain select * from t1 force index(d) order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL d 23 NULL 5
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `c` (`c`),
- KEY `d2` (`d`),
- KEY `d` (`d`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add index (c(2));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `c` (`c`(2))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 add unique index (d(10));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `d` (`d`(10)),
- KEY `c` (`c`(2))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-insert into t1 values(5,1,'ggg','ggg');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 3 ad ad
-4 4 afe afe
-5 1 ggg ggg
-select * from t1 force index(c) order by c;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 3 ad ad
-4 4 afe afe
-5 1 ggg ggg
-select * from t1 force index(d) order by d;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 3 ad ad
-4 4 afe afe
-5 1 ggg ggg
-explain select * from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
-explain select * from t1 force index(d) order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `d` (`d`(10)),
- KEY `c` (`c`(2))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 drop index d;
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 3 ad ad
-4 4 afe afe
-5 1 ggg ggg
-8 9 fff fff
-select * from t1 force index(c) order by c;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 3 ad ad
-4 4 afe afe
-8 9 fff fff
-5 1 ggg ggg
-explain select * from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
-explain select * from t1 order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `c` (`c`(2))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add unique index (b,c);
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 16 NULL 5
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `b` (`b`,`c`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 add index (b,c);
-insert into t1 values(11,11,'kkk','kkk');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-11 11 kkk kkk
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-11 11 kkk kkk
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 16 NULL 6
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `b` (`b`,`c`),
- KEY `b_2` (`b`,`c`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 add unique index (c,d);
-insert into t1 values(13,13,'yyy','aaa');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-11 11 kkk kkk
-13 13 yyy aaa
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-11 11 kkk kkk
-13 13 yyy aaa
-select * from t1 force index(c) order by c;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-11 11 kkk kkk
-13 13 yyy aaa
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 16 NULL 7
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 34 NULL 7
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `b` (`b`,`c`),
- UNIQUE KEY `c` (`c`,`d`),
- KEY `b_2` (`b`,`c`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int not null, c int, primary key (a), key (b)) engine = innodb;
-create table t3(a int not null, c int not null, d int, primary key (a), key (c)) engine = innodb;
-create table t4(a int not null, d int not null, e int, primary key (a), key (d)) engine = innodb;
-create table t2(a int not null, b int not null, c int not null, d int not null, e int,
-foreign key (b) references t1(b) on delete cascade,
-foreign key (c) references t3(c), foreign key (d) references t4(d))
-engine = innodb;
-alter table t1 drop index b;
-ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint
-alter table t3 drop index c;
-ERROR HY000: Cannot drop index 'c': needed in a foreign key constraint
-alter table t4 drop index d;
-ERROR HY000: Cannot drop index 'd': needed in a foreign key constraint
-alter table t2 drop index b;
-ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint
-alter table t2 drop index b, drop index c, drop index d;
-ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint
-create unique index dc on t2 (d,c);
-create index dc on t1 (b,c);
-alter table t2 add primary key (a);
-insert into t1 values (1,1,1);
-insert into t3 values (1,1,1);
-insert into t4 values (1,1,1);
-insert into t2 values (1,1,1,1,1);
-commit;
-alter table t4 add constraint dc foreign key (a) references t1(a);
-show create table t4;
-Table Create Table
-t4 CREATE TABLE `t4` (
- `a` int(11) NOT NULL,
- `d` int(11) NOT NULL,
- `e` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `d` (`d`),
- CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t3 add constraint dc foreign key (a) references t1(a);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 121)
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `a` int(11) NOT NULL,
- `c` int(11) NOT NULL,
- `d` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `c` (`c`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t2 drop index b, add index (b);
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) NOT NULL,
- `b` int(11) NOT NULL,
- `c` int(11) NOT NULL,
- `d` int(11) NOT NULL,
- `e` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `dc` (`d`,`c`),
- KEY `c` (`c`),
- KEY `b` (`b`),
- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`b`) ON DELETE CASCADE,
- CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t3` (`c`),
- CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`d`) REFERENCES `t4` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-delete from t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
-drop index dc on t4;
-ERROR 42000: Can't DROP 'dc'; check that column/key exists
-alter table t3 drop foreign key dc;
-ERROR HY000: Error on rename of './test/t3' to './#sql2-temporary' (errno: 152)
-alter table t4 drop foreign key dc;
-select * from t2;
-a b c d e
-1 1 1 1 1
-delete from t1;
-select * from t2;
-a b c d e
-drop table t2,t4,t3,t1;
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=utf8;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add unique index (b);
-ERROR 23000: Duplicate entry '2' for key 'b'
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-alter table t1 add index (b);
-insert into t1 values(10,10,'kkk','iii');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 5 NULL 6
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-alter table t1 add unique index (c), add index (d);
-insert into t1 values(11,11,'aaa','mmm');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-select * from t1 force index(c) order by c;
-a b c d
-11 11 aaa mmm
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-select * from t1 force index(d) order by d;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 5 NULL 7
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 31 NULL 7
-explain select * from t1 force index(d) order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL d 63 NULL 7
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `c` (`c`),
- KEY `b` (`b`),
- KEY `d` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-drop table t1;
-create table t1(a int not null, b int) engine = innodb;
-insert into t1 values (1,1),(1,1),(1,1),(1,1);
-alter table t1 add unique index (a);
-ERROR 23000: Duplicate entry '1' for key 'a'
-alter table t1 add unique index (b);
-ERROR 23000: Duplicate entry '1' for key 'b'
-alter table t1 add unique index (a), add unique index(b);
-ERROR 23000: Duplicate entry '1' for key 'a'
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, c int not null,b int, primary key(a), unique key(c), key(b)) engine = innodb;
-alter table t1 drop index c, drop index b;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `c` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int, primary key(a)) engine = innodb;
-alter table t1 add index (b);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
-alter table t1 add unique index (b), add unique index (c), add unique index (d);
-ERROR 23000: Duplicate entry 'ac' for key 'c'
-alter table t1 add unique index (c), add unique index (b), add index (d);
-ERROR 23000: Duplicate entry 'ac' for key 'c'
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb;
-insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1);
-alter table t1 add unique index (b);
-insert into t1 values (10,20,20),(11,19,19),(12,18,18),(13,17,17);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) NOT NULL,
- `c` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `b` (`b`),
- KEY `c` (`c`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 5 NULL 9
-explain select * from t1 order by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL 9
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 4 NULL 9
-select * from t1 order by a;
-a b c
-1 5 1
-2 4 2
-3 3 3
-4 2 4
-5 1 5
-10 20 20
-11 19 19
-12 18 18
-13 17 17
-select * from t1 force index(b) order by b;
-a b c
-5 1 5
-4 2 4
-3 3 3
-2 4 2
-1 5 1
-13 17 17
-12 18 18
-11 19 19
-10 20 20
-select * from t1 force index(c) order by c;
-a b c
-1 5 1
-2 4 2
-3 3 3
-4 2 4
-5 1 5
-13 17 17
-12 18 18
-11 19 19
-10 20 20
-drop table t1;
-create table t1(a int not null, b int not null) engine=innodb;
-insert into t1 values (1,1);
-alter table t1 add primary key(b);
-insert into t1 values (2,2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) NOT NULL,
- PRIMARY KEY (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-select * from t1;
-a b
-1 1
-2 2
-explain select * from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2
-explain select * from t1 order by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using filesort
-explain select * from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL 2
-checksum table t1;
-Table Checksum
-test.t1 582702641
-drop table t1;
-create table t1(a int not null) engine=innodb;
-insert into t1 values (1);
-alter table t1 add primary key(a);
-insert into t1 values (2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-commit;
-select * from t1;
-a
-1
-2
-explain select * from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index
-explain select * from t1 order by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index
-drop table t1;
-create table t2(d varchar(17) primary key) engine=innodb default charset=utf8;
-create table t3(a int primary key) engine=innodb;
-insert into t3 values(22),(44),(33),(55),(66);
-insert into t2 values ('jejdkrun87'),('adfd72nh9k'),
-('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik');
-create table t1(a int, b blob, c text, d text not null)
-engine=innodb default charset = utf8;
-insert into t1
-select a,left(repeat(d,100*a),65535),repeat(d,20*a),d from t2,t3;
-drop table t2, t3;
-select count(*) from t1 where a=44;
-count(*)
-5
-select a,
-length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1;
-a length(b) b=left(repeat(d,100*a),65535) length(c) c=repeat(d,20*a) d
-22 22000 1 4400 1 adfd72nh9k
-22 35200 1 7040 1 adfdijn0loKNHJik
-22 28600 1 5720 1 adfdijnmnb78k
-22 26400 1 5280 1 adfdpplkeock
-22 22000 1 4400 1 jejdkrun87
-33 33000 1 6600 1 adfd72nh9k
-33 52800 1 10560 1 adfdijn0loKNHJik
-33 42900 1 8580 1 adfdijnmnb78k
-33 39600 1 7920 1 adfdpplkeock
-33 33000 1 6600 1 jejdkrun87
-44 44000 1 8800 1 adfd72nh9k
-44 65535 1 14080 1 adfdijn0loKNHJik
-44 57200 1 11440 1 adfdijnmnb78k
-44 52800 1 10560 1 adfdpplkeock
-44 44000 1 8800 1 jejdkrun87
-55 55000 1 11000 1 adfd72nh9k
-55 65535 1 17600 1 adfdijn0loKNHJik
-55 65535 1 14300 1 adfdijnmnb78k
-55 65535 1 13200 1 adfdpplkeock
-55 55000 1 11000 1 jejdkrun87
-66 65535 1 13200 1 adfd72nh9k
-66 65535 1 21120 1 adfdijn0loKNHJik
-66 65535 1 17160 1 adfdijnmnb78k
-66 65535 1 15840 1 adfdpplkeock
-66 65535 1 13200 1 jejdkrun87
-alter table t1 add primary key (a), add key (b(20));
-ERROR 23000: Duplicate entry '22' for key 'PRIMARY'
-delete from t1 where a%2;
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-alter table t1 add primary key (a,b(255),c(255)), add key (b(767));
-select count(*) from t1 where a=44;
-count(*)
-5
-select a,
-length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1;
-a length(b) b=left(repeat(d,100*a),65535) length(c) c=repeat(d,20*a) d
-22 22000 1 4400 1 adfd72nh9k
-22 35200 1 7040 1 adfdijn0loKNHJik
-22 28600 1 5720 1 adfdijnmnb78k
-22 26400 1 5280 1 adfdpplkeock
-22 22000 1 4400 1 jejdkrun87
-44 44000 1 8800 1 adfd72nh9k
-44 65535 1 14080 1 adfdijn0loKNHJik
-44 57200 1 11440 1 adfdijnmnb78k
-44 52800 1 10560 1 adfdpplkeock
-44 44000 1 8800 1 jejdkrun87
-66 65535 1 13200 1 adfd72nh9k
-66 65535 1 21120 1 adfdijn0loKNHJik
-66 65535 1 17160 1 adfdijnmnb78k
-66 65535 1 15840 1 adfdpplkeock
-66 65535 1 13200 1 jejdkrun87
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` blob NOT NULL,
- `c` text NOT NULL,
- `d` text NOT NULL,
- PRIMARY KEY (`a`,`b`(255),`c`(255)),
- KEY `b` (`b`(767))
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-explain select * from t1 where b like 'adfd%';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL b NULL NULL NULL 15 Using where
-create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
-insert into t2 select a,left(b,255) from t1;
-drop table t1;
-rename table t2 to t1;
-set innodb_lock_wait_timeout=1;
-begin;
-select a from t1 limit 1 for update;
-a
-22
-set innodb_lock_wait_timeout=1;
-create index t1ba on t1 (b,a);
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-commit;
-begin;
-select a from t1 limit 1 lock in share mode;
-a
-22
-create index t1ba on t1 (b,a);
-drop index t1ba on t1;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-commit;
-explain select a from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL t1ba 261 NULL 15 Using index
-select a,sleep(2+a/100) from t1 order by b limit 3;
-select sleep(1);
-sleep(1)
-0
-drop index t1ba on t1;
-a sleep(2+a/100)
-22 0
-44 0
-66 0
-explain select a from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 261 NULL 15 Using index; Using filesort
-select a from t1 order by b limit 3;
-a
-22
-66
-44
-commit;
-drop table t1;
-set global innodb_file_per_table=on;
-set global innodb_file_format='Barracuda';
-create table t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
-i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob,
-q blob,r blob,s blob,t blob,u blob)
-engine=innodb row_format=dynamic;
-create index t1a on t1 (a(1));
-create index t1b on t1 (b(1));
-create index t1c on t1 (c(1));
-create index t1d on t1 (d(1));
-create index t1e on t1 (e(1));
-create index t1f on t1 (f(1));
-create index t1g on t1 (g(1));
-create index t1h on t1 (h(1));
-create index t1i on t1 (i(1));
-create index t1j on t1 (j(1));
-create index t1k on t1 (k(1));
-create index t1l on t1 (l(1));
-create index t1m on t1 (m(1));
-create index t1n on t1 (n(1));
-create index t1o on t1 (o(1));
-create index t1p on t1 (p(1));
-create index t1q on t1 (q(1));
-create index t1r on t1 (r(1));
-create index t1s on t1 (s(1));
-create index t1t on t1 (t(1));
-create index t1u on t1 (u(1));
-ERROR HY000: Too big row
-create index t1ut on t1 (u(1), t(1));
-ERROR HY000: Too big row
-create index t1st on t1 (s(1), t(1));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` blob,
- `b` blob,
- `c` blob,
- `d` blob,
- `e` blob,
- `f` blob,
- `g` blob,
- `h` blob,
- `i` blob,
- `j` blob,
- `k` blob,
- `l` blob,
- `m` blob,
- `n` blob,
- `o` blob,
- `p` blob,
- `q` blob,
- `r` blob,
- `s` blob,
- `t` blob,
- `u` blob,
- KEY `t1a` (`a`(1)),
- KEY `t1b` (`b`(1)),
- KEY `t1c` (`c`(1)),
- KEY `t1d` (`d`(1)),
- KEY `t1e` (`e`(1)),
- KEY `t1f` (`f`(1)),
- KEY `t1g` (`g`(1)),
- KEY `t1h` (`h`(1)),
- KEY `t1i` (`i`(1)),
- KEY `t1j` (`j`(1)),
- KEY `t1k` (`k`(1)),
- KEY `t1l` (`l`(1)),
- KEY `t1m` (`m`(1)),
- KEY `t1n` (`n`(1)),
- KEY `t1o` (`o`(1)),
- KEY `t1p` (`p`(1)),
- KEY `t1q` (`q`(1)),
- KEY `t1r` (`r`(1)),
- KEY `t1s` (`s`(1)),
- KEY `t1t` (`t`(1)),
- KEY `t1st` (`s`(1),`t`(1))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
-create index t1u on t1 (u(1));
-ERROR HY000: Too big row
-alter table t1 row_format=compact;
-create index t1u on t1 (u(1));
-drop table t1;
-set global innodb_file_per_table=0;
-set global innodb_file_format=Antelope;
-set global innodb_file_format_check=Antelope;
-SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
-SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
-CREATE TABLE t1(
-c1 BIGINT(12) NOT NULL,
-PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-CREATE TABLE t2(
-c1 BIGINT(16) NOT NULL,
-c2 BIGINT(12) NOT NULL,
-c3 BIGINT(12) NOT NULL,
-PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3) REFERENCES t1(c1);
-SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
-SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `fk_t2_ca` (`c3`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `i_t2_c3_c2` (`c3`,`c2`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
-SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-INSERT INTO t2 VALUES(0,0,0);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`))
-INSERT INTO t1 VALUES(0);
-INSERT INTO t2 VALUES(0,0,0);
-DROP TABLE t2;
-CREATE TABLE t2(
-c1 BIGINT(16) NOT NULL,
-c2 BIGINT(12) NOT NULL,
-c3 BIGINT(12) NOT NULL,
-PRIMARY KEY (c1,c2,c3)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3) REFERENCES t1(c1);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`,`c2`,`c3`),
- KEY `fk_t2_ca` (`c3`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`,`c2`,`c3`),
- KEY `i_t2_c3_c2` (`c3`,`c2`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-INSERT INTO t2 VALUES(0,0,1);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`))
-INSERT INTO t2 VALUES(0,0,0);
-DELETE FROM t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`))
-DELETE FROM t2;
-DROP TABLE t2;
-DROP TABLE t1;
-CREATE TABLE t1(
-c1 BIGINT(12) NOT NULL,
-c2 INT(4) NOT NULL,
-PRIMARY KEY (c2,c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-CREATE TABLE t2(
-c1 BIGINT(16) NOT NULL,
-c2 BIGINT(12) NOT NULL,
-c3 BIGINT(12) NOT NULL,
-PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
-ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL;
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `c1` bigint(12) NOT NULL,
- `c2` bigint(12) NOT NULL,
- PRIMARY KEY (`c2`,`c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `fk_t2_ca` (`c3`,`c2`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE INDEX i_t2_c2_c1 ON t2(c2, c1);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `fk_t2_ca` (`c3`,`c2`),
- KEY `i_t2_c2_c1` (`c2`,`c1`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE INDEX i_t2_c3_c1_c2 ON t2(c3, c1, c2);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `fk_t2_ca` (`c3`,`c2`),
- KEY `i_t2_c2_c1` (`c2`,`c1`),
- KEY `i_t2_c3_c1_c2` (`c3`,`c1`,`c2`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `i_t2_c2_c1` (`c2`,`c1`),
- KEY `i_t2_c3_c1_c2` (`c3`,`c1`,`c2`),
- KEY `i_t2_c3_c2` (`c3`,`c2`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-DROP TABLE t2;
-DROP TABLE t1;
-call mtr.add_suppression("InnoDB: insufficient history for index");
-CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
-BEGIN;
-SELECT * FROM t1;
-a b
-3 a
-3 b
-1 c
-0 d
-1 e
-CREATE INDEX t1a ON t1(a);
-SELECT * FROM t1;
-a b
-3 a
-3 b
-1 c
-0 d
-1 e
-SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
-ERROR HY000: Table definition has changed, please retry transaction
-SELECT * FROM t1;
-a b
-3 a
-3 b
-1 c
-0 d
-1 e
-COMMIT;
-SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
-a b
-0 d
-1 c
-1 e
-3 a
-3 b
-DROP TABLE t1;
diff --git a/mysql-test/r/innodb-use-sys-malloc.result b/mysql-test/r/innodb-use-sys-malloc.result
deleted file mode 100644
index 2ec4c7c8130..00000000000
--- a/mysql-test/r/innodb-use-sys-malloc.result
+++ /dev/null
@@ -1,48 +0,0 @@
-SELECT @@GLOBAL.innodb_use_sys_malloc;
-@@GLOBAL.innodb_use_sys_malloc
-1
-1 Expected
-SET @@GLOBAL.innodb_use_sys_malloc=0;
-ERROR HY000: Variable 'innodb_use_sys_malloc' is a read only variable
-Expected error 'Read only variable'
-SELECT @@GLOBAL.innodb_use_sys_malloc;
-@@GLOBAL.innodb_use_sys_malloc
-1
-1 Expected
-drop table if exists t1;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
-select * from t1;
-a
-1
-2
-3
-4
-5
-6
-7
-drop table t1;
-SELECT @@GLOBAL.innodb_use_sys_malloc;
-@@GLOBAL.innodb_use_sys_malloc
-1
-1 Expected
-SET @@GLOBAL.innodb_use_sys_malloc=0;
-ERROR HY000: Variable 'innodb_use_sys_malloc' is a read only variable
-Expected error 'Read only variable'
-SELECT @@GLOBAL.innodb_use_sys_malloc;
-@@GLOBAL.innodb_use_sys_malloc
-1
-1 Expected
-drop table if exists t1;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
-select * from t1;
-a
-1
-2
-3
-4
-5
-6
-7
-drop table t1;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 9cfa825447b..718e363adb7 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -691,14 +691,16 @@ count(*)
select count(*) from t1 where sca_pic is null;
count(*)
2
-alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
+alter table t1 drop index sca_pic;
+alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
select count(*) from t1 where cat_code='E';
count(*)
0
-alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
+alter table t1 drop index sca_pic;
+alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
@@ -1508,7 +1510,7 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop index id2 on t2;
drop index id on t2;
-Got one of the listed errors
+ERROR HY000: Cannot drop index 'id': needed in a foreign key constraint
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
diff --git a/mysql-test/r/innodb_mysql_lock2.result b/mysql-test/r/innodb_mysql_lock2.result
new file mode 100644
index 00000000000..79606ea8bdc
--- /dev/null
+++ b/mysql-test/r/innodb_mysql_lock2.result
@@ -0,0 +1,601 @@
+#
+# Test how do we handle locking in various cases when
+# we read data from InnoDB tables.
+#
+# In fact by performing this test we check two things:
+# 1) That SQL-layer correctly determine type of thr_lock.c
+# lock to be acquired/passed to InnoDB engine.
+# 2) That InnoDB engine correctly interprets this lock
+# type and takes necessary row locks or does not
+# take them if they are not necessary.
+#
+# This test makes sense only in REPEATABLE-READ mode as
+# in SERIALIZABLE mode all statements that read data take
+# shared lock on them to enforce its semantics.
+select @@session.tx_isolation;
+@@session.tx_isolation
+REPEATABLE-READ
+# Prepare playground by creating tables, views,
+# routines and triggers used in tests.
+drop table if exists t0, t1, t2, t3, t4, t5, te;
+drop view if exists v1, v2;
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop function if exists f1;
+drop function if exists f2;
+drop function if exists f3;
+drop function if exists f4;
+drop function if exists f5;
+drop function if exists f6;
+drop function if exists f7;
+drop function if exists f8;
+drop function if exists f9;
+drop function if exists f10;
+drop function if exists f11;
+drop function if exists f12;
+drop function if exists f13;
+drop function if exists f14;
+drop function if exists f15;
+create table t1 (i int primary key) engine=innodb;
+insert into t1 values (1), (2), (3), (4), (5);
+create table t2 (j int primary key) engine=innodb;
+insert into t2 values (1), (2), (3), (4), (5);
+create table t3 (k int primary key) engine=innodb;
+insert into t3 values (1), (2), (3);
+create table t4 (l int primary key) engine=innodb;
+insert into t4 values (1);
+create table t5 (l int primary key) engine=innodb;
+insert into t5 values (1);
+create table te(e int primary key);
+insert into te values (1);
+create view v1 as select i from t1;
+create view v2 as select j from t2 where j in (select i from t1);
+create procedure p1(k int) insert into t2 values (k);
+create function f1() returns int
+begin
+declare j int;
+select i from t1 where i = 1 into j;
+return j;
+end|
+create function f2() returns int
+begin
+declare k int;
+select i from t1 where i = 1 into k;
+insert into t2 values (k + 5);
+return 0;
+end|
+create function f3() returns int
+begin
+return (select i from t1 where i = 3);
+end|
+create function f4() returns int
+begin
+if (select i from t1 where i = 3) then
+return 1;
+else
+return 0;
+end if;
+end|
+create function f5() returns int
+begin
+insert into t2 values ((select i from t1 where i = 1) + 5);
+return 0;
+end|
+create function f6() returns int
+begin
+declare k int;
+select i from v1 where i = 1 into k;
+return k;
+end|
+create function f7() returns int
+begin
+declare k int;
+select j from v2 where j = 1 into k;
+return k;
+end|
+create function f8() returns int
+begin
+declare k int;
+select i from v1 where i = 1 into k;
+insert into t2 values (k+5);
+return k;
+end|
+create function f9() returns int
+begin
+update v2 set j=j+10 where j=1;
+return 1;
+end|
+create function f10() returns int
+begin
+return f1();
+end|
+create function f11() returns int
+begin
+declare k int;
+set k= f1();
+insert into t2 values (k+5);
+return k;
+end|
+create function f12(p int) returns int
+begin
+insert into t2 values (p);
+return p;
+end|
+create function f13(p int) returns int
+begin
+return p;
+end|
+create procedure p2(inout p int)
+begin
+select i from t1 where i = 1 into p;
+end|
+create function f14() returns int
+begin
+declare k int;
+call p2(k);
+insert into t2 values (k+5);
+return k;
+end|
+create function f15() returns int
+begin
+declare k int;
+call p2(k);
+return k;
+end|
+create trigger t4_bi before insert on t4 for each row
+begin
+declare k int;
+select i from t1 where i=1 into k;
+set new.l= k+1;
+end|
+create trigger t4_bu before update on t4 for each row
+begin
+if (select i from t1 where i=1) then
+set new.l= 2;
+end if;
+end|
+# Trigger below uses insertion of duplicate key in 'te'
+# table as a way to abort delete operation.
+create trigger t4_bd before delete on t4 for each row
+begin
+if !(select i from v1 where i=1) then
+insert into te values (1);
+end if;
+end|
+create trigger t5_bi before insert on t5 for each row
+begin
+set new.l= f1()+1;
+end|
+create trigger t5_bu before update on t5 for each row
+begin
+declare j int;
+call p2(j);
+set new.l= j + 1;
+end|
+#
+# Set common variables to be used by scripts called below.
+#
+#
+# 1. Statements that read tables and do not use subqueries.
+#
+#
+# 1.1 Simple SELECT statement.
+#
+# No locks are necessary as this statement won't be written
+# to the binary log and InnoDB supports snapshots.
+Success: 'select * from t1' doesn't take row locks on 't1'.
+#
+# 1.2 Multi-UPDATE statement.
+#
+# Has to take shared locks on rows in the table being read as this
+# statement will be written to the binary log and therefore should
+# be serialized with concurrent statements.
+Success: 'update t2, t1 set j= j - 1 where i = j' takes shared row locks on 't1'.
+#
+# 1.3 Multi-DELETE statement.
+#
+# The above is true for this statement as well.
+Success: 'delete t2 from t1, t2 where i = j' takes shared row locks on 't1'.
+#
+# 1.4 DESCRIBE statement.
+#
+# This statement does not really read data from the
+# target table and thus does not take any lock on it.
+# We check this for completeness of coverage.
+Success: 'describe t1' doesn't take row locks on 't1'.
+#
+# 1.5 SHOW statements.
+#
+# The above is true for SHOW statements as well.
+Success: 'show create table t1' doesn't take row locks on 't1'.
+Success: 'show keys from t1' doesn't take row locks on 't1'.
+#
+# 2. Statements which read tables through subqueries.
+#
+#
+# 2.1 CALL with a subquery.
+#
+# A strong lock is not necessary as this statement is not
+# written to the binary log as a whole (it is written
+# statement-by-statement) and thanks to MVCC we can always get
+# versions of rows prior to the update that has locked them.
+# But in practice InnoDB does locking reads for all statements
+# other than SELECT (unless it is a READ-COMITTED mode or
+# innodb_locks_unsafe_for_binlog is ON).
+Success: 'call p1((select i + 5 from t1 where i = 1))' takes shared row locks on 't1'.
+#
+# 2.2 CREATE TABLE with a subquery.
+#
+# Has to take shared locks on rows in the table being read as
+# this statement is written to the binary log and therefore
+# should be serialized with concurrent statements.
+Success: 'create table t0 engine=innodb select * from t1' takes shared row locks on 't1'.
+drop table t0;
+Success: 'create table t0 engine=innodb select j from t2 where j in (select i from t1)' takes shared row locks on 't1'.
+drop table t0;
+#
+# 2.3 DELETE with a subquery.
+#
+# The above is true for this statement as well.
+Success: 'delete from t2 where j in (select i from t1)' takes shared row locks on 't1'.
+#
+# 2.4 MULTI-DELETE with a subquery.
+#
+# Same is true for this statement as well.
+Success: 'delete t2 from t3, t2 where k = j and j in (select i from t1)' takes shared row locks on 't1'.
+#
+# 2.5 DO with a subquery.
+#
+# In theory should not take row locks as it is not logged.
+# In practice InnoDB takes shared row locks.
+Success: 'do (select i from t1 where i = 1)' takes shared row locks on 't1'.
+#
+# 2.6 INSERT with a subquery.
+#
+# Has to take shared locks on rows in the table being read as
+# this statement is written to the binary log and therefore
+# should be serialized with concurrent statements.
+Success: 'insert into t2 select i+5 from t1' takes shared row locks on 't1'.
+Success: 'insert into t2 values ((select i+5 from t1 where i = 4))' takes shared row locks on 't1'.
+#
+# 2.7 LOAD DATA with a subquery.
+#
+# The above is true for this statement as well.
+Success: 'load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1)' takes shared row locks on 't1'.
+#
+# 2.8 REPLACE with a subquery.
+#
+# Same is true for this statement as well.
+Success: 'replace into t2 select i+5 from t1' takes shared row locks on 't1'.
+Success: 'replace into t2 values ((select i+5 from t1 where i = 4))' takes shared row locks on 't1'.
+#
+# 2.9 SELECT with a subquery.
+#
+# Locks are not necessary as this statement is not written
+# to the binary log and thanks to MVCC we can always get
+# versions of rows prior to the update that has locked them.
+#
+# Also serves as a test case for bug #46947 "Embedded SELECT
+# without FOR UPDATE is causing a lock".
+Success: 'select * from t2 where j in (select i from t1)' doesn't take row locks on 't1'.
+#
+# 2.10 SET with a subquery.
+#
+# In theory should not require locking as it is not written
+# to the binary log. In practice InnoDB acquires shared row
+# locks.
+Success: 'set @a:= (select i from t1 where i = 1)' takes shared row locks on 't1'.
+#
+# 2.11 SHOW with a subquery.
+#
+# Similarly to the previous case, in theory should not require locking
+# as it is not written to the binary log. In practice InnoDB
+# acquires shared row locks.
+Success: 'show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1)' takes shared row locks on 't1'.
+Success: 'show columns from t2 where (select i from t1 where i = 1)' takes shared row locks on 't1'.
+#
+# 2.12 UPDATE with a subquery.
+#
+# Has to take shared locks on rows in the table being read as
+# this statement is written to the binary log and therefore
+# should be serialized with concurrent statements.
+Success: 'update t2 set j= j-10 where j in (select i from t1)' takes shared row locks on 't1'.
+#
+# 2.13 MULTI-UPDATE with a subquery.
+#
+# Same is true for this statement as well.
+Success: 'update t2, t3 set j= j -10 where j=k and j in (select i from t1)' takes shared row locks on 't1'.
+#
+# 3. Statements which read tables through a view.
+#
+#
+# 3.1 SELECT statement which uses some table through a view.
+#
+# Since this statement is not written to the binary log
+# and old version of rows are accessible thanks to MVCC,
+# no locking is necessary.
+Success: 'select * from v1' doesn't take row locks on 't1'.
+Success: 'select * from v2' doesn't take row locks on 't1'.
+Success: 'select * from t2 where j in (select i from v1)' doesn't take row locks on 't1'.
+Success: 'select * from t3 where k in (select j from v2)' doesn't take row locks on 't1'.
+#
+# 3.2 Statements which modify a table and use views.
+#
+# Since such statements are going to be written to the binary
+# log they need to be serialized against concurrent statements
+# and therefore should take shared row locks on data read.
+Success: 'update t2 set j= j-10 where j in (select i from v1)' takes shared row locks on 't1'.
+Success: 'update t3 set k= k-10 where k in (select j from v2)' takes shared row locks on 't1'.
+Success: 'update t2, v1 set j= j-10 where j = i' takes shared row locks on 't1'.
+Success: 'update v2 set j= j-10 where j = 3' takes shared row locks on 't1'.
+#
+# 4. Statements which read tables through stored functions.
+#
+#
+# 4.1 SELECT/SET with a stored function which does not
+# modify data and uses SELECT in its turn.
+#
+# Calls to such functions won't get into the binary log and
+# thus don't need to acquire strong locks.
+# In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+# used stored functions may lead to broken SBR" strong locks
+# are taken (we accepted it as a trade-off for this fix).
+Success: 'select f1()' doesn't take row locks on 't1'.
+Success: 'set @a:= f1()' doesn't take row locks on 't1'.
+#
+# 4.2 INSERT (or other statement which modifies data) with
+# a stored function which does not modify data and uses
+# SELECT.
+#
+# Since such statement is written to the binary log it should
+# be serialized with concurrent statements affecting the data
+# it uses. Therefore it should take row locks on the data
+# it reads.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken.
+Success: 'insert into t2 values (f1() + 5)' doesn't take row locks on 't1'.
+#
+# 4.3 SELECT/SET with a stored function which
+# reads and modifies data.
+#
+# Since a call to such function is written to the binary log,
+# it should be serialized with concurrent statements affecting
+# the data it uses. Hence, row locks on the data read
+# should be taken.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken.
+Success: 'select f2()' doesn't take row locks on 't1'.
+Success: 'set @a:= f2()' doesn't take row locks on 't1'.
+#
+# 4.4. SELECT/SET with a stored function which does not
+# modify data and reads a table through subselect
+# in a control construct.
+#
+# Again, in theory a call to this function won't get to the
+# binary log and thus no locking is needed. But in practice
+# we don't detect this fact early enough (get_lock_type_for_table())
+# to avoid taking row locks.
+Success: 'select f3()' takes shared row locks on 't1'.
+Success: 'set @a:= f3()' takes shared row locks on 't1'.
+Success: 'select f4()' takes shared row locks on 't1'.
+Success: 'set @a:= f4()' takes shared row locks on 't1'.
+#
+# 4.5. INSERT (or other statement which modifies data) with
+# a stored function which does not modify data and reads
+# the table through a subselect in one of its control
+# constructs.
+#
+# Since such statement is written to the binary log it should
+# be serialized with concurrent statements affecting data it
+# uses. Therefore it should take row locks on the data
+# it reads.
+Success: 'insert into t2 values (f3() + 5)' takes shared row locks on 't1'.
+Success: 'insert into t2 values (f4() + 6)' takes shared row locks on 't1'.
+#
+# 4.6 SELECT/SET which uses a stored function with
+# DML which reads a table via a subquery.
+#
+# Since call to such function is written to the binary log
+# it should be serialized with concurrent statements.
+# Hence reads should take row locks.
+Success: 'select f5()' takes shared row locks on 't1'.
+Success: 'set @a:= f5()' takes shared row locks on 't1'.
+#
+# 4.7 SELECT/SET which uses a stored function which
+# doesn't modify data and reads tables through
+# a view.
+#
+# Once again, in theory, calls to such functions won't
+# get into the binary log and thus don't need row
+# locks. In practice this fact is discovered
+# too late to have any effect.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken
+# in case of simple SELECT.
+Success: 'select f6()' doesn't take row locks on 't1'.
+Success: 'set @a:= f6()' doesn't take row locks on 't1'.
+Success: 'select f7()' takes shared row locks on 't1'.
+Success: 'set @a:= f7()' takes shared row locks on 't1'.
+#
+# 4.8 INSERT which uses stored function which
+# doesn't modify data and reads a table
+# through a view.
+#
+# Since such statement is written to the binary log and
+# should be serialized with concurrent statements affecting
+# the data it uses. Therefore it should take row locks on
+# the rows it reads.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken
+# in case of simple SELECT.
+Success: 'insert into t3 values (f6() + 5)' doesn't take row locks on 't1'.
+Success: 'insert into t3 values (f7() + 5)' takes shared row locks on 't1'.
+#
+# 4.9 SELECT which uses a stored function which
+# modifies data and reads tables through a view.
+#
+# Since a call to such function is written to the binary log
+# it should be serialized with concurrent statements.
+# Hence, reads should take row locks.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken
+# in case of simple SELECT.
+Success: 'select f8()' doesn't take row locks on 't1'.
+Success: 'select f9()' takes shared row locks on 't1'.
+#
+# 4.10 SELECT which uses stored function which doesn't modify
+# data and reads a table indirectly, by calling another
+# function.
+#
+# Calls to such functions won't get into the binary log and
+# thus don't need to acquire strong locks.
+# In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+# used stored functions may lead to broken SBR" strong locks
+# are taken (we accepted it as a trade-off for this fix).
+Success: 'select f10()' doesn't take row locks on 't1'.
+#
+# 4.11 INSERT which uses a stored function which doesn't modify
+# data and reads a table indirectly, by calling another
+# function.
+#
+# Since such statement is written to the binary log, it should
+# be serialized with concurrent statements affecting the data it
+# uses. Therefore it should take row locks on data it reads.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken.
+Success: 'insert into t2 values (f10() + 5)' doesn't take row locks on 't1'.
+#
+# 4.12 SELECT which uses a stored function which modifies
+# data and reads a table indirectly, by calling another
+# function.
+#
+# Since a call to such function is written to the binary log
+# it should be serialized from concurrent statements.
+# Hence, reads should take row locks.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken.
+Success: 'select f11()' doesn't take row locks on 't1'.
+#
+# 4.13 SELECT that reads a table through a subquery passed
+# as a parameter to a stored function which modifies
+# data.
+#
+# Even though a call to this function is written to the
+# binary log, values of its parameters are written as literals.
+# So there is no need to acquire row locks on rows used in
+# the subquery.
+# But due to the fact that in 5.1 for prelocked statements
+# THD::in_lock_tables is set to TRUE we acquire strong locks
+# (see also bug#44613 "SELECT statement inside FUNCTION takes
+# a shared lock" [sic!!!]).
+Success: 'select f12((select i+10 from t1 where i=1))' takes shared row locks on 't1'.
+#
+# 4.14 INSERT that reads a table via a subquery passed
+# as a parameter to a stored function which doesn't
+# modify data.
+#
+# Since this statement is written to the binary log it should
+# be serialized with concurrent statements affecting the data it
+# uses. Therefore it should take row locks on the data it reads.
+Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' takes shared row locks on 't1'.
+#
+# 5. Statements that read tables through stored procedures.
+#
+#
+# 5.1 CALL statement which reads a table via SELECT.
+#
+# Since neither this statement nor its components are
+# written to the binary log, there is no need to take
+# row locks on the data it reads.
+Success: 'call p2(@a)' doesn't take row locks on 't1'.
+#
+# 5.2 Function that modifies data and uses CALL,
+# which reads a table through SELECT.
+#
+# Since a call to such function is written to the binary
+# log, it should be serialized with concurrent statements.
+# Hence, in this case reads should take row locks on data.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken.
+Success: 'select f14()' doesn't take row locks on 't1'.
+#
+# 5.3 SELECT that calls a function that doesn't modify data and
+# uses a CALL statement that reads a table via SELECT.
+#
+# Calls to such functions won't get into the binary log and
+# thus don't need to acquire strong locks.
+# In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+# used stored functions may lead to broken SBR" strong locks
+# are taken (we accepted it as a trade-off for this fix).
+Success: 'select f15()' doesn't take row locks on 't1'.
+#
+# 5.4 INSERT which calls function which doesn't modify data and
+# uses CALL statement which reads table through SELECT.
+#
+# Since such statement is written to the binary log it should
+# be serialized with concurrent statements affecting data it
+# uses. Therefore it should take row locks on data it reads.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken.
+Success: 'insert into t2 values (f15()+5)' doesn't take row locks on 't1'.
+#
+# 6. Statements that use triggers.
+#
+#
+# 6.1 Statement invoking a trigger that reads table via SELECT.
+#
+# Since this statement is written to the binary log it should
+# be serialized with concurrent statements affecting the data
+# it uses. Therefore, it should take row locks on the data
+# it reads.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken.
+Success: 'insert into t4 values (2)' doesn't take row locks on 't1'.
+#
+# 6.2 Statement invoking a trigger that reads table through
+# a subquery in a control construct.
+#
+# The above is true for this statement as well.
+Success: 'update t4 set l= 2 where l = 1' takes shared row locks on 't1'.
+#
+# 6.3 Statement invoking a trigger that reads a table through
+# a view.
+#
+# And for this statement.
+Success: 'delete from t4 where l = 1' takes shared row locks on 't1'.
+#
+# 6.4 Statement invoking a trigger that reads a table through
+# a stored function.
+#
+# And for this statement.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken.
+Success: 'insert into t5 values (2)' doesn't take row locks on 't1'.
+#
+# 6.5 Statement invoking a trigger that reads a table through
+# stored procedure.
+#
+# And for this statement.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" no lock is taken.
+Success: 'update t5 set l= 2 where l = 1' doesn't take row locks on 't1'.
+# Clean-up.
+drop function f1;
+drop function f2;
+drop function f3;
+drop function f4;
+drop function f5;
+drop function f6;
+drop function f7;
+drop function f8;
+drop function f9;
+drop function f10;
+drop function f11;
+drop function f12;
+drop function f13;
+drop function f14;
+drop function f15;
+drop view v1, v2;
+drop procedure p1;
+drop procedure p2;
+drop table t1, t2, t3, t4, t5, te;
diff --git a/mysql-test/r/innodb_xtradb_bug317074.result b/mysql-test/r/innodb_xtradb_bug317074.result
deleted file mode 100644
index fff87ced019..00000000000
--- a/mysql-test/r/innodb_xtradb_bug317074.result
+++ /dev/null
@@ -1,31 +0,0 @@
-SET @old_innodb_file_format=@@innodb_file_format;
-SET @old_innodb_file_per_table=@@innodb_file_per_table;
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
-DROP TABLE IF EXISTS `test1`;
-CREATE TABLE IF NOT EXISTS `test1` (
-`a` int primary key auto_increment,
-`b` int default 0,
-`c` char(100) default 'testtest'
-) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
-set autocommit=0;
-CREATE PROCEDURE insert_many(p1 int)
-BEGIN
-SET @x = 0;
-SET @y = 0;
-REPEAT
-insert into test1 set b=1;
-SET @x = @x + 1;
-SET @y = @y + 1;
-IF @y >= 1000 THEN
-commit;
-SET @y = 0;
-END IF;
-UNTIL @x >= p1 END REPEAT;
-END|
-DROP PROCEDURE insert_many;
-ALTER TABLE test1 ENGINE=MyISAM;
-DROP TABLE test1;
-SET GLOBAL innodb_file_format=@old_innodb_file_format;
-SET GLOBAL innodb_file_per_table=@old_innodb_file_per_table;
-set global innodb_file_format_check=Antelope;
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 4543446e807..8e438934b23 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -1308,4 +1308,93 @@ WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
f1 f2 f3 f1 f2
1 NULL 3 NULL NULL
DROP TABLE t1, t2;
+#
+# Bug#52357: Assertion failed: join->best_read in greedy_search
+# optimizer_search_depth=0
+#
+CREATE TABLE t1( a INT );
+INSERT INTO t1 VALUES (1),(2);
+SET optimizer_search_depth = 0;
+# Should not core dump on query preparation
+EXPLAIN
+SELECT 1
+FROM t1 tt3 LEFT OUTER JOIN t1 tt4 ON 1
+LEFT OUTER JOIN t1 tt5 ON 1
+LEFT OUTER JOIN t1 tt6 ON 1
+LEFT OUTER JOIN t1 tt7 ON 1
+LEFT OUTER JOIN t1 tt8 ON 1
+RIGHT OUTER JOIN t1 tt2 ON 1
+RIGHT OUTER JOIN t1 tt1 ON 1
+STRAIGHT_JOIN t1 tt9 ON 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tt1 ALL NULL NULL NULL NULL 2
+1 SIMPLE tt2 ALL NULL NULL NULL NULL 2
+1 SIMPLE tt3 ALL NULL NULL NULL NULL 2
+1 SIMPLE tt4 ALL NULL NULL NULL NULL 2
+1 SIMPLE tt5 ALL NULL NULL NULL NULL 2
+1 SIMPLE tt6 ALL NULL NULL NULL NULL 2
+1 SIMPLE tt7 ALL NULL NULL NULL NULL 2
+1 SIMPLE tt8 ALL NULL NULL NULL NULL 2
+1 SIMPLE tt9 ALL NULL NULL NULL NULL 2 Using join buffer
+SET optimizer_search_depth = DEFAULT;
+DROP TABLE t1;
+#
+# Bug#46091 STRAIGHT_JOIN + RIGHT JOIN returns different result
+#
+CREATE TABLE t1 (f1 INT NOT NULL);
+INSERT INTO t1 VALUES (9),(0);
+CREATE TABLE t2 (f1 INT NOT NULL);
+INSERT INTO t2 VALUES
+(5),(3),(0),(3),(1),(0),(1),(7),(1),(0),(0),(8),(4),(9),(0),(2),(0),(8),(5),(1);
+SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1
+RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1;
+COUNT(*)
+476
+EXPLAIN SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1
+RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE TA2 ALL NULL NULL NULL NULL 20 Using where
+1 SIMPLE TA3 ALL NULL NULL NULL NULL 20 Using join buffer
+1 SIMPLE TA1 ALL NULL NULL NULL NULL 2
+DROP TABLE t1, t2;
+#
+# Bug#48971 Segfault in add_found_match_trig_cond () at sql_select.cc:5990
+#
+CREATE TABLE t1(f1 INT, PRIMARY KEY (f1));
+INSERT INTO t1 VALUES (1),(2);
+EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
+LEFT JOIN t1 AS jt2
+RIGHT JOIN t1 AS jt3
+JOIN t1 AS jt4 ON 1
+LEFT JOIN t1 AS jt5 ON 1
+ON 1
+RIGHT JOIN t1 AS jt6 ON jt6.f1
+ON 1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using index
+1 SIMPLE jt6 index NULL PRIMARY 4 NULL 2 100.00 Using index
+1 SIMPLE jt3 index NULL PRIMARY 4 NULL 2 100.00 Using index
+1 SIMPLE jt4 index NULL PRIMARY 4 NULL 2 100.00 Using index
+1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using index
+1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using index
+Warnings:
+Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on((`test`.`jt6`.`f1` and 1))) on(1) where 1
+EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
+RIGHT JOIN t1 AS jt2
+RIGHT JOIN t1 AS jt3
+JOIN t1 AS jt4 ON 1
+LEFT JOIN t1 AS jt5 ON 1
+ON 1
+RIGHT JOIN t1 AS jt6 ON jt6.f1
+ON 1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE jt6 index NULL PRIMARY 4 NULL 2 100.00 Using index
+1 SIMPLE jt3 index NULL PRIMARY 4 NULL 2 100.00 Using index
+1 SIMPLE jt4 index NULL PRIMARY 4 NULL 2 100.00 Using index
+1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using index
+1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using index
+1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using index
+Warnings:
+Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on((`test`.`jt6`.`f1` and 1)) left join `test`.`t1` `jt1` on(1) where 1
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index b3487d376a1..665e80b8ba2 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -496,4 +496,11 @@ SELECT * FROM t1;
col0
test
DROP TABLE t1;
+#
+# Bug #52512 : Assertion `! is_set()' in
+# Diagnostics_area::set_ok_status on LOAD DATA
+#
+CREATE TABLE t1 (id INT NOT NULL);
+LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/lock_sync.result b/mysql-test/r/lock_sync.result
new file mode 100644
index 00000000000..752f278a2b4
--- /dev/null
+++ b/mysql-test/r/lock_sync.result
@@ -0,0 +1,631 @@
+#
+# Test how we handle locking in various cases when
+# we read data from MyISAM tables.
+#
+# In this test we mostly check that the SQL-layer correctly
+# determines the type of thr_lock.c lock for a table being
+# read.
+# I.e. that it disallows concurrent inserts when the statement
+# is going to be written to the binary log and therefore
+# should be serialized, and allows concurrent inserts when
+# such serialization is not necessary (e.g. when
+# the statement is not written to binary log).
+#
+# Force concurrent inserts to be performed even if the table
+# has gaps. This allows to simplify clean up in scripts
+# used below (instead of backing up table being inserted
+# into and then restoring it from backup at the end of the
+# script we can simply delete rows which were inserted).
+set @old_concurrent_insert= @@global.concurrent_insert;
+set @@global.concurrent_insert= 2;
+select @@global.concurrent_insert;
+@@global.concurrent_insert
+2
+# Prepare playground by creating tables, views,
+# routines and triggers used in tests.
+drop table if exists t0, t1, t2, t3, t4, t5, te;
+drop view if exists v1, v2;
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop function if exists f1;
+drop function if exists f2;
+drop function if exists f3;
+drop function if exists f4;
+drop function if exists f5;
+drop function if exists f6;
+drop function if exists f7;
+drop function if exists f8;
+drop function if exists f9;
+drop function if exists f10;
+drop function if exists f11;
+drop function if exists f12;
+drop function if exists f13;
+drop function if exists f14;
+drop function if exists f15;
+create table t1 (i int primary key);
+insert into t1 values (1), (2), (3), (4), (5);
+create table t2 (j int primary key);
+insert into t2 values (1), (2), (3), (4), (5);
+create table t3 (k int primary key);
+insert into t3 values (1), (2), (3);
+create table t4 (l int primary key);
+insert into t4 values (1);
+create table t5 (l int primary key);
+insert into t5 values (1);
+create table te(e int primary key);
+insert into te values (1);
+create view v1 as select i from t1;
+create view v2 as select j from t2 where j in (select i from t1);
+create procedure p1(k int) insert into t2 values (k);
+create function f1() returns int
+begin
+declare j int;
+select i from t1 where i = 1 into j;
+return j;
+end|
+create function f2() returns int
+begin
+declare k int;
+select i from t1 where i = 1 into k;
+insert into t2 values (k + 5);
+return 0;
+end|
+create function f3() returns int
+begin
+return (select i from t1 where i = 3);
+end|
+create function f4() returns int
+begin
+if (select i from t1 where i = 3) then
+return 1;
+else
+return 0;
+end if;
+end|
+create function f5() returns int
+begin
+insert into t2 values ((select i from t1 where i = 1) + 5);
+return 0;
+end|
+create function f6() returns int
+begin
+declare k int;
+select i from v1 where i = 1 into k;
+return k;
+end|
+create function f7() returns int
+begin
+declare k int;
+select j from v2 where j = 1 into k;
+return k;
+end|
+create function f8() returns int
+begin
+declare k int;
+select i from v1 where i = 1 into k;
+insert into t2 values (k+5);
+return k;
+end|
+create function f9() returns int
+begin
+update v2 set j=j+10 where j=1;
+return 1;
+end|
+create function f10() returns int
+begin
+return f1();
+end|
+create function f11() returns int
+begin
+declare k int;
+set k= f1();
+insert into t2 values (k+5);
+return k;
+end|
+create function f12(p int) returns int
+begin
+insert into t2 values (p);
+return p;
+end|
+create function f13(p int) returns int
+begin
+return p;
+end|
+create procedure p2(inout p int)
+begin
+select i from t1 where i = 1 into p;
+end|
+create function f14() returns int
+begin
+declare k int;
+call p2(k);
+insert into t2 values (k+5);
+return k;
+end|
+create function f15() returns int
+begin
+declare k int;
+call p2(k);
+return k;
+end|
+create trigger t4_bi before insert on t4 for each row
+begin
+declare k int;
+select i from t1 where i=1 into k;
+set new.l= k+1;
+end|
+create trigger t4_bu before update on t4 for each row
+begin
+if (select i from t1 where i=1) then
+set new.l= 2;
+end if;
+end|
+# Trigger below uses insertion of duplicate key in 'te'
+# table as a way to abort delete operation.
+create trigger t4_bd before delete on t4 for each row
+begin
+if !(select i from v1 where i=1) then
+insert into te values (1);
+end if;
+end|
+create trigger t5_bi before insert on t5 for each row
+begin
+set new.l= f1()+1;
+end|
+create trigger t5_bu before update on t5 for each row
+begin
+declare j int;
+call p2(j);
+set new.l= j + 1;
+end|
+#
+# Set common variables to be used by the scripts
+# called below.
+#
+# Switch to connection 'con1'.
+# Cache all functions used in the tests below so statements
+# calling them won't need to open and lock mysql.proc table
+# and we can assume that each statement locks its tables
+# once during its execution.
+show create procedure p1;
+show create procedure p2;
+show create function f1;
+show create function f2;
+show create function f3;
+show create function f4;
+show create function f5;
+show create function f6;
+show create function f7;
+show create function f8;
+show create function f9;
+show create function f10;
+show create function f11;
+show create function f12;
+show create function f13;
+show create function f14;
+show create function f15;
+# Switch back to connection 'default'.
+#
+# 1. Statements that read tables and do not use subqueries.
+#
+#
+# 1.1 Simple SELECT statement.
+#
+# No locks are necessary as this statement won't be written
+# to the binary log and thanks to how MyISAM works SELECT
+# will see version of the table prior to concurrent insert.
+Success: 'select * from t1' allows concurrent inserts into 't1'.
+#
+# 1.2 Multi-UPDATE statement.
+#
+# Has to take shared locks on rows in the table being read as this
+# statement will be written to the binary log and therefore should
+# be serialized with concurrent statements.
+Success: 'update t2, t1 set j= j - 1 where i = j' doesn't allow concurrent inserts into 't1'.
+#
+# 1.3 Multi-DELETE statement.
+#
+# The above is true for this statement as well.
+Success: 'delete t2 from t1, t2 where i = j' doesn't allow concurrent inserts into 't1'.
+#
+# 1.4 DESCRIBE statement.
+#
+# This statement does not really read data from the
+# target table and thus does not take any lock on it.
+# We check this for completeness of coverage.
+lock table t1 write;
+# Switching to connection 'con1'.
+# This statement should not be blocked.
+describe t1;
+# Switching to connection 'default'.
+unlock tables;
+#
+# 1.5 SHOW statements.
+#
+# The above is true for SHOW statements as well.
+lock table t1 write;
+# Switching to connection 'con1'.
+# These statements should not be blocked.
+show keys from t1;
+# Switching to connection 'default'.
+unlock tables;
+#
+# 2. Statements which read tables through subqueries.
+#
+#
+# 2.1 CALL with a subquery.
+#
+# In theory strong lock is not necessary as this statement
+# is not written to the binary log as a whole (it is written
+# statement-by-statement). But in practice in 5.1 for
+# almost everything except SELECT we take strong lock.
+Success: 'call p1((select i + 5 from t1 where i = 1))' doesn't allow concurrent inserts into 't1'.
+#
+# 2.2 CREATE TABLE with a subquery.
+#
+# Has to take a strong lock on the table being read as
+# this statement is written to the binary log and therefore
+# should be serialized with concurrent statements.
+Success: 'create table t0 select * from t1' doesn't allow concurrent inserts into 't1'.
+drop table t0;
+Success: 'create table t0 select j from t2 where j in (select i from t1)' doesn't allow concurrent inserts into 't1'.
+drop table t0;
+#
+# 2.3 DELETE with a subquery.
+#
+# The above is true for this statement as well.
+Success: 'delete from t2 where j in (select i from t1)' doesn't allow concurrent inserts into 't1'.
+#
+# 2.4 MULTI-DELETE with a subquery.
+#
+# Same is true for this statement as well.
+Success: 'delete t2 from t3, t2 where k = j and j in (select i from t1)' doesn't allow concurrent inserts into 't1'.
+#
+# 2.5 DO with a subquery.
+#
+# In theory strong lock is not necessary as it is not logged.
+# But in practice in 5.1 for almost everything except SELECT
+# we take strong lock.
+Success: 'do (select i from t1 where i = 1)' doesn't allow concurrent inserts into 't1'.
+#
+# 2.6 INSERT with a subquery.
+#
+# Has to take a strong lock on the table being read as
+# this statement is written to the binary log and therefore
+# should be serialized with concurrent inserts.
+Success: 'insert into t2 select i+5 from t1' doesn't allow concurrent inserts into 't1'.
+Success: 'insert into t2 values ((select i+5 from t1 where i = 4))' doesn't allow concurrent inserts into 't1'.
+#
+# 2.7 LOAD DATA with a subquery.
+#
+# The above is true for this statement as well.
+Success: 'load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1)' doesn't allow concurrent inserts into 't1'.
+#
+# 2.8 REPLACE with a subquery.
+#
+# Same is true for this statement as well.
+Success: 'replace into t2 select i+5 from t1' doesn't allow concurrent inserts into 't1'.
+Success: 'replace into t2 values ((select i+5 from t1 where i = 4))' doesn't allow concurrent inserts into 't1'.
+#
+# 2.9 SELECT with a subquery.
+#
+# Strong locks are not necessary as this statement is not written
+# to the binary log and thanks to how MyISAM works this statement
+# sees a version of the table prior to the concurrent insert.
+Success: 'select * from t2 where j in (select i from t1)' allows concurrent inserts into 't1'.
+#
+# 2.10 SET with a subquery.
+#
+# In theory the same is true for this statement as well.
+# But in practice in 5.1 we acquire strong lock in this
+# case as well.
+Success: 'set @a:= (select i from t1 where i = 1)' doesn't allow concurrent inserts into 't1'.
+#
+# 2.11 SHOW with a subquery.
+#
+# The same is true for this statement too.
+Success: 'show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1)' doesn't allow concurrent inserts into 't1'.
+Success: 'show columns from t2 where (select i from t1 where i = 1)' doesn't allow concurrent inserts into 't1'.
+#
+# 2.12 UPDATE with a subquery.
+#
+# Has to take a strong lock on the table being read as
+# this statement is written to the binary log and therefore
+# should be serialized with concurrent inserts.
+Success: 'update t2 set j= j-10 where j in (select i from t1)' doesn't allow concurrent inserts into 't1'.
+#
+# 2.13 MULTI-UPDATE with a subquery.
+#
+# Same is true for this statement as well.
+Success: 'update t2, t3 set j= j -10 where j=k and j in (select i from t1)' doesn't allow concurrent inserts into 't1'.
+#
+# 3. Statements which read tables through a view.
+#
+#
+# 3.1 SELECT statement which uses some table through a view.
+#
+# Since this statement is not written to the binary log and
+# an old version of the table is accessible thanks to how MyISAM
+# handles concurrent insert, no locking is necessary.
+Success: 'select * from v1' allows concurrent inserts into 't1'.
+Success: 'select * from v2' allows concurrent inserts into 't1'.
+Success: 'select * from t2 where j in (select i from v1)' allows concurrent inserts into 't1'.
+Success: 'select * from t3 where k in (select j from v2)' allows concurrent inserts into 't1'.
+#
+# 3.2 Statements which modify a table and use views.
+#
+# Since such statements are going to be written to the binary
+# log they need to be serialized against concurrent statements
+# and therefore should take strong locks on the data read.
+Success: 'update t2 set j= j-10 where j in (select i from v1)' doesn't allow concurrent inserts into 't1'.
+Success: 'update t3 set k= k-10 where k in (select j from v2)' doesn't allow concurrent inserts into 't1'.
+Success: 'update t2, v1 set j= j-10 where j = i' doesn't allow concurrent inserts into 't1'.
+Success: 'update v2 set j= j-10 where j = 3' doesn't allow concurrent inserts into 't1'.
+#
+# 4. Statements which read tables through stored functions.
+#
+#
+# 4.1 SELECT/SET with a stored function which does not
+# modify data and uses SELECT in its turn.
+#
+# Calls to such functions won't get into the binary log and
+# thus don't need to acquire strong locks.
+# In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+# used stored functions may lead to broken SBR" strong locks
+# are taken (we accepted it as a trade-off for this fix).
+Success: 'select f1()' allows concurrent inserts into 't1'.
+Success: 'set @a:= f1()' allows concurrent inserts into 't1'.
+#
+# 4.2 INSERT (or other statement which modifies data) with
+# a stored function which does not modify data and uses
+# SELECT.
+#
+# Since such statement is written to the binary log it should
+# be serialized with concurrent statements affecting the data
+# it uses. Therefore it should take strong lock on the data
+# it reads.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken.
+Success: 'insert into t2 values (f1() + 5)' allows concurrent inserts into 't1'.
+#
+# 4.3 SELECT/SET with a stored function which
+# reads and modifies data.
+#
+# Since a call to such function is written to the binary log,
+# it should be serialized with concurrent statements affecting
+# the data it uses. Hence, a strong lock on the data read
+# should be taken.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken.
+Success: 'select f2()' allows concurrent inserts into 't1'.
+Success: 'set @a:= f2()' allows concurrent inserts into 't1'.
+#
+# 4.4. SELECT/SET with a stored function which does not
+# modify data and reads a table through subselect
+# in a control construct.
+#
+# Again, in theory a call to this function won't get to the
+# binary log and thus no strong lock is needed. But in practice
+# we don't detect this fact early enough (get_lock_type_for_table())
+# to avoid taking a strong lock.
+Success: 'select f3()' doesn't allow concurrent inserts into 't1'.
+Success: 'set @a:= f3()' doesn't allow concurrent inserts into 't1'.
+Success: 'select f4()' doesn't allow concurrent inserts into 't1'.
+Success: 'set @a:= f4()' doesn't allow concurrent inserts into 't1'.
+#
+# 4.5. INSERT (or other statement which modifies data) with
+# a stored function which does not modify data and reads
+# the table through a subselect in one of its control
+# constructs.
+#
+# Since such statement is written to the binary log it should
+# be serialized with concurrent statements affecting data it
+# uses. Therefore it should take a strong lock on the data
+# it reads.
+Success: 'insert into t2 values (f3() + 5)' doesn't allow concurrent inserts into 't1'.
+Success: 'insert into t2 values (f4() + 6)' doesn't allow concurrent inserts into 't1'.
+#
+# 4.6 SELECT/SET which uses a stored function with
+# DML which reads a table via a subquery.
+#
+# Since call to such function is written to the binary log
+# it should be serialized with concurrent statements.
+# Hence reads should take a strong lock.
+Success: 'select f5()' doesn't allow concurrent inserts into 't1'.
+Success: 'set @a:= f5()' doesn't allow concurrent inserts into 't1'.
+#
+# 4.7 SELECT/SET which uses a stored function which
+# doesn't modify data and reads tables through
+# a view.
+#
+# Once again, in theory, calls to such functions won't
+# get into the binary log and thus don't need strong
+# locks. In practice this fact is discovered
+# too late to have any effect.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken
+# in case when simple SELECT is used.
+Success: 'select f6()' allows concurrent inserts into 't1'.
+Success: 'set @a:= f6()' allows concurrent inserts into 't1'.
+Success: 'select f7()' doesn't allow concurrent inserts into 't1'.
+Success: 'set @a:= f7()' doesn't allow concurrent inserts into 't1'.
+#
+# 4.8 INSERT which uses stored function which
+# doesn't modify data and reads a table
+# through a view.
+#
+# Since such statement is written to the binary log and
+# should be serialized with concurrent statements affecting
+# the data it uses. Therefore it should take a strong lock on
+# the table it reads.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken
+# in case when simple SELECT is used.
+Success: 'insert into t3 values (f6() + 5)' allows concurrent inserts into 't1'.
+Success: 'insert into t3 values (f7() + 5)' doesn't allow concurrent inserts into 't1'.
+#
+# 4.9 SELECT which uses a stored function which
+# modifies data and reads tables through a view.
+#
+# Since a call to such function is written to the binary log
+# it should be serialized with concurrent statements.
+# Hence, reads should take strong locks.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken
+# in case when simple SELECT is used.
+Success: 'select f8()' allows concurrent inserts into 't1'.
+Success: 'select f9()' doesn't allow concurrent inserts into 't1'.
+#
+# 4.10 SELECT which uses a stored function which doesn't modify
+# data and reads a table indirectly, by calling another
+# function.
+#
+# Calls to such functions won't get into the binary log and
+# thus don't need to acquire strong locks.
+# In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+# used stored functions may lead to broken SBR" strong locks
+# are taken (we accepted it as a trade-off for this fix).
+Success: 'select f10()' allows concurrent inserts into 't1'.
+#
+# 4.11 INSERT which uses a stored function which doesn't modify
+# data and reads a table indirectly, by calling another
+# function.
+#
+# Since such statement is written to the binary log, it should
+# be serialized with concurrent statements affecting the data it
+# uses. Therefore it should take strong locks on data it reads.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken.
+Success: 'insert into t2 values (f10() + 5)' allows concurrent inserts into 't1'.
+#
+# 4.12 SELECT which uses a stored function which modifies
+# data and reads a table indirectly, by calling another
+# function.
+#
+# Since a call to such function is written to the binary log
+# it should be serialized from concurrent statements.
+# Hence, read should take a strong lock.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken.
+Success: 'select f11()' allows concurrent inserts into 't1'.
+#
+# 4.13 SELECT that reads a table through a subquery passed
+# as a parameter to a stored function which modifies
+# data.
+#
+# Even though a call to this function is written to the
+# binary log, values of its parameters are written as literals.
+# So there is no need to acquire strong locks for tables used in
+# the subquery.
+Success: 'select f12((select i+10 from t1 where i=1))' allows concurrent inserts into 't1'.
+#
+# 4.14 INSERT that reads a table via a subquery passed
+# as a parameter to a stored function which doesn't
+# modify data.
+#
+# Since this statement is written to the binary log it should
+# be serialized with concurrent statements affecting the data it
+# uses. Therefore it should take strong locks on the data it reads.
+Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' doesn't allow concurrent inserts into 't1'.
+#
+# 5. Statements that read tables through stored procedures.
+#
+#
+# 5.1 CALL statement which reads a table via SELECT.
+#
+# Since neither this statement nor its components are
+# written to the binary log, there is no need to take
+# strong locks on the data it reads.
+Success: 'call p2(@a)' allows concurrent inserts into 't1'.
+#
+# 5.2 Function that modifies data and uses CALL,
+# which reads a table through SELECT.
+#
+# Since a call to such function is written to the binary
+# log, it should be serialized with concurrent statements.
+# Hence, in this case reads should take strong locks on data.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken.
+Success: 'select f14()' allows concurrent inserts into 't1'.
+#
+# 5.3 SELECT that calls a function that doesn't modify data and
+# uses a CALL statement that reads a table via SELECT.
+#
+# Calls to such functions won't get into the binary log and
+# thus don't need to acquire strong locks.
+# In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+# used stored functions may lead to broken SBR" strong locks
+# are taken (we accepted it as a trade-off for this fix).
+Success: 'select f15()' allows concurrent inserts into 't1'.
+#
+# 5.4 INSERT which calls function which doesn't modify data and
+# uses CALL statement which reads table through SELECT.
+#
+# Since such statement is written to the binary log it should
+# be serialized with concurrent statements affecting data it
+# uses. Therefore it should take strong locks on data it reads.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken.
+Success: 'insert into t2 values (f15()+5)' allows concurrent inserts into 't1'.
+#
+# 6. Statements that use triggers.
+#
+#
+# 6.1 Statement invoking a trigger that reads table via SELECT.
+#
+# Since this statement is written to the binary log it should
+# be serialized with concurrent statements affecting the data
+# it uses. Therefore, it should take strong locks on the data
+# it reads.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken.
+Success: 'insert into t4 values (2)' allows concurrent inserts into 't1'.
+#
+# 6.2 Statement invoking a trigger that reads table through
+# a subquery in a control construct.
+#
+# The above is true for this statement as well.
+Success: 'update t4 set l= 2 where l = 1' doesn't allow concurrent inserts into 't1'.
+#
+# 6.3 Statement invoking a trigger that reads a table through
+# a view.
+#
+# And for this statement.
+Success: 'delete from t4 where l = 1' doesn't allow concurrent inserts into 't1'.
+#
+# 6.4 Statement invoking a trigger that reads a table through
+# a stored function.
+#
+# And for this statement.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken.
+Success: 'insert into t5 values (2)' allows concurrent inserts into 't1'.
+#
+# 6.5 Statement invoking a trigger that reads a table through
+# stored procedure.
+#
+# And for this statement.
+# But due to bug #53921 "Wrong locks for SELECTs used stored
+# functions may lead to broken SBR" weak locks are taken.
+Success: 'update t5 set l= 2 where l = 1' allows concurrent inserts into 't1'.
+# Clean-up.
+drop function f1;
+drop function f2;
+drop function f3;
+drop function f4;
+drop function f5;
+drop function f6;
+drop function f7;
+drop function f8;
+drop function f9;
+drop function f10;
+drop function f11;
+drop function f12;
+drop function f13;
+drop function f14;
+drop function f15;
+drop view v1, v2;
+drop procedure p1;
+drop procedure p2;
+drop table t1, t2, t3, t4, t5, te;
+set @@global.concurrent_insert= @old_concurrent_insert;
diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result
index 4ce678e37aa..654f9d127d3 100644
--- a/mysql-test/r/log_state.result
+++ b/mysql-test/r/log_state.result
@@ -308,8 +308,41 @@ SET @@global.general_log = @old_general_log;
SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
+#
+# Bug #49756 Rows_examined is always 0 in the slow query log
+# for update statements
+#
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = "TABLE";
+SET GLOBAL slow_query_log = ON;
+SET GLOBAL long_query_time = 0.001;
+TRUNCATE TABLE mysql.slow_log;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT, PRIMARY KEY (b));
+INSERT INTO t2 VALUES (3),(4);
+INSERT INTO t1 VALUES (1+sleep(.01)),(2);
+INSERT INTO t1 SELECT b+sleep(.01) from t2;
+UPDATE t1 SET a=a+sleep(.01) WHERE a>2;
+UPDATE t1 SET a=a+sleep(.01) ORDER BY a DESC;
+UPDATE t2 set b=b+sleep(.01) limit 1;
+UPDATE t1 SET a=a+sleep(.01) WHERE a in (SELECT b from t2);
+DELETE FROM t1 WHERE a=a+sleep(.01) ORDER BY a LIMIT 2;
+SELECT rows_examined,sql_text FROM mysql.slow_log;
+rows_examined sql_text
+0 INSERT INTO t1 VALUES (1+sleep(.01)),(2)
+2 INSERT INTO t1 SELECT b+sleep(.01) from t2
+4 UPDATE t1 SET a=a+sleep(.01) WHERE a>2
+8 UPDATE t1 SET a=a+sleep(.01) ORDER BY a DESC
+2 UPDATE t2 set b=b+sleep(.01) limit 1
+4 UPDATE t1 SET a=a+sleep(.01) WHERE a in (SELECT b from t2)
+6 DELETE FROM t1 WHERE a=a+sleep(.01) ORDER BY a LIMIT 2
+DROP TABLE t1,t2;
+TRUNCATE TABLE mysql.slow_log;
+# end of bug#49756
End of 5.1 tests
# Close connection con1
+SET GLOBAL long_query_time = DEFAULT;
+SET GLOBAL log_output = @old_log_output;
SET global general_log = @old_general_log;
SET global general_log_file = @old_general_log_file;
SET global slow_query_log = @old_slow_query_log;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 04bf7720c43..ae72f416c79 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -602,9 +602,6 @@ select * from t2 /* must be (3,1), (4,4) */;
a b
3 1
4 4
-show master status /* there must be the UPDATE query event */;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 206
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
@@ -612,9 +609,6 @@ 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 the UPDATE query event */;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 221
drop table t1, t2;
set @@session.binlog_format= @sav_binlog_format;
drop table if exists t1, t2, t3;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index ad77d04d583..ccf60ae5fd9 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -4561,5 +4561,20 @@ a b c
SET NAMES default;
DROP TABLE t1, t2;
#
+# Bug #53088: mysqldump with -T & --default-character-set set
+# truncates text/blob to 766 chars
+#
+# Also see outfile_loaddata.test
+#
+CREATE TABLE t1 (a BLOB) CHARSET latin1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (REPEAT('.', 800));
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET latin1;
+# should be 800
+SELECT LENGTH(a) FROM t2;
+LENGTH(a)
+800
+DROP TABLE t1, t2;
+#
# End of 5.1 tests
#
diff --git a/mysql-test/r/mysqlhotcopy_archive.result b/mysql-test/r/mysqlhotcopy_archive.result
new file mode 100644
index 00000000000..bea78597336
--- /dev/null
+++ b/mysql-test/r/mysqlhotcopy_archive.result
@@ -0,0 +1,118 @@
+DROP DATABASE IF EXISTS hotcopy_test;
+CREATE DATABASE hotcopy_test;
+USE hotcopy_test;
+CREATE TABLE t1 (c1 int, c2 varchar(20)) ENGINE=archive;
+CREATE TABLE t2 (c1 int, c2 varchar(20)) ENGINE=archive;
+CREATE TABLE t3 (c1 int, c2 varchar(20)) ENGINE=archive;
+INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+USE hotcopy_save;
+SELECT * FROM t1;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+DROP TABLE t2;
+db.opt
+t1.ARZ
+t1.frm
+t3.ARZ
+t3.frm
+FLUSH TABLES;
+SELECT * FROM t1;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+db.opt
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+t3.ARZ
+t3.frm
+DROP DATABASE hotcopy_test_cpy;
+DROP DATABASE hotcopy_test;
+DROP DATABASE hotcopy_save;
+DROP DATABASE hotcopy_save_old;
diff --git a/mysql-test/r/mysqlhotcopy_myisam.result b/mysql-test/r/mysqlhotcopy_myisam.result
new file mode 100644
index 00000000000..52aeffce5cf
--- /dev/null
+++ b/mysql-test/r/mysqlhotcopy_myisam.result
@@ -0,0 +1,164 @@
+DROP DATABASE IF EXISTS hotcopy_test;
+CREATE DATABASE hotcopy_test;
+USE hotcopy_test;
+CREATE TABLE t1 (c1 int, c2 varchar(20)) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 int, c2 varchar(20)) ENGINE=MyISAM;
+CREATE TABLE t3 (c1 int, c2 varchar(20)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 2
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+USE hotcopy_save;
+SELECT * FROM t1;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+DELETE FROM t1;
+SELECT * FROM t1;
+c1 c2
+USE hotcopy_save;
+SELECT * FROM t1;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+DROP TABLE t2;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t3.MYD
+t3.MYI
+t3.frm
+FLUSH TABLES;
+SELECT * FROM t1;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t2;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+SELECT * FROM t3;
+c1 c2
+1 aaaaaaaaaaaaaaaaaaaa
+2 bbbbbbbbbbbbbbbbbbbb
+USE hotcopy_test;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+DROP DATABASE hotcopy_save;
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+db.opt
+t1.MYD
+t1.MYI
+t1.frm
+t2.MYD
+t2.MYI
+t2.frm
+t3.MYD
+t3.MYI
+t3.frm
+DROP DATABASE hotcopy_test_cpy;
+DROP DATABASE hotcopy_test;
+DROP DATABASE hotcopy_save;
+DROP DATABASE hotcopy_save_old;
diff --git a/mysql-test/r/outfile_loaddata.result b/mysql-test/r/outfile_loaddata.result
index 453e3adb54c..36a72fd84ce 100644
--- a/mysql-test/r/outfile_loaddata.result
+++ b/mysql-test/r/outfile_loaddata.result
@@ -239,4 +239,24 @@ a b c
2 NULL NULL
SET NAMES default;
DROP TABLE t1, t2;
+#
+# Bug #53088: mysqldump with -T & --default-character-set set
+# truncates text/blob to 766 chars
+#
+# Also see mysqldump.test
+#
+CREATE TABLE t1 (a BLOB) CHARSET latin1;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (REPEAT('.', 800));
+SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug53088.txt' CHARACTER SET latin1 FROM t1;
+# should be greater than 800
+SELECT LENGTH(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug53088.txt'));
+LENGTH(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug53088.txt'))
+801
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug53088.txt' INTO TABLE t2;
+# should be 800
+SELECT LENGTH(a) FROM t2;
+LENGTH(a)
+800
+DROP TABLE t1, t2;
# End of 5.1 tests.
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result
index 6ebf033adb7..16428fba4d9 100644
--- a/mysql-test/r/partition_error.result
+++ b/mysql-test/r/partition_error.result
@@ -1,5 +1,29 @@
drop table if exists t1;
#
+# Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
+#
+CREATE TABLE t1 (a INT) PARTITION BY HASH (a);
+FLUSH TABLES;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Error Failed to read from the .par file
+test.t1 check Error Incorrect information in file: './test/t1.frm'
+test.t1 check error Corrupt
+SELECT * FROM t1;
+ERROR HY000: Failed to read from the .par file
+# Note that it is currently impossible to drop a partitioned table
+# without the .par file
+DROP TABLE t1;
+ERROR 42S02: Unknown table 't1'
+#
+# Bug#49477: Assertion `0' failed in ha_partition.cc:5530
+# with temporary table and partitions
+#
+CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
+CREATE TEMPORARY TABLE tmp_t1 LIKE t1;
+ERROR HY000: Cannot create temporary table with partitions
+DROP TABLE t1;
+#
# Bug#50392: insert_id is not reset for partitioned tables
# auto_increment on duplicate entry
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY);
diff --git a/mysql-test/r/renamedb.result b/mysql-test/r/renamedb.result
index ff8f89592fc..e77aca0d0b7 100644
--- a/mysql-test/r/renamedb.result
+++ b/mysql-test/r/renamedb.result
@@ -7,6 +7,6 @@ ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and n
ALTER DATABASE `#mysql51#not-yet` UPGRADE DATA DIRECTORY NAME;
ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and name
ALTER DATABASE `#mysql50#` UPGRADE DATA DIRECTORY NAME;
-ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and name
+ERROR 42000: Incorrect database name '#mysql50#'
ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Unknown database '#mysql50#upgrade-me'
diff --git a/mysql-test/r/schema.result b/mysql-test/r/schema.result
index 564fb3626df..e6af4e312a3 100644
--- a/mysql-test/r/schema.result
+++ b/mysql-test/r/schema.result
@@ -11,3 +11,22 @@ mtr
mysql
test
drop schema foo;
+#
+# Bug#54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER
+#
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (a INT);
+INSERT INTO db1.t1 VALUES (1), (2);
+# Connection con1
+HANDLER db1.t1 OPEN;
+# Connection default
+# Sending:
+DROP DATABASE db1;
+# Connection con2
+# Waiting for 'DROP DATABASE db1' to sync in.
+# Connection con1
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+# Connection default
+# Reaping: DROP DATABASE db1
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 6353ae23013..c1aa5704f56 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4781,4 +4781,19 @@ a b c
SELECT * FROM t1 WHERE 102 < c;
a b c
DROP TABLE t1;
+#
+# Bug #54459: Assertion failed: param.sort_length,
+# file .\filesort.cc, line 149 (part II)
+#
+CREATE TABLE t1(a ENUM('') NOT NULL);
+INSERT INTO t1 VALUES (), (), ();
+EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+1
+1
+1
+1
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result
index 6353ae23013..c1aa5704f56 100644
--- a/mysql-test/r/select_pkeycache.result
+++ b/mysql-test/r/select_pkeycache.result
@@ -4781,4 +4781,19 @@ a b c
SELECT * FROM t1 WHERE 102 < c;
a b c
DROP TABLE t1;
+#
+# Bug #54459: Assertion failed: param.sort_length,
+# file .\filesort.cc, line 149 (part II)
+#
+CREATE TABLE t1(a ENUM('') NOT NULL);
+INSERT INTO t1 VALUES (), (), ();
+EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+1
+1
+1
+1
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result
index 7a6173b89e2..7b7d05617ab 100644
--- a/mysql-test/r/sp_trans_log.result
+++ b/mysql-test/r/sp_trans_log.result
@@ -14,13 +14,13 @@ 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 */|
+show binlog events from <binlog_start>|
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 # #
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
select count(*),@a from t1 /* must be 1,1 */|
count(*) @a
1 1
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index ed5f8e9e75f..cbb6149a148 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -4714,3 +4714,20 @@ t1_id total_amount
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
+#
+# Bug #52711: Segfault when doing EXPLAIN SELECT with
+# union...order by (select... where...)
+#
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+# Should not crash
+EXPLAIN
+SELECT * FROM t2 UNION SELECT * FROM t2
+ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+# Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+DROP TABLE t1,t2;
+End of 5.1 tests
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index e4b90196c2d..86712bebfa1 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -138,3 +138,13 @@ CAST(c AS TIME)
00:00:00
DROP TABLE t1;
End of 5.0 tests
+#
+# Bug#53942 valgrind warnings with timestamp() function and incomplete datetime values
+#
+CREATE TABLE t1(f1 TIME);
+INSERT INTO t1 VALUES ('23:38:57');
+SELECT TIMESTAMP(f1,'1') FROM t1;
+TIMESTAMP(f1,'1')
+NULL
+DROP TABLE t1;
+End of 5.1 tests
diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result
index 034242079b1..da2f55b5bb1 100644
--- a/mysql-test/r/upgrade.result
+++ b/mysql-test/r/upgrade.result
@@ -112,3 +112,31 @@ select * from `a-b-c`.v1;
f1
drop database `a-b-c`;
use test;
+# End of 5.0 tests
+#
+# Bug #53804: serious flaws in the alter database .. upgrade data
+# directory name command
+#
+ALTER DATABASE `#mysql50#:` UPGRADE DATA DIRECTORY NAME;
+ERROR 42000: Unknown database '#mysql50#:'
+ALTER DATABASE `#mysql50#.` UPGRADE DATA DIRECTORY NAME;
+ERROR 42000: Incorrect database name '#mysql50#.'
+ALTER DATABASE `#mysql50#../` UPGRADE DATA DIRECTORY NAME;
+ERROR 42000: Incorrect database name '#mysql50#../'
+ALTER DATABASE `#mysql50#../..` UPGRADE DATA DIRECTORY NAME;
+ERROR 42000: Incorrect database name '#mysql50#../..'
+ALTER DATABASE `#mysql50#../../` UPGRADE DATA DIRECTORY NAME;
+ERROR 42000: Incorrect database name '#mysql50#../../'
+ALTER DATABASE `#mysql50#./blablabla` UPGRADE DATA DIRECTORY NAME;
+ERROR 42000: Incorrect database name '#mysql50#./blablabla'
+ALTER DATABASE `#mysql50#../blablabla` UPGRADE DATA DIRECTORY NAME;
+ERROR 42000: Incorrect database name '#mysql50#../blablabla'
+ALTER DATABASE `#mysql50#/` UPGRADE DATA DIRECTORY NAME;
+ERROR 42000: Incorrect database name '#mysql50#/'
+ALTER DATABASE `#mysql50#/.` UPGRADE DATA DIRECTORY NAME;
+ERROR 42000: Incorrect database name '#mysql50#/.'
+USE `#mysql50#.`;
+ERROR 42000: Incorrect database name '#mysql50#.'
+USE `#mysql50#../blablabla`;
+ERROR 42000: Incorrect database name '#mysql50#../blablabla'
+# End of 5.1 tests
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 54506a9a4a2..832c679f8d5 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -576,7 +576,7 @@ set global table_open_cache=100;
set storage_engine=myisam;
set global thread_cache_size=100;
set timestamp=1, timestamp=default;
-set tmp_table_size=100;
+set tmp_table_size=1024;
set tx_isolation="READ-COMMITTED";
set wait_timeout=100;
set log_warnings=1;
@@ -1017,6 +1017,13 @@ hostname #
# Test 'myisam_mmap_size' option is not dynamic
SET @@myisam_mmap_size= 500M;
ERROR HY000: Variable 'myisam_mmap_size' is a read only variable
+#
+# Bug #52315: utc_date() crashes when system time > year 2037
+#
+SET TIMESTAMP=2*1024*1024*1024;
+#Should not crash
+SELECT UTC_DATE();
+SET TIMESTAMP=DEFAULT;
End of 5.0 tests
set join_buffer_size=1;
Warnings:
diff --git a/mysql-test/r/variables_debug.result b/mysql-test/r/variables_debug.result
index 85eaf34b033..d578fa957fc 100644
--- a/mysql-test/r/variables_debug.result
+++ b/mysql-test/r/variables_debug.result
@@ -1,3 +1,4 @@
+SET @old_debug = @@GLOBAL.debug;
set debug= 'T';
select @@debug;
@@debug
@@ -22,4 +23,5 @@ SET GLOBAL debug='';
SELECT @@global.debug;
@@global.debug
+SET GLOBAL debug=@old_debug;
End of 5.1 tests
diff --git a/mysql-test/std_data/intersect-bug50389.tsv b/mysql-test/std_data/intersect-bug50389.tsv
new file mode 100644
index 00000000000..f84359603a8
--- /dev/null
+++ b/mysql-test/std_data/intersect-bug50389.tsv
@@ -0,0 +1,441 @@
+3304605 1221256 0 0 abcdefghijklmnopwrst
+3304606 1221259 0 0 abcdefghijklmnopwrst
+3304607 1221260 0 0 asdfghjklzxcvbnm
+3304629 1221273 0 0 asdfghjklzxcvbnm
+3304630 1221273 0 0 asdfghjklzxcvbnm
+3304634 1221259 0 0 asdfghjklzxcvbnm
+3304644 1221278 0 0 abcdefghijklmnopwrst
+3304648 1221278 0 0 abcdefghijklmnopwrst
+3304649 1221278 0 1 asdfghjklzxcvbnm
+3304650 1221278 0 0 asdfghjklzxcvbnm
+3304651 1221282 0 0 abcdefghijklmnopwrst
+3304660 1221287 0 0 asdfghjklzxcvbnm
+3304662 1221288 0 0 abcdefghijklmnopwrst
+3304663 1221288 0 0 abcdefghijklmnopwrst
+3304664 1221290 0 0 abcdefghijklmnopwrst
+3304670 1221290 0 0 asdfghjklzxcvbnm
+3304671 1221292 0 0 abcdefghijklmnopwrst
+3304672 1221287 0 0 asdfghjklzxcvbnm
+3304673 1221294 0 0 asdfghjklzxcvbnm
+3304674 1221287 0 0 asdfghjklzxcvbnm
+3304676 1221296 0 0 abcdefghijklmnopwrst
+3304677 1221287 0 0 abcdefghijklmnopwrst
+3304678 1221287 0 0 abcdefghijklmnopwrst
+3304679 1221297 0 0 asdfghjklzxcvbnm
+3304680 1221290 0 0 abcdefghijklmnopwrst
+3304681 1221290 0 0 abcdefghijklmnopwrst
+3304685 1221300 0 0 asdfghjklzxcvbnm
+3304687 1221302 0 0 abcdefghijklmnopwrst
+3304688 1221296 1221298 0 abcdefghijklmnopwrst
+3304692 1221309 0 0 asdfghjklzxcvbnm
+3304694 1221309 0 0 asdfghjklzxcvbnm
+3304695 1221290 0 0 abcdefghijklmnopwrst
+3304696 1221313 0 0 asdfghjklzxcvbnm
+3304701 1221314 0 0 asdfghjklzxcvbnm
+3304703 1221313 0 0 abcdefghijklmnopwrst
+3304707 1221313 0 0 asdfghjklzxcvbnm
+3304709 1221313 0 0 abcdefghijklmnopwrst
+3304713 1221314 0 0 abcdefghijklmnopwrst
+3304715 1221317 0 0 abcdefghijklmnopwrst
+3304717 1221319 0 0 asdfghjklzxcvbnm
+3304718 1221320 0 0 abcdefghijklmnopwrst
+3304723 1221314 0 0 abcdefghijklmnopwrst
+3304724 1221314 0 0 asdfghjklzxcvbnm
+3304725 1221300 0 0 asdfghjklzxcvbnm
+3304726 1221314 0 0 asdfghjklzxcvbnm
+3304730 1221326 0 0 asdfghjklzxcvbnm
+3304732 1221328 0 0 asdfghjklzxcvbnm
+3304733 1221329 0 0 asdfghjklzxcvbnm
+3304745 1221331 0 0 abcdefghijklmnopwrst
+3304747 1221300 0 0 abcdefghijklmnopwrst
+3304752 1221332 0 0 asdfghjklzxcvbnm
+3304756 1221333 0 0 asdfghjklzxcvbnm
+3304765 1221336 0 0 asdfghjklzxcvbnm
+3304767 1221338 0 0 abcdefghijklmnopwrst
+3304769 1221340 0 0 asdfghjklzxcvbnm
+3304770 1221328 0 0 asdfghjklzxcvbnm
+3304771 1221328 0 0 abcdefghijklmnopwrst
+3304773 1221340 0 0 asdfghjklzxcvbnm
+3304774 1221340 0 0 abcdefghijklmnopwrst
+3304775 1221338 1221342 1 asdfghjklzxcvbnm
+3304778 1221345 0 0 asdfghjklzxcvbnm
+3304786 1221332 0 0 asdfghjklzxcvbnm
+3304787 1221347 0 0 abcdefghijklmnopwrst
+3304789 1221347 0 0 asdfghjklzxcvbnm
+3304793 1221349 0 0 abcdefghijklmnopwrst
+3304794 1221350 0 0 asdfghjklzxcvbnm
+3304800 1221290 0 0 asdfghjklzxcvbnm
+3304802 1221290 0 0 asdfghjklzxcvbnm
+3304803 1221290 0 0 asdfghjklzxcvbnm
+3304810 1221356 0 0 asdfghjklzxcvbnm
+3304811 1221356 0 0 asdfghjklzxcvbnm
+3304821 1221364 0 0 asdfghjklzxcvbnm
+3304823 1221365 0 0 asdfghjklzxcvbnm
+3304824 1221366 0 0 abcdefghijklmnopwrst
+3304825 1221365 0 0 asdfghjklzxcvbnm
+3304826 1221367 0 0 asdfghjklzxcvbnm
+3304828 1221369 0 0 abcdefghijklmnopwrst
+3304829 1221366 1221368 0 asdfghjklzxcvbnm
+3304831 1221372 0 0 abcdefghijklmnopwrst
+3304832 1221364 1221373 0 abcdefghijklmnopwrst
+3304833 1221364 1221371 0 asdfghjklzxcvbnm
+3304834 1221364 0 0 abcdefghijklmnopwrst
+3304836 1221375 0 0 abcdefghijklmnopwrst
+3304837 1221364 0 0 abcdefghijklmnopwrst
+3304838 1221364 1221376 0 asdfghjklzxcvbnm
+3304840 1221372 0 0 asdfghjklzxcvbnm
+3304842 1221372 0 1 abcdefghijklmnopwrst
+3304844 1221372 0 0 asdfghjklzxcvbnm
+3304845 1221372 0 0 abcdefghijklmnopwrst
+3304847 1221382 0 0 abcdefghijklmnopwrst
+3304848 1221372 0 0 abcdefghijklmnopwrst
+3304849 1221372 0 0 asdfghjklzxcvbnm
+3304852 1221364 1221378 0 asdfghjklzxcvbnm
+3304853 1221383 0 0 abcdefghijklmnopwrst
+3304854 1221384 0 0 asdfghjklzxcvbnm
+3304855 1221347 0 0 asdfghjklzxcvbnm
+3304858 1221383 0 0 abcdefghijklmnopwrst
+3304862 1221386 0 0 abcdefghijklmnopwrst
+3304864 1221387 0 0 abcdefghijklmnopwrst
+3304867 1221389 0 0 abcdefghijklmnopwrst
+3304868 1221390 0 0 asdfghjklzxcvbnm
+3304869 1221391 0 0 asdfghjklzxcvbnm
+3304871 1221393 0 0 asdfghjklzxcvbnm
+3304874 1221395 0 0 abcdefghijklmnopwrst
+3304877 1221396 0 0 abcdefghijklmnopwrst
+3304879 1221396 0 0 asdfghjklzxcvbnm
+3304882 1221398 0 0 abcdefghijklmnopwrst
+3304883 1221399 0 0 abcdefghijklmnopwrst
+3304884 1221400 0 0 abcdefghijklmnopwrst
+3304889 1221405 0 0 abcdefghijklmnopwrst
+3304895 1221409 0 0 asdfghjklzxcvbnm
+3304899 1221395 0 0 asdfghjklzxcvbnm
+3304900 1221395 0 0 asdfghjklzxcvbnm
+3304902 1221395 0 0 abcdefghijklmnopwrst
+3304903 1221395 0 0 asdfghjklzxcvbnm
+3304924 1221414 0 0 abcdefghijklmnopwrst
+3304925 1221415 0 0 asdfghjklzxcvbnm
+3304935 1221416 0 0 asdfghjklzxcvbnm
+3304936 1221418 0 0 asdfghjklzxcvbnm
+3304944 1221419 0 0 abcdefghijklmnopwrst
+3304959 1221427 0 0 asdfghjklzxcvbnm
+3304963 1221415 0 0 asdfghjklzxcvbnm
+3304964 1221428 0 0 asdfghjklzxcvbnm
+3304965 1221429 0 0 abcdefghijklmnopwrst
+3304978 1221433 0 0 abcdefghijklmnopwrst
+3304986 1221437 0 0 asdfghjklzxcvbnm
+3304988 1221439 0 0 asdfghjklzxcvbnm
+3304994 1221441 0 0 asdfghjklzxcvbnm
+3304996 1221442 0 0 asdfghjklzxcvbnm
+3304998 1221443 0 0 asdfghjklzxcvbnm
+3305003 1221446 0 0 abcdefghijklmnopwrst
+3305008 1221433 0 0 abcdefghijklmnopwrst
+3305009 1221447 0 0 asdfghjklzxcvbnm
+3305012 1221447 0 0 asdfghjklzxcvbnm
+3305013 1221449 0 0 abcdefghijklmnopwrst
+3305015 1221451 0 0 asdfghjklzxcvbnm
+3305019 1221453 0 0 asdfghjklzxcvbnm
+3305023 1221449 0 0 asdfghjklzxcvbnm
+3305026 1221456 0 0 abcdefghijklmnopwrst
+3305028 1221457 0 0 asdfghjklzxcvbnm
+3305032 1221449 0 0 asdfghjklzxcvbnm
+3305037 1221453 0 0 asdfghjklzxcvbnm
+3305040 1221451 0 0 asdfghjklzxcvbnm
+3305061 1221446 0 0 abcdefghijklmnopwrst
+3305175 1221457 0 0 abcdefghijklmnopwrst
+3305304 1221453 0 0 abcdefghijklmnopwrst
+3305308 1221453 0 1 abcdefghijklmnopwrst
+3305333 1221457 1221577 0 asdfghjklzxcvbnm
+3305335 1221453 0 0 asdfghjklzxcvbnm
+3305354 1221457 0 1 asdfghjklzxcvbnm
+3306089 1221442 0 0 abcdefghijklmnopwrst
+3306090 1221442 0 0 abcdefghijklmnopwrst
+3306092 1221442 0 0 asdfghjklzxcvbnm
+3306345 1221366 0 0 asdfghjklzxcvbnm
+3306349 1221366 0 0 asdfghjklzxcvbnm
+3306419 1221364 1221371 0 asdfghjklzxcvbnm
+3307390 1221453 0 0 abcdefghijklmnopwrst
+3308002 1221416 1221417 0 abcdefghijklmnopwrst
+3308331 1221366 1222821 0 abcdefghijklmnopwrst
+3309991 1221347 0 0 asdfghjklzxcvbnm
+3311917 1221287 0 0 abcdefghijklmnopwrst
+3311937 1221287 0 0 abcdefghijklmnopwrst
+3311945 1221287 0 0 asdfghjklzxcvbnm
+3311955 1221287 0 0 abcdefghijklmnopwrst
+3311961 1221287 0 0 asdfghjklzxcvbnm
+3311963 1221287 0 1 asdfghjklzxcvbnm
+3311968 1221287 0 0 asdfghjklzxcvbnm
+3311974 1221287 0 1 abcdefghijklmnopwrst
+3311976 1221287 0 1 abcdefghijklmnopwrst
+3311981 1221287 0 1 abcdefghijklmnopwrst
+3311985 1221287 0 1 asdfghjklzxcvbnm
+3312014 1221287 0 0 abcdefghijklmnopwrst
+3312018 1221287 0 1 abcdefghijklmnopwrst
+3312025 1221287 0 0 abcdefghijklmnopwrst
+3312027 1221287 0 0 abcdefghijklmnopwrst
+3312030 1221287 0 0 abcdefghijklmnopwrst
+3313755 1221288 0 0 abcdefghijklmnopwrst
+3313767 1221288 0 0 asdfghjklzxcvbnm
+3314668 1221290 0 0 asdfghjklzxcvbnm
+3314670 1221290 0 0 abcdefghijklmnopwrst
+3323440 1221338 0 0 abcdefghijklmnopwrst
+3323736 1221338 0 0 asdfghjklzxcvbnm
+3323739 1221338 0 0 asdfghjklzxcvbnm
+3324077 1221290 0 0 asdfghjklzxcvbnm
+3324081 1221290 0 0 abcdefghijklmnopwrst
+3324082 1221290 0 0 abcdefghijklmnopwrst
+3324639 1221457 1221563 1 asdfghjklzxcvbnm
+3326180 1221287 0 0 abcdefghijklmnopwrst
+3326204 1221287 0 0 asdfghjklzxcvbnm
+3326945 1221457 1221563 1 asdfghjklzxcvbnm
+3328393 1221364 1221373 0 asdfghjklzxcvbnm
+3328966 1221287 0 0 abcdefghijklmnopwrst
+3329875 1221457 1382427 0 abcdefghijklmnopwrst
+3333449 1221278 1231113 0 abcdefghijklmnopwrst
+3336022 1221457 0 0 abcdefghijklmnopwrst
+3340069 1221364 1221373 0 abcdefghijklmnopwrst
+3340073 1221364 1221373 0 abcdefghijklmnopwrst
+3340563 1221290 0 0 asdfghjklzxcvbnm
+3341553 1221453 0 0 abcdefghijklmnopwrst
+3345868 1221287 0 0 asdfghjklzxcvbnm
+3345873 1221287 0 0 abcdefghijklmnopwrst
+3345879 1221287 0 0 asdfghjklzxcvbnm
+3346860 1221457 0 0 abcdefghijklmnopwrst
+3347053 1221287 0 0 asdfghjklzxcvbnm
+3347109 1221287 0 1 abcdefghijklmnopwrst
+3350589 1221372 1236415 0 abcdefghijklmnopwrst
+3350594 1221372 1236415 1 asdfghjklzxcvbnm
+3353871 1221457 0 0 asdfghjklzxcvbnm
+3354727 1221364 1221373 0 abcdefghijklmnopwrst
+3355270 1221393 0 1 abcdefghijklmnopwrst
+3357638 1221287 0 0 asdfghjklzxcvbnm
+3357644 1221287 0 0 abcdefghijklmnopwrst
+3357648 1221287 0 0 abcdefghijklmnopwrst
+3357651 1221287 0 0 asdfghjklzxcvbnm
+3357661 1221287 0 0 abcdefghijklmnopwrst
+3357678 1221287 0 0 abcdefghijklmnopwrst
+3357697 1221287 0 0 asdfghjklzxcvbnm
+3357737 1221287 0 0 asdfghjklzxcvbnm
+3357744 1221287 0 0 abcdefghijklmnopwrst
+3357754 1221287 0 1 asdfghjklzxcvbnm
+3357760 1221287 0 1 abcdefghijklmnopwrst
+3357774 1221287 0 1 abcdefghijklmnopwrst
+3357779 1221287 0 0 abcdefghijklmnopwrst
+3357796 1221287 0 0 asdfghjklzxcvbnm
+3357814 1221287 0 0 asdfghjklzxcvbnm
+3357833 1221287 0 1 asdfghjklzxcvbnm
+3357835 1221287 0 0 abcdefghijklmnopwrst
+3357840 1221287 0 1 asdfghjklzxcvbnm
+3357842 1221287 0 0 abcdefghijklmnopwrst
+3357845 1221287 0 1 abcdefghijklmnopwrst
+3357849 1221287 0 1 abcdefghijklmnopwrst
+3357852 1221287 0 0 abcdefghijklmnopwrst
+3358935 1221443 0 1 abcdefghijklmnopwrst
+3358967 1221443 0 1 abcdefghijklmnopwrst
+3359181 1221256 0 0 abcdefghijklmnopwrst
+3360512 1221319 0 0 asdfghjklzxcvbnm
+3362004 1221287 0 0 abcdefghijklmnopwrst
+3362009 1221287 0 1 abcdefghijklmnopwrst
+3362358 1221287 0 0 asdfghjklzxcvbnm
+3363214 1221287 0 0 abcdefghijklmnopwrst
+3363238 1221287 0 1 asdfghjklzxcvbnm
+3363616 1221287 0 1 asdfghjklzxcvbnm
+3363631 1221287 0 0 asdfghjklzxcvbnm
+3364281 1221287 0 0 abcdefghijklmnopwrst
+3365900 1221347 0 0 asdfghjklzxcvbnm
+3365901 1221347 0 0 asdfghjklzxcvbnm
+3365906 1221347 0 0 asdfghjklzxcvbnm
+3365907 1221347 0 0 asdfghjklzxcvbnm
+3365910 1221347 0 0 abcdefghijklmnopwrst
+3365936 1221347 0 0 abcdefghijklmnopwrst
+3367846 1221287 0 0 abcdefghijklmnopwrst
+3368011 1221428 0 0 abcdefghijklmnopwrst
+3369882 1221300 0 0 asdfghjklzxcvbnm
+3370856 1221443 0 0 asdfghjklzxcvbnm
+3370861 1221443 1221445 0 abcdefghijklmnopwrst
+3375327 1221443 0 0 abcdefghijklmnopwrst
+3375333 1221443 1221445 0 abcdefghijklmnopwrst
+3376219 1221453 0 1 abcdefghijklmnopwrst
+3376228 1221453 0 0 abcdefghijklmnopwrst
+3376238 1221453 0 0 asdfghjklzxcvbnm
+3376243 1221453 0 0 abcdefghijklmnopwrst
+3376248 1221453 0 1 abcdefghijklmnopwrst
+3376254 1221453 0 0 abcdefghijklmnopwrst
+3376263 1221453 0 0 abcdefghijklmnopwrst
+3376272 1221453 0 1 asdfghjklzxcvbnm
+3376281 1221453 0 0 asdfghjklzxcvbnm
+3376290 1221453 0 0 abcdefghijklmnopwrst
+3376296 1221453 0 1 abcdefghijklmnopwrst
+3376301 1221453 0 0 asdfghjklzxcvbnm
+3376350 1221453 0 0 asdfghjklzxcvbnm
+3379002 1221453 0 0 abcdefghijklmnopwrst
+3379015 1221453 0 0 asdfghjklzxcvbnm
+3379025 1221453 0 0 abcdefghijklmnopwrst
+3379032 1221453 0 0 asdfghjklzxcvbnm
+3380181 1221372 1245650 0 asdfghjklzxcvbnm
+3380186 1221372 1245650 0 abcdefghijklmnopwrst
+3380190 1221372 1245650 0 asdfghjklzxcvbnm
+3380195 1221372 1245650 0 abcdefghijklmnopwrst
+3380202 1221372 1245650 0 asdfghjklzxcvbnm
+3380683 1221287 0 0 asdfghjklzxcvbnm
+3382317 1221453 0 0 abcdefghijklmnopwrst
+3382417 1221287 0 0 asdfghjklzxcvbnm
+3383523 1221338 0 1 abcdefghijklmnopwrst
+3387213 1221287 0 0 abcdefghijklmnopwrst
+3388139 1221453 0 0 asdfghjklzxcvbnm
+3398039 1221443 1251164 0 abcdefghijklmnopwrst
+3401835 1221453 0 0 asdfghjklzxcvbnm
+3412582 1221443 1255886 0 asdfghjklzxcvbnm
+3412583 1221443 1255886 0 asdfghjklzxcvbnm
+3413795 1221443 1255886 0 asdfghjklzxcvbnm
+3413813 1221443 1256258 0 asdfghjklzxcvbnm
+3420306 1221453 0 0 asdfghjklzxcvbnm
+3420354 1221453 0 0 asdfghjklzxcvbnm
+3425653 1221443 0 0 abcdefghijklmnopwrst
+3425658 1221443 0 0 asdfghjklzxcvbnm
+3431409 1221453 0 0 asdfghjklzxcvbnm
+3432510 1221443 1262320 0 asdfghjklzxcvbnm
+3432513 1221443 1262320 0 asdfghjklzxcvbnm
+3444444 1221443 1262320 0 abcdefghijklmnopwrst
+3445447 1221287 0 1 asdfghjklzxcvbnm
+3448662 1221338 0 0 asdfghjklzxcvbnm
+3450032 1221347 0 0 abcdefghijklmnopwrst
+3450259 1221453 0 0 abcdefghijklmnopwrst
+3452176 1221453 0 0 asdfghjklzxcvbnm
+3459239 1221347 0 0 asdfghjklzxcvbnm
+3463196 1221347 0 0 abcdefghijklmnopwrst
+3468759 1221453 0 0 abcdefghijklmnopwrst
+3470988 1221457 0 0 asdfghjklzxcvbnm
+3477116 1221287 0 0 asdfghjklzxcvbnm
+3477639 1221372 1277136 0 abcdefghijklmnopwrst
+3477656 1221372 1277136 0 asdfghjklzxcvbnm
+3488071 1221256 1238964 0 abcdefghijklmnopwrst
+3488079 1221256 0 0 asdfghjklzxcvbnm
+3488108 1221256 0 1 asdfghjklzxcvbnm
+3507126 1221287 0 1 asdfghjklzxcvbnm
+3511898 1221347 0 0 asdfghjklzxcvbnm
+3521780 1221453 0 0 abcdefghijklmnopwrst
+3536908 1221287 0 0 abcdefghijklmnopwrst
+3544231 1221329 0 1 asdfghjklzxcvbnm
+3545379 1221329 1298955 0 abcdefghijklmnopwrst
+3545384 1221329 1298955 0 abcdefghijklmnopwrst
+3545387 1221329 1298955 0 abcdefghijklmnopwrst
+3545389 1221329 1298955 1 abcdefghijklmnopwrst
+3545398 1221329 1298955 1 abcdefghijklmnopwrst
+3555715 1221287 0 0 asdfghjklzxcvbnm
+3563557 1221329 1298955 0 abcdefghijklmnopwrst
+3564322 1221338 0 0 asdfghjklzxcvbnm
+3565475 1221453 0 0 abcdefghijklmnopwrst
+3577588 1221287 0 0 asdfghjklzxcvbnm
+3600047 1221453 0 0 abcdefghijklmnopwrst
+3600062 1221453 0 0 asdfghjklzxcvbnm
+3600071 1221453 0 0 abcdefghijklmnopwrst
+3600080 1221453 0 1 abcdefghijklmnopwrst
+3600086 1221453 0 0 asdfghjklzxcvbnm
+3600091 1221453 0 1 abcdefghijklmnopwrst
+3600097 1221453 0 0 asdfghjklzxcvbnm
+3600103 1221453 0 0 asdfghjklzxcvbnm
+3600106 1221453 0 0 abcdefghijklmnopwrst
+3600113 1221453 0 0 abcdefghijklmnopwrst
+3600119 1221453 0 0 asdfghjklzxcvbnm
+3600124 1221453 0 0 abcdefghijklmnopwrst
+3600144 1221453 0 0 asdfghjklzxcvbnm
+3600152 1221453 0 0 asdfghjklzxcvbnm
+3600165 1221453 0 0 asdfghjklzxcvbnm
+3610561 1221287 0 0 abcdefghijklmnopwrst
+3617030 1221329 0 0 asdfghjklzxcvbnm
+3628347 1221443 1327098 0 abcdefghijklmnopwrst
+3628348 1221443 1327098 0 abcdefghijklmnopwrst
+3628646 1221443 0 0 asdfghjklzxcvbnm
+3633673 1221372 1328838 0 abcdefghijklmnopwrst
+3648489 1221443 0 0 asdfghjklzxcvbnm
+3648490 1221443 0 0 asdfghjklzxcvbnm
+3648534 1221443 1333827 0 asdfghjklzxcvbnm
+3653046 1221329 1298955 0 asdfghjklzxcvbnm
+3662680 1221287 0 0 asdfghjklzxcvbnm
+3699529 1221288 0 0 asdfghjklzxcvbnm
+3706659 1221453 0 0 asdfghjklzxcvbnm
+3723399 1221287 0 1 asdfghjklzxcvbnm
+3749934 1221278 0 0 abcdefghijklmnopwrst
+3761370 1221443 1371176 0 asdfghjklzxcvbnm
+3765884 1221443 1333827 0 abcdefghijklmnopwrst
+3772880 1221457 0 0 abcdefghijklmnopwrst
+3779574 1221457 1372998 1 abcdefghijklmnopwrst
+3784656 1221457 1372998 1 abcdefghijklmnopwrst
+3784700 1221457 1372998 1 abcdefghijklmnopwrst
+3784744 1221457 1382427 0 abcdefghijklmnopwrst
+3796187 1221457 1382427 1 abcdefghijklmnopwrst
+3796193 1221457 0 0 abcdefghijklmnopwrst
+3817277 1221457 1382427 0 asdfghjklzxcvbnm
+3828282 1221457 0 0 abcdefghijklmnopwrst
+3828297 1221457 0 0 abcdefghijklmnopwrst
+3828300 1221457 0 0 abcdefghijklmnopwrst
+3833022 1221287 0 0 asdfghjklzxcvbnm
+3856380 1221457 1395359 0 asdfghjklzxcvbnm
+3856391 1221457 0 0 asdfghjklzxcvbnm
+3861413 1221256 0 0 abcdefghijklmnopwrst
+3864734 1221393 0 1 abcdefghijklmnopwrst
+3868051 1221329 0 0 abcdefghijklmnopwrst
+3868059 1221329 0 0 abcdefghijklmnopwrst
+3869088 1221329 0 0 abcdefghijklmnopwrst
+3878669 1221329 1298955 0 asdfghjklzxcvbnm
+3878684 1221329 1298955 0 asdfghjklzxcvbnm
+3881785 1221287 0 0 abcdefghijklmnopwrst
+3882333 1221287 0 0 asdfghjklzxcvbnm
+3882389 1221287 0 0 abcdefghijklmnopwrst
+3908680 1221372 1245650 0 asdfghjklzxcvbnm
+3908690 1221372 1245650 0 asdfghjklzxcvbnm
+3908697 1221372 1245650 0 abcdefghijklmnopwrst
+3911434 1221453 0 0 abcdefghijklmnopwrst
+3911446 1221453 0 0 asdfghjklzxcvbnm
+3911448 1221453 0 0 abcdefghijklmnopwrst
+3911489 1221453 0 0 abcdefghijklmnopwrst
+3917384 1221453 0 0 abcdefghijklmnopwrst
+3939602 1221457 0 1 asdfghjklzxcvbnm
+3962210 1221453 0 0 asdfghjklzxcvbnm
+3963734 1221457 0 0 asdfghjklzxcvbnm
+3977364 1221287 0 0 asdfghjklzxcvbnm
+3981725 1221453 0 0 abcdefghijklmnopwrst
+4042952 1221453 0 0 abcdefghijklmnopwrst
+4042953 1221453 0 0 abcdefghijklmnopwrst
+4042958 1221453 0 0 abcdefghijklmnopwrst
+4042960 1221453 0 1 abcdefghijklmnopwrst
+4042965 1221453 0 0 asdfghjklzxcvbnm
+4066893 1221453 0 1 abcdefghijklmnopwrst
+4066896 1221453 0 0 abcdefghijklmnopwrst
+4066900 1221453 0 0 abcdefghijklmnopwrst
+4066908 1221453 0 0 abcdefghijklmnopwrst
+4066912 1221453 0 0 asdfghjklzxcvbnm
+4066915 1221453 0 0 asdfghjklzxcvbnm
+4066919 1221453 0 0 abcdefghijklmnopwrst
+4066924 1221453 0 0 asdfghjklzxcvbnm
+4066929 1221453 0 0 abcdefghijklmnopwrst
+4066934 1221453 0 0 asdfghjklzxcvbnm
+4066941 1221453 0 0 abcdefghijklmnopwrst
+4066946 1221453 0 0 asdfghjklzxcvbnm
+4066955 1221453 0 0 abcdefghijklmnopwrst
+4116291 1221433 1487238 0 asdfghjklzxcvbnm
+4116295 1221433 1487238 0 abcdefghijklmnopwrst
+4116450 1221433 1487238 0 abcdefghijklmnopwrst
+4121149 1221287 0 0 asdfghjklzxcvbnm
+4137325 1221453 0 0 abcdefghijklmnopwrst
+4149051 1221287 0 0 abcdefghijklmnopwrst
+4162347 1221287 0 0 abcdefghijklmnopwrst
+4164485 1221457 0 1 asdfghjklzxcvbnm
+4174706 1221457 0 0 abcdefghijklmnopwrst
+4178645 1221457 0 0 abcdefghijklmnopwrst
+4180122 1221457 1382427 0 asdfghjklzxcvbnm
+4180925 1221457 1382427 0 asdfghjklzxcvbnm
+4186417 1221457 0 0 abcdefghijklmnopwrst
+4189624 1221457 0 1 asdfghjklzxcvbnm
+4203132 1221453 0 0 asdfghjklzxcvbnm
+4228206 1221457 0 0 abcdefghijklmnopwrst
+4278829 1221453 0 0 abcdefghijklmnopwrst
+4326422 1221453 0 0 abcdefghijklmnopwrst
+4337061 1221287 0 0 abcdefghijklmnopwrst
+4379354 1221287 0 0 abcdefghijklmnopwrst
+4404901 1221457 0 0 abcdefghijklmnopwrst
+4494153 1221457 0 0 abcdefghijklmnopwrst
+4535721 1221287 0 0 asdfghjklzxcvbnm
+4559596 1221457 0 0 abcdefghijklmnopwrst
+4617751 1221393 0 0 abcdefghijklmnopwrst
diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result
index 58c444c9571..7fb5e50a219 100644
--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result
+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result
@@ -91,3 +91,14 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA==
';
ERROR HY000: master may suffer from http://bugs.mysql.com/bug.php?id=37426 so slave stops; check error log on slave for more info
drop table t1, char63_utf8, char128_utf8;
+#
+# Bug #54393: crash and/or valgrind errors in
+# mysql_client_binlog_statement
+#
+BINLOG '';
+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
+BINLOG '123';
+BINLOG '-2079193929';
+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
+BINLOG 'xç↓%~∙D╒ƒ╡';
+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
diff --git a/mysql-test/suite/binlog/r/binlog_innodb.result b/mysql-test/suite/binlog/r/binlog_innodb.result
index 1922897f631..881d8d2719e 100644
--- a/mysql-test/suite/binlog/r/binlog_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_innodb.result
@@ -156,9 +156,9 @@ select * from t2 /* must be (3,1), (4,4) */;
a b
1 1
4 4
-show master status /* there must no UPDATE in binlog */;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 106
+# There must no UPDATE in binlog;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
@@ -166,8 +166,8 @@ 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 */;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 106
+# There must be no UPDATE query event;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
drop table t1, t2;
End of tests
diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result
index 4d32a4f4739..d612e7adde1 100644
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result
@@ -26,215 +26,215 @@ create table t1 (n int) engine=innodb;
begin;
commit;
drop table t1;
-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 # use `test`; create table t1 (n int) engine=innodb
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # Table_map 1 # table_id: # (test.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-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 # 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;
+master-bin.000001 # Query # # use `test`; create table t1 (n int) engine=innodb
+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 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # 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 */
+master-bin.000001 # Rotate # # master-bin.000002;pos=4
+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 1 # use `test`; drop table t1
+master-bin.000002 # Query # # use `test`; drop table t1
set @ac = @@autocommit;
set autocommit= 0;
reset master;
@@ -245,830 +245,828 @@ insert into t1 values (2);
insert into t1 values (3);
commit;
drop table t1;
-show binlog events from 0;
+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 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
+master-bin.000001 # Query # # use `test`; create table t1(n int) engine=innodb
+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 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; drop table t1
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;
+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 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 Table_map 1 315 table_id: # (test.t1)
-master-bin.000001 315 Write_rows 1 349 table_id: # flags: STMT_END_F
-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 # Query # # use `test`; create table t1 (a int) engine=innodb
+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 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # 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 */
+master-bin.000001 # Rotate # # master-bin.000002;pos=4
drop table t1;
set global binlog_cache_size=@bcs;
set session autocommit = @ac;
@@ -1081,15 +1079,14 @@ set @b= 14632475938453979136;
execute stmt using @a, @b;
deallocate prepare stmt;
drop table t1;
-show binlog events from 0;
+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 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 # Query # # use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
+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 # # use `test`; drop table t1
reset master;
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE bug39182;
@@ -1289,14 +1286,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 # <Binlog_Do_DB> <Binlog_Ignore_DB>
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 */;
+show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000002 106
+master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB>
drop table t3;
#
# Bug #45998: database crashes when running "create as select"
diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
index 9057395ab82..8b42cadf6cb 100644
--- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
@@ -879,11 +879,11 @@ delete from t4;
insert into t3 values (1,1),(2,2);
insert into t4 values (1,1),(2,2);
reset master;
-UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
+UPDATE t3,t4 SET t3.a = t4.a + bug27417(1) where t3.a = 1;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
select count(*) from t1 /* must be 1 */;
count(*)
-2
+1
drop table t4;
delete from t1;
delete from t2;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
index a7f79e53895..abfd6a33a7d 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
@@ -3,14 +3,13 @@ create table t1 (a int, b int) engine=innodb;
begin;
insert into t1 values (1,2);
commit;
-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: #, Binlog ver: #
-master-bin.000001 106 Query 1 192 use `test`; drop table if exists t1
-master-bin.000001 192 Query 1 299 use `test`; create table t1 (a int, b int) engine=innodb
-master-bin.000001 299 Query 1 367 BEGIN
-master-bin.000001 367 Query 1 457 use `test`; insert into t1 values (1,2)
-master-bin.000001 457 Xid 1 484 COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; drop table if exists t1
+master-bin.000001 # Query # # use `test`; create table t1 (a int, b int) engine=innodb
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values (1,2)
+master-bin.000001 # Xid # # COMMIT /* XID */
drop table t1;
drop table if exists t1, t2;
reset master;
@@ -38,115 +37,115 @@ create table t1 (n int) engine=innodb;
begin;
commit;
drop table t1;
-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 # use `test`; create table t1 (n int) engine=innodb
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(100 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(99 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(98 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(97 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(96 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(95 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(94 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(93 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(92 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(91 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(90 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(89 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(88 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(87 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(86 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(85 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(84 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(83 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(82 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(81 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(80 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(79 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(78 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(77 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(76 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(75 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(74 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(73 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(72 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(71 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(70 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(69 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(68 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(67 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(66 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(65 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(64 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(63 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(62 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(61 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(60 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(59 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(58 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(57 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(56 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(55 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(54 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(53 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(52 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(51 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(50 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(49 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(48 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(47 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(46 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(45 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(44 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(43 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(42 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(41 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(40 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(39 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(38 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(37 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(36 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(35 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(34 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(33 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(32 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(31 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(30 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(29 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(28 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(27 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(26 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(25 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(24 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(23 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(22 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(21 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(20 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(19 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(18 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(17 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(16 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(15 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(14 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(13 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(12 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(11 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(10 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(9 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(8 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(7 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(6 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(5 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(4 + 4)
-master-bin.000001 # Query 1 # use `test`; insert into t1 values(3 + 4)
-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;
+master-bin.000001 # Query # # use `test`; create table t1 (n int) engine=innodb
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values(100 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(99 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(98 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(97 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(96 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(95 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(94 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(93 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(92 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(91 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(90 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(89 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(88 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(87 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(86 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(85 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(84 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(83 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(82 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(81 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(80 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(79 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(78 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(77 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(76 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(75 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(74 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(73 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(72 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(71 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(70 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(69 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(68 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(67 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(66 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(65 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(64 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(63 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(62 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(61 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(60 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(59 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(58 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(57 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(56 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(55 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(54 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(53 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(52 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(51 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(50 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(49 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(48 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(47 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(46 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(45 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(44 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(43 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(42 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(41 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(40 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(39 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(38 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(37 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(36 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(35 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(34 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(33 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(32 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(31 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(30 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(29 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(28 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(27 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(26 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(25 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(24 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(23 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(22 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(21 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(20 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(19 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(18 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(17 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(16 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(15 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(14 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(13 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(12 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(11 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(10 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(9 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(8 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(7 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(6 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(5 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(4 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(3 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(2 + 4)
+master-bin.000001 # Query # # use `test`; insert into t1 values(1 + 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Rotate # # master-bin.000002;pos=4
+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 1 # use `test`; drop table t1
+master-bin.000002 # Query # # use `test`; drop table t1
set @ac = @@autocommit;
set autocommit= 0;
reset master;
@@ -157,427 +156,425 @@ insert into t1 values (2);
insert into t1 values (3);
commit;
drop table t1;
-show binlog events from 0;
+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 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 # Query # # use `test`; create table t1(n int) engine=innodb
+master-bin.000001 # Query # # BEGIN
+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 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # 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;
+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 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 # Query # # use `test`; create table t1 (a int) engine=innodb
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; insert into t1 values( 400 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 399 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 398 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 397 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 396 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 395 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 394 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 393 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 392 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 391 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 390 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 389 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 388 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 387 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 386 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 385 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 384 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 383 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 382 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 381 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 380 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 379 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 378 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 377 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 376 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 375 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 374 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 373 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 372 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 371 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 370 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 369 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 368 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 367 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 366 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 365 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 364 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 363 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 362 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 361 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 360 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 359 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 358 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 357 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 356 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 355 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 354 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 353 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 352 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 351 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 350 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 349 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 348 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 347 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 346 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 345 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 344 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 343 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 342 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 341 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 340 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 339 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 338 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 337 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 336 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 335 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 334 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 333 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 332 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 331 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 330 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 329 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 328 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 327 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 326 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 325 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 324 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 323 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 322 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 321 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 320 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 319 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 318 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 317 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 316 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 315 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 314 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 313 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 312 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 311 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 310 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 309 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 308 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 307 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 306 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 305 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 304 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 303 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 302 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 301 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 300 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 299 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 298 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 297 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 296 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 295 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 294 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 293 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 292 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 291 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 290 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 289 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 288 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 287 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 286 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 285 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 284 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 283 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 282 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 281 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 280 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 279 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 278 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 277 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 276 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 275 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 274 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 273 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 272 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 271 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 270 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 269 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 268 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 267 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 266 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 265 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 264 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 263 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 262 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 261 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 260 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 259 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 258 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 257 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 256 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 255 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 254 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 253 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 252 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 251 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 250 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 249 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 248 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 247 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 246 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 245 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 244 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 243 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 242 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 241 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 240 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 239 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 238 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 237 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 236 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 235 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 234 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 233 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 232 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 231 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 230 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 229 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 228 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 227 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 226 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 225 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 224 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 223 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 222 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 221 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 220 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 219 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 218 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 217 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 216 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 215 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 214 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 213 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 212 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 211 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 210 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 209 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 208 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 207 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 206 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 205 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 204 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 203 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 202 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 201 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 200 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 199 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 198 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 197 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 196 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 195 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 194 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 193 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 192 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 191 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 190 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 189 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 188 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 187 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 186 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 185 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 184 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 183 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 182 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 181 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 180 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 179 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 178 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 177 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 176 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 175 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 174 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 173 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 172 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 171 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 170 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 169 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 168 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 167 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 166 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 165 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 164 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 163 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 162 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 161 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 160 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 159 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 158 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 157 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 156 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 155 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 154 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 153 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 152 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 151 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 150 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 149 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 148 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 147 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 146 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 145 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 144 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 143 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 142 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 141 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 140 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 139 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 138 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 137 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 136 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 135 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 134 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 133 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 132 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 131 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 130 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 129 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 128 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 127 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 126 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 125 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 124 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 123 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 122 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 121 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 120 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 119 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 118 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 117 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 116 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 115 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 114 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 113 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 112 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 111 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 110 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 109 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 108 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 107 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 105 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 104 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 103 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 102 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 101 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 100 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 99 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 98 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 97 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 96 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 95 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 94 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 93 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 92 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 91 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 90 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 89 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 88 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 87 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 86 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 85 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 84 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 83 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 82 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 81 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 80 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 79 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 78 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 77 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 76 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 75 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 74 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 73 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 72 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 71 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 70 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 69 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 68 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 67 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 66 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 65 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 64 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 63 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 62 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 61 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 60 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 59 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 58 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 57 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 56 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 55 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 54 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 53 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 52 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 51 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 50 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 49 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 48 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 47 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 46 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 45 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 44 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 43 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 42 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 41 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 40 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 39 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 38 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 37 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 36 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 35 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 34 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 33 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 32 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 31 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 30 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 29 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 28 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 27 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 26 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 25 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 24 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 23 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 22 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 21 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 20 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 19 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 18 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 17 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 16 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 15 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 14 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 13 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 12 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 11 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 10 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 9 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 8 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 7 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 6 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 5 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 4 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 3 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 2 )
+master-bin.000001 # Query # # use `test`; insert into t1 values( 1 )
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Rotate # # master-bin.000002;pos=4
drop table t1;
set global binlog_cache_size=@bcs;
set session autocommit = @ac;
@@ -590,12 +587,11 @@ set @b= 14632475938453979136;
execute stmt using @a, @b;
deallocate prepare stmt;
drop table t1;
-show binlog events from 0;
+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 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 # Query # # use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
+master-bin.000001 # Query # # use `test`; insert into t1 values (9999999999999999,14632475938453979136)
+master-bin.000001 # Query # # use `test`; drop table t1
reset master;
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE bug39182;
@@ -766,14 +762,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 # <Binlog_Do_DB> <Binlog_Ignore_DB>
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 */;
+show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000002 106
+master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB>
drop table t3;
#
# Bug #45998: database crashes when running "create as select"
diff --git a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
index b2e6ac854cf..a47ab2ce932 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
@@ -104,9 +104,8 @@ select * from t2;
a
select * from t3;
a
-show binlog events;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc # # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query # # use `test`; drop table t1,t2
master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=blackhole
master-bin.000001 # Query # # BEGIN
@@ -126,7 +125,7 @@ master-bin.000001 # Query # # use `test`; replace into t1 values(100)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; create table t2 (a varchar(200)) engine=blackhole
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=581
+master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`) ;file_id=#
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; alter table t1 add b int
@@ -163,13 +162,6 @@ start transaction;
insert into t1 values(2);
rollback;
set autocommit=1;
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc # # Server ver: VERSION, Binlog ver: 4
-master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=blackhole
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; insert into t1 values(1)
-master-bin.000001 # Query # # COMMIT
drop table if exists t1;
reset master;
create table t1 (a int auto_increment, primary key (a)) engine=blackhole;
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 75094ca3b4c..a26fcc1dc1a 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
@@ -364,6 +364,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (10,10)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100)
master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (101,101)
+master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # use `test`; DROP TABLE t1,t2
reset master;
create table t1 (a int) engine=innodb;
@@ -802,7 +805,7 @@ delete from t4;
insert into t3 values (1,1),(2,2);
insert into t4 values (1,1),(2,2);
reset master;
-UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
+UPDATE t3,t4 SET t3.a = t4.a + bug27417(1) where t3.a = 1;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
select count(*) from t1 /* must be 1 */;
count(*)
diff --git a/mysql-test/suite/binlog/t/binlog_base64_flag.test b/mysql-test/suite/binlog/t/binlog_base64_flag.test
index e6271ec6ccc..3f1e4e98bec 100644
--- a/mysql-test/suite/binlog/t/binlog_base64_flag.test
+++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test
@@ -150,3 +150,16 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA==
';
drop table t1, char63_utf8, char128_utf8;
+
+
+--echo #
+--echo # Bug #54393: crash and/or valgrind errors in
+--echo # mysql_client_binlog_statement
+--echo #
+--error ER_SYNTAX_ERROR
+BINLOG '';
+BINLOG '123';
+--error ER_SYNTAX_ERROR
+BINLOG '-2079193929';
+--error ER_SYNTAX_ERROR
+BINLOG 'xç↓%~∙D╒ƒ╡';
diff --git a/mysql-test/suite/binlog/t/binlog_innodb.test b/mysql-test/suite/binlog/t/binlog_innodb.test
index f84fd65226a..2914cd1dcc5 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_binlog_events.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 be no UPDATE query event;
+source include/show_binlog_events.inc;
# cleanup bug#27716
drop table t1, t2;
diff --git a/mysql-test/suite/binlog/t/binlog_stm_binlog.test b/mysql-test/suite/binlog/t/binlog_stm_binlog.test
index a8afe4d3b8c..f5257f21434 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_binlog.test
+++ b/mysql-test/suite/binlog/t/binlog_stm_binlog.test
@@ -12,8 +12,7 @@ create table t1 (a int, b int) engine=innodb;
begin;
insert into t1 values (1,2);
commit;
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-show binlog events;
+source include/show_binlog_events.inc;
drop table t1;
# This is a wrapper for binlog.test so that the same test case can be used
diff --git a/mysql-test/suite/bugs/r/rpl_bug12691.result b/mysql-test/suite/bugs/r/rpl_bug12691.result
index 69d5e8009b0..8feeb0effc3 100644
--- a/mysql-test/suite/bugs/r/rpl_bug12691.result
+++ b/mysql-test/suite/bugs/r/rpl_bug12691.result
@@ -16,12 +16,11 @@ LOAD DATA INFILE FILENAME
SELECT COUNT(*) FROM t1;
COUNT(*)
3
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: #
-master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (b CHAR(10))
-master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=#
-master-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE FILENAME ;file_id=#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (b CHAR(10))
+master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/rpl_bug12691.dat' INTO TABLE `t1` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`b`) ;file_id=#
**** On Slave ****
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
diff --git a/mysql-test/suite/bugs/r/rpl_bug36391.result b/mysql-test/suite/bugs/r/rpl_bug36391.result
index 2d62837a87a..33175d89d30 100644
--- a/mysql-test/suite/bugs/r/rpl_bug36391.result
+++ b/mysql-test/suite/bugs/r/rpl_bug36391.result
@@ -13,5 +13,6 @@ Tables_in_test
t1
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 278
+master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
flush logs;
+drop table t1;
diff --git a/mysql-test/suite/bugs/t/rpl_bug12691.test b/mysql-test/suite/bugs/t/rpl_bug12691.test
index b29c85584a5..28d7f16935e 100644
--- a/mysql-test/suite/bugs/t/rpl_bug12691.test
+++ b/mysql-test/suite/bugs/t/rpl_bug12691.test
@@ -28,9 +28,7 @@ STOP SLAVE;
SELECT COUNT(*) FROM t1;
---replace_column 2 # 5 #
---replace_regex /Server ver: .+/Server ver: #/ /table_id: [0-9]+/table_id: #/ /COMMIT.+xid=[0-9]+.+/#/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /'.+'/FILENAME/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
--save_master_pos
diff --git a/mysql-test/suite/bugs/t/rpl_bug36391.test b/mysql-test/suite/bugs/t/rpl_bug36391.test
index 9f384304837..8bca9a46c5a 100644
--- a/mysql-test/suite/bugs/t/rpl_bug36391.test
+++ b/mysql-test/suite/bugs/t/rpl_bug36391.test
@@ -21,8 +21,10 @@ create table t1(id int);
show tables;
-show master status;
+--source include/show_master_status.inc
flush logs;
--exec $MYSQL_BINLOG $MYSQL_TEST_DIR/var/log/master-bin.000001 | $MYSQL test
+
+drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_000015.result b/mysql-test/suite/engines/funcs/r/rpl_000015.result
index eee3b505ad6..8cd48141127 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_000015.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_000015.result
@@ -10,166 +10,25 @@ File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106
stop slave;
reset slave;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry #
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
change master to master_host='127.0.0.1';
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry #
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
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry #
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
start slave;
-show slave status;
-Slave_IO_State Waiting for master to send event
-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 106
-Relay_Log_File slave-relay-bin.000002
-Relay_Log_Pos 252
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 106
-Relay_Log_Space 407
-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
+Checking that both slave threads are running.
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/engines/funcs/r/rpl_REDIRECT.result b/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result
index 7a901b65810..b6cb2c0e7de 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result
@@ -4,8 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
+SHOW SLAVE STATUS;;
SHOW SLAVE HOSTS;
Server_id Host Port Rpl_recovery_rank Master_id
2 127.0.0.1 SLAVE_PORT 0 1
diff --git a/mysql-test/suite/engines/funcs/r/rpl_change_master.result b/mysql-test/suite/engines/funcs/r/rpl_change_master.result
index 62c5ffdd4f8..2258a35a869 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_change_master.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_change_master.result
@@ -11,13 +11,7 @@ stop slave sql_thread;
insert into t1 values(1);
insert into t1 values(2);
stop slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # No 0 0
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_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # No 0 0
start slave;
select * from t1;
n
diff --git a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result b/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result
index b5e14d3adac..f71411c68dd 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result
@@ -4,8 +4,6 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
load table t1 from master;
ERROR 08S01: Error connecting to master: Master is not configured
load table t1 from master;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
index c894ad0135b..ef4d7797dbf 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
@@ -17,43 +17,6 @@ let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%
--source include/wait_slave_status.inc
flush logs;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port SLAVE_PORT
-Connect_Retry 60
-Master_Log_File slave-bin.000001
-Read_Master_Log_Pos 106
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File slave-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos 106
-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
+Relay_Log_File mysqld-relay-bin.000003
+Checking that both slave threads are running.
STOP SLAVE;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
index d858ced1352..779a3af9631 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
@@ -10,6 +10,6 @@ load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
select count(*) from test.t1;
count(*)
2
-show binlog events from 106;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
drop table test.t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
index f26f4350cf1..1b2ded26f66 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
@@ -4,39 +4,23 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-show master status;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 106 <Binlog_Ignore_DB>
-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 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No # No 0 0
stop slave;
-change master to master_log_pos=106;
+change master to master_log_pos=MASTER_LOG_POS;
start slave;
stop slave;
-change master to master_log_pos=106;
-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 106 # # master-bin.000001 No No 0 0 106 # None 0 No # No 0 0
+change master to master_log_pos=MASTER_LOG_POS;
start slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No # No 0 0
stop slave;
-change master to master_log_pos=177;
+# impossible position leads to an error
+change master to master_log_pos=MASTER_LOG_POS;
start slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 177 # # master-bin.000001 No Yes 0 0 177 # None 0 No # No 1236 Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position' 0
-show master status;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 106 <Binlog_Ignore_DB>
+Last_IO_Error = Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position'
create table if not exists t1 (n int);
drop table if exists t1;
create table t1 (n int);
insert into t1 values (1),(2),(3);
stop slave;
-change master to master_log_pos=206;
+change master to master_log_pos=MASTER_LOG_POS;
start slave;
select * from t1 ORDER BY n;
n
diff --git a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
index b4b04d35208..ced1693bdc8 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
@@ -14,47 +14,16 @@ MIXED MIXED
CREATE TABLE t1 (a INT, b LONG);
INSERT INTO t1 VALUES (1,1), (2,2);
INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
**** On Slave ****
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
-SHOW 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, b LONG)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+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
+show binlog events from <binlog_start>;
DROP TABLE IF EXISTS t1;
SET GLOBAL BINLOG_FORMAT=@saved_binlog_format;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
index 89654ebf165..048e07271b3 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
@@ -41,12 +41,11 @@ t1
t2
**** On Master ****
DROP TABLE t1,t2;
-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 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 # Query # # use `test`; CREATE TABLE t1 (a int)
+master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int)
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
SHOW TABLES;
Tables_in_test
t2
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
index ad192b530a7..cd7528280d0 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
@@ -17,43 +17,5 @@ a
0
drop table t1;
insert into t1 values (1);
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table test.t2
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1146
-Last_Error Error 'Table 'test.t1' doesn't exist' on opening tables
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 1146
-Last_SQL_Error Error 'Table 'test.t1' doesn't exist' on opening tables
+Last_SQL_Error = Error 'Table 'test.t1' doesn't exist' on opening tables
drop table t1, t2;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result b/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
index 6ef88c23726..c0f7ddabec7 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
@@ -24,45 +24,7 @@ select @@global.max_relay_log_size;
@@global.max_relay_log_size
4096
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 2
#
@@ -72,45 +34,7 @@ set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size;
@@global.max_relay_log_size 20480
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 3: max_relay_log_size = 0
#
@@ -120,90 +44,13 @@ set global max_relay_log_size=0;
select @@global.max_relay_log_size;
@@global.max_relay_log_size 0
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
stop slave;
reset slave;
flush logs;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File
-Read_Master_Log_Pos #
-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
#
# Test 5
#
@@ -211,89 +58,13 @@ reset slave;
start slave;
flush logs;
create table t1 (a int);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs;
drop table t1;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
index fa40d8760a8..7bf09df31ca 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
@@ -4,196 +4,37 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-stop slave;
-change master to master_user='test';
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+include/stop_slave.inc
+change master to master_user='test';
Master_User test
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running 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
-reset slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+reset slave;
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File
-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
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+include/start_slave.inc
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-stop slave;
+Master_Host 127.0.0.1
+include/stop_slave.inc
reset slave;
-start slave;
+include/start_slave.inc
create temporary table t1 (a int);
-stop slave;
+include/stop_slave.inc
reset slave;
-start slave;
+include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
-stop slave;
+include/stop_slave.inc
reset slave;
-*** errno must be zero: 0 ***
change master to master_user='impossible_user_name';
start slave;
-ONE
-1
include/stop_slave.inc
change master to master_user='root';
include/start_slave.inc
-*** last errno must be zero: 0 ***
-*** last error must be blank: ***
include/stop_slave.inc
change master to master_user='impossible_user_name';
start slave;
-ONE
-1
include/stop_slave.inc
reset slave;
-*** io last errno must be zero: 0 ***
-*** io last error must be blank: ***
-*** sql last errno must be zero: 0 ***
-*** sql last error must be blank: ***
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_until.result b/mysql-test/suite/engines/funcs/r/rpl_row_until.result
index 5091a9f6468..72dd1a6a7c3 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_until.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_until.result
@@ -12,193 +12,39 @@ create table t2(n int not null auto_increment primary key);
insert into t2 values (1),(2);
insert into t2 values (3),(4);
drop table t2;
-start slave until master_log_file='master-bin.000001', master_log_pos=311;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
select * from t1;
n
1
2
3
4
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File slave-relay-bin.000004
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running #
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-bin.000001
-Until_Log_Pos 311
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=MASTER_LOG_POS;
select * from t1;
-n 1
-n 2
-n 3
-n 4
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File slave-relay-bin.000004
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running #
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-no-such-bin.000001
-Until_Log_Pos 291
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
+n
+1
+2
+3
+4
+start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=RELAY_LOG_POS;
select * from t2;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File slave-relay-bin.000004
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running #
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Relay
-Until_Log_File slave-relay-bin.000004
-Until_Log_Pos 728
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
+n
+1
+2
start slave;
stop slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File slave-relay-bin.000004
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-bin.000001
-Until_Log_Pos 740
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
-start slave until master_log_file='master-bin', master_log_pos=561;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
+start slave until master_log_file='master-bin', master_log_pos=MASTER_LOG_POS;
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;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS, relay_log_pos=RELAY_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until relay_log_file='slave-relay-bin.000002';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=MASTER_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave sql_thread;
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
Warnings:
-Level Note
-Code 1254
-Message Slave is already running
+Note 1254 Slave is already running
diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
index 47c2a522094..1e7108d7961 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
@@ -8,10 +8,8 @@ create table t1 (n int);
reset master;
stop slave;
change master to master_port=SLAVE_PORT;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
- 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 106 None 0 No NULL No 0 0
start slave;
+Last_IO_Error = Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
insert into t1 values (1);
show status like "slave_running";
Variable_name Value
diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
index d50814022d8..066b563c4e8 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
@@ -8,9 +8,6 @@ create table t1 (n int);
reset master;
stop slave;
change master to master_port=SLAVE_PORT;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
- 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 106 None 0 No NULL No 0 0
start slave;
insert into t1 values (1);
select * from t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
index dfc82f61e68..c4dc7686045 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
@@ -18,44 +18,5 @@ drop user rpl@127.0.0.1;
flush privileges;
stop slave;
start slave;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User rpl
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running No
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master NULL
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
drop table t1;
drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result b/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
index 2215b34814e..db06cb6d3de 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
@@ -21,45 +21,7 @@ select @@global.max_relay_log_size;
@@global.max_relay_log_size
4096
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 2
#
@@ -69,45 +31,7 @@ set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size;
@@global.max_relay_log_size 20480
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 3: max_relay_log_size = 0
#
@@ -117,90 +41,13 @@ set global max_relay_log_size=0;
select @@global.max_relay_log_size;
@@global.max_relay_log_size 0
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
stop slave;
reset slave;
flush logs;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File
-Read_Master_Log_Pos #
-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
#
# Test 5
#
@@ -208,89 +55,13 @@ reset slave;
start slave;
flush logs;
create table t1 (a int);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs;
drop table t1;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result b/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
index 78d9d7c41eb..1fc189975ef 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
@@ -4,196 +4,37 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-stop slave;
-change master to master_user='test';
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+include/stop_slave.inc
+change master to master_user='test';
Master_User test
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running 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
-reset slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+reset slave;
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File
-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
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+include/start_slave.inc
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-stop slave;
+Master_Host 127.0.0.1
+include/stop_slave.inc
reset slave;
-start slave;
+include/start_slave.inc
create temporary table t1 (a int);
-stop slave;
+include/stop_slave.inc
reset slave;
-start slave;
+include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
-stop slave;
+include/stop_slave.inc
reset slave;
-*** errno must be zero: 0 ***
change master to master_user='impossible_user_name';
start slave;
-ONE
-1
include/stop_slave.inc
change master to master_user='root';
include/start_slave.inc
-*** last errno must be zero: 0 ***
-*** last error must be blank: ***
include/stop_slave.inc
change master to master_user='impossible_user_name';
start slave;
-ONE
-1
include/stop_slave.inc
reset slave;
-*** io last errno must be zero: 0 ***
-*** io last error must be blank: ***
-*** sql last errno must be zero: 0 ***
-*** sql last error must be blank: ***
diff --git a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
index 466302000af..61d77c0dc2a 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
@@ -376,7 +376,7 @@ CREATE TABLE t12 (data LONG);
LOCK TABLES t12 WRITE;
INSERT INTO t12 VALUES(UUID());
UNLOCK TABLES;
-show binlog events;
-show binlog events;
+show binlog events from <binlog_start>;
+show binlog events from <binlog_start>;
drop database mysqltest1;
set global binlog_format= @saved_binlog_format;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000015.test b/mysql-test/suite/engines/funcs/t/rpl_000015.test
index 817ed6f407c..6c18e66a3a6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_000015.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_000015.test
@@ -11,31 +11,25 @@ save_master_pos;
connection slave;
stop slave;
reset slave;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 5 # 8 # 9 # 23 # 33 #
-show slave status;
+let $status_items= Master_Log_File, Read_Master_Log_Pos, Relay_Master_Log_File, Exec_Master_Log_Pos;
+source include/show_slave_status.inc;
change master to master_host='127.0.0.1';
# The following needs to be cleaned up when change master is fixed
---vertical_results
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 5 # 8 # 9 # 23 # 33 #
-show slave status;
+source include/show_slave_status.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;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 5 # 8 # 9 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
+
start slave;
sync_with_master;
+let $status_items= Master_Log_File, Relay_Master_Log_File;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
+
--vertical_results
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 5 # 8 # 9 # 23 # 33 #
---replace_column 33 #
-show slave status;
connection master;
--disable_warnings
drop table if exists t1;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test b/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
index 078d1048794..7644b18ee7e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
@@ -7,15 +7,11 @@ source include/master-slave.inc;
--disable_ps_protocol
#first, make sure the slave has had enough time to register
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#discover slaves
connection master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-SHOW SLAVE STATUS;
+--query_vertical SHOW SLAVE STATUS;
--replace_result $SLAVE_MYPORT SLAVE_PORT
SHOW SLAVE HOSTS;
rpl_probe;
@@ -25,9 +21,7 @@ enable_rpl_parse;
create table t1 ( n int);
insert into t1 values (1),(2),(3),(4);
disable_rpl_parse;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
insert into t1 values(5);
connection master;
enable_rpl_parse;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_change_master.test b/mysql-test/suite/engines/funcs/t/rpl_change_master.test
index c031464c95e..ce8c921c2ad 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_change_master.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_change_master.test
@@ -18,13 +18,26 @@ save_master_pos;
connection slave;
--real_sleep 3 # wait for I/O thread to have read updates
stop slave;
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 23 # 33 #
-show slave status;
+source include/wait_for_slave_to_stop.inc;
+
+let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
+if (`SELECT $read_pos = $exec_pos`)
+{
+ source include/show_rpl_debug_info.inc;
+ echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos';
+ die Failed because Read_Master_Log_Pos is equal to Exec_Master_Log_Pos;
+}
change master to master_user='root';
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 23 # 33 #
-show slave status;
+let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
+if (`SELECT $read_pos <> $exec_pos`)
+{
+ source include/show_rpl_debug_info.inc;
+ echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos';
+ die Failed because Read_Master_Log_Pos is not equal to Exec_Master_Log_Pos;
+}
+
start slave;
sync_with_master;
select * from t1;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test b/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test
index 707d1eca8c2..863b450a6d9 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test
@@ -1,8 +1,5 @@
source include/master-slave.inc;
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
-
#
# Load table should not succeed on the master as this is not a slave
#
diff --git a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
index 2e481f5e5e7..0b71817226a 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
@@ -41,8 +41,7 @@ sleep 5;
#
# Show status of slave
#
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
---vertical_results
-SHOW SLAVE STATUS;
+--let status_items= Relay_Log_File
+--source include/show_slave_status.inc
+--source include/check_slave_is_running.inc
STOP SLAVE;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
index 791fe84420f..2dd2218eb5c 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
@@ -20,9 +20,7 @@ save_master_pos;
connection slave;
sync_with_master;
select count(*) from test.t1; # check that LOAD was replicated
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events from 106; # should be nothing
+source include/show_binlog_events.inc;
# Cleanup
connection master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
index 13083e47bcf..e07f0d5f2a7 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
@@ -11,36 +11,41 @@
# Passes with rbr no problem, removed statement include [jbm]
source include/master-slave.inc;
---replace_column 3 <Binlog_Ignore_DB>
-show master status;
+let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
sync_slave_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
stop slave;
-change master to master_log_pos=106;
+
+--replace_result $master_log_pos MASTER_LOG_POS
+eval change master to master_log_pos=$master_log_pos;
start slave;
sleep 5;
stop slave;
-change master to master_log_pos=106;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+
+--replace_result $master_log_pos MASTER_LOG_POS
+eval change master to master_log_pos=$master_log_pos;
+--let $slave_param= Read_Master_Log_Pos
+--let $slave_param_value= $master_log_pos
+--source include/wait_for_slave_param.inc
+
start slave;
sleep 5;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+--let $slave_param= Read_Master_Log_Pos
+--let $slave_param_value= $master_log_pos
+--source include/wait_for_slave_param.inc
+--source include/check_slave_no_error.inc
+
stop slave;
+--echo # impossible position leads to an error
+--replace_result 177 MASTER_LOG_POS
change master to master_log_pos=177;
start slave;
sleep 2;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+let $slave_io_errno= 1236;
+let $show_slave_io_error= 1;
+source include/wait_for_slave_io_error.inc;
connection master;
---replace_column 3 <Binlog_Ignore_DB>
-show master status;
+
+let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
create table if not exists t1 (n int);
drop table if exists t1;
create table t1 (n int);
@@ -48,7 +53,9 @@ insert into t1 values (1),(2),(3);
save_master_pos;
connection slave;
stop slave;
-change master to master_log_pos=206;
+
+--replace_result $master_log_pos MASTER_LOG_POS
+eval change master to master_log_pos=$master_log_pos;
start slave;
sync_with_master;
select * from t1 ORDER BY n;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
index d466382dc92..c9d27d1ea6a 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
@@ -15,25 +15,17 @@ SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
CREATE TABLE t1 (a INT, b LONG);
INSERT INTO t1 VALUES (1,1), (2,2);
INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
# Different number of binlog events are generated by different engines
--disable_result_log
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
--enable_result_log
sync_slave_with_master;
--echo **** On Slave ****
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
+source include/show_binlog_events.inc;
+
# Different number of binlog events are generated by different engines
--disable_result_log
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
--enable_result_log
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
index 20c217a7c3a..d18ebc2846b 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
@@ -30,10 +30,7 @@ connection master;
--echo **** On Master ****
# Should drop the non-temporary table t1 and the temporary table t2
DROP TABLE t1,t2;
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
SHOW TABLES;
sync_slave_with_master;
--echo **** On Slave ****
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
index 736071a8ece..dca2894c9da 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
@@ -22,13 +22,11 @@ connection master;
insert into t1 values (1);
connection slave;
-# slave should have stopped because can't find table t1
-wait_for_slave_to_stop;
+# slave should have stopped because can't find table t1
# see if we have a good error message:
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
---vertical_results
-show slave status;
+--let $slave_sql_errno= 1146
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
# cleanup
connection master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_until.test b/mysql-test/suite/engines/funcs/t/rpl_row_until.test
index ccd9ce11637..b60734317c6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_until.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_until.test
@@ -18,44 +18,50 @@ connection master;
# create some events on master
create table t1(n int not null auto_increment primary key);
insert into t1 values (1),(2),(3),(4);
+let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
drop table t1;
+
create table t2(n int not null auto_increment primary key);
insert into t2 values (1),(2);
+let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
insert into t2 values (3),(4);
drop table t2;
# try to replicate all queries until drop of t1
connection slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=311;
+--replace_result $master_log_pos_1 MASTER_LOG_POS
+eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_log_pos_1;
sleep 2;
wait_for_slave_to_stop;
# here table should be still not deleted
select * from t1;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
-show slave status;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos_1
+--source include/check_slave_param.inc
# this should fail right after start
+--replace_result 291 MASTER_LOG_POS
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
# again this table should be still not deleted
select * from t1;
sleep 2;
wait_for_slave_to_stop;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
-show slave status;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos_1
+--source include/check_slave_param.inc
# try replicate all up to and not including the second insert to t2;
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
+let $master_log_pos= $master_log_pos_2;
+let $relay_log_file= slave-relay-bin.000004;
+--source include/get_relay_log_pos.inc
+--replace_result $relay_log_pos RELAY_LOG_POS
+eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos;
sleep 2;
wait_for_slave_to_stop;
select * from t2;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
-show slave status;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos
+--source include/check_slave_param.inc
# clean up
start slave;
@@ -65,27 +71,32 @@ connection slave;
sync_with_master;
stop slave;
+--let $exec_log_pos_1= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
# this should stop immediately as we are already there
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
+--replace_result $master_log_pos_2 MASTER_LOG_POS
+eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_log_pos_2;
sleep 2;
wait_for_slave_to_stop;
# here the sql slave thread should be stopped
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
---replace_column 1 # 7 # 9 # 22 # 23 # 33 #
-show slave status;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $exec_log_pos_1
+--source include/check_slave_param.inc
#testing various error conditions
+--replace_result 561 MASTER_LOG_POS
--error 1277
start slave until master_log_file='master-bin', master_log_pos=561;
+--replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
--error 1277
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
--error 1277
start slave until master_log_file='master-bin.000001';
--error 1277
start slave until relay_log_file='slave-relay-bin.000002';
+--replace_result 561 MASTER_LOG_POS
--error 1277
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
# Warning should be given for second command
start slave sql_thread;
+--replace_result 740 MASTER_LOG_POS
start slave until master_log_file='master-bin.000001', master_log_pos=740;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
index 71310750b60..014f38d3544 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
@@ -12,10 +12,13 @@ reset master;
stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 16 # 18 #
-show slave status;
+source include/check_slave_no_error.inc;
+
start slave;
+let $slave_io_errno= 1593;
+let $show_slave_io_error= 1;
+source include/wait_for_slave_io_error.inc;
+
insert into t1 values (1);
# can't MASTER_POS_WAIT(), it does not work in this weird setup
# (when slave is its own master without --replicate-same-server-id)
diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
index 0f2eb560d18..5b8683ecfb1 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
@@ -9,9 +9,6 @@ reset master;
stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 18 #
-show slave status;
start slave;
insert into t1 values (1);
save_master_pos;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
index b3d6e49e215..cc3fbf6abee 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
@@ -22,9 +22,7 @@ drop table if exists t1;
--enable_warnings
create table t1 (n int);
insert into t1 values (1);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
# 3. Delete new replication user
@@ -40,12 +38,8 @@ stop slave;
start slave;
# 5. Make sure Slave_IO_Running = No
---replace_result $MASTER_MYPORT MASTER_MYPORT
-# Column 1 is replaced, since the output can be either
-# "Connecting to master" or "Waiting for master update"
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 #
---vertical_results
-show slave status;
+let $slave_io_errno= 1045;
+source include/wait_for_slave_io_error.inc;
# Cleanup (Note that slave IO thread is not running)
connection slave;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
index d89765fb28d..eb2e2a828f3 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
@@ -501,9 +501,7 @@ INSERT INTO t12 VALUES(UUID());
UNLOCK TABLES;
--disable_result_log
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events;
+source include/show_binlog_events.inc;
--enable_result_log
sync_slave_with_master;
@@ -520,9 +518,7 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_
connection master;
--disable_result_log
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events;
+source include/show_binlog_events.inc;
--enable_result_log
# Now test that mysqlbinlog works fine on a binlog generated by the
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result
index 7f5639a57db..89c0d29016f 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -64,7 +64,7 @@ NULL information_schema COLUMN_PRIVILEGES PRIVILEGE_TYPE 6 NO varchar 64 192 NU
NULL information_schema COLUMN_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
NULL information_schema COLUMN_PRIVILEGES TABLE_NAME 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
NULL information_schema COLUMN_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema ENGINES COMMENT 3 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select
+NULL information_schema ENGINES COMMENT 3 NO varchar 160 480 NULL NULL utf8 utf8_general_ci varchar(160) select
NULL information_schema ENGINES ENGINE 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
NULL information_schema ENGINES SAVEPOINTS 6 NULL YES varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
NULL information_schema ENGINES SUPPORT 2 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select
@@ -225,14 +225,15 @@ NULL information_schema INNODB_SYS_INDEXES PAGE_NO 7 0 NO bigint NULL NULL 19 0
NULL information_schema INNODB_SYS_INDEXES SPACE 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_SYS_INDEXES TABLE_ID 1 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_SYS_INDEXES TYPE 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-NULL information_schema INNODB_SYS_TABLES CLUSTER_NAME 7 NO varchar 192 576 NULL NULL utf8 utf8_general_ci varchar(192) select
-NULL information_schema INNODB_SYS_TABLES ID 2 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-NULL information_schema INNODB_SYS_TABLES MIX_ID 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-NULL information_schema INNODB_SYS_TABLES MIX_LEN 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-NULL information_schema INNODB_SYS_TABLES NAME 1 NO varchar 192 576 NULL NULL utf8 utf8_general_ci varchar(192) select
-NULL information_schema INNODB_SYS_TABLES N_COLS 3 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-NULL information_schema INNODB_SYS_TABLES SPACE 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-NULL information_schema INNODB_SYS_TABLES TYPE 4 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+NULL information_schema INNODB_SYS_TABLES CLUSTER_NAME 8 NO varchar 192 576 NULL NULL utf8 utf8_general_ci varchar(192) select
+NULL information_schema INNODB_SYS_TABLES ID 3 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+NULL information_schema INNODB_SYS_TABLES MIX_ID 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+NULL information_schema INNODB_SYS_TABLES MIX_LEN 7 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+NULL information_schema INNODB_SYS_TABLES NAME 2 NO varchar 192 576 NULL NULL utf8 utf8_general_ci varchar(192) select
+NULL information_schema INNODB_SYS_TABLES N_COLS 4 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+NULL information_schema INNODB_SYS_TABLES SCHEMA 1 NO varchar 192 576 NULL NULL utf8 utf8_general_ci varchar(192) select
+NULL information_schema INNODB_SYS_TABLES SPACE 9 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+NULL information_schema INNODB_SYS_TABLES TYPE 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_TABLE_STATS clust_size 4 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_TABLE_STATS modified 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema INNODB_TABLE_STATS other_size 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
@@ -608,7 +609,7 @@ NULL information_schema COLUMNS NUMERIC_SCALE bigint NULL NULL NULL NULL bigint(
3.0000 information_schema COLUMN_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema ENGINES ENGINE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema ENGINES SUPPORT varchar 8 24 utf8 utf8_general_ci varchar(8)
-3.0000 information_schema ENGINES COMMENT varchar 80 240 utf8 utf8_general_ci varchar(80)
+3.0000 information_schema ENGINES COMMENT varchar 160 480 utf8 utf8_general_ci varchar(160)
3.0000 information_schema ENGINES TRANSACTIONS varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema ENGINES XA varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema ENGINES SAVEPOINTS varchar 3 9 utf8 utf8_general_ci varchar(3)
@@ -767,6 +768,7 @@ NULL information_schema INNODB_SYS_INDEXES N_FIELDS bigint NULL NULL NULL NULL b
NULL information_schema INNODB_SYS_INDEXES TYPE bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema INNODB_SYS_INDEXES SPACE bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema INNODB_SYS_INDEXES PAGE_NO bigint NULL NULL NULL NULL bigint(21) unsigned
+3.0000 information_schema INNODB_SYS_TABLES SCHEMA varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INNODB_SYS_TABLES NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
NULL information_schema INNODB_SYS_TABLES ID bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema INNODB_SYS_TABLES N_COLS bigint NULL NULL NULL NULL bigint(21) unsigned
diff --git a/mysql-test/suite/funcs_1/r/is_engines.result b/mysql-test/suite/funcs_1/r/is_engines.result
index 9965fc5ad73..e76cbe7bdee 100644
--- a/mysql-test/suite/funcs_1/r/is_engines.result
+++ b/mysql-test/suite/funcs_1/r/is_engines.result
@@ -30,7 +30,7 @@ DESCRIBE information_schema.ENGINES;
Field Type Null Key Default Extra
ENGINE varchar(64) NO
SUPPORT varchar(8) NO
-COMMENT varchar(80) NO
+COMMENT varchar(160) NO
TRANSACTIONS varchar(3) YES NULL
XA varchar(3) YES NULL
SAVEPOINTS varchar(3) YES NULL
@@ -39,7 +39,7 @@ Table Create Table
ENGINES CREATE TEMPORARY TABLE `ENGINES` (
`ENGINE` varchar(64) NOT NULL DEFAULT '',
`SUPPORT` varchar(8) NOT NULL DEFAULT '',
- `COMMENT` varchar(80) NOT NULL DEFAULT '',
+ `COMMENT` varchar(160) NOT NULL DEFAULT '',
`TRANSACTIONS` varchar(3) DEFAULT NULL,
`XA` varchar(3) DEFAULT NULL,
`SAVEPOINTS` varchar(3) DEFAULT NULL
@@ -48,7 +48,7 @@ SHOW COLUMNS FROM information_schema.ENGINES;
Field Type Null Key Default Extra
ENGINE varchar(64) NO
SUPPORT varchar(8) NO
-COMMENT varchar(80) NO
+COMMENT varchar(160) NO
TRANSACTIONS varchar(3) YES NULL
XA varchar(3) YES NULL
SAVEPOINTS varchar(3) YES NULL
diff --git a/mysql-test/suite/funcs_1/t/is_columns_is.test b/mysql-test/suite/funcs_1/t/is_columns_is.test
index eb5c119baf4..0ac687354a1 100644
--- a/mysql-test/suite/funcs_1/t/is_columns_is.test
+++ b/mysql-test/suite/funcs_1/t/is_columns_is.test
@@ -18,6 +18,7 @@
--source include/not_embedded.inc
# This test depends on having the PBXT information_schema stuff.
--source include/have_pbxt.inc
+--source include/have_xtradb.inc
let $my_where = WHERE table_schema = 'information_schema'
AND table_name <> 'profiling';
diff --git a/mysql-test/suite/funcs_1/t/is_engines_innodb.test b/mysql-test/suite/funcs_1/t/is_engines_innodb.test
index 6c20b9697f0..44c7d7652d7 100644
--- a/mysql-test/suite/funcs_1/t/is_engines_innodb.test
+++ b/mysql-test/suite/funcs_1/t/is_engines_innodb.test
@@ -11,5 +11,6 @@
let $engine_type= InnoDB;
--source include/have_innodb.inc
--vertical_results
+--replace_regex /XtraDB engine based on InnoDB plugin. //
eval SELECT * FROM information_schema.engines
WHERE ENGINE = '$engine_type';
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-44030.result b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result
index c0695bf0be0..54e972843f5 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc-44030.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result
@@ -13,18 +13,18 @@ d1
1
2
INSERT INTO t1 VALUES(null);
-Got one of the listed errors
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`d1`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
d1
1
2
3
+4
DROP TABLE t1;
diff --git a/mysql-test/r/innodb-autoinc-optimize.result b/mysql-test/suite/innodb/r/innodb-autoinc-optimize.result
index c6da43555b2..c6da43555b2 100644
--- a/mysql-test/r/innodb-autoinc-optimize.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc-optimize.result
diff --git a/mysql-test/r/innodb-ucs2.result b/mysql-test/suite/innodb/r/innodb-ucs2.result
index b6bff7d5f42..b6bff7d5f42 100644
--- a/mysql-test/r/innodb-ucs2.result
+++ b/mysql-test/suite/innodb/r/innodb-ucs2.result
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
new file mode 100644
index 00000000000..345da7a0163
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb.result
@@ -0,0 +1,2359 @@
+drop table if exists t1,t2,t3,t4;
+drop database if exists mysqltest;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
+select id, code, name from t1 order by id;
+id code name
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+8 1 Sinisa
+update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
+select id, code, name from t1 order by id;
+id code name
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+8 1 Sinisa
+12 1 Ralph
+drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+parent_id int(11) DEFAULT '0' NOT NULL,
+level tinyint(4) DEFAULT '0' NOT NULL,
+PRIMARY KEY (id),
+KEY parent_id (parent_id),
+KEY level (level)
+) engine=innodb;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+id parent_id level
+8 102 2
+9 102 2
+15 102 2
+update t1 set id=id+1000;
+update t1 set id=1024 where id=1009;
+Got one of the listed errors
+select * from t1;
+id parent_id level
+1001 100 0
+1002 101 1
+1003 101 1
+1004 101 1
+1005 101 1
+1006 101 1
+1007 101 1
+1008 102 2
+1009 102 2
+1015 102 2
+1016 103 2
+1017 103 2
+1018 103 2
+1019 103 2
+1020 103 2
+1021 104 2
+1022 104 2
+1024 104 2
+1025 105 2
+1026 105 2
+1027 105 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1034 106 2
+1035 106 2
+1036 107 2
+1037 107 2
+1038 107 2
+1040 107 2
+1157 100 0
+1179 105 2
+1183 104 2
+1193 105 2
+1202 107 2
+1203 107 2
+update ignore t1 set id=id+1;
+select * from t1;
+id parent_id level
+1001 100 0
+1002 101 1
+1003 101 1
+1004 101 1
+1005 101 1
+1006 101 1
+1007 101 1
+1008 102 2
+1010 102 2
+1015 102 2
+1016 103 2
+1017 103 2
+1018 103 2
+1019 103 2
+1020 103 2
+1021 104 2
+1023 104 2
+1024 104 2
+1025 105 2
+1026 105 2
+1027 105 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1034 106 2
+1035 106 2
+1036 107 2
+1037 107 2
+1039 107 2
+1041 107 2
+1158 100 0
+1180 105 2
+1184 104 2
+1194 105 2
+1202 107 2
+1204 107 2
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+id parent_id level
+1008 102 2
+1010 102 2
+1015 102 2
+explain select level from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using index
+explain select level,id from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using index
+explain select level,id,parent_id from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const #
+select level,id from t1 where level=1;
+level id
+1 1002
+1 1003
+1 1004
+1 1005
+1 1006
+1 1007
+select level,id,parent_id from t1 where level=1;
+level id parent_id
+1 1002 101
+1 1003 101
+1 1004 101
+1 1005 101
+1 1006 101
+1 1007 101
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 id A # NULL NULL BTREE
+t1 1 parent_id 1 parent_id A # NULL NULL BTREE
+t1 1 level 1 level A # NULL NULL BTREE
+drop table t1;
+CREATE TABLE t1 (
+gesuchnr int(11) DEFAULT '0' NOT NULL,
+benutzer_id int(11) DEFAULT '0' NOT NULL,
+PRIMARY KEY (gesuchnr,benutzer_id)
+) engine=innodb;
+replace into t1 (gesuchnr,benutzer_id) values (2,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+select * from t1;
+gesuchnr benutzer_id
+1 1
+2 1
+drop table t1;
+create table t1 (a int) engine=innodb;
+insert into t1 values (1), (2);
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+delete from t1 where a = 1;
+select * from t1;
+a
+2
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+create table t1 (a int,b varchar(20)) engine=innodb;
+insert into t1 values (1,""), (2,"testing");
+delete from t1 where a = 1;
+select * from t1;
+a b
+2 testing
+create index skr on t1 (a);
+insert into t1 values (3,""), (4,"testing");
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 skr 1 a A # NULL NULL YES BTREE
+drop table t1;
+create table t1 (a int,b varchar(20),key(a)) engine=innodb;
+insert into t1 values (1,""), (2,"testing");
+select * from t1 where a = 1;
+a b
+1
+drop table t1;
+create table t1 (n int not null primary key) engine=innodb;
+set autocommit=0;
+insert into t1 values (4);
+rollback;
+select n, "after rollback" from t1;
+n after rollback
+insert into t1 values (4);
+commit;
+select n, "after commit" from t1;
+n after commit
+4 after commit
+commit;
+insert into t1 values (5);
+insert into t1 values (4);
+ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
+commit;
+select n, "after commit" from t1;
+n after commit
+4 after commit
+5 after commit
+set autocommit=1;
+insert into t1 values (6);
+insert into t1 values (4);
+ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
+select n from t1;
+n
+4
+5
+6
+set autocommit=0;
+begin;
+savepoint `my_savepoint`;
+insert into t1 values (7);
+savepoint `savept2`;
+insert into t1 values (3);
+select n from t1;
+n
+3
+4
+5
+6
+7
+savepoint savept3;
+rollback to savepoint savept2;
+rollback to savepoint savept3;
+ERROR 42000: SAVEPOINT savept3 does not exist
+rollback to savepoint savept2;
+release savepoint `my_savepoint`;
+select n from t1;
+n
+4
+5
+6
+7
+rollback to savepoint `my_savepoint`;
+ERROR 42000: SAVEPOINT my_savepoint does not exist
+rollback to savepoint savept2;
+ERROR 42000: SAVEPOINT savept2 does not exist
+insert into t1 values (8);
+savepoint sv;
+commit;
+savepoint sv;
+set autocommit=1;
+rollback;
+drop table t1;
+create table t1 (n int not null primary key) engine=innodb;
+start transaction;
+insert into t1 values (4);
+flush tables with read lock;
+commit;
+unlock tables;
+commit;
+select * from t1;
+n
+4
+drop table t1;
+create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb;
+begin;
+insert into t1 values(1,'hamdouni');
+select id as afterbegin_id,nom as afterbegin_nom from t1;
+afterbegin_id afterbegin_nom
+1 hamdouni
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+afterrollback_id afterrollback_nom
+set autocommit=0;
+insert into t1 values(2,'mysql');
+select id as afterautocommit0_id,nom as afterautocommit0_nom from t1;
+afterautocommit0_id afterautocommit0_nom
+2 mysql
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+afterrollback_id afterrollback_nom
+set autocommit=1;
+drop table t1;
+CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb;
+insert into t1 values ('pippo', 12);
+insert into t1 values ('pippo', 12);
+ERROR 23000: Duplicate entry 'pippo' for key 'PRIMARY'
+delete from t1;
+delete from t1 where id = 'pippo';
+select * from t1;
+id val
+insert into t1 values ('pippo', 12);
+set autocommit=0;
+delete from t1;
+rollback;
+select * from t1;
+id val
+pippo 12
+delete from t1;
+commit;
+select * from t1;
+id val
+drop table t1;
+create table t1 (a integer) engine=innodb;
+start transaction;
+rename table t1 to t2;
+create table t1 (b integer) engine=innodb;
+insert into t1 values (1);
+rollback;
+drop table t1;
+rename table t2 to t1;
+drop table t1;
+set autocommit=1;
+CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 'Jochen');
+select * from t1;
+ID NAME
+1 Jochen
+drop table t1;
+CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb;
+set autocommit=0;
+INSERT INTO t1 SET _userid='marc@anyware.co.uk';
+COMMIT;
+SELECT * FROM t1;
+_userid
+marc@anyware.co.uk
+SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
+_userid
+marc@anyware.co.uk
+drop table t1;
+set autocommit=1;
+CREATE TABLE t1 (
+user_id int(10) DEFAULT '0' NOT NULL,
+name varchar(100),
+phone varchar(100),
+ref_email varchar(100) DEFAULT '' NOT NULL,
+detail varchar(200),
+PRIMARY KEY (user_id,ref_email)
+)engine=innodb;
+INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
+select * from t1 where user_id=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
+select * from t1 where user_id=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+select * from t1 where user_id>=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+10293 shirish 2333604 shirish@yahoo.com ddsds
+select * from t1 where user_id>10292;
+user_id name phone ref_email detail
+10293 shirish 2333604 shirish@yahoo.com ddsds
+select * from t1 where user_id<10292;
+user_id name phone ref_email detail
+10291 sanjeev 29153373 sansh777@hotmail.com xxx
+drop table t1;
+CREATE TABLE t1 (a int not null, b int not null,c int not null,
+key(a),primary key(a,b), unique(c),key(a),unique(b));
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a A # NULL NULL BTREE
+t1 0 PRIMARY 2 b A # NULL NULL BTREE
+t1 0 c 1 c A # NULL NULL BTREE
+t1 0 b 1 b A # NULL NULL BTREE
+t1 1 a 1 a A # NULL NULL BTREE
+t1 1 a_2 1 a A # NULL NULL BTREE
+drop table t1;
+create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
+alter table t1 engine=innodb;
+insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
+select * from t1;
+col1 col2
+1 1
+2 3
+3 4
+4 4
+5 2
+update t1 set col2='7' where col1='4';
+select * from t1;
+col1 col2
+1 1
+2 3
+3 4
+4 7
+5 2
+alter table t1 add co3 int not null;
+select * from t1;
+col1 col2 co3
+1 1 0
+2 3 0
+3 4 0
+4 7 0
+5 2 0
+update t1 set col2='9' where col1='2';
+select * from t1;
+col1 col2 co3
+1 1 0
+2 9 0
+3 4 0
+4 7 0
+5 2 0
+drop table t1;
+create table t1 (a int not null , b int, primary key (a)) engine = innodb;
+create table t2 (a int not null , b int, primary key (a)) engine = myisam;
+insert into t1 VALUES (1,3) , (2,3), (3,3);
+select * from t1;
+a b
+1 3
+2 3
+3 3
+insert into t2 select * from t1;
+select * from t2;
+a b
+1 3
+2 3
+3 3
+delete from t1 where b = 3;
+select * from t1;
+a b
+insert into t1 select * from t2;
+select * from t1;
+a b
+1 3
+2 3
+3 3
+select * from t2;
+a b
+1 3
+2 3
+3 3
+drop table t1,t2;
+CREATE TABLE t1 (
+user_name varchar(12),
+password text,
+subscribed char(1),
+user_id int(11) DEFAULT '0' NOT NULL,
+quota bigint(20),
+weight double,
+access_date date,
+access_time time,
+approved datetime,
+dummy_primary_key int(11) NOT NULL auto_increment,
+PRIMARY KEY (dummy_primary_key)
+) ENGINE=innodb;
+INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
+INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
+INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
+INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4);
+INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5);
+select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name;
+user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key
+user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1
+user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2
+user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3
+user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4
+user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5
+drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+parent_id int(11) DEFAULT '0' NOT NULL,
+level tinyint(4) DEFAULT '0' NOT NULL,
+KEY (id),
+KEY parent_id (parent_id),
+KEY level (level)
+) engine=innodb;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
+INSERT INTO t1 values (179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+id parent_id level
+8 102 2
+9 102 2
+15 102 2
+update t1 set id=id+1000;
+update t1 set id=1024 where id=1009;
+select * from t1;
+id parent_id level
+1001 100 0
+1003 101 1
+1004 101 1
+1008 102 2
+1024 102 2
+1017 103 2
+1022 104 2
+1024 104 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1203 107 2
+1202 107 2
+1020 103 2
+1157 100 0
+1193 105 2
+1040 107 2
+1002 101 1
+1015 102 2
+1006 101 1
+1034 106 2
+1035 106 2
+1016 103 2
+1007 101 1
+1036 107 2
+1018 103 2
+1026 105 2
+1027 105 2
+1183 104 2
+1038 107 2
+1025 105 2
+1037 107 2
+1021 104 2
+1019 103 2
+1005 101 1
+1179 105 2
+update ignore t1 set id=id+1;
+select * from t1;
+id parent_id level
+1002 100 0
+1004 101 1
+1005 101 1
+1009 102 2
+1025 102 2
+1018 103 2
+1023 104 2
+1025 104 2
+1029 105 2
+1030 105 2
+1031 105 2
+1032 106 2
+1033 106 2
+1034 106 2
+1204 107 2
+1203 107 2
+1021 103 2
+1158 100 0
+1194 105 2
+1041 107 2
+1003 101 1
+1016 102 2
+1007 101 1
+1035 106 2
+1036 106 2
+1017 103 2
+1008 101 1
+1037 107 2
+1019 103 2
+1027 105 2
+1028 105 2
+1184 104 2
+1039 107 2
+1026 105 2
+1038 107 2
+1022 104 2
+1020 103 2
+1006 101 1
+1180 105 2
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+id parent_id level
+1009 102 2
+1025 102 2
+1016 102 2
+explain select level from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using index
+select level,id from t1 where level=1;
+level id
+1 1004
+1 1005
+1 1003
+1 1007
+1 1008
+1 1006
+select level,id,parent_id from t1 where level=1;
+level id parent_id
+1 1004 101
+1 1005 101
+1 1003 101
+1 1007 101
+1 1008 101
+1 1006 101
+select level,id from t1 where level=1 order by id;
+level id
+1 1003
+1 1004
+1 1005
+1 1006
+1 1007
+1 1008
+delete from t1 where level=1;
+select * from t1;
+id parent_id level
+1002 100 0
+1009 102 2
+1025 102 2
+1018 103 2
+1023 104 2
+1025 104 2
+1029 105 2
+1030 105 2
+1031 105 2
+1032 106 2
+1033 106 2
+1034 106 2
+1204 107 2
+1203 107 2
+1021 103 2
+1158 100 0
+1194 105 2
+1041 107 2
+1016 102 2
+1035 106 2
+1036 106 2
+1017 103 2
+1037 107 2
+1019 103 2
+1027 105 2
+1028 105 2
+1184 104 2
+1039 107 2
+1026 105 2
+1038 107 2
+1022 104 2
+1020 103 2
+1180 105 2
+drop table t1;
+CREATE TABLE t1 (
+sca_code char(6) NOT NULL,
+cat_code char(6) NOT NULL,
+sca_desc varchar(50),
+lan_code char(2) NOT NULL,
+sca_pic varchar(100),
+sca_sdesc varchar(50),
+sca_sch_desc varchar(16),
+PRIMARY KEY (sca_code, cat_code, lan_code),
+INDEX sca_pic (sca_pic)
+) engine = innodb ;
+INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
+select count(*) from t1 where sca_code = 'PD';
+count(*)
+1
+select count(*) from t1 where sca_code <= 'PD';
+count(*)
+1
+select count(*) from t1 where sca_pic is null;
+count(*)
+2
+alter table t1 drop index sca_pic;
+alter table t1 add index sca_pic (cat_code, sca_pic);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+count(*)
+1
+select count(*) from t1 where cat_code='E';
+count(*)
+0
+alter table t1 drop index sca_pic;
+alter table t1 add index (sca_pic, cat_code);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+count(*)
+1
+select count(*) from t1 where sca_pic >= 'n';
+count(*)
+1
+select sca_pic from t1 where sca_pic is null;
+sca_pic
+NULL
+NULL
+update t1 set sca_pic="test" where sca_pic is null;
+delete from t1 where sca_code='pd';
+drop table t1;
+set @a:=now();
+CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
+insert into t1 (a) values(1),(2),(3);
+select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
+a
+1
+2
+3
+select a from t1 natural join t1 as t2 where b >= @a order by a;
+a
+1
+2
+3
+update t1 set a=5 where a=1;
+select a from t1;
+a
+2
+3
+5
+drop table t1;
+create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb;
+insert into t1 values("hello",1),("world",2);
+select * from t1 order by b desc;
+a b
+world 2
+hello 1
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a A # NULL NULL BTREE
+drop table t1;
+create table t1 (i int, j int ) ENGINE=innodb;
+insert into t1 values (1,2);
+select * from t1 where i=1 and j=2;
+i j
+1 2
+create index ax1 on t1 (i,j);
+select * from t1 where i=1 and j=2;
+i j
+1 2
+drop table t1;
+CREATE TABLE t1 (
+a int3 unsigned NOT NULL,
+b int1 unsigned NOT NULL,
+UNIQUE (a, b)
+) ENGINE = innodb;
+INSERT INTO t1 VALUES (1, 1);
+SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
+MIN(B) MAX(b)
+1 1
+drop table t1;
+CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb;
+insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
+explain select * from t1 where a > 0 and a < 50;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where
+drop table t1;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
+select id from t1;
+id
+0
+1
+2
+select id from t1;
+id
+0
+1
+2
+UNLOCK TABLES;
+DROP TABLE t1;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+begin;
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
+select id from t1;
+id
+0
+1
+2
+insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
+commit;
+select id,id3 from t1;
+id id3
+0 0
+1 1
+2 2
+100 2
+UNLOCK TABLES;
+DROP TABLE t1;
+create table t1 (a char(20), unique (a(5))) engine=innodb;
+drop table t1;
+create table t1 (a char(20), index (a(5))) engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) DEFAULT NULL,
+ KEY `a` (`a`(5))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb;
+insert into t1 values (NULL),(NULL),(NULL);
+delete from t1 where a=3;
+insert into t1 values (NULL);
+select * from t1;
+a
+1
+2
+4
+alter table t1 add b int;
+select * from t1;
+a b
+1 NULL
+2 NULL
+4 NULL
+drop table t1;
+create table t1
+(
+id int auto_increment primary key,
+name varchar(32) not null,
+value text not null,
+uid int not null,
+unique key(name,uid)
+) engine=innodb;
+insert into t1 values (1,'one','one value',101),
+(2,'two','two value',102),(3,'three','three value',103);
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+delete from t1 where uid=102;
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+set insert_id=6;
+replace into t1 (value,name,uid) values ('other value','two',102);
+select * from t1;
+id name value uid
+1 one one value 101
+3 three three value 103
+6 two other value 102
+drop table t1;
+create database mysqltest;
+create table mysqltest.t1 (a int not null) engine= innodb;
+insert into mysqltest.t1 values(1);
+create table mysqltest.t2 (a int not null) engine= myisam;
+insert into mysqltest.t2 values(1);
+create table mysqltest.t3 (a int not null) engine= heap;
+insert into mysqltest.t3 values(1);
+commit;
+drop database mysqltest;
+show tables from mysqltest;
+ERROR 42000: Unknown database 'mysqltest'
+set autocommit=0;
+create table t1 (a int not null) engine= innodb;
+insert into t1 values(1),(2);
+truncate table t1;
+commit;
+truncate table t1;
+truncate table t1;
+select * from t1;
+a
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+a
+commit;
+drop table t1;
+set autocommit=1;
+create table t1 (a int not null) engine= innodb;
+insert into t1 values(1),(2);
+truncate table t1;
+insert into t1 values(1),(2);
+select * from t1;
+a
+1
+2
+truncate table t1;
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+a
+drop table t1;
+create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb;
+insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
+explain select * from t1 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL #
+explain select * from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
+explain select * from t1 order by c;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
+explain select a from t1 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index
+explain select b from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b,c from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL #
+drop table t1;
+create table t1 (t int not null default 1, key (t)) engine=innodb;
+desc t1;
+Field Type Null Key Default Extra
+t int(11) NO MUL 1
+drop table t1;
+CREATE TABLE t1 (
+number bigint(20) NOT NULL default '0',
+cname char(15) NOT NULL default '',
+carrier_id smallint(6) NOT NULL default '0',
+privacy tinyint(4) NOT NULL default '0',
+last_mod_date timestamp NOT NULL,
+last_mod_id smallint(6) NOT NULL default '0',
+last_app_date timestamp NOT NULL,
+last_app_id smallint(6) default '-1',
+version smallint(6) NOT NULL default '0',
+assigned_scps int(11) default '0',
+status tinyint(4) default '0'
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1);
+INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0);
+INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1);
+INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0);
+INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0);
+INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0);
+CREATE TABLE t2 (
+number bigint(20) NOT NULL default '0',
+cname char(15) NOT NULL default '',
+carrier_id smallint(6) NOT NULL default '0',
+privacy tinyint(4) NOT NULL default '0',
+last_mod_date timestamp NOT NULL,
+last_mod_id smallint(6) NOT NULL default '0',
+last_app_date timestamp NOT NULL,
+last_app_id smallint(6) default '-1',
+version smallint(6) NOT NULL default '0',
+assigned_scps int(11) default '0',
+status tinyint(4) default '0'
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1);
+INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0);
+INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1);
+INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0);
+select * from t1;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+4077711111 SeanWheeler 90 2 2002-01-11 11:28:46 500 0000-00-00 00:00:00 -1 2 3 1
+9197722223 berry 90 3 2002-01-11 11:28:09 500 2002-01-02 11:45:32 501 4 10 0
+650 San Francisco 0 0 2001-12-27 11:13:36 342 0000-00-00 00:00:00 -1 1 24 1
+302467 Sue's Subshop 90 3 2002-01-09 11:32:41 500 2002-01-02 11:51:11 501 7 24 0
+6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
+333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+4077711111 SeanWheeler 0 2 2002-01-11 11:28:53 500 0000-00-00 00:00:00 -1 2 3 1
+9197722223 berry 90 3 2002-01-11 11:28:18 500 2002-01-02 11:45:32 501 4 10 0
+650 San Francisco 90 0 2002-01-09 11:31:58 342 0000-00-00 00:00:00 -1 1 24 1
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null);
+select * from t1;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
+333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+drop table t1,t2;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+SELECT @@tx_isolation,@@global.tx_isolation;
+@@tx_isolation @@global.tx_isolation
+SERIALIZABLE REPEATABLE-READ
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+COMMIT;
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+COMMIT;
+SET binlog_format='MIXED';
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+COMMIT;
+DROP TABLE t1;
+create table t1 (n int(10), d int(10)) engine=innodb;
+create table t2 (n int(10), d int(10)) engine=innodb;
+insert into t1 values(1,1),(1,2);
+insert into t2 values(1,10),(2,20);
+UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
+select * from t1;
+n d
+1 10
+1 10
+select * from t2;
+n d
+1 30
+2 20
+drop table t1,t2;
+drop table if exists t1, t2;
+CREATE TABLE t1 (a int, PRIMARY KEY (a));
+CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
+create trigger trg_del_t2 after delete on t2 for each row
+insert into t1 values (1);
+insert into t1 values (1);
+insert into t2 values (1),(2);
+delete t2 from t2;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+select count(*) from t2 /* must be 2 as restored after rollback caused by the error */;
+count(*)
+2
+drop table t1, t2;
+drop table if exists t1, t2;
+CREATE TABLE t1 (a int, PRIMARY KEY (a));
+CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
+create trigger trg_del_t2 after delete on t2 for each row
+insert into t1 values (1);
+insert into t1 values (1);
+insert into t2 values (1),(2);
+delete t2 from t2;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+select count(*) from t2 /* must be 2 as restored after rollback caused by the error */;
+count(*)
+2
+drop table t1, t2;
+create table t1 (a int, b int) engine=innodb;
+insert into t1 values(20,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a;
+b ifnull(t2.b,"this is null")
+NULL this is null
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+b ifnull(t2.b,"this is null")
+NULL this is null
+insert into t1 values(10,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+b ifnull(t2.b,"this is null")
+NULL this is null
+NULL this is null
+drop table t1;
+create table t1 (a varchar(10) not null) engine=myisam;
+create table t2 (b varchar(10) not null unique) engine=innodb;
+select t1.a from t1,t2 where t1.a=t2.b;
+a
+drop table t1,t2;
+create table t1 (a int not null, b int, primary key (a)) engine = innodb;
+create table t2 (a int not null, b int, primary key (a)) engine = innodb;
+insert into t1 values (10, 20);
+insert into t2 values (10, 20);
+update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
+drop table t1,t2;
+CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB;
+insert into t1 set id=1;
+insert into t2 set id=1, t1_id=1;
+delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
+select * from t1;
+id
+select * from t2;
+id t1_id
+drop table t2,t1;
+CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES(1, 1);
+SELECT * from t1;
+id
+1
+UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1;
+SELECT * from t1;
+id
+2
+UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id;
+SELECT * from t1;
+id
+3
+DROP TABLE t1,t2;
+set autocommit=0;
+CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB;
+INSERT INTO t3 VALUES("my-test-1", "my-test-2");
+COMMIT;
+INSERT INTO t1 VALUES("this-key", "will disappear");
+INSERT INTO t2 VALUES("this-key", "will also disappear");
+DELETE FROM t3 WHERE id1="my-test-1";
+SELECT * FROM t1;
+id value
+this-key will disappear
+SELECT * FROM t2;
+id value
+this-key will also disappear
+SELECT * FROM t3;
+id1 id2
+ROLLBACK;
+SELECT * FROM t1;
+id value
+SELECT * FROM t2;
+id value
+SELECT * FROM t3;
+id1 id2
+my-test-1 my-test-2
+SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE;
+id1 id2
+my-test-1 my-test-2
+COMMIT;
+set autocommit=1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
+SELECT * from t1;
+a b
+1 1
+102 2
+103 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+drop table t1;
+CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=0;
+INSERT INTO t1 ( B_ID ) VALUES ( 1 );
+INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT * FROM t1;
+B_ID
+drop table t1,t2;
+create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb;
+insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
+select distinct parent,child from t1 order by parent;
+parent child
+0 4
+1 2
+1 3
+2 1
+drop table t1;
+create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb;
+create table t2 (a int not null auto_increment primary key, b int);
+insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
+insert into t2 (a) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+select count(*) from t1;
+count(*)
+623
+explain select * from t1 where c between 1 and 2500;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c c 5 NULL # Using where
+update t1 set c=a;
+explain select * from t1 where c between 1 and 2500;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL c NULL NULL NULL # Using where
+drop table t1,t2;
+create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
+insert into t1 (id) values (null),(null),(null),(null),(null);
+update t1 set fk=69 where fk is null order by id limit 1;
+SELECT * from t1;
+id fk
+2 NULL
+3 NULL
+4 NULL
+5 NULL
+1 69
+drop table t1;
+create table t1 (a int not null, b int not null, key (a));
+insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
+SET @tmp=0;
+update t1 set b=(@tmp:=@tmp+1) order by a;
+update t1 set b=99 where a=1 order by b asc limit 1;
+update t1 set b=100 where a=1 order by b desc limit 2;
+update t1 set a=a+10+b where a=1 order by b;
+select * from t1 order by a,b;
+a b
+2 4
+2 5
+2 6
+3 7
+3 8
+3 9
+3 10
+3 11
+3 12
+13 2
+111 100
+111 100
+drop table t1;
+create table t1 ( c char(8) not null ) engine=innodb;
+insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
+insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
+alter table t1 add b char(8) not null;
+alter table t1 add a char(8) not null;
+alter table t1 add primary key (a,b,c);
+update t1 set a=c, b=c;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
+insert into t2 select * from t1;
+delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
+drop table t1,t2;
+SET AUTOCOMMIT=1;
+create table t1 (a integer auto_increment primary key) engine=innodb;
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+a
+1
+2
+drop table t1;
+CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB;
+drop table t2,t1;
+create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb;
+insert into `t1`values ( 1 ) ;
+create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb;
+insert into `t2`values ( 1 ) ;
+create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
+insert into `t3`values ( 1 ) ;
+delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
+update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
+update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+ERROR 42S22: Unknown column 't1.id' in 'where clause'
+drop table t3,t2,t1;
+create table t1(
+id int primary key,
+pid int,
+index(pid),
+foreign key(pid) references t1(id) on delete cascade) engine=innodb;
+insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
+(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
+delete from t1 where id=0;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
+delete from t1 where id=15;
+delete from t1 where id=0;
+drop table t1;
+CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
+CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
+(stamp))ENGINE=InnoDB;
+insert into t1 values (1),(2),(3);
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
+Warnings:
+Warning 1265 Data truncated for column 'stamp' at row 3
+SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
+'20020204120000' GROUP BY col1;
+col1
+1
+2
+3
+4
+drop table t1,t2;
+CREATE TABLE t1 (
+`id` int(10) unsigned NOT NULL auto_increment,
+`id_object` int(10) unsigned default '0',
+`id_version` int(10) unsigned NOT NULL default '1',
+`label` varchar(100) NOT NULL default '',
+`description` text,
+PRIMARY KEY (`id`),
+KEY `id_object` (`id_object`),
+KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
+CREATE TABLE t2 (
+`id` int(10) unsigned NOT NULL auto_increment,
+`id_version` int(10) unsigned NOT NULL default '1',
+PRIMARY KEY (`id`),
+KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
+SELECT t2.id, t1.`label` FROM t2 INNER JOIN
+(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl
+ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
+id label
+3382 Test
+102 Le Pekin (Test)
+1794 Test de resto
+1822 Test 3
+3524 Societe Test
+3525 Fournisseur Test
+drop table t1,t2;
+create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam;
+create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb;
+create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+insert t3 select * from t1;
+checksum table t1, t2, t3, t4 quick;
+Table Checksum
+test.t1 3442722830
+test.t2 NULL
+test.t3 NULL
+test.t4 NULL
+Warnings:
+Error 1146 Table 'test.t4' doesn't exist
+checksum table t1, t2, t3, t4;
+Table Checksum
+test.t1 3442722830
+test.t2 3442722830
+test.t3 3442722830
+test.t4 NULL
+Warnings:
+Error 1146 Table 'test.t4' doesn't exist
+checksum table t1, t2, t3, t4 extended;
+Table Checksum
+test.t1 3442722830
+test.t2 3442722830
+test.t3 3442722830
+test.t4 NULL
+Warnings:
+Error 1146 Table 'test.t4' doesn't exist
+drop table t1,t2,t3;
+create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1;
+trim(name2)
+fff
+sss
+ttt
+first
+second
+third
+1
+2
+3
+drop table t1;
+create table t1 (a int) engine=innodb;
+create table t2 like t1;
+drop table t1,t2;
+create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
+create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `id2` int(11) NOT NULL,
+ UNIQUE KEY `id` (`id`,`id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ KEY `t1_id_fk` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create index id on t2 (id);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ KEY `id` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create index id2 on t2 (id);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ KEY `id` (`id`),
+ KEY `id2` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop index id2 on t2;
+drop index id on t2;
+ERROR HY000: Cannot drop index 'id': needed in a foreign key constraint
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ KEY `id` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `id2` int(11) NOT NULL,
+ KEY `t1_id_fk` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create unique index id on t2 (id,id2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `id2` int(11) NOT NULL,
+ UNIQUE KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `id2` int(11) NOT NULL,
+ UNIQUE KEY `id` (`id`,`id2`),
+ KEY `t1_id_fk` (`id2`,`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `id2` int(11) NOT NULL,
+ UNIQUE KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `id2` int(11) NOT NULL,
+ UNIQUE KEY `id` (`id`,`id2`),
+ KEY `t1_id_fk` (`id2`,`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id2` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id2` int(11) NOT NULL,
+ KEY `t1_id_fk` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t2 add index id_test (id), add index id_test2 (id,id2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id2` int(11) NOT NULL,
+ KEY `id_test` (`id`),
+ KEY `id_test2` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
+ERROR 42000: Incorrect foreign key definition for 't1_id_fk': Key reference and table reference don't match
+create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `b_2` (`b`),
+ KEY `b` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `b` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`),
+ CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2, t1;
+create table t1 (c char(10), index (c,c)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c'
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10)) engine=innodb;
+alter table t1 add key (c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c2,c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c2,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c1,c2);
+ERROR 42S21: Duplicate column name 'c1'
+drop table t1;
+create table t1(a int(1) , b int(1)) engine=innodb;
+insert into t1 values ('1111', '3333');
+select distinct concat(a, b) from t1;
+concat(a, b)
+11113333
+drop table t1;
+CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
+SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
+ERROR HY000: The used table type doesn't support FULLTEXT indexes
+DROP TABLE t1;
+CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
+CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
+SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
+a_id b_list
+1 1,2,3
+2 4,5
+3 NULL
+DROP TABLE t2;
+DROP TABLE t1;
+create temporary table t1 (a int) engine=innodb;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+a
+42
+drop table t1;
+create table t1 (a int) engine=innodb;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+a
+42
+drop table t1;
+create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb;
+insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
+select * from t1 order by a,b,c,d;
+a b c d e
+1 1 a 1 1
+2 2 b 2 2
+3 3 ab 3 3
+explain select * from t1 order by a,b,c,d;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
+drop table t1;
+create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
+insert into t1 values ('8', '6'), ('4', '7');
+select min(a) from t1;
+min(a)
+4
+select min(b) from t1 where a='8';
+min(b)
+6
+drop table t1;
+create table t1 (x bigint unsigned not null primary key) engine=innodb;
+insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
+select * from t1;
+x
+18446744073709551600
+18446744073709551601
+select count(*) from t1 where x>0;
+count(*)
+2
+select count(*) from t1 where x=0;
+count(*)
+0
+select count(*) from t1 where x<0;
+count(*)
+0
+select count(*) from t1 where x < -16;
+count(*)
+0
+select count(*) from t1 where x = -16;
+count(*)
+0
+explain select count(*) from t1 where x > -16;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index
+select count(*) from t1 where x > -16;
+count(*)
+2
+select * from t1 where x > -16;
+x
+18446744073709551600
+18446744073709551601
+select count(*) from t1 where x = 18446744073709551601;
+count(*)
+1
+drop table t1;
+SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
+variable_value
+8191
+SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
+variable_value
+16384
+SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
+variable_value - @innodb_rows_deleted_orig
+71
+SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
+variable_value - @innodb_rows_inserted_orig
+1063
+SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
+variable_value - @innodb_rows_updated_orig
+865
+SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
+variable_value - @innodb_row_lock_waits_orig
+0
+SELECT variable_value - @innodb_row_lock_current_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits';
+variable_value - @innodb_row_lock_current_waits_orig
+0
+SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time';
+variable_value - @innodb_row_lock_time_orig
+0
+SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max';
+variable_value - @innodb_row_lock_time_max_orig
+0
+SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
+variable_value - @innodb_row_lock_time_avg_orig
+0
+SET @innodb_sync_spin_loops_orig = @@innodb_sync_spin_loops;
+show variables like "innodb_sync_spin_loops";
+Variable_name Value
+innodb_sync_spin_loops 30
+set global innodb_sync_spin_loops=1000;
+show variables like "innodb_sync_spin_loops";
+Variable_name Value
+innodb_sync_spin_loops 1000
+set global innodb_sync_spin_loops=0;
+show variables like "innodb_sync_spin_loops";
+Variable_name Value
+innodb_sync_spin_loops 0
+set global innodb_sync_spin_loops=20;
+show variables like "innodb_sync_spin_loops";
+Variable_name Value
+innodb_sync_spin_loops 20
+set global innodb_sync_spin_loops=@innodb_sync_spin_loops_orig;
+SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;
+show variables like "innodb_thread_concurrency";
+Variable_name Value
+innodb_thread_concurrency 0
+set global innodb_thread_concurrency=1001;
+Warnings:
+Warning 1292 Truncated incorrect thread_concurrency value: '1001'
+show variables like "innodb_thread_concurrency";
+Variable_name Value
+innodb_thread_concurrency 1000
+set global innodb_thread_concurrency=0;
+show variables like "innodb_thread_concurrency";
+Variable_name Value
+innodb_thread_concurrency 0
+set global innodb_thread_concurrency=16;
+show variables like "innodb_thread_concurrency";
+Variable_name Value
+innodb_thread_concurrency 16
+SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency;
+show variables like "innodb_concurrency_tickets";
+Variable_name Value
+innodb_concurrency_tickets 500
+set global innodb_concurrency_tickets=1000;
+show variables like "innodb_concurrency_tickets";
+Variable_name Value
+innodb_concurrency_tickets 1000
+set global innodb_concurrency_tickets=0;
+Warnings:
+Warning 1292 Truncated incorrect concurrency_tickets value: '0'
+show variables like "innodb_concurrency_tickets";
+Variable_name Value
+innodb_concurrency_tickets 1
+set global innodb_concurrency_tickets=500;
+show variables like "innodb_concurrency_tickets";
+Variable_name Value
+innodb_concurrency_tickets 500
+show variables like "innodb_thread_sleep_delay";
+Variable_name Value
+innodb_thread_sleep_delay 10000
+set global innodb_thread_sleep_delay=100000;
+show variables like "innodb_thread_sleep_delay";
+Variable_name Value
+innodb_thread_sleep_delay 100000
+set global innodb_thread_sleep_delay=0;
+show variables like "innodb_thread_sleep_delay";
+Variable_name Value
+innodb_thread_sleep_delay 0
+set global innodb_thread_sleep_delay=10000;
+show variables like "innodb_thread_sleep_delay";
+Variable_name Value
+innodb_thread_sleep_delay 10000
+set storage_engine=INNODB;
+drop table if exists t1,t2,t3;
+--- Testing varchar ---
+--- Testing varchar ---
+create table t1 (v varchar(10), c char(10), t text);
+insert into t1 values('+ ', '+ ', '+ ');
+set @a=repeat(' ',20);
+insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
+Warnings:
+Note 1265 Data truncated for column 'v' at row 1
+select concat('*',v,'*',c,'*',t,'*') from t1;
+concat('*',v,'*',c,'*',t,'*')
+*+ *+*+ *
+*+ *+*+ *
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create table t2 like t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create table t3 select * from t1;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t1 modify c varchar(10);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
+ `t` text
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t1 modify v char(10);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` char(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
+ `t` text
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t1 modify t varchar(10);
+Warnings:
+Note 1265 Data truncated for column 't' at row 2
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` char(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT NULL,
+ `t` varchar(10) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+select concat('*',v,'*',c,'*',t,'*') from t1;
+concat('*',v,'*',c,'*',t,'*')
+*+*+*+ *
+*+*+*+ *
+drop table t1,t2,t3;
+create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text,
+ KEY `v` (`v`),
+ KEY `c` (`c`),
+ KEY `t` (`t`(10))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+select count(*) from t1;
+count(*)
+270
+insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
+select count(*) from t1 where v='a';
+count(*)
+10
+select count(*) from t1 where c='a';
+count(*)
+10
+select count(*) from t1 where t='a';
+count(*)
+10
+select count(*) from t1 where v='a ';
+count(*)
+10
+select count(*) from t1 where c='a ';
+count(*)
+10
+select count(*) from t1 where t='a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+count(*)
+10
+select count(*) from t1 where v like 'a%';
+count(*)
+11
+select count(*) from t1 where c like 'a%';
+count(*)
+11
+select count(*) from t1 where t like 'a%';
+count(*)
+11
+select count(*) from t1 where v like 'a %';
+count(*)
+9
+explain select count(*) from t1 where v='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 13 const # Using where; Using index
+explain select count(*) from t1 where c='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c c 11 const # Using where; Using index
+explain select count(*) from t1 where t='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref t t 13 const # Using where
+explain select count(*) from t1 where v like 'a%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range v v 13 NULL # Using where; Using index
+explain select count(*) from t1 where v between 'a' and 'a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 13 const # Using where; Using index
+explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 13 const # Using where; Using index
+alter table t1 add unique(v);
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
+alter table t1 add key(v);
+select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
+qq
+*a*a*a*
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+*a *a*a *
+explain select * from t1 where v='a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v,v_2 # 13 const # Using where
+select v,count(*) from t1 group by v limit 10;
+v count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select v,count(c) from t1 group by v limit 10;
+v count(c)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result v,count(c) from t1 group by v limit 10;
+v count(c)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select c,count(*) from t1 group by c limit 10;
+c count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select c,count(t) from t1 group by c limit 10;
+c count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result c,count(t) from t1 group by c limit 10;
+c count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select t,count(*) from t1 group by t limit 10;
+t count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select t,count(t) from t1 group by t limit 10;
+t count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result t,count(t) from t1 group by t limit 10;
+t count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(300) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text,
+ KEY `c` (`c`),
+ KEY `t` (`t`(10)),
+ KEY `v` (`v`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+select count(*) from t1 where v='a';
+count(*)
+10
+select count(*) from t1 where v='a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+count(*)
+10
+select count(*) from t1 where v like 'a%';
+count(*)
+11
+select count(*) from t1 where v like 'a %';
+count(*)
+9
+explain select count(*) from t1 where v='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 303 const # Using where; Using index
+explain select count(*) from t1 where v like 'a%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range v v 303 NULL # Using where; Using index
+explain select count(*) from t1 where v between 'a' and 'a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 303 const # Using where; Using index
+explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 303 const # Using where; Using index
+explain select * from t1 where v='a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 303 const # Using where
+select v,count(*) from t1 group by v limit 10;
+v count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+alter table t1 drop key v, add key v (v(30));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(300) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text,
+ KEY `c` (`c`),
+ KEY `t` (`t`(10)),
+ KEY `v` (`v`(30))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+select count(*) from t1 where v='a';
+count(*)
+10
+select count(*) from t1 where v='a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ';
+count(*)
+10
+select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+count(*)
+10
+select count(*) from t1 where v like 'a%';
+count(*)
+11
+select count(*) from t1 where v like 'a %';
+count(*)
+9
+explain select count(*) from t1 where v='a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 33 const # Using where
+explain select count(*) from t1 where v like 'a%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range v v 33 NULL # Using where
+explain select count(*) from t1 where v between 'a' and 'a ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 33 const # Using where
+explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 33 const # Using where
+explain select * from t1 where v='a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref v v 33 const # Using where
+select v,count(*) from t1 group by v limit 10;
+v count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+alter table t1 modify v varchar(600), drop key v, add key v (v);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(600) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text,
+ KEY `c` (`c`),
+ KEY `t` (`t`(10)),
+ KEY `v` (`v`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+select v,count(*) from t1 group by v limit 10;
+v count(*)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+select sql_big_result v,count(t) from t1 group by v limit 10;
+v count(t)
+a 1
+a 10
+b 10
+c 10
+d 10
+e 10
+f 10
+g 10
+h 10
+i 10
+drop table t1;
+create table t1 (a char(10), unique (a));
+insert into t1 values ('a ');
+insert into t1 values ('a ');
+ERROR 23000: Duplicate entry 'a' for key 'a'
+alter table t1 modify a varchar(10);
+insert into t1 values ('a '),('a '),('a '),('a ');
+ERROR 23000: Duplicate entry 'a ' for key 'a'
+insert into t1 values ('a ');
+ERROR 23000: Duplicate entry 'a ' for key 'a'
+insert into t1 values ('a ');
+ERROR 23000: Duplicate entry 'a ' for key 'a'
+insert into t1 values ('a ');
+ERROR 23000: Duplicate entry 'a ' for key 'a'
+update t1 set a='a ' where a like 'a%';
+select concat(a,'.') from t1;
+concat(a,'.')
+a .
+update t1 set a='abc ' where a like 'a ';
+select concat(a,'.') from t1;
+concat(a,'.')
+a .
+update t1 set a='a ' where a like 'a %';
+select concat(a,'.') from t1;
+concat(a,'.')
+a .
+update t1 set a='a ' where a like 'a ';
+select concat(a,'.') from t1;
+concat(a,'.')
+a .
+drop table t1;
+create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5)));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL,
+ `t` text,
+ KEY `v` (`v`(5)),
+ KEY `c` (`c`(5)),
+ KEY `t` (`t`(5))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (v char(10) character set utf8);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` char(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (v varchar(10), c char(10)) row_format=fixed;
+Warnings:
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` varchar(10) DEFAULT NULL,
+ `c` char(10) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
+insert into t1 values('a','a'),('a ','a ');
+select concat('*',v,'*',c,'*') from t1;
+concat('*',v,'*',c,'*')
+*a*a*
+*a *a*
+drop table t1;
+create table t1 (v varchar(65530), key(v(10)));
+insert into t1 values(repeat('a',65530));
+select length(v) from t1 where v=repeat('a',65530);
+length(v)
+65530
+drop table t1;
+create table t1(a int, b varchar(12), key ba(b, a));
+insert into t1 values (1, 'A'), (20, NULL);
+explain select * from t1 where a=20 and b is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index
+select * from t1 where a=20 and b is null;
+a b
+20 NULL
+drop table t1;
+create table t1 (v varchar(65530), key(v));
+Warnings:
+Warning 1071 Specified key was too long; max key length is 767 bytes
+drop table t1;
+create table t1 (v varchar(65536));
+Warnings:
+Note 1246 Converting column 'v' from VARCHAR to TEXT
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` mediumtext
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (v varchar(65530) character set utf8);
+Warnings:
+Note 1246 Converting column 'v' from VARCHAR to TEXT
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v` mediumtext CHARACTER SET utf8
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+set storage_engine=MyISAM;
diff --git a/mysql-test/r/innodb_autoinc_lock_mode_zero.result b/mysql-test/suite/innodb/r/innodb_autoinc_lock_mode_zero.result
index 3d016684338..3d016684338 100644
--- a/mysql-test/r/innodb_autoinc_lock_mode_zero.result
+++ b/mysql-test/suite/innodb/r/innodb_autoinc_lock_mode_zero.result
diff --git a/mysql-test/suite/innodb/r/innodb_bug21704.result b/mysql-test/suite/innodb/r/innodb_bug21704.result
index b8e0b15d50d..ffbfa8a337e 100644
--- a/mysql-test/suite/innodb/r/innodb_bug21704.result
+++ b/mysql-test/suite/innodb/r/innodb_bug21704.result
@@ -25,8 +25,8 @@ ALTER TABLE t1 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t1 CHANGE b c INT;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
# Test renaming the column in the referencing table
@@ -34,8 +34,8 @@ ALTER TABLE t2 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t2 CHANGE b c INT;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
# Test with self-referential constraints
@@ -45,8 +45,8 @@ ALTER TABLE t3 CHANGE b d INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t3 CHANGE c d INT;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
# Cleanup.
diff --git a/mysql-test/r/innodb_bug30919.result b/mysql-test/suite/innodb/r/innodb_bug30919.result
index 42aa4ff302b..42aa4ff302b 100644
--- a/mysql-test/r/innodb_bug30919.result
+++ b/mysql-test/suite/innodb/r/innodb_bug30919.result
diff --git a/mysql-test/r/innodb_bug42419.result b/mysql-test/suite/innodb/r/innodb_bug42419.result
index f304bb634cb..f304bb634cb 100644
--- a/mysql-test/r/innodb_bug42419.result
+++ b/mysql-test/suite/innodb/r/innodb_bug42419.result
diff --git a/mysql-test/suite/innodb/r/innodb_bug48024.result b/mysql-test/suite/innodb/r/innodb_bug48024.result
new file mode 100644
index 00000000000..611923d2796
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug48024.result
@@ -0,0 +1,10 @@
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b);
+DROP TABLE bug48024,bug48024_b;
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)|
+DROP TABLE bug48024,bug48024_b;
diff --git a/mysql-test/suite/innodb/r/innodb_bug49164.result b/mysql-test/suite/innodb/r/innodb_bug49164.result
new file mode 100644
index 00000000000..9456702e1d0
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug49164.result
@@ -0,0 +1,42 @@
+SET tx_isolation = 'READ-COMMITTED';
+CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
+ENGINE=InnoDB;
+insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
+begin;
+update bug49164 set c=7;
+select * from bug49164;
+a b c
+1 1 7
+2 2 7
+3 3 7
+rollback;
+select * from bug49164;
+a b c
+1 1 1
+2 2 2
+3 3 3
+begin;
+update bug49164 set c=7;
+SET tx_isolation = 'READ-COMMITTED';
+begin;
+select * from bug49164;
+a b c
+1 1 1
+2 2 2
+3 3 3
+commit;
+begin;
+update bug49164 set c=6 where a=1 and b=1;
+rollback;
+select * from bug49164;
+a b c
+1 1 1
+2 2 2
+3 3 3
+commit;
+select * from bug49164;
+a b c
+1 1 6
+2 2 2
+3 3 3
+drop table bug49164;
diff --git a/mysql-test/suite/innodb/r/innodb_bug53674.result b/mysql-test/suite/innodb/r/innodb_bug53674.result
new file mode 100644
index 00000000000..c4021c2e7cd
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug53674.result
@@ -0,0 +1,11 @@
+create table bug53674(a int)engine=innodb;
+insert into bug53674 values (1),(2);
+start transaction;
+select * from bug53674 for update;
+a
+1
+2
+select * from bug53674 where a=(select a from bug53674 where a > 1);
+a
+2
+drop table bug53674;
diff --git a/mysql-test/suite/innodb/r/innodb_bug54044.result b/mysql-test/suite/innodb/r/innodb_bug54044.result
new file mode 100644
index 00000000000..90ab812f2ae
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug54044.result
@@ -0,0 +1,3 @@
+CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
+AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
+ERROR HY000: Can't create table 'test.table_54044' (errno: -1)
diff --git a/mysql-test/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result
index c6c775afc9f..c6c775afc9f 100644
--- a/mysql-test/r/innodb_gis.result
+++ b/mysql-test/suite/innodb/r/innodb_gis.result
diff --git a/mysql-test/r/innodb_lock_wait_timeout_1.result b/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result
index bd8760b8f79..bd8760b8f79 100644
--- a/mysql-test/r/innodb_lock_wait_timeout_1.result
+++ b/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result
diff --git a/mysql-test/suite/innodb/r/innodb_misc1.result b/mysql-test/suite/innodb/r/innodb_misc1.result
index 40d13c9726a..214e79de985 100644
--- a/mysql-test/suite/innodb/r/innodb_misc1.result
+++ b/mysql-test/suite/innodb/r/innodb_misc1.result
@@ -763,6 +763,7 @@ t1 CREATE TABLE `t1` (
CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
+SET SESSION innodb_strict_mode = on;
CREATE TABLE t1 (
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),
diff --git a/mysql-test/suite/innodb/r/innodb_multi_update.result b/mysql-test/suite/innodb/r/innodb_multi_update.result
new file mode 100644
index 00000000000..7af9b030d1f
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_multi_update.result
@@ -0,0 +1,76 @@
+CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb;
+INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100;
+select * from bug38999_1;
+a b
+101 1
+102 2
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101;
+select * from bug38999_1;
+a b
+201 1
+102 2
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2;
+select * from bug38999_1;
+a b
+201 1
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+102 12
+112 12
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100;
+select * from bug38999_1;
+a b
+201 1
+103 5
+104 6
+106 6
+105 7
+107 7
+108 8
+109 9
+110 10
+111 11
+102 12
+112 12
+select * from bug38999_2;
+a b
+1 1
+2 2
+6 6
+7 7
+8 8
+9 9
+3 13
+4 14
+5 15
+drop table bug38999_1,bug38999_2;
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
new file mode 100644
index 00000000000..d018cace759
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -0,0 +1,2510 @@
+set global innodb_support_xa=default;
+set session innodb_support_xa=default;
+SET SESSION STORAGE_ENGINE = InnoDB;
+drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
+drop procedure if exists p1;
+create table t1 (
+c_id int(11) not null default '0',
+org_id int(11) default null,
+unique key contacts$c_id (c_id),
+key contacts$org_id (org_id)
+);
+insert into t1 values
+(2,null),(120,null),(141,null),(218,7), (128,1),
+(151,2),(234,2),(236,2),(243,2),(255,2),(259,2),(232,3),(235,3),(238,3),
+(246,3),(253,3),(269,3),(285,3),(291,3),(293,3),(131,4),(230,4),(231,4);
+create table t2 (
+slai_id int(11) not null default '0',
+owner_tbl int(11) default null,
+owner_id int(11) default null,
+sla_id int(11) default null,
+inc_web int(11) default null,
+inc_email int(11) default null,
+inc_chat int(11) default null,
+inc_csr int(11) default null,
+inc_total int(11) default null,
+time_billed int(11) default null,
+activedate timestamp null default null,
+expiredate timestamp null default null,
+state int(11) default null,
+sla_set int(11) default null,
+unique key t2$slai_id (slai_id),
+key t2$owner_id (owner_id),
+key t2$sla_id (sla_id)
+);
+insert into t2(slai_id, owner_tbl, owner_id, sla_id) values
+(1,3,1,1), (3,3,10,2), (4,3,3,6), (5,3,2,5), (6,3,8,3), (7,3,9,7),
+(8,3,6,8), (9,3,4,9), (10,3,5,10), (11,3,11,11), (12,3,7,12);
+flush tables;
+select si.slai_id
+from t1 c join t2 si on
+((si.owner_tbl = 3 and si.owner_id = c.org_id) or
+( si.owner_tbl = 2 and si.owner_id = c.c_id))
+where
+c.c_id = 218 and expiredate is null;
+slai_id
+12
+select * from t1 where org_id is null;
+c_id org_id
+2 NULL
+120 NULL
+141 NULL
+select si.slai_id
+from t1 c join t2 si on
+((si.owner_tbl = 3 and si.owner_id = c.org_id) or
+( si.owner_tbl = 2 and si.owner_id = c.c_id))
+where
+c.c_id = 218 and expiredate is null;
+slai_id
+12
+drop table t1, t2;
+CREATE TABLE t1 (a int, b int, KEY b (b));
+CREATE TABLE t2 (a int, b int, PRIMARY KEY (a,b));
+CREATE TABLE t3 (a int, b int, c int, PRIMARY KEY (a),
+UNIQUE KEY b (b,c), KEY a (a,b,c));
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 SELECT a + 1, b + 1 FROM t1;
+INSERT INTO t1 SELECT a + 2, b + 2 FROM t1;
+INSERT INTO t2 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
+INSERT INTO t2 SELECT a + 1, b FROM t2;
+DELETE FROM t2 WHERE a = 1 AND b < 2;
+INSERT INTO t3 VALUES (1,1,1),(2,1,2);
+INSERT INTO t3 SELECT a + 2, a + 2, 3 FROM t3;
+INSERT INTO t3 SELECT a + 4, a + 4, 3 FROM t3;
+SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
+t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
+ORDER BY t1.b LIMIT 2;
+b a
+1 1
+2 2
+SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
+t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
+ORDER BY t1.b LIMIT 5;
+b a
+1 1
+2 2
+2 2
+3 3
+3 3
+DROP TABLE t1, t2, t3;
+CREATE TABLE `t1` (`id1` INT) ;
+INSERT INTO `t1` (`id1`) VALUES (1),(5),(2);
+CREATE TABLE `t2` (
+`id1` INT,
+`id2` INT NOT NULL,
+`id3` INT,
+`id4` INT NOT NULL,
+UNIQUE (`id2`,`id4`),
+KEY (`id1`)
+);
+INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
+(1,1,1,0),
+(1,1,2,1),
+(5,1,2,2),
+(6,1,2,3),
+(1,2,2,2),
+(1,2,1,1);
+SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
+id1
+2
+DROP TABLE t1, t2;
+create table t1 (c1 int) engine=innodb;
+handler t1 open;
+handler t1 read first;
+c1
+Before and after comparison
+0
+drop table t1;
+CREATE TABLE t1(c1 TEXT, UNIQUE (c1(1)), cnt INT DEFAULT 1)
+ENGINE=INNODB CHARACTER SET UTF8;
+INSERT INTO t1 (c1) VALUES ('1a');
+SELECT * FROM t1;
+c1 cnt
+1a 1
+INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
+SELECT * FROM t1;
+c1 cnt
+1a 2
+DROP TABLE t1;
+CREATE TABLE t1(c1 VARCHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1)
+ENGINE=INNODB CHARACTER SET UTF8;
+INSERT INTO t1 (c1) VALUES ('1a');
+SELECT * FROM t1;
+c1 cnt
+1a 1
+INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
+SELECT * FROM t1;
+c1 cnt
+1a 2
+DROP TABLE t1;
+CREATE TABLE t1(c1 CHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1)
+ENGINE=INNODB CHARACTER SET UTF8;
+INSERT INTO t1 (c1) VALUES ('1a');
+SELECT * FROM t1;
+c1 cnt
+1a 1
+INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
+SELECT * FROM t1;
+c1 cnt
+1a 2
+DROP TABLE t1;
+CREATE TABLE t1 (
+a1 decimal(10,0) DEFAULT NULL,
+a2 blob,
+a3 time DEFAULT NULL,
+a4 blob,
+a5 char(175) DEFAULT NULL,
+a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+a7 tinyblob,
+INDEX idx (a6,a7(239),a5)
+) ENGINE=InnoDB;
+EXPLAIN SELECT a4 FROM t1 WHERE
+a6=NULL AND
+a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+EXPLAIN SELECT t1.a4 FROM t1, t1 t WHERE
+t.a6=t.a6 AND t1.a6=NULL AND
+t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+DROP TABLE t1;
+create table t1m (a int) engine = MEMORY;
+create table t1i (a int);
+create table t2m (a int) engine = MEMORY;
+create table t2i (a int);
+insert into t2m values (5);
+insert into t2i values (5);
+select min(a) from t1i;
+min(a)
+NULL
+select min(7) from t1i;
+min(7)
+NULL
+select min(7) from DUAL;
+min(7)
+7
+explain select min(7) from t2i join t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1 Using join buffer
+select min(7) from t2i join t1i;
+min(7)
+NULL
+select max(a) from t1i;
+max(a)
+NULL
+select max(7) from t1i;
+max(7)
+NULL
+select max(7) from DUAL;
+max(7)
+7
+explain select max(7) from t2i join t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1 Using join buffer
+select max(7) from t2i join t1i;
+max(7)
+NULL
+select 1, min(a) from t1i where a=99;
+1 min(a)
+1 NULL
+select 1, min(a) from t1i where 1=99;
+1 min(a)
+1 NULL
+select 1, min(1) from t1i where a=99;
+1 min(1)
+1 NULL
+select 1, min(1) from t1i where 1=99;
+1 min(1)
+1 NULL
+select 1, max(a) from t1i where a=99;
+1 max(a)
+1 NULL
+select 1, max(a) from t1i where 1=99;
+1 max(a)
+1 NULL
+select 1, max(1) from t1i where a=99;
+1 max(1)
+1 NULL
+select 1, max(1) from t1i where 1=99;
+1 max(1)
+1 NULL
+explain select count(*), min(7), max(7) from t1m, t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select count(*), min(7), max(7) from t1m, t1i;
+count(*) min(7) max(7)
+0 NULL NULL
+explain select count(*), min(7), max(7) from t1m, t2i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t2i ALL NULL NULL NULL NULL 1
+select count(*), min(7), max(7) from t1m, t2i;
+count(*) min(7) max(7)
+0 NULL NULL
+explain select count(*), min(7), max(7) from t2m, t1i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2m system NULL NULL NULL NULL 1
+1 SIMPLE t1i ALL NULL NULL NULL NULL 1
+select count(*), min(7), max(7) from t2m, t1i;
+count(*) min(7) max(7)
+0 NULL NULL
+drop table t1m, t1i, t2m, t2i;
+create table t1 (
+a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
+) ENGINE = MEMORY;
+insert into t1 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
+create table t4 (
+pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
+);
+insert into t4 (a1, a2, b, c, d, dummy) select * from t1;
+create index idx12672_0 on t4 (a1);
+create index idx12672_1 on t4 (a1,a2,b,c);
+create index idx12672_2 on t4 (a1,a2,b);
+analyze table t4;
+Table Op Msg_type Msg_text
+test.t4 analyze status OK
+select distinct a1 from t4 where pk_col not in (1,2,3,4);
+a1
+a
+b
+c
+d
+drop table t1,t4;
+DROP TABLE IF EXISTS t2, t1;
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB;
+CREATE TABLE t2 (
+i INT NOT NULL,
+FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION
+) ENGINE= InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+DELETE IGNORE FROM t1 WHERE i = 1;
+Warnings:
+Error 1451 Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`i`) REFERENCES `t1` (`i`) ON DELETE NO ACTION)
+SELECT * FROM t1, t2;
+i i
+1 1
+DROP TABLE t2, t1;
+End of 4.1 tests.
+create table t1 (
+a varchar(30), b varchar(30), primary key(a), key(b)
+);
+select distinct a from t1;
+a
+drop table t1;
+create table t1(a int, key(a));
+insert into t1 values(1);
+select a, count(a) from t1 group by a with rollup;
+a count(a)
+1 1
+NULL 1
+drop table t1;
+create table t1 (f1 int, f2 char(1), primary key(f1,f2));
+insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
+alter table t1 drop primary key, add primary key (f2, f1);
+explain select distinct f1 a, f1 b from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary
+explain select distinct f1, f2 from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
+drop table t1;
+CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
+INDEX (name));
+CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11));
+ALTER TABLE t2 ADD FOREIGN KEY (fkey) REFERENCES t2(id);
+INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
+INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
+EXPLAIN
+SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
+WHERE t1.name LIKE 'A%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index
+1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index
+EXPLAIN
+SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
+WHERE t1.name LIKE 'A%' OR FALSE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL fkey 5 NULL 5 Using index
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
+DROP TABLE t1,t2;
+CREATE TABLE t1 (
+id int NOT NULL,
+name varchar(20) NOT NULL,
+dept varchar(20) NOT NULL,
+age tinyint(3) unsigned NOT NULL,
+PRIMARY KEY (id),
+INDEX (name,dept)
+) ENGINE=InnoDB;
+INSERT INTO t1(id, dept, age, name) VALUES
+(3987, 'cs1', 10, 'rs1'), (3988, 'cs2', 20, 'rs1'), (3995, 'cs3', 10, 'rs2'),
+(3996, 'cs4', 20, 'rs2'), (4003, 'cs5', 10, 'rs3'), (4004, 'cs6', 20, 'rs3'),
+(4011, 'cs7', 10, 'rs4'), (4012, 'cs8', 20, 'rs4'), (4019, 'cs9', 10, 'rs5'),
+(4020, 'cs10', 20, 'rs5'),(4027, 'cs11', 10, 'rs6'),(4028, 'cs12', 20, 'rs6');
+EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range name name 44 NULL 2 Using where; Using index for group-by
+SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+name dept
+rs5 cs10
+rs5 cs9
+DELETE FROM t1;
+# Masking (#) number in "rows" column of the following EXPLAIN output, as it may vary (bug#47746).
+EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range name name 44 NULL # Using where; Using index for group-by
+SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+name dept
+DROP TABLE t1;
+drop table if exists t1;
+show variables like 'innodb_rollback_on_timeout';
+Variable_name Value
+innodb_rollback_on_timeout OFF
+create table t1 (a int unsigned not null primary key) engine = innodb;
+insert into t1 values (1);
+commit;
+begin work;
+insert into t1 values (2);
+select * from t1;
+a
+1
+2
+begin work;
+insert into t1 values (5);
+select * from t1;
+a
+1
+5
+insert into t1 values (2);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t1;
+a
+1
+5
+commit;
+select * from t1;
+a
+1
+2
+commit;
+select * from t1;
+a
+1
+2
+5
+drop table t1;
+set @save_qcache_size=@@global.query_cache_size;
+set @save_qcache_type=@@global.query_cache_type;
+set global query_cache_size=10*1024*1024;
+set global query_cache_type=1;
+drop table if exists `test`;
+Warnings:
+Note 1051 Unknown table 'test'
+CREATE TABLE `test` (`test1` varchar(3) NOT NULL,
+`test2` varchar(4) NOT NULL,PRIMARY KEY (`test1`))
+ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO `test` (`test1`, `test2`) VALUES ('tes', '5678');
+select * from test;
+test1 test2
+tes 5678
+INSERT INTO `test` (`test1`, `test2`) VALUES ('tes', '1234')
+ON DUPLICATE KEY UPDATE `test2` = '1234';
+select * from test;
+test1 test2
+tes 1234
+flush tables;
+select * from test;
+test1 test2
+tes 1234
+drop table test;
+set global query_cache_type=@save_qcache_type;
+set global query_cache_size=@save_qcache_size;
+drop table if exists t1;
+show variables like 'innodb_rollback_on_timeout';
+Variable_name Value
+innodb_rollback_on_timeout OFF
+create table t1 (a int unsigned not null primary key) engine = innodb;
+insert into t1 values (1);
+commit;
+begin work;
+insert into t1 values (2);
+select * from t1;
+a
+1
+2
+begin work;
+insert into t1 values (5);
+select * from t1;
+a
+1
+5
+insert into t1 values (2);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t1;
+a
+1
+5
+commit;
+select * from t1;
+a
+1
+2
+commit;
+select * from t1;
+a
+1
+2
+5
+drop table t1;
+create table t1(
+id int auto_increment,
+c char(1) not null,
+counter int not null default 1,
+primary key (id),
+unique key (c)
+) engine=innodb;
+insert into t1 (id, c) values
+(NULL, 'a'),
+(NULL, 'a')
+on duplicate key update id = values(id), counter = counter + 1;
+select * from t1;
+id c counter
+2 a 2
+insert into t1 (id, c) values
+(NULL, 'b')
+on duplicate key update id = values(id), counter = counter + 1;
+select * from t1;
+id c counter
+2 a 2
+3 b 1
+truncate table t1;
+insert into t1 (id, c) values (NULL, 'a');
+select * from t1;
+id c counter
+1 a 1
+insert into t1 (id, c) values (NULL, 'b'), (NULL, 'b')
+on duplicate key update id = values(id), c = values(c), counter = counter + 1;
+select * from t1;
+id c counter
+1 a 1
+3 b 2
+insert into t1 (id, c) values (NULL, 'a')
+on duplicate key update id = values(id), c = values(c), counter = counter + 1;
+select * from t1;
+id c counter
+3 b 2
+4 a 2
+drop table t1;
+CREATE TABLE t1(
+id int AUTO_INCREMENT PRIMARY KEY,
+stat_id int NOT NULL,
+acct_id int DEFAULT NULL,
+INDEX idx1 (stat_id, acct_id),
+INDEX idx2 (acct_id)
+) ENGINE=MyISAM;
+CREATE TABLE t2(
+id int AUTO_INCREMENT PRIMARY KEY,
+stat_id int NOT NULL,
+acct_id int DEFAULT NULL,
+INDEX idx1 (stat_id, acct_id),
+INDEX idx2 (acct_id)
+) ENGINE=InnoDB;
+INSERT INTO t1(stat_id,acct_id) VALUES
+(1,759), (2,831), (3,785), (4,854), (1,921),
+(1,553), (2,589), (3,743), (2,827), (2,545),
+(4,779), (4,783), (1,597), (1,785), (4,832),
+(1,741), (1,833), (3,788), (2,973), (1,907);
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+UPDATE t1 SET acct_id=785
+WHERE MOD(stat_id,2)=0 AND MOD(id,stat_id)=MOD(acct_id,stat_id);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+40960
+SELECT COUNT(*) FROM t1 WHERE acct_id=785;
+COUNT(*)
+8702
+EXPLAIN SELECT COUNT(*) FROM t1 WHERE stat_id IN (1,3) AND acct_id=785;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx1,idx2 idx1 9 NULL 2 Using where; Using index
+INSERT INTO t2 SELECT * FROM t1;
+OPTIMIZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t2 optimize status OK
+EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range idx1,idx2 idx1 9 NULL 2 Using where; Using index
+DROP TABLE t1,t2;
+create table t1(a int) engine=innodb;
+alter table t1 comment '123';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='123'
+drop table t1;
+CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8;
+INSERT INTO t1 VALUES ('uk'),('bg');
+SELECT * FROM t1 WHERE a = 'uk';
+a
+uk
+DELETE FROM t1 WHERE a = 'uk';
+SELECT * FROM t1 WHERE a = 'uk';
+a
+UPDATE t1 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t1 WHERE a = 'uk';
+a
+CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
+INSERT INTO t2 VALUES ('uk'),('bg');
+SELECT * FROM t2 WHERE a = 'uk';
+a
+uk
+DELETE FROM t2 WHERE a = 'uk';
+SELECT * FROM t2 WHERE a = 'uk';
+a
+INSERT INTO t2 VALUES ('uk');
+UPDATE t2 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t2 WHERE a = 'uk';
+a
+CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
+INSERT INTO t3 VALUES ('uk'),('bg');
+SELECT * FROM t3 WHERE a = 'uk';
+a
+uk
+DELETE FROM t3 WHERE a = 'uk';
+SELECT * FROM t3 WHERE a = 'uk';
+a
+INSERT INTO t3 VALUES ('uk');
+UPDATE t3 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t3 WHERE a = 'uk';
+a
+DROP TABLE t1,t2,t3;
+create table t1 (a int) engine=innodb;
+select * from bug29807;
+ERROR 42S02: Table 'test.bug29807' doesn't exist
+drop table t1;
+drop table bug29807;
+ERROR 42S02: Unknown table 'bug29807'
+create table bug29807 (a int);
+drop table bug29807;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+switch to connection c1
+SET AUTOCOMMIT=0;
+INSERT INTO t2 VALUES (1);
+switch to connection c2
+SET AUTOCOMMIT=0;
+LOCK TABLES t1 READ, t2 READ;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+switch to connection c1
+COMMIT;
+INSERT INTO t1 VALUES (1);
+switch to connection default
+SET AUTOCOMMIT=default;
+DROP TABLE t1,t2;
+CREATE TABLE t1 (
+id int NOT NULL auto_increment PRIMARY KEY,
+b int NOT NULL,
+c datetime NOT NULL,
+INDEX idx_b(b),
+INDEX idx_c(c)
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+b int NOT NULL auto_increment PRIMARY KEY,
+c datetime NOT NULL
+) ENGINE= MyISAM;
+INSERT INTO t2(c) VALUES ('2007-01-01');
+INSERT INTO t2(c) SELECT c FROM t2;
+INSERT INTO t2(c) SELECT c FROM t2;
+INSERT INTO t2(c) SELECT c FROM t2;
+INSERT INTO t2(c) SELECT c FROM t2;
+INSERT INTO t2(c) SELECT c FROM t2;
+INSERT INTO t2(c) SELECT c FROM t2;
+INSERT INTO t2(c) SELECT c FROM t2;
+INSERT INTO t2(c) SELECT c FROM t2;
+INSERT INTO t2(c) SELECT c FROM t2;
+INSERT INTO t2(c) SELECT c FROM t2;
+INSERT INTO t1(b,c) SELECT b,c FROM t2;
+UPDATE t2 SET c='2007-01-02';
+INSERT INTO t1(b,c) SELECT b,c FROM t2;
+UPDATE t2 SET c='2007-01-03';
+INSERT INTO t1(b,c) SELECT b,c FROM t2;
+set @@sort_buffer_size=8192;
+Warnings:
+Warning 1292 Truncated incorrect sort_buffer_size value: '8192'
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+3072
+EXPLAIN
+SELECT COUNT(*) FROM t1
+WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL idx_b,idx_c NULL NULL NULL # Using where
+SELECT COUNT(*) FROM t1
+WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1;
+COUNT(*)
+3072
+EXPLAIN
+SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c)
+WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge idx_b,idx_c idx_c,idx_b 8,4 NULL # Using sort_union(idx_c,idx_b); Using where
+SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c)
+WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1;
+COUNT(*)
+3072
+set @@sort_buffer_size=default;
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a int, b int);
+insert into t1 values (1,1),(1,2);
+CREATE TABLE t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t2 (a int, b int, primary key (a));
+BEGIN;
+INSERT INTO t2 values(100,100);
+CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+100 100
+ROLLBACK;
+SELECT * from t2;
+a b
+100 100
+TRUNCATE table t2;
+INSERT INTO t2 select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+drop table t2;
+CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
+BEGIN;
+INSERT INTO t2 values(100,100);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+100 100
+COMMIT;
+BEGIN;
+INSERT INTO t2 values(101,101);
+CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+100 100
+101 101
+ROLLBACK;
+SELECT * from t2;
+a b
+100 100
+TRUNCATE table t2;
+INSERT INTO t2 select * from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT * from t2;
+a b
+drop table t1,t2;
+create table t1(f1 varchar(800) binary not null, key(f1))
+character set utf8 collate utf8_general_ci;
+Warnings:
+Warning 1071 Specified key was too long; max key length is 767 bytes
+insert into t1 values('aaa');
+drop table t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB;
+INSERT INTO t1 VALUES ( 1 , 1 , 1);
+INSERT INTO t1 SELECT a + 1 , MOD(a + 1 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 2 , MOD(a + 2 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 4 , MOD(a + 4 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 8 , MOD(a + 8 , 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20), 1 FROM t1;
+INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20), 1 FROM t1;
+EXPLAIN SELECT b, SUM(c) FROM t1 GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 5 NULL 128
+EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort
+DROP TABLE t1;
+drop table if exists t1;
+show variables like 'innodb_rollback_on_timeout';
+Variable_name Value
+innodb_rollback_on_timeout OFF
+create table t1 (a int unsigned not null primary key) engine = innodb;
+insert into t1 values (1);
+commit;
+begin work;
+insert into t1 values (2);
+select * from t1;
+a
+1
+2
+begin work;
+insert into t1 values (5);
+select * from t1;
+a
+1
+5
+insert into t1 values (2);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t1;
+a
+1
+5
+commit;
+select * from t1;
+a
+1
+2
+commit;
+select * from t1;
+a
+1
+2
+5
+drop table t1;
+drop table if exists t1;
+create table t1 (a int) engine=innodb;
+alter table t1 alter a set default 1;
+drop table t1;
+
+Bug#24918 drop table and lock / inconsistent between
+perm and temp tables
+
+Check transactional tables under LOCK TABLES
+
+drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp,
+t24918_access;
+create table t24918_access (id int);
+create table t24918 (id int) engine=myisam;
+create temporary table t24918_tmp (id int) engine=myisam;
+create table t24918_trans (id int) engine=innodb;
+create temporary table t24918_trans_tmp (id int) engine=innodb;
+lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write;
+drop table t24918;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+drop table t24918_trans;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+drop table t24918_trans_tmp;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+drop table t24918_tmp;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+unlock tables;
+drop table t24918_access;
+CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2);
+INSERT INTO t1 SELECT a + 8, 2 FROM t1;
+INSERT INTO t1 SELECT a + 16, 1 FROM t1;
+EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a;
+id 1
+select_type SIMPLE
+table t1
+type ref
+possible_keys bkey
+key bkey
+key_len 5
+ref const
+rows 16
+Extra Using where; Using index
+SELECT * FROM t1 WHERE b=2 ORDER BY a;
+a b
+1 2
+2 2
+3 2
+4 2
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+11 2
+12 2
+13 2
+14 2
+15 2
+16 2
+EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
+id 1
+select_type SIMPLE
+table t1
+type range
+possible_keys bkey
+key bkey
+key_len 5
+ref NULL
+rows 16
+Extra Using where; Using index; Using filesort
+SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
+a b
+1 2
+2 2
+3 2
+4 2
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+11 2
+12 2
+13 2
+14 2
+15 2
+16 2
+17 1
+18 1
+19 1
+20 1
+21 1
+22 1
+23 1
+24 1
+25 1
+26 1
+27 1
+28 1
+29 1
+30 1
+31 1
+32 1
+EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
+id 1
+select_type SIMPLE
+table t1
+type range
+possible_keys bkey
+key bkey
+key_len 5
+ref NULL
+rows 16
+Extra Using where; Using index
+SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
+a b
+17 1
+18 1
+19 1
+20 1
+21 1
+22 1
+23 1
+24 1
+25 1
+26 1
+27 1
+28 1
+29 1
+30 1
+31 1
+32 1
+1 2
+2 2
+3 2
+4 2
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+11 2
+12 2
+13 2
+14 2
+15 2
+16 2
+CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a), KEY bkey (b,c))
+ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,1,1),(3,1,1),(2,1,1),(4,1,1);
+INSERT INTO t2 SELECT a + 4, 1, 1 FROM t2;
+INSERT INTO t2 SELECT a + 8, 1, 1 FROM t2;
+EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 5
+ref const
+rows 8
+Extra Using where; Using index; Using filesort
+SELECT * FROM t2 WHERE b=1 ORDER BY a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 10
+ref const,const
+rows 8
+Extra Using where; Using index
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 10
+ref const,const
+rows 8
+Extra Using where; Using index
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 10
+ref const,const
+rows 8
+Extra Using where; Using index
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+INSERT INTO t1 SELECT a + 8 FROM t1;
+INSERT INTO t1 SELECT a + 16 FROM t1;
+CREATE PROCEDURE p1 ()
+BEGIN
+DECLARE i INT DEFAULT 50;
+DECLARE cnt INT;
+START TRANSACTION;
+ALTER TABLE t1 ENGINE=InnoDB;
+COMMIT;
+START TRANSACTION;
+WHILE (i > 0) DO
+SET i = i - 1;
+SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE;
+END WHILE;
+COMMIT;
+END;|
+CALL p1();
+CALL p1();
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
+create table t1(a text) engine=innodb default charset=utf8;
+insert into t1 values('aaa');
+alter table t1 add index(a(1024));
+Warnings:
+Warning 1071 Specified key was too long; max key length is 767 bytes
+Warning 1071 Specified key was too long; max key length is 767 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text,
+ KEY `a` (`a`(255))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
+drop table t1;
+CREATE TABLE t1 (
+a INT,
+b INT,
+KEY (b)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,10), (2,10), (2,20), (3,30);
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=20 FOR UPDATE;
+a b
+2 20
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=10 ORDER BY A FOR UPDATE;
+a b
+1 10
+2 10
+ROLLBACK;
+ROLLBACK;
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT,
+b INT NOT NULL,
+c INT NOT NULL,
+d INT,
+UNIQUE KEY (c,b)
+) engine=innodb;
+INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
+EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
+SELECT c,b,d FROM t1 GROUP BY c,b,d;
+c b d
+1 1 50
+3 1 4
+3 2 40
+EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
+c b d
+1 1 50
+3 1 4
+3 2 40
+EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
+SELECT c,b,d FROM t1 ORDER BY c,b,d;
+c b d
+1 1 50
+3 1 4
+3 2 40
+EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL c 8 NULL 3
+SELECT c,b,d FROM t1 GROUP BY c,b;
+c b d
+1 1 50
+3 1 4
+3 2 40
+EXPLAIN SELECT c,b FROM t1 GROUP BY c,b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL c 8 NULL 3 Using index
+SELECT c,b FROM t1 GROUP BY c,b;
+c b
+1 1
+3 1
+3 2
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), INDEX b (b)) ENGINE=InnoDB;
+INSERT INTO t1(a,b) VALUES (1,1), (2,2), (3,2);
+EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a ASC;
+id 1
+select_type SIMPLE
+table t1
+type ref
+possible_keys b
+key b
+key_len 5
+ref const
+rows 1
+Extra Using where; Using index
+SELECT * FROM t1 WHERE b=2 ORDER BY a ASC;
+a b
+2 2
+3 2
+EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a DESC;
+id 1
+select_type SIMPLE
+table t1
+type ref
+possible_keys b
+key b
+key_len 5
+ref const
+rows 1
+Extra Using where; Using index
+SELECT * FROM t1 WHERE b=2 ORDER BY a DESC;
+a b
+3 2
+2 2
+EXPLAIN SELECT * FROM t1 ORDER BY b ASC, a ASC;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key b
+key_len 5
+ref NULL
+rows 3
+Extra Using index
+SELECT * FROM t1 ORDER BY b ASC, a ASC;
+a b
+1 1
+2 2
+3 2
+EXPLAIN SELECT * FROM t1 ORDER BY b DESC, a DESC;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key b
+key_len 5
+ref NULL
+rows 3
+Extra Using index
+SELECT * FROM t1 ORDER BY b DESC, a DESC;
+a b
+3 2
+2 2
+1 1
+EXPLAIN SELECT * FROM t1 ORDER BY b ASC, a DESC;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key b
+key_len 5
+ref NULL
+rows 3
+Extra Using index; Using filesort
+SELECT * FROM t1 ORDER BY b ASC, a DESC;
+a b
+1 1
+3 2
+2 2
+EXPLAIN SELECT * FROM t1 ORDER BY b DESC, a ASC;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key b
+key_len 5
+ref NULL
+rows 3
+Extra Using index; Using filesort
+SELECT * FROM t1 ORDER BY b DESC, a ASC;
+a b
+2 2
+3 2
+1 1
+DROP TABLE t1;
+
+#
+# Bug#27610: ALTER TABLE ROW_FORMAT=... does not rebuild the table.
+#
+
+# - prepare;
+
+DROP TABLE IF EXISTS t1;
+
+CREATE TABLE t1(c INT)
+ENGINE = InnoDB
+ROW_FORMAT = COMPACT;
+
+# - initial check;
+
+SELECT table_schema, table_name, row_format
+FROM INFORMATION_SCHEMA.TABLES
+WHERE table_schema = DATABASE() AND table_name = 't1';
+table_schema table_name row_format
+test t1 Compact
+
+# - change ROW_FORMAT and check;
+
+ALTER TABLE t1 ROW_FORMAT = REDUNDANT;
+
+SELECT table_schema, table_name, row_format
+FROM INFORMATION_SCHEMA.TABLES
+WHERE table_schema = DATABASE() AND table_name = 't1';
+table_schema table_name row_format
+test t1 Redundant
+
+# - that's it, cleanup.
+
+DROP TABLE t1;
+create table t1(a char(10) not null, unique key aa(a(1)),
+b char(4) not null, unique key bb(b(4))) engine=innodb;
+desc t1;
+Field Type Null Key Default Extra
+a char(10) NO UNI NULL
+b char(4) NO PRI NULL
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) NOT NULL,
+ `b` char(4) NOT NULL,
+ UNIQUE KEY `bb` (`b`),
+ UNIQUE KEY `aa` (`a`(1))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(191, 'member', 1), (NULL, 'member', 3), (NULL, 'member', 4), (201, 'member', 2);
+EXPLAIN SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL idx NULL NULL NULL 4 Using where; Using filesort
+SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
+id type d
+191 member 1
+NULL member 3
+NULL member 4
+DROP TABLE t1;
+set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment;
+set global innodb_autoextend_increment=8;
+set global innodb_autoextend_increment=@my_innodb_autoextend_increment;
+set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency;
+set global innodb_commit_concurrency=0;
+set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
+CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY (a), KEY t1_b (b))
+ENGINE=InnoDB;
+INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1);
+INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
+EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index t1_b PRIMARY 4 NULL 8 Using where
+SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
+a b c
+8 1 1
+7 1 1
+6 1 1
+5 1 1
+4 1 1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
+CREATE INDEX i1 on t1 (a(3));
+SELECT * FROM t1 WHERE a = 'abcde';
+a
+DROP TABLE t1;
+#
+# BUG #26288: savepoint are not deleted on comit, if the transaction
+# was otherwise empty
+#
+BEGIN;
+SAVEPOINT s1;
+COMMIT;
+RELEASE SAVEPOINT s1;
+ERROR 42000: SAVEPOINT s1 does not exist
+BEGIN;
+SAVEPOINT s2;
+COMMIT;
+ROLLBACK TO SAVEPOINT s2;
+ERROR 42000: SAVEPOINT s2 does not exist
+BEGIN;
+SAVEPOINT s3;
+ROLLBACK;
+RELEASE SAVEPOINT s3;
+ERROR 42000: SAVEPOINT s3 does not exist
+BEGIN;
+SAVEPOINT s4;
+ROLLBACK;
+ROLLBACK TO SAVEPOINT s4;
+ERROR 42000: SAVEPOINT s4 does not exist
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY COMMENT 'My ID#', f2 INTEGER DEFAULT NULL, f3 CHAR(10) DEFAULT 'My ID#', CONSTRAINT f2_ref FOREIGN KEY (f2) REFERENCES t1 (f1)) ENGINE=INNODB;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL COMMENT 'My ID#',
+ `f2` int(11) DEFAULT NULL,
+ `f3` char(10) DEFAULT 'My ID#',
+ PRIMARY KEY (`f1`),
+ KEY `f2_ref` (`f2`),
+ CONSTRAINT `f2_ref` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# Bug #36995: valgrind error in remove_const during subquery executions
+#
+create table t1 (a bit(1) not null,b int) engine=myisam;
+create table t2 (c int) engine=innodb;
+explain
+select b from t1 where a not in (select b from t1,t2 group by a) group by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1
+DROP TABLE t1,t2;
+End of 5.0 tests
+CREATE TABLE `t2` (
+`k` int(11) NOT NULL auto_increment,
+`a` int(11) default NULL,
+`c` int(11) default NULL,
+PRIMARY KEY (`k`),
+UNIQUE KEY `idx_1` (`a`)
+);
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+insert into t2 ( a ) values ( 7 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+last_insert_id()
+2
+select * from t2;
+k a c
+1 6 NULL
+2 7 NULL
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+last_insert_id()
+2
+select last_insert_id(0);
+last_insert_id(0)
+0
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1;
+select last_insert_id();
+last_insert_id()
+0
+select * from t2;
+k a c
+1 6 2
+2 7 NULL
+insert ignore into t2 values (null,6,1),(10,8,1);
+select last_insert_id();
+last_insert_id()
+0
+insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
+select last_insert_id();
+last_insert_id()
+11
+select * from t2;
+k a c
+1 6 2
+2 7 NULL
+10 8 1
+11 15 1
+12 20 1
+insert into t2 ( a ) values ( 6 ) on duplicate key update c =
+ifnull( c,
+0 ) + 1, k=last_insert_id(k);
+select last_insert_id();
+last_insert_id()
+1
+select * from t2;
+k a c
+1 6 3
+2 7 NULL
+10 8 1
+11 15 1
+12 20 1
+drop table t2;
+drop table if exists t1, t2;
+create table t1 (i int);
+alter table t1 modify i int default 1;
+alter table t1 modify i int default 2, rename t2;
+lock table t2 write;
+alter table t2 modify i int default 3;
+unlock tables;
+lock table t2 write;
+alter table t2 modify i int default 4, rename t1;
+unlock tables;
+drop table t1;
+drop table if exists t1;
+create table t1 (i int);
+insert into t1 values ();
+lock table t1 write;
+alter table t1 modify i int default 1;
+insert into t1 values ();
+select * from t1;
+i
+NULL
+1
+alter table t1 change i c char(10) default "Two";
+insert into t1 values ();
+select * from t1;
+c
+NULL
+1
+Two
+unlock tables;
+select * from t1;
+c
+NULL
+1
+Two
+drop tables t1;
+create table t1(f1 varchar(5) unique, f2 timestamp NOT NULL DEFAULT
+CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
+insert into t1(f1) values(1);
+select @a:=f2 from t1;
+@a:=f2
+#
+update t1 set f1=1;
+select @b:=f2 from t1;
+@b:=f2
+#
+select if(@a=@b,"ok","wrong");
+if(@a=@b,"ok","wrong")
+ok
+insert into t1(f1) values (1) on duplicate key update f1="1";
+select @b:=f2 from t1;
+@b:=f2
+#
+select if(@a=@b,"ok","wrong");
+if(@a=@b,"ok","wrong")
+ok
+insert into t1(f1) select f1 from t1 on duplicate key update f1="1";
+select @b:=f2 from t1;
+@b:=f2
+#
+select if(@a=@b,"ok","wrong");
+if(@a=@b,"ok","wrong")
+ok
+drop table t1;
+SET SESSION AUTOCOMMIT = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+set binlog_format=mixed;
+# Switch to connection con1
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
+ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,2);
+# 1. test for locking:
+BEGIN;
+UPDATE t1 SET b = 12 WHERE a = 1;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+SELECT * FROM t1;
+a b
+1 12
+# Switch to connection con2
+UPDATE t1 SET b = 21 WHERE a = 1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Switch to connection con1
+SELECT * FROM t1;
+a b
+1 12
+ROLLBACK;
+# 2. test for serialized update:
+CREATE TABLE t2 (a INT);
+TRUNCATE t1;
+INSERT INTO t1 VALUES (1,'init');
+CREATE PROCEDURE p1()
+BEGIN
+UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
+INSERT INTO t2 VALUES ();
+END|
+BEGIN;
+UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+SELECT * FROM t1;
+a b
+1 init+con1
+# Switch to connection con2
+CALL p1;;
+# Switch to connection con1
+SELECT * FROM t1;
+a b
+1 init+con1
+COMMIT;
+SELECT * FROM t1;
+a b
+1 init+con1
+# Switch to connection con2
+SELECT * FROM t1;
+a b
+1 init+con1+con2
+# Switch to connection con1
+# 3. test for updated key column:
+TRUNCATE t1;
+TRUNCATE t2;
+INSERT INTO t1 VALUES (1,'init');
+BEGIN;
+UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+SELECT * FROM t1;
+a b
+2 init+con1
+# Switch to connection con2
+CALL p1;;
+# Switch to connection con1
+SELECT * FROM t1;
+a b
+2 init+con1
+COMMIT;
+SELECT * FROM t1;
+a b
+2 init+con1
+# Switch to connection con2
+SELECT * FROM t1;
+a b
+2 init+con1
+DROP PROCEDURE p1;
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b)) engine=innodb;
+CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+CONSTRAINT c2 FOREIGN KEY f2 (c) REFERENCES t1 (a,b) ON UPDATE NO ACTION) engine=innodb;
+ERROR 42000: Incorrect foreign key definition for 'f2': Key reference and table reference don't match
+CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a,b) ON UPDATE NO ACTION) engine=innodb;
+ERROR 42000: Incorrect foreign key definition for 'c2': Key reference and table reference don't match
+CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+CONSTRAINT c1 FOREIGN KEY c2 (c) REFERENCES t1 (a) ON DELETE NO ACTION,
+CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION) engine=innodb;
+ALTER TABLE t2 DROP FOREIGN KEY c2;
+DROP TABLE t2;
+CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+FOREIGN KEY (c) REFERENCES t1 (a,k) ON UPDATE NO ACTION) engine=innodb;
+ERROR 42000: Incorrect foreign key definition for 'foreign key without name': Key reference and table reference don't match
+CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+FOREIGN KEY f1 (c) REFERENCES t1 (a,k) ON UPDATE NO ACTION) engine=innodb;
+ERROR 42000: Incorrect foreign key definition for 'f1': Key reference and table reference don't match
+CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+CONSTRAINT c1 FOREIGN KEY f1 (c) REFERENCES t1 (a) ON DELETE NO ACTION,
+CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION,
+FOREIGN KEY f3 (c) REFERENCES t1 (a) ON UPDATE NO ACTION,
+FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION) engine=innodb;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) NOT NULL,
+ `d` int(11) NOT NULL,
+ PRIMARY KEY (`c`,`d`),
+ CONSTRAINT `c1` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON DELETE NO ACTION,
+ CONSTRAINT `c2` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION,
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION,
+ CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t1` (`a`) ON UPDATE NO ACTION
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+create table t1 (a int auto_increment primary key) engine=innodb;
+alter table t1 order by a;
+Warnings:
+Warning 1105 ORDER BY ignored as there is a user-defined clustered index in the table 't1'
+drop table t1;
+CREATE TABLE t1
+(vid integer NOT NULL,
+tid integer NOT NULL,
+idx integer NOT NULL,
+name varchar(128) NOT NULL,
+type varchar(128) NULL,
+PRIMARY KEY(idx, vid, tid),
+UNIQUE(vid, tid, name)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(1,1,1,'pk',NULL),(2,1,1,'pk',NULL),(3,1,1,'pk',NULL),(4,1,1,'c1',NULL),
+(5,1,1,'pk',NULL),(1,1,2,'c1',NULL),(2,1,2,'c1',NULL),(3,1,2,'c1',NULL),
+(4,1,2,'c2',NULL),(5,1,2,'c1',NULL),(2,1,3,'c2',NULL),(3,1,3,'c2',NULL),
+(4,1,3,'pk',NULL),(5,1,3,'c2',NULL),
+(2,1,4,'c_extra',NULL),(3,1,4,'c_extra',NULL);
+EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 12 NULL 16 Using where
+SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
+vid tid idx name type
+3 1 4 c_extra NULL
+3 1 3 c2 NULL
+3 1 2 c1 NULL
+3 1 1 pk NULL
+DROP TABLE t1;
+#
+# Bug #44290: explain crashes for subquery with distinct in
+# SQL_SELECT::test_quick_select
+# (reproduced only with InnoDB tables)
+#
+CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, KEY (c3), KEY (c2, c3))
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2);
+SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
+FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
+1
+1
+EXPLAIN
+SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
+FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+2 DERIVED t1 index c3,c2 c2 10 NULL 5
+DROP TABLE t1;
+CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3))
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2);
+SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
+FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
+1
+1
+EXPLAIN
+SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
+FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+2 DERIVED t1 index c3,c2 c2 18 NULL 5
+DROP TABLE t1;
+CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2),
+KEY (c3), KEY (c2, c3))
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2);
+SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
+FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
+1
+1
+EXPLAIN
+SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
+FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+2 DERIVED t1 index c3,c2 c2 14 NULL 5
+DROP TABLE t1;
+End of 5.1 tests
+drop table if exists t1, t2, t3;
+create table t1(a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, b int, pk int, key(a,b), primary key(pk)) engine=innodb;
+insert into t2 select @a:=A.a+10*(B.a + 10*C.a),@a, @a from t1 A, t1 B, t1 C;
+this must use key 'a', not PRIMARY:
+explain select a from t2 where a=b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL a 10 NULL # Using where; Using index
+drop table t1, t2;
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+select @@session.sql_log_bin, @@session.binlog_format, @@session.tx_isolation;
+@@session.sql_log_bin 1
+@@session.binlog_format STATEMENT
+@@session.tx_isolation READ-COMMITTED
+CREATE TABLE t1 ( a INT ) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
+CREATE INDEX i1 on t1 (a(3));
+SELECT * FROM t1 WHERE a = 'abcde';
+a
+DROP TABLE t1;
+CREATE TABLE foo (a int, b int, c char(10),
+PRIMARY KEY (c(3)),
+KEY b (b)
+) engine=innodb;
+CREATE TABLE foo2 (a int, b int, c char(10),
+PRIMARY KEY (c),
+KEY b (b)
+) engine=innodb;
+CREATE TABLE bar (a int, b int, c char(10),
+PRIMARY KEY (c(3)),
+KEY b (b)
+) engine=myisam;
+INSERT INTO foo VALUES
+(1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'),
+(4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe');
+INSERT INTO bar SELECT * FROM foo;
+INSERT INTO foo2 SELECT * FROM foo;
+EXPLAIN SELECT c FROM bar WHERE b>2;;
+id 1
+select_type SIMPLE
+table bar
+type ALL
+possible_keys b
+key NULL
+key_len NULL
+ref NULL
+rows 6
+Extra Using where
+EXPLAIN SELECT c FROM foo WHERE b>2;;
+id 1
+select_type SIMPLE
+table foo
+type ALL
+possible_keys b
+key NULL
+key_len NULL
+ref NULL
+rows 6
+Extra Using where
+EXPLAIN SELECT c FROM foo2 WHERE b>2;;
+id 1
+select_type SIMPLE
+table foo2
+type range
+possible_keys b
+key b
+key_len 5
+ref NULL
+rows 3
+Extra Using where; Using index
+EXPLAIN SELECT c FROM bar WHERE c>2;;
+id 1
+select_type SIMPLE
+table bar
+type ALL
+possible_keys PRIMARY
+key NULL
+key_len NULL
+ref NULL
+rows 6
+Extra Using where
+EXPLAIN SELECT c FROM foo WHERE c>2;;
+id 1
+select_type SIMPLE
+table foo
+type ALL
+possible_keys PRIMARY
+key NULL
+key_len NULL
+ref NULL
+rows 6
+Extra Using where
+EXPLAIN SELECT c FROM foo2 WHERE c>2;;
+id 1
+select_type SIMPLE
+table foo2
+type index
+possible_keys PRIMARY
+key b
+key_len 5
+ref NULL
+rows 6
+Extra Using where; Using index
+DROP TABLE foo, bar, foo2;
+DROP TABLE IF EXISTS t1,t3,t2;
+DROP FUNCTION IF EXISTS f1;
+CREATE FUNCTION f1() RETURNS VARCHAR(250)
+BEGIN
+return 'hhhhhhh' ;
+END|
+CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20), c VARCHAR(20)) ENGINE=INNODB;
+BEGIN WORK;
+CREATE TEMPORARY TABLE t2 (a VARCHAR(20), b VARCHAR(20), c varchar(20)) ENGINE=INNODB;
+CREATE TEMPORARY TABLE t3 LIKE t2;
+INSERT INTO t1 VALUES ('a','b',NULL),('c','d',NULL),('e','f',NULL);
+SET @stmt := CONCAT('INSERT INTO t2 SELECT tbl.a, tbl.b, f1()',' FROM t1 tbl');
+PREPARE stmt1 FROM @stmt;
+SET @stmt := CONCAT('INSERT INTO t3', ' SELECT * FROM t2');
+PREPARE stmt3 FROM @stmt;
+EXECUTE stmt1;
+COMMIT;
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt3;
+DROP TABLE t1,t3,t2;
+DROP FUNCTION f1;
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY,
+t1_id INT, INDEX par_ind (t1_id),
+FOREIGN KEY (t1_id) REFERENCES t1(id)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (3,2);
+SET AUTOCOMMIT = 0;
+START TRANSACTION;
+TRUNCATE TABLE t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`))
+SELECT * FROM t1;
+id
+1
+2
+COMMIT;
+SELECT * FROM t1;
+id
+1
+2
+START TRANSACTION;
+TRUNCATE TABLE t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`))
+SELECT * FROM t1;
+id
+1
+2
+ROLLBACK;
+SELECT * FROM t1;
+id
+1
+2
+SET AUTOCOMMIT = 1;
+START TRANSACTION;
+SELECT * FROM t1;
+id
+1
+2
+COMMIT;
+TRUNCATE TABLE t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`))
+SELECT * FROM t1;
+id
+1
+2
+DELETE FROM t2 WHERE id = 3;
+START TRANSACTION;
+SELECT * FROM t1;
+id
+1
+2
+TRUNCATE TABLE t1;
+ROLLBACK;
+SELECT * FROM t1;
+id
+TRUNCATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0
+#
+CREATE TABLE t1 (
+id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+aid INT UNSIGNED NOT NULL,
+PRIMARY KEY (id),
+FOREIGN KEY (aid) REFERENCES t1 (id)
+) ENGINE=InnoDB;
+CREATE TABLE t3 (
+bid INT UNSIGNED NOT NULL,
+FOREIGN KEY (bid) REFERENCES t2 (id)
+) ENGINE=InnoDB;
+CREATE TABLE t4 (
+a INT
+) ENGINE=InnoDB;
+CREATE TABLE t5 (
+a INT
+) ENGINE=InnoDB;
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id, aid) VALUES (1, 1),(2,1),(3,1),(4,1);
+INSERT INTO t3 (bid) VALUES (1);
+INSERT INTO t4 VALUES (1),(2),(3),(4),(5);
+INSERT INTO t5 VALUES (1);
+DELETE t5 FROM t4 LEFT JOIN t5 ON t4.a= t5.a;
+DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`bid`) REFERENCES `t2` (`id`))
+DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`bid`) REFERENCES `t2` (`id`))
+DELETE IGNORE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1;
+DROP TABLE t3;
+DROP TABLE t2;
+DROP TABLE t1;
+DROP TABLES t4,t5;
+# Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0
+# Testing for any side effects of IGNORE on AFTER DELETE triggers used with
+# transactional tables.
+#
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a VARCHAR(100)) ENGINE=InnoDB;
+CREATE TABLE t3 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t4 (i INT NOT NULL PRIMARY KEY, t1i INT,
+FOREIGN KEY (t1i) REFERENCES t1(i))
+ENGINE=InnoDB;
+CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW
+BEGIN
+SET @b:='EXECUTED TRIGGER';
+INSERT INTO t2 VALUES (@b);
+SET @a:= error_happens_here;
+END||
+SET @b:="";
+SET @a:="";
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+INSERT INTO t3 SELECT * FROM t1;
+** An error in a trigger causes rollback of the statement.
+DELETE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
+ERROR 42S22: Unknown column 'error_happens_here' in 'field list'
+SELECT @a,@b;
+@a @b
+ EXECUTED TRIGGER
+SELECT * FROM t2;
+a
+SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
+i i
+1 1
+2 2
+3 3
+4 4
+** Same happens with the IGNORE option
+DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
+ERROR 42S22: Unknown column 'error_happens_here' in 'field list'
+SELECT * FROM t2;
+a
+SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
+i i
+1 1
+2 2
+3 3
+4 4
+**
+** The following is an attempt to demonstrate
+** error handling inside a row iteration.
+**
+DROP TRIGGER trg;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+INSERT INTO t3 VALUES (1),(2),(3),(4);
+INSERT INTO t4 VALUES (3,3),(4,4);
+CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW
+BEGIN
+SET @b:= CONCAT('EXECUTED TRIGGER FOR ROW ',CAST(OLD.i AS CHAR));
+INSERT INTO t2 VALUES (@b);
+END||
+** DELETE is prevented by foreign key constrains but errors are silenced.
+** The AFTER trigger isn't fired.
+DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
+** Tables are modified by best effort:
+SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
+i i
+3 3
+4 4
+** The AFTER trigger was only executed on successful rows:
+SELECT * FROM t2;
+a
+EXECUTED TRIGGER FOR ROW 1
+EXECUTED TRIGGER FOR ROW 2
+DROP TRIGGER trg;
+**
+** Induce an error midway through an AFTER-trigger
+**
+TRUNCATE TABLE t4;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t3;
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+INSERT INTO t3 VALUES (1),(2),(3),(4);
+CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW
+BEGIN
+SET @a:= @a+1;
+IF @a > 2 THEN
+INSERT INTO t4 VALUES (5,5);
+END IF;
+END||
+SET @a:=0;
+** Errors in the trigger causes the statement to abort.
+DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`t1i`) REFERENCES `t1` (`i`))
+SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
+i i
+1 1
+2 2
+3 3
+4 4
+SELECT * FROM t4;
+i t1i
+DROP TRIGGER trg;
+DROP TABLE t4;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE = INNODB;
+CREATE TABLE t2 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB;
+CREATE TABLE t3 (a INT, b INT KEY, KEY (a)) ENGINE = INNODB;
+CREATE TABLE t4 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB;
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6);
+INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+INSERT INTO t3 VALUES (1, 101), (2, 102), (3, 103), (4, 104), (5, 105), (6, 106);
+INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+UPDATE t1, t2 SET t1.a = t1.a + 100, t2.b = t1.a + 10
+WHERE t1.a BETWEEN 2 AND 4 AND t2.a = t1.b;
+SELECT * FROM t2;
+a b
+1 1
+2 12
+3 13
+4 14
+5 5
+UPDATE t3, t4 SET t3.a = t3.a + 100, t4.b = t3.a + 10
+WHERE t3.a BETWEEN 2 AND 4 AND t4.a = t3.b - 100;
+SELECT * FROM t4;
+a b
+1 1
+2 12
+3 13
+4 14
+5 5
+DROP TABLE t1, t2, t3, t4;
+#
+# Bug#44886: SIGSEGV in test_if_skip_sort_order() -
+# uninitialized variable used as subscript
+#
+CREATE TABLE t1 (a INT, b INT, c INT, d INT, PRIMARY KEY (b), KEY (a,c))
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1,1,0);
+CREATE TABLE t2 (a INT, b INT, e INT, KEY (e)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,1,2);
+CREATE TABLE t3 (a INT, b INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (1, 1);
+SELECT * FROM t1, t2, t3
+WHERE t1.a = t3.a AND (t1.b = t3.b OR t1.d) AND t2.b = t1.b AND t2.e = 2
+GROUP BY t1.b;
+a b c d a b e a b
+1 1 1 0 1 1 2 1 1
+DROP TABLE t1, t2, t3;
+#
+# Bug #45828: Optimizer won't use partial primary key if another
+# index can prevent filesort
+#
+CREATE TABLE `t1` (
+c1 int NOT NULL,
+c2 int NOT NULL,
+c3 int NOT NULL,
+PRIMARY KEY (c1,c2),
+KEY (c3)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (5,2,1246276747);
+INSERT INTO t1 VALUES (2,1,1246281721);
+INSERT INTO t1 VALUES (7,3,1246281756);
+INSERT INTO t1 VALUES (4,2,1246282139);
+INSERT INTO t1 VALUES (3,1,1246282230);
+INSERT INTO t1 VALUES (1,0,1246282712);
+INSERT INTO t1 VALUES (8,3,1246282765);
+INSERT INTO t1 SELECT c1+10,c2+10,c3+10 FROM t1;
+INSERT INTO t1 SELECT c1+100,c2+100,c3+100 from t1;
+INSERT INTO t1 SELECT c1+1000,c2+1000,c3+1000 from t1;
+INSERT INTO t1 SELECT c1+10000,c2+10000,c3+10000 from t1;
+INSERT INTO t1 SELECT c1+100000,c2+100000,c3+100000 from t1;
+INSERT INTO t1 SELECT c1+1000000,c2+1000000,c3+1000000 from t1;
+SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
+c1 c2 c3
+EXPLAIN SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref PRIMARY,c3 PRIMARY 4 const 1 Using where; Using filesort
+EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref PRIMARY PRIMARY 4 const 1 Using where; Using filesort
+CREATE TABLE t2 (
+c1 int NOT NULL,
+c2 int NOT NULL,
+c3 int NOT NULL,
+KEY (c1,c2),
+KEY (c3)
+) ENGINE=InnoDB;
+explain SELECT * FROM t2 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref c1,c3 c1 4 const 1 Using where; Using filesort
+DROP TABLE t1,t2;
+#
+# 36259: Optimizing with ORDER BY
+#
+CREATE TABLE t1 (
+a INT NOT NULL AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL,
+d VARCHAR(5),
+e INT NOT NULL,
+PRIMARY KEY (a), KEY i2 (b,c,d)
+) ENGINE=InnoDB;
+INSERT INTO t1 (b,c,d,e) VALUES (1,1,'a',1), (2,2,'b',2);
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+EXPLAIN SELECT * FROM t1 WHERE b=1 AND c=1 ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i2 i2 8 const,const 1 Using where; Using filesort
+EXPLAIN SELECT * FROM t1 FORCE INDEX(i2) WHERE b=1 and c=1 ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i2 i2 8 const,const 1 Using where; Using filesort
+EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using where
+DROP TABLE t1;
+#
+# Bug #47963: Wrong results when index is used
+#
+CREATE TABLE t1(
+a VARCHAR(5) NOT NULL,
+b VARCHAR(5) NOT NULL,
+c DATETIME NOT NULL,
+KEY (c)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00');
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001';
+a b c
+TEST TEST 2009-10-09 00:00:00
+SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
+a b c
+EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND
+c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+DROP TABLE t1;
+#
+# Bug #46175: NULL read_view and consistent read assertion
+#
+CREATE TABLE t1(a CHAR(13),KEY(a)) ENGINE=innodb;
+CREATE TABLE t2(b DATETIME,KEY(b)) ENGINE=innodb;
+INSERT INTO t1 VALUES (),();
+INSERT INTO t2 VALUES (),();
+CREATE OR REPLACE VIEW v1 AS SELECT 1 FROM t2
+WHERE b =(SELECT a FROM t1 LIMIT 1);
+CREATE PROCEDURE p1(num INT)
+BEGIN
+DECLARE i INT DEFAULT 0;
+REPEAT
+SHOW CREATE VIEW v1;
+SET i:=i+1;
+UNTIL i>num END REPEAT;
+END|
+# Should not crash
+# Should not crash
+DROP PROCEDURE p1;
+DROP VIEW v1;
+DROP TABLE t1,t2;
+#
+# Bug #49324: more valgrind errors in test_if_skip_sort_order
+#
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb ;
+#should not cause valgrind warnings
+SELECT 1 FROM t1 JOIN t1 a USING(a) GROUP BY t1.a,t1.a;
+1
+DROP TABLE t1;
+#
+# Bug#50843: Filesort used instead of clustered index led to
+# performance degradation.
+#
+create table t1(f1 int not null primary key, f2 int) engine=innodb;
+create table t2(f1 int not null, key (f1)) engine=innodb;
+insert into t1 values (1,1),(2,2),(3,3);
+insert into t2 values (1),(2),(3);
+explain select t1.* from t1 left join t2 using(f1) group by t1.f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 3
+1 SIMPLE t2 ref f1 f1 4 test.t1.f1 1 Using index
+drop table t1,t2;
+#
+#
+# Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may
+# corrupt definition at engine
+#
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, KEY k (a,b))
+ENGINE=InnoDB;
+ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b);
+SHOW INDEXES FROM t1;;
+Table t1
+Non_unique 0
+Key_name k
+Seq_in_index 1
+Column_name a
+Collation A
+Cardinality 0
+Sub_part NULL
+Packed NULL
+Null
+Index_type BTREE
+Comment
+Table t1
+Non_unique 0
+Key_name k
+Seq_in_index 2
+Column_name b
+Collation A
+Cardinality 0
+Sub_part NULL
+Packed NULL
+Null
+Index_type BTREE
+Comment
+DROP TABLE t1;
+#
+# Bug #53334: wrong result for outer join with impossible ON condition
+# (see the same test case for MyISAM in join.test)
+#
+create table t1 (id int primary key);
+create table t2 (id int);
+insert into t1 values (75);
+insert into t1 values (79);
+insert into t1 values (78);
+insert into t1 values (77);
+replace into t1 values (76);
+replace into t1 values (76);
+insert into t1 values (104);
+insert into t1 values (103);
+insert into t1 values (102);
+insert into t1 values (101);
+insert into t1 values (105);
+insert into t1 values (106);
+insert into t1 values (107);
+insert into t2 values (107),(75),(1000);
+select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
+where t2.id=75 and t1.id is null;
+id id
+NULL 75
+explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
+where t2.id=75 and t1.id is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
+drop table t1,t2;
+#
+# Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when
+# JOINed during an UPDATE
+#
+CREATE TABLE t1 (d INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, b INT,
+c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB;
+set up our data elements
+INSERT INTO t1 (d) VALUES (1);
+INSERT INTO t2 (a,b) VALUES (1,1);
+SELECT SECOND(c) INTO @bug47453 FROM t2;
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+SECOND(c)-@bug47453
+0
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+SECOND(c)-@bug47453
+0
+SELECT SLEEP(1);
+SLEEP(1)
+0
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+#should be 0
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+SECOND(c)-@bug47453
+0
+DROP TABLE t1, t2;
+#
+# Bug#38999 valgrind warnings for update statement in function compare_record()
+#
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 values (1),(2),(3),(4),(5);
+INSERT INTO t2 values (1);
+SELECT * FROM t1 WHERE a = 2;
+a
+2
+UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1;
+DROP TABLE t1,t2;
+#
+# Bug #53334: wrong result for outer join with impossible ON condition
+# (see the same test case for MyISAM in join.test)
+#
+CREATE TABLE t1 (id INT PRIMARY KEY);
+CREATE TABLE t2 (id INT);
+INSERT INTO t1 VALUES (75);
+INSERT INTO t1 VALUES (79);
+INSERT INTO t1 VALUES (78);
+INSERT INTO t1 VALUES (77);
+REPLACE INTO t1 VALUES (76);
+REPLACE INTO t1 VALUES (76);
+INSERT INTO t1 VALUES (104);
+INSERT INTO t1 VALUES (103);
+INSERT INTO t1 VALUES (102);
+INSERT INTO t1 VALUES (101);
+INSERT INTO t1 VALUES (105);
+INSERT INTO t1 VALUES (106);
+INSERT INTO t1 VALUES (107);
+INSERT INTO t2 VALUES (107),(75),(1000);
+SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0
+WHERE t2.id=75 AND t1.id IS NULL;
+id id
+NULL 75
+EXPLAIN SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0
+WHERE t2.id=75 AND t1.id IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
+DROP TABLE t1,t2;
+#
+# Bug #53830: !table || (!table->read_set || bitmap_is_set(table->read_set, field_index))
+#
+CREATE TABLE t1 (a INT, b INT, c INT, d INT,
+PRIMARY KEY(a,b,c), KEY(b,d))
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0, 77, 1, 3);
+UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25;
+DROP TABLE t1;
+#
+# Bug#50389 Using intersect does not return all rows
+#
+CREATE TABLE t1 (
+f1 INT(10) NOT NULL,
+f2 INT(10),
+f3 INT(10),
+f4 TINYINT(4),
+f5 VARCHAR(50),
+PRIMARY KEY (f1),
+KEY idx1 (f2,f5,f4),
+KEY idx2 (f2,f4)
+) ENGINE=InnoDB;
+LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1;
+SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+3470988,3305175,3329875,3817277,3856380,3796193,
+3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+f1 f2 f3 f4 f5
+3305175 1221457 0 0 abcdefghijklmnopwrst
+3329875 1221457 1382427 0 abcdefghijklmnopwrst
+3336022 1221457 0 0 abcdefghijklmnopwrst
+3346860 1221457 0 0 abcdefghijklmnopwrst
+3772880 1221457 0 0 abcdefghijklmnopwrst
+3784744 1221457 1382427 0 abcdefghijklmnopwrst
+3796193 1221457 0 0 abcdefghijklmnopwrst
+4228206 1221457 0 0 abcdefghijklmnopwrst
+4494153 1221457 0 0 abcdefghijklmnopwrst
+4559596 1221457 0 0 abcdefghijklmnopwrst
+EXPLAIN SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+3470988,3305175,3329875,3817277,3856380,3796193,
+3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge PRIMARY,idx1,idx2 idx2,idx1,PRIMARY 7,60,4 NULL 1 Using intersect(idx2,idx1,PRIMARY); Using where
+DROP TABLE t1;
+#
+# Bug#51431 Wrong sort order after import of dump file
+#
+CREATE TABLE t1 (
+f1 INT(11) NOT NULL,
+f2 int(11) NOT NULL,
+f3 int(11) NOT NULL,
+f4 tinyint(1) NOT NULL,
+PRIMARY KEY (f1),
+UNIQUE KEY (f2, f3),
+KEY (f4)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1),
+(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1),
+(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1),
+(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1),
+(26,1,9921,1), (27,1,9922,1);
+FLUSH TABLES;
+SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+f1 f2 f3 f4
+27 1 9922 1
+26 1 9921 1
+25 1 9920 1
+24 1 9919 1
+23 1 9918 1
+EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where
+DROP TABLE t1;
+End of 5.1 tests
diff --git a/mysql-test/r/innodb_mysql_rbk.result b/mysql-test/suite/innodb/r/innodb_mysql_rbk.result
index 21ac4295325..21ac4295325 100644
--- a/mysql-test/r/innodb_mysql_rbk.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql_rbk.result
diff --git a/mysql-test/r/innodb_notembedded.result b/mysql-test/suite/innodb/r/innodb_notembedded.result
index af332aba38a..af332aba38a 100644
--- a/mysql-test/r/innodb_notembedded.result
+++ b/mysql-test/suite/innodb/r/innodb_notembedded.result
diff --git a/mysql-test/r/innodb_timeout_rollback.result b/mysql-test/suite/innodb/r/innodb_timeout_rollback.result
index e2da6ba8af7..e2da6ba8af7 100644
--- a/mysql-test/r/innodb_timeout_rollback.result
+++ b/mysql-test/suite/innodb/r/innodb_timeout_rollback.result
diff --git a/mysql-test/suite/innodb/t/disabled.def b/mysql-test/suite/innodb/t/disabled.def
index 7ab00a90758..cae02f606d6 100644
--- a/mysql-test/suite/innodb/t/disabled.def
+++ b/mysql-test/suite/innodb/t/disabled.def
@@ -9,6 +9,6 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-innodb : Bug#53306 2010-04-30 VasilDimov valgrind warnings
-innodb_bug52663 : Waiting for merge with XtraDB
-innodb_bug51920 : Waiting for merge with XtraDB
+
+#innodb : Bug#53306 2010-04-30 VasilDimov valgrind warnings
+innodb_bug48024 : Waiting for merge with Percona Server; bug fixed in innodb_plugin in MySQL 5.1.48
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-44030.test b/mysql-test/suite/innodb/t/innodb-autoinc-44030.test
index 2524ceb4009..bfde243c495 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc-44030.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc-44030.test
@@ -27,7 +27,7 @@ SELECT * FROM t1;
# longer results in the two data dictionaries being out of sync. If they
# revert their changes then this check for ER_AUTOINC_READ_FAILED will need
# to be enabled. Also, see http://bugs.mysql.com/bug.php?id=47621.
--- error ER_AUTOINC_READ_FAILED,1467
+# -- error ER_AUTOINC_READ_FAILED,1467
INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
diff --git a/mysql-test/t/innodb-autoinc-optimize.test b/mysql-test/suite/innodb/t/innodb-autoinc-optimize.test
index 0f0cb57f92f..0f0cb57f92f 100644
--- a/mysql-test/t/innodb-autoinc-optimize.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc-optimize.test
diff --git a/mysql-test/t/innodb-ucs2.test b/mysql-test/suite/innodb/t/innodb-ucs2.test
index 7b91ef37d3f..7b91ef37d3f 100644
--- a/mysql-test/t/innodb-ucs2.test
+++ b/mysql-test/suite/innodb/t/innodb-ucs2.test
diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test
new file mode 100644
index 00000000000..743f47e1ccc
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb.test
@@ -0,0 +1,1392 @@
+#######################################################################
+# #
+# Please, DO NOT TOUCH this file as well as the innodb.result file. #
+# These files are to be modified ONLY BY INNOBASE guys. #
+# #
+# Use innodb_mysql.[test|result] files instead. #
+# #
+# If nevertheless you need to make some changes here, please, forward #
+# your commit message #
+# To: innodb_dev_ww@oracle.com #
+# Cc: dev-innodb@mysql.com #
+# (otherwise your changes may be erased). #
+# #
+#######################################################################
+
+-- source include/have_innodb.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+# Save the original values of some variables in order to be able to
+# estimate how much they have changed during the tests. Previously this
+# test assumed that e.g. rows_deleted is 0 here and after deleting 23
+# rows it expected that rows_deleted will be 23. Now we do not make
+# assumptions about the values of the variables at the beginning, e.g.
+# rows_deleted should be 23 + "rows_deleted before the test". This allows
+# the test to be run multiple times without restarting the mysqld server.
+# See Bug#43309 Test main.innodb can't be run twice
+-- disable_query_log
+SET @innodb_thread_concurrency_orig = @@innodb_thread_concurrency;
+
+SET @innodb_rows_deleted_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted');
+SET @innodb_rows_inserted_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted');
+SET @innodb_rows_updated_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated');
+SET @innodb_row_lock_waits_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits');
+SET @innodb_row_lock_current_waits_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits');
+SET @innodb_row_lock_time_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time');
+SET @innodb_row_lock_time_max_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max');
+SET @innodb_row_lock_time_avg_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg');
+-- enable_query_log
+
+--disable_warnings
+drop table if exists t1,t2,t3,t4;
+drop database if exists mysqltest;
+--enable_warnings
+
+#
+# Small basic test with ignore
+#
+
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
+
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+
+update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
+select id, code, name from t1 order by id;
+update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
+select id, code, name from t1 order by id;
+
+drop table t1;
+
+#
+# A bit bigger test
+# The 'replace_column' statements are needed because the cardinality calculated
+# by innodb is not always the same between runs
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ parent_id int(11) DEFAULT '0' NOT NULL,
+ level tinyint(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id),
+ KEY parent_id (parent_id),
+ KEY level (level)
+) engine=innodb;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+update t1 set id=id+1000;
+-- error ER_DUP_ENTRY,1022
+update t1 set id=1024 where id=1009;
+select * from t1;
+update ignore t1 set id=id+1; # This will change all rows
+select * from t1;
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+--replace_column 9 #
+explain select level from t1 where level=1;
+--replace_column 9 #
+explain select level,id from t1 where level=1;
+--replace_column 9 #
+explain select level,id,parent_id from t1 where level=1;
+select level,id from t1 where level=1;
+select level,id,parent_id from t1 where level=1;
+optimize table t1;
+--replace_column 7 #
+show keys from t1;
+drop table t1;
+
+#
+# Test replace
+#
+
+CREATE TABLE t1 (
+ gesuchnr int(11) DEFAULT '0' NOT NULL,
+ benutzer_id int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (gesuchnr,benutzer_id)
+) engine=innodb;
+
+replace into t1 (gesuchnr,benutzer_id) values (2,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+select * from t1;
+drop table t1;
+
+#
+# test delete using hidden_primary_key
+#
+
+create table t1 (a int) engine=innodb;
+insert into t1 values (1), (2);
+optimize table t1;
+delete from t1 where a = 1;
+select * from t1;
+check table t1;
+drop table t1;
+
+create table t1 (a int,b varchar(20)) engine=innodb;
+insert into t1 values (1,""), (2,"testing");
+delete from t1 where a = 1;
+select * from t1;
+create index skr on t1 (a);
+insert into t1 values (3,""), (4,"testing");
+analyze table t1;
+--replace_column 7 #
+show keys from t1;
+drop table t1;
+
+
+# Test of reading on secondary key with may be null
+
+create table t1 (a int,b varchar(20),key(a)) engine=innodb;
+insert into t1 values (1,""), (2,"testing");
+select * from t1 where a = 1;
+drop table t1;
+
+#
+# Test rollback
+#
+
+create table t1 (n int not null primary key) engine=innodb;
+set autocommit=0;
+insert into t1 values (4);
+rollback;
+select n, "after rollback" from t1;
+insert into t1 values (4);
+commit;
+select n, "after commit" from t1;
+commit;
+insert into t1 values (5);
+-- error ER_DUP_ENTRY
+insert into t1 values (4);
+commit;
+select n, "after commit" from t1;
+set autocommit=1;
+insert into t1 values (6);
+-- error ER_DUP_ENTRY
+insert into t1 values (4);
+select n from t1;
+set autocommit=0;
+#
+# savepoints
+#
+begin;
+savepoint `my_savepoint`;
+insert into t1 values (7);
+savepoint `savept2`;
+insert into t1 values (3);
+select n from t1;
+savepoint savept3;
+rollback to savepoint savept2;
+--error 1305
+rollback to savepoint savept3;
+rollback to savepoint savept2;
+release savepoint `my_savepoint`;
+select n from t1;
+-- error 1305
+rollback to savepoint `my_savepoint`;
+--error 1305
+rollback to savepoint savept2;
+insert into t1 values (8);
+savepoint sv;
+commit;
+savepoint sv;
+set autocommit=1;
+# nop
+rollback;
+drop table t1;
+
+#
+# Test for commit and FLUSH TABLES WITH READ LOCK
+#
+
+create table t1 (n int not null primary key) engine=innodb;
+start transaction;
+insert into t1 values (4);
+flush tables with read lock;
+#
+# Current code can't handle a read lock in middle of transaction
+#--error 1223;
+commit;
+unlock tables;
+commit;
+select * from t1;
+drop table t1;
+
+#
+# Testing transactions
+#
+
+create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb;
+begin;
+insert into t1 values(1,'hamdouni');
+select id as afterbegin_id,nom as afterbegin_nom from t1;
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+set autocommit=0;
+insert into t1 values(2,'mysql');
+select id as afterautocommit0_id,nom as afterautocommit0_nom from t1;
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+set autocommit=1;
+drop table t1;
+
+#
+# Simple not autocommit test
+#
+
+CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb;
+insert into t1 values ('pippo', 12);
+-- error ER_DUP_ENTRY
+insert into t1 values ('pippo', 12); # Gives error
+delete from t1;
+delete from t1 where id = 'pippo';
+select * from t1;
+
+insert into t1 values ('pippo', 12);
+set autocommit=0;
+delete from t1;
+rollback;
+select * from t1;
+delete from t1;
+commit;
+select * from t1;
+drop table t1;
+
+#
+# Test of active transactions
+#
+
+create table t1 (a integer) engine=innodb;
+start transaction;
+rename table t1 to t2;
+create table t1 (b integer) engine=innodb;
+insert into t1 values (1);
+rollback;
+drop table t1;
+rename table t2 to t1;
+drop table t1;
+set autocommit=1;
+
+#
+# The following simple tests failed at some point
+#
+
+CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 'Jochen');
+select * from t1;
+drop table t1;
+
+CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb;
+set autocommit=0;
+INSERT INTO t1 SET _userid='marc@anyware.co.uk';
+COMMIT;
+SELECT * FROM t1;
+SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
+drop table t1;
+set autocommit=1;
+
+#
+# Test when reading on part of unique key
+#
+CREATE TABLE t1 (
+ user_id int(10) DEFAULT '0' NOT NULL,
+ name varchar(100),
+ phone varchar(100),
+ ref_email varchar(100) DEFAULT '' NOT NULL,
+ detail varchar(200),
+ PRIMARY KEY (user_id,ref_email)
+)engine=innodb;
+
+INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
+select * from t1 where user_id=10292;
+INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
+select * from t1 where user_id=10292;
+select * from t1 where user_id>=10292;
+select * from t1 where user_id>10292;
+select * from t1 where user_id<10292;
+drop table t1;
+
+#
+# Test that keys are created in right order
+#
+
+CREATE TABLE t1 (a int not null, b int not null,c int not null,
+key(a),primary key(a,b), unique(c),key(a),unique(b));
+--replace_column 7 #
+show index from t1;
+drop table t1;
+
+#
+# Test of ALTER TABLE and innodb tables
+#
+
+create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
+alter table t1 engine=innodb;
+insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
+select * from t1;
+update t1 set col2='7' where col1='4';
+select * from t1;
+alter table t1 add co3 int not null;
+select * from t1;
+update t1 set col2='9' where col1='2';
+select * from t1;
+drop table t1;
+
+#
+# INSERT INTO innodb tables
+#
+
+create table t1 (a int not null , b int, primary key (a)) engine = innodb;
+create table t2 (a int not null , b int, primary key (a)) engine = myisam;
+insert into t1 VALUES (1,3) , (2,3), (3,3);
+select * from t1;
+insert into t2 select * from t1;
+select * from t2;
+delete from t1 where b = 3;
+select * from t1;
+insert into t1 select * from t2;
+select * from t1;
+select * from t2;
+drop table t1,t2;
+
+#
+# ORDER BY on not primary key
+#
+
+CREATE TABLE t1 (
+ user_name varchar(12),
+ password text,
+ subscribed char(1),
+ user_id int(11) DEFAULT '0' NOT NULL,
+ quota bigint(20),
+ weight double,
+ access_date date,
+ access_time time,
+ approved datetime,
+ dummy_primary_key int(11) NOT NULL auto_increment,
+ PRIMARY KEY (dummy_primary_key)
+) ENGINE=innodb;
+INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
+INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
+INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
+INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4);
+INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5);
+select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name;
+drop table t1;
+
+#
+# Testing of tables without primary keys
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ parent_id int(11) DEFAULT '0' NOT NULL,
+ level tinyint(4) DEFAULT '0' NOT NULL,
+ KEY (id),
+ KEY parent_id (parent_id),
+ KEY level (level)
+) engine=innodb;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
+INSERT INTO t1 values (179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+update t1 set id=id+1000;
+update t1 set id=1024 where id=1009;
+select * from t1;
+update ignore t1 set id=id+1; # This will change all rows
+select * from t1;
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+--replace_column 9 #
+explain select level from t1 where level=1;
+select level,id from t1 where level=1;
+select level,id,parent_id from t1 where level=1;
+select level,id from t1 where level=1 order by id;
+delete from t1 where level=1;
+select * from t1;
+drop table t1;
+
+#
+# Test of index only reads
+#
+CREATE TABLE t1 (
+ sca_code char(6) NOT NULL,
+ cat_code char(6) NOT NULL,
+ sca_desc varchar(50),
+ lan_code char(2) NOT NULL,
+ sca_pic varchar(100),
+ sca_sdesc varchar(50),
+ sca_sch_desc varchar(16),
+ PRIMARY KEY (sca_code, cat_code, lan_code),
+ INDEX sca_pic (sca_pic)
+) engine = innodb ;
+
+INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
+select count(*) from t1 where sca_code = 'PD';
+select count(*) from t1 where sca_code <= 'PD';
+select count(*) from t1 where sca_pic is null;
+alter table t1 drop index sca_pic;
+alter table t1 add index sca_pic (cat_code, sca_pic);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+select count(*) from t1 where cat_code='E';
+
+alter table t1 drop index sca_pic;
+alter table t1 add index (sca_pic, cat_code);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+select count(*) from t1 where sca_pic >= 'n';
+select sca_pic from t1 where sca_pic is null;
+update t1 set sca_pic="test" where sca_pic is null;
+delete from t1 where sca_code='pd';
+drop table t1;
+
+#
+# Test of opening table twice and timestamps
+#
+set @a:=now();
+CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
+insert into t1 (a) values(1),(2),(3);
+select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
+select a from t1 natural join t1 as t2 where b >= @a order by a;
+update t1 set a=5 where a=1;
+select a from t1;
+drop table t1;
+
+#
+# Test with variable length primary key
+#
+create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb;
+insert into t1 values("hello",1),("world",2);
+select * from t1 order by b desc;
+optimize table t1;
+--replace_column 7 #
+show keys from t1;
+drop table t1;
+
+#
+# Test of create index with NULL columns
+#
+create table t1 (i int, j int ) ENGINE=innodb;
+insert into t1 values (1,2);
+select * from t1 where i=1 and j=2;
+create index ax1 on t1 (i,j);
+select * from t1 where i=1 and j=2;
+drop table t1;
+
+#
+# Test min-max optimization
+#
+
+CREATE TABLE t1 (
+ a int3 unsigned NOT NULL,
+ b int1 unsigned NOT NULL,
+ UNIQUE (a, b)
+) ENGINE = innodb;
+
+INSERT INTO t1 VALUES (1, 1);
+SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
+drop table t1;
+
+#
+# Test INSERT DELAYED
+#
+
+CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb;
+# Can't test this in 3.23
+# INSERT DELAYED INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+#
+# Crash when using many tables (Test case by Jeremy D Zawodny)
+#
+
+create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb;
+insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
+--replace_column 9 #
+explain select * from t1 where a > 0 and a < 50;
+drop table t1;
+
+#
+# Test lock tables
+#
+
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+--error ER_DUP_ENTRY
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+select id from t1;
+select id from t1;
+UNLOCK TABLES;
+DROP TABLE t1;
+
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+begin;
+--error ER_DUP_ENTRY
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+select id from t1;
+insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
+commit;
+select id,id3 from t1;
+UNLOCK TABLES;
+DROP TABLE t1;
+
+#
+# Test prefix key
+#
+create table t1 (a char(20), unique (a(5))) engine=innodb;
+drop table t1;
+create table t1 (a char(20), index (a(5))) engine=innodb;
+show create table t1;
+drop table t1;
+
+#
+# Test using temporary table and auto_increment
+#
+
+create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb;
+insert into t1 values (NULL),(NULL),(NULL);
+delete from t1 where a=3;
+insert into t1 values (NULL);
+select * from t1;
+alter table t1 add b int;
+select * from t1;
+drop table t1;
+
+#Slashdot bug
+create table t1
+ (
+ id int auto_increment primary key,
+ name varchar(32) not null,
+ value text not null,
+ uid int not null,
+ unique key(name,uid)
+ ) engine=innodb;
+insert into t1 values (1,'one','one value',101),
+ (2,'two','two value',102),(3,'three','three value',103);
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+delete from t1 where uid=102;
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+set insert_id=6;
+replace into t1 (value,name,uid) values ('other value','two',102);
+select * from t1;
+drop table t1;
+
+#
+# Test DROP DATABASE
+#
+
+create database mysqltest;
+create table mysqltest.t1 (a int not null) engine= innodb;
+insert into mysqltest.t1 values(1);
+create table mysqltest.t2 (a int not null) engine= myisam;
+insert into mysqltest.t2 values(1);
+create table mysqltest.t3 (a int not null) engine= heap;
+insert into mysqltest.t3 values(1);
+commit;
+drop database mysqltest;
+# Don't check error message
+--error 1049
+show tables from mysqltest;
+
+#
+# Test truncate table with and without auto_commit
+#
+
+set autocommit=0;
+create table t1 (a int not null) engine= innodb;
+insert into t1 values(1),(2);
+truncate table t1;
+commit;
+truncate table t1;
+truncate table t1;
+select * from t1;
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+commit;
+drop table t1;
+set autocommit=1;
+
+create table t1 (a int not null) engine= innodb;
+insert into t1 values(1),(2);
+truncate table t1;
+insert into t1 values(1),(2);
+select * from t1;
+truncate table t1;
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+drop table t1;
+
+#
+# Test of how ORDER BY works when doing it on the whole table
+#
+
+create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb;
+insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
+--replace_column 9 #
+explain select * from t1 order by a;
+--replace_column 9 #
+explain select * from t1 order by b;
+--replace_column 9 #
+explain select * from t1 order by c;
+--replace_column 9 #
+explain select a from t1 order by a;
+--replace_column 9 #
+explain select b from t1 order by b;
+--replace_column 9 #
+explain select a,b from t1 order by b;
+--replace_column 9 #
+explain select a,b from t1;
+--replace_column 9 #
+explain select a,b,c from t1;
+drop table t1;
+
+#
+# Check describe
+#
+
+create table t1 (t int not null default 1, key (t)) engine=innodb;
+desc t1;
+drop table t1;
+
+#
+# Test of multi-table-delete
+#
+
+CREATE TABLE t1 (
+ number bigint(20) NOT NULL default '0',
+ cname char(15) NOT NULL default '',
+ carrier_id smallint(6) NOT NULL default '0',
+ privacy tinyint(4) NOT NULL default '0',
+ last_mod_date timestamp NOT NULL,
+ last_mod_id smallint(6) NOT NULL default '0',
+ last_app_date timestamp NOT NULL,
+ last_app_id smallint(6) default '-1',
+ version smallint(6) NOT NULL default '0',
+ assigned_scps int(11) default '0',
+ status tinyint(4) default '0'
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1);
+INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0);
+INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1);
+INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0);
+INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0);
+INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0);
+CREATE TABLE t2 (
+ number bigint(20) NOT NULL default '0',
+ cname char(15) NOT NULL default '',
+ carrier_id smallint(6) NOT NULL default '0',
+ privacy tinyint(4) NOT NULL default '0',
+ last_mod_date timestamp NOT NULL,
+ last_mod_id smallint(6) NOT NULL default '0',
+ last_app_date timestamp NOT NULL,
+ last_app_id smallint(6) default '-1',
+ version smallint(6) NOT NULL default '0',
+ assigned_scps int(11) default '0',
+ status tinyint(4) default '0'
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1);
+INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0);
+INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1);
+INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0);
+select * from t1;
+select * from t2;
+delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null);
+select * from t1;
+select * from t2;
+select * from t2;
+drop table t1,t2;
+
+#
+# A simple test with some isolation levels
+# TODO: Make this into a test using replication to really test how
+# this works.
+#
+
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+SELECT @@tx_isolation,@@global.tx_isolation;
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
+select id, code, name from t1 order by id;
+COMMIT;
+
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
+select id, code, name from t1 order by id;
+COMMIT;
+
+SET binlog_format='MIXED';
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+COMMIT;
+DROP TABLE t1;
+
+#
+# Test of multi-table-update
+#
+create table t1 (n int(10), d int(10)) engine=innodb;
+create table t2 (n int(10), d int(10)) engine=innodb;
+insert into t1 values(1,1),(1,2);
+insert into t2 values(1,10),(2,20);
+UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
+select * from t1;
+select * from t2;
+drop table t1,t2;
+
+#
+# Bug #29136 erred multi-delete on trans table does not rollback
+#
+
+# prepare
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+CREATE TABLE t1 (a int, PRIMARY KEY (a));
+CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
+create trigger trg_del_t2 after delete on t2 for each row
+ insert into t1 values (1);
+insert into t1 values (1);
+insert into t2 values (1),(2);
+
+
+# exec cases A, B - see multi_update.test
+
+# A. send_error() w/o send_eof() branch
+
+--error ER_DUP_ENTRY
+delete t2 from t2;
+
+# check
+
+select count(*) from t2 /* must be 2 as restored after rollback caused by the error */;
+
+# cleanup bug#29136
+
+drop table t1, t2;
+
+
+#
+# Bug #29136 erred multi-delete on trans table does not rollback
+#
+
+# prepare
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+CREATE TABLE t1 (a int, PRIMARY KEY (a));
+CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
+create trigger trg_del_t2 after delete on t2 for each row
+ insert into t1 values (1);
+insert into t1 values (1);
+insert into t2 values (1),(2);
+
+
+# exec cases A, B - see multi_update.test
+
+# A. send_error() w/o send_eof() branch
+
+--error ER_DUP_ENTRY
+delete t2 from t2;
+
+# check
+
+select count(*) from t2 /* must be 2 as restored after rollback caused by the error */;
+
+# cleanup bug#29136
+
+drop table t1, t2;
+
+
+#
+# Testing of IFNULL
+#
+create table t1 (a int, b int) engine=innodb;
+insert into t1 values(20,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a;
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+insert into t1 values(10,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+drop table t1;
+
+#
+# Test of read_through not existing const_table
+#
+
+create table t1 (a varchar(10) not null) engine=myisam;
+create table t2 (b varchar(10) not null unique) engine=innodb;
+select t1.a from t1,t2 where t1.a=t2.b;
+drop table t1,t2;
+create table t1 (a int not null, b int, primary key (a)) engine = innodb;
+create table t2 (a int not null, b int, primary key (a)) engine = innodb;
+insert into t1 values (10, 20);
+insert into t2 values (10, 20);
+update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
+drop table t1,t2;
+
+#
+# Test of multi-table-delete with foreign key constraints
+#
+
+CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB;
+insert into t1 set id=1;
+insert into t2 set id=1, t1_id=1;
+delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
+select * from t1;
+select * from t2;
+drop table t2,t1;
+CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES(1, 1);
+SELECT * from t1;
+UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1;
+SELECT * from t1;
+UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id;
+SELECT * from t1;
+DROP TABLE t1,t2;
+
+#
+# Test of range_optimizer
+#
+
+set autocommit=0;
+
+CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+
+CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+
+CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB;
+
+INSERT INTO t3 VALUES("my-test-1", "my-test-2");
+COMMIT;
+
+INSERT INTO t1 VALUES("this-key", "will disappear");
+INSERT INTO t2 VALUES("this-key", "will also disappear");
+DELETE FROM t3 WHERE id1="my-test-1";
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+ROLLBACK;
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE;
+COMMIT;
+set autocommit=1;
+DROP TABLE t1,t2,t3;
+
+#
+# Check update with conflicting key
+#
+
+CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+# We need the a < 1000 test here to quard against the halloween problems
+UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
+SELECT * from t1;
+drop table t1;
+
+CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=0;
+INSERT INTO t1 ( B_ID ) VALUES ( 1 );
+INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
+ROLLBACK;
+SELECT * FROM t1;
+drop table t1,t2;
+create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb;
+insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
+select distinct parent,child from t1 order by parent;
+drop table t1;
+
+#
+# Test that MySQL priorities clustered indexes
+#
+create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb;
+create table t2 (a int not null auto_increment primary key, b int);
+insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
+insert into t2 (a) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+select count(*) from t1;
+--replace_column 9 #
+explain select * from t1 where c between 1 and 2500;
+update t1 set c=a;
+--replace_column 9 #
+explain select * from t1 where c between 1 and 2500;
+drop table t1,t2;
+
+#
+# Test of UPDATE ... ORDER BY
+#
+
+create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
+
+insert into t1 (id) values (null),(null),(null),(null),(null);
+update t1 set fk=69 where fk is null order by id limit 1;
+SELECT * from t1;
+drop table t1;
+
+create table t1 (a int not null, b int not null, key (a));
+insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
+SET @tmp=0;
+update t1 set b=(@tmp:=@tmp+1) order by a;
+update t1 set b=99 where a=1 order by b asc limit 1;
+update t1 set b=100 where a=1 order by b desc limit 2;
+update t1 set a=a+10+b where a=1 order by b;
+select * from t1 order by a,b;
+drop table t1;
+
+#
+# Test of multi-table-updates (bug #1980).
+#
+
+create table t1 ( c char(8) not null ) engine=innodb;
+insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
+insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
+
+alter table t1 add b char(8) not null;
+alter table t1 add a char(8) not null;
+alter table t1 add primary key (a,b,c);
+update t1 set a=c, b=c;
+
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
+insert into t2 select * from t1;
+
+delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
+drop table t1,t2;
+
+#
+# test autoincrement with TRUNCATE
+#
+
+SET AUTOCOMMIT=1;
+create table t1 (a integer auto_increment primary key) engine=innodb;
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+drop table t1;
+
+#
+# Test dictionary handling with spaceand quoting
+#
+
+CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB;
+#show create table t2;
+drop table t2,t1;
+
+#
+# Test of multi updated and foreign keys
+#
+
+create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb;
+insert into `t1`values ( 1 ) ;
+create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb;
+insert into `t2`values ( 1 ) ;
+create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
+insert into `t3`values ( 1 ) ;
+--error 1451
+delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+--error 1451
+update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+--error 1054
+update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+drop table t3,t2,t1;
+
+#
+# test for recursion depth limit
+#
+create table t1(
+ id int primary key,
+ pid int,
+ index(pid),
+ foreign key(pid) references t1(id) on delete cascade) engine=innodb;
+insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
+ (8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
+-- error 1451
+delete from t1 where id=0;
+delete from t1 where id=15;
+delete from t1 where id=0;
+
+drop table t1;
+
+#
+# Test timestamps
+#
+
+CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
+CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
+(stamp))ENGINE=InnoDB;
+insert into t1 values (1),(2),(3);
+# Note that timestamp 3 is wrong
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
+SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
+'20020204120000' GROUP BY col1;
+drop table t1,t2;
+
+#
+# Test by Francois MASUREL
+#
+
+CREATE TABLE t1 (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `id_object` int(10) unsigned default '0',
+ `id_version` int(10) unsigned NOT NULL default '1',
+ `label` varchar(100) NOT NULL default '',
+ `description` text,
+ PRIMARY KEY (`id`),
+ KEY `id_object` (`id_object`),
+ KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
+
+CREATE TABLE t2 (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `id_version` int(10) unsigned NOT NULL default '1',
+ PRIMARY KEY (`id`),
+ KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+
+INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
+
+SELECT t2.id, t1.`label` FROM t2 INNER JOIN
+(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl
+ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
+drop table t1,t2;
+
+create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam;
+create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb;
+create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+insert t3 select * from t1;
+checksum table t1, t2, t3, t4 quick;
+checksum table t1, t2, t3, t4;
+checksum table t1, t2, t3, t4 extended;
+#show table status;
+drop table t1,t2,t3;
+
+#
+# Test problem with refering to different fields in same table in UNION
+# (Bug #2552)
+#
+create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1;
+drop table t1;
+
+#
+# Bug2160
+#
+create table t1 (a int) engine=innodb;
+create table t2 like t1;
+drop table t1,t2;
+
+#
+# Test of automaticly created foreign keys
+#
+
+create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
+create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
+show create table t1;
+show create table t2;
+create index id on t2 (id);
+show create table t2;
+create index id2 on t2 (id);
+show create table t2;
+drop index id2 on t2;
+--error ER_DROP_INDEX_FK
+drop index id on t2;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;
+show create table t2;
+create unique index id on t2 (id,id2);
+show create table t2;
+drop table t2;
+
+# Check foreign key columns created in different order than key columns
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
+show create table t2;
+alter table t2 add index id_test (id), add index id_test2 (id,id2);
+show create table t2;
+drop table t2;
+
+# Test error handling
+
+# Embedded server doesn't chdir to data directory
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
+--error ER_WRONG_FK_DEF
+create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
+
+# bug#3749
+
+create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+drop table t2;
+create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+drop table t2, t1;
+
+
+#
+# Bug #6126: Duplicate columns in keys gives misleading error message
+#
+--error 1060
+create table t1 (c char(10), index (c,c)) engine=innodb;
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
+create table t1 (c1 char(10), c2 char(10)) engine=innodb;
+--error 1060
+alter table t1 add key (c1,c1);
+--error 1060
+alter table t1 add key (c2,c1,c1);
+--error 1060
+alter table t1 add key (c1,c2,c1);
+--error 1060
+alter table t1 add key (c1,c1,c2);
+drop table t1;
+
+#
+# Bug #4082: integer truncation
+#
+
+create table t1(a int(1) , b int(1)) engine=innodb;
+insert into t1 values ('1111', '3333');
+select distinct concat(a, b) from t1;
+drop table t1;
+
+#
+# BUG#7709 test case - Boolean fulltext query against unsupported
+# engines does not fail
+#
+
+CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
+--error 1214
+SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+#
+# check null values #1
+#
+
+--disable_warnings
+CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
+ CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+--enable_warnings
+INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
+SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
+DROP TABLE t2;
+DROP TABLE t1;
+
+#
+# Bug#11816 - Truncate table doesn't work with temporary innodb tables
+# This is not an innodb bug, but we test it using innodb.
+#
+create temporary table t1 (a int) engine=innodb;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+drop table t1;
+# Show that it works with permanent tables too.
+create table t1 (a int) engine=innodb;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+drop table t1;
+
+#
+# Bug #13025 Server crash during filesort
+#
+
+create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb;
+insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
+select * from t1 order by a,b,c,d;
+explain select * from t1 order by a,b,c,d;
+drop table t1;
+
+#
+# BUG#11039,#13218 Wrong key length in min()
+#
+
+create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
+insert into t1 values ('8', '6'), ('4', '7');
+select min(a) from t1;
+select min(b) from t1 where a='8';
+drop table t1;
+
+# End of 4.1 tests
+
+#
+# range optimizer problem
+#
+
+create table t1 (x bigint unsigned not null primary key) engine=innodb;
+insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
+select * from t1;
+select count(*) from t1 where x>0;
+select count(*) from t1 where x=0;
+select count(*) from t1 where x<0;
+select count(*) from t1 where x < -16;
+select count(*) from t1 where x = -16;
+explain select count(*) from t1 where x > -16;
+select count(*) from t1 where x > -16;
+select * from t1 where x > -16;
+select count(*) from t1 where x = 18446744073709551601;
+drop table t1;
+
+
+# Test for testable InnoDB status variables. This test
+# uses previous ones(pages_created, rows_deleted, ...).
+--replace_result 8192 8191
+SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
+SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
+SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
+SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
+SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
+
+# Test for row locks InnoDB status variables.
+SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
+SELECT variable_value - @innodb_row_lock_current_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits';
+SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time';
+SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max';
+SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
+
+# Test for innodb_sync_spin_loops variable
+SET @innodb_sync_spin_loops_orig = @@innodb_sync_spin_loops;
+show variables like "innodb_sync_spin_loops";
+set global innodb_sync_spin_loops=1000;
+show variables like "innodb_sync_spin_loops";
+set global innodb_sync_spin_loops=0;
+show variables like "innodb_sync_spin_loops";
+set global innodb_sync_spin_loops=20;
+show variables like "innodb_sync_spin_loops";
+set global innodb_sync_spin_loops=@innodb_sync_spin_loops_orig;
+
+# Test for innodb_thread_concurrency variable
+SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;
+show variables like "innodb_thread_concurrency";
+set global innodb_thread_concurrency=1001;
+show variables like "innodb_thread_concurrency";
+set global innodb_thread_concurrency=0;
+show variables like "innodb_thread_concurrency";
+set global innodb_thread_concurrency=16;
+show variables like "innodb_thread_concurrency";
+SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency;
+
+# Test for innodb_concurrency_tickets variable
+show variables like "innodb_concurrency_tickets";
+set global innodb_concurrency_tickets=1000;
+show variables like "innodb_concurrency_tickets";
+set global innodb_concurrency_tickets=0;
+show variables like "innodb_concurrency_tickets";
+set global innodb_concurrency_tickets=500;
+show variables like "innodb_concurrency_tickets";
+
+# Test for innodb_thread_sleep_delay variable
+show variables like "innodb_thread_sleep_delay";
+set global innodb_thread_sleep_delay=100000;
+show variables like "innodb_thread_sleep_delay";
+set global innodb_thread_sleep_delay=0;
+show variables like "innodb_thread_sleep_delay";
+set global innodb_thread_sleep_delay=10000;
+show variables like "innodb_thread_sleep_delay";
+
+#
+# Test varchar
+#
+
+let $default=`select @@storage_engine`;
+set storage_engine=INNODB;
+source include/varchar.inc;
+
+#
+# Some errors/warnings on create
+#
+
+# Embedded server doesn't chdir to data directory
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
+create table t1 (v varchar(65530), key(v));
+drop table t1;
+create table t1 (v varchar(65536));
+show create table t1;
+drop table t1;
+create table t1 (v varchar(65530) character set utf8);
+show create table t1;
+drop table t1;
+
+eval set storage_engine=$default;
+
+-- disable_query_log
+SET GLOBAL innodb_thread_concurrency = @innodb_thread_concurrency_orig;
+
+#######################################################################
+# #
+# Please, DO NOT TOUCH this file as well as the innodb.result file. #
+# These files are to be modified ONLY BY INNOBASE guys. #
+# #
+# Use innodb_mysql.[test|result] files instead. #
+# #
+# If nevertheless you need to make some changes here, please, forward #
+# your commit message #
+# To: innodb_dev_ww@oracle.com #
+# Cc: dev-innodb@mysql.com #
+# (otherwise your changes may be erased). #
+# #
+#######################################################################
diff --git a/mysql-test/t/innodb_autoinc_lock_mode_zero-master.opt b/mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero-master.opt
index fad0da2ac2e..fad0da2ac2e 100644
--- a/mysql-test/t/innodb_autoinc_lock_mode_zero-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero-master.opt
diff --git a/mysql-test/t/innodb_autoinc_lock_mode_zero.test b/mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero.test
index 96f748673c0..96f748673c0 100644
--- a/mysql-test/t/innodb_autoinc_lock_mode_zero.test
+++ b/mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero.test
diff --git a/mysql-test/t/innodb_bug30919-master.opt b/mysql-test/suite/innodb/t/innodb_bug30919-master.opt
index 8636d2d8734..8636d2d8734 100644
--- a/mysql-test/t/innodb_bug30919-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_bug30919-master.opt
diff --git a/mysql-test/t/innodb_bug30919.test b/mysql-test/suite/innodb/t/innodb_bug30919.test
index 56b2c7bc03d..56b2c7bc03d 100644
--- a/mysql-test/t/innodb_bug30919.test
+++ b/mysql-test/suite/innodb/t/innodb_bug30919.test
diff --git a/mysql-test/t/innodb_bug42419.test b/mysql-test/suite/innodb/t/innodb_bug42419.test
index 93c4764252a..93c4764252a 100644
--- a/mysql-test/t/innodb_bug42419.test
+++ b/mysql-test/suite/innodb/t/innodb_bug42419.test
diff --git a/mysql-test/suite/innodb/t/innodb_bug48024.test b/mysql-test/suite/innodb/t/innodb_bug48024.test
new file mode 100644
index 00000000000..db828aa1cda
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug48024.test
@@ -0,0 +1,22 @@
+# Bug #48024 Innodb doesn't work with multi-statements
+
+--source include/have_innodb.inc
+
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+# Bug #53644 InnoDB thinks that /*/ starts and ends a comment
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b);
+
+DROP TABLE bug48024,bug48024_b;
+
+# Work around Bug #53750 (failure in mysql-test-run --ps-protocol)
+-- disable_ps_protocol
+delimiter |;
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)|
+delimiter ;|
+
+DROP TABLE bug48024,bug48024_b;
diff --git a/mysql-test/suite/innodb/t/innodb_bug49164.test b/mysql-test/suite/innodb/t/innodb_bug49164.test
new file mode 100644
index 00000000000..7f1c9f4ca9c
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug49164.test
@@ -0,0 +1,47 @@
+-- source include/have_innodb.inc
+
+# Bug #49164 READ-COMMITTED reports "matched: 0" on compound PK
+# a duplicate of
+# Bug #52663 Lost update incrementing column value under READ COMMITTED
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+SET tx_isolation = 'READ-COMMITTED';
+
+CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
+ENGINE=InnoDB;
+
+insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
+
+begin;
+update bug49164 set c=7;
+select * from bug49164;
+rollback;
+select * from bug49164;
+begin;
+update bug49164 set c=7;
+
+connection con2;
+
+SET tx_isolation = 'READ-COMMITTED';
+begin;
+select * from bug49164;
+commit;
+begin;
+--send
+update bug49164 set c=6 where a=1 and b=1;
+
+connection con1;
+rollback;
+select * from bug49164;
+connection con2;
+reap;
+commit;
+connection con1;
+select * from bug49164;
+connection default;
+disconnect con1;
+disconnect con2;
+drop table bug49164;
diff --git a/mysql-test/suite/innodb/t/innodb_bug53674-master.opt b/mysql-test/suite/innodb/t/innodb_bug53674-master.opt
new file mode 100644
index 00000000000..f1cfd7ab6c7
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug53674-master.opt
@@ -0,0 +1 @@
+--log-bin --innodb-locks-unsafe-for-binlog --binlog-format=mixed
diff --git a/mysql-test/suite/innodb/t/innodb_bug53674.test b/mysql-test/suite/innodb/t/innodb_bug53674.test
new file mode 100644
index 00000000000..47f67f109c3
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug53674.test
@@ -0,0 +1,8 @@
+-- source include/have_innodb.inc
+
+create table bug53674(a int)engine=innodb;
+insert into bug53674 values (1),(2);
+start transaction;
+select * from bug53674 for update;
+select * from bug53674 where a=(select a from bug53674 where a > 1);
+drop table bug53674;
diff --git a/mysql-test/suite/innodb/t/innodb_bug54044.test b/mysql-test/suite/innodb/t/innodb_bug54044.test
new file mode 100644
index 00000000000..a6722ed6399
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug54044.test
@@ -0,0 +1,11 @@
+# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type
+# during create table, so it will not trigger assertion failure.
+
+--source include/have_innodb.inc
+
+# This 'create table' operation should fail because of
+# using NULL datatype
+--error ER_CANT_CREATE_TABLE
+CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
+ AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
+
diff --git a/mysql-test/t/innodb_gis.test b/mysql-test/suite/innodb/t/innodb_gis.test
index 1adb14ea482..1adb14ea482 100644
--- a/mysql-test/t/innodb_gis.test
+++ b/mysql-test/suite/innodb/t/innodb_gis.test
diff --git a/mysql-test/t/innodb_lock_wait_timeout_1-master.opt b/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1-master.opt
index 462f8fbe828..462f8fbe828 100644
--- a/mysql-test/t/innodb_lock_wait_timeout_1-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1-master.opt
diff --git a/mysql-test/t/innodb_lock_wait_timeout_1.test b/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1.test
index fcbf2b1cfc7..fcbf2b1cfc7 100644
--- a/mysql-test/t/innodb_lock_wait_timeout_1.test
+++ b/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1.test
diff --git a/mysql-test/suite/innodb/t/innodb_misc1.test b/mysql-test/suite/innodb/t/innodb_misc1.test
index 30f9c129570..1bebd5411bc 100644
--- a/mysql-test/suite/innodb/t/innodb_misc1.test
+++ b/mysql-test/suite/innodb/t/innodb_misc1.test
@@ -1021,6 +1021,8 @@ DROP TABLE t1,t2;
#
# Bug #21101 (Prints wrong error message if max row size is too large)
#
+#from innodb-1.0.8, any size is passed without innodb_strict_mode.
+SET SESSION innodb_strict_mode = on;
--error 1118
CREATE TABLE t1 (
c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
diff --git a/mysql-test/suite/innodb/t/innodb_multi_update.test b/mysql-test/suite/innodb/t/innodb_multi_update.test
new file mode 100644
index 00000000000..7ab17ccf70a
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_multi_update.test
@@ -0,0 +1,29 @@
+-- source include/have_innodb.inc
+
+#
+# Test multi update with different join methods
+#
+
+CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb;
+INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+
+# Full join, without key
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100;
+select * from bug38999_1;
+
+# unique key
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101;
+select * from bug38999_1;
+
+# ref key
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2;
+select * from bug38999_1;
+
+# Range key (in bug38999_1)
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100;
+select * from bug38999_1;
+select * from bug38999_2;
+
+drop table bug38999_1,bug38999_2;
diff --git a/mysql-test/t/innodb_mysql-master.opt b/mysql-test/suite/innodb/t/innodb_mysql-master.opt
index 205c733455d..205c733455d 100644
--- a/mysql-test/t/innodb_mysql-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_mysql-master.opt
diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test
new file mode 100644
index 00000000000..8d3af2b3a5d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test
@@ -0,0 +1,755 @@
+# t/innodb_mysql.test
+#
+# Last update:
+# 2006-07-26 ML test refactored (MySQL 5.1)
+# main testing code t/innodb_mysql.test -> include/mix1.inc
+#
+
+# Slow test, don't run during staging part
+-- source include/not_staging.inc
+-- source include/have_innodb.inc
+let $engine_type= InnoDB;
+let $other_engine_type= MEMORY;
+# InnoDB does support FOREIGN KEYFOREIGN KEYs
+let $test_foreign_keys= 1;
+set global innodb_support_xa=default;
+set session innodb_support_xa=default;
+--source include/mix1.inc
+
+--disable_warnings
+drop table if exists t1, t2, t3;
+--enable_warnings
+#
+# BUG#35850: Performance regression in 5.1.23/5.1.24
+#
+create table t1(a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, b int, pk int, key(a,b), primary key(pk)) engine=innodb;
+insert into t2 select @a:=A.a+10*(B.a + 10*C.a),@a, @a from t1 A, t1 B, t1 C;
+--echo this must use key 'a', not PRIMARY:
+--replace_column 9 #
+explain select a from t2 where a=b;
+drop table t1, t2;
+
+#
+# Bug #40360: Binlog related errors with binlog off
+#
+# This bug is triggered when the binlog format is STATEMENT and the
+# binary log is turned off. In this case, no error should be shown for
+# the statement since there are no replication issues.
+
+SET SESSION BINLOG_FORMAT=STATEMENT;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+query_vertical select @@session.sql_log_bin, @@session.binlog_format, @@session.tx_isolation;
+CREATE TABLE t1 ( a INT ) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+DROP TABLE t1;
+
+#
+# Bug#37284 Crash in Field_string::type()
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
+CREATE INDEX i1 on t1 (a(3));
+SELECT * FROM t1 WHERE a = 'abcde';
+DROP TABLE t1;
+
+#
+# Bug #37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of
+# requested column
+#
+
+CREATE TABLE foo (a int, b int, c char(10),
+ PRIMARY KEY (c(3)),
+ KEY b (b)
+) engine=innodb;
+
+CREATE TABLE foo2 (a int, b int, c char(10),
+ PRIMARY KEY (c),
+ KEY b (b)
+) engine=innodb;
+
+CREATE TABLE bar (a int, b int, c char(10),
+ PRIMARY KEY (c(3)),
+ KEY b (b)
+) engine=myisam;
+
+INSERT INTO foo VALUES
+ (1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'),
+ (4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe');
+
+INSERT INTO bar SELECT * FROM foo;
+INSERT INTO foo2 SELECT * FROM foo;
+
+--query_vertical EXPLAIN SELECT c FROM bar WHERE b>2;
+--query_vertical EXPLAIN SELECT c FROM foo WHERE b>2;
+--query_vertical EXPLAIN SELECT c FROM foo2 WHERE b>2;
+
+--query_vertical EXPLAIN SELECT c FROM bar WHERE c>2;
+--query_vertical EXPLAIN SELECT c FROM foo WHERE c>2;
+--query_vertical EXPLAIN SELECT c FROM foo2 WHERE c>2;
+
+DROP TABLE foo, bar, foo2;
+
+
+#
+# Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t3,t2;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+DELIMITER |;
+CREATE FUNCTION f1() RETURNS VARCHAR(250)
+ BEGIN
+ return 'hhhhhhh' ;
+ END|
+DELIMITER ;|
+
+CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20), c VARCHAR(20)) ENGINE=INNODB;
+
+BEGIN WORK;
+
+CREATE TEMPORARY TABLE t2 (a VARCHAR(20), b VARCHAR(20), c varchar(20)) ENGINE=INNODB;
+CREATE TEMPORARY TABLE t3 LIKE t2;
+
+INSERT INTO t1 VALUES ('a','b',NULL),('c','d',NULL),('e','f',NULL);
+
+SET @stmt := CONCAT('INSERT INTO t2 SELECT tbl.a, tbl.b, f1()',' FROM t1 tbl');
+PREPARE stmt1 FROM @stmt;
+
+SET @stmt := CONCAT('INSERT INTO t3', ' SELECT * FROM t2');
+PREPARE stmt3 FROM @stmt;
+
+EXECUTE stmt1;
+
+COMMIT;
+
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt3;
+
+DROP TABLE t1,t3,t2;
+DROP FUNCTION f1;
+
+#
+# Bug#37016: TRUNCATE TABLE removes some rows but not all
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY,
+ t1_id INT, INDEX par_ind (t1_id),
+ FOREIGN KEY (t1_id) REFERENCES t1(id)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (3,2);
+
+SET AUTOCOMMIT = 0;
+
+START TRANSACTION;
+--error ER_ROW_IS_REFERENCED_2
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+COMMIT;
+SELECT * FROM t1;
+
+START TRANSACTION;
+--error ER_ROW_IS_REFERENCED_2
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+ROLLBACK;
+SELECT * FROM t1;
+
+SET AUTOCOMMIT = 1;
+
+START TRANSACTION;
+SELECT * FROM t1;
+COMMIT;
+
+--error ER_ROW_IS_REFERENCED_2
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+DELETE FROM t2 WHERE id = 3;
+
+START TRANSACTION;
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+ROLLBACK;
+SELECT * FROM t1;
+TRUNCATE TABLE t2;
+
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0
+--echo #
+CREATE TABLE t1 (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ aid INT UNSIGNED NOT NULL,
+ PRIMARY KEY (id),
+ FOREIGN KEY (aid) REFERENCES t1 (id)
+) ENGINE=InnoDB;
+
+CREATE TABLE t3 (
+ bid INT UNSIGNED NOT NULL,
+ FOREIGN KEY (bid) REFERENCES t2 (id)
+) ENGINE=InnoDB;
+
+CREATE TABLE t4 (
+ a INT
+) ENGINE=InnoDB;
+
+CREATE TABLE t5 (
+ a INT
+) ENGINE=InnoDB;
+
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id, aid) VALUES (1, 1),(2,1),(3,1),(4,1);
+INSERT INTO t3 (bid) VALUES (1);
+
+INSERT INTO t4 VALUES (1),(2),(3),(4),(5);
+INSERT INTO t5 VALUES (1);
+
+DELETE t5 FROM t4 LEFT JOIN t5 ON t4.a= t5.a;
+
+--error ER_ROW_IS_REFERENCED_2
+DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1;
+--error ER_ROW_IS_REFERENCED_2
+DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1;
+
+DELETE IGNORE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1;
+
+DROP TABLE t3;
+DROP TABLE t2;
+DROP TABLE t1;
+DROP TABLES t4,t5;
+
+--echo # Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0
+--echo # Testing for any side effects of IGNORE on AFTER DELETE triggers used with
+--echo # transactional tables.
+--echo #
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a VARCHAR(100)) ENGINE=InnoDB;
+CREATE TABLE t3 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t4 (i INT NOT NULL PRIMARY KEY, t1i INT,
+ FOREIGN KEY (t1i) REFERENCES t1(i))
+ ENGINE=InnoDB;
+delimiter ||;
+CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW
+BEGIN
+ SET @b:='EXECUTED TRIGGER';
+ INSERT INTO t2 VALUES (@b);
+ SET @a:= error_happens_here;
+END||
+delimiter ;||
+
+SET @b:="";
+SET @a:="";
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+INSERT INTO t3 SELECT * FROM t1;
+--echo ** An error in a trigger causes rollback of the statement.
+--error ER_BAD_FIELD_ERROR
+DELETE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
+SELECT @a,@b;
+SELECT * FROM t2;
+SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
+
+--echo ** Same happens with the IGNORE option
+--error ER_BAD_FIELD_ERROR
+DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
+SELECT * FROM t2;
+SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
+
+--echo **
+--echo ** The following is an attempt to demonstrate
+--echo ** error handling inside a row iteration.
+--echo **
+DROP TRIGGER trg;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+INSERT INTO t3 VALUES (1),(2),(3),(4);
+INSERT INTO t4 VALUES (3,3),(4,4);
+
+delimiter ||;
+CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW
+BEGIN
+ SET @b:= CONCAT('EXECUTED TRIGGER FOR ROW ',CAST(OLD.i AS CHAR));
+ INSERT INTO t2 VALUES (@b);
+END||
+delimiter ;||
+
+--echo ** DELETE is prevented by foreign key constrains but errors are silenced.
+--echo ** The AFTER trigger isn't fired.
+DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
+--echo ** Tables are modified by best effort:
+SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
+--echo ** The AFTER trigger was only executed on successful rows:
+SELECT * FROM t2;
+
+DROP TRIGGER trg;
+
+--echo **
+--echo ** Induce an error midway through an AFTER-trigger
+--echo **
+TRUNCATE TABLE t4;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t3;
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+INSERT INTO t3 VALUES (1),(2),(3),(4);
+delimiter ||;
+CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW
+BEGIN
+ SET @a:= @a+1;
+ IF @a > 2 THEN
+ INSERT INTO t4 VALUES (5,5);
+ END IF;
+END||
+delimiter ;||
+
+SET @a:=0;
+--echo ** Errors in the trigger causes the statement to abort.
+--error ER_NO_REFERENCED_ROW_2
+DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
+SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
+SELECT * FROM t4;
+
+DROP TRIGGER trg;
+DROP TABLE t4;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+#
+# Bug#43580: Issue with Innodb on multi-table update
+#
+CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE = INNODB;
+CREATE TABLE t2 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB;
+
+CREATE TABLE t3 (a INT, b INT KEY, KEY (a)) ENGINE = INNODB;
+CREATE TABLE t4 (a INT KEY, b INT, KEY (b)) ENGINE = INNODB;
+
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6);
+INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+
+INSERT INTO t3 VALUES (1, 101), (2, 102), (3, 103), (4, 104), (5, 105), (6, 106);
+INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+
+UPDATE t1, t2 SET t1.a = t1.a + 100, t2.b = t1.a + 10
+WHERE t1.a BETWEEN 2 AND 4 AND t2.a = t1.b;
+--sorted_result
+SELECT * FROM t2;
+
+UPDATE t3, t4 SET t3.a = t3.a + 100, t4.b = t3.a + 10
+WHERE t3.a BETWEEN 2 AND 4 AND t4.a = t3.b - 100;
+--sorted_result
+SELECT * FROM t4;
+
+DROP TABLE t1, t2, t3, t4;
+
+--echo #
+--echo # Bug#44886: SIGSEGV in test_if_skip_sort_order() -
+--echo # uninitialized variable used as subscript
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, c INT, d INT, PRIMARY KEY (b), KEY (a,c))
+ ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1,1,0);
+
+CREATE TABLE t2 (a INT, b INT, e INT, KEY (e)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,1,2);
+
+CREATE TABLE t3 (a INT, b INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (1, 1);
+
+SELECT * FROM t1, t2, t3
+ WHERE t1.a = t3.a AND (t1.b = t3.b OR t1.d) AND t2.b = t1.b AND t2.e = 2
+ GROUP BY t1.b;
+
+DROP TABLE t1, t2, t3;
+
+--echo #
+--echo # Bug #45828: Optimizer won't use partial primary key if another
+--echo # index can prevent filesort
+--echo #
+
+# Create the table
+CREATE TABLE `t1` (
+ c1 int NOT NULL,
+ c2 int NOT NULL,
+ c3 int NOT NULL,
+ PRIMARY KEY (c1,c2),
+ KEY (c3)
+) ENGINE=InnoDB;
+
+# populate with data
+INSERT INTO t1 VALUES (5,2,1246276747);
+INSERT INTO t1 VALUES (2,1,1246281721);
+INSERT INTO t1 VALUES (7,3,1246281756);
+INSERT INTO t1 VALUES (4,2,1246282139);
+INSERT INTO t1 VALUES (3,1,1246282230);
+INSERT INTO t1 VALUES (1,0,1246282712);
+INSERT INTO t1 VALUES (8,3,1246282765);
+INSERT INTO t1 SELECT c1+10,c2+10,c3+10 FROM t1;
+INSERT INTO t1 SELECT c1+100,c2+100,c3+100 from t1;
+INSERT INTO t1 SELECT c1+1000,c2+1000,c3+1000 from t1;
+INSERT INTO t1 SELECT c1+10000,c2+10000,c3+10000 from t1;
+INSERT INTO t1 SELECT c1+100000,c2+100000,c3+100000 from t1;
+INSERT INTO t1 SELECT c1+1000000,c2+1000000,c3+1000000 from t1;
+
+# query and no rows will match the c1 condition, whereas all will match c3
+SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
+
+# SHOULD use the pk.
+# index on c3 will be used instead of primary key
+EXPLAIN SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
+
+# if we force the primary key, we can see the estimate is 1
+EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
+
+
+CREATE TABLE t2 (
+ c1 int NOT NULL,
+ c2 int NOT NULL,
+ c3 int NOT NULL,
+ KEY (c1,c2),
+ KEY (c3)
+) ENGINE=InnoDB;
+
+# SHOULD use the pk.
+# if we switch it from a primary key to a regular index, it works correctly as well
+explain SELECT * FROM t2 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
+
+DROP TABLE t1,t2;
+
+
+--echo #
+--echo # 36259: Optimizing with ORDER BY
+--echo #
+
+CREATE TABLE t1 (
+ a INT NOT NULL AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL,
+ d VARCHAR(5),
+ e INT NOT NULL,
+ PRIMARY KEY (a), KEY i2 (b,c,d)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 (b,c,d,e) VALUES (1,1,'a',1), (2,2,'b',2);
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
+EXPLAIN SELECT * FROM t1 WHERE b=1 AND c=1 ORDER BY a;
+EXPLAIN SELECT * FROM t1 FORCE INDEX(i2) WHERE b=1 and c=1 ORDER BY a;
+EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a;
+
+DROP TABLE t1;
+
+--echo #
+--echo # Bug #47963: Wrong results when index is used
+--echo #
+CREATE TABLE t1(
+ a VARCHAR(5) NOT NULL,
+ b VARCHAR(5) NOT NULL,
+ c DATETIME NOT NULL,
+ KEY (c)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00');
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001';
+SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
+EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND
+ c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
+DROP TABLE t1;
+
+--echo #
+--echo # Bug #46175: NULL read_view and consistent read assertion
+--echo #
+
+CREATE TABLE t1(a CHAR(13),KEY(a)) ENGINE=innodb;
+CREATE TABLE t2(b DATETIME,KEY(b)) ENGINE=innodb;
+INSERT INTO t1 VALUES (),();
+INSERT INTO t2 VALUES (),();
+CREATE OR REPLACE VIEW v1 AS SELECT 1 FROM t2
+ WHERE b =(SELECT a FROM t1 LIMIT 1);
+
+--disable_query_log
+--disable_result_log
+CONNECT (con1, localhost, root,,);
+--enable_query_log
+--enable_result_log
+CONNECTION default;
+
+DELIMITER |;
+CREATE PROCEDURE p1(num INT)
+BEGIN
+ DECLARE i INT DEFAULT 0;
+ REPEAT
+ SHOW CREATE VIEW v1;
+ SET i:=i+1;
+ UNTIL i>num END REPEAT;
+END|
+DELIMITER ;|
+
+--echo # Should not crash
+--disable_query_log
+--disable_result_log
+--send CALL p1(1000)
+CONNECTION con1;
+--echo # Should not crash
+CALL p1(1000);
+
+CONNECTION default;
+--reap
+--enable_query_log
+--enable_result_log
+
+DISCONNECT con1;
+DROP PROCEDURE p1;
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
+
+--echo #
+--echo # Bug #49324: more valgrind errors in test_if_skip_sort_order
+--echo #
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb ;
+--echo #should not cause valgrind warnings
+SELECT 1 FROM t1 JOIN t1 a USING(a) GROUP BY t1.a,t1.a;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#50843: Filesort used instead of clustered index led to
+--echo # performance degradation.
+--echo #
+create table t1(f1 int not null primary key, f2 int) engine=innodb;
+create table t2(f1 int not null, key (f1)) engine=innodb;
+insert into t1 values (1,1),(2,2),(3,3);
+insert into t2 values (1),(2),(3);
+explain select t1.* from t1 left join t2 using(f1) group by t1.f1;
+drop table t1,t2;
+--echo #
+
+
+--echo #
+--echo # Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may
+--echo # corrupt definition at engine
+--echo #
+
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, KEY k (a,b))
+ ENGINE=InnoDB;
+
+ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b);
+
+--query_vertical SHOW INDEXES FROM t1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # Bug #53334: wrong result for outer join with impossible ON condition
+--echo # (see the same test case for MyISAM in join.test)
+--echo #
+
+create table t1 (id int primary key);
+create table t2 (id int);
+
+insert into t1 values (75);
+insert into t1 values (79);
+insert into t1 values (78);
+insert into t1 values (77);
+replace into t1 values (76);
+replace into t1 values (76);
+insert into t1 values (104);
+insert into t1 values (103);
+insert into t1 values (102);
+insert into t1 values (101);
+insert into t1 values (105);
+insert into t1 values (106);
+insert into t1 values (107);
+
+insert into t2 values (107),(75),(1000);
+
+select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
+ where t2.id=75 and t1.id is null;
+explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
+ where t2.id=75 and t1.id is null;
+
+drop table t1,t2;
+
+--echo #
+--echo # Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when
+--echo # JOINed during an UPDATE
+--echo #
+
+CREATE TABLE t1 (d INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, b INT,
+ c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB;
+
+--echo set up our data elements
+INSERT INTO t1 (d) VALUES (1);
+INSERT INTO t2 (a,b) VALUES (1,1);
+SELECT SECOND(c) INTO @bug47453 FROM t2;
+
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+
+SELECT SLEEP(1);
+
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+
+--echo #should be 0
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#38999 valgrind warnings for update statement in function compare_record()
+--echo #
+
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 values (1),(2),(3),(4),(5);
+INSERT INTO t2 values (1);
+
+SELECT * FROM t1 WHERE a = 2;
+UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug #53334: wrong result for outer join with impossible ON condition
+--echo # (see the same test case for MyISAM in join.test)
+--echo #
+
+CREATE TABLE t1 (id INT PRIMARY KEY);
+CREATE TABLE t2 (id INT);
+
+INSERT INTO t1 VALUES (75);
+INSERT INTO t1 VALUES (79);
+INSERT INTO t1 VALUES (78);
+INSERT INTO t1 VALUES (77);
+REPLACE INTO t1 VALUES (76);
+REPLACE INTO t1 VALUES (76);
+INSERT INTO t1 VALUES (104);
+INSERT INTO t1 VALUES (103);
+INSERT INTO t1 VALUES (102);
+INSERT INTO t1 VALUES (101);
+INSERT INTO t1 VALUES (105);
+INSERT INTO t1 VALUES (106);
+INSERT INTO t1 VALUES (107);
+
+INSERT INTO t2 VALUES (107),(75),(1000);
+
+SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0
+ WHERE t2.id=75 AND t1.id IS NULL;
+EXPLAIN SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0
+ WHERE t2.id=75 AND t1.id IS NULL;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug #53830: !table || (!table->read_set || bitmap_is_set(table->read_set, field_index))
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, c INT, d INT,
+ PRIMARY KEY(a,b,c), KEY(b,d))
+ ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0, 77, 1, 3);
+
+UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25;
+
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#50389 Using intersect does not return all rows
+--echo #
+
+CREATE TABLE t1 (
+ f1 INT(10) NOT NULL,
+ f2 INT(10),
+ f3 INT(10),
+ f4 TINYINT(4),
+ f5 VARCHAR(50),
+ PRIMARY KEY (f1),
+ KEY idx1 (f2,f5,f4),
+ KEY idx2 (f2,f4)
+) ENGINE=InnoDB;
+
+LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1;
+
+SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+ 3470988,3305175,3329875,3817277,3856380,3796193,
+ 3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+
+EXPLAIN SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+ 3470988,3305175,3329875,3817277,3856380,3796193,
+ 3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#51431 Wrong sort order after import of dump file
+--echo #
+
+CREATE TABLE t1 (
+ f1 INT(11) NOT NULL,
+ f2 int(11) NOT NULL,
+ f3 int(11) NOT NULL,
+ f4 tinyint(1) NOT NULL,
+ PRIMARY KEY (f1),
+ UNIQUE KEY (f2, f3),
+ KEY (f4)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1),
+(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1),
+(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1),
+(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1),
+(26,1,9921,1), (27,1,9922,1);
+
+FLUSH TABLES;
+
+SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+
+DROP TABLE t1;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/innodb_mysql_rbk-master.opt b/mysql-test/suite/innodb/t/innodb_mysql_rbk-master.opt
index 0e400f9c36b..0e400f9c36b 100644
--- a/mysql-test/t/innodb_mysql_rbk-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_mysql_rbk-master.opt
diff --git a/mysql-test/t/innodb_mysql_rbk.test b/mysql-test/suite/innodb/t/innodb_mysql_rbk.test
index d2368c81f95..d2368c81f95 100644
--- a/mysql-test/t/innodb_mysql_rbk.test
+++ b/mysql-test/suite/innodb/t/innodb_mysql_rbk.test
diff --git a/mysql-test/t/innodb_notembedded.test b/mysql-test/suite/innodb/t/innodb_notembedded.test
index c74dc931505..c74dc931505 100644
--- a/mysql-test/t/innodb_notembedded.test
+++ b/mysql-test/suite/innodb/t/innodb_notembedded.test
diff --git a/mysql-test/t/innodb_timeout_rollback-master.opt b/mysql-test/suite/innodb/t/innodb_timeout_rollback-master.opt
index 50921bb4df0..50921bb4df0 100644
--- a/mysql-test/t/innodb_timeout_rollback-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_timeout_rollback-master.opt
diff --git a/mysql-test/t/innodb_timeout_rollback.test b/mysql-test/suite/innodb/t/innodb_timeout_rollback.test
index 99890971064..99890971064 100644
--- a/mysql-test/t/innodb_timeout_rollback.test
+++ b/mysql-test/suite/innodb/t/innodb_timeout_rollback.test
diff --git a/mysql-test/suite/innodb_plugin/r/innodb-autoinc-optimize.result b/mysql-test/suite/innodb_plugin/r/innodb-autoinc-optimize.result
new file mode 100644
index 00000000000..c6da43555b2
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb-autoinc-optimize.result
@@ -0,0 +1,9 @@
+drop table if exists t1;
+create table t1(a int not null auto_increment primary key) engine=innodb;
+insert into t1 set a = -1;
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+==== clean up ====
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb-ucs2.result b/mysql-test/suite/innodb_plugin/r/innodb-ucs2.result
new file mode 100644
index 00000000000..b6bff7d5f42
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb-ucs2.result
@@ -0,0 +1,314 @@
+drop table if exists t1, t2;
+create table t1 (
+a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 05630563 05630563 email
+4 0563 0563 email
+4 05612020 05612020 email
+4 01FC 01FC email
+4 0120 0120 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 0000E400 0000E400 email
+4 0000563001FC0563 0000563001FC0563 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 05630563 05630563 email
+4 0563 0563 email
+4 05612020 05612020 email
+4 01FC 01FC email
+4 0120 0120 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 0000E400 0000E400 email
+4 0000563001FC0563 0000563001FC0563 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 0120 0120 email
+4 01FC 01FC email
+4 0563 0563 email
+4 0000563001FC0563 0000563001FC0563 email
+4 0000E400 0000E400 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 05612020 05612020 email
+4 05630563 05630563 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 0000E400 0000E400 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 0120 0120 email
+4 01FC 01FC email
+4 05612020 05612020 email
+4 0563 0563 email
+1 61626364656667 61626364656667 one
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+drop table t1;
+drop table t2;
+commit;
+CREATE TABLE t1 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind) hex(string1)
+31
+32
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind) hex(string1)
+0031
+0032
+drop table t1,t2;
+CREATE TABLE t1 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind) hex(string1)
+31
+32
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind) hex(string1)
+0031
+0032
+drop table t1,t2;
+CREATE TABLE t1 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+hex(ind) hex(string1)
+0
+1
+select hex(ind),hex(string1) from t2 order by string1;
+hex(ind) hex(string1)
+0
+1
+drop table t1,t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2))
+) character set utf8 engine = innodb;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2))
+) character set ucs2 engine = innodb;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a hex(b)
+1 61626364656667
+2 6465666768696A6B
+6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a hex(b)
+1 61626364656667
+2 6465666768696A6B
+6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/suite/innodb_plugin/r/innodb.result b/mysql-test/suite/innodb_plugin/r/innodb.result
index e435c0f68ca..c4b718bd975 100644
--- a/mysql-test/suite/innodb_plugin/r/innodb.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb.result
@@ -1184,82 +1184,6 @@ a b
8 8
9 9
drop table t1;
-CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
-CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
-INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
-INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-update t1,t2 set t1.a=t1.a+100;
-select * from t1;
-a b
-101 1
-102 2
-103 3
-104 4
-105 5
-106 6
-107 7
-108 8
-109 9
-110 10
-111 11
-112 12
-update t1,t2 set t1.a=t1.a+100 where t1.a=101;
-select * from t1;
-a b
-201 1
-102 2
-103 3
-104 4
-105 5
-106 6
-107 7
-108 8
-109 9
-110 10
-111 11
-112 12
-update t1,t2 set t1.b=t1.b+10 where t1.b=2;
-select * from t1;
-a b
-201 1
-103 3
-104 4
-105 5
-106 6
-107 7
-108 8
-109 9
-110 10
-111 11
-102 12
-112 12
-update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
-select * from t1;
-a b
-201 1
-103 5
-104 6
-106 6
-105 7
-107 7
-108 8
-109 9
-110 10
-111 11
-102 12
-112 12
-select * from t2;
-a b
-1 1
-2 2
-6 6
-7 7
-8 8
-9 9
-3 13
-4 14
-5 15
-drop table t1,t2;
CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
SET AUTOCOMMIT=0;
@@ -1438,7 +1362,7 @@ insert t2 select * from t1;
insert t3 select * from t1;
checksum table t1, t2, t3, t4 quick;
Table Checksum
-test.t1 2948697075
+test.t1 3442722830
test.t2 NULL
test.t3 NULL
test.t4 NULL
@@ -1446,17 +1370,17 @@ Warnings:
Error 1146 Table 'test.t4' doesn't exist
checksum table t1, t2, t3, t4;
Table Checksum
-test.t1 2948697075
-test.t2 2948697075
-test.t3 2948697075
+test.t1 3442722830
+test.t2 3442722830
+test.t3 3442722830
test.t4 NULL
Warnings:
Error 1146 Table 'test.t4' doesn't exist
checksum table t1, t2, t3, t4 extended;
Table Checksum
-test.t1 2948697075
-test.t2 2948697075
-test.t3 2948697075
+test.t1 3442722830
+test.t2 3442722830
+test.t3 3442722830
test.t4 NULL
Warnings:
Error 1146 Table 'test.t4' doesn't exist
@@ -1752,10 +1676,10 @@ variable_value - @innodb_rows_deleted_orig
71
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
variable_value - @innodb_rows_inserted_orig
-1087
+1066
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
variable_value - @innodb_rows_updated_orig
-885
+865
SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
variable_value - @innodb_row_lock_waits_orig
0
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_autoinc_lock_mode_zero.result b/mysql-test/suite/innodb_plugin/r/innodb_autoinc_lock_mode_zero.result
new file mode 100644
index 00000000000..3d016684338
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_autoinc_lock_mode_zero.result
@@ -0,0 +1,39 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+ggid varchar(32) binary DEFAULT '' NOT NULL,
+email varchar(64) DEFAULT '' NOT NULL,
+passwd varchar(32) binary DEFAULT '' NOT NULL,
+PRIMARY KEY (id),
+UNIQUE ggid (ggid)
+) ENGINE=innodb;
+insert into t1 (ggid,passwd) values ('test1','xxx');
+insert into t1 (ggid,passwd) values ('test2','yyy');
+insert into t1 (ggid,passwd) values ('test2','this will fail');
+ERROR 23000: Duplicate entry 'test2' for key 'ggid'
+insert into t1 (ggid,id) values ('this will fail',1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+select * from t1 where ggid='test1';
+id ggid email passwd
+1 test1 xxx
+select * from t1 where passwd='xxx';
+id ggid email passwd
+1 test1 xxx
+select * from t1 where id=2;
+id ggid email passwd
+2 test2 yyy
+replace into t1 (ggid,id) values ('this will work',1);
+replace into t1 (ggid,passwd) values ('test2','this will work');
+update t1 set id=100,ggid='test2' where id=1;
+ERROR 23000: Duplicate entry 'test2' for key 'ggid'
+select * from t1;
+id ggid email passwd
+1 this will work
+3 test2 this will work
+select * from t1 where id=1;
+id ggid email passwd
+1 this will work
+select * from t1 where id=999;
+id ggid email passwd
+drop table t1;
+End of tests
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug30919.result b/mysql-test/suite/innodb_plugin/r/innodb_bug30919.result
new file mode 100644
index 00000000000..42aa4ff302b
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug30919.result
@@ -0,0 +1,1043 @@
+use test;
+CREATE TABLE test.part_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT,
+dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
+fkid MEDIUMINT, filler VARCHAR(255),
+PRIMARY KEY(id)) ENGINE='innodb'
+PARTITION BY RANGE(id)
+SUBPARTITION BY hash(id) subpartitions 2
+(PARTITION pa3 values less than (42),
+PARTITION pa6 values less than (60),
+PARTITION pa7 values less than (70),
+PARTITION pa8 values less than (80),
+PARTITION pa9 values less than (90),
+PARTITION pa10 values less than (100),
+PARTITION pa11 values less than MAXVALUE);
+CREATE PROCEDURE test.proc_part()
+BEGIN
+DECLARE ins_count INT DEFAULT 1000;
+DECLARE del_count INT;
+DECLARE cur_user VARCHAR(255);
+DECLARE local_uuid VARCHAR(255);
+DECLARE local_time TIMESTAMP;
+SET local_time= NOW();
+SET cur_user= CURRENT_USER();
+SET local_uuid= UUID();
+WHILE ins_count > 0 DO
+INSERT INTO test.part_tbl VALUES (NULL, NOW(), USER() , UUID(),
+ins_count,'Going to test MBR for MySQL');
+SET ins_count = ins_count - 1;
+END WHILE;
+SELECT MAX(id) FROM test.part_tbl INTO del_count;
+WHILE del_count > 0 DO
+DELETE FROM test.part_tbl WHERE id = del_count;
+select count(*) as internal_count, del_count -- these two lines are for
+FROM test.part_tbl; -- debug to show the problem
+SET del_count = del_count - 2;
+END WHILE;
+END|
+CALL test.proc_part();
+internal_count del_count
+999 1000
+internal_count del_count
+998 998
+internal_count del_count
+997 996
+internal_count del_count
+996 994
+internal_count del_count
+995 992
+internal_count del_count
+994 990
+internal_count del_count
+993 988
+internal_count del_count
+992 986
+internal_count del_count
+991 984
+internal_count del_count
+990 982
+internal_count del_count
+989 980
+internal_count del_count
+988 978
+internal_count del_count
+987 976
+internal_count del_count
+986 974
+internal_count del_count
+985 972
+internal_count del_count
+984 970
+internal_count del_count
+983 968
+internal_count del_count
+982 966
+internal_count del_count
+981 964
+internal_count del_count
+980 962
+internal_count del_count
+979 960
+internal_count del_count
+978 958
+internal_count del_count
+977 956
+internal_count del_count
+976 954
+internal_count del_count
+975 952
+internal_count del_count
+974 950
+internal_count del_count
+973 948
+internal_count del_count
+972 946
+internal_count del_count
+971 944
+internal_count del_count
+970 942
+internal_count del_count
+969 940
+internal_count del_count
+968 938
+internal_count del_count
+967 936
+internal_count del_count
+966 934
+internal_count del_count
+965 932
+internal_count del_count
+964 930
+internal_count del_count
+963 928
+internal_count del_count
+962 926
+internal_count del_count
+961 924
+internal_count del_count
+960 922
+internal_count del_count
+959 920
+internal_count del_count
+958 918
+internal_count del_count
+957 916
+internal_count del_count
+956 914
+internal_count del_count
+955 912
+internal_count del_count
+954 910
+internal_count del_count
+953 908
+internal_count del_count
+952 906
+internal_count del_count
+951 904
+internal_count del_count
+950 902
+internal_count del_count
+949 900
+internal_count del_count
+948 898
+internal_count del_count
+947 896
+internal_count del_count
+946 894
+internal_count del_count
+945 892
+internal_count del_count
+944 890
+internal_count del_count
+943 888
+internal_count del_count
+942 886
+internal_count del_count
+941 884
+internal_count del_count
+940 882
+internal_count del_count
+939 880
+internal_count del_count
+938 878
+internal_count del_count
+937 876
+internal_count del_count
+936 874
+internal_count del_count
+935 872
+internal_count del_count
+934 870
+internal_count del_count
+933 868
+internal_count del_count
+932 866
+internal_count del_count
+931 864
+internal_count del_count
+930 862
+internal_count del_count
+929 860
+internal_count del_count
+928 858
+internal_count del_count
+927 856
+internal_count del_count
+926 854
+internal_count del_count
+925 852
+internal_count del_count
+924 850
+internal_count del_count
+923 848
+internal_count del_count
+922 846
+internal_count del_count
+921 844
+internal_count del_count
+920 842
+internal_count del_count
+919 840
+internal_count del_count
+918 838
+internal_count del_count
+917 836
+internal_count del_count
+916 834
+internal_count del_count
+915 832
+internal_count del_count
+914 830
+internal_count del_count
+913 828
+internal_count del_count
+912 826
+internal_count del_count
+911 824
+internal_count del_count
+910 822
+internal_count del_count
+909 820
+internal_count del_count
+908 818
+internal_count del_count
+907 816
+internal_count del_count
+906 814
+internal_count del_count
+905 812
+internal_count del_count
+904 810
+internal_count del_count
+903 808
+internal_count del_count
+902 806
+internal_count del_count
+901 804
+internal_count del_count
+900 802
+internal_count del_count
+899 800
+internal_count del_count
+898 798
+internal_count del_count
+897 796
+internal_count del_count
+896 794
+internal_count del_count
+895 792
+internal_count del_count
+894 790
+internal_count del_count
+893 788
+internal_count del_count
+892 786
+internal_count del_count
+891 784
+internal_count del_count
+890 782
+internal_count del_count
+889 780
+internal_count del_count
+888 778
+internal_count del_count
+887 776
+internal_count del_count
+886 774
+internal_count del_count
+885 772
+internal_count del_count
+884 770
+internal_count del_count
+883 768
+internal_count del_count
+882 766
+internal_count del_count
+881 764
+internal_count del_count
+880 762
+internal_count del_count
+879 760
+internal_count del_count
+878 758
+internal_count del_count
+877 756
+internal_count del_count
+876 754
+internal_count del_count
+875 752
+internal_count del_count
+874 750
+internal_count del_count
+873 748
+internal_count del_count
+872 746
+internal_count del_count
+871 744
+internal_count del_count
+870 742
+internal_count del_count
+869 740
+internal_count del_count
+868 738
+internal_count del_count
+867 736
+internal_count del_count
+866 734
+internal_count del_count
+865 732
+internal_count del_count
+864 730
+internal_count del_count
+863 728
+internal_count del_count
+862 726
+internal_count del_count
+861 724
+internal_count del_count
+860 722
+internal_count del_count
+859 720
+internal_count del_count
+858 718
+internal_count del_count
+857 716
+internal_count del_count
+856 714
+internal_count del_count
+855 712
+internal_count del_count
+854 710
+internal_count del_count
+853 708
+internal_count del_count
+852 706
+internal_count del_count
+851 704
+internal_count del_count
+850 702
+internal_count del_count
+849 700
+internal_count del_count
+848 698
+internal_count del_count
+847 696
+internal_count del_count
+846 694
+internal_count del_count
+845 692
+internal_count del_count
+844 690
+internal_count del_count
+843 688
+internal_count del_count
+842 686
+internal_count del_count
+841 684
+internal_count del_count
+840 682
+internal_count del_count
+839 680
+internal_count del_count
+838 678
+internal_count del_count
+837 676
+internal_count del_count
+836 674
+internal_count del_count
+835 672
+internal_count del_count
+834 670
+internal_count del_count
+833 668
+internal_count del_count
+832 666
+internal_count del_count
+831 664
+internal_count del_count
+830 662
+internal_count del_count
+829 660
+internal_count del_count
+828 658
+internal_count del_count
+827 656
+internal_count del_count
+826 654
+internal_count del_count
+825 652
+internal_count del_count
+824 650
+internal_count del_count
+823 648
+internal_count del_count
+822 646
+internal_count del_count
+821 644
+internal_count del_count
+820 642
+internal_count del_count
+819 640
+internal_count del_count
+818 638
+internal_count del_count
+817 636
+internal_count del_count
+816 634
+internal_count del_count
+815 632
+internal_count del_count
+814 630
+internal_count del_count
+813 628
+internal_count del_count
+812 626
+internal_count del_count
+811 624
+internal_count del_count
+810 622
+internal_count del_count
+809 620
+internal_count del_count
+808 618
+internal_count del_count
+807 616
+internal_count del_count
+806 614
+internal_count del_count
+805 612
+internal_count del_count
+804 610
+internal_count del_count
+803 608
+internal_count del_count
+802 606
+internal_count del_count
+801 604
+internal_count del_count
+800 602
+internal_count del_count
+799 600
+internal_count del_count
+798 598
+internal_count del_count
+797 596
+internal_count del_count
+796 594
+internal_count del_count
+795 592
+internal_count del_count
+794 590
+internal_count del_count
+793 588
+internal_count del_count
+792 586
+internal_count del_count
+791 584
+internal_count del_count
+790 582
+internal_count del_count
+789 580
+internal_count del_count
+788 578
+internal_count del_count
+787 576
+internal_count del_count
+786 574
+internal_count del_count
+785 572
+internal_count del_count
+784 570
+internal_count del_count
+783 568
+internal_count del_count
+782 566
+internal_count del_count
+781 564
+internal_count del_count
+780 562
+internal_count del_count
+779 560
+internal_count del_count
+778 558
+internal_count del_count
+777 556
+internal_count del_count
+776 554
+internal_count del_count
+775 552
+internal_count del_count
+774 550
+internal_count del_count
+773 548
+internal_count del_count
+772 546
+internal_count del_count
+771 544
+internal_count del_count
+770 542
+internal_count del_count
+769 540
+internal_count del_count
+768 538
+internal_count del_count
+767 536
+internal_count del_count
+766 534
+internal_count del_count
+765 532
+internal_count del_count
+764 530
+internal_count del_count
+763 528
+internal_count del_count
+762 526
+internal_count del_count
+761 524
+internal_count del_count
+760 522
+internal_count del_count
+759 520
+internal_count del_count
+758 518
+internal_count del_count
+757 516
+internal_count del_count
+756 514
+internal_count del_count
+755 512
+internal_count del_count
+754 510
+internal_count del_count
+753 508
+internal_count del_count
+752 506
+internal_count del_count
+751 504
+internal_count del_count
+750 502
+internal_count del_count
+749 500
+internal_count del_count
+748 498
+internal_count del_count
+747 496
+internal_count del_count
+746 494
+internal_count del_count
+745 492
+internal_count del_count
+744 490
+internal_count del_count
+743 488
+internal_count del_count
+742 486
+internal_count del_count
+741 484
+internal_count del_count
+740 482
+internal_count del_count
+739 480
+internal_count del_count
+738 478
+internal_count del_count
+737 476
+internal_count del_count
+736 474
+internal_count del_count
+735 472
+internal_count del_count
+734 470
+internal_count del_count
+733 468
+internal_count del_count
+732 466
+internal_count del_count
+731 464
+internal_count del_count
+730 462
+internal_count del_count
+729 460
+internal_count del_count
+728 458
+internal_count del_count
+727 456
+internal_count del_count
+726 454
+internal_count del_count
+725 452
+internal_count del_count
+724 450
+internal_count del_count
+723 448
+internal_count del_count
+722 446
+internal_count del_count
+721 444
+internal_count del_count
+720 442
+internal_count del_count
+719 440
+internal_count del_count
+718 438
+internal_count del_count
+717 436
+internal_count del_count
+716 434
+internal_count del_count
+715 432
+internal_count del_count
+714 430
+internal_count del_count
+713 428
+internal_count del_count
+712 426
+internal_count del_count
+711 424
+internal_count del_count
+710 422
+internal_count del_count
+709 420
+internal_count del_count
+708 418
+internal_count del_count
+707 416
+internal_count del_count
+706 414
+internal_count del_count
+705 412
+internal_count del_count
+704 410
+internal_count del_count
+703 408
+internal_count del_count
+702 406
+internal_count del_count
+701 404
+internal_count del_count
+700 402
+internal_count del_count
+699 400
+internal_count del_count
+698 398
+internal_count del_count
+697 396
+internal_count del_count
+696 394
+internal_count del_count
+695 392
+internal_count del_count
+694 390
+internal_count del_count
+693 388
+internal_count del_count
+692 386
+internal_count del_count
+691 384
+internal_count del_count
+690 382
+internal_count del_count
+689 380
+internal_count del_count
+688 378
+internal_count del_count
+687 376
+internal_count del_count
+686 374
+internal_count del_count
+685 372
+internal_count del_count
+684 370
+internal_count del_count
+683 368
+internal_count del_count
+682 366
+internal_count del_count
+681 364
+internal_count del_count
+680 362
+internal_count del_count
+679 360
+internal_count del_count
+678 358
+internal_count del_count
+677 356
+internal_count del_count
+676 354
+internal_count del_count
+675 352
+internal_count del_count
+674 350
+internal_count del_count
+673 348
+internal_count del_count
+672 346
+internal_count del_count
+671 344
+internal_count del_count
+670 342
+internal_count del_count
+669 340
+internal_count del_count
+668 338
+internal_count del_count
+667 336
+internal_count del_count
+666 334
+internal_count del_count
+665 332
+internal_count del_count
+664 330
+internal_count del_count
+663 328
+internal_count del_count
+662 326
+internal_count del_count
+661 324
+internal_count del_count
+660 322
+internal_count del_count
+659 320
+internal_count del_count
+658 318
+internal_count del_count
+657 316
+internal_count del_count
+656 314
+internal_count del_count
+655 312
+internal_count del_count
+654 310
+internal_count del_count
+653 308
+internal_count del_count
+652 306
+internal_count del_count
+651 304
+internal_count del_count
+650 302
+internal_count del_count
+649 300
+internal_count del_count
+648 298
+internal_count del_count
+647 296
+internal_count del_count
+646 294
+internal_count del_count
+645 292
+internal_count del_count
+644 290
+internal_count del_count
+643 288
+internal_count del_count
+642 286
+internal_count del_count
+641 284
+internal_count del_count
+640 282
+internal_count del_count
+639 280
+internal_count del_count
+638 278
+internal_count del_count
+637 276
+internal_count del_count
+636 274
+internal_count del_count
+635 272
+internal_count del_count
+634 270
+internal_count del_count
+633 268
+internal_count del_count
+632 266
+internal_count del_count
+631 264
+internal_count del_count
+630 262
+internal_count del_count
+629 260
+internal_count del_count
+628 258
+internal_count del_count
+627 256
+internal_count del_count
+626 254
+internal_count del_count
+625 252
+internal_count del_count
+624 250
+internal_count del_count
+623 248
+internal_count del_count
+622 246
+internal_count del_count
+621 244
+internal_count del_count
+620 242
+internal_count del_count
+619 240
+internal_count del_count
+618 238
+internal_count del_count
+617 236
+internal_count del_count
+616 234
+internal_count del_count
+615 232
+internal_count del_count
+614 230
+internal_count del_count
+613 228
+internal_count del_count
+612 226
+internal_count del_count
+611 224
+internal_count del_count
+610 222
+internal_count del_count
+609 220
+internal_count del_count
+608 218
+internal_count del_count
+607 216
+internal_count del_count
+606 214
+internal_count del_count
+605 212
+internal_count del_count
+604 210
+internal_count del_count
+603 208
+internal_count del_count
+602 206
+internal_count del_count
+601 204
+internal_count del_count
+600 202
+internal_count del_count
+599 200
+internal_count del_count
+598 198
+internal_count del_count
+597 196
+internal_count del_count
+596 194
+internal_count del_count
+595 192
+internal_count del_count
+594 190
+internal_count del_count
+593 188
+internal_count del_count
+592 186
+internal_count del_count
+591 184
+internal_count del_count
+590 182
+internal_count del_count
+589 180
+internal_count del_count
+588 178
+internal_count del_count
+587 176
+internal_count del_count
+586 174
+internal_count del_count
+585 172
+internal_count del_count
+584 170
+internal_count del_count
+583 168
+internal_count del_count
+582 166
+internal_count del_count
+581 164
+internal_count del_count
+580 162
+internal_count del_count
+579 160
+internal_count del_count
+578 158
+internal_count del_count
+577 156
+internal_count del_count
+576 154
+internal_count del_count
+575 152
+internal_count del_count
+574 150
+internal_count del_count
+573 148
+internal_count del_count
+572 146
+internal_count del_count
+571 144
+internal_count del_count
+570 142
+internal_count del_count
+569 140
+internal_count del_count
+568 138
+internal_count del_count
+567 136
+internal_count del_count
+566 134
+internal_count del_count
+565 132
+internal_count del_count
+564 130
+internal_count del_count
+563 128
+internal_count del_count
+562 126
+internal_count del_count
+561 124
+internal_count del_count
+560 122
+internal_count del_count
+559 120
+internal_count del_count
+558 118
+internal_count del_count
+557 116
+internal_count del_count
+556 114
+internal_count del_count
+555 112
+internal_count del_count
+554 110
+internal_count del_count
+553 108
+internal_count del_count
+552 106
+internal_count del_count
+551 104
+internal_count del_count
+550 102
+internal_count del_count
+549 100
+internal_count del_count
+548 98
+internal_count del_count
+547 96
+internal_count del_count
+546 94
+internal_count del_count
+545 92
+internal_count del_count
+544 90
+internal_count del_count
+543 88
+internal_count del_count
+542 86
+internal_count del_count
+541 84
+internal_count del_count
+540 82
+internal_count del_count
+539 80
+internal_count del_count
+538 78
+internal_count del_count
+537 76
+internal_count del_count
+536 74
+internal_count del_count
+535 72
+internal_count del_count
+534 70
+internal_count del_count
+533 68
+internal_count del_count
+532 66
+internal_count del_count
+531 64
+internal_count del_count
+530 62
+internal_count del_count
+529 60
+internal_count del_count
+528 58
+internal_count del_count
+527 56
+internal_count del_count
+526 54
+internal_count del_count
+525 52
+internal_count del_count
+524 50
+internal_count del_count
+523 48
+internal_count del_count
+522 46
+internal_count del_count
+521 44
+internal_count del_count
+520 42
+internal_count del_count
+519 40
+internal_count del_count
+518 38
+internal_count del_count
+517 36
+internal_count del_count
+516 34
+internal_count del_count
+515 32
+internal_count del_count
+514 30
+internal_count del_count
+513 28
+internal_count del_count
+512 26
+internal_count del_count
+511 24
+internal_count del_count
+510 22
+internal_count del_count
+509 20
+internal_count del_count
+508 18
+internal_count del_count
+507 16
+internal_count del_count
+506 14
+internal_count del_count
+505 12
+internal_count del_count
+504 10
+internal_count del_count
+503 8
+internal_count del_count
+502 6
+internal_count del_count
+501 4
+internal_count del_count
+500 2
+select count(*) as Part from test.part_tbl;
+Part
+500
+DROP PROCEDURE test.proc_part;
+DROP TABLE test.part_tbl;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug42419.result b/mysql-test/suite/innodb_plugin/r/innodb_bug42419.result
new file mode 100644
index 00000000000..f304bb634cb
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug42419.result
@@ -0,0 +1,17 @@
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+COMMIT;
+SET AUTOCOMMIT = 0;
+CREATE TEMPORARY TABLE t1_tmp ( b INT );
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2;
+SET AUTOCOMMIT = 0;
+CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int );
+INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+Reap the server message for connection user2 UPDATE t1 ...
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug46000.result b/mysql-test/suite/innodb_plugin/r/innodb_bug46000.result
index c8e3db8d641..b27b3d7443b 100644
--- a/mysql-test/suite/innodb_plugin/r/innodb_bug46000.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug46000.result
@@ -14,6 +14,5 @@ show warnings;
Level Code Message
Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
-Error 1030 Got error -1 from storage engine
create index idx on bug46000(id);
drop table bug46000;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug48024.result b/mysql-test/suite/innodb_plugin/r/innodb_bug48024.result
new file mode 100644
index 00000000000..611923d2796
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug48024.result
@@ -0,0 +1,10 @@
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b);
+DROP TABLE bug48024,bug48024_b;
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)|
+DROP TABLE bug48024,bug48024_b;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug49164-xb.result b/mysql-test/suite/innodb_plugin/r/innodb_bug49164-xb.result
new file mode 100644
index 00000000000..9456702e1d0
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug49164-xb.result
@@ -0,0 +1,42 @@
+SET tx_isolation = 'READ-COMMITTED';
+CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
+ENGINE=InnoDB;
+insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
+begin;
+update bug49164 set c=7;
+select * from bug49164;
+a b c
+1 1 7
+2 2 7
+3 3 7
+rollback;
+select * from bug49164;
+a b c
+1 1 1
+2 2 2
+3 3 3
+begin;
+update bug49164 set c=7;
+SET tx_isolation = 'READ-COMMITTED';
+begin;
+select * from bug49164;
+a b c
+1 1 1
+2 2 2
+3 3 3
+commit;
+begin;
+update bug49164 set c=6 where a=1 and b=1;
+rollback;
+select * from bug49164;
+a b c
+1 1 1
+2 2 2
+3 3 3
+commit;
+select * from bug49164;
+a b c
+1 1 6
+2 2 2
+3 3 3
+drop table bug49164;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug49164.result b/mysql-test/suite/innodb_plugin/r/innodb_bug49164.result
new file mode 100644
index 00000000000..9456702e1d0
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug49164.result
@@ -0,0 +1,42 @@
+SET tx_isolation = 'READ-COMMITTED';
+CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
+ENGINE=InnoDB;
+insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
+begin;
+update bug49164 set c=7;
+select * from bug49164;
+a b c
+1 1 7
+2 2 7
+3 3 7
+rollback;
+select * from bug49164;
+a b c
+1 1 1
+2 2 2
+3 3 3
+begin;
+update bug49164 set c=7;
+SET tx_isolation = 'READ-COMMITTED';
+begin;
+select * from bug49164;
+a b c
+1 1 1
+2 2 2
+3 3 3
+commit;
+begin;
+update bug49164 set c=6 where a=1 and b=1;
+rollback;
+select * from bug49164;
+a b c
+1 1 1
+2 2 2
+3 3 3
+commit;
+select * from bug49164;
+a b c
+1 1 6
+2 2 2
+3 3 3
+drop table bug49164;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug53290.result b/mysql-test/suite/innodb_plugin/r/innodb_bug53290.result
new file mode 100644
index 00000000000..46cd7248c4e
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug53290.result
@@ -0,0 +1,17 @@
+create table bug53290 (x bigint) engine=innodb;
+insert into bug53290 () values (),(),(),(),(),(),(),(),(),(),(),();
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+alter table bug53290 add unique index `idx` (x);
+drop table bug53290;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug53591.result b/mysql-test/suite/innodb_plugin/r/innodb_bug53591.result
new file mode 100644
index 00000000000..99dd0d837ae
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug53591.result
@@ -0,0 +1,15 @@
+SET GLOBAL innodb_file_format='Barracuda';
+SET GLOBAL innodb_file_per_table=on;
+set old_alter_table=0;
+CREATE TABLE bug53591(a text charset utf8 not null)
+ENGINE=InnoDB KEY_BLOCK_SIZE=1;
+ALTER TABLE bug53591 ADD PRIMARY KEY(a(220));
+ERROR HY000: Too big row
+SHOW WARNINGS;
+Level Code Message
+Error 139 Too big row
+Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
+DROP TABLE bug53591;
+SET GLOBAL innodb_file_format=Antelope;
+SET GLOBAL innodb_file_format_check=Antelope;
+SET GLOBAL innodb_file_per_table=0;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug53592.result b/mysql-test/suite/innodb_plugin/r/innodb_bug53592.result
new file mode 100644
index 00000000000..18906568613
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug53592.result
@@ -0,0 +1,26 @@
+set old_alter_table=0;
+create table bug53592(a int) engine=innodb row_format=compact;
+alter table bug53592 add column b text charset utf8;
+alter table bug53592 add column c blob not null;
+create index bug53592_b on bug53592(b(81));
+create unique index bug53592_c on bug53592(c(1));
+replace into bug53592 values (),();
+Warnings:
+Warning 1364 Field 'c' doesn't have a default value
+check table bug53592;
+Table Op Msg_type Msg_text
+test.bug53592 check status OK
+drop table bug53592;
+set old_alter_table=1;
+create table bug53592(a int) engine=innodb row_format=compact;
+alter table bug53592 add column b text charset utf8;
+alter table bug53592 add column c blob not null;
+create index bug53592_b on bug53592(b(81));
+create unique index bug53592_c on bug53592(c(1));
+replace into bug53592 values (),();
+Warnings:
+Warning 1364 Field 'c' doesn't have a default value
+check table bug53592;
+Table Op Msg_type Msg_text
+test.bug53592 check status OK
+drop table bug53592;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug53674.result b/mysql-test/suite/innodb_plugin/r/innodb_bug53674.result
new file mode 100644
index 00000000000..c4021c2e7cd
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug53674.result
@@ -0,0 +1,11 @@
+create table bug53674(a int)engine=innodb;
+insert into bug53674 values (1),(2);
+start transaction;
+select * from bug53674 for update;
+a
+1
+2
+select * from bug53674 where a=(select a from bug53674 where a > 1);
+a
+2
+drop table bug53674;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result
new file mode 100644
index 00000000000..90ab812f2ae
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug54044.result
@@ -0,0 +1,3 @@
+CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
+AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
+ERROR HY000: Can't create table 'test.table_54044' (errno: -1)
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug54679.result b/mysql-test/suite/innodb_plugin/r/innodb_bug54679.result
new file mode 100644
index 00000000000..f98f0474233
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug54679.result
@@ -0,0 +1,91 @@
+SET GLOBAL innodb_file_format='Barracuda';
+SET GLOBAL innodb_file_per_table=ON;
+SET innodb_strict_mode=ON;
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+bug54679 Compressed row_format=COMPRESSED
+ALTER TABLE bug54679 ADD COLUMN b INT;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+bug54679 Compressed row_format=COMPRESSED
+DROP TABLE bug54679;
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+bug54679 Compact
+ALTER TABLE bug54679 KEY_BLOCK_SIZE=1;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+bug54679 Compressed key_block_size=1
+ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+DROP TABLE bug54679;
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+bug54679 Redundant row_format=REDUNDANT
+ALTER TABLE bug54679 KEY_BLOCK_SIZE=2;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+TABLE_NAME ROW_FORMAT CREATE_OPTIONS
+bug54679 Compressed row_format=REDUNDANT key_block_size=2
+SET GLOBAL innodb_file_format=Antelope;
+ALTER TABLE bug54679 KEY_BLOCK_SIZE=4;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+DROP TABLE bug54679;
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ERROR HY000: Can't create table 'test.bug54679' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
+Error 1005 Can't create table 'test.bug54679' (errno: 1478)
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB;
+SET GLOBAL innodb_file_format=Barracuda;
+SET GLOBAL innodb_file_per_table=OFF;
+ALTER TABLE bug54679 KEY_BLOCK_SIZE=4;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC;
+ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
+Error 1005 Can't create table '#sql-temporary' (errno: 1478)
+DROP TABLE bug54679;
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ERROR HY000: Can't create table 'test.bug54679' (errno: 1478)
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
+Error 1005 Can't create table 'test.bug54679' (errno: 1478)
+SET GLOBAL innodb_file_per_table=ON;
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+DROP TABLE bug54679;
+SET GLOBAL innodb_file_format=Antelope;
+SET GLOBAL innodb_file_format_check=Antelope;
+SET GLOBAL innodb_file_per_table=0;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_gis.result b/mysql-test/suite/innodb_plugin/r/innodb_gis.result
new file mode 100644
index 00000000000..c6c775afc9f
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_gis.result
@@ -0,0 +1,589 @@
+SET storage_engine=innodb;
+DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
+CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING);
+CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON);
+CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT);
+CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING);
+CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON);
+CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION);
+CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY);
+SHOW CREATE TABLE gis_point;
+Table Create Table
+gis_point CREATE TABLE `gis_point` (
+ `fid` int(11) NOT NULL AUTO_INCREMENT,
+ `g` point DEFAULT NULL,
+ PRIMARY KEY (`fid`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW FIELDS FROM gis_point;
+Field Type Null Key Default Extra
+fid int(11) NO PRI NULL auto_increment
+g point YES NULL
+SHOW FIELDS FROM gis_line;
+Field Type Null Key Default Extra
+fid int(11) NO PRI NULL auto_increment
+g linestring YES NULL
+SHOW FIELDS FROM gis_polygon;
+Field Type Null Key Default Extra
+fid int(11) NO PRI NULL auto_increment
+g polygon YES NULL
+SHOW FIELDS FROM gis_multi_point;
+Field Type Null Key Default Extra
+fid int(11) NO PRI NULL auto_increment
+g multipoint YES NULL
+SHOW FIELDS FROM gis_multi_line;
+Field Type Null Key Default Extra
+fid int(11) NO PRI NULL auto_increment
+g multilinestring YES NULL
+SHOW FIELDS FROM gis_multi_polygon;
+Field Type Null Key Default Extra
+fid int(11) NO PRI NULL auto_increment
+g multipolygon YES NULL
+SHOW FIELDS FROM gis_geometrycollection;
+Field Type Null Key Default Extra
+fid int(11) NO PRI NULL auto_increment
+g geometrycollection YES NULL
+SHOW FIELDS FROM gis_geometry;
+Field Type Null Key Default Extra
+fid int(11) NO PRI NULL auto_increment
+g geometry YES NULL
+INSERT INTO gis_point VALUES
+(101, PointFromText('POINT(10 10)')),
+(102, PointFromText('POINT(20 10)')),
+(103, PointFromText('POINT(20 20)')),
+(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+INSERT INTO gis_line VALUES
+(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))));
+INSERT INTO gis_polygon VALUES
+(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))));
+INSERT INTO gis_multi_point VALUES
+(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))));
+INSERT INTO gis_multi_line VALUES
+(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))));
+INSERT INTO gis_multi_polygon VALUES
+(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))));
+INSERT INTO gis_geometrycollection VALUES
+(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))));
+INSERT into gis_geometry SELECT * FROM gis_point;
+INSERT into gis_geometry SELECT * FROM gis_line;
+INSERT into gis_geometry SELECT * FROM gis_polygon;
+INSERT into gis_geometry SELECT * FROM gis_multi_point;
+INSERT into gis_geometry SELECT * FROM gis_multi_line;
+INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
+INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+SELECT fid, AsText(g) FROM gis_point ORDER by fid;
+fid AsText(g)
+101 POINT(10 10)
+102 POINT(20 10)
+103 POINT(20 20)
+104 POINT(10 20)
+SELECT fid, AsText(g) FROM gis_line ORDER by fid;
+fid AsText(g)
+105 LINESTRING(0 0,0 10,10 0)
+106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+107 LINESTRING(10 10,40 10)
+SELECT fid, AsText(g) FROM gis_polygon ORDER by fid;
+fid AsText(g)
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+110 POLYGON((0 0,30 0,30 30,0 0))
+SELECT fid, AsText(g) FROM gis_multi_point ORDER by fid;
+fid AsText(g)
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
+SELECT fid, AsText(g) FROM gis_multi_line ORDER by fid;
+fid AsText(g)
+114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+115 MULTILINESTRING((10 48,10 21,10 0))
+116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+SELECT fid, AsText(g) FROM gis_multi_polygon ORDER by fid;
+fid AsText(g)
+117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+SELECT fid, AsText(g) FROM gis_geometrycollection ORDER by fid;
+fid AsText(g)
+120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+SELECT fid, AsText(g) FROM gis_geometry ORDER by fid;
+fid AsText(g)
+101 POINT(10 10)
+102 POINT(20 10)
+103 POINT(20 20)
+104 POINT(10 20)
+105 LINESTRING(0 0,0 10,10 0)
+106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+107 LINESTRING(10 10,40 10)
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+110 POLYGON((0 0,30 0,30 30,0 0))
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
+114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+115 MULTILINESTRING((10 48,10 21,10 0))
+116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+SELECT fid, Dimension(g) FROM gis_geometry ORDER by fid;
+fid Dimension(g)
+101 0
+102 0
+103 0
+104 0
+105 1
+106 1
+107 1
+108 2
+109 2
+110 2
+111 0
+112 0
+113 0
+114 1
+115 1
+116 1
+117 2
+118 2
+119 2
+120 1
+121 1
+SELECT fid, GeometryType(g) FROM gis_geometry ORDER by fid;
+fid GeometryType(g)
+101 POINT
+102 POINT
+103 POINT
+104 POINT
+105 LINESTRING
+106 LINESTRING
+107 LINESTRING
+108 POLYGON
+109 POLYGON
+110 POLYGON
+111 MULTIPOINT
+112 MULTIPOINT
+113 MULTIPOINT
+114 MULTILINESTRING
+115 MULTILINESTRING
+116 MULTILINESTRING
+117 MULTIPOLYGON
+118 MULTIPOLYGON
+119 MULTIPOLYGON
+120 GEOMETRYCOLLECTION
+121 GEOMETRYCOLLECTION
+SELECT fid, IsEmpty(g) FROM gis_geometry ORDER by fid;
+fid IsEmpty(g)
+101 0
+102 0
+103 0
+104 0
+105 0
+106 0
+107 0
+108 0
+109 0
+110 0
+111 0
+112 0
+113 0
+114 0
+115 0
+116 0
+117 0
+118 0
+119 0
+120 0
+121 0
+SELECT fid, AsText(Envelope(g)) FROM gis_geometry ORDER by fid;
+fid AsText(Envelope(g))
+101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
+Warnings:
+Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
+SELECT fid, X(g) FROM gis_point ORDER by fid;
+fid X(g)
+101 10
+102 20
+103 20
+104 10
+SELECT fid, Y(g) FROM gis_point ORDER by fid;
+fid Y(g)
+101 10
+102 10
+103 20
+104 20
+explain extended select X(g),Y(g) FROM gis_point;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
+Warnings:
+Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
+SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
+fid AsText(StartPoint(g))
+105 POINT(0 0)
+106 POINT(10 10)
+107 POINT(10 10)
+SELECT fid, AsText(EndPoint(g)) FROM gis_line ORDER by fid;
+fid AsText(EndPoint(g))
+105 POINT(10 0)
+106 POINT(10 10)
+107 POINT(40 10)
+SELECT fid, GLength(g) FROM gis_line ORDER by fid;
+fid GLength(g)
+105 24.142135623731
+106 40
+107 30
+SELECT fid, NumPoints(g) FROM gis_line ORDER by fid;
+fid NumPoints(g)
+105 3
+106 5
+107 2
+SELECT fid, AsText(PointN(g, 2)) FROM gis_line ORDER by fid;
+fid AsText(PointN(g, 2))
+105 POINT(0 10)
+106 POINT(20 10)
+107 POINT(40 10)
+SELECT fid, IsClosed(g) FROM gis_line ORDER by fid;
+fid IsClosed(g)
+105 0
+106 1
+107 0
+explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
+SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
+fid AsText(Centroid(g))
+108 POINT(15 15)
+109 POINT(25.4166666666667 25.4166666666667)
+110 POINT(20 10)
+SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
+fid Area(g)
+108 100
+109 2400
+110 450
+SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon ORDER by fid;
+fid AsText(ExteriorRing(g))
+108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+110 LINESTRING(0 0,30 0,30 30,0 0)
+SELECT fid, NumInteriorRings(g) FROM gis_polygon ORDER by fid;
+fid NumInteriorRings(g)
+108 0
+109 1
+110 0
+SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon ORDER by fid;
+fid AsText(InteriorRingN(g, 1))
+108 NULL
+109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+110 NULL
+explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
+SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
+fid IsClosed(g)
+114 0
+115 0
+116 0
+SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
+fid AsText(Centroid(g))
+117 POINT(55.5885277530424 17.426536064114)
+118 POINT(55.5885277530424 17.426536064114)
+119 POINT(2 2)
+SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
+fid Area(g)
+117 1684.5
+118 1684.5
+119 4.5
+SELECT fid, NumGeometries(g) from gis_multi_point ORDER by fid;
+fid NumGeometries(g)
+111 4
+112 4
+113 2
+SELECT fid, NumGeometries(g) from gis_multi_line ORDER by fid;
+fid NumGeometries(g)
+114 2
+115 1
+116 2
+SELECT fid, NumGeometries(g) from gis_multi_polygon ORDER by fid;
+fid NumGeometries(g)
+117 2
+118 2
+119 1
+SELECT fid, NumGeometries(g) from gis_geometrycollection ORDER by fid;
+fid NumGeometries(g)
+120 2
+121 2
+explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
+fid AsText(GeometryN(g, 2))
+111 POINT(10 10)
+112 POINT(11 11)
+113 POINT(4 10)
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line ORDER by fid;
+fid AsText(GeometryN(g, 2))
+114 LINESTRING(16 0,16 23,16 48)
+115 NULL
+116 LINESTRING(2 5,5 8,21 7)
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon ORDER by fid;
+fid AsText(GeometryN(g, 2))
+117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+119 NULL
+SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection ORDER by fid;
+fid AsText(GeometryN(g, 2))
+120 LINESTRING(0 0,10 10)
+121 LINESTRING(3 6,7 9)
+SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection ORDER by fid;
+fid AsText(GeometryN(g, 1))
+120 POINT(0 0)
+121 POINT(44 6)
+explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
+SELECT g1.fid as first, g2.fid as second,
+Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+first second w c o e d t i r
+120 120 1 1 0 1 0 0 1 0
+120 121 0 0 1 0 0 0 1 0
+121 120 0 0 1 0 0 0 1 0
+121 121 1 1 0 1 0 0 1 0
+explain extended SELECT g1.fid as first, g2.fid as second,
+Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
+Warnings:
+Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
+DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+CREATE TABLE t1 (
+a INTEGER PRIMARY KEY AUTO_INCREMENT,
+gp point,
+ln linestring,
+pg polygon,
+mp multipoint,
+mln multilinestring,
+mpg multipolygon,
+gc geometrycollection,
+gm geometry
+);
+SHOW FIELDS FROM t1;
+Field Type Null Key Default Extra
+a int(11) NO PRI NULL auto_increment
+gp point YES NULL
+ln linestring YES NULL
+pg polygon YES NULL
+mp multipoint YES NULL
+mln multilinestring YES NULL
+mpg multipolygon YES NULL
+gc geometrycollection YES NULL
+gm geometry YES NULL
+ALTER TABLE t1 ADD fid INT;
+SHOW FIELDS FROM t1;
+Field Type Null Key Default Extra
+a int(11) NO PRI NULL auto_increment
+gp point YES NULL
+ln linestring YES NULL
+pg polygon YES NULL
+mp multipoint YES NULL
+mln multilinestring YES NULL
+mpg multipolygon YES NULL
+gc geometrycollection YES NULL
+gm geometry YES NULL
+fid int(11) YES NULL
+DROP TABLE t1;
+create table t1 (pk integer primary key auto_increment, a geometry not null);
+insert into t1 (a) values (GeomFromText('Point(1 2)'));
+insert into t1 (a) values ('Garbage');
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+insert IGNORE into t1 (a) values ('Garbage');
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+drop table t1;
+create table t1 (pk integer primary key auto_increment, fl geometry not null);
+insert into t1 (fl) values (1);
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+insert into t1 (fl) values (1.11);
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+insert into t1 (fl) values ("qwerty");
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+insert into t1 (fl) values (pointfromtext('point(1,1)'));
+ERROR 23000: Column 'fl' cannot be null
+drop table t1;
+End of 4.1 tests
+CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrcontains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrdisjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrequal
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrintersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbroverlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrtouches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrwithin
+big,center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+contains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+disjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+equals
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+intersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+overlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+touches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+within
+big,center
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+overlaps
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+overlaps
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+Overlaps(@horiz1, @vert1)
+0
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+Overlaps(@horiz1, @horiz2)
+1
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+Overlaps(@horiz1, @horiz3)
+0
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+Overlaps(@horiz1, @point1)
+0
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+Overlaps(@horiz1, @point2)
+0
+DROP TABLE t1;
+End of 5.0 tests
+CREATE TABLE t1 (p POINT);
+CREATE TABLE t2 (p POINT, INDEX(p));
+INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)'));
+INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)'));
+SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
+COUNT(*)
+1
+EXPLAIN
+SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref p p 28 const 1 Using where
+SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
+COUNT(*)
+1
+INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)'));
+INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)'));
+EXPLAIN
+SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
+COUNT(*)
+2
+EXPLAIN
+SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref p p 28 const 1 Using where
+SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
+COUNT(*)
+2
+EXPLAIN
+SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
+SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)');
+COUNT(*)
+2
+DROP TABLE t1, t2;
+End of 5.0 tests
+create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
+ERROR HY000: The used table type doesn't support SPATIAL indexes
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_lock_wait_timeout_1.result b/mysql-test/suite/innodb_plugin/r/innodb_lock_wait_timeout_1.result
new file mode 100644
index 00000000000..bd8760b8f79
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_lock_wait_timeout_1.result
@@ -0,0 +1,375 @@
+#
+# Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout
+# without error
+#
+CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB;
+INSERT INTO t1 (a,b) VALUES (1070109,99);
+CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB;
+INSERT INTO t2 (b,a) VALUES (7,1070109);
+SELECT * FROM t1;
+a b
+1070109 99
+BEGIN;
+SELECT b FROM t2 WHERE b=7 FOR UPDATE;
+b
+7
+BEGIN;
+SELECT b FROM t2 WHERE b=7 FOR UPDATE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7));
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT * FROM t1;
+a b
+1070109 99
+DROP TABLE t2, t1;
+# End of 5.0 tests
+#
+# Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT
+# FOR UPDATE
+#
+drop table if exists t1;
+create table t1 (a int primary key auto_increment,
+b int, index(b)) engine=innodb;
+insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+set autocommit=0;
+begin;
+select * from t1 where b=5 for update;
+a b
+5 5
+insert ignore into t1 (b) select a as b from t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Cleanup
+#
+commit;
+set autocommit=default;
+drop table t1;
+#
+# Bug #37183 insert ignore into .. select ... hangs
+# after deadlock was encountered
+#
+create table t1(id int primary key,v int)engine=innodb;
+insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
+create table t2 like t1;
+begin;
+update t1 set v=id*2 where id=1;
+begin;
+update t1 set v=id*2 where id=2;
+update t1 set v=id*2 where id=2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+insert ignore into t2 select * from t1 where id=1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+rollback;
+rollback;
+drop table t1, t2;
+#
+# Bug#41756 Strange error messages about locks from InnoDB
+#
+drop table if exists t1;
+# In the default transaction isolation mode, and/or with
+# innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row()
+# in InnoDB does nothing.
+# Thus in order to reproduce the condition that led to the
+# warning, one needs to relax isolation by either
+# setting a weaker tx_isolation value, or by turning on
+# the unsafe replication switch.
+# For testing purposes, choose to tweak the isolation level,
+# since it's settable at runtime, unlike
+# innodb_locks_unsafe_for_binlog, which is
+# only a command-line switch.
+#
+set @@session.tx_isolation="read-committed";
+# Prepare data. We need a table with a unique index,
+# for join_read_key to be used. The other column
+# allows to control what passes WHERE clause filter.
+create table t1 (a int primary key, b int) engine=innodb;
+# Let's make sure t1 has sufficient amount of rows
+# to exclude JT_ALL access method when reading it,
+# i.e. make sure that JT_EQ_REF(a) is always preferred.
+insert into t1 values (1,1), (2,null), (3,1), (4,1),
+(5,1), (6,1), (7,1), (8,1), (9,1), (10,1),
+(11,1), (12,1), (13,1), (14,1), (15,1),
+(16,1), (17,1), (18,1), (19,1), (20,1);
+#
+# Demonstrate that for the SELECT statement
+# used later in the test JT_EQ_REF access method is used.
+#
+explain
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+select 2 as a, 2 as b) as t2 for update;
+id 1
+select_type PRIMARY
+table <derived2>
+type ALL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows 2
+Extra
+id 1
+select_type PRIMARY
+table t1
+type eq_ref
+possible_keys PRIMARY
+key PRIMARY
+key_len 4
+ref t2.a
+rows 1
+Extra Using where
+id 2
+select_type DERIVED
+table NULL
+type NULL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra No tables used
+id 3
+select_type UNION
+table NULL
+type NULL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra No tables used
+id NULL
+select_type UNION RESULT
+table <union2,3>
+type ALL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra
+#
+# Demonstrate that the reported SELECT statement
+# no longer produces warnings.
+#
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+select 2 as a, 2 as b) as t2 for update;
+1
+commit;
+#
+# Demonstrate that due to lack of inter-sweep "reset" function,
+# we keep some non-matching records locked, even though we know
+# we could unlock them.
+# To do that, show that if there is only one distinct value
+# for a in t2 (a=2), we will keep record (2,null) in t1 locked.
+# But if we add another value for "a" to t2, say 6,
+# join_read_key cache will be pruned at least once,
+# and thus record (2, null) in t1 will get unlocked.
+#
+begin;
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+select 2 as a, 2 as b) as t2 for update;
+1
+#
+# Switching to connection con1
+# We should be able to delete all records from t1 except (2, null),
+# since they were not locked.
+begin;
+# Delete in series of 3 records so that full scan
+# is not used and we're not blocked on record (2,null)
+delete from t1 where a in (1,3,4);
+delete from t1 where a in (5,6,7);
+delete from t1 where a in (8,9,10);
+delete from t1 where a in (11,12,13);
+delete from t1 where a in (14,15,16);
+delete from t1 where a in (17,18);
+delete from t1 where a in (19,20);
+#
+# Record (2, null) is locked. This is actually unnecessary,
+# because the previous select returned no rows.
+# Just demonstrate the effect.
+#
+delete from t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+rollback;
+#
+# Switching to connection default
+#
+# Show that the original contents of t1 is intact:
+select * from t1;
+a b
+1 1
+2 NULL
+3 1
+4 1
+5 1
+6 1
+7 1
+8 1
+9 1
+10 1
+11 1
+12 1
+13 1
+14 1
+15 1
+16 1
+17 1
+18 1
+19 1
+20 1
+commit;
+#
+# Have a one more record in t2 to show that
+# if join_read_key cache is purned, the current
+# row under the cursor is unlocked (provided, this row didn't
+# match the partial WHERE clause, of course).
+# Sic: the result of this test dependent on the order of retrieval
+# of records --echo # from the derived table, if !
+# We use DELETE to disable the JOIN CACHE. This DELETE modifies no
+# records. It also should leave no InnoDB row locks.
+#
+begin;
+delete t1.* from t1 natural join (select 2 as a, 2 as b union all
+select 0 as a, 0 as b) as t2;
+# Demonstrate that nothing was deleted form t1
+select * from t1;
+a b
+1 1
+2 NULL
+3 1
+4 1
+5 1
+6 1
+7 1
+8 1
+9 1
+10 1
+11 1
+12 1
+13 1
+14 1
+15 1
+16 1
+17 1
+18 1
+19 1
+20 1
+#
+# Switching to connection con1
+begin;
+# Since there is another distinct record in the derived table
+# the previous matching record in t1 -- (2,null) -- was unlocked.
+delete from t1;
+# We will need the contents of the table again.
+rollback;
+select * from t1;
+a b
+1 1
+2 NULL
+3 1
+4 1
+5 1
+6 1
+7 1
+8 1
+9 1
+10 1
+11 1
+12 1
+13 1
+14 1
+15 1
+16 1
+17 1
+18 1
+19 1
+20 1
+commit;
+#
+# Switching to connection default
+rollback;
+begin;
+#
+# Before this patch, we could wrongly unlock a record
+# that was cached and later used in a join. Demonstrate that
+# this is no longer the case.
+# Sic: this test is also order-dependent (i.e. the
+# the bug would show up only if the first record in the union
+# is retreived and processed first.
+#
+# Verify that JT_EQ_REF is used.
+explain
+select 1 from t1 natural join (select 3 as a, 2 as b union all
+select 3 as a, 1 as b) as t2 for update;
+id 1
+select_type PRIMARY
+table <derived2>
+type ALL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows 2
+Extra
+id 1
+select_type PRIMARY
+table t1
+type eq_ref
+possible_keys PRIMARY
+key PRIMARY
+key_len 4
+ref t2.a
+rows 1
+Extra Using where
+id 2
+select_type DERIVED
+table NULL
+type NULL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra No tables used
+id 3
+select_type UNION
+table NULL
+type NULL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra No tables used
+id NULL
+select_type UNION RESULT
+table <union2,3>
+type ALL
+possible_keys NULL
+key NULL
+key_len NULL
+ref NULL
+rows NULL
+Extra
+# Lock the record.
+select 1 from t1 natural join (select 3 as a, 2 as b union all
+select 3 as a, 1 as b) as t2 for update;
+1
+1
+# Switching to connection con1
+#
+# We should not be able to delete record (3,1) from t1,
+# (previously it was possible).
+#
+delete from t1 where a=3;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Switching to connection default
+commit;
+set @@session.tx_isolation=default;
+drop table t1;
+#
+# End of 5.1 tests
+#
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_multi_update.result b/mysql-test/suite/innodb_plugin/r/innodb_multi_update.result
new file mode 100644
index 00000000000..7af9b030d1f
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_multi_update.result
@@ -0,0 +1,76 @@
+CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb;
+INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100;
+select * from bug38999_1;
+a b
+101 1
+102 2
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101;
+select * from bug38999_1;
+a b
+201 1
+102 2
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2;
+select * from bug38999_1;
+a b
+201 1
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+102 12
+112 12
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100;
+select * from bug38999_1;
+a b
+201 1
+103 5
+104 6
+106 6
+105 7
+107 7
+108 8
+109 9
+110 10
+111 11
+102 12
+112 12
+select * from bug38999_2;
+a b
+1 1
+2 2
+6 6
+7 7
+8 8
+9 9
+3 13
+4 14
+5 15
+drop table bug38999_1,bug38999_2;
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/suite/innodb_plugin/r/innodb_mysql.result
index 7a19d913231..53e979c350f 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_mysql.result
@@ -2296,6 +2296,28 @@ id select_type table type possible_keys key key_len ref rows Extra
drop table t1,t2;
#
#
+# Bug #39653: find_shortest_key in sql_select.cc does not consider
+# clustered primary keys
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT, f INT,
+KEY (b,c)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3),
+(4,4,4,4,4,4), (5,5,5,5,5,5), (6,6,6,6,6,6),
+(7,7,7,7,7,7), (8,8,8,8,8,8), (9,9,9,9,9,9),
+(11,11,11,11,11,11);
+EXPLAIN SELECT COUNT(*) FROM t1;
+id 1
+select_type SIMPLE
+table t1
+type index
+possible_keys NULL
+key PRIMARY
+key_len 4
+ref NULL
+rows 10
+Extra Using index
+DROP TABLE t1;
+#
# Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may
# corrupt definition at engine
#
@@ -2329,36 +2351,6 @@ Index_type BTREE
Comment
DROP TABLE t1;
#
-# Bug #53334: wrong result for outer join with impossible ON condition
-# (see the same test case for MyISAM in join.test)
-#
-create table t1 (id int primary key);
-create table t2 (id int);
-insert into t1 values (75);
-insert into t1 values (79);
-insert into t1 values (78);
-insert into t1 values (77);
-replace into t1 values (76);
-replace into t1 values (76);
-insert into t1 values (104);
-insert into t1 values (103);
-insert into t1 values (102);
-insert into t1 values (101);
-insert into t1 values (105);
-insert into t1 values (106);
-insert into t1 values (107);
-insert into t2 values (107),(75),(1000);
-select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
-where t2.id=75 and t1.id is null;
-id id
-NULL 75
-explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
-where t2.id=75 and t1.id is null;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
-drop table t1,t2;
-#
# Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when
# JOINed during an UPDATE
#
@@ -2386,4 +2378,16 @@ SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
SECOND(c)-@bug47453
0
DROP TABLE t1, t2;
+#
+# Bug#38999 valgrind warnings for update statement in function compare_record()
+#
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 values (1),(2),(3),(4),(5);
+INSERT INTO t2 values (1);
+SELECT * FROM t1 WHERE a = 2;
+a
+2
+UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1;
+DROP TABLE t1,t2;
End of 5.1 tests
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_mysql_rbk.result b/mysql-test/suite/innodb_plugin/r/innodb_mysql_rbk.result
new file mode 100644
index 00000000000..21ac4295325
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_mysql_rbk.result
@@ -0,0 +1,21 @@
+CREATE TABLE t1(a INT, b INT NOT NULL, PRIMARY KEY (a)) ENGINE=innodb
+DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE;
+a b
+3 3
+START TRANSACTION;
+UPDATE t1 SET b=b+12 WHERE a > 2 ORDER BY a;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ROLLBACK;
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE;
+a b
+3 3
+START TRANSACTION;
+UPDATE t1 SET b=10 WHERE a > 1 ORDER BY a;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT * FROM t1 WHERE b = 10;
+a b
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_notembedded.result b/mysql-test/suite/innodb_plugin/r/innodb_notembedded.result
new file mode 100644
index 00000000000..af332aba38a
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_notembedded.result
@@ -0,0 +1,23 @@
+drop table if exists t1;
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
+SET GLOBAL log_bin_trust_function_creators = 1;
+create table t1 (col1 integer primary key, col2 integer) engine=innodb;
+insert t1 values (1,100);
+create function f1 () returns integer begin
+declare var1 int;
+select col2 into var1 from t1 where col1=1 for update;
+return var1;
+end|
+start transaction;
+select f1();
+f1()
+100
+update t1 set col2=0 where col1=1;
+select * from t1;
+col1 col2
+1 100
+rollback;
+rollback;
+drop table t1;
+drop function f1;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_timeout_rollback.result b/mysql-test/suite/innodb_plugin/r/innodb_timeout_rollback.result
new file mode 100644
index 00000000000..e2da6ba8af7
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_timeout_rollback.result
@@ -0,0 +1,36 @@
+drop table if exists t1;
+show variables like 'innodb_rollback_on_timeout';
+Variable_name Value
+innodb_rollback_on_timeout ON
+create table t1 (a int unsigned not null primary key) engine = innodb;
+insert into t1 values (1);
+commit;
+begin work;
+insert into t1 values (2);
+select * from t1;
+a
+1
+2
+begin work;
+insert into t1 values (5);
+select * from t1;
+a
+1
+5
+insert into t1 values (2);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t1;
+a
+1
+commit;
+select * from t1;
+a
+1
+2
+commit;
+select * from t1;
+a
+1
+2
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/suite/innodb_plugin/t/disabled.def b/mysql-test/suite/innodb_plugin/t/disabled.def
new file mode 100644
index 00000000000..158dd7e7f67
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/disabled.def
@@ -0,0 +1,20 @@
+##############################################################################
+#
+# List the test cases that are to be disabled temporarily.
+#
+# Separate the test case name and the comment with ':'.
+#
+# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
+#
+# Do not use any TAB characters for whitespace.
+#
+##############################################################################
+
+innodb_bug48024 : Waiting for merge/fix from XtraDB
+innodb_bug53590 : Waiting for merge/fix from XtraDB
+innodb_bug53591 : Waiting for merge/fix from XtraDB
+innodb_bug53592 : Waiting for merge/fix from XtraDB
+innodb-use-sys-malloc : Waiting for bugfix from Percona for LP#612600
+innodb_bug53290 : Waiting for merge/fix from XtraDB
+innodb_bug54679 : Waiting for merge/fix from XtraDB
+innodb_bug52745 : Waiting for merge/fix from XtraDB
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-autoinc-optimize.test b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-optimize.test
new file mode 100644
index 00000000000..b359980768c
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-optimize.test
@@ -0,0 +1,19 @@
+-- source include/have_innodb_plugin.inc
+# embedded server ignores 'delayed', so skip this
+-- source include/not_embedded.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug 34286
+#
+create table t1(a int not null auto_increment primary key) engine=innodb;
+insert into t1 set a = -1;
+# NOTE: The database needs to be shutdown and restarted (here) for
+# the test to work. It's included for reference only.
+optimize table t1;
+
+--echo ==== clean up ====
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-ucs2.test b/mysql-test/suite/innodb_plugin/t/innodb-ucs2.test
new file mode 100644
index 00000000000..050a05675e7
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb-ucs2.test
@@ -0,0 +1,230 @@
+-- source include/have_innodb_plugin.inc
+-- source include/have_ucs2.inc
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+#
+# BUG 14056 Column prefix index on UTF-8 primary key column causes: Can't find record..
+#
+
+create table t1 (
+ a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+ a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+create table t1 (
+ a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+ a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+create table t1 (
+ a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+ a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+create table t1 (
+ a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+ a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+commit;
+
+#
+# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key
+#
+CREATE TABLE t1 (
+ ind enum('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ ind enum('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+CREATE TABLE t1 (
+ ind set('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ ind set('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+CREATE TABLE t1 (
+ ind bit not null,
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ ind bit not null,
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+select hex(ind),hex(string1) from t2 order by string1;
+drop table t1,t2;
+
+# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..'
+
+create table t2 (
+ a int, b char(10), filler char(10), primary key(a, b(2))
+) character set utf8 engine = innodb;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+ a int, b char(10), filler char(10), primary key(a, b(2))
+) character set ucs2 engine = innodb;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/suite/innodb_plugin/t/innodb.test b/mysql-test/suite/innodb_plugin/t/innodb.test
index 6cfc0f0cb9a..1b840f696c1 100644
--- a/mysql-test/suite/innodb_plugin/t/innodb.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb.test
@@ -16,6 +16,8 @@
-- source include/have_innodb_plugin.inc
let $MYSQLD_DATADIR= `select @@datadir`;
+let collation=utf8_unicode_ci;
+--source include/have_collation.inc
# Save the original values of some variables in order to be able to
# estimate how much they have changed during the tests. Previously this
@@ -915,33 +917,6 @@ UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
SELECT * from t1;
drop table t1;
-#
-# Test multi update with different join methods
-#
-
-CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
-CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
-INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
-INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-
-# Full join, without key
-update t1,t2 set t1.a=t1.a+100;
-select * from t1;
-
-# unique key
-update t1,t2 set t1.a=t1.a+100 where t1.a=101;
-select * from t1;
-
-# ref key
-update t1,t2 set t1.b=t1.b+10 where t1.b=2;
-select * from t1;
-
-# Range key (in t1)
-update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
-select * from t1;
-select * from t2;
-
-drop table t1,t2;
CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
SET AUTOCOMMIT=0;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt
new file mode 100644
index 00000000000..fad0da2ac2e
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt
@@ -0,0 +1 @@
+--innodb-autoinc-lock-mode=0
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero.test b/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero.test
new file mode 100644
index 00000000000..5a0cd5fa766
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero.test
@@ -0,0 +1,44 @@
+# This test runs with old-style locking, as:
+# --innodb-autoinc-lock-mode=0
+
+-- source include/have_innodb_plugin.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+
+#
+# Search on unique key
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ ggid varchar(32) binary DEFAULT '' NOT NULL,
+ email varchar(64) DEFAULT '' NOT NULL,
+ passwd varchar(32) binary DEFAULT '' NOT NULL,
+ PRIMARY KEY (id),
+ UNIQUE ggid (ggid)
+) ENGINE=innodb;
+
+insert into t1 (ggid,passwd) values ('test1','xxx');
+insert into t1 (ggid,passwd) values ('test2','yyy');
+-- error ER_DUP_ENTRY
+insert into t1 (ggid,passwd) values ('test2','this will fail');
+-- error ER_DUP_ENTRY
+insert into t1 (ggid,id) values ('this will fail',1);
+
+select * from t1 where ggid='test1';
+select * from t1 where passwd='xxx';
+select * from t1 where id=2;
+
+replace into t1 (ggid,id) values ('this will work',1);
+replace into t1 (ggid,passwd) values ('test2','this will work');
+-- error ER_DUP_ENTRY
+update t1 set id=100,ggid='test2' where id=1;
+select * from t1;
+select * from t1 where id=1;
+select * from t1 where id=999;
+drop table t1;
+
+--echo End of tests
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt
new file mode 100644
index 00000000000..8636d2d8734
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt
@@ -0,0 +1 @@
+--innodb --innodb_autoinc_lock_mode=0
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug30919.test b/mysql-test/suite/innodb_plugin/t/innodb_bug30919.test
new file mode 100644
index 00000000000..cc1358294e1
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug30919.test
@@ -0,0 +1,68 @@
+--source include/have_innodb_plugin.inc
+--source include/have_partition.inc
+--vertical_results
+let $engine_type= 'innodb';
+
+######## Creat Table Section #########
+use test;
+
+eval CREATE TABLE test.part_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT,
+ dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
+ fkid MEDIUMINT, filler VARCHAR(255),
+ PRIMARY KEY(id)) ENGINE=$engine_type
+ PARTITION BY RANGE(id)
+ SUBPARTITION BY hash(id) subpartitions 2
+ (PARTITION pa3 values less than (42),
+ PARTITION pa6 values less than (60),
+ PARTITION pa7 values less than (70),
+ PARTITION pa8 values less than (80),
+ PARTITION pa9 values less than (90),
+ PARTITION pa10 values less than (100),
+ PARTITION pa11 values less than MAXVALUE);
+
+######## Create SPs, Functions, Views and Triggers Section ##############
+
+delimiter |;
+
+CREATE PROCEDURE test.proc_part()
+BEGIN
+ DECLARE ins_count INT DEFAULT 1000;
+ DECLARE del_count INT;
+ DECLARE cur_user VARCHAR(255);
+ DECLARE local_uuid VARCHAR(255);
+ DECLARE local_time TIMESTAMP;
+
+ SET local_time= NOW();
+ SET cur_user= CURRENT_USER();
+ SET local_uuid= UUID();
+
+ WHILE ins_count > 0 DO
+ INSERT INTO test.part_tbl VALUES (NULL, NOW(), USER() , UUID(),
+ ins_count,'Going to test MBR for MySQL');
+ SET ins_count = ins_count - 1;
+ END WHILE;
+ SELECT MAX(id) FROM test.part_tbl INTO del_count;
+ WHILE del_count > 0 DO
+ DELETE FROM test.part_tbl WHERE id = del_count;
+ select count(*) as internal_count, del_count -- these two lines are for
+ FROM test.part_tbl; -- debug to show the problem
+ SET del_count = del_count - 2;
+ END WHILE;
+END|
+
+delimiter ;|
+
+############ Finish Setup Section ###################
+
+############ Test Section ###################
+--horizontal_results
+
+CALL test.proc_part();
+
+select count(*) as Part from test.part_tbl;
+
+###### CLEAN UP SECTION ##############
+
+DROP PROCEDURE test.proc_part;
+DROP TABLE test.part_tbl;
+
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug42419.test b/mysql-test/suite/innodb_plugin/t/innodb_bug42419.test
new file mode 100644
index 00000000000..2302e3c2233
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug42419.test
@@ -0,0 +1,78 @@
+#
+# Testcase for InnoDB
+# Bug#42419 Server crash with "Pure virtual method called" on two concurrent connections
+#
+
+--source include/not_embedded.inc
+--source include/have_innodb_plugin.inc
+
+let $innodb_lock_wait_timeout= query_get_value(SHOW VARIABLES LIKE 'innodb_lock_wait_timeout%', Value, 1);
+if (`SELECT $innodb_lock_wait_timeout < 10`)
+{
+ --echo # innodb_lock_wait_timeout must be >= 10 seconds
+ --echo # so that this test can work all time fine on an overloaded testing box
+ SHOW VARIABLES LIKE 'innodb_lock_wait_timeout';
+ exit;
+}
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+# First session
+connection default;
+
+
+--enable_warnings
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB;
+
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+COMMIT;
+SET AUTOCOMMIT = 0;
+
+CREATE TEMPORARY TABLE t1_tmp ( b INT );
+
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2;
+
+# Second session
+connect (user2,localhost,root,,,$MASTER_MYPORT,$MASTER_MYSOCK);
+
+SET AUTOCOMMIT = 0;
+
+CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int );
+INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
+
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
+send
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
+
+# The last update will wait for a lock held by the first session
+
+# First session
+connection default;
+
+# Poll till the UPDATE of the second session waits for lock
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Updating';
+--source include/wait_show_condition.inc
+
+# If the testing box is overloadeded and innodb_lock_wait_timeout is too small
+# we might get here ER_LOCK_WAIT_TIMEOUT.
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1;
+
+# Second session
+connection user2;
+--echo Reap the server message for connection user2 UPDATE t1 ...
+reap;
+
+# The server crashed when executing this UPDATE or the succeeding SQL command.
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
+
+connection default;
+disconnect user2;
+DROP TABLE t1;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug48024.test b/mysql-test/suite/innodb_plugin/t/innodb_bug48024.test
new file mode 100644
index 00000000000..fea3adf9216
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug48024.test
@@ -0,0 +1,22 @@
+# Bug #48024 Innodb doesn't work with multi-statements
+
+--source include/have_innodb_plugin.inc
+
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+# Bug #53644 InnoDB thinks that /*/ starts and ends a comment
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b);
+
+DROP TABLE bug48024,bug48024_b;
+
+# Work around Bug #53750 (failure in mysql-test-run --ps-protocol)
+-- disable_ps_protocol
+delimiter |;
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)|
+delimiter ;|
+
+DROP TABLE bug48024,bug48024_b;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug49164.test b/mysql-test/suite/innodb_plugin/t/innodb_bug49164.test
new file mode 100644
index 00000000000..a945bc681b6
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug49164.test
@@ -0,0 +1,47 @@
+-- source include/have_innodb_plugin.inc
+
+# Bug #49164 READ-COMMITTED reports "matched: 0" on compound PK
+# a duplicate of
+# Bug #52663 Lost update incrementing column value under READ COMMITTED
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+SET tx_isolation = 'READ-COMMITTED';
+
+CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
+ENGINE=InnoDB;
+
+insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
+
+begin;
+update bug49164 set c=7;
+select * from bug49164;
+rollback;
+select * from bug49164;
+begin;
+update bug49164 set c=7;
+
+connection con2;
+
+SET tx_isolation = 'READ-COMMITTED';
+begin;
+select * from bug49164;
+commit;
+begin;
+--send
+update bug49164 set c=6 where a=1 and b=1;
+
+connection con1;
+rollback;
+select * from bug49164;
+connection con2;
+reap;
+commit;
+connection con1;
+select * from bug49164;
+connection default;
+disconnect con1;
+disconnect con2;
+drop table bug49164;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug52745.test b/mysql-test/suite/innodb_plugin/t/innodb_bug52745.test
index b20a993a2d1..05ad630fbe1 100644
--- a/mysql-test/suite/innodb_plugin/t/innodb_bug52745.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug52745.test
@@ -1,4 +1,6 @@
-- source include/have_innodb_plugin.inc
+let collation=utf8_persian_ci;
+--source include/have_collation.inc
let $file_format=`select @@innodb_file_format`;
let $file_format_check=`select @@innodb_file_format_check`;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug53290.test b/mysql-test/suite/innodb_plugin/t/innodb_bug53290.test
new file mode 100644
index 00000000000..3f6b9b513f7
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53290.test
@@ -0,0 +1,22 @@
+-- source include/have_innodb_plugin.inc
+
+create table bug53290 (x bigint) engine=innodb;
+
+insert into bug53290 () values (),(),(),(),(),(),(),(),(),(),(),();
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+
+alter table bug53290 add unique index `idx` (x);
+
+drop table bug53290;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug53591.test b/mysql-test/suite/innodb_plugin/t/innodb_bug53591.test
new file mode 100644
index 00000000000..32871cad869
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53591.test
@@ -0,0 +1,25 @@
+#
+# XtraDB doesn't have this problem
+#
+-- source include/have_innodb_plugin.inc
+
+let $file_format=`select @@innodb_file_format`;
+let $file_format_check=`select @@innodb_file_format_check`;
+let $file_per_table=`select @@innodb_file_per_table`;
+
+SET GLOBAL innodb_file_format='Barracuda';
+SET GLOBAL innodb_file_per_table=on;
+
+set old_alter_table=0;
+
+CREATE TABLE bug53591(a text charset utf8 not null)
+ENGINE=InnoDB KEY_BLOCK_SIZE=1;
+-- error 139
+ALTER TABLE bug53591 ADD PRIMARY KEY(a(220));
+SHOW WARNINGS;
+
+DROP TABLE bug53591;
+
+EVAL SET GLOBAL innodb_file_format=$file_format;
+EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
+EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug53592.test b/mysql-test/suite/innodb_plugin/t/innodb_bug53592.test
new file mode 100644
index 00000000000..aec331e031b
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53592.test
@@ -0,0 +1,59 @@
+# Testcase for Bug #53592 - "crash replacing duplicates into
+# table after fast alter table added unique key". The fix is to make
+# sure index number lookup should go through "index translation table".
+
+--source include/have_innodb_plugin.inc
+
+# Use FIC for index creation
+set old_alter_table=0;
+
+create table bug53592(a int) engine=innodb row_format=compact;
+
+alter table bug53592 add column b text charset utf8;
+
+alter table bug53592 add column c blob not null;
+
+# Create a non-unique nonclustered index
+create index bug53592_b on bug53592(b(81));
+
+# Create a unique index, this unique index should have smaller
+# index number than bug53592_b, since unique index ranks higher
+# than regular index does
+create unique index bug53592_c on bug53592(c(1));
+
+# This will trigger a dup key error and will require fetching
+# the index number through a index structure for the error reporting.
+# To get the correct index number, the code should go through index
+# translation table. Otherwise, it will get the wrong index
+# number and later trigger a server crash.
+replace into bug53592 values (),();
+
+check table bug53592;
+
+drop table bug53592;
+
+# Running the same set of test when "old_alter_table" is turned on
+set old_alter_table=1;
+
+create table bug53592(a int) engine=innodb row_format=compact;
+
+alter table bug53592 add column b text charset utf8;
+
+alter table bug53592 add column c blob not null;
+
+# Create a non-unique nonclustered index
+create index bug53592_b on bug53592(b(81));
+
+# Create a unique index
+create unique index bug53592_c on bug53592(c(1));
+
+# This will trigger a dup key error and will require fetching
+# the index number through a index structure for the error reporting.
+# To get the correct index number, the code should go through index
+# translation table. Otherwise, it will get the wrong index
+# number and later trigger a server crash.
+replace into bug53592 values (),();
+
+check table bug53592;
+
+drop table bug53592;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt
new file mode 100644
index 00000000000..f1cfd7ab6c7
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt
@@ -0,0 +1 @@
+--log-bin --innodb-locks-unsafe-for-binlog --binlog-format=mixed
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug53674.test b/mysql-test/suite/innodb_plugin/t/innodb_bug53674.test
new file mode 100644
index 00000000000..e3cbf4466a7
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53674.test
@@ -0,0 +1,8 @@
+-- source include/have_innodb_plugin.inc
+
+create table bug53674(a int)engine=innodb;
+insert into bug53674 values (1),(2);
+start transaction;
+select * from bug53674 for update;
+select * from bug53674 where a=(select a from bug53674 where a > 1);
+drop table bug53674;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test
new file mode 100644
index 00000000000..58f60a54130
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug54044.test
@@ -0,0 +1,11 @@
+# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type
+# during create table, so it will not trigger assertion failure.
+
+--source include/have_innodb_plugin.inc
+
+# This 'create table' operation should fail because of
+# using NULL datatype
+--error ER_CANT_CREATE_TABLE
+CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
+ AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
+
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug54679.test b/mysql-test/suite/innodb_plugin/t/innodb_bug54679.test
new file mode 100644
index 00000000000..863d9847ac1
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug54679.test
@@ -0,0 +1,97 @@
+# Test Bug #54679 alter table causes compressed row_format to revert to compact
+
+--source include/have_innodb_plugin.inc
+
+let $file_format=`select @@innodb_file_format`;
+let $file_format_check=`select @@innodb_file_format_check`;
+let $file_per_table=`select @@innodb_file_per_table`;
+SET GLOBAL innodb_file_format='Barracuda';
+SET GLOBAL innodb_file_per_table=ON;
+SET innodb_strict_mode=ON;
+
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+
+# The ROW_FORMAT of the table should be preserved when it is not specified
+# in ALTER TABLE.
+ALTER TABLE bug54679 ADD COLUMN b INT;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+
+DROP TABLE bug54679;
+
+# Check that the ROW_FORMAT conversion to/from COMPRESSED works.
+
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+
+# KEY_BLOCK_SIZE implies COMPRESSED.
+ALTER TABLE bug54679 KEY_BLOCK_SIZE=1;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+DROP TABLE bug54679;
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+
+ALTER TABLE bug54679 KEY_BLOCK_SIZE=2;
+SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
+WHERE TABLE_NAME='bug54679';
+
+# This prevents other than REDUNDANT or COMPACT ROW_FORMAT for new tables.
+SET GLOBAL innodb_file_format=Antelope;
+
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE bug54679 KEY_BLOCK_SIZE=4;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+DROP TABLE bug54679;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB;
+
+SET GLOBAL innodb_file_format=Barracuda;
+# This will prevent ROW_FORMAT=COMPRESSED, because the system tablespace
+# cannot be compressed.
+SET GLOBAL innodb_file_per_table=OFF;
+
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE bug54679 KEY_BLOCK_SIZE=4;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+DROP TABLE bug54679;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+SHOW WARNINGS;
+SET GLOBAL innodb_file_per_table=ON;
+CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+DROP TABLE bug54679;
+
+EVAL SET GLOBAL innodb_file_format=$file_format;
+EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
+EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_gis.test b/mysql-test/suite/innodb_plugin/t/innodb_gis.test
new file mode 100644
index 00000000000..ad1d081f29c
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_gis.test
@@ -0,0 +1,10 @@
+--source include/have_innodb_plugin.inc
+SET storage_engine=innodb;
+--source include/gis_generic.inc
+--source include/gis_keys.inc
+
+#
+# Bug #15680 (SPATIAL key in innodb)
+#
+--error ER_TABLE_CANT_HANDLE_SPKEYS
+create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt
new file mode 100644
index 00000000000..462f8fbe828
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt
@@ -0,0 +1 @@
+--innodb_lock_wait_timeout=1
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1.test b/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1.test
new file mode 100644
index 00000000000..d7272779bdd
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1.test
@@ -0,0 +1,264 @@
+--source include/have_innodb_plugin.inc
+
+--echo #
+--echo # Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout
+--echo # without error
+--echo #
+
+CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB;
+
+INSERT INTO t1 (a,b) VALUES (1070109,99);
+
+CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB;
+
+INSERT INTO t2 (b,a) VALUES (7,1070109);
+
+SELECT * FROM t1;
+
+BEGIN;
+
+SELECT b FROM t2 WHERE b=7 FOR UPDATE;
+
+CONNECT (addconroot, localhost, root,,);
+CONNECTION addconroot;
+
+BEGIN;
+
+--error ER_LOCK_WAIT_TIMEOUT
+SELECT b FROM t2 WHERE b=7 FOR UPDATE;
+
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7));
+
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7);
+
+--error ER_LOCK_WAIT_TIMEOUT
+DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7);
+
+SELECT * FROM t1;
+
+CONNECTION default;
+DISCONNECT addconroot;
+
+DROP TABLE t2, t1;
+
+--echo # End of 5.0 tests
+
+--echo #
+--echo # Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT
+--echo # FOR UPDATE
+--echo #
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int primary key auto_increment,
+ b int, index(b)) engine=innodb;
+insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+set autocommit=0;
+begin;
+select * from t1 where b=5 for update;
+connect (con1, localhost, root,,);
+connection con1;
+--error ER_LOCK_WAIT_TIMEOUT
+insert ignore into t1 (b) select a as b from t1;
+connection default;
+--echo # Cleanup
+--echo #
+disconnect con1;
+commit;
+set autocommit=default;
+drop table t1;
+
+--echo #
+--echo # Bug #37183 insert ignore into .. select ... hangs
+--echo # after deadlock was encountered
+--echo #
+connect (con1,localhost,root,,);
+create table t1(id int primary key,v int)engine=innodb;
+insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
+create table t2 like t1;
+
+--connection con1
+begin;
+update t1 set v=id*2 where id=1;
+
+--connection default
+begin;
+update t1 set v=id*2 where id=2;
+
+--connection con1
+--error 1205
+update t1 set v=id*2 where id=2;
+
+--connection default
+--error 1205
+insert ignore into t2 select * from t1 where id=1;
+rollback;
+
+--connection con1
+rollback;
+
+--connection default
+disconnect con1;
+drop table t1, t2;
+
+
+--echo #
+--echo # Bug#41756 Strange error messages about locks from InnoDB
+--echo #
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+--echo # In the default transaction isolation mode, and/or with
+--echo # innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row()
+--echo # in InnoDB does nothing.
+--echo # Thus in order to reproduce the condition that led to the
+--echo # warning, one needs to relax isolation by either
+--echo # setting a weaker tx_isolation value, or by turning on
+--echo # the unsafe replication switch.
+--echo # For testing purposes, choose to tweak the isolation level,
+--echo # since it's settable at runtime, unlike
+--echo # innodb_locks_unsafe_for_binlog, which is
+--echo # only a command-line switch.
+--echo #
+set @@session.tx_isolation="read-committed";
+
+--echo # Prepare data. We need a table with a unique index,
+--echo # for join_read_key to be used. The other column
+--echo # allows to control what passes WHERE clause filter.
+create table t1 (a int primary key, b int) engine=innodb;
+--echo # Let's make sure t1 has sufficient amount of rows
+--echo # to exclude JT_ALL access method when reading it,
+--echo # i.e. make sure that JT_EQ_REF(a) is always preferred.
+insert into t1 values (1,1), (2,null), (3,1), (4,1),
+ (5,1), (6,1), (7,1), (8,1), (9,1), (10,1),
+ (11,1), (12,1), (13,1), (14,1), (15,1),
+ (16,1), (17,1), (18,1), (19,1), (20,1);
+--echo #
+--echo # Demonstrate that for the SELECT statement
+--echo # used later in the test JT_EQ_REF access method is used.
+--echo #
+--vertical_results
+explain
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+ select 2 as a, 2 as b) as t2 for update;
+--horizontal_results
+--echo #
+--echo # Demonstrate that the reported SELECT statement
+--echo # no longer produces warnings.
+--echo #
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+ select 2 as a, 2 as b) as t2 for update;
+commit;
+--echo #
+--echo # Demonstrate that due to lack of inter-sweep "reset" function,
+--echo # we keep some non-matching records locked, even though we know
+--echo # we could unlock them.
+--echo # To do that, show that if there is only one distinct value
+--echo # for a in t2 (a=2), we will keep record (2,null) in t1 locked.
+--echo # But if we add another value for "a" to t2, say 6,
+--echo # join_read_key cache will be pruned at least once,
+--echo # and thus record (2, null) in t1 will get unlocked.
+--echo #
+begin;
+select 1 from t1 natural join (select 2 as a, 1 as b union all
+ select 2 as a, 2 as b) as t2 for update;
+connect (con1,localhost,root,,);
+--echo #
+--echo # Switching to connection con1
+connection con1;
+--echo # We should be able to delete all records from t1 except (2, null),
+--echo # since they were not locked.
+begin;
+--echo # Delete in series of 3 records so that full scan
+--echo # is not used and we're not blocked on record (2,null)
+delete from t1 where a in (1,3,4);
+delete from t1 where a in (5,6,7);
+delete from t1 where a in (8,9,10);
+delete from t1 where a in (11,12,13);
+delete from t1 where a in (14,15,16);
+delete from t1 where a in (17,18);
+delete from t1 where a in (19,20);
+--echo #
+--echo # Record (2, null) is locked. This is actually unnecessary,
+--echo # because the previous select returned no rows.
+--echo # Just demonstrate the effect.
+--echo #
+--error ER_LOCK_WAIT_TIMEOUT
+delete from t1;
+rollback;
+--echo #
+--echo # Switching to connection default
+connection default;
+--echo #
+--echo # Show that the original contents of t1 is intact:
+select * from t1;
+commit;
+--echo #
+--echo # Have a one more record in t2 to show that
+--echo # if join_read_key cache is purned, the current
+--echo # row under the cursor is unlocked (provided, this row didn't
+--echo # match the partial WHERE clause, of course).
+--echo # Sic: the result of this test dependent on the order of retrieval
+--echo # of records --echo # from the derived table, if !
+--echo # We use DELETE to disable the JOIN CACHE. This DELETE modifies no
+--echo # records. It also should leave no InnoDB row locks.
+--echo #
+begin;
+delete t1.* from t1 natural join (select 2 as a, 2 as b union all
+ select 0 as a, 0 as b) as t2;
+--echo # Demonstrate that nothing was deleted form t1
+select * from t1;
+--echo #
+--echo # Switching to connection con1
+connection con1;
+begin;
+--echo # Since there is another distinct record in the derived table
+--echo # the previous matching record in t1 -- (2,null) -- was unlocked.
+delete from t1;
+--echo # We will need the contents of the table again.
+rollback;
+select * from t1;
+commit;
+--echo #
+--echo # Switching to connection default
+connection default;
+rollback;
+begin;
+--echo #
+--echo # Before this patch, we could wrongly unlock a record
+--echo # that was cached and later used in a join. Demonstrate that
+--echo # this is no longer the case.
+--echo # Sic: this test is also order-dependent (i.e. the
+--echo # the bug would show up only if the first record in the union
+--echo # is retreived and processed first.
+--echo #
+--echo # Verify that JT_EQ_REF is used.
+--vertical_results
+explain
+select 1 from t1 natural join (select 3 as a, 2 as b union all
+ select 3 as a, 1 as b) as t2 for update;
+--horizontal_results
+--echo # Lock the record.
+select 1 from t1 natural join (select 3 as a, 2 as b union all
+ select 3 as a, 1 as b) as t2 for update;
+--echo # Switching to connection con1
+connection con1;
+--echo #
+--echo # We should not be able to delete record (3,1) from t1,
+--echo # (previously it was possible).
+--echo #
+--error ER_LOCK_WAIT_TIMEOUT
+delete from t1 where a=3;
+--echo # Switching to connection default
+connection default;
+commit;
+
+disconnect con1;
+set @@session.tx_isolation=default;
+drop table t1;
+
+--echo #
+--echo # End of 5.1 tests
+--echo #
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test b/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test
new file mode 100644
index 00000000000..890889301e6
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test
@@ -0,0 +1,29 @@
+-- source include/have_innodb_plugin.inc
+
+#
+# Test multi update with different join methods
+#
+
+CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb;
+INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+
+# Full join, without key
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100;
+select * from bug38999_1;
+
+# unique key
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101;
+select * from bug38999_1;
+
+# ref key
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2;
+select * from bug38999_1;
+
+# Range key (in bug38999_1)
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100;
+select * from bug38999_1;
+select * from bug38999_2;
+
+drop table bug38999_1,bug38999_2;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt
new file mode 100644
index 00000000000..205c733455d
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt
@@ -0,0 +1 @@
+--innodb-lock-wait-timeout=2
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/suite/innodb_plugin/t/innodb_mysql.test
index ada4323dcee..5adaba43050 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql.test
@@ -2,12 +2,12 @@
#
# Last update:
# 2006-07-26 ML test refactored (MySQL 5.1)
-# main testing code t/innodb_mysql.test -> include/mix1.inc
+# main testing code t/innodb_mysql.test -> include/mix1.inc
#
-# Slow test, don't run during staging part
--- source include/not_staging.inc
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
+-- source include/have_query_cache.inc
+
let $engine_type= InnoDB;
let $other_engine_type= MEMORY;
# InnoDB does support FOREIGN KEYFOREIGN KEYs
@@ -561,6 +561,23 @@ drop table t1,t2;
--echo #
+--echo # Bug #39653: find_shortest_key in sql_select.cc does not consider
+--echo # clustered primary keys
+--echo #
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, d INT, e INT, f INT,
+ KEY (b,c)) ENGINE=INNODB;
+
+INSERT INTO t1 VALUES (1,1,1,1,1,1), (2,2,2,2,2,2), (3,3,3,3,3,3),
+ (4,4,4,4,4,4), (5,5,5,5,5,5), (6,6,6,6,6,6),
+ (7,7,7,7,7,7), (8,8,8,8,8,8), (9,9,9,9,9,9),
+ (11,11,11,11,11,11);
+
+--query_vertical EXPLAIN SELECT COUNT(*) FROM t1
+
+DROP TABLE t1;
+
+--echo #
--echo # Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may
--echo # corrupt definition at engine
--echo #
@@ -574,36 +591,6 @@ ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b);
DROP TABLE t1;
---echo #
---echo # Bug #53334: wrong result for outer join with impossible ON condition
---echo # (see the same test case for MyISAM in join.test)
---echo #
-
-create table t1 (id int primary key);
-create table t2 (id int);
-
-insert into t1 values (75);
-insert into t1 values (79);
-insert into t1 values (78);
-insert into t1 values (77);
-replace into t1 values (76);
-replace into t1 values (76);
-insert into t1 values (104);
-insert into t1 values (103);
-insert into t1 values (102);
-insert into t1 values (101);
-insert into t1 values (105);
-insert into t1 values (106);
-insert into t1 values (107);
-
-insert into t2 values (107),(75),(1000);
-
-select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
- where t2.id=75 and t1.id is null;
-explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
- where t2.id=75 and t1.id is null;
-
-drop table t1,t2;
--echo #
--echo # Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when
@@ -633,4 +620,18 @@ SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
DROP TABLE t1, t2;
+--echo #
+--echo # Bug#38999 valgrind warnings for update statement in function compare_record()
+--echo #
+
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 values (1),(2),(3),(4),(5);
+INSERT INTO t2 values (1);
+
+SELECT * FROM t1 WHERE a = 2;
+UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1;
+
+DROP TABLE t1,t2;
+
--echo End of 5.1 tests
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt
new file mode 100644
index 00000000000..0e400f9c36b
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt
@@ -0,0 +1 @@
+--innodb_lock_wait_timeout=1 --innodb_rollback_on_timeout=1
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk.test b/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk.test
new file mode 100644
index 00000000000..d8d56adc448
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk.test
@@ -0,0 +1,35 @@
+-- source include/have_innodb_plugin.inc
+
+#
+# Bug #41453: Assertion `m_status == DA_ERROR' failed in
+# Diagnostics_area::sql_errno
+#
+
+CREATE TABLE t1(a INT, b INT NOT NULL, PRIMARY KEY (a)) ENGINE=innodb
+DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
+CONNECT (con1,localhost,root,,);
+CONNECT (con2,localhost,root,,);
+
+CONNECTION con1;
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE;
+CONNECTION con2;
+START TRANSACTION;
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t1 SET b=b+12 WHERE a > 2 ORDER BY a;
+ROLLBACK;
+
+CONNECTION con1;
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE;
+CONNECTION con2;
+START TRANSACTION;
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t1 SET b=10 WHERE a > 1 ORDER BY a;
+SELECT * FROM t1 WHERE b = 10;
+
+CONNECTION default;
+DISCONNECT con1;
+DISCONNECT con2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_notembedded.test b/mysql-test/suite/innodb_plugin/t/innodb_notembedded.test
new file mode 100644
index 00000000000..2afe9079ba8
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_notembedded.test
@@ -0,0 +1,50 @@
+-- source include/not_embedded.inc
+-- source include/have_innodb_plugin.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+
+
+#
+# BUG#11238 - in prelocking mode SELECT .. FOR UPDATE is changed to
+# non-blocking SELECT
+#
+SET GLOBAL log_bin_trust_function_creators = 1;
+create table t1 (col1 integer primary key, col2 integer) engine=innodb;
+insert t1 values (1,100);
+delimiter |;
+create function f1 () returns integer begin
+declare var1 int;
+select col2 into var1 from t1 where col1=1 for update;
+return var1;
+end|
+delimiter ;|
+start transaction;
+select f1();
+connection b;
+send update t1 set col2=0 where col1=1;
+connection default;
+select * from t1;
+connection a;
+rollback;
+connection b;
+reap;
+rollback;
+
+# Cleanup
+connection a;
+disconnect a;
+--source include/wait_until_disconnected.inc
+connection b;
+disconnect b;
+--source include/wait_until_disconnected.inc
+connection default;
+drop table t1;
+drop function f1;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt
new file mode 100644
index 00000000000..50921bb4df0
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt
@@ -0,0 +1 @@
+--innodb_lock_wait_timeout=2 --innodb_rollback_on_timeout
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback.test b/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback.test
new file mode 100644
index 00000000000..cc7ab9ee0bd
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback.test
@@ -0,0 +1,5 @@
+-- source include/have_innodb_plugin.inc
+
+--source include/innodb_rollback_on_timeout.inc
+
+--echo End of 5.0 tests
diff --git a/mysql-test/suite/manual/r/rpl_replication_delay.result b/mysql-test/suite/manual/r/rpl_replication_delay.result
index a8fa6ce8265..73dd77cc647 100644
--- a/mysql-test/suite/manual/r/rpl_replication_delay.result
+++ b/mysql-test/suite/manual/r/rpl_replication_delay.result
@@ -4,45 +4,8 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-show slave status /* Second_behind reports 0 */;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port 9306
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos 106
-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 106
-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
+# Second_behind reports 0
Seconds_Behind_Master 0
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
@@ -50,87 +13,13 @@ create table t1 (f1 int);
flush logs /* contaminate rli->last_master_timestamp */;
lock table t1 write;
insert into t1 values (1);
-show slave status /* bug emulated: reports slave threads starting time about 3*3 not 3 secs */;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port 9306
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos 367
-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 279
-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
+# bug emulated: reports slave threads starting time about 3*3 not 3 secs
Seconds_Behind_Master 9
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
unlock tables;
flush logs /* this time rli->last_master_timestamp is not affected */;
lock table t1 write;
insert into t1 values (2);
-show slave status /* reports the correct diff with master query time about 3+3 secs */;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port 9306
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos 455
-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 367
-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
+# reports the correct diff with master query time about 3+3 secs
Seconds_Behind_Master 7
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
unlock tables;
drop table t1;
diff --git a/mysql-test/suite/manual/t/rpl_replication_delay.test b/mysql-test/suite/manual/t/rpl_replication_delay.test
index 8230698c8f9..fc1db9bfe18 100644
--- a/mysql-test/suite/manual/t/rpl_replication_delay.test
+++ b/mysql-test/suite/manual/t/rpl_replication_delay.test
@@ -10,9 +10,9 @@ source include/master-slave.inc;
connection master;
#connection slave;
sync_slave_with_master;
---replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
---replace_column 1 # 8 # 9 # 23 #
---query_vertical show slave status /* Second_behind reports 0 */;
+--echo # Second_behind reports 0
+let $status_items= Seconds_Behind_Master;
+source include/show_slave_status.inc;
sleep 3;
### bug emulation
@@ -35,9 +35,8 @@ insert into t1 values (1);
sleep 3;
connection slave;
---replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
---replace_column 1 # 8 # 9 # 23 #
---query_vertical show slave status /* bug emulated: reports slave threads starting time about 3*3 not 3 secs */;
+--echo # bug emulated: reports slave threads starting time about 3*3 not 3 secs
+source include/show_slave_status.inc;
unlock tables;
connection master;
@@ -55,9 +54,8 @@ insert into t1 values (2);
sleep 3;
connection slave;
---replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
---replace_column 1 # 8 # 9 # 23 #
---query_vertical show slave status /* reports the correct diff with master query time about 3+3 secs */;
+--echo # reports the correct diff with master query time about 3+3 secs
+source include/show_slave_status.inc;
unlock tables;
connection master;
diff --git a/mysql-test/suite/maria/r/maria-recovery2.result b/mysql-test/suite/maria/r/maria-recovery2.result
index 88db518254f..bca6d0d7c74 100644
--- a/mysql-test/suite/maria/r/maria-recovery2.result
+++ b/mysql-test/suite/maria/r/maria-recovery2.result
@@ -136,7 +136,7 @@ ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t_corrupted1 extended;
Table Op Msg_type Msg_text
-mysqltest.t_corrupted1 check warning Table is marked as crashed and last repair failed
+mysqltest.t_corrupted1 check warning Last repair was aborted before finishing
mysqltest.t_corrupted1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
diff --git a/mysql-test/suite/maria/r/maria.result b/mysql-test/suite/maria/r/maria.result
index 5e33c3fa423..5d7a5fec78b 100644
--- a/mysql-test/suite/maria/r/maria.result
+++ b/mysql-test/suite/maria/r/maria.result
@@ -2600,3 +2600,10 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+Create table t1 (a int) engine="aria";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0
+drop table t1;
diff --git a/mysql-test/suite/maria/t/maria.test b/mysql-test/suite/maria/t/maria.test
index c40dde5952b..35ccb6263e3 100644
--- a/mysql-test/suite/maria/t/maria.test
+++ b/mysql-test/suite/maria/t/maria.test
@@ -1873,6 +1873,14 @@ insert into t1 values(1,repeat('a',100), repeat('b',657860));
check table t1;
drop table t1;
+#
+# Check we can create a table with the 'Aria' alias
+#
+
+Create table t1 (a int) engine="aria";
+show create table t1;
+drop table t1;
+
# Set defaults back
--disable_result_log
--disable_query_log
diff --git a/mysql-test/suite/ndb_team/r/rpl_ndb_extraColMaster.result b/mysql-test/suite/ndb_team/r/rpl_ndb_extraColMaster.result
index 97300e7131b..fb0324bc89e 100644
--- a/mysql-test/suite/ndb_team/r/rpl_ndb_extraColMaster.result
+++ b/mysql-test/suite/ndb_team/r/rpl_ndb_extraColMaster.result
@@ -91,49 +91,7 @@ f1 f2 f3 f4
27 27 27 next
29 29 29 second
30 30 30 next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-
+Checking that both slave threads are running.
***** Testing Altering table def scenario *****
@@ -454,7 +412,9 @@ f1 f2 f3 f4
update t31 set f5=555555555555555 where f3=6;
update t31 set f2=2 where f3=2;
update t31 set f1=NULL where f3=1;
-update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
+update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
+Warnings:
+Warning 1048 Column 'f3' cannot be null
** Delete from Master **
@@ -463,50 +423,12 @@ delete from t2;
delete from t3;
delete from t4;
delete from t31;
+select * from t31;
+f1 f2 f3 f4
** Check slave status **
-select * from t31;
-f1 f2 f3 f4
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
****************************************
* columns in master at middle of table *
@@ -539,50 +461,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t10 ***
DROP TABLE t10;
@@ -614,50 +499,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t11 ***
DROP TABLE t11;
@@ -768,45 +616,7 @@ c1 c3 hex(c4) c5 c6
************
* Bug30415 *
************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1091
-Last_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -854,45 +664,7 @@ c1 hex(c4) c5 c6 c7 c2
*** Expect slave to fail with Error 1054 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1054
-Last_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -940,45 +712,7 @@ c1 hex(c4) c5 c6 c7
*** BUG 30434 ***
*****************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1072
-Last_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-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 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)'
+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)'
STOP SLAVE;
RESET SLAVE;
@@ -1230,49 +964,7 @@ f1 f2 f3 f4
27 27 27 next
29 29 29 second
30 30 30 next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-
+Checking that both slave threads are running.
***** Testing Altering table def scenario *****
@@ -1593,7 +1285,9 @@ f1 f2 f3 f4
update t31 set f5=555555555555555 where f3=6;
update t31 set f2=2 where f3=2;
update t31 set f1=NULL where f3=1;
-update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
+update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
+Warnings:
+Warning 1048 Column 'f3' cannot be null
** Delete from Master **
@@ -1602,50 +1296,12 @@ delete from t2;
delete from t3;
delete from t4;
delete from t31;
+select * from t31;
+f1 f2 f3 f4
** Check slave status **
-select * from t31;
-f1 f2 f3 f4
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
****************************************
* columns in master at middle of table *
@@ -1678,50 +1334,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t10 ***
DROP TABLE t10;
@@ -1753,50 +1372,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t11 ***
DROP TABLE t11;
@@ -1907,45 +1489,7 @@ c1 c3 hex(c4) c5 c6
************
* Bug30415 *
************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1091
-Last_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -1993,45 +1537,7 @@ c1 hex(c4) c5 c6 c7 c2
*** Expect slave to fail with Error 1054 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1054
-Last_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -2079,45 +1585,7 @@ c1 hex(c4) c5 c6 c7
*** BUG 30434 ***
*****************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1072
-Last_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-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 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)'
+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)'
STOP SLAVE;
RESET SLAVE;
diff --git a/mysql-test/suite/ndb_team/r/rpl_ndb_mix_innodb.result b/mysql-test/suite/ndb_team/r/rpl_ndb_mix_innodb.result
index f9c077f38da..203a59b4613 100644
--- a/mysql-test/suite/ndb_team/r/rpl_ndb_mix_innodb.result
+++ b/mysql-test/suite/ndb_team/r/rpl_ndb_mix_innodb.result
@@ -26,21 +26,21 @@ from mysql.ndb_apply_status;
# since insert is done with transactional engine, expect a BEGIN
# at <start_pos>
-show binlog events from <start_pos> limit 1;
+show binlog events from <binlog_start> limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 <start_pos> Query 1 # BEGIN
+master-bin.000001 # Query # # BEGIN
# Now the insert, one step after
-show binlog events from <start_pos> limit 1,1;
+show binlog events from <binlog_start> limit 1,1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; insert into t1 values (1,2)
+master-bin.000001 # Query # # use `test`; insert into t1 values (1,2)
# and the COMMIT should be at <end_pos>
-show binlog events from <start_pos> limit 2,1;
+show binlog events from <binlog_start> limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
+master-bin.000001 # Xid # # COMMIT /* XID */
begin;
insert into t1 values (2,3);
@@ -51,18 +51,18 @@ select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
from mysql.ndb_apply_status;
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
<log_name> <start_pos> <end_pos>
-show binlog events from <start_pos> limit 1;
+show binlog events from <binlog_start> limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 <start_pos> Query 1 # BEGIN
+master-bin.000001 # Query # # BEGIN
-show binlog events from <start_pos> limit 1,2;
+show binlog events from <binlog_start> limit 1,2;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; insert into t1 values (2,3)
master-bin.000001 # Query # # use `test`; insert into t2 values (3,4)
-show binlog events from <start_pos> limit 3,1;
+show binlog events from <binlog_start> limit 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
+master-bin.000001 # Xid # # COMMIT /* XID */
DROP TABLE test.t1, test.t2;
SHOW TABLES;
diff --git a/mysql-test/suite/parts/r/optimizer.result b/mysql-test/suite/parts/r/optimizer.result
new file mode 100644
index 00000000000..cdf0b2b83dc
--- /dev/null
+++ b/mysql-test/suite/parts/r/optimizer.result
@@ -0,0 +1,45 @@
+drop table if exists t1,t2;
+#
+# Bug#50939: Loose Index Scan unduly relies on engine to remember range
+# endpoints
+#
+CREATE TABLE t1 (
+a INT,
+b INT,
+KEY ( a, b )
+) PARTITION BY HASH (a) PARTITIONS 1;
+CREATE TABLE t2 (
+a INT,
+b INT,
+KEY ( a, b )
+);
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
+INSERT INTO t1 SELECT a + 10, b + 10 FROM t1;
+INSERT INTO t1 SELECT a + 20, b + 20 FROM t1;
+INSERT INTO t1 SELECT a + 40, b + 40 FROM t1;
+INSERT INTO t2 SELECT * FROM t1;
+# plans should be identical
+EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by
+EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by
+FLUSH status;
+SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a;
+a MAX(b)
+10 10
+# Should be no more than 4 reads.
+SHOW status LIKE 'handler_read_key';
+Variable_name Value
+Handler_read_key 4
+FLUSH status;
+SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
+a MAX(b)
+10 10
+# Should be no more than 4 reads.
+SHOW status LIKE 'handler_read_key';
+Variable_name Value
+Handler_read_key 4
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/parts/r/partition_debug_sync_innodb.result b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result
new file mode 100644
index 00000000000..70939691565
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_debug_sync_innodb.result
@@ -0,0 +1,61 @@
+#
+# Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
+# concurrent I_S query
+create table t1 (a int)
+engine = innodb
+partition by range (a)
+(partition p0 values less than MAXVALUE);
+insert into t1 values (1), (11), (21), (33);
+SELECT * FROM t1;
+a
+1
+11
+21
+33
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+t1#P#p0.ibd
+t1.frm
+t1.par
+SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open';
+SET DEBUG_SYNC='partition_open_error SIGNAL alter WAIT_FOR finish';
+SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+SET DEBUG_SYNC = 'now WAIT_FOR parked';
+# When waiting for the name lock in get_all_tables in sql_show.cc
+# this will not be concurrent any more, thus the TIMEOUT
+SET DEBUG_SYNC = 'before_rename_partitions SIGNAL open WAIT_FOR alter TIMEOUT 1';
+# Needs to be executed twice, since first is this 'SET DEBUG_SYNC ...'
+SET DEBUG_SYNC = 'before_close_thread_tables SIGNAL finish EXECUTE 2';
+ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
+(PARTITION p0 VALUES LESS THAN (10),
+PARTITION p10 VALUES LESS THAN MAXVALUE);
+Warnings:
+Warning 1649 debug sync point wait timed out
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
+NULL test t1 p0 NULL 1 NULL RANGE NULL a NULL 10 1 16384 16384 NULL 0 0 NULL NULL NULL NULL default NULL
+NULL test t1 p10 NULL 2 NULL RANGE NULL a NULL MAXVALUE 3 5461 16384 NULL 0 0 NULL NULL NULL NULL default NULL
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
+ PARTITION p10 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+SELECT * FROM t1;
+a
+1
+11
+21
+33
+drop table t1;
+SET DEBUG_SYNC = 'RESET';
diff --git a/mysql-test/suite/parts/r/rpl_partition.result b/mysql-test/suite/parts/r/rpl_partition.result
index c2537815631..9c5ac34b1b0 100644
--- a/mysql-test/suite/parts/r/rpl_partition.result
+++ b/mysql-test/suite/parts/r/rpl_partition.result
@@ -138,45 +138,7 @@ SUBPARTITIONS 2
PARTITION pa9 VALUES LESS THAN (90) ENGINE = InnoDB,
PARTITION pa10 VALUES LESS THAN (100) ENGINE = InnoDB,
PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
SELECT count(*) "Slave norm" FROM t1;
Slave norm 500
SELECT count(*) "Slave bykey" FROM t2;
diff --git a/mysql-test/suite/parts/t/optimizer.test b/mysql-test/suite/parts/t/optimizer.test
new file mode 100644
index 00000000000..f93c36823ca
--- /dev/null
+++ b/mysql-test/suite/parts/t/optimizer.test
@@ -0,0 +1,47 @@
+# The server must support partitioning.
+--source include/have_partition.inc
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+--echo #
+--echo # Bug#50939: Loose Index Scan unduly relies on engine to remember range
+--echo # endpoints
+--echo #
+CREATE TABLE t1 (
+ a INT,
+ b INT,
+ KEY ( a, b )
+) PARTITION BY HASH (a) PARTITIONS 1;
+
+CREATE TABLE t2 (
+ a INT,
+ b INT,
+ KEY ( a, b )
+);
+
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+
+INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
+INSERT INTO t1 SELECT a + 10, b + 10 FROM t1;
+INSERT INTO t1 SELECT a + 20, b + 20 FROM t1;
+INSERT INTO t1 SELECT a + 40, b + 40 FROM t1;
+
+INSERT INTO t2 SELECT * FROM t1;
+
+--echo # plans should be identical
+EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
+EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
+
+FLUSH status;
+SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a;
+--echo # Should be no more than 4 reads.
+SHOW status LIKE 'handler_read_key';
+
+FLUSH status;
+SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
+--echo # Should be no more than 4 reads.
+SHOW status LIKE 'handler_read_key';
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt b/mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt
new file mode 100644
index 00000000000..9854fda301d
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt
@@ -0,0 +1 @@
+--innodb_file_per_table=1
diff --git a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
new file mode 100644
index 00000000000..79ef3d537bf
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
@@ -0,0 +1,44 @@
+--source include/have_innodb.inc
+--source include/have_partition.inc
+--source include/have_debug_sync.inc
+
+let $MYSQLD_DATADIR=`SELECT @@datadir`;
+
+--echo #
+--echo # Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
+--echo # concurrent I_S query
+create table t1 (a int)
+engine = innodb
+partition by range (a)
+(partition p0 values less than MAXVALUE);
+insert into t1 values (1), (11), (21), (33);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+--list_files $MYSQLD_DATADIR/test
+
+SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open';
+SET DEBUG_SYNC='partition_open_error SIGNAL alter WAIT_FOR finish';
+send
+SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+
+connect (con1, localhost, root,,);
+SET DEBUG_SYNC = 'now WAIT_FOR parked';
+--echo # When waiting for the name lock in get_all_tables in sql_show.cc
+--echo # this will not be concurrent any more, thus the TIMEOUT
+SET DEBUG_SYNC = 'before_rename_partitions SIGNAL open WAIT_FOR alter TIMEOUT 1';
+--echo # Needs to be executed twice, since first is this 'SET DEBUG_SYNC ...'
+SET DEBUG_SYNC = 'before_close_thread_tables SIGNAL finish EXECUTE 2';
+--error 0,ER_TABLE_EXISTS_ERROR
+ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
+(PARTITION p0 VALUES LESS THAN (10),
+ PARTITION p10 VALUES LESS THAN MAXVALUE);
+
+disconnect con1;
+connection default;
+--reap
+--list_files $MYSQLD_DATADIR/test
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+drop table t1;
+--list_files $MYSQLD_DATADIR/test
+SET DEBUG_SYNC = 'RESET';
diff --git a/mysql-test/suite/parts/t/rpl_partition.test b/mysql-test/suite/parts/t/rpl_partition.test
index f7d1c14cf29..4b4915b89ec 100644
--- a/mysql-test/suite/parts/t/rpl_partition.test
+++ b/mysql-test/suite/parts/t/rpl_partition.test
@@ -145,9 +145,7 @@ SELECT count(*) as "Master byrange" FROM t3;
--sync_slave_with_master
connection slave;
show create table t3;
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-show slave status;
+--source include/check_slave_is_running.inc
SELECT count(*) "Slave norm" FROM t1;
SELECT count(*) "Slave bykey" FROM t2;
SELECT count(*) "Slave byrange" FROM t3;
diff --git a/mysql-test/suite/pbxt/r/join_nested.result b/mysql-test/suite/pbxt/r/join_nested.result
index 9b561371404..4e687b810db 100644
--- a/mysql-test/suite/pbxt/r/join_nested.result
+++ b/mysql-test/suite/pbxt/r/join_nested.result
@@ -958,15 +958,15 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
-1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00 Using where
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
CREATE INDEX idx_b ON t8(b);
EXPLAIN
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
diff --git a/mysql-test/suite/pbxt/r/renamedb.result b/mysql-test/suite/pbxt/r/renamedb.result
index ff8f89592fc..e77aca0d0b7 100644
--- a/mysql-test/suite/pbxt/r/renamedb.result
+++ b/mysql-test/suite/pbxt/r/renamedb.result
@@ -7,6 +7,6 @@ ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and n
ALTER DATABASE `#mysql51#not-yet` UPGRADE DATA DIRECTORY NAME;
ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and name
ALTER DATABASE `#mysql50#` UPGRADE DATA DIRECTORY NAME;
-ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and name
+ERROR 42000: Incorrect database name '#mysql50#'
ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Unknown database '#mysql50#upgrade-me'
diff --git a/mysql-test/suite/pbxt/t/check.test b/mysql-test/suite/pbxt/t/check.test
index e8f355fe266..e25c5217e48 100644
--- a/mysql-test/suite/pbxt/t/check.test
+++ b/mysql-test/suite/pbxt/t/check.test
@@ -9,11 +9,13 @@ drop table if exists t1;
create table t1(n int not null, key(n), key(n), key(n), key(n));
let $1=10000;
disable_query_log;
+begin;
while ($1)
{
eval insert into t1 values ($1);
dec $1;
}
+commit;
enable_query_log;
send check table t1 extended;
connection con2;
diff --git a/mysql-test/suite/pbxt/t/count_distinct2.test b/mysql-test/suite/pbxt/t/count_distinct2.test
index 2f95e000f6c..8e2b33f1704 100644
--- a/mysql-test/suite/pbxt/t/count_distinct2.test
+++ b/mysql-test/suite/pbxt/t/count_distinct2.test
@@ -52,11 +52,13 @@ drop table t1;
create table t1 (n int default NULL);
let $1=5000;
disable_query_log;
+begin;
while ($1)
{
eval insert into t1 values($1);
dec $1;
}
+commit;
enable_query_log;
flush status;
@@ -68,11 +70,13 @@ drop table t1;
create table t1 (s text);
let $1=5000;
disable_query_log;
+begin;
while ($1)
{
eval insert into t1 values('$1');
dec $1;
}
+commit;
enable_query_log;
flush status;
select count(distinct s) from t1;
diff --git a/mysql-test/suite/pbxt/t/derived.test b/mysql-test/suite/pbxt/t/derived.test
index 33ad994278c..a9127b49741 100644
--- a/mysql-test/suite/pbxt/t/derived.test
+++ b/mysql-test/suite/pbxt/t/derived.test
@@ -46,12 +46,14 @@ explain select * from (select t1.*, t2.a as t2a from t1,t2 where t1.a=t2.a) t1;
drop table t1, t2;
create table t1(a int not null, t char(8), index(a));
disable_query_log;
+begin;
let $1 = 10000;
while ($1)
{
eval insert into t1 values ($1,'$1');
dec $1;
}
+commit;
enable_query_log;
SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20;
explain select count(*) from t1 as tt1, (select * from t1) as tt2;
diff --git a/mysql-test/suite/pbxt/t/renamedb.test b/mysql-test/suite/pbxt/t/renamedb.test
index 84315090b7a..71d0c127058 100644
--- a/mysql-test/suite/pbxt/t/renamedb.test
+++ b/mysql-test/suite/pbxt/t/renamedb.test
@@ -44,7 +44,7 @@ ALTER DATABASE `#mysql41#not-supported` UPGRADE DATA DIRECTORY NAME;
--error ER_WRONG_USAGE
ALTER DATABASE `#mysql51#not-yet` UPGRADE DATA DIRECTORY NAME;
---error ER_WRONG_USAGE
+--error ER_WRONG_DB_NAME
ALTER DATABASE `#mysql50#` UPGRADE DATA DIRECTORY NAME;
--error ER_BAD_DB_ERROR
diff --git a/mysql-test/suite/percona/disabled.def b/mysql-test/suite/percona/disabled.def
new file mode 100644
index 00000000000..4f35807b7a1
--- /dev/null
+++ b/mysql-test/suite/percona/disabled.def
@@ -0,0 +1,13 @@
+percona_suppress_log_warning_1592: Feature not merged into MariaDB
+percona_log_slow_slave_statements: Feature not merged into MariaDB
+percona_log_slow_slave_statements-and-use_global_long_query_time: Feature not merged into MariaDB
+percona_slow_query_log-control_global_slow: Feature not merged into MariaDB
+percona_slow_query_log-microseconds_in_slow_query_log: Feature not merged into MariaDB
+percona_query_cache_with_comments: Feature not merged into MariaDB
+percona_query_cache_with_comments_prepared_statements: Feature not merged into MariaDB
+percona_show_temp_tables: Feature not merged into MariaDB
+percona_slow_query_log-use_global_long_query_time: Feature not merged into MariaDB
+percona_query_cache_with_comments_disable: Feature not merged into MariaDB
+
+percona_slow_query_log-log_slow_verbosity: InnoDB filtering information not fully merged into MariaDB
+
diff --git a/mysql-test/suite/percona/percona_innodb_deadlock_count.result b/mysql-test/suite/percona/percona_innodb_deadlock_count.result
new file mode 100644
index 00000000000..4ad6fd433fe
--- /dev/null
+++ b/mysql-test/suite/percona/percona_innodb_deadlock_count.result
@@ -0,0 +1,28 @@
+# Establish connection con1 (user=root)
+# Establish connection con2 (user=root)
+# Establish connection con3 (user=root)
+# Drop test table
+drop table if exists t;
+# Create test table
+create table t(a INT PRIMARY KEY, b INT) engine=InnoDB;
+# Insert two rows to test table
+insert into t values(2,1);
+insert into t values(1,2);
+# Switch to connection con1
+BEGIN;
+SELECT b FROM t WHERE a=1 FOR UPDATE;
+b
+2
+# Switch to connection con2
+BEGIN;
+SELECT b FROM t WHERE a=2 FOR UPDATE;
+b
+1
+# Switch to connection con1
+SELECT b FROM t WHERE a=2 FOR UPDATE;
+# Switch to connection con2
+SELECT b FROM t WHERE a=1 FOR UPDATE;
+# Switch to connection con3
+1
+# Drop test table
+drop table t;
diff --git a/mysql-test/suite/percona/percona_innodb_deadlock_count.test b/mysql-test/suite/percona/percona_innodb_deadlock_count.test
new file mode 100644
index 00000000000..b0882a18dc1
--- /dev/null
+++ b/mysql-test/suite/percona/percona_innodb_deadlock_count.test
@@ -0,0 +1,49 @@
+--source include/have_innodb.inc
+--echo # Establish connection con1 (user=root)
+connect (con1,localhost,root,,);
+--echo # Establish connection con2 (user=root)
+connect (con2,localhost,root,,);
+--echo # Establish connection con3 (user=root)
+connect (con3,localhost,root,,);
+--echo # Drop test table
+--disable_warnings
+drop table if exists t;
+--enable_warnings
+disable_abort_on_error;
+
+--echo # Create test table
+create table t(a INT PRIMARY KEY, b INT) engine=InnoDB;
+--echo # Insert two rows to test table
+insert into t values(2,1);
+insert into t values(1,2);
+
+#--echo # Save current deadlock count
+let $current = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_deadlocks'`;
+
+--echo # Switch to connection con1
+connection con1;
+BEGIN; SELECT b FROM t WHERE a=1 FOR UPDATE;
+
+#show engine innodb status;
+
+--echo # Switch to connection con2
+connection con2;
+BEGIN; SELECT b FROM t WHERE a=2 FOR UPDATE;
+
+--echo # Switch to connection con1
+connection con1;
+SEND SELECT b FROM t WHERE a=2 FOR UPDATE;
+
+--echo # Switch to connection con2
+connection con2;
+SEND SELECT b FROM t WHERE a=1 FOR UPDATE;
+
+SLEEP 0.2;
+--echo # Switch to connection con3
+connection con3;
+let $result = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_deadlocks'`;
+
+let $diff = `SELECT $result - $current`;
+echo $diff;
+--echo # Drop test table
+drop table t;
diff --git a/mysql-test/suite/percona/percona_innodb_doublewrite_file-master.opt b/mysql-test/suite/percona/percona_innodb_doublewrite_file-master.opt
new file mode 100644
index 00000000000..0f4d0c45410
--- /dev/null
+++ b/mysql-test/suite/percona/percona_innodb_doublewrite_file-master.opt
@@ -0,0 +1 @@
+--innodb_doublewrite_file=ib_doublewrite
diff --git a/mysql-test/suite/percona/percona_innodb_doublewrite_file.result b/mysql-test/suite/percona/percona_innodb_doublewrite_file.result
new file mode 100644
index 00000000000..4d086cc4498
--- /dev/null
+++ b/mysql-test/suite/percona/percona_innodb_doublewrite_file.result
@@ -0,0 +1,4 @@
+show variables like 'innodb_doublewrite%';
+Variable_name Value
+innodb_doublewrite ON
+innodb_doublewrite_file ib_doublewrite
diff --git a/mysql-test/suite/percona/percona_innodb_doublewrite_file.test b/mysql-test/suite/percona/percona_innodb_doublewrite_file.test
new file mode 100644
index 00000000000..8068d561190
--- /dev/null
+++ b/mysql-test/suite/percona/percona_innodb_doublewrite_file.test
@@ -0,0 +1,2 @@
+--source include/have_innodb.inc
+show variables like 'innodb_doublewrite%';
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-master.opt b/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-master.opt
new file mode 100644
index 00000000000..d600400af08
--- /dev/null
+++ b/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-master.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=1 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-slave.opt b/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-slave.opt
new file mode 100644
index 00000000000..c79e637317b
--- /dev/null
+++ b/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time-slave.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=1 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.result b/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.result
new file mode 100644
index 00000000000..c17e7a3f508
--- /dev/null
+++ b/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.result
@@ -0,0 +1,103 @@
+# Activate master-slave replication
+stop slave;
+drop table if exists t1,t2,t3,t4,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 table t for test
+DROP TABLE IF EXISTS t;
+CREATE TABLE t(id INT);
+# Start slave replication
+START SLAVE;
+INSERT INTO t VALUES (1);
+# Read information about master binlog
+# Sync(1) slave thread
+# Read and change log_slow_slave_statements to ON on slave
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements OFF
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+INSERT INTO t VALUES (2);
+# Read information about master binlog
+# Sync slave(2) thread
+# Restart slave
+STOP SLAVE;
+START SLAVE;
+INSERT INTO t VALUES (3);
+# Read information about master binlog
+# Sync(3) slave thread
+show variables like 'long_query_time';
+Variable_name Value
+long_query_time 1.000000
+show global variables like 'long_query_time';
+Variable_name Value
+long_query_time 1.000000
+show global variables like 'use_global_long_query_time';
+Variable_name Value
+use_global_long_query_time OFF
+set global long_query_time=0;
+show variables like 'long_query_time';
+Variable_name Value
+long_query_time 1.000000
+show global variables like 'long_query_time';
+Variable_name Value
+long_query_time 0.000000
+show global variables like 'use_global_long_query_time';
+Variable_name Value
+use_global_long_query_time OFF
+INSERT INTO t VALUES (4);
+# Read information about master binlog
+# Sync slave(4) thread
+show variables like 'long_query_time';
+Variable_name Value
+long_query_time 1.000000
+show global variables like 'long_query_time';
+Variable_name Value
+long_query_time 0.000000
+show global variables like 'use_global_long_query_time';
+Variable_name Value
+use_global_long_query_time OFF
+set global use_global_long_query_time=1;
+show variables like 'long_query_time';
+Variable_name Value
+long_query_time 0.000000
+show global variables like 'long_query_time';
+Variable_name Value
+long_query_time 0.000000
+show global variables like 'use_global_long_query_time';
+Variable_name Value
+use_global_long_query_time ON
+INSERT INTO t VALUES (5);
+# Read information about master binlog
+# Sync slave(5) thread
+show variables like 'long_query_time';
+Variable_name Value
+long_query_time 0.000000
+show global variables like 'long_query_time';
+Variable_name Value
+long_query_time 0.000000
+show global variables like 'use_global_long_query_time';
+Variable_name Value
+use_global_long_query_time ON
+set global long_query_time=1;
+set global use_global_long_query_time=0;
+# Analyse master slow_query_log
+0
+0
+0
+0
+0
+# Analyse slave slow_query_log
+0
+0
+0
+0
+1
+set global log_slow_slave_statements=OFF;
+DROP TABLE t;
+# Read information about master binlog
+# Sync slave(6) thread
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test b/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test
new file mode 100644
index 00000000000..7605218e463
--- /dev/null
+++ b/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test
@@ -0,0 +1,139 @@
+-- echo # Activate master-slave replication
+-- source include/master-slave.inc
+
+connection master;
+-- echo # Make table t for test
+-- disable_warnings
+DROP TABLE IF EXISTS t;
+-- enable_warnings
+CREATE TABLE t(id INT);
+
+
+-- echo # Start slave replication
+-- disable_warnings
+connection slave;
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+-- enable_warnings
+
+#-- echo # Make insert(1) on master
+connection master;
+INSERT INTO t VALUES (1);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync(1) slave thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+
+-- echo # Read and change log_slow_slave_statements to ON on slave
+show variables like 'log_slow_slave_statements';
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+
+#-- echo # Make insert(2) on master
+connection master;
+INSERT INTO t VALUES (2);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync slave(2) thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+-- echo # Restart slave
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+
+#-- echo # Make insert(3) on master
+connection master;
+INSERT INTO t VALUES (3);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync(3) slave thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+show variables like 'long_query_time';
+show global variables like 'long_query_time';
+show global variables like 'use_global_long_query_time';
+set global long_query_time=0;
+show variables like 'long_query_time';
+show global variables like 'long_query_time';
+show global variables like 'use_global_long_query_time';
+
+#-- echo # Make insert(4) on master
+connection master;
+INSERT INTO t VALUES (4);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync slave(4) thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+show variables like 'long_query_time';
+show global variables like 'long_query_time';
+show global variables like 'use_global_long_query_time';
+set global use_global_long_query_time=1;
+show variables like 'long_query_time';
+show global variables like 'long_query_time';
+show global variables like 'use_global_long_query_time';
+
+#-- echo # Make insert(5) on master
+connection master;
+let $MASTER_DATADIR= `select @@datadir`;
+INSERT INTO t VALUES (5);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync slave(5) thread
+connection slave;
+let $SLAVE_DATADIR= `select @@datadir`;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+show variables like 'long_query_time';
+show global variables like 'long_query_time';
+show global variables like 'use_global_long_query_time';
+set global long_query_time=1;
+set global use_global_long_query_time=0;
+
+-- echo # Analyse master slow_query_log
+let $i=5;
+let $k=1;
+let $cmd=cat ./$MASTER_DATADIR/percona_log_slow_slave_statements-master.log | grep;
+while($i)
+{
+ let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l;
+ exec $current_cmd;
+ dec $i;
+ inc $k;
+}
+
+-- echo # Analyse slave slow_query_log
+let $i=5;
+let $k=1;
+let $cmd=cat $SLAVE_DATADIR/percona_log_slow_slave_statements-slave.log | grep;
+while($i)
+{
+ let $current_cmd = $cmd "INSERT INTO t VALUES ($k)" | wc -l;
+ exec $current_cmd;
+ dec $i;
+ inc $k;
+}
+set global log_slow_slave_statements=OFF;
+
+connection master;
+DROP TABLE t;
+
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync slave(6) thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-master.opt b/mysql-test/suite/percona/percona_log_slow_slave_statements-master.opt
new file mode 100644
index 00000000000..dd94fd90a57
--- /dev/null
+++ b/mysql-test/suite/percona/percona_log_slow_slave_statements-master.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_log_slow_slave_statements-master.log --long-query-time=0 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements-slave.opt b/mysql-test/suite/percona/percona_log_slow_slave_statements-slave.opt
new file mode 100644
index 00000000000..e276b0bcfc8
--- /dev/null
+++ b/mysql-test/suite/percona/percona_log_slow_slave_statements-slave.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_log_slow_slave_statements-slave.log --long-query-time=0 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements.result b/mysql-test/suite/percona/percona_log_slow_slave_statements.result
new file mode 100644
index 00000000000..e3bf3e92c94
--- /dev/null
+++ b/mysql-test/suite/percona/percona_log_slow_slave_statements.result
@@ -0,0 +1,86 @@
+# Activate master-slave replication
+stop slave;
+drop table if exists t1,t2,t3,t4,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 table t for test
+DROP TABLE IF EXISTS t;
+CREATE TABLE t(id INT);
+# Start slave replication
+START SLAVE;
+INSERT INTO t VALUES (1);
+# Read information about master binlog
+# Sync(1) slave thread
+# Read and change log_slow_slave_statements to ON on slave
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements OFF
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+INSERT INTO t VALUES (2);
+# Read information about master binlog
+# Sync slave(2) thread
+# Restart slave
+STOP SLAVE;
+START SLAVE;
+INSERT INTO t VALUES (3);
+# Read information about master binlog
+# Sync(3) slave thread
+# Read and change log_slow_slave_statements to OFF on slave
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+set global log_slow_slave_statements=OFF;
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements OFF
+INSERT INTO t VALUES (4);
+# Read information about master binlog
+# Sync slave(4) thread
+# Restart slave
+STOP SLAVE;
+START SLAVE;
+INSERT INTO t VALUES (5);
+# Read information about master binlog
+# Sync slave(5) thread
+# Read and change log_slow_slave_statements to ON on slave
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements OFF
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+Variable_name Value
+log_slow_slave_statements ON
+INSERT INTO t VALUES (6);
+# Read information about master binlog
+# Sync slave(6) thread
+# Restart slave
+STOP SLAVE;
+START SLAVE;
+INSERT INTO t VALUES (7);
+# Read information about master binlog
+# Sync slave(7) thread
+# Analyse master slow_query_log
+1
+1
+1
+1
+1
+1
+1
+# Analyse slave slow_query_log
+0
+0
+1
+0
+0
+0
+1
+set global log_slow_slave_statements=OFF;
+DROP TABLE t;
+# Read information about master binlog
+# Sync slave(8) thread
diff --git a/mysql-test/suite/percona/percona_log_slow_slave_statements.test b/mysql-test/suite/percona/percona_log_slow_slave_statements.test
new file mode 100644
index 00000000000..37cb1ad2419
--- /dev/null
+++ b/mysql-test/suite/percona/percona_log_slow_slave_statements.test
@@ -0,0 +1,160 @@
+-- echo # Activate master-slave replication
+-- source include/master-slave.inc
+
+connection master;
+-- echo # Make table t for test
+-- disable_warnings
+DROP TABLE IF EXISTS t;
+-- enable_warnings
+CREATE TABLE t(id INT);
+
+
+-- echo # Start slave replication
+-- disable_warnings
+connection slave;
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+-- enable_warnings
+
+#-- echo # Make insert(1) on master
+connection master;
+INSERT INTO t VALUES (1);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync(1) slave thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+
+-- echo # Read and change log_slow_slave_statements to ON on slave
+show variables like 'log_slow_slave_statements';
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+
+#-- echo # Make insert(2) on master
+connection master;
+INSERT INTO t VALUES (2);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync slave(2) thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+-- echo # Restart slave
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+
+#-- echo # Make insert(3) on master
+connection master;
+INSERT INTO t VALUES (3);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync(3) slave thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+-- echo # Read and change log_slow_slave_statements to OFF on slave
+show variables like 'log_slow_slave_statements';
+set global log_slow_slave_statements=OFF;
+show variables like 'log_slow_slave_statements';
+
+#-- echo # Make insert(4) on master
+connection master;
+INSERT INTO t VALUES (4);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync slave(4) thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+-- echo # Restart slave
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+
+#-- echo # Make insert(5) on master
+connection master;
+INSERT INTO t VALUES (5);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync slave(5) thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+-- echo # Read and change log_slow_slave_statements to ON on slave
+show variables like 'log_slow_slave_statements';
+set global log_slow_slave_statements=ON;
+show variables like 'log_slow_slave_statements';
+
+#-- echo # Make insert(6) on master
+connection master;
+INSERT INTO t VALUES (6);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync slave(6) thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+-- echo # Restart slave
+STOP SLAVE;
+-- source include/wait_for_slave_to_stop.inc
+START SLAVE;
+-- source include/wait_for_slave_to_start.inc
+
+#-- echo # Make insert(7) on master
+connection master;
+let $MASTER_DATADIR= `select @@datadir`;
+INSERT INTO t VALUES (7);
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync slave(7) thread
+connection slave;
+let $SLAVE_DATADIR= `select @@datadir`;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
+
+-- echo # Analyse master slow_query_log
+let $i=7;
+let $k=1;
+let $cmd=cat $MASTER_DATADIR/percona_log_slow_slave_statements-master.log | grep -c;
+while($i)
+{
+ let $current_cmd = $cmd "INSERT INTO t VALUES ($k)";
+ exec $current_cmd;
+ dec $i;
+ inc $k;
+}
+
+-- echo # Analyse slave slow_query_log
+let $i=7;
+let $k=1;
+let $cmd=cat $SLAVE_DATADIR/percona_log_slow_slave_statements-slave.log | grep -c;
+while($i)
+{
+ let $current_cmd = $cmd "INSERT INTO t VALUES ($k)";
+ exec $current_cmd;
+ dec $i;
+ inc $k;
+}
+set global log_slow_slave_statements=OFF;
+
+connection master;
+DROP TABLE t;
+
+-- echo # Read information about master binlog
+let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1);
+let $binlog_position = query_get_value(SHOW MASTER STATUS,Position,1);
+
+-- echo # Sync slave(8) thread
+connection slave;
+let $sync_result = `SELECT MASTER_POS_WAIT('$binlog_file',$binlog_position)`;
diff --git a/mysql-test/suite/percona/percona_query_cache_with_comments.inc.backup b/mysql-test/suite/percona/percona_query_cache_with_comments.inc.backup
new file mode 100644
index 00000000000..4b5b31e9239
--- /dev/null
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments.inc.backup
@@ -0,0 +1,88 @@
+--source include/percona_query_cache_with_comments_clear.inc
+let $query=/* with comment first */select * from t1;
+eval $query;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=# with comment first
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=-- with comment first
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=/* with comment first and "quote" */select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=# with comment first and "quote"
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=-- with comment first and "quote"
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=
+ /* with comment and whitespaces first */select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=
+ # with comment and whitespaces first
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=
+ -- with comment and whitespaces first
+select * from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $internal=* internal comment *;
+
+let $query=select * /$internal/ from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/ from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $internal=* internal comment with "quote" *;
+
+let $query=select * /$internal/ from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/ from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+let $query=select */$internal/from t1;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1
+;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 ;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 ;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1
+/* comment in the end */;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1
+/* comment in the end */
+;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 #comment in the end;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 #comment in the end
+;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 -- comment in the end;
+--source include/percona_query_cache_with_comments_eval.inc
+
+let $query=select * from t1 -- comment in the end
+;
+--source include/percona_query_cache_with_comments_eval.inc
diff --git a/mysql-test/suite/percona/percona_query_cache_with_comments.result b/mysql-test/suite/percona/percona_query_cache_with_comments.result
new file mode 100644
index 00000000000..169fdf80fef
--- /dev/null
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments.result
@@ -0,0 +1,866 @@
+set global query_cache_strip_comments=ON;
+set GLOBAL query_cache_size=1355776;
+drop table if exists t1;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+flush query cache;
+flush query cache;
+reset query cache;
+flush status;
+flush query cache;
+flush query cache;
+reset query cache;
+flush status;
+/* with comment first */select * from t1;
+a
+1
+2
+3
+-----------------------------------------------------
+/* with comment first */select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+/* with comment first */select * from t1;
+a
+1
+2
+3
+/* with comment first */select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+-----------------------------------------------------
+# with comment first
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+# with comment first
+select * from t1;
+a
+1
+2
+3
+# with comment first
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+-----------------------------------------------------
+-- with comment first
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+-- with comment first
+select * from t1;
+a
+1
+2
+3
+-- with comment first
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+-----------------------------------------------------
+/* with comment first and "quote" */select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+/* with comment first and "quote" */select * from t1;
+a
+1
+2
+3
+/* with comment first and "quote" */select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 8
+-----------------------------------------------------
+# with comment first and "quote"
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 8
+# with comment first and "quote"
+select * from t1;
+a
+1
+2
+3
+# with comment first and "quote"
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 10
+-----------------------------------------------------
+-- with comment first and "quote"
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 10
+-- with comment first and "quote"
+select * from t1;
+a
+1
+2
+3
+-- with comment first and "quote"
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 12
+-----------------------------------------------------
+/* with comment and whitespaces first */select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 12
+/* with comment and whitespaces first */select * from t1;
+a
+1
+2
+3
+/* with comment and whitespaces first */select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 14
+-----------------------------------------------------
+# with comment and whitespaces first
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 14
+# with comment and whitespaces first
+select * from t1;
+a
+1
+2
+3
+# with comment and whitespaces first
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 16
+-----------------------------------------------------
+-- with comment and whitespaces first
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 16
+-- with comment and whitespaces first
+select * from t1;
+a
+1
+2
+3
+-- with comment and whitespaces first
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 18
+-----------------------------------------------------
+select * /* internal comment */ from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 18
+select * /* internal comment */ from t1;
+a
+1
+2
+3
+select * /* internal comment */ from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 20
+-----------------------------------------------------
+select */* internal comment */ from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 20
+select */* internal comment */ from t1;
+a
+1
+2
+3
+select */* internal comment */ from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 22
+-----------------------------------------------------
+select */* internal comment */from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 22
+select */* internal comment */from t1;
+a
+1
+2
+3
+select */* internal comment */from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 24
+-----------------------------------------------------
+select * /* internal comment with "quote" */ from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 24
+select * /* internal comment with "quote" */ from t1;
+a
+1
+2
+3
+select * /* internal comment with "quote" */ from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 26
+-----------------------------------------------------
+select */* internal comment with "quote" */ from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 26
+select */* internal comment with "quote" */ from t1;
+a
+1
+2
+3
+select */* internal comment with "quote" */ from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 28
+-----------------------------------------------------
+select */* internal comment with "quote" */from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 28
+select */* internal comment with "quote" */from t1;
+a
+1
+2
+3
+select */* internal comment with "quote" */from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 30
+-----------------------------------------------------
+select * from t1
+
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 30
+select * from t1
+;
+a
+1
+2
+3
+select * from t1
+;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 32
+-----------------------------------------------------
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 32
+select * from t1 ;
+a
+1
+2
+3
+select * from t1 ;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 34
+-----------------------------------------------------
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 34
+select * from t1 ;
+a
+1
+2
+3
+select * from t1 ;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 36
+-----------------------------------------------------
+select * from t1
+/* comment in the end */
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 36
+select * from t1
+/* comment in the end */;
+a
+1
+2
+3
+select * from t1
+/* comment in the end */;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 38
+-----------------------------------------------------
+select * from t1
+/* *\/ */
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 38
+select * from t1
+/* *\/ */;
+a
+1
+2
+3
+select * from t1
+/* *\/ */;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 40
+-----------------------------------------------------
+select * from t1
+/* comment in the end */
+
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 40
+select * from t1
+/* comment in the end */
+;
+a
+1
+2
+3
+select * from t1
+/* comment in the end */
+;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 42
+-----------------------------------------------------
+select * from t1 #comment in the end
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 42
+select * from t1 #comment in the end;
+a
+1
+2
+3
+select * from t1 #comment in the end;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 44
+-----------------------------------------------------
+select * from t1 #comment in the end
+
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 44
+select * from t1 #comment in the end
+;
+a
+1
+2
+3
+select * from t1 #comment in the end
+;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 46
+-----------------------------------------------------
+select * from t1 -- comment in the end
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 46
+select * from t1 -- comment in the end;
+a
+1
+2
+3
+select * from t1 -- comment in the end;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 48
+-----------------------------------------------------
+select * from t1 -- comment in the end
+
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 48
+select * from t1 -- comment in the end
+;
+a
+1
+2
+3
+select * from t1 -- comment in the end
+;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 50
+-----------------------------------------------------
+select ' \' ' from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 50
+select ' \' ' from t1;
+'
+ '
+ '
+ '
+select ' \' ' from t1;
+'
+ '
+ '
+ '
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 51
+DROP TABLE t1;
+SET GLOBAL query_cache_size=default;
+set global query_cache_strip_comments=OFF;
diff --git a/mysql-test/suite/percona/percona_query_cache_with_comments.test b/mysql-test/suite/percona/percona_query_cache_with_comments.test
new file mode 100644
index 00000000000..0190f54d104
--- /dev/null
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments.test
@@ -0,0 +1,4 @@
+set global query_cache_strip_comments=ON;
+-- source include/percona_query_cache_with_comments_begin.inc
+-- source include/percona_query_cache_with_comments.inc
+-- source include/percona_query_cache_with_comments_end.inc
diff --git a/mysql-test/suite/percona/percona_query_cache_with_comments_crash.result b/mysql-test/suite/percona/percona_query_cache_with_comments_crash.result
new file mode 100644
index 00000000000..32bd3645ec4
--- /dev/null
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments_crash.result
@@ -0,0 +1,21 @@
+set GLOBAL query_cache_size=1355776;
+drop table if exists t1;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+flush query cache;
+flush query cache;
+reset query cache;
+flush status;
+( select * from t1 );
+a
+1
+2
+3
+/*!40101 SET @OLD_SQL_MODE := @@SQL_MODE, @@SQL_MODE := REPLACE(REPLACE(@@SQL_MODE, 'ANSI_QUOTES', ''), ',,', ','), @OLD_QUOTE := @@SQL_QUOTE_SHOW_CREATE, @@SQL_QUOTE_SHOW_CREATE := 1 */;
+/* only comment */;
+# only comment
+;
+-- only comment
+;
+DROP TABLE t1;
+SET GLOBAL query_cache_size= default;
diff --git a/mysql-test/suite/percona/percona_query_cache_with_comments_crash.test b/mysql-test/suite/percona/percona_query_cache_with_comments_crash.test
new file mode 100644
index 00000000000..e125c75c3de
--- /dev/null
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments_crash.test
@@ -0,0 +1,22 @@
+-- source include/have_query_cache.inc
+set GLOBAL query_cache_size=1355776;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+flush query cache; # This crashed in some versions
+flush query cache; # This crashed in some versions
+reset query cache;
+flush status;
+( select * from t1 );
+/*!40101 SET @OLD_SQL_MODE := @@SQL_MODE, @@SQL_MODE := REPLACE(REPLACE(@@SQL_MODE, 'ANSI_QUOTES', ''), ',,', ','), @OLD_QUOTE := @@SQL_QUOTE_SHOW_CREATE, @@SQL_QUOTE_SHOW_CREATE := 1 */;
+/* only comment */;
+let query=# only comment
+;
+eval $query;
+let query=-- only comment
+;
+eval $query;
+DROP TABLE t1;
+SET GLOBAL query_cache_size= default;
diff --git a/mysql-test/suite/percona/percona_query_cache_with_comments_disable.result b/mysql-test/suite/percona/percona_query_cache_with_comments_disable.result
new file mode 100644
index 00000000000..a13a44d9a1c
--- /dev/null
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments_disable.result
@@ -0,0 +1,865 @@
+set GLOBAL query_cache_size=1355776;
+drop table if exists t1;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+flush query cache;
+flush query cache;
+reset query cache;
+flush status;
+flush query cache;
+flush query cache;
+reset query cache;
+flush status;
+/* with comment first */select * from t1;
+a
+1
+2
+3
+-----------------------------------------------------
+/* with comment first */select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+/* with comment first */select * from t1;
+a
+1
+2
+3
+/* with comment first */select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+-----------------------------------------------------
+# with comment first
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+# with comment first
+select * from t1;
+a
+1
+2
+3
+# with comment first
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+-----------------------------------------------------
+-- with comment first
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+-- with comment first
+select * from t1;
+a
+1
+2
+3
+-- with comment first
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 3
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+-----------------------------------------------------
+/* with comment first and "quote" */select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 3
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+/* with comment first and "quote" */select * from t1;
+a
+1
+2
+3
+/* with comment first and "quote" */select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 4
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 4
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 3
+-----------------------------------------------------
+# with comment first and "quote"
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 4
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 4
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 3
+# with comment first and "quote"
+select * from t1;
+a
+1
+2
+3
+# with comment first and "quote"
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 5
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 5
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 3
+-----------------------------------------------------
+-- with comment first and "quote"
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 5
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 5
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 3
+-- with comment first and "quote"
+select * from t1;
+a
+1
+2
+3
+-- with comment first and "quote"
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 6
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 6
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 3
+-----------------------------------------------------
+/* with comment and whitespaces first */select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 6
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 6
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 3
+/* with comment and whitespaces first */select * from t1;
+a
+1
+2
+3
+/* with comment and whitespaces first */select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 7
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 7
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+-----------------------------------------------------
+# with comment and whitespaces first
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 7
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 7
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+# with comment and whitespaces first
+select * from t1;
+a
+1
+2
+3
+# with comment and whitespaces first
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 8
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 8
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+-----------------------------------------------------
+-- with comment and whitespaces first
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 8
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 8
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+-- with comment and whitespaces first
+select * from t1;
+a
+1
+2
+3
+-- with comment and whitespaces first
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 9
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 9
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+-----------------------------------------------------
+select * /* internal comment */ from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 9
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 9
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+select * /* internal comment */ from t1;
+a
+1
+2
+3
+select * /* internal comment */ from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 10
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 10
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 5
+-----------------------------------------------------
+select */* internal comment */ from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 10
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 10
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 5
+select */* internal comment */ from t1;
+a
+1
+2
+3
+select */* internal comment */ from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 11
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 11
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+-----------------------------------------------------
+select */* internal comment */from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 11
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 11
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+select */* internal comment */from t1;
+a
+1
+2
+3
+select */* internal comment */from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 12
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 12
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 7
+-----------------------------------------------------
+select * /* internal comment with "quote" */ from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 12
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 12
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 7
+select * /* internal comment with "quote" */ from t1;
+a
+1
+2
+3
+select * /* internal comment with "quote" */ from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 13
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 13
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 8
+-----------------------------------------------------
+select */* internal comment with "quote" */ from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 13
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 13
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 8
+select */* internal comment with "quote" */ from t1;
+a
+1
+2
+3
+select */* internal comment with "quote" */ from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 14
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 14
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 9
+-----------------------------------------------------
+select */* internal comment with "quote" */from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 14
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 14
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 9
+select */* internal comment with "quote" */from t1;
+a
+1
+2
+3
+select */* internal comment with "quote" */from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 15
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 15
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 10
+-----------------------------------------------------
+select * from t1
+
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 15
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 15
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 10
+select * from t1
+;
+a
+1
+2
+3
+select * from t1
+;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 16
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 16
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 11
+-----------------------------------------------------
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 16
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 16
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 11
+select * from t1 ;
+a
+1
+2
+3
+select * from t1 ;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 16
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 16
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 13
+-----------------------------------------------------
+select * from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 16
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 16
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 13
+select * from t1 ;
+a
+1
+2
+3
+select * from t1 ;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 16
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 16
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 15
+-----------------------------------------------------
+select * from t1
+/* comment in the end */
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 16
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 16
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 15
+select * from t1
+/* comment in the end */;
+a
+1
+2
+3
+select * from t1
+/* comment in the end */;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 17
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 17
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 16
+-----------------------------------------------------
+select * from t1
+/* *\/ */
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 17
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 17
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 16
+select * from t1
+/* *\/ */;
+a
+1
+2
+3
+select * from t1
+/* *\/ */;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 18
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 18
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 17
+-----------------------------------------------------
+select * from t1
+/* comment in the end */
+
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 18
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 18
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 17
+select * from t1
+/* comment in the end */
+;
+a
+1
+2
+3
+select * from t1
+/* comment in the end */
+;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 18
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 18
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 19
+-----------------------------------------------------
+select * from t1 #comment in the end
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 18
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 18
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 19
+select * from t1 #comment in the end;
+a
+1
+2
+3
+select * from t1 #comment in the end;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 19
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 19
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 20
+-----------------------------------------------------
+select * from t1 #comment in the end
+
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 19
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 19
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 20
+select * from t1 #comment in the end
+;
+a
+1
+2
+3
+select * from t1 #comment in the end
+;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 19
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 19
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 22
+-----------------------------------------------------
+select * from t1 -- comment in the end
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 19
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 19
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 22
+select * from t1 -- comment in the end;
+a
+1
+2
+3
+select * from t1 -- comment in the end;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 20
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 20
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 23
+-----------------------------------------------------
+select * from t1 -- comment in the end
+
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 20
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 20
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 23
+select * from t1 -- comment in the end
+;
+a
+1
+2
+3
+select * from t1 -- comment in the end
+;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 20
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 20
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 25
+-----------------------------------------------------
+select ' \' ' from t1
+-----------------------------------------------------
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 20
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 20
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 25
+select ' \' ' from t1;
+'
+ '
+ '
+ '
+select ' \' ' from t1;
+'
+ '
+ '
+ '
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 21
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 21
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 26
+DROP TABLE t1;
+SET GLOBAL query_cache_size=default;
+set global query_cache_strip_comments=OFF;
diff --git a/mysql-test/suite/percona/percona_query_cache_with_comments_disable.test b/mysql-test/suite/percona/percona_query_cache_with_comments_disable.test
new file mode 100644
index 00000000000..ad59ac3566c
--- /dev/null
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments_disable.test
@@ -0,0 +1,3 @@
+-- source include/percona_query_cache_with_comments_begin.inc
+-- source include/percona_query_cache_with_comments.inc
+-- source include/percona_query_cache_with_comments_end.inc
diff --git a/mysql-test/suite/percona/percona_query_cache_with_comments_prepared_statements.result b/mysql-test/suite/percona/percona_query_cache_with_comments_prepared_statements.result
new file mode 100644
index 00000000000..9b28b7f0b62
--- /dev/null
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments_prepared_statements.result
@@ -0,0 +1,396 @@
+set GLOBAL query_cache_size=1355776;
+flush query cache;
+flush query cache;
+reset query cache;
+flush status;
+drop table if exists t1;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+set global query_cache_strip_comments=ON;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+prepare stmt from '/* with comment */ select * from t1';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+execute stmt;
+a
+1
+2
+3
+execute stmt;
+a
+1
+2
+3
+execute stmt;
+a
+1
+2
+3
+execute stmt;
+a
+1
+2
+3
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 5
+prepare stmt from 'select * from t1';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+prepare stmt from 'select * /*internal comment*/from t1';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 7
+prepare stmt from 'select * /*internal comment*/ from t1';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 8
+prepare stmt from 'select * from t1 /* at the end */';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 9
+prepare stmt from 'select * from t1 /* with "quote" */';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 10
+prepare stmt from 'select * from t1 /* with \'quote\' */';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 11
+prepare stmt from 'select * from t1 # 123
+';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 12
+prepare stmt from 'select * from t1 # 123 with "quote"
+';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 13
+prepare stmt from 'select * from t1 # 123 with \'quote\'
+';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 14
+prepare stmt from 'select * from t1
+# 123
+';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 15
+prepare stmt from '#456
+select * from t1
+# 123
+';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 16
+prepare stmt from 'select * from t1 -- 123
+';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 17
+prepare stmt from 'select * from t1
+-- 123
+';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 18
+prepare stmt from '-- comment in first
+select * from t1
+# 123
+';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 19
+prepare stmt from '(#456(
+select * from t1
+# 123(
+)';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 19
+prepare stmt from '/*test*/(-- comment in first(
+select * from t1
+-- 123 asdasd
+/* test */)';
+execute stmt;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 20
+prepare stmt from 'select "test",a from t1';
+execute stmt;
+test a
+test 1
+test 2
+test 3
+execute stmt;
+test a
+test 1
+test 2
+test 3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 3
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 21
+prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
+execute stmt;
+test /* internal 'comment' */ a
+test /* internal 'comment' */ 1
+test /* internal 'comment' */ 2
+test /* internal 'comment' */ 3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 4
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 4
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 21
+prepare stmt from 'select "test #internal comment" ,a from t1';
+execute stmt;
+test #internal comment a
+test #internal comment 1
+test #internal comment 2
+test #internal comment 3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 5
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 5
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 21
+prepare stmt from 'select "test #internal comment" #external comment
+,a from t1';
+execute stmt;
+test #internal comment a
+test #internal comment 1
+test #internal comment 2
+test #internal comment 3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 5
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 5
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 22
+DROP TABLE t1;
+SET GLOBAL query_cache_size= default;
+set global query_cache_strip_comments=OFF;
diff --git a/mysql-test/suite/percona/percona_query_cache_with_comments_prepared_statements.test b/mysql-test/suite/percona/percona_query_cache_with_comments_prepared_statements.test
new file mode 100644
index 00000000000..78cb7220aff
--- /dev/null
+++ b/mysql-test/suite/percona/percona_query_cache_with_comments_prepared_statements.test
@@ -0,0 +1,208 @@
+-- source include/have_query_cache.inc
+
+set GLOBAL query_cache_size=1355776;
+
+# Reset query cache variables.
+flush query cache; # This crashed in some versions
+flush query cache; # This crashed in some versions
+reset query cache;
+flush status;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# First simple test
+#
+
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+
+set global query_cache_strip_comments=ON;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from '/* with comment */ select * from t1';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+execute stmt;
+execute stmt;
+execute stmt;
+execute stmt;
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * from t1';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * /*internal comment*/from t1';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * /*internal comment*/ from t1';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * from t1 /* at the end */';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * from t1 /* with "quote" */';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * from t1 /* with \'quote\' */';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * from t1 # 123
+';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * from t1 # 123 with "quote"
+';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * from t1 # 123 with \'quote\'
+';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * from t1
+# 123
+';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from '#456
+select * from t1
+# 123
+';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * from t1 -- 123
+';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select * from t1
+-- 123
+';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from '-- comment in first
+select * from t1
+# 123
+';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from '(#456(
+select * from t1
+# 123(
+)';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from '/*test*/(-- comment in first(
+select * from t1
+-- 123 asdasd
+/* test */)';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select "test",a from t1';
+execute stmt;
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select "test /* internal \'comment\' */",a from t1';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select "test #internal comment" ,a from t1';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+prepare stmt from 'select "test #internal comment" #external comment
+,a from t1';
+execute stmt;
+
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+DROP TABLE t1;
+SET GLOBAL query_cache_size= default;
+set global query_cache_strip_comments=OFF;
diff --git a/mysql-test/suite/percona/percona_show_temp_tables.result b/mysql-test/suite/percona/percona_show_temp_tables.result
new file mode 100644
index 00000000000..cbcb0331896
--- /dev/null
+++ b/mysql-test/suite/percona/percona_show_temp_tables.result
@@ -0,0 +1,58 @@
+drop table if exists t1,t2,t3;
+drop database if exists showtemp;
+create database if not exists showtemp;
+use test;
+create temporary table t1(id int);
+create temporary table t2(id int);
+create temporary table showtemp.t3(id int);
+insert into t1 values(10),(20),(30),(40);
+insert into showtemp.t3 values(999);
+show temporary tables;
+Temp_tables_in_test
+t2
+t1
+show temporary tables from test;
+Temp_tables_in_test
+t2
+t1
+show temporary tables in showtemp;
+Temp_tables_in_showtemp
+t3
+select table_schema, table_name, engine, table_rows from Information_schema.temporary_tables;
+table_schema table_name engine table_rows
+showtemp t3 MyISAM 1
+test t2 MyISAM 0
+test t1 MyISAM 4
+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
+table_schema table_name engine table_rows
+showtemp t3 MyISAM 1
+test t2 MyISAM 0
+test t1 MyISAM 4
+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='showtemp';
+table_schema table_name engine table_rows
+showtemp t3 MyISAM 1
+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='temp';
+table_schema table_name engine table_rows
+drop table if exists showtemp.t2;
+create temporary table t1(id int);
+create temporary table showtemp.t2(id int);
+show temporary tables;
+Temp_tables_in_test
+t1
+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
+table_schema table_name engine table_rows
+showtemp t2 MyISAM 0
+test t1 MyISAM 0
+showtemp t3 MyISAM 1
+test t2 MyISAM 0
+test t1 MyISAM 4
+drop table showtemp.t2;
+drop table t1;
+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
+table_schema table_name engine table_rows
+showtemp t3 MyISAM 1
+test t2 MyISAM 0
+test t1 MyISAM 4
+drop table t1, t2;
+drop table showtemp.t3;
+drop database showtemp;
diff --git a/mysql-test/suite/percona/percona_show_temp_tables.test b/mysql-test/suite/percona/percona_show_temp_tables.test
new file mode 100644
index 00000000000..8837df199c5
--- /dev/null
+++ b/mysql-test/suite/percona/percona_show_temp_tables.test
@@ -0,0 +1,65 @@
+# Uses GRANT commands that usually disabled in embedded server
+-- source include/not_embedded.inc
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+#
+# Test of SHOW [GLOBAL] TEMPORARY TABLES [FROM/IN] DB and
+# Information_schema.temporary_tables and global_temporary_tables
+#
+
+connect(stcon1,localhost,root,,test);
+connect(stcon2,localhost,root,,test);
+
+connection stcon1;
+
+--disable_warnings
+drop table if exists t1,t2,t3;
+drop database if exists showtemp;
+create database if not exists showtemp;
+--enable_warnings
+
+use test;
+create temporary table t1(id int);
+create temporary table t2(id int);
+create temporary table showtemp.t3(id int);
+insert into t1 values(10),(20),(30),(40);
+insert into showtemp.t3 values(999);
+
+show temporary tables;
+# "Session" is not same value always. mysql-test cannot test it always.
+#show global temporary tables;
+show temporary tables from test;
+show temporary tables in showtemp;
+select table_schema, table_name, engine, table_rows from Information_schema.temporary_tables;
+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='showtemp';
+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='temp';
+
+connection stcon2;
+
+--disable_warnings
+drop table if exists showtemp.t2;
+--enable_warnings
+create temporary table t1(id int);
+create temporary table showtemp.t2(id int);
+show temporary tables;
+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
+drop table showtemp.t2;
+drop table t1;
+
+disconnect stcon2;
+
+connection stcon1;
+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
+
+drop table t1, t2;
+drop table showtemp.t3;
+drop database showtemp;
+
+connection default;
+disconnect stcon1;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/percona/percona_slow_query_log-control_global_slow-master.opt b/mysql-test/suite/percona/percona_slow_query_log-control_global_slow-master.opt
new file mode 100644
index 00000000000..91dd41305cd
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-control_global_slow-master.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_slow_query_log-control_global_slow.log --long-query-time=1 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.result b/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.result
new file mode 100644
index 00000000000..bc6ce100b35
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.result
@@ -0,0 +1,12 @@
+SELECT sleep(2);
+sleep(2)
+0
+set global log_slow_verbosity=innodb;
+set global use_global_log_slow_control="log_slow_verbosity,long_query_time";
+SELECT sleep(2);
+sleep(2)
+0
+set global use_global_log_slow_control=none;
+set global log_slow_verbosity=microtime;
+cat MYSQLD_DATADIR/percona_slow_query_log-control_global_slow.log | grep -c "No InnoDB statistics available for this query"
+1
diff --git a/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test b/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test
new file mode 100644
index 00000000000..79b94825821
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test
@@ -0,0 +1,12 @@
+source include/have_innodb.inc;
+SELECT sleep(2);
+set global log_slow_verbosity=innodb;
+set global use_global_log_slow_control="log_slow_verbosity,long_query_time";
+SELECT sleep(2);
+set global use_global_log_slow_control=none;
+set global log_slow_verbosity=microtime;
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-control_global_slow.log | grep -c "No InnoDB statistics available for this query";
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+exec echo '$cmd';
+exec $cmd;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter-master.opt b/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter-master.opt
new file mode 100644
index 00000000000..cb93f7abf05
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter-master.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_slow_query_log-log_slow_filter.log --long-query-time=1 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.result b/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.result
new file mode 100644
index 00000000000..9c8f69745a7
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.result
@@ -0,0 +1,25 @@
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+drop table if exists t;
+# Create test table
+create table t(id INT PRIMARY KEY) engine=InnoDB;
+# Insert two rows to test table
+insert into t values(1);
+insert into t values(2);
+insert into t values(3);
+SET GLOBAL SLOW_QUERY_LOG=ON;
+SELECT sleep(2);
+sleep(2)
+0
+set log_slow_filter=full_join;
+SELECT sleep(2) union select t2.id from t as t1,t as t2;
+sleep(2)
+0
+1
+2
+3
+SELECT sleep(2);
+sleep(2)
+0
+drop table if exists t;
+cat MYSQLD_DATADIR/percona_slow_query_log-log_slow_filter.log | grep -c Query_time
+2
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test b/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test
new file mode 100644
index 00000000000..843567ae11a
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test
@@ -0,0 +1,33 @@
+source include/have_innodb.inc;
+
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+
+--disable_warnings
+drop table if exists t;
+--enable_warnings
+
+--echo # Create test table
+create table t(id INT PRIMARY KEY) engine=InnoDB;
+--echo # Insert two rows to test table
+insert into t values(1);
+insert into t values(2);
+insert into t values(3);
+
+SET GLOBAL SLOW_QUERY_LOG=ON;
+
+SELECT sleep(2);
+
+set log_slow_filter=full_join;
+
+SELECT sleep(2) union select t2.id from t as t1,t as t2;
+SELECT sleep(2);
+
+--disable_warnings
+drop table if exists t;
+--enable_warnings
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-log_slow_filter.log | grep -c Query_time;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+exec echo '$cmd';
+exec $cmd;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity-master.opt b/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity-master.opt
new file mode 100644
index 00000000000..8d21f40a34f
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity-master.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_slow_query_log-log_slow_verbosity.log --long-query-time=1 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.result b/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.result
new file mode 100644
index 00000000000..ff42937fa4a
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.result
@@ -0,0 +1,9 @@
+SELECT sleep(2);
+sleep(2)
+0
+set log_slow_verbosity=innodb;
+SELECT sleep(2);
+sleep(2)
+0
+cat MYSQLD_DATADIR/percona_slow_query_log-log_slow_verbosity.log | grep -c "No InnoDB statistics available for this query"
+1
diff --git a/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test b/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test
new file mode 100644
index 00000000000..62717c4ed6e
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test
@@ -0,0 +1,13 @@
+source include/have_innodb.inc;
+
+SELECT sleep(2);
+
+set log_slow_verbosity=innodb;
+
+SELECT sleep(2);
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-log_slow_verbosity.log | grep -c "No InnoDB statistics available for this query";
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+exec echo '$cmd';
+exec $cmd;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-long_query_time-master.opt b/mysql-test/suite/percona/percona_slow_query_log-long_query_time-master.opt
new file mode 100644
index 00000000000..473323e0bd9
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-long_query_time-master.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_slow_query_log-long_query_time.log --long-query-time=2 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_slow_query_log-long_query_time.result b/mysql-test/suite/percona/percona_slow_query_log-long_query_time.result
new file mode 100644
index 00000000000..abc9c1d9994
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-long_query_time.result
@@ -0,0 +1,22 @@
+SELECT sleep(1);
+sleep(1)
+0
+SELECT sleep(3);
+sleep(3)
+0
+SELECT sleep(5);
+sleep(5)
+0
+set long_query_time=4;
+SELECT sleep(1);
+sleep(1)
+0
+SELECT sleep(3);
+sleep(3)
+0
+SELECT sleep(5);
+sleep(5)
+0
+set long_query_time=2;
+cat MYSQLD_DATADIR/percona_slow_query_log-long_query_time.log | grep -c Query_time
+3
diff --git a/mysql-test/suite/percona/percona_slow_query_log-long_query_time.test b/mysql-test/suite/percona/percona_slow_query_log-long_query_time.test
new file mode 100644
index 00000000000..9c034a75fa8
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-long_query_time.test
@@ -0,0 +1,19 @@
+source include/have_innodb.inc;
+
+SELECT sleep(1);
+SELECT sleep(3);
+SELECT sleep(5);
+
+set long_query_time=4;
+
+SELECT sleep(1);
+SELECT sleep(3);
+SELECT sleep(5);
+
+set long_query_time=2;
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-long_query_time.log | grep -c Query_time;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+exec echo '$cmd';
+exec $cmd;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log-master.opt b/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log-master.opt
new file mode 100644
index 00000000000..6433539d3d1
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log-master.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_slow_query_log-microseconds_in_slow_query_log.log --long-query-time=1 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.result b/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.result
new file mode 100644
index 00000000000..fbfc954481e
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.result
@@ -0,0 +1,12 @@
+SELECT sleep(2);
+sleep(2)
+0
+set global slow_query_log_microseconds_timestamp=ON;
+SELECT sleep(2);
+sleep(2)
+0
+set global slow_query_log_microseconds_timestamp=OFF;
+cat MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+.[0-9]+'
+1
+cat MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+'
+2
diff --git a/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test b/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test
new file mode 100644
index 00000000000..67bf49400fa
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test
@@ -0,0 +1,20 @@
+source include/have_innodb.inc;
+
+SELECT sleep(2);
+
+set global slow_query_log_microseconds_timestamp=ON;
+
+SELECT sleep(2);
+
+set global slow_query_log_microseconds_timestamp=OFF;
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+.[0-9]+';
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+exec echo "$cmd";
+exec $cmd;
+
+let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-microseconds_in_slow_query_log.log | grep -E -c '# Time: [0-9]+[ ]+[0-9]+:[0-\9]+:[0-9]+';
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+exec echo "$cmd";
+exec $cmd;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit-master.opt b/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit-master.opt
new file mode 100644
index 00000000000..6f82556fb0c
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit-master.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_slow_query_log-min_examined_row_limit.log --long-query-time=1 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.result b/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.result
new file mode 100644
index 00000000000..32698a59837
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.result
@@ -0,0 +1,25 @@
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+drop table if exists t;
+# Create test table
+create table t(id INT PRIMARY KEY) engine=InnoDB;
+# Insert two rows to test table
+insert into t values(1);
+insert into t values(2);
+insert into t values(3);
+SET GLOBAL SLOW_QUERY_LOG=ON;
+SELECT sleep(2);
+sleep(2)
+0
+set min_examined_row_limit=5;
+SELECT sleep(2) union select t2.id from t as t1,t as t2;
+sleep(2)
+0
+1
+2
+3
+SELECT sleep(2);
+sleep(2)
+0
+drop table if exists t;
+cat MYSQLD_DATADIR/percona_slow_query_log-min_examined_row_limit.log | grep -c Query_time
+2
diff --git a/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test b/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test
new file mode 100644
index 00000000000..28287c4bcb2
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test
@@ -0,0 +1,33 @@
+source include/have_innodb.inc;
+
+SET GLOBAL SLOW_QUERY_LOG=OFF;
+
+--disable_warnings
+drop table if exists t;
+--enable_warnings
+
+--echo # Create test table
+create table t(id INT PRIMARY KEY) engine=InnoDB;
+--echo # Insert two rows to test table
+insert into t values(1);
+insert into t values(2);
+insert into t values(3);
+
+SET GLOBAL SLOW_QUERY_LOG=ON;
+
+SELECT sleep(2);
+
+set min_examined_row_limit=5;
+
+SELECT sleep(2) union select t2.id from t as t1,t as t2;
+SELECT sleep(2);
+
+--disable_warnings
+drop table if exists t;
+--enable_warnings
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-min_examined_row_limit.log | grep -c Query_time;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+exec echo '$cmd';
+exec $cmd;
diff --git a/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time-master.opt b/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time-master.opt
new file mode 100644
index 00000000000..e2f3b6f2041
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time-master.opt
@@ -0,0 +1 @@
+--slow-query-log-file=percona_slow_query_log-use_global_long_query_time.log --long-query-time=2 \ No newline at end of file
diff --git a/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.result b/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.result
new file mode 100644
index 00000000000..759f0636b5c
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.result
@@ -0,0 +1,24 @@
+SELECT sleep(1);
+sleep(1)
+0
+SELECT sleep(3);
+sleep(3)
+0
+SELECT sleep(5);
+sleep(5)
+0
+set global long_query_time=4;
+set global use_global_long_query_time=1;
+SELECT sleep(1);
+sleep(1)
+0
+SELECT sleep(3);
+sleep(3)
+0
+SELECT sleep(5);
+sleep(5)
+0
+set global long_query_time=2;
+set global use_global_long_query_time=0;
+cat MYSQLD_DATADIR/percona_slow_query_log-use_global_long_query_time.log | grep -c Query_time
+3
diff --git a/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test b/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test
new file mode 100644
index 00000000000..397526fccdd
--- /dev/null
+++ b/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test
@@ -0,0 +1,21 @@
+source include/have_innodb.inc;
+
+SELECT sleep(1);
+SELECT sleep(3);
+SELECT sleep(5);
+
+set global long_query_time=4;
+set global use_global_long_query_time=1;
+
+SELECT sleep(1);
+SELECT sleep(3);
+SELECT sleep(5);
+
+set global long_query_time=2;
+set global use_global_long_query_time=0;
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-use_global_long_query_time.log | grep -c Query_time;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+exec echo '$cmd';
+exec $cmd;
diff --git a/mysql-test/suite/percona/percona_suppress_log_warning_1592-master.opt b/mysql-test/suite/percona/percona_suppress_log_warning_1592-master.opt
new file mode 100644
index 00000000000..4658d62af60
--- /dev/null
+++ b/mysql-test/suite/percona/percona_suppress_log_warning_1592-master.opt
@@ -0,0 +1 @@
+--log-error
diff --git a/mysql-test/suite/percona/percona_suppress_log_warning_1592.result b/mysql-test/suite/percona/percona_suppress_log_warning_1592.result
new file mode 100644
index 00000000000..4715499b08f
--- /dev/null
+++ b/mysql-test/suite/percona/percona_suppress_log_warning_1592.result
@@ -0,0 +1,28 @@
+SET @old_log_warnings = @@log_warnings;
+SET @old_suppress_log_warning_1592 = @@suppress_log_warning_1592;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
+SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 0;
+SET GLOBAL LOG_WARNINGS = 0;
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+SET GLOBAL LOG_WARNINGS = 1;
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 1;
+SET GLOBAL LOG_WARNINGS = 0;
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+SET GLOBAL LOG_WARNINGS = 1;
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+DROP TABLE t1;
+SET GLOBAL log_warnings = @old_log_warnings;
+SET GLOBAL suppress_log_warning_1592 = @old_suppress_log_warning_1592;
+# Count the number of times the "Unsafe" message was printed
+# to the error log.
+Occurrences: 1
diff --git a/mysql-test/suite/percona/percona_suppress_log_warning_1592.test b/mysql-test/suite/percona/percona_suppress_log_warning_1592.test
new file mode 100644
index 00000000000..97fe40469fc
--- /dev/null
+++ b/mysql-test/suite/percona/percona_suppress_log_warning_1592.test
@@ -0,0 +1,46 @@
+-- source include/have_log_bin.inc
+-- source include/have_binlog_format_statement.inc
+
+SET @old_log_warnings = @@log_warnings;
+SET @old_suppress_log_warning_1592 = @@suppress_log_warning_1592;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
+SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 0;
+SET GLOBAL LOG_WARNINGS = 0;
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+SET GLOBAL LOG_WARNINGS = 1;
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+SET GLOBAL SUPPRESS_LOG_WARNING_1592 = 1;
+SET GLOBAL LOG_WARNINGS = 0;
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+SET GLOBAL LOG_WARNINGS = 1;
+INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
+DROP TABLE t1;
+
+SET GLOBAL log_warnings = @old_log_warnings;
+SET GLOBAL suppress_log_warning_1592 = @old_suppress_log_warning_1592;
+
+let $log_error_= `SELECT @@GLOBAL.log_error`;
+if(!`select LENGTH('$log_error_')`)
+{
+ # MySQL Server on windows is started with --console and thus
+ # does not know the location of its .err log, use default location
+ let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+}
+# Assign env variable LOG_ERROR
+let LOG_ERROR=$log_error_;
+
+--echo # Count the number of times the "Unsafe" message was printed
+--echo # to the error log.
+
+perl;
+ use strict;
+ my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set";
+ open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
+ my $count = () = grep(/suppress_1592/g,<FILE>);
+ print "Occurrences: $count\n";
+ close(FILE);
+EOF
diff --git a/mysql-test/suite/percona/percona_xtradb_admin_command.result b/mysql-test/suite/percona/percona_xtradb_admin_command.result
new file mode 100644
index 00000000000..26ba14f2f3b
--- /dev/null
+++ b/mysql-test/suite/percona/percona_xtradb_admin_command.result
@@ -0,0 +1,6 @@
+select * from information_schema.XTRADB_ADMIN_COMMAND;
+result_message
+No XTRA_* command in the SQL statement. Please add /*!XTRA_xxxx*/ to the SQL.
+select * from information_schema.XTRADB_ADMIN_COMMAND /*!XTRA_HELLO*/;
+result_message
+Hello!
diff --git a/mysql-test/suite/percona/percona_xtradb_admin_command.test b/mysql-test/suite/percona/percona_xtradb_admin_command.test
new file mode 100644
index 00000000000..5dc3fb2b33a
--- /dev/null
+++ b/mysql-test/suite/percona/percona_xtradb_admin_command.test
@@ -0,0 +1,3 @@
+--source include/have_innodb.inc
+select * from information_schema.XTRADB_ADMIN_COMMAND;
+select * from information_schema.XTRADB_ADMIN_COMMAND /*!XTRA_HELLO*/;
diff --git a/mysql-test/suite/percona/percona_xtradb_bug317074.result b/mysql-test/suite/percona/percona_xtradb_bug317074.result
new file mode 100644
index 00000000000..82a98844652
--- /dev/null
+++ b/mysql-test/suite/percona/percona_xtradb_bug317074.result
@@ -0,0 +1,4 @@
+SET @old_innodb_file_format=@@innodb_file_format;
+SET @old_innodb_file_per_table=@@innodb_file_per_table;
+SET GLOBAL innodb_file_format='Barracuda';
+SET GLOBAL innodb_file_per_table=ON;
diff --git a/mysql-test/t/innodb_xtradb_bug317074.test b/mysql-test/suite/percona/percona_xtradb_bug317074.test
index 3b58c34598a..91c59cefb73 100644
--- a/mysql-test/t/innodb_xtradb_bug317074.test
+++ b/mysql-test/suite/percona/percona_xtradb_bug317074.test
@@ -1,4 +1,4 @@
---source include/have_innodb.inc
+-- source include/have_innodb.inc
SET @old_innodb_file_format=@@innodb_file_format;
SET @old_innodb_file_per_table=@@innodb_file_per_table;
@@ -6,9 +6,10 @@ let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=ON;
---disable_warnings
+-- disable_query_log
+-- disable_result_log
+
DROP TABLE IF EXISTS `test1`;
---enable_warnings
CREATE TABLE IF NOT EXISTS `test1` (
`a` int primary key auto_increment,
`b` int default 0,
@@ -32,11 +33,7 @@ REPEAT
UNTIL @x >= p1 END REPEAT;
END|
delimiter ;|
---disable_query_log
---disable_result_log
call insert_many(100000);
---enable_query_log
---enable_result_log
DROP PROCEDURE insert_many;
# The bug is hangup at the following statement
diff --git a/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc b/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc
index 70e17cef9fe..79825016448 100644
--- a/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc
+++ b/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc
@@ -66,9 +66,7 @@ ALTER TABLE t2 DROP COLUMN d;
--echo
--echo
--echo ******************** SHOW BINLOG EVENTS ********************
---replace_column 2 # 5 #
---replace_regex /Server ver: .+/Server ver: #/ /table_id: [0-9]+/table_id: #/
-show binlog events from 1;
+source include/show_binlog_events.inc;
sync_slave_with_master;
# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test_rpl > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
diff --git a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
index e9adb805c99..d953397c0cb 100644
--- a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
+++ b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
@@ -326,10 +326,7 @@ DROP VIEW v2;
--echo
--echo
--echo ******************** SHOW BINLOG EVENTS ********************
---replace_column 2 # 5 #
---replace_regex /Server ver: .+/Server ver: #/ /table_id: [0-9]+/table_id: #/ /COMMIT.+xid=[0-9]+.+/#/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show binlog events from 1;
+--source include/show_binlog_events.inc
sync_slave_with_master;
# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test_rpl > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
diff --git a/mysql-test/suite/rpl/r/rpl_000015.result b/mysql-test/suite/rpl/r/rpl_000015.result
deleted file mode 100644
index 03b96d5870b..00000000000
--- a/mysql-test/suite/rpl/r/rpl_000015.result
+++ /dev/null
@@ -1,141 +0,0 @@
-reset master;
-show master status;
-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;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-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
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 7
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-drop table if exists t1;
-create table t1 (n int, PRIMARY KEY(n));
-insert into t1 values (10),(45),(90);
-SELECT * FROM t1 ORDER BY n;
-n
-10
-45
-90
-SELECT * FROM t1 ORDER BY n;
-n
-10
-45
-90
-drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_grant.result b/mysql-test/suite/rpl/r/rpl_binlog_grant.result
index 4a789f361c6..7a2e3183d5b 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_grant.result
@@ -17,16 +17,6 @@ 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;
-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
start transaction;
insert into t values (2);
revoke select on t from x@y;
@@ -38,19 +28,5 @@ s1
show grants for x@y;
Grants for x@y
GRANT USAGE ON *.* TO 'x'@'y'
-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 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
drop user x@y;
drop database d1;
diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result
index a17941f6ba9..292922a1afd 100644
--- a/mysql-test/suite/rpl/r/rpl_bug33931.result
+++ b/mysql-test/suite/rpl/r/rpl_bug33931.result
@@ -4,43 +4,5 @@ stop slave;
reset slave;
SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File
-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 #
-Last_Error Failed during slave thread initialization
-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 #
-Last_SQL_Error Failed during slave thread initialization
+Last_SQL_Error = Failed during slave thread initialization
SET GLOBAL debug="";
diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result
index c06c1201e3d..883feb42b3f 100644
--- a/mysql-test/suite/rpl/r/rpl_change_master.result
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result
@@ -10,86 +10,8 @@ n
stop slave sql_thread;
insert into t1 values(1);
insert into t1 values(2);
-stop slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running 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
+include/stop_slave.inc
change master to master_user='root';
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running 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
start slave;
select * from t1;
n
diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
index 6c8d35619e5..1485389204b 100644
--- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
@@ -50,45 +50,7 @@ a
SELECT * FROM t3;
a
3
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
*** Test lock wait timeout ***
include/stop_slave.inc
@@ -112,52 +74,14 @@ SELECT * FROM t3;
a
3
3
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
*** 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=MASTER_POS_BEGIN;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
@@ -179,45 +103,7 @@ a
3
3
3
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
*** Clean up ***
DROP TABLE t1,t2,t3;
diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result
index a87eaa6e537..45c5bcf7ba0 100644
--- a/mysql-test/suite/rpl/r/rpl_do_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_do_grant.result
@@ -89,6 +89,7 @@ show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
DROP DATABASE IF EXISTS bug42217_db;
CREATE DATABASE bug42217_db;
GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost'
@@ -165,9 +166,14 @@ USE test;
DROP FUNCTION bug42217_db.upgrade_del_func;
DROP FUNCTION bug42217_db.upgrade_alter_func;
DROP DATABASE bug42217_db;
-call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
stop slave;
DROP USER 'create_rout_db'@'localhost';
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
######## BUG#49119 #######
### i) test case from the 'how to repeat section'
stop slave;
diff --git a/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result
index 4c6323a61db..aa1a573d052 100644
--- a/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result
+++ b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result
@@ -6,9 +6,9 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
reset master;
change master to master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root";
-start slave;
+include/start_slave.inc
create table t1 (n int);
-stop slave;
+include/stop_slave.inc
create table t2 (n int);
show tables;
Tables_in_test
@@ -22,20 +22,20 @@ insert into t3 values(2);
insert into t3 values(3);
commit;
insert into t3 values(4);
-start slave until master_log_file="slave-bin.000001",master_log_pos=195;
+start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS;
Warnings:
Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart
show tables;
Tables_in_test
t1
t2
-start slave until master_log_file="slave-bin.000001",master_log_pos=438;
+start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS;
Warnings:
Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart
select * from t3;
n
1
-start slave until master_log_file="slave-bin.000001",master_log_pos=663;
+start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS;
Warnings:
Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart
select * from t3;
@@ -43,7 +43,7 @@ n
1
2
3
-start slave;
+include/start_slave.inc
create table t4 (n int);
create table t5 (n int);
create table t6 (n int);
@@ -55,6 +55,6 @@ t3
t4
t5
t6
-stop slave;
+include/stop_slave.inc
reset slave;
drop table t1,t2,t3,t4,t5,t6;
diff --git a/mysql-test/suite/rpl/r/rpl_empty_master_crash.result b/mysql-test/suite/rpl/r/rpl_empty_master_crash.result
index f0d84f85069..f71411c68dd 100644
--- a/mysql-test/suite/rpl/r/rpl_empty_master_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_empty_master_crash.result
@@ -4,7 +4,6 @@ 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;
diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
index 63154383e8c..48fd0366c26 100644
--- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
@@ -54,45 +54,7 @@ a b c
3 4 QA TESTING
*** Start Slave ***
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
@@ -119,49 +81,12 @@ set @b1 = 'b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t3 ***
DROP TABLE t3;
*** Create t4 on slave ***
@@ -181,49 +106,12 @@ START SLAVE;
INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
(30000.22,4,'QA TESTING');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t4 ***
DROP TABLE t4;
*** Create t5 on slave ***
@@ -243,49 +131,12 @@ START SLAVE;
INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
(2,'JOE',300.01,0,'b2b2',1.0000009);
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t5 ***
DROP TABLE t5;
*** Create t6 on slave ***
@@ -304,47 +155,9 @@ START SLAVE;
INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
(2,'JOE',300.01,0);
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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_Error = Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -440,49 +253,12 @@ set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t10 ***
DROP TABLE t10;
*** Create t11 on slave ***
@@ -501,49 +277,12 @@ set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t11 ***
DROP TABLE t11;
*** Create t12 on slave ***
@@ -753,47 +492,10 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
********************************************
*** Expect slave to fail with Error 1060 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1060
-Last_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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'
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1;
+include/start_slave.inc
*** Try to insert in master ****
INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
SELECT * FROM t15 ORDER BY c1;
@@ -891,48 +593,11 @@ START SLAVE;
*** Master Data Insert ***
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
** DROP table t17 ***
DROP TABLE t17;
diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
index d80ac5eea2c..80b18ee4bd7 100644
--- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
@@ -54,45 +54,7 @@ a b c
3 4 QA TESTING
*** Start Slave ***
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
@@ -119,49 +81,12 @@ set @b1 = 'b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t3 ***
DROP TABLE t3;
*** Create t4 on slave ***
@@ -181,49 +106,12 @@ START SLAVE;
INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
(30000.22,4,'QA TESTING');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t4 ***
DROP TABLE t4;
*** Create t5 on slave ***
@@ -243,49 +131,12 @@ START SLAVE;
INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
(2,'JOE',300.01,0,'b2b2',1.0000009);
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t5 ***
DROP TABLE t5;
*** Create t6 on slave ***
@@ -304,47 +155,9 @@ START SLAVE;
INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
(2,'JOE',300.01,0);
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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_Error = Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -440,49 +253,12 @@ set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t10 ***
DROP TABLE t10;
*** Create t11 on slave ***
@@ -501,49 +277,12 @@ set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t11 ***
DROP TABLE t11;
*** Create t12 on slave ***
@@ -753,47 +492,10 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
********************************************
*** Expect slave to fail with Error 1060 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1060
-Last_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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'
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1;
+include/start_slave.inc
*** Try to insert in master ****
INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
SELECT * FROM t15 ORDER BY c1;
@@ -891,48 +593,11 @@ START SLAVE;
*** Master Data Insert ***
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
** DROP table t17 ***
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..e8535a0bc5e 100644
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
@@ -91,49 +91,7 @@ f1 f2 f3 f4
27 27 27 next
29 29 29 second
30 30 30 next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-
+Checking that both slave threads are running.
***** Testing Altering table def scenario *****
@@ -465,50 +423,12 @@ delete from t2;
delete from t3;
delete from t4;
delete from t31;
+select * from t31;
+f1 f2 f3 f4
** Check slave status **
-select * from t31;
-f1 f2 f3 f4
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
****************************************
* columns in master at middle of table *
@@ -541,50 +461,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t10 ***
DROP TABLE t10;
@@ -616,50 +499,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t11 ***
DROP TABLE t11;
@@ -770,45 +616,7 @@ c1 c3 hex(c4) c5 c6
************
* Bug30415 *
************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1091
-Last_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -856,45 +664,7 @@ c1 hex(c4) c5 c6 c7 c2
*** Expect slave to fail with Error 1054 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1054
-Last_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -942,45 +712,7 @@ c1 hex(c4) c5 c6 c7
*** BUG 30434 ***
*****************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1072
-Last_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-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 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)'
+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)'
STOP SLAVE;
RESET SLAVE;
@@ -1232,49 +964,7 @@ f1 f2 f3 f4
27 27 27 next
29 29 29 second
30 30 30 next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-
+Checking that both slave threads are running.
***** Testing Altering table def scenario *****
@@ -1606,50 +1296,12 @@ delete from t2;
delete from t3;
delete from t4;
delete from t31;
+select * from t31;
+f1 f2 f3 f4
** Check slave status **
-select * from t31;
-f1 f2 f3 f4
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
****************************************
* columns in master at middle of table *
@@ -1682,50 +1334,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t10 ***
DROP TABLE t10;
@@ -1757,50 +1372,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t11 ***
DROP TABLE t11;
@@ -1911,45 +1489,7 @@ c1 c3 hex(c4) c5 c6
************
* Bug30415 *
************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1091
-Last_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -1997,45 +1537,7 @@ c1 hex(c4) c5 c6 c7 c2
*** Expect slave to fail with Error 1054 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1054
-Last_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -2083,45 +1585,7 @@ c1 hex(c4) c5 c6 c7
*** BUG 30434 ***
*****************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1072
-Last_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-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 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)'
+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)'
STOP SLAVE;
RESET SLAVE;
@@ -2373,49 +1837,7 @@ f1 f2 f3 f4
27 27 27 next
29 29 29 second
30 30 30 next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-
+Checking that both slave threads are running.
***** Testing Altering table def scenario *****
@@ -2747,50 +2169,12 @@ delete from t2;
delete from t3;
delete from t4;
delete from t31;
+select * from t31;
+f1 f2 f3 f4
** Check slave status **
-select * from t31;
-f1 f2 f3 f4
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
****************************************
* columns in master at middle of table *
@@ -2823,50 +2207,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t10 ***
DROP TABLE t10;
@@ -2898,50 +2245,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t11 ***
DROP TABLE t11;
@@ -3052,45 +2362,7 @@ c1 c3 hex(c4) c5 c6
************
* Bug30415 *
************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1091
-Last_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -3138,45 +2410,7 @@ c1 hex(c4) c5 c6 c7 c2
*** Expect slave to fail with Error 1054 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1054
-Last_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -3224,45 +2458,7 @@ c1 hex(c4) c5 c6 c7
*** BUG 30434 ***
*****************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1072
-Last_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-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 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)'
+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)'
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..f360a8847eb 100644
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
@@ -91,49 +91,7 @@ f1 f2 f3 f4
27 27 27 next
29 29 29 second
30 30 30 next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-
+Checking that both slave threads are running.
***** Testing Altering table def scenario *****
@@ -465,50 +423,12 @@ delete from t2;
delete from t3;
delete from t4;
delete from t31;
+select * from t31;
+f1 f2 f3 f4
** Check slave status **
-select * from t31;
-f1 f2 f3 f4
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
****************************************
* columns in master at middle of table *
@@ -541,50 +461,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t10 ***
DROP TABLE t10;
@@ -616,50 +499,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t11 ***
DROP TABLE t11;
@@ -770,45 +616,7 @@ c1 c3 hex(c4) c5 c6
************
* Bug30415 *
************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1091
-Last_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -856,45 +664,7 @@ c1 hex(c4) c5 c6 c7 c2
*** Expect slave to fail with Error 1054 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1054
-Last_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -942,45 +712,7 @@ c1 hex(c4) c5 c6 c7
*** BUG 30434 ***
*****************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1072
-Last_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-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 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)'
+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)'
STOP SLAVE;
RESET SLAVE;
@@ -1232,49 +964,7 @@ f1 f2 f3 f4
27 27 27 next
29 29 29 second
30 30 30 next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-
+Checking that both slave threads are running.
***** Testing Altering table def scenario *****
@@ -1606,50 +1296,12 @@ delete from t2;
delete from t3;
delete from t4;
delete from t31;
+select * from t31;
+f1 f2 f3 f4
** Check slave status **
-select * from t31;
-f1 f2 f3 f4
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
****************************************
* columns in master at middle of table *
@@ -1682,50 +1334,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t10 ***
DROP TABLE t10;
@@ -1757,50 +1372,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t11 ***
DROP TABLE t11;
@@ -1911,45 +1489,7 @@ c1 c3 hex(c4) c5 c6
************
* Bug30415 *
************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1091
-Last_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -1997,45 +1537,7 @@ c1 hex(c4) c5 c6 c7 c2
*** Expect slave to fail with Error 1054 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1054
-Last_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -2083,45 +1585,7 @@ c1 hex(c4) c5 c6 c7
*** BUG 30434 ***
*****************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1072
-Last_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-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 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)'
+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)'
STOP SLAVE;
RESET SLAVE;
@@ -2373,49 +1837,7 @@ f1 f2 f3 f4
27 27 27 next
29 29 29 second
30 30 30 next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-
+Checking that both slave threads are running.
***** Testing Altering table def scenario *****
@@ -2747,50 +2169,12 @@ delete from t2;
delete from t3;
delete from t4;
delete from t31;
+select * from t31;
+f1 f2 f3 f4
** Check slave status **
-select * from t31;
-f1 f2 f3 f4
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
****************************************
* columns in master at middle of table *
@@ -2823,50 +2207,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t10 ***
DROP TABLE t10;
@@ -2898,50 +2245,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
(3,@b1,DEFAULT,'QA',DEFAULT);
********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-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 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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t11 ***
DROP TABLE t11;
@@ -3052,45 +2362,7 @@ c1 c3 hex(c4) c5 c6
************
* Bug30415 *
************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1091
-Last_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -3138,45 +2410,7 @@ c1 hex(c4) c5 c6 c7 c2
*** Expect slave to fail with Error 1054 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1054
-Last_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-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 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'
+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'
STOP SLAVE;
RESET SLAVE;
@@ -3224,45 +2458,7 @@ c1 hex(c4) c5 c6 c7
*** BUG 30434 ***
*****************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1072
-Last_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-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 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)'
+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)'
STOP SLAVE;
RESET SLAVE;
diff --git a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
index 7eddaabc636..5f1f72a9a3a 100644
--- a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
+++ b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
@@ -49,82 +49,82 @@ UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
[on slave]
show tables like 't%';
diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
index 600ac44fc86..3bb96b669d7 100644
--- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
+++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
@@ -19,43 +19,9 @@ stop slave;
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=SLAVE_PORT;
include/start_slave.inc
+CREATE TABLE t1 (a INT KEY) ENGINE= MyISAM;
+INSERT INTO t1 VALUE(1);
FLUSH LOGS;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port SLAVE_PORT
-Connect_Retry 60
-Master_Log_File slave-bin.000001
-Read_Master_Log_Pos POSITION
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File slave-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos POSITION
-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 #
-Last_IO_Errno #
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
+INSERT INTO t1 VALUE(2);
+Checking that both slave threads are running.
+Relay_Log_File relay-log.000003
diff --git a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
index a34c536feb8..432bcfcc94d 100644
--- a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
+++ b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
@@ -14,7 +14,6 @@ slave is going to hang in get_master_version_and_clock
slave is unblocked
SET DEBUG_SYNC='now SIGNAL signal.get_unix_timestamp';
Check network error happened here
-NETWORK ERROR
set @@global.debug = "-d,'debug_lock.before_get_UNIX_TIMESTAMP'";
stop slave;
SET @@global.debug= "+d,'debug_lock.before_get_SERVER_ID'";
@@ -23,7 +22,6 @@ slave is going to hang in get_master_version_and_clock
slave is unblocked
SET DEBUG_SYNC='now SIGNAL signal.get_server_id';
Check network error happened here
-NETWORK ERROR
set @@global.debug = "-d,'debug_lock.before_get_SERVER_ID'";
set global debug= '';
reset master;
@@ -31,6 +29,5 @@ include/stop_slave.inc
change master to master_port=SLAVE_PORT;
start slave;
*** must be having the replicate-same-server-id IO thread error ***
-Slave_IO_Errno= 1593
-Slave_IO_Error= Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
+Last_IO_Error = Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/suite/rpl/r/rpl_grant.result b/mysql-test/suite/rpl/r/rpl_grant.result
index 1bed6101e3c..285d52b7678 100644
--- a/mysql-test/suite/rpl/r/rpl_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_grant.result
@@ -41,42 +41,3 @@ user host
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%';
COUNT(*)
0
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result
index c3baabbdbc3..6c226aaf2f7 100644
--- a/mysql-test/suite/rpl/r/rpl_incident.result
+++ b/mysql-test/suite/rpl/r/rpl_incident.result
@@ -19,51 +19,13 @@ a
2
3
4
+Last_SQL_Error = The incident LOST_EVENTS occured on the master. Message: <none>
**** On Slave ****
SELECT * FROM t1;
a
1
2
3
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File #
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1590
-Last_Error The incident LOST_EVENTS occured on the master. Message: <none>
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 1590
-Last_SQL_Error The incident LOST_EVENTS occured on the master. Message: <none>
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SELECT * FROM t1;
@@ -72,43 +34,5 @@ a
2
3
4
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File #
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000002
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result
index fbb1e2355c3..549842198e8 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result
@@ -136,25 +136,24 @@ ALTER TABLE t2 DROP COLUMN d;
******************** SHOW BINLOG EVENTS ********************
-show binlog events from 1;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: #
-master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test_rpl
-master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test_rpl_1
-master-bin.000001 # Query 1 # CREATE DATABASE test_rpl_1 CHARACTER SET utf8 COLLATE utf8_general_ci
-master-bin.000001 # Query 1 # ALTER DATABASE test_rpl_1 CHARACTER SET latin1 COLLATE latin1_general_ci
-master-bin.000001 # Query 1 # DROP DATABASE test_rpl_1
-master-bin.000001 # Query 1 # CREATE DATABASE test_rpl CHARACTER SET utf8 COLLATE utf8_general_ci
-master-bin.000001 # Query 1 # ALTER DATABASE test_rpl CHARACTER SET latin1 COLLATE latin1_swedish_ci
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE TABLE t0 (a int auto_increment not null, c int not null, PRIMARY KEY(a), KEY index2 (c)) ENGINE=innodb
-master-bin.000001 # Query 1 # use `test_rpl`; ALTER TABLE t0 DROP INDEX index2
-master-bin.000001 # Query 1 # use `test_rpl`; ALTER TABLE t0 ADD COLUMN b char(254)
-master-bin.000001 # Query 1 # use `test_rpl`; ALTER TABLE t0 ADD INDEX index1 (b)
-master-bin.000001 # Query 1 # use `test_rpl`; ALTER TABLE t0 DROP COLUMN c
-master-bin.000001 # Query 1 # use `test_rpl`; RENAME TABLE t0 TO t1
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE TABLE t2 LIKE t1
-master-bin.000001 # Query 1 # use `test_rpl`; ALTER TABLE t2 ADD COLUMN d datetime
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE INDEX index2 on t2 (d)
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE INDEX index3 on t2 (a, d)
-master-bin.000001 # Query 1 # use `test_rpl`; ALTER TABLE t2 DROP COLUMN d
+master-bin.000001 # Query # # DROP DATABASE IF EXISTS test_rpl
+master-bin.000001 # Query # # DROP DATABASE IF EXISTS test_rpl_1
+master-bin.000001 # Query # # CREATE DATABASE test_rpl_1 CHARACTER SET utf8 COLLATE utf8_general_ci
+master-bin.000001 # Query # # ALTER DATABASE test_rpl_1 CHARACTER SET latin1 COLLATE latin1_general_ci
+master-bin.000001 # Query # # DROP DATABASE test_rpl_1
+master-bin.000001 # Query # # CREATE DATABASE test_rpl CHARACTER SET utf8 COLLATE utf8_general_ci
+master-bin.000001 # Query # # ALTER DATABASE test_rpl CHARACTER SET latin1 COLLATE latin1_swedish_ci
+master-bin.000001 # Query # # use `test_rpl`; CREATE TABLE t0 (a int auto_increment not null, c int not null, PRIMARY KEY(a), KEY index2 (c)) ENGINE=innodb
+master-bin.000001 # Query # # use `test_rpl`; ALTER TABLE t0 DROP INDEX index2
+master-bin.000001 # Query # # use `test_rpl`; ALTER TABLE t0 ADD COLUMN b char(254)
+master-bin.000001 # Query # # use `test_rpl`; ALTER TABLE t0 ADD INDEX index1 (b)
+master-bin.000001 # Query # # use `test_rpl`; ALTER TABLE t0 DROP COLUMN c
+master-bin.000001 # Query # # use `test_rpl`; RENAME TABLE t0 TO t1
+master-bin.000001 # Query # # use `test_rpl`; CREATE TABLE t2 LIKE t1
+master-bin.000001 # Query # # use `test_rpl`; ALTER TABLE t2 ADD COLUMN d datetime
+master-bin.000001 # Query # # use `test_rpl`; CREATE INDEX index2 on t2 (d)
+master-bin.000001 # Query # # use `test_rpl`; CREATE INDEX index3 on t2 (a, d)
+master-bin.000001 # Query # # use `test_rpl`; ALTER TABLE t2 DROP COLUMN d
drop database test_rpl;
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
index 58b9d445037..26f2545dd72 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
@@ -830,278 +830,277 @@ DELETE FROM t2;
******************** SHOW BINLOG EVENTS ********************
-show binlog events from 1;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: #
-master-bin.000001 # Query 1 # CREATE DATABASE test_rpl
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE TABLE t1 (a int auto_increment not null, b char(254), PRIMARY KEY(a)) ENGINE=innodb
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE TABLE t2 (a int auto_increment not null, b char(254), PRIMARY KEY(a)) ENGINE=innodb
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(2, 't1, text 2')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1 WHERE a = 1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Table_map 1 # table_id: # (test_rpl.t2)
-master-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Table_map 1 # table_id: # (test_rpl.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t2 SELECT * FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t2 VALUES (1, 't1, text 1') ON DUPLICATE KEY UPDATE b = 't2, text 1'
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1 WHERE a = 2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2 WHERE a = 2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=#
-master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE `t1` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, `b`) ;file_id=#
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(2, 't1, text 2')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(3, 't1, text 3')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; REPLACE INTO t1 VALUES(1, 't1, text 11')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Table_map 1 # table_id: # (test_rpl.t1)
-master-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; REPLACE INTO t1 SET a=3, b='t1, text 33'
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1 WHERE a = 2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 'CCC')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(2, 'DDD')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t2 VALUES(1, 'DDD')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t2 VALUES(2, 'CCC')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; TRUNCATE t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; UPDATE t1 SET b = 't1, text 1 updated' WHERE a = 1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; UPDATE t1, t2 SET t1.b = 'test', t2.b = 'test'
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES (1, 'start')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES (3, 'before savepoint s1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES (5, 'before savepoint s2')
-master-bin.000001 # Query 1 # SAVEPOINT s2
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES (6, 'after savepoint s2')
-master-bin.000001 # Table_map 1 # table_id: # (test_rpl.t1)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1 WHERE a = 7
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE USER 'user_test_rpl'@'localhost' IDENTIFIED BY PASSWORD '*1111111111111111111111111111111111111111'
-master-bin.000001 # Query 1 # use `test_rpl`; GRANT SELECT ON *.* TO 'user_test_rpl'@'localhost'
-master-bin.000001 # Query 1 # use `test_rpl`; REVOKE SELECT ON *.* FROM 'user_test_rpl'@'localhost'
-master-bin.000001 # Query 1 # use `test_rpl`; SET PASSWORD FOR 'user_test_rpl'@'localhost'='*0000000000000000000000000000000000000000'
-master-bin.000001 # Query 1 # use `test_rpl`; RENAME USER 'user_test_rpl'@'localhost' TO 'user_test_rpl_2'@'localhost'
-master-bin.000001 # Query 1 # use `test_rpl`; DROP USER 'user_test_rpl_2'@'localhost'
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(100, 'test')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # use `test_rpl`; ANALYZE TABLE t1
-master-bin.000001 # Query 1 # use `test_rpl`; OPTIMIZE TABLE t1
-master-bin.000001 # Query 1 # use `test_rpl`; REPAIR TABLE t1
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+master-bin.000001 # Query # # CREATE DATABASE test_rpl
+master-bin.000001 # Query # # use `test_rpl`; CREATE TABLE t1 (a int auto_increment not null, b char(254), PRIMARY KEY(a)) ENGINE=innodb
+master-bin.000001 # Query # # use `test_rpl`; CREATE TABLE t2 (a int auto_increment not null, b char(254), PRIMARY KEY(a)) ENGINE=innodb
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(2, 't1, text 2')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1 WHERE a = 1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test_rpl.t2)
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test_rpl.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 # Query # # use `test_rpl`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t2 VALUES (1, 't1, text 1') ON DUPLICATE KEY UPDATE b = 't2, text 1'
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1 WHERE a = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2 WHERE a = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
+master-bin.000001 # Execute_load_query # # use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE `t1` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, `b`) ;file_id=#
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(2, 't1, text 2')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(3, 't1, text 3')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; REPLACE INTO t1 VALUES(1, 't1, text 11')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test_rpl.t1)
+master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; REPLACE INTO t1 SET a=3, b='t1, text 33'
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1 WHERE a = 2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(1, 'CCC')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(2, 'DDD')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t2 VALUES(1, 'DDD')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t2 VALUES(2, 'CCC')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; TRUNCATE t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; UPDATE t1 SET b = 't1, text 1 updated' WHERE a = 1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; UPDATE t1, t2 SET t1.b = 'test', t2.b = 'test'
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES (1, 'start')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES (3, 'before savepoint s1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES (5, 'before savepoint s2')
+master-bin.000001 # Query # # SAVEPOINT s2
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES (6, 'after savepoint s2')
+master-bin.000001 # Table_map # # table_id: # (test_rpl.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 # Query # # use `test_rpl`; DELETE FROM t1 WHERE a = 7
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test_rpl`; CREATE USER 'user_test_rpl'@'localhost' IDENTIFIED BY PASSWORD '*1111111111111111111111111111111111111111'
+master-bin.000001 # Query # # use `test_rpl`; GRANT SELECT ON *.* TO 'user_test_rpl'@'localhost'
+master-bin.000001 # Query # # use `test_rpl`; REVOKE SELECT ON *.* FROM 'user_test_rpl'@'localhost'
+master-bin.000001 # Query # # use `test_rpl`; SET PASSWORD FOR 'user_test_rpl'@'localhost'='*0000000000000000000000000000000000000000'
+master-bin.000001 # Query # # use `test_rpl`; RENAME USER 'user_test_rpl'@'localhost' TO 'user_test_rpl_2'@'localhost'
+master-bin.000001 # Query # # use `test_rpl`; DROP USER 'user_test_rpl_2'@'localhost'
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(100, 'test')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test_rpl`; ANALYZE TABLE t1
+master-bin.000001 # Query # # use `test_rpl`; OPTIMIZE TABLE t1
+master-bin.000001 # Query # # use `test_rpl`; REPAIR TABLE t1
+master-bin.000001 # Query # # use `test_rpl`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
BEGIN
UPDATE t1 SET b = 'test' WHERE a = 201;
END
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+master-bin.000001 # Query # # use `test_rpl`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
BEGIN
UPDATE t1 SET b = UUID() WHERE a = 202;
END
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(201, 'test 201')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; UPDATE t1 SET b = 'test' WHERE a = 201
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(202, 'test 202')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Table_map 1 # table_id: # (test_rpl.t1)
-master-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1 WHERE a = 202
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # use `test_rpl`; ALTER PROCEDURE p1 COMMENT 'p1'
-master-bin.000001 # Query 1 # use `test_rpl`; DROP PROCEDURE p1
-master-bin.000001 # Query 1 # use `test_rpl`; DROP PROCEDURE p2
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(201, 'test 201')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; UPDATE t1 SET b = 'test' WHERE a = 201
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(202, 'test 202')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test_rpl.t1)
+master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1 WHERE a = 202
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test_rpl`; ALTER PROCEDURE p1 COMMENT 'p1'
+master-bin.000001 # Query # # use `test_rpl`; DROP PROCEDURE p1
+master-bin.000001 # Query # # use `test_rpl`; DROP PROCEDURE p2
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test_rpl`; CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1
FOR EACH ROW BEGIN
INSERT INTO t2 SET a = NEW.a, b = NEW.b;
END
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Table_map 1 # table_id: # (test_rpl.t1)
-master-bin.000001 # Table_map 1 # table_id: # (test_rpl.t2)
-master-bin.000001 # Write_rows 1 # table_id: #
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # use `test_rpl`; DROP TRIGGER tr1
-master-bin.000001 # Query 1 # use `test_rpl`; GRANT EVENT ON *.* TO 'root'@'localhost'
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 'test1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE DEFINER=`root`@`localhost` EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1
-master-bin.000001 # Query 1 # use `test_rpl`; ALTER EVENT e1 RENAME TO e2
-master-bin.000001 # Query 1 # use `test_rpl`; DROP EVENT e2
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(1, 'test1')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; INSERT INTO t1 VALUES(2, 'test2')
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT * FROM t1 WHERE a = 1
-master-bin.000001 # Query 1 # use `test_rpl`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS SELECT * FROM t1 WHERE b <> UUID()
-master-bin.000001 # Query 1 # use `test_rpl`; ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT * FROM t1 WHERE a = 2
-master-bin.000001 # Query 1 # use `test_rpl`; DROP VIEW v1
-master-bin.000001 # Query 1 # use `test_rpl`; DROP VIEW v2
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
-master-bin.000001 # Xid 1 # #
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
-master-bin.000001 # Xid 1 # #
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test_rpl.t1)
+master-bin.000001 # Table_map # # table_id: # (test_rpl.t2)
+master-bin.000001 # Write_rows # # table_id: #
+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 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test_rpl`; DROP TRIGGER tr1
+master-bin.000001 # Query # # use `test_rpl`; GRANT EVENT ON *.* TO 'root'@'localhost'
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(1, 'test1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test_rpl`; CREATE DEFINER=`root`@`localhost` EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1
+master-bin.000001 # Query # # use `test_rpl`; ALTER EVENT e1 RENAME TO e2
+master-bin.000001 # Query # # use `test_rpl`; DROP EVENT e2
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(1, 'test1')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES(2, 'test2')
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test_rpl`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT * FROM t1 WHERE a = 1
+master-bin.000001 # Query # # use `test_rpl`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS SELECT * FROM t1 WHERE b <> UUID()
+master-bin.000001 # Query # # use `test_rpl`; ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT * FROM t1 WHERE a = 2
+master-bin.000001 # Query # # use `test_rpl`; DROP VIEW v1
+master-bin.000001 # Query # # use `test_rpl`; DROP VIEW v2
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test_rpl`; DELETE FROM t2
+master-bin.000001 # Xid # # COMMIT /* XID */
drop database test_rpl;
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..daefee9c669 100644
--- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
+++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
@@ -11,45 +11,7 @@ SELECT * FROM t1;
a b
1 10
2 2
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1105
-Last_Error Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10'
-Skip_Counter 0
-Exec_Master_Log_Pos 246
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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'
+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'
SELECT * FROM t1;
a b
stop slave;
@@ -94,49 +56,7 @@ id field_1 field_2 field_3
4 4 d 4d
5 5 e 5e
6 6 f 6f
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1105
-Last_Error Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1 (field_1, field_2, field_3)
-SELECT t2.field_a, t2.field_b, t2.field_c
-FROM t2
-ON DUPLICATE KEY UPDATE
-t1.field_3 = t2.field_c'
-Skip_Counter 0
-Exec_Master_Log_Pos 1278
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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 (field_1, field_2, field_3)
+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 (field_1, field_2, field_3)
SELECT t2.field_a, t2.field_b, t2.field_c
FROM t2
ON DUPLICATE KEY UPDATE
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
index ba0aa847cf7..9acc1ad93ac 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
@@ -6,85 +6,9 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,10);
-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 290
-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 290
-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
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos 560
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1593
-Last_Error Fatal error: Not enough memory
-Skip_Counter 0
-Exec_Master_Log_Pos 325
-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 1593
-Last_SQL_Error Fatal error: Not enough memory
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Fatal error: Not enough memory
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+include/start_slave.inc
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..3a52029fa4e 100644
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result
@@ -4,92 +4,18 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+create table if not exists t1 (n int);
+drop table t1;
call mtr.add_suppression ("Slave I/O: Got fatal error 1236 from master when reading data from binary");
+call mtr.add_suppression ("Error in Log_event::read_log_event");
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
include/stop_slave.inc
-change master to master_log_pos=75;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-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 #
-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_log_pos=MASTER_LOG_POS;
start slave;
+Last_IO_Error = Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'
include/stop_slave.inc
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos 75
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running No
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos 75
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
@@ -97,7 +23,7 @@ create table if not exists t1 (n int);
drop table if exists t1;
create table t1 (n int);
insert into t1 values (1),(2),(3);
-change master to master_log_pos=4;
+change master to master_log_pos=MASTER_LOG_POS;
start slave;
select * from t1 ORDER BY n;
n
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..6bb9b139057 100644
--- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
+++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
@@ -14,63 +14,22 @@ MIXED MIXED
CREATE TABLE t1 (a INT, b LONG);
INSERT INTO t1 VALUES (1,1), (2,2);
INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
-master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a INT, b LONG)
-master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
-master-bin.000001 # 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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+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
**** On Slave ****
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos 594
-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 594
-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 #
-Last_IO_Errno #
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
-slave-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a INT, b LONG)
-slave-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
-slave-bin.000001 # Query 1 # BEGIN
-slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
-slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-slave-bin.000001 # Query 1 # COMMIT
+slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG)
+slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+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
DROP TABLE IF EXISTS t1;
SET @@global.binlog_format= @old_binlog_format;
diff --git a/mysql-test/suite/rpl/r/rpl_replicate_do.result b/mysql-test/suite/rpl/r/rpl_replicate_do.result
index 33088ee2ec8..637047a883b 100644
--- a/mysql-test/suite/rpl/r/rpl_replicate_do.result
+++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result
@@ -26,45 +26,7 @@ n
select * from t11;
ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
Replicate_Do_Table test.t1
-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
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..b50c7cebcab 100644
--- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result
+++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result
@@ -14,45 +14,9 @@ create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 60
Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
select * from t1;
s
Could not break slave
@@ -93,45 +57,9 @@ show binary logs;
Log_name File_size
master-bin.000003 #
insert into t2 values (65);
-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.000003
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
Relay_Master_Log_File master-bin.000003
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
select * from t2;
m
34
@@ -157,45 +85,9 @@ master-bin.000005 # <Binlog_Do_DB> <Binlog_Ignore_DB>
select * from t4;
a
testing temporary tables part 2
-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.000005
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
Relay_Master_Log_File master-bin.000005
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
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..458ae53e79c 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
@@ -56,14 +56,13 @@ DELETE FROM t1;
INSERT INTO t1 VALUES (1),(2);
DELETE FROM t1 WHERE a = 0;
UPDATE t1 SET a=99 WHERE a = 0;
-SHOW BINLOG EVENTS;
+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: 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 # 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
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..a247c3a6039 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
@@ -436,8 +436,7 @@ DELETE FROM t1;
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
COUNT(*) 0
set @@global.slave_exec_mode= default;
-Last_SQL_Error
-
+Checking that both slave threads are running.
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
COUNT(*) 0
**** Test for BUG#37076 ****
@@ -487,8 +486,7 @@ 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.
+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.
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -500,8 +498,7 @@ Comparing tables master:test.t4 and slave:test.t4
[expecting slave to stop]
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.
+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.
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -509,8 +506,7 @@ START SLAVE;
[expecting slave to stop]
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.
+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.
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..fefe8e969dc 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
@@ -436,8 +436,7 @@ DELETE FROM t1;
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
COUNT(*) 0
set @@global.slave_exec_mode= default;
-Last_SQL_Error
-
+Checking that both slave threads are running.
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
COUNT(*) 0
**** Test for BUG#37076 ****
@@ -487,8 +486,7 @@ 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.
+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.
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -500,8 +498,7 @@ Comparing tables master:test.t4 and slave:test.t4
[expecting slave to stop]
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.
+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.
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -509,8 +506,7 @@ START SLAVE;
[expecting slave to stop]
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.
+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.
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
diff --git a/mysql-test/suite/rpl/r/rpl_row_colSize.result b/mysql-test/suite/rpl/r/rpl_row_colSize.result
index 6d002a722f1..417bc65641a 100644
--- a/mysql-test/suite/rpl/r/rpl_row_colSize.result
+++ b/mysql-test/suite/rpl/r/rpl_row_colSize.result
@@ -18,45 +18,7 @@ CREATE TABLE t1 (a DECIMAL(20, 10));
RESET MASTER;
INSERT INTO t1 VALUES (901251.90125);
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -72,45 +34,7 @@ CREATE TABLE t1 (a DECIMAL(27, 18));
RESET MASTER;
INSERT INTO t1 VALUES (901251.90125);
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -126,45 +50,7 @@ CREATE TABLE t1 (a NUMERIC(20, 10));
RESET MASTER;
INSERT INTO t1 VALUES (901251.90125);
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -181,45 +67,7 @@ CREATE TABLE t1 (a FLOAT(47));
RESET MASTER;
INSERT INTO t1 VALUES (901251.90125);
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -236,45 +84,7 @@ CREATE TABLE t1 (a BIT(64));
RESET MASTER;
INSERT INTO t1 VALUES (B'10101');
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -290,45 +100,7 @@ CREATE TABLE t1 (a BIT(12));
RESET MASTER;
INSERT INTO t1 VALUES (B'10101');
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -345,45 +117,7 @@ CREATE TABLE t1 (a SET('1','2','3','4','5','6','7','8','9'));
RESET MASTER;
INSERT INTO t1 VALUES ('4');
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -400,45 +134,7 @@ CREATE TABLE t1 (a CHAR(20));
RESET MASTER;
INSERT INTO t1 VALUES ('This is a test.');
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -486,45 +182,7 @@ CREATE TABLE t1 (a ENUM(
RESET MASTER;
INSERT INTO t1 VALUES ('44');
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -541,45 +199,7 @@ CREATE TABLE t1 (a VARCHAR(2000));
RESET MASTER;
INSERT INTO t1 VALUES ('This is a test.');
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -595,45 +215,7 @@ CREATE TABLE t1 (a VARCHAR(200));
RESET MASTER;
INSERT INTO t1 VALUES ('This is a test.');
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -649,45 +231,7 @@ CREATE TABLE t1 (a VARCHAR(2000));
RESET MASTER;
INSERT INTO t1 VALUES ('This is a test.');
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -704,45 +248,7 @@ CREATE TABLE t1 (a LONGBLOB);
RESET MASTER;
INSERT INTO t1 VALUES ('This is a test.');
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
SELECT COUNT(*) FROM t1;
COUNT(*)
0
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 8a1b7a805aa..e480ff3dfe9 100644
--- a/mysql-test/suite/rpl/r/rpl_row_create_table.result
+++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result
@@ -13,31 +13,12 @@ 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;
-Log_name #
-Pos 106
-Event_type Query
-Server_id #
-End_log_pos 199
-Info use `test`; CREATE TABLE t1 (a INT, b INT)
-Log_name #
-Pos 199
-Event_type Query
-Server_id #
-End_log_pos 305
-Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
-Log_name #
-Pos 305
-Event_type Query
-Server_id #
-End_log_pos 411
-Info use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
-Log_name #
-Pos 411
-Event_type Query
-Server_id #
-End_log_pos 530
-Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT)
+master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
+master-bin.000001 # Query # # use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
+master-bin.000001 # Query # # use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
**** On Master ****
SHOW CREATE TABLE t1;
Table t1
@@ -137,7 +118,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 <binlog_start>;
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 +128,13 @@ a b
1 2
2 4
3 6
-SHOW BINLOG EVENTS FROM 106;
+show binlog events from <binlog_start>;
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
+master-bin.000001 # Query # # use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t7)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # ROLLBACK
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
@@ -171,12 +152,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 <binlog_start>;
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
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t7)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
@@ -216,10 +197,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 <binlog_start>;
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` (
+master-bin.000001 # Query # # use `test`; CREATE TABLE t8 LIKE t4
+master-bin.000001 # Query # # use `test`; CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
)
@@ -289,38 +270,38 @@ a
1
2
3
-SHOW BINLOG EVENTS FROM 106;
+show binlog events from <binlog_start>;
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` (
+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 # Query # # 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` (
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+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 # Query # # 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` (
+master-bin.000001 # Table_map # # table_id: # (test.t3)
+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 # Query # # 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
+master-bin.000001 # Table_map # # table_id: # (test.t4)
+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 # Query # # COMMIT
SHOW TABLES;
Tables_in_test
t1
@@ -374,20 +355,20 @@ a
4
6
9
-SHOW BINLOG EVENTS FROM 106;
+show binlog events from <binlog_start>;
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 */
+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 # # use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
SELECT * FROM t2 ORDER BY a;
a
1
@@ -413,14 +394,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 <binlog_start>;
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
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # 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..048e07271b3 100644
--- a/mysql-test/suite/rpl/r/rpl_row_drop.result
+++ b/mysql-test/suite/rpl/r/rpl_row_drop.result
@@ -41,12 +41,11 @@ t1
t2
**** On Master ****
DROP TABLE t1,t2;
-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 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 # Query # # use `test`; CREATE TABLE t1 (a int)
+master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int)
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
SHOW TABLES;
Tables_in_test
t2
diff --git a/mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result b/mysql-test/suite/rpl/r/rpl_row_find_row.result
index 01e3dfd6508..69516b47b7d 100644
--- a/mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result
+++ b/mysql-test/suite/rpl/r/rpl_row_find_row.result
@@ -24,3 +24,15 @@ INSERT INTO t VALUES (1,2,4);
INSERT INTO t VALUES (4,3,4);
DELETE FROM t;
DROP TABLE t;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 INT NOT NULL, c2 INT NOT NULL, c3 INT, UNIQUE KEY(c1,c3), KEY(c2));
+INSERT INTO t1(c1,c2) VALUES(1,1);
+INSERT INTO t1(c1,c2) VALUES(1,2);
+UPDATE t1 SET c1=1000 WHERE c2=2;
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
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 18a5dbfccc1..fe2fb1d9da2 100644
--- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
+++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
@@ -12,16 +12,12 @@ 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 925 ;
+show binlog events from <binlog_start>;
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 # # use `test`; rename table t1 to t5, t2 to t1
select * from t3;
a
flush tables;
-SHOW BINLOG EVENTS FROM 925 ;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
-master-bin.000001 # Query 1 # use `test`; flush tables
select * from t3;
a
stop slave;
diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result
index 9593b009d1f..0f648539c47 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result
@@ -7,7 +7,7 @@ start slave;
include/stop_slave.inc
reset master;
reset slave;
-start slave;
+include/start_slave.inc
create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
insert into t1 values (NULL);
drop table t1;
@@ -16,30 +16,29 @@ load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
-show binlog events;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
-master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-master-bin.000001 # 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
-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 # 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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+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 # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+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
+show binlog events from <binlog_start> 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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+show binlog events from <binlog_start> 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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Query # # BEGIN
+show binlog events from <binlog_start> limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
flush logs;
create table t3 (a int)ENGINE=MyISAM;
select * from t1 order by 1 asc;
@@ -203,15 +202,14 @@ 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
-show binlog events in 'master-bin.000002';
+show binlog events in 'master-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
-master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
-master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
-master-bin.000002 # Query 1 # BEGIN
-master-bin.000002 # Table_map 1 # table_id: # (test.t2)
-master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000002 # Query 1 # COMMIT
+master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM
+master-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM
+master-bin.000002 # Query # # BEGIN
+master-bin.000002 # Table_map # # table_id: # (test.t2)
+master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000002 # Query # # COMMIT
show binary logs;
Log_name File_size
master-bin.000001 #
@@ -220,69 +218,29 @@ show binary logs;
Log_name File_size
slave-bin.000001 #
slave-bin.000002 #
-show binlog events in 'slave-bin.000001' from 4;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
-slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-slave-bin.000001 # Query 1 # BEGIN
-slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
-slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-slave-bin.000001 # Query 1 # COMMIT
-slave-bin.000001 # Query 1 # use `test`; drop table t1
-slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
-slave-bin.000001 # Query 1 # BEGIN
-slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
-slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-slave-bin.000001 # Query 1 # COMMIT
-slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
-slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
-show binlog events in 'slave-bin.000002' from 4;
+slave-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+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 # # use `test`; drop table t1
+slave-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+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 # # use `test`; create table t3 (a int)ENGINE=MyISAM
+slave-bin.000001 # Rotate # # slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
-slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
-slave-bin.000002 # Query 1 # BEGIN
-slave-bin.000002 # Table_map 1 # table_id: # (test.t2)
-slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
-slave-bin.000002 # Query 1 # COMMIT
-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.000002
-Read_Master_Log_Pos 516
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000002
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos 516
-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
+slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM
+slave-bin.000002 # Query # # BEGIN
+slave-bin.000002 # Table_map # # table_id: # (test.t2)
+slave-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000002 # Query # # COMMIT
+Checking that both slave threads are running.
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..ff189e676cc 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
@@ -7,7 +7,7 @@ start slave;
include/stop_slave.inc
reset master;
reset slave;
-start slave;
+include/start_slave.inc
create table t1(n int not null auto_increment primary key)ENGINE=InnoDB;
insert into t1 values (NULL);
drop table t1;
@@ -16,30 +16,29 @@ load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
-show binlog events;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
-master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
-master-bin.000001 # 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 */
-master-bin.000001 # Query 1 # use `test`; drop table t1
-master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
-master-bin.000001 # 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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+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 # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
+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 */
+show binlog events from <binlog_start> 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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+show binlog events from <binlog_start> 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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+master-bin.000001 # Query # # BEGIN
+show binlog events from <binlog_start> limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
flush logs;
create table t3 (a int)ENGINE=InnoDB;
select * from t1 order by 1 asc;
@@ -203,15 +202,14 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Rotate # # master-bin.000002;pos=4
-show binlog events in 'master-bin.000002';
+show binlog events in 'master-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
-master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB
-master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB
-master-bin.000002 # Query 1 # BEGIN
-master-bin.000002 # Table_map 1 # table_id: # (test.t2)
-master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000002 # Xid 1 # COMMIT /* XID */
+master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=InnoDB
+master-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=InnoDB
+master-bin.000002 # Query # # BEGIN
+master-bin.000002 # Table_map # # table_id: # (test.t2)
+master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000002 # Xid # # COMMIT /* XID */
show binary logs;
Log_name File_size
master-bin.000001 #
@@ -220,69 +218,29 @@ show binary logs;
Log_name File_size
slave-bin.000001 #
slave-bin.000002 #
-show binlog events in 'slave-bin.000001' from 4;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
-slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
-slave-bin.000001 # Query 1 # BEGIN
-slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
-slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-slave-bin.000001 # Xid 1 # COMMIT /* XID */
-slave-bin.000001 # Query 1 # use `test`; drop table t1
-slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
-slave-bin.000001 # Query 1 # BEGIN
-slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
-slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-slave-bin.000001 # Xid 1 # COMMIT /* XID */
-slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB
-slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
-show binlog events in 'slave-bin.000002' from 4;
+slave-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+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 # Xid # # COMMIT /* XID */
+slave-bin.000001 # Query # # use `test`; drop table t1
+slave-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
+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 # Xid # # COMMIT /* XID */
+slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=InnoDB
+slave-bin.000001 # Rotate # # slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
-slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB
-slave-bin.000002 # Query 1 # BEGIN
-slave-bin.000002 # Table_map 1 # table_id: # (test.t2)
-slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
-slave-bin.000002 # Xid 1 # COMMIT /* XID */
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000002
-Read_Master_Log_Pos 474
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000002
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos 474
-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
+slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=InnoDB
+slave-bin.000002 # Query # # BEGIN
+slave-bin.000002 # Table_map # # table_id: # (test.t2)
+slave-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000002 # Xid # # COMMIT /* XID */
+Checking that both slave threads are running.
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..db06cb6d3de 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
@@ -21,45 +21,7 @@ select @@global.max_relay_log_size;
@@global.max_relay_log_size
4096
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 2
#
@@ -69,45 +31,7 @@ set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size;
@@global.max_relay_log_size 20480
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 3: max_relay_log_size = 0
#
@@ -117,90 +41,13 @@ set global max_relay_log_size=0;
select @@global.max_relay_log_size;
@@global.max_relay_log_size 0
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
stop slave;
reset slave;
flush logs;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File
-Read_Master_Log_Pos #
-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
#
# Test 5
#
@@ -208,89 +55,13 @@ reset slave;
start slave;
flush logs;
create table t1 (a int);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs;
drop table t1;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
diff --git a/mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result b/mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result
new file mode 100644
index 00000000000..c461cafbd7c
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result
@@ -0,0 +1,46 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+## case #1 - last_null_bit_pos==0 in record_compare without X bit
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 );
+INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 );
+UPDATE t1 SET c5 = 'a';
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
+## case #1.1 - last_null_bit_pos==0 in record_compare with X bit
+## (1 column less and no varchar)
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 );
+INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 );
+UPDATE t1 SET c5 = 'a';
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
+## case #2 - X bit is wrongly set.
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=InnoDB DEFAULT CHARSET= latin1;
+INSERT INTO t1(c1) VALUES (10);
+INSERT INTO t1(c1) VALUES (NULL);
+UPDATE t1 SET c1= 0;
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result b/mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result
new file mode 100644
index 00000000000..38fbe486d2e
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result
@@ -0,0 +1,60 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+## case #1 - last_null_bit_pos==0 in record_compare without X bit
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 );
+INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 );
+UPDATE t1 SET c5 = 'a';
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
+## case #1.1 - last_null_bit_pos==0 in record_compare with X bit
+## (1 column less and no varchar)
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 );
+INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 );
+UPDATE t1 SET c5 = 'a';
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
+## case #2 - X bit is wrongly set.
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=MyISAM DEFAULT CHARSET= latin1;
+INSERT INTO t1(c1) VALUES (10);
+INSERT INTO t1(c1) VALUES (NULL);
+UPDATE t1 SET c1= 0;
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
+## coverage purposes - Field_bits
+## 1 X bit + 2 Null bits + 5 bits => last_null_bit_pos==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 (c1 bigint(20) DEFAULT 0, c2 bit(5)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1(c1,c2) VALUES (10, b'1');
+INSERT INTO t1(c1,c2) VALUES (NULL, b'1');
+UPDATE t1 SET c1= 0;
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
index fa40d8760a8..7bf09df31ca 100644
--- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
@@ -4,196 +4,37 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-stop slave;
-change master to master_user='test';
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+include/stop_slave.inc
+change master to master_user='test';
Master_User test
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running 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
-reset slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+reset slave;
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File
-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
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+include/start_slave.inc
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-stop slave;
+Master_Host 127.0.0.1
+include/stop_slave.inc
reset slave;
-start slave;
+include/start_slave.inc
create temporary table t1 (a int);
-stop slave;
+include/stop_slave.inc
reset slave;
-start slave;
+include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
-stop slave;
+include/stop_slave.inc
reset slave;
-*** errno must be zero: 0 ***
change master to master_user='impossible_user_name';
start slave;
-ONE
-1
include/stop_slave.inc
change master to master_user='root';
include/start_slave.inc
-*** last errno must be zero: 0 ***
-*** last error must be blank: ***
include/stop_slave.inc
change master to master_user='impossible_user_name';
start slave;
-ONE
-1
include/stop_slave.inc
reset slave;
-*** io last errno must be zero: 0 ***
-*** io last error must be blank: ***
-*** sql last errno must be zero: 0 ***
-*** sql last error must be blank: ***
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..2b83bffd85f 100644
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
@@ -118,214 +118,27 @@ a b
SELECT * FROM t2;
a
2
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running 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 <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_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 0
-Last_SQL_Error <Last_SQL_Error>
+Checking that both slave threads are running.
INSERT INTO t9 VALUES (4);
INSERT INTO t4 VALUES (4);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error <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_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
-Last_SQL_Error <Last_SQL_Error>
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
INSERT INTO t9 VALUES (5);
INSERT INTO t5 VALUES (5,10,25);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error <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_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
-Last_SQL_Error <Last_SQL_Error>
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
INSERT INTO t9 VALUES (6);
INSERT INTO t6 VALUES (6,12,36);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error <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_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
-Last_SQL_Error <Last_SQL_Error>
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
INSERT INTO t9 VALUES (6);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running 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 <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_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 0
-Last_SQL_Error <Last_SQL_Error>
+Checking that both slave threads are running.
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..a42530c354d 100644
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
@@ -118,214 +118,27 @@ a b
SELECT * FROM t2;
a
2
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running 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 <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_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 0
-Last_SQL_Error <Last_SQL_Error>
+Checking that both slave threads are running.
INSERT INTO t9 VALUES (4);
INSERT INTO t4 VALUES (4);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error <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_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
-Last_SQL_Error <Last_SQL_Error>
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
INSERT INTO t9 VALUES (5);
INSERT INTO t5 VALUES (5,10,25);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error <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_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
-Last_SQL_Error <Last_SQL_Error>
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
INSERT INTO t9 VALUES (6);
INSERT INTO t6 VALUES (6,12,36);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error <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_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 1535
-Last_SQL_Error <Last_SQL_Error>
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
INSERT INTO t9 VALUES (6);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running 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 <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_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 0
-Last_SQL_Error <Last_SQL_Error>
+Checking that both slave threads are running.
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..81aeb0d645b 100644
--- a/mysql-test/suite/rpl/r/rpl_row_until.result
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result
@@ -20,188 +20,32 @@ n
2
3
4
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos MASTER_POS_DROP_T1
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-bin.000001
-Until_Log_Pos MASTER_POS_DROP_T1
-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
-START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
+START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
SELECT * FROM t1;
n
1
2
3
4
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos MASTER_POS_DROP_T1
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-no-such-bin.000001
-Until_Log_Pos 291
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2
SELECT * FROM t2;
n
1
2
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos MASTER_POS_INSERT1_T2
-Relay_Log_Space #
-Until_Condition Relay
-Until_Log_File slave-relay-bin.000002
-Until_Log_Pos RELAY_POS_INSERT1_T2
-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
START SLAVE;
include/stop_slave.inc
START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running 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 MASTER_POS_DROP_T2
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-bin.000001
-Until_Log_Pos MASTER_POS_CREATE_T2
-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
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=MASTER_LOG_POS;
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;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS, RELAY_LOG_POS=RELAY_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE;
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
Warnings:
Note 1254 Slave is already running
diff --git a/mysql-test/suite/rpl/r/rpl_skip_error.result b/mysql-test/suite/rpl/r/rpl_skip_error.result
index d955859f030..0aa8069a38c 100644
--- a/mysql-test/suite/rpl/r/rpl_skip_error.result
+++ b/mysql-test/suite/rpl/r/rpl_skip_error.result
@@ -31,45 +31,7 @@ n
3
7
8
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
==== Clean Up ====
drop table t1;
create table t1(a int primary key);
@@ -84,45 +46,7 @@ select * from t1;
a
1
2
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
==== 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..c3c4f7c015a 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
@@ -10,45 +10,6 @@ insert into t1(b) values (1);
insert into t1(b) values (2);
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
commit;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 9
-Last_Error Error in Begin_load_query event: write to '../../tmp/SQL_LOAD.data' failed
-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 9
-Last_SQL_Error Error in Begin_load_query event: write to '../../tmp/SQL_LOAD.data' failed
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..a4067fb7983 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_skip.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result
@@ -42,46 +42,7 @@ c d
2 8
3 18
**** On Slave ****
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
-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 1115
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos 762
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-bin.000001
-Until_Log_Pos 762
-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
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SELECT * FROM t1;
@@ -104,48 +65,9 @@ show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # User var # # @`foo`=12
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(@foo, 2*@foo)
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=106;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos 248
-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 248
-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
**** On Master ****
DROP TABLE t1, t2;
SET SESSION BINLOG_FORMAT=ROW;
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index 631369b2b74..8f06653f8ab 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -409,110 +409,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,41 +522,41 @@ 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`()
+master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`()
set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
Warnings:
Warning 1287 '@@log_bin_trust_routine_creators' is deprecated and will be removed in a future release. Please use '@@log_bin_trust_function_creators' instead
diff --git a/mysql-test/suite/rpl/r/rpl_ssl.result b/mysql-test/suite/rpl/r/rpl_ssl.result
index d188dd353ce..1af4c5e227c 100644
--- a/mysql-test/suite/rpl/r/rpl_ssl.result
+++ b/mysql-test/suite/rpl/r/rpl_ssl.result
@@ -19,89 +19,23 @@ insert into t1 values(1);
select * from t1;
t
1
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User replssl
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
Master_SSL_Allowed Yes
-Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
Master_SSL_CA_Path
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
-Master_SSL_Cipher
Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
STOP SLAVE;
select * from t1;
t
1
insert into t1 values (NULL);
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User replssl
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
Master_SSL_Allowed Yes
-Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
Master_SSL_CA_Path
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
-Master_SSL_Cipher
Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
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..5b4aa126c77 100644
--- a/mysql-test/suite/rpl/r/rpl_ssl1.result
+++ b/mysql-test/suite/rpl/r/rpl_ssl1.result
@@ -18,89 +18,23 @@ start slave;
select * from t1;
t
1
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User replssl
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File #
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File #
-Slave_IO_Running #
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
Master_SSL_Allowed Yes
-Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
Master_SSL_CA_Path
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
-Master_SSL_Cipher
Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
stop slave;
change master to master_user='root',master_password='', master_ssl=0;
start slave;
drop user replssl@localhost;
drop table t1;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File #
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File #
-Slave_IO_Running #
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
Master_SSL_Allowed No
-Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
Master_SSL_CA_Path
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
-Master_SSL_Cipher
Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
stop slave;
change master to
master_host="localhost",
@@ -116,43 +50,10 @@ on slave
select * from t1;
t
1
-show slave status;
-Slave_IO_State #
-Master_Host localhost
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File #
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File #
-Slave_IO_Running #
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
Master_SSL_Allowed Yes
-Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
Master_SSL_CA_Path
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
-Master_SSL_Cipher
Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert Yes
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
index ea2a9ce9a79..fe2fb1d9da2 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
@@ -12,16 +12,12 @@ 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 684 ;
+show binlog events from <binlog_start>;
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 # # use `test`; rename table t1 to t5, t2 to t1
select * from t3;
a
flush tables;
-SHOW BINLOG EVENTS FROM 684 ;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
-master-bin.000001 # Query 1 # use `test`; flush tables
select * from t3;
a
stop slave;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result
index 70aeb733769..1c24b2ca15b 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result
@@ -52,18 +52,18 @@ CREATE TABLE t1(a int, UNIQUE(a));
INSERT DELAYED IGNORE INTO t1 VALUES(1);
INSERT DELAYED IGNORE INTO t1 VALUES(1);
flush table t1;
-show binlog events in 'master-bin.000002' LIMIT 2,2;
+show binlog events in 'master-bin.000002' from <binlog_start> limit 1,2;
Log_name Pos Event_type Server_id End_log_pos Info
-x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
-x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+master-bin.000002 # Query # # use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+master-bin.000002 # Query # # use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
select * from t1;
a
1
On slave
-show binlog events in 'slave-bin.000002' LIMIT 2,2;
+show binlog events in 'slave-bin.000002' from <binlog_start> limit 1,2;
Log_name Pos Event_type Server_id End_log_pos Info
-x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
-x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+slave-bin.000002 # Query # # use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+slave-bin.000002 # Query # # use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
select * from t1;
a
1
@@ -112,24 +112,14 @@ id name
USE test;
DROP SCHEMA mysqlslap;
use test;
-FLUSH LOGS;
-FLUSH LOGS;
CREATE TABLE t1(a int, UNIQUE(a));
INSERT DELAYED IGNORE INTO t1 VALUES(1);
INSERT DELAYED IGNORE INTO t1 VALUES(1);
flush table t1;
-show binlog events in 'master-bin.000002' LIMIT 2,2;
-Log_name Pos Event_type Server_id End_log_pos Info
-x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
-x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
select * from t1;
a
1
On slave
-show binlog events in 'slave-bin.000002' LIMIT 2,2;
-Log_name Pos Event_type Server_id End_log_pos Info
-x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
-x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
select * from t1;
a
1
diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result
index 47556a33e97..d73a689969f 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result
@@ -7,7 +7,7 @@ start slave;
include/stop_slave.inc
reset master;
reset slave;
-start slave;
+include/start_slave.inc
create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
insert into t1 values (NULL);
drop table t1;
@@ -16,26 +16,25 @@ load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
-show binlog events;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
-master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-master-bin.000001 # Intvar 1 # INSERT_ID=1
-master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
-master-bin.000001 # Query 1 # use `test`; drop table t1
-master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
-master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
-master-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '../../std_data/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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
+master-bin.000001 # Execute_load_query # # 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=#
+show binlog events from <binlog_start> 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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+show binlog events from <binlog_start> 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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001 # Intvar # # INSERT_ID=1
+show binlog events from <binlog_start> 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)
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
flush logs;
create table t3 (a int)ENGINE=MyISAM;
select * from t1 order by 1 asc;
@@ -195,12 +194,11 @@ master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not nul
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Execute_load_query # # 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=#
master-bin.000001 # Rotate # # master-bin.000002;pos=4
-show binlog events in 'master-bin.000002';
+show binlog events in 'master-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
-master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
-master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
-master-bin.000002 # Query 1 # use `test`; insert into t2 values (1)
+master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM
+master-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM
+master-bin.000002 # Query # # use `test`; insert into t2 values (1)
show binary logs;
Log_name File_size
master-bin.000001 #
@@ -209,62 +207,22 @@ show binary logs;
Log_name File_size
slave-bin.000001 #
slave-bin.000002 #
-show binlog events in 'slave-bin.000001' from 4;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
-slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-slave-bin.000001 # Intvar 1 # INSERT_ID=1
-slave-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
-slave-bin.000001 # Query 1 # use `test`; drop table t1
-slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
-slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
-slave-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (`word`) ;file_id=1
-slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
-slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
-show binlog events in 'slave-bin.000002' from 4;
+slave-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+slave-bin.000001 # Intvar # # INSERT_ID=1
+slave-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
+slave-bin.000001 # Query # # use `test`; drop table t1
+slave-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+slave-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
+slave-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (`word`) ;file_id=#
+slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=MyISAM
+slave-bin.000001 # Rotate # # slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
-slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
-slave-bin.000002 # Query 1 # use `test`; insert into t2 values (1)
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000002
-Read_Master_Log_Pos 392
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000002
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos 392
-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
+slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=MyISAM
+slave-bin.000002 # Query # # use `test`; insert into t2 values (1)
+Checking that both slave threads are running.
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..db06cb6d3de 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
@@ -21,45 +21,7 @@ select @@global.max_relay_log_size;
@@global.max_relay_log_size
4096
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 2
#
@@ -69,45 +31,7 @@ set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size;
@@global.max_relay_log_size 20480
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 3: max_relay_log_size = 0
#
@@ -117,90 +41,13 @@ set global max_relay_log_size=0;
select @@global.max_relay_log_size;
@@global.max_relay_log_size 0
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
stop slave;
reset slave;
flush logs;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File
-Read_Master_Log_Pos #
-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
#
# Test 5
#
@@ -208,89 +55,13 @@ reset slave;
start slave;
flush logs;
create table t1 (a int);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs;
drop table t1;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
diff --git a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
index 03223166f44..2ecaf2c90ae 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
@@ -868,3 +868,24 @@ DROP TABLE nt_4;
DROP PROCEDURE pc_i_tt_3;
DROP FUNCTION f1;
DROP FUNCTION f2;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE `t1` (
+`c1` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`c2` tinyint(1) unsigned DEFAULT NULL,
+`c3` varchar(300) DEFAULT NULL,
+`c4` int(10) unsigned NOT NULL,
+`c5` int(10) unsigned DEFAULT NULL,
+PRIMARY KEY (`c1`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ALTER TABLE `t1` Engine=InnoDB;
+SET AUTOCOMMIT=0;
+INSERT INTO t1 (c1,c2,c3,c4,c5) VALUES (1, 1, 'X', 1, NULL);
+COMMIT;
+ROLLBACK;
+SET AUTOCOMMIT=1;
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE `t1`;
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..1fc189975ef 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
@@ -4,196 +4,37 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-stop slave;
-change master to master_user='test';
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+include/stop_slave.inc
+change master to master_user='test';
Master_User test
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running 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
-reset slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+reset slave;
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File
-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
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State #
Master_Host 127.0.0.1
+include/start_slave.inc
Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-stop slave;
+Master_Host 127.0.0.1
+include/stop_slave.inc
reset slave;
-start slave;
+include/start_slave.inc
create temporary table t1 (a int);
-stop slave;
+include/stop_slave.inc
reset slave;
-start slave;
+include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
-stop slave;
+include/stop_slave.inc
reset slave;
-*** errno must be zero: 0 ***
change master to master_user='impossible_user_name';
start slave;
-ONE
-1
include/stop_slave.inc
change master to master_user='root';
include/start_slave.inc
-*** last errno must be zero: 0 ***
-*** last error must be blank: ***
include/stop_slave.inc
change master to master_user='impossible_user_name';
start slave;
-ONE
-1
include/stop_slave.inc
reset slave;
-*** io last errno must be zero: 0 ***
-*** io last error must be blank: ***
-*** sql last errno must be zero: 0 ***
-*** sql last error must be blank: ***
diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result
index 644baba0335..0094c143e38 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_until.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_until.result
@@ -17,199 +17,43 @@ insert into t2 values (3),(4);
drop table t2;
==== Replicate one event at a time on slave ====
[on slave]
-start slave until master_log_file='master-bin.000001', master_log_pos=323;
+start slave until master_log_file='MASTER_LOG_FILE', master_log_pos=MASTER_LOG_POS;
select * from t1;
n
1
2
3
4
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-bin.000001
-Until_Log_Pos 323
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=MASTER_LOG_POS;
select * from t1;
n
1
2
3
4
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-no-such-bin.000001
-Until_Log_Pos 291
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
+start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=RELAY_LOG_POS;
select * from t2;
n
1
2
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Relay
-Until_Log_File slave-relay-bin.000004
-Until_Log_Pos 746
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
start slave;
[on master]
[on slave]
include/stop_slave.inc
-start slave until master_log_file='master-bin.000001', master_log_pos=776;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-bin.000001
-Until_Log_Pos 776
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+start slave until master_log_file='MASTER_LOG_FILE', master_log_pos=MASTER_LOG_POS;
==== Test various error conditions ====
-start slave until master_log_file='master-bin', master_log_pos=561;
+start slave until master_log_file='master-bin', master_log_pos=MASTER_LOG_POS;
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;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS, relay_log_pos=RELAY_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until relay_log_file='slave-relay-bin.000002';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=MASTER_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave sql_thread;
-start slave until master_log_file='master-bin.000001', master_log_pos=776;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
Warnings:
Note 1254 Slave is already running
include/stop_slave.inc
@@ -230,7 +74,7 @@ insert into t1 set a=null;
select count(*) as two from t1;
two
2
-start slave until master_log_file='master-bin.000001', master_log_pos= UNTIL_POS;;
+start slave until master_log_file='MASTER_LOG_FILE', master_log_pos= UNTIL_POS;;
slave stopped at the prescribed position
select 0 as zero;
zero
@@ -249,8 +93,9 @@ start slave;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
-flush logs;
stop slave;
+flush logs;
+flush logs;
reset slave;
start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */;
show tables /* t1 must exist */;
diff --git a/mysql-test/suite/rpl/r/rpl_temporary_errors.result b/mysql-test/suite/rpl/r/rpl_temporary_errors.result
index e5d9ea5837c..023f9a850ab 100644
--- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result
@@ -40,46 +40,65 @@ a b
2 2
3 3
4 4
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
DROP TABLE t1;
**** On Master ****
+SET SQL_LOG_BIN= 0;
DROP TABLE t1;
+SET SQL_LOG_BIN= 1;
+SET SESSION BINLOG_FORMAT=MIXED;
+CREATE TABLE t_myisam (id INT, PRIMARY KEY (id)) engine= MyIsam;
+INSERT INTO t_myisam (id) VALUES(1);
+CREATE TABLE t_innodb (id INT) engine= Innodb;
+INSERT INTO t_innodb (id) VALUES(1);
+BEGIN;
+INSERT INTO t_innodb(id) VALUES(2);
+INSERT INTO t_myisam(id) VALUES(3);
+CREATE TEMPORARY TABLE x (id INT);
+INSERT INTO t_myisam(id) VALUES(4),(1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO t_innodb(id) VALUES(5);
+COMMIT;
+SELECT * FROM t_innodb;
+id
+1
+2
+5
+SELECT * FROM t_myisam;
+id
+1
+3
+4
+SELECT * FROM t_innodb;
+id
+1
+2
+5
+SELECT * FROM t_myisam;
+id
+1
+3
+4
+BEGIN;
+CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb;
+INSERT INTO t_innodb(id) VALUES(1);
+INSERT INTO t_innodb(id) VALUES(1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+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 t_innodb(id) VALUES(2)
+master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam(id) VALUES(3)
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE x (id INT)
+master-bin.000001 # Query # # use `test`; INSERT INTO t_myisam(id) VALUES(4),(1)
+master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb(id) VALUES(5)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb(id) VALUES(1)
+master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb(id) VALUES(1)
+master-bin.000001 # Query # # ROLLBACK
+DROP TABLE t_myisam, t_innodb;
STOP SLAVE;
diff --git a/mysql-test/suite/rpl/t/rpl_000015-slave.opt b/mysql-test/suite/rpl/t/rpl_000015-slave.opt
deleted file mode 100644
index 28bc753dd56..00000000000
--- a/mysql-test/suite/rpl/t/rpl_000015-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---server-id=22 --master-connect-retry=7
diff --git a/mysql-test/suite/rpl/t/rpl_000015.cnf b/mysql-test/suite/rpl/t/rpl_000015.cnf
deleted file mode 100644
index 46f8af242c2..00000000000
--- a/mysql-test/suite/rpl/t/rpl_000015.cnf
+++ /dev/null
@@ -1,2 +0,0 @@
-!include ../rpl_1slave_base.cnf
-
diff --git a/mysql-test/suite/rpl/t/rpl_000015.test b/mysql-test/suite/rpl/t/rpl_000015.test
deleted file mode 100644
index 45a43cd38d0..00000000000
--- a/mysql-test/suite/rpl/t/rpl_000015.test
+++ /dev/null
@@ -1,40 +0,0 @@
--- source include/have_log_bin.inc
-#####################
-# Change Author: JBM
-# Change Date: 2006-01-17
-# Change: added order by in select
-#####################
-
-connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK);
-connection master;
-reset master;
-source include/show_master_status.inc;
-save_master_pos;
-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;
-source include/show_slave_status2.inc;
-start slave;
-sync_with_master;
-source include/show_slave_status2.inc;
-connection master;
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (n int, PRIMARY KEY(n));
-insert into t1 values (10),(45),(90);
-sync_slave_with_master;
-connection slave;
-SELECT * FROM t1 ORDER BY n;
-connection master;
-SELECT * FROM t1 ORDER BY n;
-drop table t1;
-sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_grant.test b/mysql-test/suite/rpl/t/rpl_binlog_grant.test
index 31163927ce2..4c6402359fe 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_grant.test
@@ -20,26 +20,24 @@ set @@autocommit=0;
start transaction;
insert into t values (1);
grant select on t to x@y;
+let $wait_binlog_event= grant select;
+source include/wait_for_binlog_event.inc;
#
# There is no active transaction here
#
rollback;
show grants for x@y;
---replace_result $VERSION VERSION
---replace_regex /\/\* xid=.* \*\//\/* XID *\//
-show binlog events;
start transaction;
insert into t values (2);
revoke select on t from x@y;
+let $wait_binlog_event= revoke select;
+source include/wait_for_binlog_event.inc;
#
# There is no active transaction here
#
commit;
select * from t;
show grants for x@y;
---replace_result $VERSION VERSION
---replace_regex /\/\* xid=.* \*\//\/* XID *\//
-show binlog events;
drop user x@y;
drop database d1;
--sync_slave_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test
index 1316ddb7401..3327a36622c 100644
--- a/mysql-test/suite/rpl/t/rpl_bug33931.test
+++ b/mysql-test/suite/rpl/t/rpl_bug33931.test
@@ -37,9 +37,10 @@ connection slave;
#
source include/wait_for_slave_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 19 # 23 # 33 # 37 #
-query_vertical show slave status;
+# 1593 = ER_SLAVE_FATAL_ERROR
+--let $slave_sql_errno= 1593
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
#
# Cleanup
diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test
index d0cd40e2e11..33bd9d51b11 100644
--- a/mysql-test/suite/rpl/t/rpl_change_master.test
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test
@@ -19,10 +19,26 @@ let $slave_param= Read_Master_Log_Pos;
let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1);
connection slave;
source include/wait_for_slave_param.inc;
-stop slave;
-source include/show_slave_status2.inc;
+source include/stop_slave.inc;
+
+let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
+if (`SELECT $read_pos = $exec_pos`)
+{
+ source include/show_rpl_debug_info.inc;
+ echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos';
+ die Failed because Read_Master_Log_Pos is equal to Exec_Master_Log_Pos;
+}
change master to master_user='root';
-source include/show_slave_status2.inc;
+let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
+if (`SELECT $read_pos <> $exec_pos`)
+{
+ source include/show_rpl_debug_info.inc;
+ echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos';
+ die Failed because Read_Master_Log_Pos is not equal to Exec_Master_Log_Pos;
+}
+
start slave;
sync_with_master;
select * from t1;
diff --git a/mysql-test/suite/rpl/t/rpl_critical_errors.test b/mysql-test/suite/rpl/t/rpl_critical_errors.test
index b35cd305f92..aa1f251b738 100644
--- a/mysql-test/suite/rpl/t/rpl_critical_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_critical_errors.test
@@ -53,15 +53,13 @@ KILL QUERY 2;
connection slave;
# Here the slave will only stop if the query above actually started
-# inserting some rows into t2. Otherwise, it will hang forever.
---source include/wait_for_slave_to_stop.inc
+# inserting some rows into t2. Otherwise, it will hang forever. ... and there
+# the error code should be 1317 (ER_QUERY_INTERRUPTED)
+--let $slave_sql_errno= 1317
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
# The following should be 0
SELECT COUNT(*) FROM t2;
-# ... and there the error code should be 1317 (ER_QUERY_INTERRUPTED)
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 20 # 22 # 23 # 33 #
-query_vertical SHOW SLAVE STATUS;
-
enable_parsing;
diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test
index 24e7bd631a7..457095f8fa6 100644
--- a/mysql-test/suite/rpl/t/rpl_do_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test
@@ -120,6 +120,9 @@ show grants for rpl_do_grant2@localhost;
# BUG42217 mysql.procs_priv does not get replicated
#####################################################
connection master;
+call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
+sync_slave_with_master;
+connection master;
--disable_warnings
DROP DATABASE IF EXISTS bug42217_db;
@@ -129,8 +132,8 @@ CREATE DATABASE bug42217_db;
GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost'
IDENTIFIED BY 'create_rout_db' WITH GRANT OPTION;
-sync_slave_with_master;
-connection master;
+-- sync_slave_with_master
+-- connection master
connect (create_rout_db_master, localhost, create_rout_db, create_rout_db, bug42217_db,$MASTER_MYPORT,);
connect (create_rout_db_slave, localhost, create_rout_db, create_rout_db, bug42217_db, $SLAVE_MYPORT,);
@@ -210,18 +213,26 @@ DROP FUNCTION bug42217_db.upgrade_del_func;
DROP FUNCTION bug42217_db.upgrade_alter_func;
DROP DATABASE bug42217_db;
-call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
-
-sync_slave_with_master;
-
+-- sync_slave_with_master
# Drop the user that was already dropped on the slave
connection slave;
--disable_warnings
stop slave;
connection master;
+
+# user was already dropped in the slave before
+# so no need to wait for the slave to replicate
+# this statement (if it did and we later synced
+# the slave it would end up in an error anyway)
DROP USER 'create_rout_db'@'localhost';
+
--enable_warnings
+# finish entire clean up (remove binlogs)
+# so that we leave a pristine environment for the
+# following tests
+-- source include/master-slave-reset.inc
+
# BUG#49119: Master crashes when executing 'REVOKE ... ON
# {PROCEDURE|FUNCTION} FROM ...'
#
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..ab1de6a2e9f 100644
--- a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
+++ b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
@@ -21,52 +21,51 @@ connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root";
-start slave;
+source include/start_slave.inc;
# now we test it
connection slave;
create table t1 (n int);
+let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $master_log_pos_1= `SELECT $master_log_pos_1 + 3`;
-save_master_pos;
-connection master;
-sync_with_master;
+sync_slave_with_master master;
#
# BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if
# log-slave-updates and circul repl
#
-stop slave;
+source include/stop_slave.inc;
create table t2 (n int); # create one ignored event
-save_master_pos;
-connection slave;
-sync_with_master;
-
-connection slave;
+sync_slave_with_master;
show tables;
-save_master_pos;
-
create table t3 (n int) engine=innodb;
+let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $master_log_pos_2= `SELECT $master_log_pos_2 + 5`;
set @a=1;
insert into t3 values(@a);
+let $master_log_pos_3= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $master_log_pos_3= `SELECT $master_log_pos_3 + 5`;
begin;
insert into t3 values(2);
insert into t3 values(3);
commit;
insert into t3 values(4);
-
connection master;
# bug is that START SLAVE UNTIL may stop too late, we test that by
# asking it to stop before creation of t3.
-start slave until master_log_file="slave-bin.000001",master_log_pos=195;
+--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_1 MASTER_LOG_POS
+eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_1;
--source include/wait_for_slave_sql_to_stop.inc
# then BUG#13861 causes t3 to show up below (because stopped too
@@ -75,16 +74,18 @@ start slave until master_log_file="slave-bin.000001",master_log_pos=195;
show tables;
# ensure that we do not break set @a=1; insert into t3 values(@a);
-start slave until master_log_file="slave-bin.000001",master_log_pos=438;
+--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_2 MASTER_LOG_POS
+eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_2;
--source include/wait_for_slave_sql_to_stop.inc
select * from t3;
# ensure that we do not break transaction
-start slave until master_log_file="slave-bin.000001",master_log_pos=663;
+--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_3 MASTER_LOG_POS
+eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_3;
--source include/wait_for_slave_sql_to_stop.inc
select * from t3;
-start slave;
+source include/start_slave.inc;
# BUG#13023 is that Exec_master_log_pos may stay too low "forever":
@@ -94,31 +95,20 @@ create table t4 (n int); # create 3 ignored events
create table t5 (n int);
create table t6 (n int);
-save_master_pos;
-connection slave;
-sync_with_master;
-
-connection slave;
-
-save_master_pos;
-
-connection master;
+sync_slave_with_master;
+sync_slave_with_master master;
# then BUG#13023 caused hang below ("master" looks behind, while it's
# not in terms of updates done).
-sync_with_master;
-
show tables;
# cleanup
-stop slave;
+source include/stop_slave.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.test b/mysql-test/suite/rpl/t/rpl_empty_master_crash.test
index f8e7870ae3c..863b450a6d9 100644
--- a/mysql-test/suite/rpl/t/rpl_empty_master_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_empty_master_crash.test
@@ -1,7 +1,5 @@
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
#
diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
index bf71ffbfd1e..aa2dee0fe57 100644
--- a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
+++ b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
@@ -126,7 +126,7 @@ connection master;
# Parameters for include/wait_for_slave_sql_error_and_skip.inc:
# Ask it to show SQL error message.
-let $show_sql_error= 1;
+let $show_slave_sql_error= 1;
# The expected error will always be 1146 (ER_NO_SUCH_TABLE).
let $slave_sql_errno= 1146;
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
index a8befe612c2..487f910ba2b 100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
@@ -36,7 +36,6 @@ source include/start_slave.inc;
# 2. Insert into t1 on slave (2nd) when the event (1st) for t1 replicated.
# 3. Master waits until the event (2nd) for t1 will be replicated.
---disable_query_log
CREATE TABLE t1 (a INT KEY) ENGINE= MyISAM;
let $wait_binlog_event= CREATE TABLE t1;
--source include/wait_for_binlog_event.inc
@@ -44,31 +43,20 @@ sync_slave_with_master;
connection master;
INSERT INTO t1 VALUE(1);
---enable_query_log
FLUSH LOGS;
-let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1);
-
-connection slave;
-let $slave_param= Exec_Master_Log_Pos;
-source include/wait_for_slave_param.inc;
+sync_slave_with_master;
---disable_query_log
INSERT INTO t1 VALUE(2);
let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1);
---enable_query_log
-
-connection master;
-let $slave_param= Exec_Master_Log_Pos;
-source include/wait_for_slave_param.inc;
-
---enable_query_log
+sync_slave_with_master master;
#
-# Show status of slave
+# Check that the master server's slave threads are still running and show
+# Relay_Log_File
#
---replace_result $SLAVE_MYPORT SLAVE_PORT $slave_param_value POSITION
---replace_column 1 # 8 # 9 # 16 # 23 # 33 # 34 # 35 #
---query_vertical SHOW SLAVE STATUS
+--source include/check_slave_is_running.inc
+--let status_items= Relay_Log_File
+--source include/show_slave_status.inc
--disable_query_log
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
index 4a9276d9880..28f13c17042 100644
--- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
+++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
@@ -57,14 +57,10 @@ source include/stop_slave.inc;
eval change master to master_port=$SLAVE_MYPORT;
start slave;
-let $slave_param= Last_IO_Errno;
-let $slave_param_value= 1593;
-source include/wait_for_slave_param.inc;
--echo *** must be having the replicate-same-server-id IO thread error ***
-let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1);
-let $last_io_error= query_get_value("show slave status", Last_IO_Error, 1);
-echo Slave_IO_Errno= $last_io_errno;
-echo Slave_IO_Error= $last_io_error;
+let $slave_io_errno= 1593;
+let $show_slave_io_error= 1;
+source include/wait_for_slave_io_error.inc;
# cleanup
diff --git a/mysql-test/suite/rpl/t/rpl_grant.test b/mysql-test/suite/rpl/t/rpl_grant.test
index 50b243eab92..6fbdafc0f9c 100644
--- a/mysql-test/suite/rpl/t/rpl_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_grant.test
@@ -36,5 +36,3 @@ sync_slave_with_master;
--echo **** On Slave ****
SELECT user,host FROM mysql.user WHERE user like 'dummy%';
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%';
-
-source include/show_slave_status2.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test
index 66893ebb93f..08096d03c11 100644
--- a/mysql-test/suite/rpl/t/rpl_incident.test
+++ b/mysql-test/suite/rpl/t/rpl_incident.test
@@ -16,6 +16,7 @@ SELECT * FROM t1;
connection slave;
# Wait until SQL thread stops with error LOST_EVENT on master
let $slave_sql_errno= 1590;
+let $show_slave_sql_error= 1;
source include/wait_for_slave_sql_error.inc;
# The 4 should not be inserted into the table, since the incident log
@@ -23,10 +24,6 @@ source include/wait_for_slave_sql_error.inc;
--echo **** On Slave ****
SELECT * FROM t1;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
-
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
--sync_with_master
@@ -35,9 +32,7 @@ START SLAVE;
# should be running. We should also have rotated to a new binary log.
SELECT * FROM t1;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
+source include/check_slave_is_running.inc;
connection master;
DROP TABLE t1;
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..5b31b094b62 100644
--- a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
+++ b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
@@ -26,9 +26,11 @@ INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
SELECT * FROM t1;
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
-# show the error message
---replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
---query_vertical show slave status;
+# show the error message
+#1105 = ER_UNKNOWN_ERROR
+--let $slave_sql_errno= 1105
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
# show that it was not replicated
SELECT * FROM t1;
@@ -81,8 +83,10 @@ SELECT * FROM t1;
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
# show the error message
---replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
---query_vertical show slave status;
+#1105 = ER_UNKNOWN_ERROR
+--let $slave_sql_errno= 1105
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
# show that it was not replicated
SELECT * FROM t1;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
index b7d9995c834..e80fc160d8f 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
@@ -8,7 +8,6 @@ connection master;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,10);
sync_slave_with_master;
-source include/show_slave_status.inc;
# Now we feed it a load data infile, which should make it stop with a
# fatal error.
@@ -16,12 +15,9 @@ connection master;
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
connection slave;
-wait_for_slave_to_stop;
-source include/show_slave_status.inc;
-
-connection slave;
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+let $slave_sql_errno= 1593;
+let $show_slave_sql_error= 1;
+source include/wait_for_slave_sql_error_and_skip.inc;
connection master;
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test
index 48effa00b64..daf4b9093fe 100644
--- a/mysql-test/suite/rpl/t/rpl_log_pos.test
+++ b/mysql-test/suite/rpl/t/rpl_log_pos.test
@@ -11,19 +11,31 @@
# Passes with rbr no problem, removed statement include [jbm]
source include/master-slave.inc;
+
+#
+# Add an event to get some information into the log we can try to parse
+#
+let $read_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
+create table if not exists t1 (n int);
+drop table t1;
+
call mtr.add_suppression ("Slave I/O: Got fatal error 1236 from master when reading data from binary");
+call mtr.add_suppression ("Error in Log_event::read_log_event");
source include/show_master_status.inc;
sync_slave_with_master;
source include/stop_slave.inc;
-change master to master_log_pos=75;
-source include/show_slave_status2.inc;
+let $wrong_log_pos= `SELECT $read_pos+2`;
+--replace_result $wrong_log_pos MASTER_LOG_POS
+eval change master to master_log_pos=$wrong_log_pos;
start slave;
-source include/wait_for_slave_sql_to_start.inc;
-source include/wait_for_slave_io_to_stop.inc;
+let $slave_io_errno= 1236;
+let $show_slave_io_error= 1;
+source include/wait_for_slave_io_error.inc;
+--disable_warnings
source include/stop_slave.inc;
+--enable_warnings
-source include/show_slave_status.inc;
connection master;
source include/show_master_status.inc;
create table if not exists t1 (n int);
@@ -32,6 +44,7 @@ create table t1 (n int);
insert into t1 values (1),(2),(3);
save_master_pos;
connection slave;
+--replace_result 4 MASTER_LOG_POS
change master to master_log_pos=4;
start slave;
sync_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
index 8863c9d4ac7..ec50311fc7c 100644
--- a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
+++ b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
@@ -15,20 +15,10 @@ SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
CREATE TABLE t1 (a INT, b LONG);
INSERT INTO t1 VALUES (1,1), (2,2);
INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
sync_slave_with_master;
--echo **** On Slave ****
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 # 34 # 35 #
---query_vertical SHOW SLAVE STATUS
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
diff --git a/mysql-test/suite/rpl/t/rpl_replicate_do.test b/mysql-test/suite/rpl/t/rpl_replicate_do.test
index fea168ee9f1..382e198aaf9 100644
--- a/mysql-test/suite/rpl/t/rpl_replicate_do.test
+++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test
@@ -31,10 +31,8 @@ save_master_pos;
connection slave;
sync_with_master;
# show slave status, just to see of it prints replicate-do-table
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
-
+let $status_items= Replicate_Do_Table;
+source include/show_slave_status.inc;
#
# BUG#12542
# TEST: "SET ONE_SHOT should always be executed on slave"
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
index f67c880bf26..e8bcc904e4c 100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
@@ -66,7 +66,9 @@ insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
sync_slave_with_master;
-source include/show_slave_status2.inc;
+let $status_items= Master_Log_File, Relay_Master_Log_File;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
select * from t1;
connection master;
flush logs;
@@ -136,7 +138,8 @@ purge master logs before (@time_for_purge);
source include/show_binary_logs.inc;
insert into t2 values (65);
sync_slave_with_master;
-source include/show_slave_status2.inc;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
select * from t2;
#
@@ -166,7 +169,8 @@ connection slave;
sync_with_master;
select * from t4;
-source include/show_slave_status2.inc;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
# because of concurrent insert, the table may not be up to date
# if we do not lock
lock tables t3 read;
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
index 2ee7c62f282..2bf5a01a71f 100644
--- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
@@ -48,9 +48,7 @@ DELETE FROM t1;
INSERT INTO t1 VALUES (1),(2);
DELETE FROM t1 WHERE a = 0;
UPDATE t1 SET a=99 WHERE a = 0;
---replace_result $SERVER_VERSION SERVER_VERSION
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
DROP TABLE t1;
--sync_slave_with_master
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 e30982da605..a72ca75e975 100644
--- a/mysql-test/suite/rpl/t/rpl_row_create_table.test
+++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test
@@ -36,9 +36,7 @@ CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---query_vertical SHOW BINLOG EVENTS FROM 106
+--source include/show_binlog_events.inc
--echo **** On Master ****
--query_vertical SHOW CREATE TABLE t1
--query_vertical SHOW CREATE TABLE t2
@@ -74,9 +72,7 @@ connection master;
--error ER_DUP_ENTRY
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
# Shouldn't be written to the binary log
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+--source include/show_binlog_events.inc
# Test that INSERT-SELECT works the same way as for SBR.
CREATE TABLE t7 (a INT, b INT UNIQUE);
@@ -84,9 +80,7 @@ CREATE TABLE t7 (a INT, b INT UNIQUE);
INSERT INTO t7 SELECT a,b FROM tt3;
SELECT * FROM t7 ORDER BY a,b;
# Should be written to the binary log
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+--source include/show_binlog_events.inc
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
@@ -98,9 +92,7 @@ INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
BEGIN;
INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+--source include/show_binlog_events.inc
SELECT * FROM t7 ORDER BY a,b;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
@@ -116,9 +108,7 @@ CREATE TEMPORARY TABLE tt7 SELECT 1;
--echo **** On Master ****
--query_vertical SHOW CREATE TABLE t8
--query_vertical SHOW CREATE TABLE t9
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+--source include/show_binlog_events.inc
sync_slave_with_master;
--echo **** On Slave ****
--query_vertical SHOW CREATE TABLE t8
@@ -160,9 +150,7 @@ SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
SELECT * FROM t3 ORDER BY a;
SELECT * FROM t4 ORDER BY a;
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+--source include/show_binlog_events.inc
sync_slave_with_master;
SHOW TABLES;
SELECT * FROM t1 ORDER BY a;
@@ -202,9 +190,7 @@ INSERT INTO t2 SELECT a+2 FROM tt1;
COMMIT;
SELECT * FROM t2 ORDER BY a;
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+--source include/show_binlog_events.inc
sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
@@ -225,9 +211,7 @@ INSERT INTO t2 SELECT a+2 FROM tt2;
ROLLBACK;
SELECT * FROM t2 ORDER BY a;
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 106;
+source include/show_binlog_events.inc;
sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
diff --git a/mysql-test/suite/rpl/t/rpl_row_drop.test b/mysql-test/suite/rpl/t/rpl_row_drop.test
index 20c217a7c3a..d18ebc2846b 100644
--- a/mysql-test/suite/rpl/t/rpl_row_drop.test
+++ b/mysql-test/suite/rpl/t/rpl_row_drop.test
@@ -30,10 +30,7 @@ connection master;
--echo **** On Master ****
# Should drop the non-temporary table t1 and the temporary table t2
DROP TABLE t1,t2;
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
SHOW TABLES;
sync_slave_with_master;
--echo **** On Slave ****
diff --git a/mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test b/mysql-test/suite/rpl/t/rpl_row_find_row.test
index 1d7e134f4f4..9163ab54406 100644
--- a/mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test
+++ b/mysql-test/suite/rpl/t/rpl_row_find_row.test
@@ -71,3 +71,34 @@ DELETE FROM t;
DROP TABLE t;
-- sync_slave_with_master
+
+#
+# BUG#53893: RBR: nullable unique key can lead to out-of-sync slave
+#
+
+#
+# We insert two rows. Both with part of UNIQUE KEY set to null.
+# Then we update the last row inserted. On master the correct
+# row is updated. On the slave the wrong row would be updated
+# because the engine would look it up by the NULL Unique KEY.
+# As a consquence, the wrong row would be updated.
+#
+
+-- connection master
+-- source include/master-slave-reset.inc
+-- connection master
+
+CREATE TABLE t1 (c1 INT NOT NULL, c2 INT NOT NULL, c3 INT, UNIQUE KEY(c1,c3), KEY(c2));
+INSERT INTO t1(c1,c2) VALUES(1,1);
+INSERT INTO t1(c1,c2) VALUES(1,2);
+UPDATE t1 SET c1=1000 WHERE c2=2;
+-- sync_slave_with_master
+
+-- let $diff_table_1=master:test.t1
+-- let $diff_table_2=slave:test.t1
+-- source include/diff_tables.inc
+
+-- connection master
+DROP TABLE t1;
+-- sync_slave_with_master
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test b/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test
new file mode 100644
index 00000000000..67e4c4fb14d
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test
@@ -0,0 +1,10 @@
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+-- source include/have_innodb.inc
+
+#
+# BUG#52868 Wrong handling of NULL value during update, replication out of sync
+#
+
+-- let $engine= InnoDB
+-- source extra/rpl_tests/rpl_record_compare.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test b/mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test
new file mode 100644
index 00000000000..43fa99a51da
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test
@@ -0,0 +1,31 @@
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+#
+# BUG#52868 Wrong handling of NULL value during update, replication out of sync
+#
+
+-- let $engine= MyISAM
+-- source extra/rpl_tests/rpl_record_compare.test
+
+-- echo ## coverage purposes - Field_bits
+-- echo ## 1 X bit + 2 Null bits + 5 bits => last_null_bit_pos==0
+## Added here because AFAIK it's only MyISAM and NDB that use Field_bits
+
+-- source include/master-slave-reset.inc
+-- connection master
+
+-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bit(5)) ENGINE=$engine DEFAULT CHARSET=latin1
+
+INSERT INTO t1(c1,c2) VALUES (10, b'1');
+INSERT INTO t1(c1,c2) VALUES (NULL, b'1');
+UPDATE t1 SET c1= 0;
+-- sync_slave_with_master
+
+-- let $diff_table_1= master:test.t1
+-- let $diff_table_2= slave:test.t1
+-- source include/diff_tables.inc
+
+-- connection master
+DROP TABLE t1;
+-- sync_slave_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test
index fe859218ed3..9e3cbbd325a 100644
--- a/mysql-test/suite/rpl/t/rpl_row_until.test
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test
@@ -15,6 +15,7 @@ DROP TABLE t1;
# Save master log postion for query DROP TABLE t1
save_master_pos;
let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7);
+let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 7);
CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
# Save master log postion for query CREATE TABLE t2
@@ -46,26 +47,28 @@ eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='1
# Try to replicate all queries until drop of t1
connection slave;
-echo START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1;
+echo START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_drop_t1;
--disable_query_log
-eval START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_pos_drop_t1;
+eval START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_drop_t1;
--enable_query_log
--source include/wait_for_slave_sql_to_stop.inc
# Here table should be still not deleted
SELECT * FROM t1;
---replace_result $master_pos_drop_t1 MASTER_POS_DROP_T1
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_drop_t1
+--source include/check_slave_param.inc
# This should fail right after start
+--replace_result 291 MASTER_LOG_POS
START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
--source include/wait_for_slave_sql_to_stop.inc
# again this table should be still not deleted
SELECT * FROM t1;
---replace_result $master_pos_drop_t1 MASTER_POS_DROP_T1
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_drop_t1
+--source include/check_slave_param.inc
# Try replicate all up to and not including the second insert to t2;
echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2;
@@ -74,9 +77,10 @@ eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$r
--enable_query_log
--source include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t2;
---replace_result $relay_pos_insert1_t2 RELAY_POS_INSERT1_T2 $master_pos_insert1_t2 MASTER_POS_INSERT1_T2
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_insert1_t2
+--source include/check_slave_param.inc
# clean up
START SLAVE;
@@ -86,31 +90,34 @@ sync_slave_with_master;
--source include/stop_slave.inc
# This should stop immediately as we are already there
-echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2;
+echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_create_t2;
--disable_query_log
-eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_pos_create_t2;
+eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_create_t2;
--enable_query_log
let $slave_param= Until_Log_Pos;
let $slave_param_value= $master_pos_create_t2;
--source include/wait_for_slave_param.inc
--source include/wait_for_slave_sql_to_stop.inc
# here the sql slave thread should be stopped
---replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
---replace_result $master_pos_create_t2 MASTER_POS_CREATE_T2 $master_pos_drop_t2 MASTER_POS_DROP_T2
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_drop_t2
+--source include/check_slave_param.inc
#testing various error conditions
+--replace_result 561 MASTER_LOG_POS
--error 1277
START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
+--replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
--error 1277
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12;
--error 1277
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
--error 1277
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
+--replace_result 561 MASTER_LOG_POS
--error 1277
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
# Warning should be given for second command
START SLAVE;
+--replace_result 740 MASTER_LOG_POS
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
diff --git a/mysql-test/suite/rpl/t/rpl_skip_error.test b/mysql-test/suite/rpl/t/rpl_skip_error.test
index 9c6aa3dcb57..8d176ac0c3b 100644
--- a/mysql-test/suite/rpl/t/rpl_skip_error.test
+++ b/mysql-test/suite/rpl/t/rpl_skip_error.test
@@ -55,7 +55,7 @@ insert into t1 values (7), (8), (9);
--echo [on slave]
sync_slave_with_master;
select * from t1 order by n;
-source include/show_slave_status2.inc;
+source include/check_slave_is_running.inc;
--echo ==== Clean Up ====
connection master;
@@ -78,7 +78,7 @@ insert into t1 values (1), (2), (3);
--echo [on slave]
sync_slave_with_master;
select * from t1;
-source include/show_slave_status2.inc;
+source include/check_slave_is_running.inc;
--echo ==== Clean Up ====
diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
index 437e1ebb92d..22309c33724 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
@@ -31,12 +31,9 @@ commit;
# Catch Error
##########################################################################
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
-
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---replace_regex /SQL_LOAD-[0-9]-[0-9]-[0-9]*/SQL_LOAD/
-query_vertical show slave status;
+# Errno 9 is what we get although it's wrong (see BUG#52768).
+--let $slave_sql_errno= 9
+--source include/wait_for_slave_sql_error.inc
##########################################################################
# Clean up
diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test
index c5ee6793277..4c5930d74fe 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_skip.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test
@@ -14,6 +14,7 @@ CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (c INT, d INT);
INSERT INTO t1 VALUES (1,1),(2,4),(3,9);
INSERT INTO t2 VALUES (1,1),(2,8),(3,27);
+let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
UPDATE t1,t2 SET b = d, d = b * 2 WHERE a = c;
source include/show_binlog_events.inc;
@@ -21,16 +22,17 @@ source include/show_binlog_events.inc;
SELECT * FROM t1;
SELECT * FROM t2;
save_master_pos;
-
--echo **** On Slave ****
connection slave;
# Stop when reaching the the first table map event.
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
+--replace_result $master_log_pos MASTER_LOG_POS
+eval START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_log_pos;
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;
+let $slave_param= Exec_Master_Log_Pos;
+let $slave_param_value= $master_log_pos;
+source include/check_slave_param.inc;
+source include/check_slave_no_error.inc;
# Now we skip *one* table map event. If the execution starts right
# after that table map event, *one* of the involved tables will be
@@ -53,19 +55,18 @@ RESET MASTER;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET @foo = 12;
+let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
INSERT INTO t1 VALUES(@foo, 2*@foo);
save_master_pos;
source include/show_binlog_events.inc;
connection slave;
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=106;
+--replace_result $master_log_pos MASTER_LOG_POS
+eval START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_log_pos;
source include/wait_for_slave_sql_to_stop.inc;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
--echo **** On Master ****
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test
index 9be630e9ae8..243136a0d38 100644
--- a/mysql-test/suite/rpl/t/rpl_sp.test
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -568,9 +568,7 @@ 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.
diff --git a/mysql-test/suite/rpl/t/rpl_ssl.test b/mysql-test/suite/rpl/t/rpl_ssl.test
index 7e256390e25..803b08eeec5 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl.test
@@ -30,9 +30,9 @@ select * from t1;
# The slave is synced and waiting/reading from master
# SHOW SLAVE STATUS will show "Waiting for master to send event"
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-query_vertical show slave status;
+let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
# Stop the slave, as reported in bug#21871 it would hang
STOP SLAVE;
@@ -70,9 +70,8 @@ let $master_count= `select count(*) from t1`;
sync_slave_with_master;
--source include/wait_for_slave_to_start.inc
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-query_vertical show slave status;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
let $slave_count= `select count(*) from t1`;
diff --git a/mysql-test/suite/rpl/t/rpl_ssl1.test b/mysql-test/suite/rpl/t/rpl_ssl1.test
index b5355d737d5..eca6a8cf46e 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl1.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl1.test
@@ -45,9 +45,9 @@ sync_with_master;
select * from t1;
#checking show slave status
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
-query_vertical show slave status;
+let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
#checking if replication works without ssl also performing clean up
stop slave;
@@ -59,10 +59,8 @@ drop table t1;
save_master_pos;
connection slave;
sync_with_master;
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
-query_vertical show slave status;
-
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
# End of 4.1 tests
# Start replication with ssl_verify_server_cert turned on
@@ -89,9 +87,8 @@ echo on slave;
select * from t1;
#checking show slave status
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
-query_vertical show slave status;
+source include/show_slave_status.inc;
+--source include/check_slave_is_running.inc
connection master;
drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test
index 0097fde874a..4086fd03ca1 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test
@@ -3,3 +3,41 @@
--source include/have_innodb.inc
--source extra/rpl_tests/rpl_mixing_engines.test
+
+#
+# BUG#49522: Replication problem with mixed MyISAM/InnoDB
+#
+
+-- source include/master-slave-reset.inc
+-- connection master
+
+CREATE TABLE `t1` (
+ `c1` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` tinyint(1) unsigned DEFAULT NULL,
+ `c3` varchar(300) DEFAULT NULL,
+ `c4` int(10) unsigned NOT NULL,
+ `c5` int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY (`c1`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+-- sync_slave_with_master
+ALTER TABLE `t1` Engine=InnoDB;
+
+-- connection master
+SET AUTOCOMMIT=0;
+
+INSERT INTO t1 (c1,c2,c3,c4,c5) VALUES (1, 1, 'X', 1, NULL);
+COMMIT;
+ROLLBACK;
+SET AUTOCOMMIT=1;
+
+-- 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
+
+-- source include/master-slave-end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test
index ae03ebe8b76..f5e57ec2bd6 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_until.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_until.test
@@ -34,9 +34,12 @@ sync_slave_with_master;
connection master;
create table t1(n int not null auto_increment primary key);
insert into t1 values (1),(2),(3),(4);
+let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1);
drop table t1;
create table t2(n int not null auto_increment primary key);
insert into t2 values (1),(2);
+let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
insert into t2 values (3),(4);
drop table t2;
@@ -45,27 +48,39 @@ drop table t2;
# try to replicate all queries until drop of t1
--echo [on slave]
connection slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=323;
+--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_1 MASTER_LOG_POS
+eval start slave until master_log_file='$master_log_file', master_log_pos=$master_log_pos_1;
--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_stop.inc
# here table should be still not deleted
select * from t1;
-source include/show_slave_status2.inc;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos_1
+--source include/check_slave_param.inc
# this should fail right after start
+--replace_result 291 MASTER_LOG_POS
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_stop.inc
# again this table should be still not deleted
select * from t1;
-source include/show_slave_status2.inc;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos_1
+--source include/check_slave_param.inc
+let $relay_log_file= slave-relay-bin.000004;
+let $master_log_pos= $master_log_pos_2;
+source include/get_relay_log_pos.inc;
# try replicate all up to and not including the second insert to t2;
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
+--replace_result $relay_log_pos RELAY_LOG_POS
+eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos;
--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_stop.inc
select * from t2;
-source include/show_slave_status2.inc;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos
+--source include/check_slave_param.inc
# clean up
start slave;
@@ -75,27 +90,34 @@ connection master;
sync_slave_with_master;
--source include/stop_slave.inc
+--let $exec_log_pos_1= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
# this should stop immediately as we are already there
-start slave until master_log_file='master-bin.000001', master_log_pos=776;
+--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_2 MASTER_LOG_POS
+eval start slave until master_log_file='$master_log_file', master_log_pos=$master_log_pos_2;
--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_stop.inc
---replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
-source include/show_slave_status2.inc;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $exec_log_pos_1
+--source include/check_slave_param.inc
--echo ==== Test various error conditions ====
+--replace_result 561 MASTER_LOG_POS
--error 1277
start slave until master_log_file='master-bin', master_log_pos=561;
+--replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
--error 1277
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
--error 1277
start slave until master_log_file='master-bin.000001';
--error 1277
start slave until relay_log_file='slave-relay-bin.000002';
+--replace_result 561 MASTER_LOG_POS
--error 1277
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
# Warning should be given for second command
start slave sql_thread;
+--replace_result 776 MASTER_LOG_POS
start slave until master_log_file='master-bin.000001', master_log_pos=776;
#
@@ -144,8 +166,8 @@ insert into t1 set a=null;
select count(*) as two from t1;
connection slave;
---replace_result $until_pos UNTIL_POS;
-eval start slave until master_log_file='master-bin.000001', master_log_pos= $until_pos;
+--replace_result $master_log_file MASTER_LOG_FILE $until_pos UNTIL_POS;
+eval start slave until master_log_file='$master_log_file', master_log_pos= $until_pos;
source include/wait_for_slave_sql_to_stop.inc;
let $slave_exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
--echo slave stopped at the prescribed position
@@ -174,13 +196,18 @@ sync_with_master;
connection master;
drop table if exists t1; # there is create table t1 in bug47142_master-bin.000001
+sync_slave_with_master;
+connection slave;
+stop slave;
+connection master;
+
flush logs;
let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/master-bin.000001
--copy_file $MYSQL_TEST_DIR/std_data/bug47142_master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
+flush logs;
connection slave;
-stop slave;
reset slave;
start slave until master_log_file='master-bin.000001', master_log_pos=294 /* to stop right before DROP */;
--source include/wait_for_slave_sql_to_stop.inc
diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
index ad0e6174c54..6b1ba558d2d 100644
--- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
@@ -1,4 +1,5 @@
source include/master-slave.inc;
+source include/have_innodb.inc;
call mtr.add_suppression("Deadlock found");
@@ -25,18 +26,58 @@ sync_slave_with_master;
set @@global.slave_exec_mode= default;
SHOW STATUS LIKE 'Slave_retried_transactions';
SELECT * FROM t1;
-source include/show_slave_status2.inc;
+source include/check_slave_is_running.inc;
DROP TABLE t1;
--echo **** On Master ****
connection master;
+SET SQL_LOG_BIN= 0;
DROP TABLE t1;
+SET SQL_LOG_BIN= 1;
+
+# BUG#Bug #53259 Unsafe statement binlogged in statement format w/MyIsam temp tables
+#
+SET SESSION BINLOG_FORMAT=MIXED;
+CREATE TABLE t_myisam (id INT, PRIMARY KEY (id)) engine= MyIsam;
+INSERT INTO t_myisam (id) VALUES(1);
+CREATE TABLE t_innodb (id INT) engine= Innodb;
+INSERT INTO t_innodb (id) VALUES(1);
+
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+BEGIN;
+INSERT INTO t_innodb(id) VALUES(2);
+INSERT INTO t_myisam(id) VALUES(3);
+CREATE TEMPORARY TABLE x (id INT);
+--error 1062
+INSERT INTO t_myisam(id) VALUES(4),(1);
+INSERT INTO t_innodb(id) VALUES(5);
+COMMIT;
+
+SELECT * FROM t_innodb;
+SELECT * FROM t_myisam;
+
+--sync_slave_with_master
+
+SELECT * FROM t_innodb;
+SELECT * FROM t_myisam;
+
+--connection master
+
+BEGIN;
+CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb;
+INSERT INTO t_innodb(id) VALUES(1);
+INSERT INTO t_innodb(id) VALUES(1);
+ROLLBACK;
+source include/show_binlog_events.inc;
+
+DROP TABLE t_myisam, t_innodb;
# We must wait for the slave to stop.
# Otherwise the warnings in the error log about deadlock may be written to
# the error log only during shutdown, and currently the suppression of
# "Deadlock found" set in this test case is not effective during server
# shutdown.
+--sync_slave_with_master
connection slave;
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
diff --git a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
index 56924a2efe9..d8c6ae5ade8 100644
--- a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
+++ b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
@@ -10,4 +10,3 @@ source include/have_binlog_format_row.inc;
LET $ENGINE_TYPE= MyISAM;
source extra/rpl_tests/rpl_tmp_table_and_DDL.test;
-
diff --git a/mysql-test/suite/rpl_ndb/my.cnf b/mysql-test/suite/rpl_ndb/my.cnf
index 58fec36eedd..426608fc7fa 100644
--- a/mysql-test/suite/rpl_ndb/my.cnf
+++ b/mysql-test/suite/rpl_ndb/my.cnf
@@ -18,6 +18,8 @@ mysqld=
ndbcluster
# Turn on bin logging
log-bin= master-bin
+# Cluster only supports row format
+binlog-format= row
[mysqld.1.1]
@@ -41,6 +43,8 @@ master-connect-retry= 1
log-bin= slave-bin
relay-log= slave-relay-bin
+# Cluster only supports row format
+binlog-format= row
init-rpl-role= slave
log-slave-updates
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..d43165e2b5e 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
@@ -140,45 +140,7 @@ set GLOBAL slave_transaction_retries=1;
**** On Master ****
UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
**** On Slave ****
-SHOW SLAVE STATUS;;
-Slave_IO_State <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 <Read_Master_Log_Pos>
-Relay_Log_File <Relay_Log_File>
-Relay_Log_Pos <Relay_Log_Pos>
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table <Replicate_Ignore_Table>
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno <Last_Errno>
-Last_Error <Last_Error>
-Skip_Counter 0
-Exec_Master_Log_Pos <Exec_Master_Log_Pos>
-Relay_Log_Space <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 <Seconds_Behind_Master>
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno <Last_IO_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno <Last_SQL_Errno>
-Last_SQL_Error <Last_SQL_Error>
+Last_SQL_Error = Could not execute Write_rows event on table test.t1; Got temporary error 266 'Time-out in NDB, probably caused by deadlock' from NDB, Error_code: 1297; Lock wait timeout exceeded; try restarting transaction, Error_code: 1205; handler error HA_ERR_LOCK_WAIT_TIMEOUT; the event's master log master-bin.000001, end_log_pos 6834
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..dfbd7a37d8e 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
@@ -17,87 +17,11 @@ SELECT * FROM t1 ORDER BY a;
a b
1 2
2 3
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
SELECT * FROM t1 ORDER BY a;
a b
1 2
2 3
-show slave status;;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 60
-Master_Log_File slave-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File slave-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-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
+Checking that both slave threads are running.
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..99438d663bb 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
@@ -14,45 +14,7 @@ INSERT INTO t1 VALUES (2,3);
STOP SLAVE;
CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=SLAVE_PORT,MASTER_USER="root";
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port SLAVE_PORT
-Connect_Retry 60
-Master_Log_File slave-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File slave-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-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
+Checking that both slave threads are running.
SELECT * FROM t1 ORDER BY a;
a b
1 2
@@ -63,43 +25,5 @@ SELECT * FROM t1 ORDER BY a;
a b
1 2
2 3
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
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..1a79affabe6 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
@@ -54,45 +54,7 @@ a b c
3 4 QA TESTING
*** Start Slave ***
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 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.
-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 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_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.
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
@@ -119,49 +81,12 @@ set @b1 = 'b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t3 ***
DROP TABLE t3;
*** Create t4 on slave ***
@@ -181,49 +106,12 @@ START SLAVE;
INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
(30000.22,4,'QA TESTING');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t4 ***
DROP TABLE t4;
*** Create t5 on slave ***
@@ -243,49 +131,12 @@ START SLAVE;
INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
(2,'JOE',300.01,0,'b2b2',1.0000009);
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t5 ***
DROP TABLE t5;
*** Create t6 on slave ***
@@ -304,47 +155,9 @@ START SLAVE;
INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
(2,'JOE',300.01,0);
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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_Error = Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -416,49 +229,12 @@ set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t10 ***
DROP TABLE t10;
*** Create t11 on slave ***
@@ -477,49 +253,12 @@ set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
*** Drop t11 ***
DROP TABLE t11;
*** Create t12 on slave ***
@@ -729,47 +468,10 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
********************************************
*** Expect slave to fail with Error 1060 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1060
-Last_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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'
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1;
+include/start_slave.inc
*** Try to insert in master ****
INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
SELECT * FROM t15 ORDER BY c1;
@@ -867,48 +569,11 @@ START SLAVE;
*** Master Data Insert ***
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
********************************************
-*** Expect slave to fail with Error 1522 ***
+*** Expect slave to fail with Error 1535 ***
********************************************
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port #
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1535
-Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-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
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
** DROP table t17 ***
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..e2755c04f28 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
@@ -32,16 +32,11 @@ SELECT * FROM t1 ORDER BY c3;
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
+Checking that both slave threads are running.
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
START SLAVE;
SELECT * FROM t1 ORDER BY c3;
c1 c2 c3
@@ -67,7 +62,5 @@ COMMIT;
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
+Checking that both slave threads are running.
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..85ecb13bd66 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
@@ -7,7 +7,7 @@ start slave;
include/stop_slave.inc
reset master;
reset slave;
-start slave;
+include/start_slave.inc
create table t1(n int not null auto_increment primary key)ENGINE=NDB;
insert into t1 values (NULL);
drop table t1;
@@ -16,34 +16,33 @@ load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
-show binlog events;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
-master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Table_map 1 # table_id: # (test.t1)
-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
-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=NDB
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Table_map 1 # table_id: # (test.t1)
-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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; drop table t1
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+show binlog events from <binlog_start> 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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+show binlog events from <binlog_start> 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;
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+master-bin.000001 # Query # # BEGIN
+show binlog events from <binlog_start> limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Table_map 1 # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (test.t1)
flush logs;
create table t3 (a int)ENGINE=NDB;
select * from t1 order by 1 asc;
@@ -211,17 +210,16 @@ master-bin.000001 # Write_rows # # table_id: #
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
-show binlog events in 'master-bin.000002';
+show binlog events in 'master-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
-master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB
-master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB
-master-bin.000002 # Query 1 # BEGIN
-master-bin.000002 # Table_map 1 # table_id: # (test.t2)
-master-bin.000002 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
-master-bin.000002 # Write_rows 1 # table_id: #
-master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000002 # Query 1 # COMMIT
+master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=NDB
+master-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=NDB
+master-bin.000002 # Query # # BEGIN
+master-bin.000002 # Table_map # # table_id: # (test.t2)
+master-bin.000002 # Table_map # # table_id: # (mysql.ndb_apply_status)
+master-bin.000002 # Write_rows # # table_id: #
+master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000002 # Query # # COMMIT
show binary logs;
Log_name File_size
master-bin.000001 #
@@ -230,75 +228,35 @@ show binary logs;
Log_name File_size
slave-bin.000001 #
slave-bin.000002 #
-show binlog events in 'slave-bin.000001' from 4;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
-slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
-slave-bin.000001 # Query 2 # BEGIN
-slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
-slave-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
-slave-bin.000001 # Write_rows 2 # table_id: #
-slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-slave-bin.000001 # Query 2 # COMMIT
-slave-bin.000001 # Query 1 # use `test`; drop table t1
-slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
-slave-bin.000001 # Query 2 # BEGIN
-slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
-slave-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
-slave-bin.000001 # Write_rows 2 # table_id: #
-slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-slave-bin.000001 # Query 2 # COMMIT
-slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB
-slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
-show binlog events in 'slave-bin.000002' from 4;
+slave-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+slave-bin.000001 # Write_rows # # table_id: #
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # use `test`; drop table t1
+slave-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
+slave-bin.000001 # Query # # BEGIN
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+slave-bin.000001 # Write_rows # # table_id: #
+slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=NDB
+slave-bin.000001 # Rotate # # slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
-slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB
-slave-bin.000002 # Query 2 # BEGIN
-slave-bin.000002 # Table_map 2 # table_id: # (test.t2)
-slave-bin.000002 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
-slave-bin.000002 # Write_rows 2 # table_id: #
-slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
-slave-bin.000002 # Query 2 # COMMIT
-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.000002
-Read_Master_Log_Pos 623
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000002
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos 623
-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
+slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=NDB
+slave-bin.000002 # Query # # BEGIN
+slave-bin.000002 # Table_map # # table_id: # (test.t2)
+slave-bin.000002 # Table_map # # table_id: # (mysql.ndb_apply_status)
+slave-bin.000002 # Write_rows # # table_id: #
+slave-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
+slave-bin.000002 # Query # # COMMIT
+Checking that both slave threads are running.
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_engines_transactions.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result
index da60b0bbbbf..7caa88a16a1 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result
@@ -341,6 +341,25 @@ ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SET AUTOCOMMIT = 1;
+---- Mixed statements Innodb ----
+BEGIN;
+INSERT INTO tndb VALUES (147);
+INSERT INTO tinnodb SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+COMMIT;
+INSERT INTO tndb VALUES (148);
+BEGIN;
+INSERT INTO tinnodb SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+INSERT INTO tndb VALUES (149);
+COMMIT;
+BEGIN;
+INSERT INTO tndb VALUES (150);
+INSERT INTO tmyisam SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+COMMIT;
+INSERT INTO tndb VALUES (151);
+BEGIN;
+INSERT INTO tmyisam SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+INSERT INTO tndb VALUES (152);
+COMMIT;
==== Verify the result ====
SELECT * FROM tmyisam ORDER BY a;
a
@@ -393,6 +412,8 @@ a
140
142
146
+150
+151
SELECT * FROM tinnodb ORDER BY a;
a
1
@@ -420,6 +441,8 @@ a
120
125
127
+147
+148
SELECT * FROM tndb ORDER BY a;
a
2
@@ -447,6 +470,12 @@ a
121
123
126
+147
+148
+149
+150
+151
+152
[on slave]
Comparing tables master:test.tmyisam and slave:test.tmyisam
Comparing tables master:test.tinnodb and slave:test.tinnodb
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..92fda774da5
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result
@@ -0,0 +1,286 @@
+==== 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 myisam_innodb VALUES (13);
+INSERT INTO myisam_innodb VALUES (14);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO innodb_myisam VALUES (15);
+INSERT INTO innodb_myisam VALUES (16);
+ROLLBACK;
+BEGIN;
+INSERT INTO myisam_ndb VALUES (17);
+INSERT INTO myisam_ndb VALUES (18);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+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 myisam_innodb VALUES (37);
+INSERT INTO myisam_innodb VALUES (38);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO innodb_myisam VALUES (39);
+INSERT INTO innodb_myisam VALUES (40);
+ROLLBACK;
+BEGIN;
+INSERT INTO myisam_ndb VALUES (41);
+INSERT INTO myisam_ndb VALUES (42);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+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;
+INSERT INTO myisam_innodb VALUES (61);
+INSERT INTO myisam_innodb VALUES (62);
+INSERT INTO myisam_ndb VALUES (63);
+INSERT INTO myisam_ndb VALUES (64);
+==== Show results ====
+SELECT * FROM myisam_innodb ORDER BY a;
+a
+1
+2
+13
+14
+25
+26
+37
+38
+49
+50
+61
+62
+SELECT * FROM innodb_myisam ORDER BY a;
+a
+3
+4
+27
+28
+51
+52
+SELECT * FROM myisam_ndb ORDER BY a;
+a
+5
+6
+17
+18
+29
+30
+41
+42
+53
+54
+63
+64
+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..05524ae1ae3 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
@@ -29,8 +29,8 @@ FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
106 master-bin.000001
CHANGE MASTER TO
master_port=<MASTER_PORT1>,
-master_log_file = 'master-bin.000001',
-master_log_pos = 106 ;
+master_log_file = 'MASTER_LOG_FILE',
+master_log_pos = MASTER_LOG_POS ;
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_stm_innodb.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result
index 675a69d17a4..367738b21e5 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+SET binlog_format = STATEMENT;
*** Test 1 ***
@@ -26,21 +27,21 @@ from mysql.ndb_apply_status;
# since insert is done with transactional engine, expect a BEGIN
# at <start_pos>
-show binlog events from <start_pos> limit 1;
+show binlog events from <binlog_start> limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 <start_pos> Query 1 # BEGIN
+master-bin.000001 # Query # # BEGIN
# Now the insert, one step after
-show binlog events from <start_pos> limit 1,1;
+show binlog events from <binlog_start> limit 1,1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; insert into t1 values (1,2)
+master-bin.000001 # Query # # use `test`; insert into t1 values (1,2)
# and the COMMIT should be at <end_pos>
-show binlog events from <start_pos> limit 2,1;
+show binlog events from <binlog_start> limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
+master-bin.000001 # Xid # # COMMIT /* XID */
begin;
insert into t1 values (2,3);
@@ -51,18 +52,18 @@ select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
from mysql.ndb_apply_status;
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
<log_name> <start_pos> <end_pos>
-show binlog events from <start_pos> limit 1;
+show binlog events from <binlog_start> limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 <start_pos> Query 1 # BEGIN
+master-bin.000001 # Query # # BEGIN
-show binlog events from <start_pos> limit 1,2;
+show binlog events from <binlog_start> limit 1,2;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; insert into t1 values (2,3)
master-bin.000001 # Query # # use `test`; insert into t2 values (3,4)
-show binlog events from <start_pos> limit 3,1;
+show binlog events from <binlog_start> limit 3,1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
+master-bin.000001 # Xid # # COMMIT /* XID */
DROP TABLE test.t1, test.t2;
SHOW TABLES;
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..49d068d5fe4 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
@@ -68,45 +68,7 @@ CHANGE MASTER TO
master_log_file = 'master-bin.000001',
master_log_pos = <the_pos> ;
START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State <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 <Read_Master_Log_Pos>
-Relay_Log_File <Relay_Log_File>
-Relay_Log_Pos <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_Ignore_Table>
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos <Exec_Master_Log_Pos>
-Relay_Log_Space <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 <Seconds_Behind_Master>
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno <Last_IO_Errno>
-Last_IO_Error <Last_IO_Error>
-Last_SQL_Errno 0
-Last_SQL_Error
+Checking that both slave threads are running.
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..04a75bf3479 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
@@ -436,8 +436,7 @@ DELETE FROM t1;
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
COUNT(*) 0
set @@global.slave_exec_mode= default;
-Last_SQL_Error
-
+Checking that both slave threads are running.
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
COUNT(*) 0
**** Test for BUG#37076 ****
@@ -487,8 +486,7 @@ 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.
+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.
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -500,8 +498,7 @@ Comparing tables master:test.t4 and slave:test.t4
[expecting slave to stop]
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.
+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.
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
@@ -509,8 +506,7 @@ START SLAVE;
[expecting slave to stop]
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.
+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.
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..14d3baee1b0 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result
@@ -27,18 +27,17 @@ SELECT * FROM t1 ORDER BY a,b;
a b
**** On Master ****
DROP TABLE t1;
-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: 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 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # 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);
@@ -63,29 +62,28 @@ a b
3 3
**** On Master ****
DROP TABLE t1;
-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: 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 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+master-bin.000001 # Write_rows # # table_id: #
+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 # Table_map # # table_id: # (mysql.ndb_apply_status)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; DROP TABLE t1
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
index 5903cd223ad..c03738bc48b 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
@@ -191,10 +191,11 @@ connection slave;
source include/wait_for_slave_sql_to_stop.inc;
# Replication should have stopped, since max retries were not enough.
-# verify with show slave status
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 19 <Last_Errno> 20 <Last_Error> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 37 <Last_SQL_Errno> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS;
+# verify with show slave status
+# 1205 = ER_LOCK_WAIT_TIMEOUT
+--let $slave_sql_errno= 1205
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
# now set max retries high enough to succeed, and start slave again
set GLOBAL slave_transaction_retries=10;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
index 7b8497d8dab..e63b7c5e8ff 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
@@ -16,9 +16,7 @@ START SLAVE;
--connection slave
CREATE TABLE t1 (a int key, b int) ENGINE=ndb;
#CREATE TABLE t2 (a int key, b int) ENGINE=ndb;
---save_master_pos
---connection master
---sync_with_master
+sync_slave_with_master master;
# now we should have a table on the master as well
SHOW TABLES;
@@ -30,25 +28,19 @@ INSERT INTO t1 VALUES (2,3);
# ensure data has propagated both ways
--connection slave
---save_master_pos
---connection master
---sync_with_master
+sync_slave_with_master master;
--sync_slave_with_master
# connect to slave and ensure data it there.
--connection slave
SELECT * FROM t1 ORDER BY a;
#SELECT * FROM t2 ORDER BY a;
-# BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical show slave status;
+source include/check_slave_is_running.inc;
# connect to master and ensure data it there.
--connection master
SELECT * FROM t1 ORDER BY a;
#SELECT * FROM t2 ORDER BY a;
-# BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical show slave status;
+source include/check_slave_is_running.inc;
# stop replication on "master" as not to replicate
# shutdown circularly, eg drop table
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
index eb04dc2e260..8b0f869c1a3 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
@@ -38,9 +38,7 @@ eval CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=$SLAVE_MYPORT,MASTER_U
START SLAVE;
connection slave;
-save_master_pos;
-connection master;
-sync_with_master;
+sync_slave_with_master master;
# The statement is disabled since it cannot reliably show the same
# info all the time. Use it for debug purposes.
@@ -48,9 +46,7 @@ sync_with_master;
#SHOW BINLOG EVENTS;
# Check that there is no error in replication
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+source include/check_slave_is_running.inc;
# Check that we have the data on the master
SELECT * FROM t1 ORDER BY a;
@@ -75,9 +71,7 @@ sync_with_master;
SELECT * FROM t1 ORDER BY a;
# Check that there is no error in replication
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+source include/check_slave_is_running.inc;
-- connection master
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test
index 3133ad34f0c..99c9df40094 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test
@@ -39,12 +39,9 @@ SELECT * FROM t1 ORDER BY c3;
# check that we have it on the slave
--sync_slave_with_master
---connection slave
SELECT * FROM t1 ORDER BY c3;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
-SHOW SLAVE STATUS;
+source include/check_slave_is_running.inc;
# stop slave and reset position to before the last changes
STOP SLAVE;
@@ -53,9 +50,7 @@ eval CHANGE MASTER TO
master_log_file = '$the_file',
master_log_pos = $the_pos ;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
-SHOW SLAVE STATUS;
+source include/check_slave_no_error.inc;
# start the slave again
# -> same events should have been applied again
@@ -67,7 +62,6 @@ START SLAVE;
--connection master
SELECT * FROM t1 ORDER BY c3;
--sync_slave_with_master
---connection slave
SELECT * FROM t1 ORDER BY c3;
STOP SLAVE;
@@ -106,9 +100,7 @@ COMMIT;
--sync_slave_with_master
--connection slave
SELECT * FROM t1;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 34 <Last_IO_Errno> 35 <Last_IO_Error>
-SHOW SLAVE STATUS;
+source include/check_slave_is_running.inc;
connection master;
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test
index 14b76722fa6..22ccabe3745 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test
@@ -415,6 +415,29 @@ ROLLBACK;
SET AUTOCOMMIT = 1;
+--echo ---- Mixed statements Innodb ----
+
+BEGIN;
+INSERT INTO tndb VALUES (147);
+INSERT INTO tinnodb SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+COMMIT;
+
+INSERT INTO tndb VALUES (148);
+BEGIN;
+INSERT INTO tinnodb SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+INSERT INTO tndb VALUES (149);
+COMMIT;
+
+BEGIN;
+INSERT INTO tndb VALUES (150);
+INSERT INTO tmyisam SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+COMMIT;
+
+INSERT INTO tndb VALUES (151);
+BEGIN;
+INSERT INTO tmyisam SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+INSERT INTO tndb VALUES (152);
+COMMIT;
--echo ==== Verify the result ====
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..7d7cd5770cf
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test
@@ -0,0 +1,349 @@
+# ==== 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 ----
+
+BEGIN;
+INSERT INTO myisam_innodb VALUES (13);
+INSERT INTO myisam_innodb VALUES (14);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+BEGIN;
+INSERT INTO innodb_myisam VALUES (15);
+INSERT INTO innodb_myisam VALUES (16);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+
+BEGIN;
+INSERT INTO myisam_ndb VALUES (17);
+INSERT INTO myisam_ndb VALUES (18);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+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 ----
+
+BEGIN;
+INSERT INTO myisam_innodb VALUES (37);
+INSERT INTO myisam_innodb VALUES (38);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+BEGIN;
+INSERT INTO innodb_myisam VALUES (39);
+INSERT INTO innodb_myisam VALUES (40);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+
+BEGIN;
+INSERT INTO myisam_ndb VALUES (41);
+INSERT INTO myisam_ndb VALUES (42);
+ROLLBACK;
+sync_slave_with_master;
+connection master;
+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;
+
+# 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;
+
+
+--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/rpl_ndb/t/rpl_ndb_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
index eb128cfa2ce..e9107fd90bd 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
@@ -39,7 +39,7 @@ let $the_file= `SELECT @the_file` ;
# now connect the slave to the _other_ "master"
connection slave;
---replace_result $MASTER_MYPORT1 <MASTER_PORT1>
+--replace_result $MASTER_MYPORT1 <MASTER_PORT1> $the_pos MASTER_LOG_POS $the_file MASTER_LOG_FILE
eval CHANGE MASTER TO
master_port=$MASTER_MYPORT1,
master_log_file = '$the_file',
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test
index bf7f1eed7b2..7c65e04717a 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test
@@ -27,9 +27,11 @@
--disable_query_log
--source include/have_ndb.inc
--source include/have_innodb.inc
---source include/have_binlog_format_statement.inc
--source include/ndb_master-slave.inc
--enable_query_log
+
+# statement format is supported because master uses innodb
+SET binlog_format = STATEMENT;
let $off_set = 6;
let $rpl_format = 'SBR';
--source extra/rpl_tests/rpl_ndb_apply_status.test
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
index 88572c3e9a2..b91ff198c51 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
@@ -70,10 +70,7 @@ START SLAVE;
#
--connection master
--sync_slave_with_master
---connection slave
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
-query_vertical SHOW SLAVE STATUS;
+--source include/check_slave_is_running.inc
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
@@ -85,7 +82,6 @@ SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
--connection master
DROP DATABASE ndbsynctest;
--sync_slave_with_master
---connection slave
STOP SLAVE;
#
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test
index f8933b3744d..898bf310dc5 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test
@@ -39,10 +39,7 @@ SELECT * FROM t1 ORDER BY a,b;
--echo **** On Master ****
connection master;
DROP TABLE t1;
-let SERVER_VERSION=`select version()`;
---replace_regex /\/\* xid=[0-9]+ \*\//\/* xid= *\// /table_id: [0-9]+/table_id: #/
---replace_result $SERVER_VERSION SERVER_VERSION
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
--echo **** On Master ****
connection master;
@@ -64,8 +61,6 @@ SELECT * FROM t1 ORDER BY a,b;
--echo **** On Master ****
connection master;
DROP TABLE t1;
---replace_regex /table_id: [0-9]+/table_id: #/
---replace_result $SERVER_VERSION SERVER_VERSION
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
-- source include/master-slave-end.inc
diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_func.result b/mysql-test/suite/sys_vars/r/slow_query_log_func.result
index eb7efe4a004..fb650399597 100644
--- a/mysql-test/suite/sys_vars/r/slow_query_log_func.result
+++ b/mysql-test/suite/sys_vars/r/slow_query_log_func.result
@@ -36,5 +36,78 @@ SELECT count(*) > 0 FROM mysql.slow_log;
count(*) > 0
1
DROP PROCEDURE p_test;
+Bug53191 Lock_time in slow log is negative when logging stored routines
+TRUNCATE mysql.slow_log;
+CREATE TABLE t1 (c0 INT PRIMARY KEY AUTO_INCREMENT, c1 TIMESTAMP, c2 TIMESTAMP);
+CREATE FUNCTION f_slow_now() RETURNS TIMESTAMP
+BEGIN
+DO SLEEP(2);
+RETURN NOW();
+END//
+CREATE FUNCTION f_slow_current_time() RETURNS TIME
+BEGIN
+DO SLEEP(2);
+RETURN CURRENT_TIME();
+END
+//
+INSERT INTO t1 (c1,c2) VALUES (now(), f_slow_now())//
+CREATE TRIGGER tf_before BEFORE INSERT ON t1
+FOR EACH ROW BEGIN
+SET new.c2 = f_slow_now();
+END//
+CREATE PROCEDURE p1()
+BEGIN
+INSERT INTO t1 (c1,c2) values (now(),now());
+DO SLEEP(2);
+INSERT INTO t1 (c1,c2) values (now(),now());
+end//
+INSERT INTO t1 (c1,c2) VALUES (now(), now());
+CALL p1();
+SELECT c1-c2 FROM t1;
+c1-c2
+0
+0
+0
+0
+*** There shouldn't less than 1 s difference between each row
+SELECT t1.c1-self.c1 > 1 FROM t1, t1 as self WHERE t1.c0=self.c0+1 ORDER BY t1.c0;
+t1.c1-self.c1 > 1
+1
+1
+1
+DROP TRIGGER tf_before;
+DROP FUNCTION f_slow_now;
+DROP FUNCTION f_slow_current_time;
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
+DROP PROCEDURE IF EXISTS p1;
+CREATE PROCEDURE p1()
+BEGIN
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) FROM t1 WHERE c1= 1;
+UPDATE t1 SET c1=c1*2;
+END|
+Connection 2
+LOCK TABLE t1 WRITE;
+Back to default connection
+CALL p1();
+Wait three seconds and unlock the table
+UNLOCK TABLES;
+COUNT(*)
+1
+Slow log:
+**** 1 == we have slow log entries
+SELECT count(*) > 0 FROM mysql.slow_log;
+count(*) > 0
+1
+**** 0 == None of the entries have a lock time greater than 10 s
+SELECT count(*) FROM mysql.slow_log WHERE lock_time > 10;
+count(*)
+0
+DROP TABLE t1;
+DROP PROCEDURE p1;
SET @@global.log_output = @global_log_output;
SET @global.slow_query_log = @global_slow_query_log;
diff --git a/mysql-test/suite/sys_vars/r/tx_isolation_func.result b/mysql-test/suite/sys_vars/r/tx_isolation_func.result
index 2242525f14b..6b4c990c71c 100644
--- a/mysql-test/suite/sys_vars/r/tx_isolation_func.result
+++ b/mysql-test/suite/sys_vars/r/tx_isolation_func.result
@@ -95,10 +95,7 @@ a b
22 10
24 10
INSERT INTO t1 VALUES(23, 23);
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES(25, 25);
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-Bug: Only even rows are being locked, error 1205 should'nt have occured
SELECT * FROM t1;
a b
2 10
@@ -109,7 +106,9 @@ a b
18 10
20 10
22 10
+23 23
24 10
+25 25
COMMIT;
** Connection con0 **
COMMIT;
@@ -144,7 +143,9 @@ a b
18 10
20 10
22 10
+23 23
24 10
+25 25
INSERT INTO t1 VALUES(5, 5);
INSERT INTO t1 VALUES(7, 7);
SELECT * FROM t1;
@@ -159,7 +160,9 @@ a b
18 10
20 10
22 10
+23 23
24 10
+25 25
COMMIT;
** Connection con0 **
COMMIT;
@@ -196,7 +199,9 @@ a b
18 11
20 11
22 11
+23 23
24 11
+25 25
INSERT INTO t1 VALUES(9, 9);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES(13, 13);
@@ -214,7 +219,9 @@ a b
18 11
20 11
22 11
+23 23
24 11
+25 25
COMMIT;
** Connection con0 **
COMMIT;
@@ -225,6 +232,8 @@ SELECT * FROM t1 WHERE a IN (2,4,6,8,10,12,14,16,18,20,22,24,26) = 0 FOR UPDATE;
a b
5 5
7 7
+23 23
+25 25
UPDATE t1 SET b = 13 WHERE a IN (2,4,6,8,10,12,14,16,18,20,22,24,26) = 0;
** Connection con1 **
START TRANSACTION;
@@ -240,7 +249,9 @@ a b
18 12
20 12
22 12
+23 23
24 12
+25 25
INSERT INTO t1 VALUES(9, 9);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES(13, 13);
@@ -258,7 +269,9 @@ a b
18 12
20 12
22 12
+23 23
24 12
+25 25
COMMIT;
** Connection con0 **
COMMIT;
@@ -273,7 +286,9 @@ a b
18 12
20 12
22 12
+23 13
24 12
+25 13
UPDATE t1 SET b = 14 WHERE a IN (2,4,6,8) = 0;
** Connection con1 **
START TRANSACTION;
@@ -289,7 +304,9 @@ a b
18 12
20 12
22 12
+23 13
24 12
+25 13
INSERT INTO t1 VALUES(9, 9);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES(13, 13);
@@ -307,7 +324,9 @@ a b
18 12
20 12
22 12
+23 13
24 12
+25 13
COMMIT;
** Connection con0 **
COMMIT;
diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_func.test
index 250d5210c46..dd202ec20ff 100644
--- a/mysql-test/suite/sys_vars/t/slow_query_log_func.test
+++ b/mysql-test/suite/sys_vars/t/slow_query_log_func.test
@@ -51,8 +51,93 @@ CALL p_test();
SELECT count(*) > 0 FROM mysql.slow_log;
DROP PROCEDURE p_test;
+#==============================================================================
+--echo Bug53191 Lock_time in slow log is negative when logging stored routines
+#==============================================================================
+TRUNCATE mysql.slow_log;
+connect (con2,localhost,root,,);
+connection default;
+
+CREATE TABLE t1 (c0 INT PRIMARY KEY AUTO_INCREMENT, c1 TIMESTAMP, c2 TIMESTAMP);
+delimiter //;
+CREATE FUNCTION f_slow_now() RETURNS TIMESTAMP
+BEGIN
+ DO SLEEP(2);
+ RETURN NOW();
+END//
+
+CREATE FUNCTION f_slow_current_time() RETURNS TIME
+BEGIN
+ DO SLEEP(2);
+ RETURN CURRENT_TIME();
+END
+//
+
+INSERT INTO t1 (c1,c2) VALUES (now(), f_slow_now())//
+
+CREATE TRIGGER tf_before BEFORE INSERT ON t1
+FOR EACH ROW BEGIN
+ SET new.c2 = f_slow_now();
+END//
+
+CREATE PROCEDURE p1()
+BEGIN
+ INSERT INTO t1 (c1,c2) values (now(),now());
+ DO SLEEP(2);
+ INSERT INTO t1 (c1,c2) values (now(),now());
+end//
+
+delimiter ;//
+
+INSERT INTO t1 (c1,c2) VALUES (now(), now());
+CALL p1();
+
+SELECT c1-c2 FROM t1;
+--echo *** There shouldn't less than 1 s difference between each row
+SELECT t1.c1-self.c1 > 1 FROM t1, t1 as self WHERE t1.c0=self.c0+1 ORDER BY t1.c0;
+
+DROP TRIGGER tf_before;
+DROP FUNCTION f_slow_now;
+DROP FUNCTION f_slow_current_time;
+DROP TABLE t1;
+
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
+DROP PROCEDURE IF EXISTS p1;
+delimiter |;
+CREATE PROCEDURE p1()
+BEGIN
+ INSERT INTO t1 VALUES (1);
+ SELECT COUNT(*) FROM t1 WHERE c1= 1;
+ UPDATE t1 SET c1=c1*2;
+END|
+delimiter ;|
+
+--echo Connection 2
+connection con2;
+LOCK TABLE t1 WRITE;
+
+--echo Back to default connection
+connection default;
+send CALL p1();
+
+--echo Wait three seconds and unlock the table
+connection con2;
+sleep 3;
+UNLOCK TABLES;
+connection default;
+reap;
+--echo Slow log:
+--echo **** 1 == we have slow log entries
+SELECT count(*) > 0 FROM mysql.slow_log;
+--echo **** 0 == None of the entries have a lock time greater than 10 s
+SELECT count(*) FROM mysql.slow_log WHERE lock_time > 10;
+disconnect con2;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+
-#restore
+#================================================================== Restore
SET @@global.log_output = @global_log_output;
SET @global.slow_query_log = @global_slow_query_log;
diff --git a/mysql-test/suite/sys_vars/t/tx_isolation_func.test b/mysql-test/suite/sys_vars/t/tx_isolation_func.test
index 1fd2e323db8..7072de6b086 100644
--- a/mysql-test/suite/sys_vars/t/tx_isolation_func.test
+++ b/mysql-test/suite/sys_vars/t/tx_isolation_func.test
@@ -134,12 +134,9 @@ START TRANSACTION;
SELECT * FROM t1;
---error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES(23, 23);
---error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 VALUES(25, 25);
---echo Bug: Only even rows are being locked, error 1205 should'nt have occured
SELECT * FROM t1;
diff --git a/mysql-test/t/alter_table-big.test b/mysql-test/t/alter_table-big.test
index 1dcc1f1c9bd..e007a3a55e0 100644
--- a/mysql-test/t/alter_table-big.test
+++ b/mysql-test/t/alter_table-big.test
@@ -31,7 +31,9 @@ create table t2 (i int);
# statement execution, so we don't need many rows in 't1' to make
# this test repeatable.
alter table t1 disable keys;
+--disable_warnings
insert into t1 values (RAND()*1000, RAND()*1000, RAND()*1000);
+--enable_warnings
# Later we use binlog to check the order in which statements are
# executed so let us reset it first.
@@ -50,8 +52,7 @@ connection default;
--reap
set session debug="-d,sleep_alter_enable_indexes";
# Check that statements were executed/binlogged in correct order.
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
# Clean up
drop tables t1, t2;
@@ -111,8 +112,7 @@ drop table t3;
set session debug="-d,sleep_alter_before_main_binlog";
# Check that all statements were logged in correct order
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
--echo End of 5.1 tests
diff --git a/mysql-test/t/bug39022.test b/mysql-test/t/bug39022.test
index 268b207e0e5..6056dbf0e7b 100644
--- a/mysql-test/t/bug39022.test
+++ b/mysql-test/t/bug39022.test
@@ -24,7 +24,7 @@ START TRANSACTION;
connection thread2;
--echo # in thread2
REPLACE INTO t2 VALUES (-17);
-SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d);
+SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
connection thread1;
--echo # in thread1
@@ -37,14 +37,14 @@ START TRANSACTION;
REPLACE INTO t1(a,b) VALUES (65,-50);
REPLACE INTO t2 VALUES (-91);
send;
-SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); #waits
+SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; #waits
connection thread1;
--echo # in thread1
--echo # should not crash
--error ER_LOCK_DEADLOCK
-SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); #crashes
+SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; #crashes
connection thread2;
--echo # in thread2
diff --git a/mysql-test/t/create-big.test b/mysql-test/t/create-big.test
index 6cd6326cdb8..e1dfbbd4ac4 100644
--- a/mysql-test/t/create-big.test
+++ b/mysql-test/t/create-big.test
@@ -305,8 +305,7 @@ connection default;
show create table t2;
drop table t2;
# Let us check that statements were executed/binlogged in correct order
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
# Now let us check the gap between check for target table
# existance and copying of .frm file.
@@ -330,8 +329,7 @@ drop table t1;
connection default;
--reap
drop table t2;
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
# And now he gap between copying of .frm file and ha_create_table() call.
create table t1 (i int);
@@ -359,8 +357,7 @@ drop table t1;
connection default;
--reap
drop table t2;
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
# Finally we check the gap between ha_create_table() and binlogging
create table t1 (i int);
@@ -386,7 +383,6 @@ drop table t1;
connection default;
--reap
drop table t2;
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
set session debug="-d,sleep_create_like_before_binlogging";
diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test
index 89df33a6df5..f3038ccfa61 100644
--- a/mysql-test/t/ctype_cp932_binlog_stm.test
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
@@ -7,6 +7,7 @@
#
# Bug#18293: Values in stored procedure written to binlog unescaped
#
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
delimiter |;
CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
@@ -22,7 +23,7 @@ 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|
+source include/show_binlog_events.inc|
delimiter ;|
--echo End of 5.0 tests
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 7bbc470137a..5a0e86568f3 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -374,5 +374,17 @@ DELETE IGNORE FROM t1;
DROP TABLE t1;
+--echo #
+--echo # Bug #53450: Crash/assertion
+--echo # "virtual int ha_myisam::index_first(uchar*)") at assert.c:81
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, c INT,
+ INDEX(a), INDEX(b), INDEX(c));
+INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9);
+
+DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
+
+DROP TABLE t1;
--echo End of 5.1 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index c1a22adf091..cede26f555a 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -11,5 +11,6 @@
##############################################################################
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
-# partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings
-# ps_3innodb : Bug#53309 2010-04-30 VasilDimov valgrind warnings
+partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings
+main.mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst
+main.mysqlhotcopy_archive: bug#54129 2010-06-04 Horst
diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test
index 7cd16a6bc5a..f6edacfaa29 100644
--- a/mysql-test/t/error_simulation.test
+++ b/mysql-test/t/error_simulation.test
@@ -45,6 +45,49 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
+--echo #
+--echo # Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string
+--echo #
+
+CREATE TABLE t1(a BLOB);
+
+SET SESSION debug="+d,bug42064_simulate_oom";
+# May fail with either ER_OUT_OF_RESOURCES or EE_OUTOFMEMORY
+--error ER_OUT_OF_RESOURCES, 5
+INSERT INTO t1 VALUES("");
+SET SESSION debug=DEFAULT;
+
+DROP TABLE t1;
+
+-- echo #
+-- echo # Bug#41660: Sort-index_merge for non-first join table may require
+-- echo # O(#scans) memory
+-- echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+
+CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b));
+INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C;
+INSERT INTO t2 VALUES (1, 1, 'data');
+
+--echo # the example query uses LEFT JOIN only for the sake of being able to
+--echo # demonstrate the issue with a very small dataset. (left outer join
+--echo # disables the use of join buffering, so we get the second table
+--echo # re-scanned for every record in the outer table. if we used inner join,
+--echo # we would need to have thousands of records and/or more columns in both
+--echo # tables so that the join buffer is filled and re-scans are triggered).
+
+SET SESSION debug = '+d,only_one_Unique_may_be_created';
+
+--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+
+SET SESSION debug = DEFAULT;
+
+DROP TABLE t1, t2;
--echo #
--echo # End of 5.1 tests
diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test
index 041a2def490..5f16f8bea6a 100644
--- a/mysql-test/t/events_scheduling.test
+++ b/mysql-test/t/events_scheduling.test
@@ -108,6 +108,32 @@ DROP TABLE table_1;
DROP TABLE table_2;
DROP TABLE table_3;
DROP TABLE table_4;
+
+-- echo
+-- echo Bug #50087 Interval arithmetic for Event_queue_element is not portable.
+-- echo
+
+CREATE TABLE t1(a int);
+
+CREATE EVENT e1 ON SCHEDULE EVERY 1 MONTH
+STARTS NOW() - INTERVAL 1 MONTH
+ENDS NOW() + INTERVAL 2 MONTH
+ON COMPLETION PRESERVE
+DO
+ INSERT INTO t1 VALUES (1);
+
+CREATE EVENT e2 ON SCHEDULE EVERY 1 MONTH
+STARTS NOW()
+ENDS NOW() + INTERVAL 11 MONTH
+ON COMPLETION PRESERVE
+DO
+ INSERT INTO t1 VALUES (1);
+
+DROP TABLE t1;
+DROP EVENT e1;
+DROP EVENT e2;
+
+
DROP DATABASE events_test;
SET GLOBAL event_scheduler=@event_scheduler;
diff --git a/mysql-test/t/events_time_zone.test b/mysql-test/t/events_time_zone.test
index 17260eb0038..cb2fbab29c6 100644
--- a/mysql-test/t/events_time_zone.test
+++ b/mysql-test/t/events_time_zone.test
@@ -174,13 +174,13 @@ CREATE EVENT e2 ON SCHEDULE EVERY @step SECOND
# We want to start at the beginning of the DST cycle, so we wait
# untill current time divides by @step6.
-let $wait_timeout= `SELECT @step6 + 1`;
+let $wait_timeout= `SELECT @step6*2 + 1`;
let $wait_condition= SELECT UNIX_TIMESTAMP() % @step6 = @step6 - 1;
--source include/wait_condition.inc
# The second wait is needed because after the first wait we may end up
# on the ending edge of a second. Second wait will bring us to the
# beginning edge.
-let $wait_timeout= `SELECT @step + 1`;
+let $wait_timeout= `SELECT @step*2 + 1`;
let $wait_condition= SELECT UNIX_TIMESTAMP() % @step6 = 0;
--source include/wait_condition.inc
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index ba6be72dbdc..b635a1b2968 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -213,4 +213,19 @@ EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND
DROP TABLE t1, t2;
+--echo #
+--echo # Bug #48573: difference of index selection between rpm binary and
+--echo # .tar.gz, windows vs linux..
+--echo #
+
+CREATE TABLE t1(c1 INT, c2 INT, c4 INT, c5 INT, KEY(c2, c5), KEY(c2, c4, c5));
+INSERT INTO t1 VALUES(4, 1, 1, 1);
+INSERT INTO t1 VALUES(3, 1, 1, 1);
+INSERT INTO t1 VALUES(2, 1, 1, 1);
+INSERT INTO t1 VALUES(1, 1, 1, 1);
+
+EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1;
+
+DROP TABLE t1;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/flush_block_commit_notembedded.test b/mysql-test/t/flush_block_commit_notembedded.test
index aea38250218..b774d7ec069 100644
--- a/mysql-test/t/flush_block_commit_notembedded.test
+++ b/mysql-test/t/flush_block_commit_notembedded.test
@@ -28,14 +28,14 @@ INSERT t1 VALUES (1);
--echo # Switch to connection con2
connection con2;
FLUSH TABLES WITH READ LOCK;
-SHOW MASTER STATUS;
+--source include/show_binlog_events.inc
--echo # Switch to connection con1
connection con1;
send COMMIT;
--echo # Switch to connection con2
connection con2;
sleep 1;
-SHOW MASTER STATUS;
+--source include/show_binlog_events.inc
UNLOCK TABLES;
--echo # Switch to connection con1
connection con1;
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 61ae812d874..6efeb2866e6 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -540,5 +540,20 @@ EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL);
DROP TABLE t1;
--echo #
+--echo # Bug#54477: Crash on IN / CASE with NULL arguments
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+
+SELECT 1 IN (NULL, a) FROM t1;
+
+SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP;
+
+SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP;
+
+DROP TABLE t1;
+
+--echo #
--echo End of 5.1 tests
diff --git a/mysql-test/t/func_isnull.test b/mysql-test/t/func_isnull.test
index 6218efb882f..d3ad4614998 100644
--- a/mysql-test/t/func_isnull.test
+++ b/mysql-test/t/func_isnull.test
@@ -13,3 +13,18 @@ select * from t1 where isnull(to_days(mydate));
drop table t1;
# End of 4.1 tests
+
+--echo #
+--echo # Bug#53933 crash when using uncacheable subquery in the having clause of outer query
+--echo #
+
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (0),(0);
+
+SELECT ISNULL((SELECT GET_LOCK('Bug#53933', 0) FROM t1 GROUP BY f1)) AS f2
+FROM t1 GROUP BY f1 HAVING f2 = f2;
+SELECT RELEASE_LOCK('Bug#53933');
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
index 741ea5533da..1204d04d9a0 100644
--- a/mysql-test/t/func_like.test
+++ b/mysql-test/t/func_like.test
@@ -112,5 +112,19 @@ select 'andre%' like 'andreÊ%' escape 'Ê';
#
select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê';
-#
-# End of 4.1 tests
+
+--echo End of 4.1 tests
+
+
+--echo #
+--echo # Bug #54575: crash when joining tables with unique set column
+--echo #
+CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a));
+CREATE TABLE t2(b INT PRIMARY KEY);
+INSERT INTO t1 VALUES ();
+INSERT INTO t2 VALUES (1), (2), (3);
+SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a;
+DROP TABLE t1, t2;
+
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index e6ea5ecc7f6..c5b27ee1a62 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1205,6 +1205,21 @@ SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT( b)
DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#52051: Aggregate functions incorrectly returns NULL from outer
+--echo # join query
+--echo #
+CREATE TABLE t1 (a INT PRIMARY KEY);
+CREATE TABLE t2 (a INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1), (2);
+EXPLAIN SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+EXPLAIN SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+DROP TABLE t1, t2;
+
+
--echo #
--echo # End of 5.1 tests
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index b06f0c09fc5..8ab7e1c9cb4 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -1085,4 +1085,19 @@ INSERT INTO t1 VALUES (1), (2), (3);
--source include/min_null_cond.inc
DROP TABLE t1;
+--echo #
+--echo # Bug#53859: Valgrind: opt_sum_query(TABLE_LIST*, List<Item>&, Item*) at
+--echo # opt_sum.cc:305
+--echo #
+CREATE TABLE t1 ( a INT, KEY (a) );
+INSERT INTO t1 VALUES (1), (2), (3);
+
+SELECT MIN( a ) AS min_a
+FROM t1
+WHERE a > 1 AND a IS NULL
+ORDER BY min_a;
+
+DROP TABLE t1;
+
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/handler_myisam.test b/mysql-test/t/handler_myisam.test
index 868ba14480a..e78072ef8a0 100644
--- a/mysql-test/t/handler_myisam.test
+++ b/mysql-test/t/handler_myisam.test
@@ -48,4 +48,53 @@ HANDLER t1 READ a NEXT;
HANDLER t1 CLOSE;
DROP TABLE t1;
+
+--echo #
+--echo # Bug #54007: assert in ha_myisam::index_next , HANDLER
+--echo #
+CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a), KEY b(b), KEY ab(a, b));
+
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+HANDLER t1 READ `PRIMARY` NEXT;
+HANDLER t1 READ ab NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 CLOSE;
+
+INSERT INTO t1 VALUES (2, 20), (1, 10), (4, 40), (3, 30);
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ `PRIMARY` NEXT;
+HANDLER t1 READ `PRIMARY` NEXT;
+HANDLER t1 READ ab NEXT;
+HANDLER t1 READ ab NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 CLOSE;
+
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+HANDLER t1 READ `PRIMARY` PREV;
+HANDLER t1 READ `PRIMARY` PREV;
+HANDLER t1 READ b PREV;
+HANDLER t1 READ b PREV;
+HANDLER t1 CLOSE;
+
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+HANDLER t1 READ `PRIMARY` PREV LIMIT 3;
+HANDLER t1 READ b NEXT LIMIT 5;
+HANDLER t1 CLOSE;
+
+DROP TABLE t1;
+
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 10bc3645898..4cef8615cd2 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1413,6 +1413,15 @@ DROP USER nonpriv;
DROP TABLE db1.t1;
DROP DATABASE db1;
+--echo
+--echo Bug#54422 query with = 'variables'
+--echo
+
+CREATE TABLE variables(f1 INT);
+SELECT COLUMN_DEFAULT, TABLE_NAME
+FROM INFORMATION_SCHEMA.COLUMNS
+WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables';
+DROP TABLE variables;
--echo End of 5.1 tests.
diff --git a/mysql-test/t/innodb-index.test b/mysql-test/t/innodb-index.test
deleted file mode 100644
index 38e5036b8be..00000000000
--- a/mysql-test/t/innodb-index.test
+++ /dev/null
@@ -1,550 +0,0 @@
--- source include/have_innodb.inc
-
-let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
-
-create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
-insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak');
-commit;
---error ER_DUP_KEYNAME
-alter table t1 add index b (b), add index b (b);
---error ER_DUP_FIELDNAME
-alter table t1 add index (b,b);
-alter table t1 add index d2 (d);
-show create table t1;
-explain select * from t1 force index(d2) order by d;
-select * from t1 force index (d2) order by d;
---error ER_DUP_ENTRY
-alter table t1 add unique index (b);
-show create table t1;
-alter table t1 add index (b);
-show create table t1;
-
-# Check how existing tables interfere with temporary tables.
-CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB;
-
-call mtr.add_suppression(" table `test`\\.`t1#[12]` already exists in InnoDB internal");
-
---error 156
-alter table t1 add unique index (c), add index (d);
-rename table `t1#1` to `t1#2`;
---error 156
-alter table t1 add unique index (c), add index (d);
-drop table `t1#2`;
-
-alter table t1 add unique index (c), add index (d);
-show create table t1;
-explain select * from t1 force index(c) order by c;
-alter table t1 add primary key (a), drop index c;
-show create table t1;
---error ER_MULTIPLE_PRI_KEY
-alter table t1 add primary key (c);
---error ER_DUP_ENTRY
-alter table t1 drop primary key, add primary key (b);
-create unique index c on t1 (c);
-show create table t1;
-explain select * from t1 force index(c) order by c;
-select * from t1 force index(c) order by c;
-alter table t1 drop index b, add index (b);
-show create table t1;
-insert into t1 values(6,1,'ggg','ggg');
-select * from t1;
-select * from t1 force index(b) order by b;
-select * from t1 force index(c) order by c;
-select * from t1 force index(d) order by d;
-explain select * from t1 force index(b) order by b;
-explain select * from t1 force index(c) order by c;
-explain select * from t1 force index(d) order by d;
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add index (c(2));
-show create table t1;
-alter table t1 add unique index (d(10));
-show create table t1;
-insert into t1 values(5,1,'ggg','ggg');
-select * from t1;
-select * from t1 force index(c) order by c;
-select * from t1 force index(d) order by d;
-explain select * from t1 order by b;
-explain select * from t1 force index(c) order by c;
-explain select * from t1 force index(d) order by d;
-show create table t1;
-alter table t1 drop index d;
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-select * from t1 force index(c) order by c;
-explain select * from t1 order by b;
-explain select * from t1 force index(c) order by c;
-explain select * from t1 order by d;
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add unique index (b,c);
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-select * from t1 force index(b) order by b;
-explain select * from t1 force index(b) order by b;
-show create table t1;
-alter table t1 add index (b,c);
-insert into t1 values(11,11,'kkk','kkk');
-select * from t1;
-select * from t1 force index(b) order by b;
-explain select * from t1 force index(b) order by b;
-show create table t1;
-alter table t1 add unique index (c,d);
-insert into t1 values(13,13,'yyy','aaa');
-select * from t1;
-select * from t1 force index(b) order by b;
-select * from t1 force index(c) order by c;
-explain select * from t1 force index(b) order by b;
-explain select * from t1 force index(c) order by c;
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int not null, c int, primary key (a), key (b)) engine = innodb;
-create table t3(a int not null, c int not null, d int, primary key (a), key (c)) engine = innodb;
-create table t4(a int not null, d int not null, e int, primary key (a), key (d)) engine = innodb;
-create table t2(a int not null, b int not null, c int not null, d int not null, e int,
-foreign key (b) references t1(b) on delete cascade,
-foreign key (c) references t3(c), foreign key (d) references t4(d))
-engine = innodb;
---error ER_DROP_INDEX_FK
-alter table t1 drop index b;
---error ER_DROP_INDEX_FK
-alter table t3 drop index c;
---error ER_DROP_INDEX_FK
-alter table t4 drop index d;
---error ER_DROP_INDEX_FK
-alter table t2 drop index b;
---error ER_DROP_INDEX_FK
-alter table t2 drop index b, drop index c, drop index d;
-# Apparently, the following makes mysql_alter_table() drop index d.
-create unique index dc on t2 (d,c);
-create index dc on t1 (b,c);
-# This should preserve the foreign key constraints.
-alter table t2 add primary key (a);
-insert into t1 values (1,1,1);
-insert into t3 values (1,1,1);
-insert into t4 values (1,1,1);
-insert into t2 values (1,1,1,1,1);
-commit;
-alter table t4 add constraint dc foreign key (a) references t1(a);
-show create table t4;
---replace_regex /'test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
-# a foreign key 'test/dc' already exists
---error ER_CANT_CREATE_TABLE
-alter table t3 add constraint dc foreign key (a) references t1(a);
-show create table t3;
-alter table t2 drop index b, add index (b);
-show create table t2;
---error ER_ROW_IS_REFERENCED_2
-delete from t1;
---error ER_CANT_DROP_FIELD_OR_KEY
-drop index dc on t4;
-# there is no foreign key dc on t3
-# Embedded server doesn't chdir to data directory
---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
---replace_regex /\/test\/#sql2-[0-9a-f-]*'/\/#sql2-temporary'/
---error ER_ERROR_ON_RENAME
-alter table t3 drop foreign key dc;
-alter table t4 drop foreign key dc;
-select * from t2;
-delete from t1;
-select * from t2;
-
-drop table t2,t4,t3,t1;
-
--- let charset = utf8
--- source include/innodb-index.inc
-
-create table t1(a int not null, b int) engine = innodb;
-insert into t1 values (1,1),(1,1),(1,1),(1,1);
---error ER_DUP_ENTRY
-alter table t1 add unique index (a);
---error ER_DUP_ENTRY
-alter table t1 add unique index (b);
---error ER_DUP_ENTRY
-alter table t1 add unique index (a), add unique index(b);
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, c int not null,b int, primary key(a), unique key(c), key(b)) engine = innodb;
-alter table t1 drop index c, drop index b;
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int, primary key(a)) engine = innodb;
-alter table t1 add index (b);
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
---error ER_DUP_ENTRY
-alter table t1 add unique index (b), add unique index (c), add unique index (d);
---error ER_DUP_ENTRY
-alter table t1 add unique index (c), add unique index (b), add index (d);
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb;
-insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1);
-alter table t1 add unique index (b);
-insert into t1 values (10,20,20),(11,19,19),(12,18,18),(13,17,17);
-show create table t1;
-check table t1;
-explain select * from t1 force index(c) order by c;
-explain select * from t1 order by a;
-explain select * from t1 force index(b) order by b;
-select * from t1 order by a;
-select * from t1 force index(b) order by b;
-select * from t1 force index(c) order by c;
-drop table t1;
-
-create table t1(a int not null, b int not null) engine=innodb;
-insert into t1 values (1,1);
-alter table t1 add primary key(b);
-insert into t1 values (2,2);
-show create table t1;
-check table t1;
-select * from t1;
-explain select * from t1;
-explain select * from t1 order by a;
-explain select * from t1 order by b;
-checksum table t1;
-drop table t1;
-
-create table t1(a int not null) engine=innodb;
-insert into t1 values (1);
-alter table t1 add primary key(a);
-insert into t1 values (2);
-show create table t1;
-check table t1;
-commit;
-select * from t1;
-explain select * from t1;
-explain select * from t1 order by a;
-drop table t1;
-
-create table t2(d varchar(17) primary key) engine=innodb default charset=utf8;
-create table t3(a int primary key) engine=innodb;
-
-insert into t3 values(22),(44),(33),(55),(66);
-
-insert into t2 values ('jejdkrun87'),('adfd72nh9k'),
-('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik');
-
-create table t1(a int, b blob, c text, d text not null)
-engine=innodb default charset = utf8;
-
-# r2667 The following test is disabled because MySQL behavior changed.
-# r2667 The test was added with this comment:
-# r2667
-# r2667 ------------------------------------------------------------------------
-# r2667 r1699 | marko | 2007-08-10 19:53:19 +0300 (Fri, 10 Aug 2007) | 5 lines
-# r2667
-# r2667 branches/zip: Add changes that accidentally omitted from r1698:
-# r2667
-# r2667 innodb-index.test, innodb-index.result: Add a test for creating
-# r2667 a PRIMARY KEY on a column that contains a NULL value.
-# r2667 ------------------------------------------------------------------------
-# r2667
-# r2667 but in BZR-r2667:
-# r2667 http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1/revision/davi%40mysql.com-20080617141221-8yre8ys9j4uw3xx5?start_revid=joerg%40mysql.com-20080630105418-7qoe5ehomgrcdb89
-# r2667 MySQL changed the behavior to do full table copy when creating PRIMARY INDEX
-# r2667 on a non-NULL column instead of calling ::add_index() which would fail (and
-# r2667 this is what we were testing here). Before r2667 the code execution path was
-# r2667 like this (when adding PRIMARY INDEX on a non-NULL column with ALTER TABLE):
-# r2667
-# r2667 mysql_alter_table()
-# r2667 compare_tables() // would return ALTER_TABLE_INDEX_CHANGED
-# r2667 ::add_index() // would fail with "primary index cannot contain NULL"
-# r2667
-# r2667 after r2667 the code execution path is the following:
-# r2667
-# r2667 mysql_alter_table()
-# r2667 compare_tables() // returns ALTER_TABLE_DATA_CHANGED
-# r2667 full copy is done, without calling ::add_index()
-# r2667
-# r2667 To enable, remove "# r2667: " below.
-# r2667
-# r2667: insert into t1 values (null,null,null,'null');
-insert into t1
-select a,left(repeat(d,100*a),65535),repeat(d,20*a),d from t2,t3;
-drop table t2, t3;
-select count(*) from t1 where a=44;
-select a,
-length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1;
-# r2667: --error ER_PRIMARY_CANT_HAVE_NULL
-# r2667: alter table t1 add primary key (a), add key (b(20));
-# r2667: delete from t1 where d='null';
---error ER_DUP_ENTRY
-alter table t1 add primary key (a), add key (b(20));
-delete from t1 where a%2;
-check table t1;
-alter table t1 add primary key (a,b(255),c(255)), add key (b(767));
-select count(*) from t1 where a=44;
-select a,
-length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1;
-show create table t1;
-check table t1;
-explain select * from t1 where b like 'adfd%';
-
-#
-# Test locking
-#
-
-create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
-insert into t2 select a,left(b,255) from t1;
-drop table t1;
-rename table t2 to t1;
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-connection a;
-set innodb_lock_wait_timeout=1;
-begin;
-# Obtain an IX lock on the table
-select a from t1 limit 1 for update;
-connection b;
-set innodb_lock_wait_timeout=1;
-# This would require an S lock on the table, conflicting with the IX lock.
---error ER_LOCK_WAIT_TIMEOUT
-create index t1ba on t1 (b,a);
-connection a;
-commit;
-begin;
-# Obtain an IS lock on the table
-select a from t1 limit 1 lock in share mode;
-connection b;
-# This will require an S lock on the table. No conflict with the IS lock.
-create index t1ba on t1 (b,a);
-# This would require an X lock on the table, conflicting with the IS lock.
---error ER_LOCK_WAIT_TIMEOUT
-drop index t1ba on t1;
-connection a;
-commit;
-explain select a from t1 order by b;
---send
-select a,sleep(2+a/100) from t1 order by b limit 3;
-
-# The following DROP INDEX will succeed, altough the SELECT above has
-# opened a read view. However, during the execution of the SELECT,
-# MySQL should hold a table lock that should block the execution
-# of the DROP INDEX below.
-
-connection b;
-select sleep(1);
-drop index t1ba on t1;
-
-# After the index was dropped, subsequent SELECTs will use the same
-# read view, but they should not be accessing the dropped index any more.
-
-connection a;
-reap;
-explain select a from t1 order by b;
-select a from t1 order by b limit 3;
-commit;
-
-connection default;
-disconnect a;
-disconnect b;
-
-drop table t1;
-
-let $per_table=`select @@innodb_file_per_table`;
-let $format=`select @@innodb_file_format`;
-set global innodb_file_per_table=on;
-set global innodb_file_format='Barracuda';
-# Test creating a table that could lead to undo log overflow.
-# In the undo log, we write a 768-byte prefix (REC_MAX_INDEX_COL_LEN)
-# of each externally stored column that appears as a column prefix in an index.
-# For this test case, it would suffice to write 1 byte, though.
-create table t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
- i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob,
- q blob,r blob,s blob,t blob,u blob)
- engine=innodb row_format=dynamic;
-create index t1a on t1 (a(1));
-create index t1b on t1 (b(1));
-create index t1c on t1 (c(1));
-create index t1d on t1 (d(1));
-create index t1e on t1 (e(1));
-create index t1f on t1 (f(1));
-create index t1g on t1 (g(1));
-create index t1h on t1 (h(1));
-create index t1i on t1 (i(1));
-create index t1j on t1 (j(1));
-create index t1k on t1 (k(1));
-create index t1l on t1 (l(1));
-create index t1m on t1 (m(1));
-create index t1n on t1 (n(1));
-create index t1o on t1 (o(1));
-create index t1p on t1 (p(1));
-create index t1q on t1 (q(1));
-create index t1r on t1 (r(1));
-create index t1s on t1 (s(1));
-create index t1t on t1 (t(1));
---error 139
-create index t1u on t1 (u(1));
---error 139
-create index t1ut on t1 (u(1), t(1));
-create index t1st on t1 (s(1), t(1));
-show create table t1;
---error 139
-create index t1u on t1 (u(1));
-alter table t1 row_format=compact;
-create index t1u on t1 (u(1));
-
-drop table t1;
-eval set global innodb_file_per_table=$per_table;
-eval set global innodb_file_format=$format;
-eval set global innodb_file_format_check=$format;
-
-#
-# Test to check whether CREATE INDEX handles implicit foreign key
-# constraint modifications (Issue #70, Bug #38786)
-#
-SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
-SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
-
-CREATE TABLE t1(
- c1 BIGINT(12) NOT NULL,
- PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-CREATE TABLE t2(
- c1 BIGINT(16) NOT NULL,
- c2 BIGINT(12) NOT NULL,
- c3 BIGINT(12) NOT NULL,
- PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3) REFERENCES t1(c1);
-
-SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
-SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-
-SHOW CREATE TABLE t2;
-
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-
-SHOW CREATE TABLE t2;
-
-SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
-SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-
---error ER_NO_REFERENCED_ROW_2
-INSERT INTO t2 VALUES(0,0,0);
-INSERT INTO t1 VALUES(0);
-INSERT INTO t2 VALUES(0,0,0);
-
-DROP TABLE t2;
-
-CREATE TABLE t2(
- c1 BIGINT(16) NOT NULL,
- c2 BIGINT(12) NOT NULL,
- c3 BIGINT(12) NOT NULL,
- PRIMARY KEY (c1,c2,c3)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3) REFERENCES t1(c1);
-
-SHOW CREATE TABLE t2;
-
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-
-SHOW CREATE TABLE t2;
---error ER_NO_REFERENCED_ROW_2
-INSERT INTO t2 VALUES(0,0,1);
-INSERT INTO t2 VALUES(0,0,0);
---error ER_ROW_IS_REFERENCED_2
-DELETE FROM t1;
-DELETE FROM t2;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1(
- c1 BIGINT(12) NOT NULL,
- c2 INT(4) NOT NULL,
- PRIMARY KEY (c2,c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-CREATE TABLE t2(
- c1 BIGINT(16) NOT NULL,
- c2 BIGINT(12) NOT NULL,
- c3 BIGINT(12) NOT NULL,
- PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1);
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
-ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL;
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
-
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-CREATE INDEX i_t2_c2_c1 ON t2(c2, c1);
-SHOW CREATE TABLE t2;
-CREATE INDEX i_t2_c3_c1_c2 ON t2(c3, c1, c2);
-SHOW CREATE TABLE t2;
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-SHOW CREATE TABLE t2;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
-call mtr.add_suppression("InnoDB: insufficient history for index");
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-connection a;
-CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
-connection b;
-BEGIN;
-SELECT * FROM t1;
-connection a;
-CREATE INDEX t1a ON t1(a);
-connection b;
-SELECT * FROM t1;
---error ER_TABLE_DEF_CHANGED
-SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
-SELECT * FROM t1;
-COMMIT;
-SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
-connection default;
-disconnect a;
-disconnect b;
-
-DROP TABLE t1;
-
-#
-# restore environment to the state it was before this test execution
-#
-
--- disable_query_log
-eval SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig;
diff --git a/mysql-test/t/innodb-use-sys-malloc-master.opt b/mysql-test/t/innodb-use-sys-malloc-master.opt
deleted file mode 100644
index fc8582b5887..00000000000
--- a/mysql-test/t/innodb-use-sys-malloc-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb-use-sys-malloc=true
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 19e5180dc8b..2c9f84e823a 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -425,11 +425,13 @@ INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca
select count(*) from t1 where sca_code = 'PD';
select count(*) from t1 where sca_code <= 'PD';
select count(*) from t1 where sca_pic is null;
-alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
+alter table t1 drop index sca_pic;
+alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where cat_code='E';
-alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
+alter table t1 drop index sca_pic;
+alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where sca_pic >= 'n';
select sca_pic from t1 where sca_pic is null;
@@ -1149,7 +1151,7 @@ show create table t2;
create index id2 on t2 (id);
show create table t2;
drop index id2 on t2;
---error ER_DROP_INDEX_FK,ER_DROP_INDEX_FK
+--error ER_DROP_INDEX_FK
drop index id on t2;
show create table t2;
drop table t2;
diff --git a/mysql-test/t/innodb_mysql_lock2.test b/mysql-test/t/innodb_mysql_lock2.test
new file mode 100644
index 00000000000..79698bcd898
--- /dev/null
+++ b/mysql-test/t/innodb_mysql_lock2.test
@@ -0,0 +1,803 @@
+# This test covers behavior for InnoDB tables.
+--source include/have_innodb.inc
+# This test requires statement/mixed mode binary logging.
+# Row-based mode puts weaker serializability requirements
+# so weaker locks are acquired for it.
+--source include/have_binlog_format_mixed_or_statement.inc
+# Save the initial number of concurrent sessions.
+--source include/count_sessions.inc
+
+--echo #
+--echo # Test how do we handle locking in various cases when
+--echo # we read data from InnoDB tables.
+--echo #
+--echo # In fact by performing this test we check two things:
+--echo # 1) That SQL-layer correctly determine type of thr_lock.c
+--echo # lock to be acquired/passed to InnoDB engine.
+--echo # 2) That InnoDB engine correctly interprets this lock
+--echo # type and takes necessary row locks or does not
+--echo # take them if they are not necessary.
+--echo #
+
+--echo # This test makes sense only in REPEATABLE-READ mode as
+--echo # in SERIALIZABLE mode all statements that read data take
+--echo # shared lock on them to enforce its semantics.
+select @@session.tx_isolation;
+
+--echo # Prepare playground by creating tables, views,
+--echo # routines and triggers used in tests.
+connect (con1, localhost, root,,);
+connection default;
+--disable_warnings
+drop table if exists t0, t1, t2, t3, t4, t5, te;
+drop view if exists v1, v2;
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop function if exists f1;
+drop function if exists f2;
+drop function if exists f3;
+drop function if exists f4;
+drop function if exists f5;
+drop function if exists f6;
+drop function if exists f7;
+drop function if exists f8;
+drop function if exists f9;
+drop function if exists f10;
+drop function if exists f11;
+drop function if exists f12;
+drop function if exists f13;
+drop function if exists f14;
+drop function if exists f15;
+--enable_warnings
+create table t1 (i int primary key) engine=innodb;
+insert into t1 values (1), (2), (3), (4), (5);
+create table t2 (j int primary key) engine=innodb;
+insert into t2 values (1), (2), (3), (4), (5);
+create table t3 (k int primary key) engine=innodb;
+insert into t3 values (1), (2), (3);
+create table t4 (l int primary key) engine=innodb;
+insert into t4 values (1);
+create table t5 (l int primary key) engine=innodb;
+insert into t5 values (1);
+create table te(e int primary key);
+insert into te values (1);
+create view v1 as select i from t1;
+create view v2 as select j from t2 where j in (select i from t1);
+create procedure p1(k int) insert into t2 values (k);
+delimiter |;
+create function f1() returns int
+begin
+ declare j int;
+ select i from t1 where i = 1 into j;
+ return j;
+end|
+create function f2() returns int
+begin
+ declare k int;
+ select i from t1 where i = 1 into k;
+ insert into t2 values (k + 5);
+ return 0;
+end|
+create function f3() returns int
+begin
+ return (select i from t1 where i = 3);
+end|
+create function f4() returns int
+begin
+ if (select i from t1 where i = 3) then
+ return 1;
+ else
+ return 0;
+ end if;
+end|
+create function f5() returns int
+begin
+ insert into t2 values ((select i from t1 where i = 1) + 5);
+ return 0;
+end|
+create function f6() returns int
+begin
+ declare k int;
+ select i from v1 where i = 1 into k;
+ return k;
+end|
+create function f7() returns int
+begin
+ declare k int;
+ select j from v2 where j = 1 into k;
+ return k;
+end|
+create function f8() returns int
+begin
+ declare k int;
+ select i from v1 where i = 1 into k;
+ insert into t2 values (k+5);
+ return k;
+end|
+create function f9() returns int
+begin
+ update v2 set j=j+10 where j=1;
+ return 1;
+end|
+create function f10() returns int
+begin
+ return f1();
+end|
+create function f11() returns int
+begin
+ declare k int;
+ set k= f1();
+ insert into t2 values (k+5);
+ return k;
+end|
+create function f12(p int) returns int
+begin
+ insert into t2 values (p);
+ return p;
+end|
+create function f13(p int) returns int
+begin
+ return p;
+end|
+create procedure p2(inout p int)
+begin
+ select i from t1 where i = 1 into p;
+end|
+create function f14() returns int
+begin
+ declare k int;
+ call p2(k);
+ insert into t2 values (k+5);
+ return k;
+end|
+create function f15() returns int
+begin
+ declare k int;
+ call p2(k);
+ return k;
+end|
+create trigger t4_bi before insert on t4 for each row
+begin
+ declare k int;
+ select i from t1 where i=1 into k;
+ set new.l= k+1;
+end|
+create trigger t4_bu before update on t4 for each row
+begin
+ if (select i from t1 where i=1) then
+ set new.l= 2;
+ end if;
+end|
+--echo # Trigger below uses insertion of duplicate key in 'te'
+--echo # table as a way to abort delete operation.
+create trigger t4_bd before delete on t4 for each row
+begin
+ if !(select i from v1 where i=1) then
+ insert into te values (1);
+ end if;
+end|
+create trigger t5_bi before insert on t5 for each row
+begin
+ set new.l= f1()+1;
+end|
+create trigger t5_bu before update on t5 for each row
+begin
+ declare j int;
+ call p2(j);
+ set new.l= j + 1;
+end|
+delimiter ;|
+
+--echo #
+--echo # Set common variables to be used by scripts called below.
+--echo #
+let $con_aux= con1;
+let $table= t1;
+
+
+--echo #
+--echo # 1. Statements that read tables and do not use subqueries.
+--echo #
+
+--echo #
+--echo # 1.1 Simple SELECT statement.
+--echo #
+--echo # No locks are necessary as this statement won't be written
+--echo # to the binary log and InnoDB supports snapshots.
+let $statement= select * from t1;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 1.2 Multi-UPDATE statement.
+--echo #
+--echo # Has to take shared locks on rows in the table being read as this
+--echo # statement will be written to the binary log and therefore should
+--echo # be serialized with concurrent statements.
+let $statement= update t2, t1 set j= j - 1 where i = j;
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 1.3 Multi-DELETE statement.
+--echo #
+--echo # The above is true for this statement as well.
+let $statement= delete t2 from t1, t2 where i = j;
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 1.4 DESCRIBE statement.
+--echo #
+--echo # This statement does not really read data from the
+--echo # target table and thus does not take any lock on it.
+--echo # We check this for completeness of coverage.
+let $statement= describe t1;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 1.5 SHOW statements.
+--echo #
+--echo # The above is true for SHOW statements as well.
+let $statement= show create table t1;
+--source include/check_no_row_lock.inc
+let $statement= show keys from t1;
+--source include/check_no_row_lock.inc
+
+
+--echo #
+--echo # 2. Statements which read tables through subqueries.
+--echo #
+
+--echo #
+--echo # 2.1 CALL with a subquery.
+--echo #
+--echo # A strong lock is not necessary as this statement is not
+--echo # written to the binary log as a whole (it is written
+--echo # statement-by-statement) and thanks to MVCC we can always get
+--echo # versions of rows prior to the update that has locked them.
+--echo # But in practice InnoDB does locking reads for all statements
+--echo # other than SELECT (unless it is a READ-COMITTED mode or
+--echo # innodb_locks_unsafe_for_binlog is ON).
+let $statement= call p1((select i + 5 from t1 where i = 1));
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 2.2 CREATE TABLE with a subquery.
+--echo #
+--echo # Has to take shared locks on rows in the table being read as
+--echo # this statement is written to the binary log and therefore
+--echo # should be serialized with concurrent statements.
+let $statement= create table t0 engine=innodb select * from t1;
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+drop table t0;
+let $statement= create table t0 engine=innodb select j from t2 where j in (select i from t1);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+drop table t0;
+
+--echo #
+--echo # 2.3 DELETE with a subquery.
+--echo #
+--echo # The above is true for this statement as well.
+let $statement= delete from t2 where j in (select i from t1);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 2.4 MULTI-DELETE with a subquery.
+--echo #
+--echo # Same is true for this statement as well.
+let $statement= delete t2 from t3, t2 where k = j and j in (select i from t1);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 2.5 DO with a subquery.
+--echo #
+--echo # In theory should not take row locks as it is not logged.
+--echo # In practice InnoDB takes shared row locks.
+let $statement= do (select i from t1 where i = 1);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 2.6 INSERT with a subquery.
+--echo #
+--echo # Has to take shared locks on rows in the table being read as
+--echo # this statement is written to the binary log and therefore
+--echo # should be serialized with concurrent statements.
+let $statement= insert into t2 select i+5 from t1;
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+let $statement= insert into t2 values ((select i+5 from t1 where i = 4));
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 2.7 LOAD DATA with a subquery.
+--echo #
+--echo # The above is true for this statement as well.
+let $statement= load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 2.8 REPLACE with a subquery.
+--echo #
+--echo # Same is true for this statement as well.
+let $statement= replace into t2 select i+5 from t1;
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+let $statement= replace into t2 values ((select i+5 from t1 where i = 4));
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 2.9 SELECT with a subquery.
+--echo #
+--echo # Locks are not necessary as this statement is not written
+--echo # to the binary log and thanks to MVCC we can always get
+--echo # versions of rows prior to the update that has locked them.
+--echo #
+--echo # Also serves as a test case for bug #46947 "Embedded SELECT
+--echo # without FOR UPDATE is causing a lock".
+let $statement= select * from t2 where j in (select i from t1);
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 2.10 SET with a subquery.
+--echo #
+--echo # In theory should not require locking as it is not written
+--echo # to the binary log. In practice InnoDB acquires shared row
+--echo # locks.
+let $statement= set @a:= (select i from t1 where i = 1);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 2.11 SHOW with a subquery.
+--echo #
+--echo # Similarly to the previous case, in theory should not require locking
+--echo # as it is not written to the binary log. In practice InnoDB
+--echo # acquires shared row locks.
+let $statement= show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+let $statement= show columns from t2 where (select i from t1 where i = 1);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 2.12 UPDATE with a subquery.
+--echo #
+--echo # Has to take shared locks on rows in the table being read as
+--echo # this statement is written to the binary log and therefore
+--echo # should be serialized with concurrent statements.
+let $statement= update t2 set j= j-10 where j in (select i from t1);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 2.13 MULTI-UPDATE with a subquery.
+--echo #
+--echo # Same is true for this statement as well.
+let $statement= update t2, t3 set j= j -10 where j=k and j in (select i from t1);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+
+--echo #
+--echo # 3. Statements which read tables through a view.
+--echo #
+
+--echo #
+--echo # 3.1 SELECT statement which uses some table through a view.
+--echo #
+--echo # Since this statement is not written to the binary log
+--echo # and old version of rows are accessible thanks to MVCC,
+--echo # no locking is necessary.
+let $statement= select * from v1;
+--source include/check_no_row_lock.inc
+let $statement= select * from v2;
+--source include/check_no_row_lock.inc
+let $statement= select * from t2 where j in (select i from v1);
+--source include/check_no_row_lock.inc
+let $statement= select * from t3 where k in (select j from v2);
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 3.2 Statements which modify a table and use views.
+--echo #
+--echo # Since such statements are going to be written to the binary
+--echo # log they need to be serialized against concurrent statements
+--echo # and therefore should take shared row locks on data read.
+let $statement= update t2 set j= j-10 where j in (select i from v1);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+let $statement= update t3 set k= k-10 where k in (select j from v2);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+let $statement= update t2, v1 set j= j-10 where j = i;
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+let $statement= update v2 set j= j-10 where j = 3;
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+
+--echo #
+--echo # 4. Statements which read tables through stored functions.
+--echo #
+
+--echo #
+--echo # 4.1 SELECT/SET with a stored function which does not
+--echo # modify data and uses SELECT in its turn.
+--echo #
+--echo # Calls to such functions won't get into the binary log and
+--echo # thus don't need to acquire strong locks.
+--echo # In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+--echo # used stored functions may lead to broken SBR" strong locks
+--echo # are taken (we accepted it as a trade-off for this fix).
+let $statement= select f1();
+let $wait_statement= select i from t1 where i = 1 into j;
+--source include/check_no_row_lock.inc
+let $statement= set @a:= f1();
+let $wait_statement= select i from t1 where i = 1 into j;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 4.2 INSERT (or other statement which modifies data) with
+--echo # a stored function which does not modify data and uses
+--echo # SELECT.
+--echo #
+--echo # Since such statement is written to the binary log it should
+--echo # be serialized with concurrent statements affecting the data
+--echo # it uses. Therefore it should take row locks on the data
+--echo # it reads.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken.
+let $statement= insert into t2 values (f1() + 5);
+let $wait_statement= select i from t1 where i = 1 into j;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 4.3 SELECT/SET with a stored function which
+--echo # reads and modifies data.
+--echo #
+--echo # Since a call to such function is written to the binary log,
+--echo # it should be serialized with concurrent statements affecting
+--echo # the data it uses. Hence, row locks on the data read
+--echo # should be taken.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken.
+let $statement= select f2();
+let $wait_statement= select i from t1 where i = 1 into k;
+--source include/check_no_row_lock.inc
+let $statement= set @a:= f2();
+let $wait_statement= select i from t1 where i = 1 into k;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 4.4. SELECT/SET with a stored function which does not
+--echo # modify data and reads a table through subselect
+--echo # in a control construct.
+--echo #
+--echo # Again, in theory a call to this function won't get to the
+--echo # binary log and thus no locking is needed. But in practice
+--echo # we don't detect this fact early enough (get_lock_type_for_table())
+--echo # to avoid taking row locks.
+let $statement= select f3();
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+let $statement= set @a:= f3();
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+let $statement= select f4();
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+let $statement= set @a:= f4();
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 4.5. INSERT (or other statement which modifies data) with
+--echo # a stored function which does not modify data and reads
+--echo # the table through a subselect in one of its control
+--echo # constructs.
+--echo #
+--echo # Since such statement is written to the binary log it should
+--echo # be serialized with concurrent statements affecting data it
+--echo # uses. Therefore it should take row locks on the data
+--echo # it reads.
+let $statement= insert into t2 values (f3() + 5);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+let $statement= insert into t2 values (f4() + 6);
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 4.6 SELECT/SET which uses a stored function with
+--echo # DML which reads a table via a subquery.
+--echo #
+--echo # Since call to such function is written to the binary log
+--echo # it should be serialized with concurrent statements.
+--echo # Hence reads should take row locks.
+let $statement= select f5();
+let $wait_statement= insert into t2 values ((select i from t1 where i = 1) + 5);
+--source include/check_shared_row_lock.inc
+let $statement= set @a:= f5();
+let $wait_statement= insert into t2 values ((select i from t1 where i = 1) + 5);
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 4.7 SELECT/SET which uses a stored function which
+--echo # doesn't modify data and reads tables through
+--echo # a view.
+--echo #
+--echo # Once again, in theory, calls to such functions won't
+--echo # get into the binary log and thus don't need row
+--echo # locks. In practice this fact is discovered
+--echo # too late to have any effect.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken
+--echo # in case of simple SELECT.
+let $statement= select f6();
+let $wait_statement= select i from v1 where i = 1 into k;
+--source include/check_no_row_lock.inc
+let $statement= set @a:= f6();
+let $wait_statement= select i from v1 where i = 1 into k;
+--source include/check_no_row_lock.inc
+let $statement= select f7();
+let $wait_statement= select j from v2 where j = 1 into k;
+--source include/check_shared_row_lock.inc
+let $statement= set @a:= f7();
+let $wait_statement= select j from v2 where j = 1 into k;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 4.8 INSERT which uses stored function which
+--echo # doesn't modify data and reads a table
+--echo # through a view.
+--echo #
+--echo # Since such statement is written to the binary log and
+--echo # should be serialized with concurrent statements affecting
+--echo # the data it uses. Therefore it should take row locks on
+--echo # the rows it reads.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken
+--echo # in case of simple SELECT.
+let $statement= insert into t3 values (f6() + 5);
+let $wait_statement= select i from v1 where i = 1 into k;
+--source include/check_no_row_lock.inc
+let $statement= insert into t3 values (f7() + 5);
+let $wait_statement= select j from v2 where j = 1 into k;
+--source include/check_shared_row_lock.inc
+
+
+--echo #
+--echo # 4.9 SELECT which uses a stored function which
+--echo # modifies data and reads tables through a view.
+--echo #
+--echo # Since a call to such function is written to the binary log
+--echo # it should be serialized with concurrent statements.
+--echo # Hence, reads should take row locks.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken
+--echo # in case of simple SELECT.
+let $statement= select f8();
+let $wait_statement= select i from v1 where i = 1 into k;
+--source include/check_no_row_lock.inc
+let $statement= select f9();
+let $wait_statement= update v2 set j=j+10 where j=1;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 4.10 SELECT which uses stored function which doesn't modify
+--echo # data and reads a table indirectly, by calling another
+--echo # function.
+--echo #
+--echo # Calls to such functions won't get into the binary log and
+--echo # thus don't need to acquire strong locks.
+--echo # In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+--echo # used stored functions may lead to broken SBR" strong locks
+--echo # are taken (we accepted it as a trade-off for this fix).
+let $statement= select f10();
+let $wait_statement= select i from t1 where i = 1 into j;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 4.11 INSERT which uses a stored function which doesn't modify
+--echo # data and reads a table indirectly, by calling another
+--echo # function.
+--echo #
+--echo # Since such statement is written to the binary log, it should
+--echo # be serialized with concurrent statements affecting the data it
+--echo # uses. Therefore it should take row locks on data it reads.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken.
+let $statement= insert into t2 values (f10() + 5);
+let $wait_statement= select i from t1 where i = 1 into j;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 4.12 SELECT which uses a stored function which modifies
+--echo # data and reads a table indirectly, by calling another
+--echo # function.
+--echo #
+--echo # Since a call to such function is written to the binary log
+--echo # it should be serialized from concurrent statements.
+--echo # Hence, reads should take row locks.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken.
+let $statement= select f11();
+let $wait_statement= select i from t1 where i = 1 into j;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 4.13 SELECT that reads a table through a subquery passed
+--echo # as a parameter to a stored function which modifies
+--echo # data.
+--echo #
+--echo # Even though a call to this function is written to the
+--echo # binary log, values of its parameters are written as literals.
+--echo # So there is no need to acquire row locks on rows used in
+--echo # the subquery.
+--echo # But due to the fact that in 5.1 for prelocked statements
+--echo # THD::in_lock_tables is set to TRUE we acquire strong locks
+--echo # (see also bug#44613 "SELECT statement inside FUNCTION takes
+--echo # a shared lock" [sic!!!]).
+let $statement= select f12((select i+10 from t1 where i=1));
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 4.14 INSERT that reads a table via a subquery passed
+--echo # as a parameter to a stored function which doesn't
+--echo # modify data.
+--echo #
+--echo # Since this statement is written to the binary log it should
+--echo # be serialized with concurrent statements affecting the data it
+--echo # uses. Therefore it should take row locks on the data it reads.
+let $statement= insert into t2 values (f13((select i+10 from t1 where i=1)));
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+
+--echo #
+--echo # 5. Statements that read tables through stored procedures.
+--echo #
+
+--echo #
+--echo # 5.1 CALL statement which reads a table via SELECT.
+--echo #
+--echo # Since neither this statement nor its components are
+--echo # written to the binary log, there is no need to take
+--echo # row locks on the data it reads.
+let $statement= call p2(@a);
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 5.2 Function that modifies data and uses CALL,
+--echo # which reads a table through SELECT.
+--echo #
+--echo # Since a call to such function is written to the binary
+--echo # log, it should be serialized with concurrent statements.
+--echo # Hence, in this case reads should take row locks on data.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken.
+let $statement= select f14();
+let $wait_statement= select i from t1 where i = 1 into p;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 5.3 SELECT that calls a function that doesn't modify data and
+--echo # uses a CALL statement that reads a table via SELECT.
+--echo #
+--echo # Calls to such functions won't get into the binary log and
+--echo # thus don't need to acquire strong locks.
+--echo # In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+--echo # used stored functions may lead to broken SBR" strong locks
+--echo # are taken (we accepted it as a trade-off for this fix).
+let $statement= select f15();
+let $wait_statement= select i from t1 where i = 1 into p;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 5.4 INSERT which calls function which doesn't modify data and
+--echo # uses CALL statement which reads table through SELECT.
+--echo #
+--echo # Since such statement is written to the binary log it should
+--echo # be serialized with concurrent statements affecting data it
+--echo # uses. Therefore it should take row locks on data it reads.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken.
+let $statement= insert into t2 values (f15()+5);
+let $wait_statement= select i from t1 where i = 1 into p;
+--source include/check_no_row_lock.inc
+
+
+--echo #
+--echo # 6. Statements that use triggers.
+--echo #
+
+--echo #
+--echo # 6.1 Statement invoking a trigger that reads table via SELECT.
+--echo #
+--echo # Since this statement is written to the binary log it should
+--echo # be serialized with concurrent statements affecting the data
+--echo # it uses. Therefore, it should take row locks on the data
+--echo # it reads.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken.
+let $statement= insert into t4 values (2);
+let $wait_statement= select i from t1 where i=1 into k;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 6.2 Statement invoking a trigger that reads table through
+--echo # a subquery in a control construct.
+--echo #
+--echo # The above is true for this statement as well.
+let $statement= update t4 set l= 2 where l = 1;
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 6.3 Statement invoking a trigger that reads a table through
+--echo # a view.
+--echo #
+--echo # And for this statement.
+let $statement= delete from t4 where l = 1;
+let $wait_statement= $statement;
+--source include/check_shared_row_lock.inc
+
+--echo #
+--echo # 6.4 Statement invoking a trigger that reads a table through
+--echo # a stored function.
+--echo #
+--echo # And for this statement.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken.
+let $statement= insert into t5 values (2);
+let $wait_statement= select i from t1 where i = 1 into j;
+--source include/check_no_row_lock.inc
+
+--echo #
+--echo # 6.5 Statement invoking a trigger that reads a table through
+--echo # stored procedure.
+--echo #
+--echo # And for this statement.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" no lock is taken.
+let $statement= update t5 set l= 2 where l = 1;
+let $wait_statement= select i from t1 where i = 1 into p;
+--source include/check_no_row_lock.inc
+
+--echo # Clean-up.
+drop function f1;
+drop function f2;
+drop function f3;
+drop function f4;
+drop function f5;
+drop function f6;
+drop function f7;
+drop function f8;
+drop function f9;
+drop function f10;
+drop function f11;
+drop function f12;
+drop function f13;
+drop function f14;
+drop function f15;
+drop view v1, v2;
+drop procedure p1;
+drop procedure p2;
+drop table t1, t2, t3, t4, t5, te;
+disconnect con1;
+
+# Check that all connections opened by test cases in this file are really
+# gone so execution of other tests won't be affected by their presence.
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index e3d68d71603..cf881e6aaa2 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -913,4 +913,72 @@ WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
DROP TABLE t1, t2;
+--echo #
+--echo # Bug#52357: Assertion failed: join->best_read in greedy_search
+--echo # optimizer_search_depth=0
+--echo #
+CREATE TABLE t1( a INT );
+
+INSERT INTO t1 VALUES (1),(2);
+SET optimizer_search_depth = 0;
+
+--echo # Should not core dump on query preparation
+EXPLAIN
+SELECT 1
+FROM t1 tt3 LEFT OUTER JOIN t1 tt4 ON 1
+ LEFT OUTER JOIN t1 tt5 ON 1
+ LEFT OUTER JOIN t1 tt6 ON 1
+ LEFT OUTER JOIN t1 tt7 ON 1
+ LEFT OUTER JOIN t1 tt8 ON 1
+ RIGHT OUTER JOIN t1 tt2 ON 1
+ RIGHT OUTER JOIN t1 tt1 ON 1
+ STRAIGHT_JOIN t1 tt9 ON 1;
+
+SET optimizer_search_depth = DEFAULT;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#46091 STRAIGHT_JOIN + RIGHT JOIN returns different result
+--echo #
+CREATE TABLE t1 (f1 INT NOT NULL);
+INSERT INTO t1 VALUES (9),(0);
+
+CREATE TABLE t2 (f1 INT NOT NULL);
+INSERT INTO t2 VALUES
+(5),(3),(0),(3),(1),(0),(1),(7),(1),(0),(0),(8),(4),(9),(0),(2),(0),(8),(5),(1);
+
+SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1
+RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1;
+
+EXPLAIN SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1
+RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1;
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#48971 Segfault in add_found_match_trig_cond () at sql_select.cc:5990
+--echo #
+CREATE TABLE t1(f1 INT, PRIMARY KEY (f1));
+INSERT INTO t1 VALUES (1),(2);
+
+EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
+ LEFT JOIN t1 AS jt2
+ RIGHT JOIN t1 AS jt3
+ JOIN t1 AS jt4 ON 1
+ LEFT JOIN t1 AS jt5 ON 1
+ ON 1
+ RIGHT JOIN t1 AS jt6 ON jt6.f1
+ ON 1;
+
+EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
+ RIGHT JOIN t1 AS jt2
+ RIGHT JOIN t1 AS jt3
+ JOIN t1 AS jt4 ON 1
+ LEFT JOIN t1 AS jt5 ON 1
+ ON 1
+ RIGHT JOIN t1 AS jt6 ON jt6.f1
+ ON 1;
+
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 126bd5c8838..e24f0b16705 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -560,4 +560,24 @@ let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/t1.txt;
+--echo #
+--echo # Bug #52512 : Assertion `! is_set()' in
+--echo # Diagnostics_area::set_ok_status on LOAD DATA
+--echo #
+
+connect (con1,localhost,root,,test);
+
+CREATE TABLE t1 (id INT NOT NULL);
+--send LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1
+# please keep this is a spearate test file : it's important to have no
+# commands after this one
+
+connection default;
+dirty_close con1;
+
+connect (con1,localhost,root,,test);
+DROP TABLE t1;
+connection default;
+disconnect con1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/lock_sync.test b/mysql-test/t/lock_sync.test
new file mode 100644
index 00000000000..17f8abb75f3
--- /dev/null
+++ b/mysql-test/t/lock_sync.test
@@ -0,0 +1,867 @@
+#
+# Locking related tests which use DEBUG_SYNC facility.
+#
+--source include/have_debug_sync.inc
+# This test requires statement/mixed mode binary logging.
+# Row-based mode puts weaker serializability requirements
+# so weaker locks are acquired for it.
+--source include/have_binlog_format_mixed_or_statement.inc
+
+# Save the initial number of concurrent sessions.
+--source include/count_sessions.inc
+
+
+--echo #
+--echo # Test how we handle locking in various cases when
+--echo # we read data from MyISAM tables.
+--echo #
+--echo # In this test we mostly check that the SQL-layer correctly
+--echo # determines the type of thr_lock.c lock for a table being
+--echo # read.
+--echo # I.e. that it disallows concurrent inserts when the statement
+--echo # is going to be written to the binary log and therefore
+--echo # should be serialized, and allows concurrent inserts when
+--echo # such serialization is not necessary (e.g. when
+--echo # the statement is not written to binary log).
+--echo #
+
+--echo # Force concurrent inserts to be performed even if the table
+--echo # has gaps. This allows to simplify clean up in scripts
+--echo # used below (instead of backing up table being inserted
+--echo # into and then restoring it from backup at the end of the
+--echo # script we can simply delete rows which were inserted).
+set @old_concurrent_insert= @@global.concurrent_insert;
+set @@global.concurrent_insert= 2;
+select @@global.concurrent_insert;
+
+--echo # Prepare playground by creating tables, views,
+--echo # routines and triggers used in tests.
+connect (con1, localhost, root,,);
+connect (con2, localhost, root,,);
+connection default;
+--disable_warnings
+drop table if exists t0, t1, t2, t3, t4, t5, te;
+drop view if exists v1, v2;
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop function if exists f1;
+drop function if exists f2;
+drop function if exists f3;
+drop function if exists f4;
+drop function if exists f5;
+drop function if exists f6;
+drop function if exists f7;
+drop function if exists f8;
+drop function if exists f9;
+drop function if exists f10;
+drop function if exists f11;
+drop function if exists f12;
+drop function if exists f13;
+drop function if exists f14;
+drop function if exists f15;
+--enable_warnings
+create table t1 (i int primary key);
+insert into t1 values (1), (2), (3), (4), (5);
+create table t2 (j int primary key);
+insert into t2 values (1), (2), (3), (4), (5);
+create table t3 (k int primary key);
+insert into t3 values (1), (2), (3);
+create table t4 (l int primary key);
+insert into t4 values (1);
+create table t5 (l int primary key);
+insert into t5 values (1);
+create table te(e int primary key);
+insert into te values (1);
+create view v1 as select i from t1;
+create view v2 as select j from t2 where j in (select i from t1);
+create procedure p1(k int) insert into t2 values (k);
+delimiter |;
+create function f1() returns int
+begin
+ declare j int;
+ select i from t1 where i = 1 into j;
+ return j;
+end|
+create function f2() returns int
+begin
+ declare k int;
+ select i from t1 where i = 1 into k;
+ insert into t2 values (k + 5);
+ return 0;
+end|
+create function f3() returns int
+begin
+ return (select i from t1 where i = 3);
+end|
+create function f4() returns int
+begin
+ if (select i from t1 where i = 3) then
+ return 1;
+ else
+ return 0;
+ end if;
+end|
+create function f5() returns int
+begin
+ insert into t2 values ((select i from t1 where i = 1) + 5);
+ return 0;
+end|
+create function f6() returns int
+begin
+ declare k int;
+ select i from v1 where i = 1 into k;
+ return k;
+end|
+create function f7() returns int
+begin
+ declare k int;
+ select j from v2 where j = 1 into k;
+ return k;
+end|
+create function f8() returns int
+begin
+ declare k int;
+ select i from v1 where i = 1 into k;
+ insert into t2 values (k+5);
+ return k;
+end|
+create function f9() returns int
+begin
+ update v2 set j=j+10 where j=1;
+ return 1;
+end|
+create function f10() returns int
+begin
+ return f1();
+end|
+create function f11() returns int
+begin
+ declare k int;
+ set k= f1();
+ insert into t2 values (k+5);
+ return k;
+end|
+create function f12(p int) returns int
+begin
+ insert into t2 values (p);
+ return p;
+end|
+create function f13(p int) returns int
+begin
+ return p;
+end|
+create procedure p2(inout p int)
+begin
+ select i from t1 where i = 1 into p;
+end|
+create function f14() returns int
+begin
+ declare k int;
+ call p2(k);
+ insert into t2 values (k+5);
+ return k;
+end|
+create function f15() returns int
+begin
+ declare k int;
+ call p2(k);
+ return k;
+end|
+create trigger t4_bi before insert on t4 for each row
+begin
+ declare k int;
+ select i from t1 where i=1 into k;
+ set new.l= k+1;
+end|
+create trigger t4_bu before update on t4 for each row
+begin
+ if (select i from t1 where i=1) then
+ set new.l= 2;
+ end if;
+end|
+--echo # Trigger below uses insertion of duplicate key in 'te'
+--echo # table as a way to abort delete operation.
+create trigger t4_bd before delete on t4 for each row
+begin
+ if !(select i from v1 where i=1) then
+ insert into te values (1);
+ end if;
+end|
+create trigger t5_bi before insert on t5 for each row
+begin
+ set new.l= f1()+1;
+end|
+create trigger t5_bu before update on t5 for each row
+begin
+ declare j int;
+ call p2(j);
+ set new.l= j + 1;
+end|
+delimiter ;|
+
+--echo #
+--echo # Set common variables to be used by the scripts
+--echo # called below.
+--echo #
+let $con_aux1= con1;
+let $con_aux2= con2;
+let $table= t1;
+
+--echo # Switch to connection 'con1'.
+connection con1;
+--echo # Cache all functions used in the tests below so statements
+--echo # calling them won't need to open and lock mysql.proc table
+--echo # and we can assume that each statement locks its tables
+--echo # once during its execution.
+--disable_result_log
+show create procedure p1;
+show create procedure p2;
+show create function f1;
+show create function f2;
+show create function f3;
+show create function f4;
+show create function f5;
+show create function f6;
+show create function f7;
+show create function f8;
+show create function f9;
+show create function f10;
+show create function f11;
+show create function f12;
+show create function f13;
+show create function f14;
+show create function f15;
+--enable_result_log
+--echo # Switch back to connection 'default'.
+connection default;
+
+--echo #
+--echo # 1. Statements that read tables and do not use subqueries.
+--echo #
+
+--echo #
+--echo # 1.1 Simple SELECT statement.
+--echo #
+--echo # No locks are necessary as this statement won't be written
+--echo # to the binary log and thanks to how MyISAM works SELECT
+--echo # will see version of the table prior to concurrent insert.
+let $statement= select * from t1;
+let $restore_table= ;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 1.2 Multi-UPDATE statement.
+--echo #
+--echo # Has to take shared locks on rows in the table being read as this
+--echo # statement will be written to the binary log and therefore should
+--echo # be serialized with concurrent statements.
+let $statement= update t2, t1 set j= j - 1 where i = j;
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 1.3 Multi-DELETE statement.
+--echo #
+--echo # The above is true for this statement as well.
+let $statement= delete t2 from t1, t2 where i = j;
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 1.4 DESCRIBE statement.
+--echo #
+--echo # This statement does not really read data from the
+--echo # target table and thus does not take any lock on it.
+--echo # We check this for completeness of coverage.
+lock table t1 write;
+--echo # Switching to connection 'con1'.
+connection con1;
+--echo # This statement should not be blocked.
+--disable_result_log
+describe t1;
+--enable_result_log
+--echo # Switching to connection 'default'.
+connection default;
+unlock tables;
+
+--echo #
+--echo # 1.5 SHOW statements.
+--echo #
+--echo # The above is true for SHOW statements as well.
+lock table t1 write;
+--echo # Switching to connection 'con1'.
+connection con1;
+--echo # These statements should not be blocked.
+# The below test for SHOW CREATE TABLE is disabled until bug 52593
+# "SHOW CREATE TABLE is blocked if table is locked for write by another
+# connection" is fixed.
+--disable_parsing
+show create table t1;
+--enable_parsing
+--disable_result_log
+show keys from t1;
+--enable_result_log
+--echo # Switching to connection 'default'.
+connection default;
+unlock tables;
+
+
+--echo #
+--echo # 2. Statements which read tables through subqueries.
+--echo #
+
+--echo #
+--echo # 2.1 CALL with a subquery.
+--echo #
+--echo # In theory strong lock is not necessary as this statement
+--echo # is not written to the binary log as a whole (it is written
+--echo # statement-by-statement). But in practice in 5.1 for
+--echo # almost everything except SELECT we take strong lock.
+let $statement= call p1((select i + 5 from t1 where i = 1));
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 2.2 CREATE TABLE with a subquery.
+--echo #
+--echo # Has to take a strong lock on the table being read as
+--echo # this statement is written to the binary log and therefore
+--echo # should be serialized with concurrent statements.
+let $statement= create table t0 select * from t1;
+let $restore_table= ;
+--source include/check_no_concurrent_insert.inc
+drop table t0;
+let $statement= create table t0 select j from t2 where j in (select i from t1);
+let $restore_table= ;
+--source include/check_no_concurrent_insert.inc
+drop table t0;
+
+--echo #
+--echo # 2.3 DELETE with a subquery.
+--echo #
+--echo # The above is true for this statement as well.
+let $statement= delete from t2 where j in (select i from t1);
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 2.4 MULTI-DELETE with a subquery.
+--echo #
+--echo # Same is true for this statement as well.
+let $statement= delete t2 from t3, t2 where k = j and j in (select i from t1);
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+
+--echo #
+--echo # 2.5 DO with a subquery.
+--echo #
+--echo # In theory strong lock is not necessary as it is not logged.
+--echo # But in practice in 5.1 for almost everything except SELECT
+--echo # we take strong lock.
+let $statement= do (select i from t1 where i = 1);
+let $restore_table= ;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 2.6 INSERT with a subquery.
+--echo #
+--echo # Has to take a strong lock on the table being read as
+--echo # this statement is written to the binary log and therefore
+--echo # should be serialized with concurrent inserts.
+let $statement= insert into t2 select i+5 from t1;
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+let $statement= insert into t2 values ((select i+5 from t1 where i = 4));
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 2.7 LOAD DATA with a subquery.
+--echo #
+--echo # The above is true for this statement as well.
+let $statement= load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1);
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 2.8 REPLACE with a subquery.
+--echo #
+--echo # Same is true for this statement as well.
+let $statement= replace into t2 select i+5 from t1;
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+let $statement= replace into t2 values ((select i+5 from t1 where i = 4));
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 2.9 SELECT with a subquery.
+--echo #
+--echo # Strong locks are not necessary as this statement is not written
+--echo # to the binary log and thanks to how MyISAM works this statement
+--echo # sees a version of the table prior to the concurrent insert.
+let $statement= select * from t2 where j in (select i from t1);
+let $restore_table= ;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 2.10 SET with a subquery.
+--echo #
+--echo # In theory the same is true for this statement as well.
+--echo # But in practice in 5.1 we acquire strong lock in this
+--echo # case as well.
+let $statement= set @a:= (select i from t1 where i = 1);
+let $restore_table= ;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 2.11 SHOW with a subquery.
+--echo #
+--echo # The same is true for this statement too.
+let $statement= show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1);
+let $restore_table= ;
+--source include/check_no_concurrent_insert.inc
+let $statement= show columns from t2 where (select i from t1 where i = 1);
+let $restore_table= ;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 2.12 UPDATE with a subquery.
+--echo #
+--echo # Has to take a strong lock on the table being read as
+--echo # this statement is written to the binary log and therefore
+--echo # should be serialized with concurrent inserts.
+let $statement= update t2 set j= j-10 where j in (select i from t1);
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 2.13 MULTI-UPDATE with a subquery.
+--echo #
+--echo # Same is true for this statement as well.
+let $statement= update t2, t3 set j= j -10 where j=k and j in (select i from t1);
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+
+--echo #
+--echo # 3. Statements which read tables through a view.
+--echo #
+
+--echo #
+--echo # 3.1 SELECT statement which uses some table through a view.
+--echo #
+--echo # Since this statement is not written to the binary log and
+--echo # an old version of the table is accessible thanks to how MyISAM
+--echo # handles concurrent insert, no locking is necessary.
+let $statement= select * from v1;
+let $restore_table= ;
+--source include/check_concurrent_insert.inc
+let $statement= select * from v2;
+let $restore_table= ;
+--source include/check_concurrent_insert.inc
+let $statement= select * from t2 where j in (select i from v1);
+let $restore_table= ;
+--source include/check_concurrent_insert.inc
+let $statement= select * from t3 where k in (select j from v2);
+let $restore_table= ;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 3.2 Statements which modify a table and use views.
+--echo #
+--echo # Since such statements are going to be written to the binary
+--echo # log they need to be serialized against concurrent statements
+--echo # and therefore should take strong locks on the data read.
+let $statement= update t2 set j= j-10 where j in (select i from v1);
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+let $statement= update t3 set k= k-10 where k in (select j from v2);
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+let $statement= update t2, v1 set j= j-10 where j = i;
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+let $statement= update v2 set j= j-10 where j = 3;
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+
+--echo #
+--echo # 4. Statements which read tables through stored functions.
+--echo #
+
+--echo #
+--echo # 4.1 SELECT/SET with a stored function which does not
+--echo # modify data and uses SELECT in its turn.
+--echo #
+--echo # Calls to such functions won't get into the binary log and
+--echo # thus don't need to acquire strong locks.
+--echo # In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+--echo # used stored functions may lead to broken SBR" strong locks
+--echo # are taken (we accepted it as a trade-off for this fix).
+let $statement= select f1();
+let $restore_table= ;
+--source include/check_concurrent_insert.inc
+let $statement= set @a:= f1();
+let $restore_table= ;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 4.2 INSERT (or other statement which modifies data) with
+--echo # a stored function which does not modify data and uses
+--echo # SELECT.
+--echo #
+--echo # Since such statement is written to the binary log it should
+--echo # be serialized with concurrent statements affecting the data
+--echo # it uses. Therefore it should take strong lock on the data
+--echo # it reads.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken.
+let $statement= insert into t2 values (f1() + 5);
+let $restore_table= t2;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 4.3 SELECT/SET with a stored function which
+--echo # reads and modifies data.
+--echo #
+--echo # Since a call to such function is written to the binary log,
+--echo # it should be serialized with concurrent statements affecting
+--echo # the data it uses. Hence, a strong lock on the data read
+--echo # should be taken.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken.
+let $statement= select f2();
+let $restore_table= t2;
+--source include/check_concurrent_insert.inc
+let $statement= set @a:= f2();
+let $restore_table= t2;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 4.4. SELECT/SET with a stored function which does not
+--echo # modify data and reads a table through subselect
+--echo # in a control construct.
+--echo #
+--echo # Again, in theory a call to this function won't get to the
+--echo # binary log and thus no strong lock is needed. But in practice
+--echo # we don't detect this fact early enough (get_lock_type_for_table())
+--echo # to avoid taking a strong lock.
+let $statement= select f3();
+let $restore_table= ;
+--source include/check_no_concurrent_insert.inc
+let $statement= set @a:= f3();
+let $restore_table= ;
+--source include/check_no_concurrent_insert.inc
+let $statement= select f4();
+let $restore_table= ;
+--source include/check_no_concurrent_insert.inc
+let $statement= set @a:= f4();
+let $restore_table= ;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 4.5. INSERT (or other statement which modifies data) with
+--echo # a stored function which does not modify data and reads
+--echo # the table through a subselect in one of its control
+--echo # constructs.
+--echo #
+--echo # Since such statement is written to the binary log it should
+--echo # be serialized with concurrent statements affecting data it
+--echo # uses. Therefore it should take a strong lock on the data
+--echo # it reads.
+let $statement= insert into t2 values (f3() + 5);
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+let $statement= insert into t2 values (f4() + 6);
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 4.6 SELECT/SET which uses a stored function with
+--echo # DML which reads a table via a subquery.
+--echo #
+--echo # Since call to such function is written to the binary log
+--echo # it should be serialized with concurrent statements.
+--echo # Hence reads should take a strong lock.
+let $statement= select f5();
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+let $statement= set @a:= f5();
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 4.7 SELECT/SET which uses a stored function which
+--echo # doesn't modify data and reads tables through
+--echo # a view.
+--echo #
+--echo # Once again, in theory, calls to such functions won't
+--echo # get into the binary log and thus don't need strong
+--echo # locks. In practice this fact is discovered
+--echo # too late to have any effect.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken
+--echo # in case when simple SELECT is used.
+let $statement= select f6();
+let $restore_table= t2;
+--source include/check_concurrent_insert.inc
+let $statement= set @a:= f6();
+let $restore_table= t2;
+--source include/check_concurrent_insert.inc
+let $statement= select f7();
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+let $statement= set @a:= f7();
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 4.8 INSERT which uses stored function which
+--echo # doesn't modify data and reads a table
+--echo # through a view.
+--echo #
+--echo # Since such statement is written to the binary log and
+--echo # should be serialized with concurrent statements affecting
+--echo # the data it uses. Therefore it should take a strong lock on
+--echo # the table it reads.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken
+--echo # in case when simple SELECT is used.
+let $statement= insert into t3 values (f6() + 5);
+let $restore_table= t3;
+--source include/check_concurrent_insert.inc
+let $statement= insert into t3 values (f7() + 5);
+let $restore_table= t3;
+--source include/check_no_concurrent_insert.inc
+
+
+--echo #
+--echo # 4.9 SELECT which uses a stored function which
+--echo # modifies data and reads tables through a view.
+--echo #
+--echo # Since a call to such function is written to the binary log
+--echo # it should be serialized with concurrent statements.
+--echo # Hence, reads should take strong locks.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken
+--echo # in case when simple SELECT is used.
+let $statement= select f8();
+let $restore_table= t2;
+--source include/check_concurrent_insert.inc
+let $statement= select f9();
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 4.10 SELECT which uses a stored function which doesn't modify
+--echo # data and reads a table indirectly, by calling another
+--echo # function.
+--echo #
+--echo # Calls to such functions won't get into the binary log and
+--echo # thus don't need to acquire strong locks.
+--echo # In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+--echo # used stored functions may lead to broken SBR" strong locks
+--echo # are taken (we accepted it as a trade-off for this fix).
+let $statement= select f10();
+let $restore_table= ;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 4.11 INSERT which uses a stored function which doesn't modify
+--echo # data and reads a table indirectly, by calling another
+--echo # function.
+--echo #
+--echo # Since such statement is written to the binary log, it should
+--echo # be serialized with concurrent statements affecting the data it
+--echo # uses. Therefore it should take strong locks on data it reads.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken.
+let $statement= insert into t2 values (f10() + 5);
+let $restore_table= t2;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 4.12 SELECT which uses a stored function which modifies
+--echo # data and reads a table indirectly, by calling another
+--echo # function.
+--echo #
+--echo # Since a call to such function is written to the binary log
+--echo # it should be serialized from concurrent statements.
+--echo # Hence, read should take a strong lock.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken.
+let $statement= select f11();
+let $restore_table= t2;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 4.13 SELECT that reads a table through a subquery passed
+--echo # as a parameter to a stored function which modifies
+--echo # data.
+--echo #
+--echo # Even though a call to this function is written to the
+--echo # binary log, values of its parameters are written as literals.
+--echo # So there is no need to acquire strong locks for tables used in
+--echo # the subquery.
+let $statement= select f12((select i+10 from t1 where i=1));
+let $restore_table= t2;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 4.14 INSERT that reads a table via a subquery passed
+--echo # as a parameter to a stored function which doesn't
+--echo # modify data.
+--echo #
+--echo # Since this statement is written to the binary log it should
+--echo # be serialized with concurrent statements affecting the data it
+--echo # uses. Therefore it should take strong locks on the data it reads.
+let $statement= insert into t2 values (f13((select i+10 from t1 where i=1)));
+let $restore_table= t2;
+--source include/check_no_concurrent_insert.inc
+
+
+--echo #
+--echo # 5. Statements that read tables through stored procedures.
+--echo #
+
+--echo #
+--echo # 5.1 CALL statement which reads a table via SELECT.
+--echo #
+--echo # Since neither this statement nor its components are
+--echo # written to the binary log, there is no need to take
+--echo # strong locks on the data it reads.
+let $statement= call p2(@a);
+let $restore_table= ;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 5.2 Function that modifies data and uses CALL,
+--echo # which reads a table through SELECT.
+--echo #
+--echo # Since a call to such function is written to the binary
+--echo # log, it should be serialized with concurrent statements.
+--echo # Hence, in this case reads should take strong locks on data.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken.
+let $statement= select f14();
+let $restore_table= t2;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 5.3 SELECT that calls a function that doesn't modify data and
+--echo # uses a CALL statement that reads a table via SELECT.
+--echo #
+--echo # Calls to such functions won't get into the binary log and
+--echo # thus don't need to acquire strong locks.
+--echo # In 5.5 due to fix for bug #53921 "Wrong locks for SELECTs
+--echo # used stored functions may lead to broken SBR" strong locks
+--echo # are taken (we accepted it as a trade-off for this fix).
+let $statement= select f15();
+let $restore_table= ;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 5.4 INSERT which calls function which doesn't modify data and
+--echo # uses CALL statement which reads table through SELECT.
+--echo #
+--echo # Since such statement is written to the binary log it should
+--echo # be serialized with concurrent statements affecting data it
+--echo # uses. Therefore it should take strong locks on data it reads.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken.
+let $statement= insert into t2 values (f15()+5);
+let $restore_table= t2;
+--source include/check_concurrent_insert.inc
+
+
+--echo #
+--echo # 6. Statements that use triggers.
+--echo #
+
+--echo #
+--echo # 6.1 Statement invoking a trigger that reads table via SELECT.
+--echo #
+--echo # Since this statement is written to the binary log it should
+--echo # be serialized with concurrent statements affecting the data
+--echo # it uses. Therefore, it should take strong locks on the data
+--echo # it reads.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken.
+let $statement= insert into t4 values (2);
+let $restore_table= t4;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 6.2 Statement invoking a trigger that reads table through
+--echo # a subquery in a control construct.
+--echo #
+--echo # The above is true for this statement as well.
+let $statement= update t4 set l= 2 where l = 1;
+let $restore_table= t4;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 6.3 Statement invoking a trigger that reads a table through
+--echo # a view.
+--echo #
+--echo # And for this statement.
+let $statement= delete from t4 where l = 1;
+let $restore_table= t4;
+--source include/check_no_concurrent_insert.inc
+
+--echo #
+--echo # 6.4 Statement invoking a trigger that reads a table through
+--echo # a stored function.
+--echo #
+--echo # And for this statement.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken.
+let $statement= insert into t5 values (2);
+let $restore_table= t5;
+--source include/check_concurrent_insert.inc
+
+--echo #
+--echo # 6.5 Statement invoking a trigger that reads a table through
+--echo # stored procedure.
+--echo #
+--echo # And for this statement.
+--echo # But due to bug #53921 "Wrong locks for SELECTs used stored
+--echo # functions may lead to broken SBR" weak locks are taken.
+let $statement= update t5 set l= 2 where l = 1;
+let $restore_table= t5;
+--source include/check_concurrent_insert.inc
+
+
+--echo # Clean-up.
+drop function f1;
+drop function f2;
+drop function f3;
+drop function f4;
+drop function f5;
+drop function f6;
+drop function f7;
+drop function f8;
+drop function f9;
+drop function f10;
+drop function f11;
+drop function f12;
+drop function f13;
+drop function f14;
+drop function f15;
+drop view v1, v2;
+drop procedure p1;
+drop procedure p2;
+drop table t1, t2, t3, t4, t5, te;
+
+disconnect con1;
+disconnect con2;
+
+set @@global.concurrent_insert= @old_concurrent_insert;
+
+
+# Check that all connections opened by test cases in this file are really
+# gone so execution of other tests won't be affected by their presence.
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test
index e40dd1e3491..05e17dc9fa7 100644
--- a/mysql-test/t/log_state.test
+++ b/mysql-test/t/log_state.test
@@ -362,6 +362,42 @@ if(!$fixed_bug38124)
}
+###########################################################################
+
+--echo #
+--echo # Bug #49756 Rows_examined is always 0 in the slow query log
+--echo # for update statements
+--echo #
+
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = "TABLE";
+SET GLOBAL slow_query_log = ON;
+SET GLOBAL long_query_time = 0.001;
+
+# clear slow_log of any residual slow queries
+TRUNCATE TABLE mysql.slow_log;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT, PRIMARY KEY (b));
+INSERT INTO t2 VALUES (3),(4);
+
+connect (con2,localhost,root,,);
+INSERT INTO t1 VALUES (1+sleep(.01)),(2);
+INSERT INTO t1 SELECT b+sleep(.01) from t2;
+UPDATE t1 SET a=a+sleep(.01) WHERE a>2;
+UPDATE t1 SET a=a+sleep(.01) ORDER BY a DESC;
+UPDATE t2 set b=b+sleep(.01) limit 1;
+UPDATE t1 SET a=a+sleep(.01) WHERE a in (SELECT b from t2);
+DELETE FROM t1 WHERE a=a+sleep(.01) ORDER BY a LIMIT 2;
+
+SELECT rows_examined,sql_text FROM mysql.slow_log;
+disconnect con2;
+connection default;
+DROP TABLE t1,t2;
+TRUNCATE TABLE mysql.slow_log;
+
+--echo # end of bug#49756
+
+
--echo End of 5.1 tests
--enable_ps_protocol
@@ -376,6 +412,8 @@ disconnect con1;
connection default;
# Reset global system variables to initial values if forgotten somewhere above.
+SET GLOBAL long_query_time = DEFAULT;
+SET GLOBAL log_output = @old_log_output;
SET global general_log = @old_general_log;
SET global general_log_file = @old_general_log_file;
SET global slow_query_log = @old_slow_query_log;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index b32a329f827..87e952dd069 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -589,7 +589,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 be the UPDATE query event */;
+let wait_binlog_event= UPDATE;
+source include/wait_for_binlog_event.inc;
# B. testing multi_update::send_error() ineffective update
# (as there is a policy described at mysql_update() still go to binlog)
@@ -600,7 +601,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 the UPDATE query event */;
+let wait_binlog_event= UPDATE;
+source include/wait_for_binlog_event.inc;
# cleanup
drop table t1, t2;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 02923bd6e6f..f1a00368e12 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -2134,6 +2134,35 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
SET NAMES default;
DROP TABLE t1, t2;
+###########################################################################
+
+--echo #
+--echo # Bug #53088: mysqldump with -T & --default-character-set set
+--echo # truncates text/blob to 766 chars
+--echo #
+--echo # Also see outfile_loaddata.test
+--echo #
+
+CREATE TABLE t1 (a BLOB) CHARSET latin1;
+CREATE TABLE t2 LIKE t1;
+
+let $table= t1;
+let $dir= $MYSQLTEST_VARDIR/tmp;
+let $file= $dir/$table.txt;
+let $length= 800;
+
+--eval INSERT INTO t1 VALUES (REPEAT('.', $length))
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --default-character-set=latin1 --tab=$dir/ test $table
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1
+--remove_file $file
+
+--echo # should be $length
+SELECT LENGTH(a) FROM t2;
+
+DROP TABLE t1, t2;
###########################################################################
--echo #
diff --git a/mysql-test/t/mysqlhotcopy_archive.test b/mysql-test/t/mysqlhotcopy_archive.test
new file mode 100644
index 00000000000..4bfad3ce138
--- /dev/null
+++ b/mysql-test/t/mysqlhotcopy_archive.test
@@ -0,0 +1,8 @@
+# Test of mysqlhotcopy (perl script)
+# Author: Horst Hunger
+# Created: 2010-05-10
+
+--source include/have_archive.inc
+let $engine= archive;
+--source include/mysqlhotcopy.inc
+--exit
diff --git a/mysql-test/t/mysqlhotcopy_myisam.test b/mysql-test/t/mysqlhotcopy_myisam.test
new file mode 100644
index 00000000000..adf26e42245
--- /dev/null
+++ b/mysql-test/t/mysqlhotcopy_myisam.test
@@ -0,0 +1,7 @@
+# Test of mysqlhotcopy (perl script)
+# Author: Horst Hunger
+# Created: 2010-05-10
+
+let $engine= MyISAM;
+--source include/mysqlhotcopy.inc
+--exit
diff --git a/mysql-test/t/outfile_loaddata.test b/mysql-test/t/outfile_loaddata.test
index 3f62acbd214..26760f9a1b2 100644
--- a/mysql-test/t/outfile_loaddata.test
+++ b/mysql-test/t/outfile_loaddata.test
@@ -251,6 +251,40 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
SET NAMES default;
DROP TABLE t1, t2;
+###########################################################################
+
+--echo #
+--echo # Bug #53088: mysqldump with -T & --default-character-set set
+--echo # truncates text/blob to 766 chars
+--echo #
+--echo # Also see mysqldump.test
+--echo #
+
+CREATE TABLE t1 (a BLOB) CHARSET latin1;
+CREATE TABLE t2 LIKE t1;
+
+let $file= '$MYSQLTEST_VARDIR/tmp/bug53088.txt';
+let $length= 800;
+
+--eval INSERT INTO t1 VALUES (REPEAT('.', $length))
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT * INTO OUTFILE $file CHARACTER SET latin1 FROM t1
+
+--echo # should be greater than $length
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT LENGTH(LOAD_FILE($file))
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE $file INTO TABLE t2
+
+--remove_file $MYSQLTEST_VARDIR/tmp/bug53088.txt
+
+--echo # should be $length
+SELECT LENGTH(a) FROM t2;
+
+DROP TABLE t1, t2;
+
###########################################################################
--echo # End of 5.1 tests.
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
index 8da8f54b774..434392c2e28 100644
--- a/mysql-test/t/partition_error.test
+++ b/mysql-test/t/partition_error.test
@@ -7,7 +7,36 @@
--disable_warnings
drop table if exists t1;
--enable_warnings
-
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+--echo #
+--echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
+--echo #
+CREATE TABLE t1 (a INT) PARTITION BY HASH (a);
+FLUSH TABLES;
+--remove_file $MYSQLD_DATADIR/test/t1.par
+--replace_result $MYSQLD_DATADIR ./
+CHECK TABLE t1;
+--error ER_UNKNOWN_ERROR
+SELECT * FROM t1;
+--echo # Note that it is currently impossible to drop a partitioned table
+--echo # without the .par file
+--error ER_BAD_TABLE_ERROR
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.frm
+--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYI
+--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYD
+
+--echo #
+--echo # Bug#49477: Assertion `0' failed in ha_partition.cc:5530
+--echo # with temporary table and partitions
+--echo #
+CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
+--error ER_PARTITION_NO_TEMPORARY
+CREATE TEMPORARY TABLE tmp_t1 LIKE t1;
+DROP TABLE t1;
+
--echo #
--echo # Bug#50392: insert_id is not reset for partitioned tables
--echo # auto_increment on duplicate entry
@@ -158,7 +187,6 @@ partitions 3
partition x2 tablespace ts2,
partition x3 tablespace ts3);
-let $MYSQLD_DATADIR= `select @@datadir`;
select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Partition by hash, invalid field in function
diff --git a/mysql-test/t/renamedb.test b/mysql-test/t/renamedb.test
index 84315090b7a..71d0c127058 100644
--- a/mysql-test/t/renamedb.test
+++ b/mysql-test/t/renamedb.test
@@ -44,7 +44,7 @@ ALTER DATABASE `#mysql41#not-supported` UPGRADE DATA DIRECTORY NAME;
--error ER_WRONG_USAGE
ALTER DATABASE `#mysql51#not-yet` UPGRADE DATA DIRECTORY NAME;
---error ER_WRONG_USAGE
+--error ER_WRONG_DB_NAME
ALTER DATABASE `#mysql50#` UPGRADE DATA DIRECTORY NAME;
--error ER_BAD_DB_ERROR
diff --git a/mysql-test/t/schema.test b/mysql-test/t/schema.test
index a08d9b38935..a63402bbb83 100644
--- a/mysql-test/t/schema.test
+++ b/mysql-test/t/schema.test
@@ -4,6 +4,9 @@
# Drop mysqltest1 database, as it can left from the previous tests.
#
+# Save the initial number of concurrent sessions.
+--source include/count_sessions.inc
+
--disable_warnings
drop database if exists mysqltest1;
--enable_warnings
@@ -12,3 +15,47 @@ create schema foo;
show create schema foo;
show schemas;
drop schema foo;
+
+
+--echo #
+--echo # Bug#54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER
+--echo #
+
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (a INT);
+INSERT INTO db1.t1 VALUES (1), (2);
+
+--echo # Connection con1
+connect (con1, localhost, root);
+HANDLER db1.t1 OPEN;
+
+--echo # Connection default
+connection default;
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection con2
+connect (con2, localhost, root);
+--echo # Waiting for 'DROP DATABASE db1' to sync in.
+let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE state='Waiting for table' AND info='DROP DATABASE db1';
+--source include/wait_condition.inc
+
+--echo # Connection con1
+connection con1;
+# All these statements before resulted in deadlock.
+CREATE DATABASE db2;
+ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
+DROP DATABASE db2;
+
+--echo # Connection default
+connection default;
+--echo # Reaping: DROP DATABASE db1
+--reap
+disconnect con1;
+disconnect con2;
+
+
+# Check that all connections opened by test cases in this file are really
+# gone so execution of other tests won't be affected by their presence.
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index f61db538fb4..db08aad0df0 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -4077,4 +4077,15 @@ SELECT * FROM t1 WHERE 102 < c;
DROP TABLE t1;
+--echo #
+--echo # Bug #54459: Assertion failed: param.sort_length,
+--echo # file .\filesort.cc, line 149 (part II)
+--echo #
+CREATE TABLE t1(a ENUM('') NOT NULL);
+INSERT INTO t1 VALUES (), (), ();
+EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+DROP TABLE t1;
+
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test
index 2f2b84a9bef..5eccbf81fef 100644
--- a/mysql-test/t/sp_trans_log.test
+++ b/mysql-test/t/sp_trans_log.test
@@ -34,8 +34,8 @@ end|
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 */|
+# with fixes for 23333 will show there is the query */|
+--source include/show_binlog_events.inc
select count(*),@a from t1 /* must be 1,1 */|
delimiter ;|
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index ffbd56c198d..89be351312d 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3711,3 +3711,28 @@ GROUP BY
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
+
+
+--echo #
+--echo # Bug #52711: Segfault when doing EXPLAIN SELECT with
+--echo # union...order by (select... where...)
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+
+--echo # Should not crash
+--disable_result_log
+EXPLAIN
+SELECT * FROM t2 UNION SELECT * FROM t2
+ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+
+--echo # Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+DROP TABLE t1,t2;
+--enable_result_log
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
index 5bb521601e5..34331b72688 100644
--- a/mysql-test/t/type_time.test
+++ b/mysql-test/t/type_time.test
@@ -88,5 +88,15 @@ INSERT INTO t1 VALUES ('0:00:00');
SELECT CAST(c AS TIME) FROM t1;
DROP TABLE t1;
-
--echo End of 5.0 tests
+
+--echo #
+--echo # Bug#53942 valgrind warnings with timestamp() function and incomplete datetime values
+--echo #
+
+CREATE TABLE t1(f1 TIME);
+INSERT INTO t1 VALUES ('23:38:57');
+SELECT TIMESTAMP(f1,'1') FROM t1;
+DROP TABLE t1;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test
index e390e8a1253..a7b9a1531ff 100644
--- a/mysql-test/t/upgrade.test
+++ b/mysql-test/t/upgrade.test
@@ -137,3 +137,37 @@ select * from `a-b-c`.v1;
--enable_ps_protocol
drop database `a-b-c`;
use test;
+
+--echo # End of 5.0 tests
+
+--echo #
+--echo # Bug #53804: serious flaws in the alter database .. upgrade data
+--echo # directory name command
+--echo #
+
+--error ER_BAD_DB_ERROR
+ALTER DATABASE `#mysql50#:` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#.` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#../` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#../..` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#../../` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#./blablabla` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#../blablabla` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#/` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#/.` UPGRADE DATA DIRECTORY NAME;
+
+--error ER_WRONG_DB_NAME
+USE `#mysql50#.`;
+--error ER_WRONG_DB_NAME
+USE `#mysql50#../blablabla`;
+
+--echo # End of 5.1 tests
+
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 94dba1e8ff6..3e9dc5e39d3 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -362,7 +362,7 @@ set global table_open_cache=100;
set storage_engine=myisam;
set global thread_cache_size=100;
set timestamp=1, timestamp=default;
-set tmp_table_size=100;
+set tmp_table_size=1024;
set tx_isolation="READ-COMMITTED";
set wait_timeout=100;
set log_warnings=1;
@@ -778,6 +778,21 @@ show variables like 'hostname';
--echo # Test 'myisam_mmap_size' option is not dynamic
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@myisam_mmap_size= 500M;
+
+
+--echo #
+--echo # Bug #52315: utc_date() crashes when system time > year 2037
+--echo #
+
+--error 0, ER_UNKNOWN_ERROR
+SET TIMESTAMP=2*1024*1024*1024;
+--echo #Should not crash
+--disable_result_log
+SELECT UTC_DATE();
+--enable_result_log
+SET TIMESTAMP=DEFAULT;
+
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/variables_debug.test b/mysql-test/t/variables_debug.test
index 8f2bde7ae42..12f5d2e6ca5 100644
--- a/mysql-test/t/variables_debug.test
+++ b/mysql-test/t/variables_debug.test
@@ -1,5 +1,7 @@
--source include/have_debug.inc
+SET @old_debug = @@GLOBAL.debug;
+
#
# Bug#34678 @@debug variable's incremental mode
#
@@ -21,5 +23,6 @@ SELECT @@global.debug;
SET GLOBAL debug='';
SELECT @@global.debug;
+SET GLOBAL debug=@old_debug;
--echo End of 5.1 tests
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
index 0dd1c5ce09f..1919b79461d 100644
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@ -1051,3 +1051,9 @@
fun:__libc_res_nsend
fun:__libc_res_nquery
}
+
+{
+ buf_buddy_relocate peeking (space,page) in potentially free blocks
+ Memcheck:Addr1
+ fun:buf_buddy_relocate
+}
diff --git a/mysys/mf_wfile.c b/mysys/mf_wfile.c
index f98d348994e..4a4fb466600 100644
--- a/mysys/mf_wfile.c
+++ b/mysys/mf_wfile.c
@@ -119,6 +119,6 @@ void wf_end(WF_PACK *buffer)
{
DBUG_ENTER("wf_end");
if (buffer)
- my_free((uchar*) buffer,MYF(0));
+ my_free(buffer, MYF(0));
DBUG_VOID_RETURN;
} /* wf_end */
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index 8d3bc0c3fb2..948d3a8476d 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -153,6 +153,14 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
DBUG_ASSERT(alloc_root_inited(mem_root));
+ DBUG_EXECUTE_IF("simulate_out_of_memory",
+ {
+ if (mem_root->error_handler)
+ (*mem_root->error_handler)();
+ DBUG_SET("-d,simulate_out_of_memory");
+ DBUG_RETURN((void*) 0); /* purecov: inspected */
+ });
+
length+=ALIGN_SIZE(sizeof(USED_MEM));
if (!(next = (USED_MEM*) my_malloc(length,MYF(MY_WME))))
{
@@ -175,6 +183,14 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
DBUG_PRINT("enter",("root: 0x%lx", (long) mem_root));
DBUG_ASSERT(alloc_root_inited(mem_root));
+ DBUG_EXECUTE_IF("simulate_out_of_memory",
+ {
+ /* Avoid reusing an already allocated block */
+ if (mem_root->error_handler)
+ (*mem_root->error_handler)();
+ DBUG_SET("-d,simulate_out_of_memory");
+ DBUG_RETURN((void*) 0); /* purecov: inspected */
+ });
length= ALIGN_SIZE(length);
if ((*(prev= &mem_root->free)) != NULL)
{
@@ -275,7 +291,7 @@ void *multi_alloc_root(MEM_ROOT *root, ...)
DBUG_RETURN((void*) start);
}
-#define TRASH_MEM(X) VALGRIND_MAKE_MEM_UNDEFINED(((char*)(X) + ((X)->size-(X)->left)), (X)->left)
+#define TRASH_MEM(X) TRASH(((char*)(X) + ((X)->size-(X)->left)), (X)->left)
/* Mark all data in blocks free for reusage */
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index 137127a2fda..69e0ca18cb8 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -378,6 +378,24 @@ void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
}
}
+/* True if union of bitmaps have all bits set */
+
+my_bool bitmap_union_is_set_all(const MY_BITMAP *map1, const MY_BITMAP *map2)
+{
+ my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
+
+ DBUG_ASSERT(map1->bitmap && map2->bitmap &&
+ map1->n_bits==map2->n_bits);
+ *map1->last_word_ptr|= map1->last_word_mask;
+
+ end= map1->last_word_ptr;
+ while ( m1 <= end)
+ if ((*m1++ | *m2++) != 0xFFFFFFFF)
+ return FALSE;
+ return TRUE;
+}
+
+
/*
Set/clear all bits above a bit.
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 1c5aa3735ec..82a691d550a 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -22,7 +22,7 @@
#include <errno.h>
#include <m_string.h>
-typedef void (*init_func_p)(const struct my_option *option, uchar* *variable,
+typedef void (*init_func_p)(const struct my_option *option, void *variable,
longlong value);
static void default_reporter(enum loglevel level, const char *format, ...);
@@ -40,11 +40,12 @@ static ulonglong getopt_ull(char *arg, const struct my_option *optp,
static double getopt_double(char *arg, const struct my_option *optp, int *err);
static void init_variables(const struct my_option *options,
init_func_p init_one_value);
-static void init_one_value(const struct my_option *opt, uchar* *, longlong);
-static void fini_one_value(const struct my_option *option, uchar* *variable,
+static void init_one_value(const struct my_option *option, void *variable,
longlong value);
-static int setval(const struct my_option *opts, uchar **value, char *argument,
- my_bool set_maximum_value);
+static void fini_one_value(const struct my_option *option, void *variable,
+ longlong value);
+static int setval(const struct my_option *opts, void *value, char *argument,
+ my_bool set_maximum_value);
static char *check_struct_option(char *cur_arg, char *key_name);
/*
@@ -100,10 +101,9 @@ static void default_reporter(enum loglevel level,
one. Call function 'get_one_option()' once for each option.
*/
-static uchar** (*getopt_get_addr)(const char *, uint, const struct my_option *, int *);
+static my_getopt_value getopt_get_addr;
-void my_getopt_register_get_addr(uchar** (*func_addr)(const char *, uint,
- const struct my_option *, int *))
+void my_getopt_register_get_addr(my_getopt_value func_addr)
{
getopt_get_addr= func_addr;
}
@@ -118,7 +118,7 @@ int handle_options(int *argc, char ***argv,
char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found),
*opt_str, key_name[FN_REFLEN];
const struct my_option *optp;
- uchar* *value;
+ void *value;
int error, i;
LINT_INIT(opt_found);
@@ -172,7 +172,7 @@ int handle_options(int *argc, char ***argv,
"%s: Option '--set-variable' is deprecated. "
"Use --variable-name=value instead.",
my_progname);
-
+
must_be_var= 1;
if (cur_arg[13] == '=')
{
@@ -377,7 +377,7 @@ int handle_options(int *argc, char ***argv,
optp->value;
if (error)
return error;
-
+
if (optp->arg_type == NO_ARG)
{
if (optend && (optp->var_type & GET_TYPE_MASK) != GET_BOOL)
@@ -405,8 +405,8 @@ int handle_options(int *argc, char ***argv,
else
{
my_getopt_error_reporter(WARNING_LEVEL,
- "%s: ignoring option '--%s' due to \
-invalid value '%s'",
+ "%s: ignoring option '--%s' due to "
+ "invalid value '%s'",
my_progname, optp->name, optend);
continue;
}
@@ -610,7 +610,7 @@ static char *check_struct_option(char *cur_arg, char *key_name)
Will set the option value to given value
*/
-static int setval(const struct my_option *opts, uchar* *value, char *argument,
+static int setval(const struct my_option *opts, void *value, char *argument,
my_bool set_maximum_value)
{
int err= 0;
@@ -618,8 +618,7 @@ static int setval(const struct my_option *opts, uchar* *value, char *argument,
if (value && argument)
{
- uchar* *result_pos= ((set_maximum_value) ?
- opts->u_max_value : value);
+ void *result_pos= ((set_maximum_value) ? opts->u_max_value : value);
if (!result_pos)
return EXIT_NO_PTR_TO_VARIABLE;
@@ -994,7 +993,7 @@ static double getopt_double(char *arg, const struct my_option *optp, int *err)
value Pointer to variable
*/
-static void init_one_value(const struct my_option *option, uchar* *variable,
+static void init_one_value(const struct my_option *option, void *variable,
longlong value)
{
DBUG_ENTER("init_one_value");
@@ -1068,7 +1067,7 @@ static void init_one_value(const struct my_option *option, uchar* *variable,
value Pointer to variable
*/
-static void fini_one_value(const struct my_option *option, uchar* *variable,
+static void fini_one_value(const struct my_option *option, void *variable,
longlong value __attribute__ ((unused)))
{
DBUG_ENTER("fini_one_value");
@@ -1109,7 +1108,7 @@ static void init_variables(const struct my_option *options,
DBUG_ENTER("init_variables");
for (; options->name; options++)
{
- uchar* *variable;
+ void *variable;
DBUG_PRINT("options", ("name: '%s'", options->name));
/*
We must set u_max_value first as for some variables
@@ -1224,7 +1223,7 @@ void my_print_variables(const struct my_option *options)
printf("--------------------------------- -----------------------------\n");
for (optp= options; optp->id; optp++)
{
- uchar* *value= (optp->var_type & GET_ASK_ADDR ?
+ void *value= (optp->var_type & GET_ASK_ADDR ?
(*getopt_get_addr)("", 0, optp, 0) : optp->value);
if (value)
{
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index 12af5603a93..330ef07ed30 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -34,13 +34,23 @@ void *my_malloc(size_t size, myf my_flags)
if (!size)
size=1; /* Safety */
- if ((point = (char*)malloc(size)) == NULL)
+
+ point= (char *) malloc(size);
+ DBUG_EXECUTE_IF("simulate_out_of_memory",
+ {
+ free(point);
+ point= NULL;
+ });
+
+ if (point == NULL)
{
my_errno=errno;
if (my_flags & MY_FAE)
error_handler_hook=fatal_error_handler_hook;
if (my_flags & (MY_FAE+MY_WME))
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH),size);
+ DBUG_EXECUTE_IF("simulate_out_of_memory",
+ DBUG_SET("-d,simulate_out_of_memory"););
if (my_flags & MY_FAE)
exit(1);
}
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index d6cd3896b08..0d0ae2dabe5 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -139,6 +139,11 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
size + /* size requested */
4 + /* overrun mark */
sf_malloc_endhunc);
+ DBUG_EXECUTE_IF("simulate_out_of_memory",
+ {
+ free(irem);
+ irem= NULL;
+ });
}
/* Check if there isn't anymore memory avaiable */
if (!irem)
@@ -159,6 +164,8 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
}
DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'",
(ulong) sf_malloc_max_memory,lineno, filename));
+ DBUG_EXECUTE_IF("simulate_out_of_memory",
+ DBUG_SET("-d,simulate_out_of_memory"););
if (MyFlags & MY_FAE)
exit(1);
DBUG_RETURN ((void*) 0);
@@ -190,9 +197,12 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
sf_malloc_count++;
pthread_mutex_unlock(&THR_LOCK_malloc);
+ MEM_CHECK_ADDRESSABLE(data, size);
/* Set the memory to the aribtrary wierd value */
if ((MyFlags & MY_ZEROFILL) || !sf_malloc_quick)
bfill(data, size, (char) (MyFlags & MY_ZEROFILL ? 0 : ALLOC_VAL));
+ if (!(MyFlags & MY_ZEROFILL))
+ MEM_UNDEFINED(data, size);
/* Return a pointer to the real data */
DBUG_PRINT("exit",("ptr: %p", data));
if (sf_min_adress > data)
@@ -312,7 +322,9 @@ void _myfree(void *ptr, const char *filename, uint lineno, myf myflags)
if (!sf_malloc_quick)
bfill(ptr, irem->datasize, (pchar) FREE_VAL);
#endif
+ MEM_NOACCESS(ptr, irem->datasize);
*((uint32*) ((char*) ptr- sizeof(uint32)))= ~MAGICKEY;
+ MEM_NOACCESS((char*) ptr - sizeof(uint32), sizeof(uint32));
/* Actually free the memory */
free((char*) irem);
DBUG_VOID_RETURN;
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c
index 75fda93b56e..80122a4e70f 100644
--- a/mysys/stacktrace.c
+++ b/mysys/stacktrace.c
@@ -86,7 +86,7 @@ void my_print_stacktrace(uchar* stack_bottom __attribute__((unused)),
#if BACKTRACE_DEMANGLE
-char __attribute__ ((weak)) *my_demangle(const char *mangled_name, int *status)
+char __attribute__ ((weak)) *my_demangle(const char *mangled_name __attribute__((unused)), int *status __attribute__((unused)))
{
return NULL;
}
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index b710a7eee39..386691be4de 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -306,7 +306,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
#if defined(MAIN) && !defined(__bsdi__)
printf("thread_alarm in process_alarm\n"); fflush(stdout);
#endif
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */
#endif
return;
@@ -325,7 +325,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
#endif
process_alarm_part2(sig);
#ifndef USE_ALARM_THREAD
-#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
+#if defined(SIGNAL_HANDLER_RESET_ON_DELIVERY) && !defined(USE_ONE_SIGNAL_HAND)
my_sigset(THR_SERVER_ALARM,process_alarm);
#endif
pthread_mutex_unlock(&LOCK_alarm);
@@ -523,12 +523,12 @@ void thr_alarm_info(ALARM_INFO *info)
*/
-static sig_handler thread_alarm(int sig)
+static sig_handler thread_alarm(int sig __attribute__((unused)))
{
#ifdef MAIN
printf("thread_alarm\n"); fflush(stdout);
#endif
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
my_sigset(sig,thread_alarm); /* int. thread system calls */
#endif
}
@@ -797,7 +797,7 @@ static sig_handler print_signal_warning(int sig)
{
printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name());
fflush(stdout);
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
my_sigset(sig,print_signal_warning); /* int. thread system calls */
#endif
if (sig == SIGALRM)
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index eb2cc94afe9..c89c7cd875e 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -522,9 +522,11 @@ $CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \
mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \
mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \
$BASE/mysql-test/std_data
-$CP mysql-test/t/*.test mysql-test/t/*.imtest \
- mysql-test/t/*.disabled mysql-test/t/*.opt \
- mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t
+# Attention: when the wildcards expand to a line that is very long,
+# it may exceed the command line length limit on some platform(s). Bug#54590
+$CP mysql-test/t/*.test mysql-test/t/*.imtest $BASE/mysql-test/t
+$CP mysql-test/t/*.disabled mysql-test/t/*.opt $BASE/mysql-test/t
+$CP mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t
$CP mysql-test/r/*.result mysql-test/r/*.require \
$BASE/mysql-test/r
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index ea00b3a183b..8bae2ec9db1 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -479,7 +479,7 @@ then
echo "Support MariaDB development by buying support/new features from"
echo "Monty Program Ab. You can contact us about this at sales@askmonty.org".
echo "Alternatively consider joining our community based development effort:"
- echo "http://askmonty.org/wiki/index.php/MariaDB#How_can_I_participate_in_the_development_of_MariaDB.3F"
+ echo "http://askmonty.org/wiki/index.php/MariaDB#How_can_I_participate_in_the_development_of_MariaDB"
echo
fi
diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc
index 75a18c5b43a..b9f8b103315 100644
--- a/server-tools/instance-manager/options.cc
+++ b/server-tools/instance-manager/options.cc
@@ -153,14 +153,14 @@ static struct my_option my_long_options[] =
#ifndef __WIN__
{ "angel-pid-file", OPT_ANGEL_PID_FILE, "Pid file for angel process.",
- (uchar* *) &Options::Daemon::angel_pid_file_name,
- (uchar* *) &Options::Daemon::angel_pid_file_name,
+ &Options::Daemon::angel_pid_file_name,
+ &Options::Daemon::angel_pid_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
#endif
{ "bind-address", OPT_BIND_ADDRESS, "Bind address to use for connection.",
- (uchar* *) &Options::Main::bind_address,
- (uchar* *) &Options::Main::bind_address,
+ &Options::Main::bind_address,
+ &Options::Main::bind_address,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "check-password-file", OPT_CHECK_PASSWORD_FILE,
@@ -173,15 +173,15 @@ static struct my_option my_long_options[] =
#ifndef DBUG_OFF
{"debug", '#', "Debug log.",
- (uchar* *) &Options::Debug::config_str,
- (uchar* *) &Options::Debug::config_str,
+ &Options::Debug::config_str,
+ &Options::Debug::config_str,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{ "default-mysqld-path", OPT_MYSQLD_PATH, "Where to look for MySQL"
" Server binary.",
- (uchar* *) &Options::Main::default_mysqld_path,
- (uchar* *) &Options::Main::default_mysqld_path,
+ &Options::Main::default_mysqld_path,
+ &Options::Main::default_mysqld_path,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 },
{ "drop-user", OPT_DROP_USER,
@@ -194,8 +194,8 @@ static struct my_option my_long_options[] =
#ifdef __WIN__
{ "install", OPT_INSTALL_SERVICE, "Install as system service.",
- (uchar* *) &Options::Service::install_as_service,
- (uchar* *) &Options::Service::install_as_service,
+ &Options::Service::install_as_service,
+ &Options::Service::install_as_service,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 },
#endif
@@ -205,22 +205,22 @@ static struct my_option my_long_options[] =
#ifndef __WIN__
{ "log", OPT_LOG, "Path to log file. Used only with --run-as-service.",
- (uchar* *) &Options::Daemon::log_file_name,
- (uchar* *) &Options::Daemon::log_file_name,
+ &Options::Daemon::log_file_name,
+ &Options::Daemon::log_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
#endif
{ "monitoring-interval", OPT_MONITORING_INTERVAL, "Interval to monitor"
" instances in seconds.",
- (uchar* *) &Options::Main::monitoring_interval,
- (uchar* *) &Options::Main::monitoring_interval,
+ &Options::Main::monitoring_interval,
+ &Options::Main::monitoring_interval,
0, GET_UINT, REQUIRED_ARG, DEFAULT_MONITORING_INTERVAL,
0, 0, 0, 0, 0 },
{ "mysqld-safe-compatible", OPT_MYSQLD_SAFE_COMPATIBLE,
"Start Instance Manager in mysqld_safe-compatible manner.",
- (uchar* *) &Options::Main::mysqld_safe_compatible,
- (uchar* *) &Options::Main::mysqld_safe_compatible,
+ &Options::Main::mysqld_safe_compatible,
+ &Options::Main::mysqld_safe_compatible,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 },
{ "print-password-line", OPT_PRINT_PASSWORD_LINE,
@@ -228,61 +228,61 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "password", OPT_PASSWORD, "Password to update the password file.",
- (uchar* *) &Options::User_management::password,
- (uchar* *) &Options::User_management::password,
+ &Options::User_management::password,
+ &Options::User_management::password,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "password-file", OPT_PASSWORD_FILE,
"Look for Instance Manager users and passwords here.",
- (uchar* *) &Options::Main::password_file_name,
- (uchar* *) &Options::Main::password_file_name,
+ &Options::Main::password_file_name,
+ &Options::Main::password_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "pid-file", OPT_PID_FILE, "Pid file to use.",
- (uchar* *) &Options::Main::pid_file_name,
- (uchar* *) &Options::Main::pid_file_name,
+ &Options::Main::pid_file_name,
+ &Options::Main::pid_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "port", OPT_PORT, "Port number to use for connections.",
- (uchar* *) &Options::Main::port_number,
- (uchar* *) &Options::Main::port_number,
+ &Options::Main::port_number,
+ &Options::Main::port_number,
0, GET_UINT, REQUIRED_ARG, DEFAULT_PORT, 0, 0, 0, 0, 0 },
#ifdef __WIN__
{ "remove", OPT_REMOVE_SERVICE, "Remove system service.",
- (uchar* *) &Options::Service::remove_service,
- (uchar* *) &Options::Service::remove_service,
+ &Options::Service::remove_service,
+ &Options::Service::remove_service,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0},
#else
{ "run-as-service", OPT_RUN_AS_SERVICE,
"Daemonize and start angel process.",
- (uchar* *) &Options::Daemon::run_as_service,
+ &Options::Daemon::run_as_service,
0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 },
#endif
#ifndef __WIN__
{ "socket", OPT_SOCKET, "Socket file to use for connection.",
- (uchar* *) &Options::Main::socket_file_name,
- (uchar* *) &Options::Main::socket_file_name,
+ &Options::Main::socket_file_name,
+ &Options::Main::socket_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
#endif
#ifdef __WIN__
{ "standalone", OPT_STAND_ALONE, "Run the application in stand alone mode.",
- (uchar* *) &Options::Service::stand_alone,
- (uchar* *) &Options::Service::stand_alone,
+ &Options::Service::stand_alone,
+ &Options::Service::stand_alone,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0},
#else
{ "user", OPT_USER, "Username to start mysqlmanager.",
- (uchar* *) &Options::Daemon::user,
- (uchar* *) &Options::Daemon::user,
+ &Options::Daemon::user,
+ &Options::Daemon::user,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
#endif
{ "username", OPT_USERNAME,
"Username to update the password file.",
- (uchar* *) &Options::User_management::user_name,
- (uchar* *) &Options::User_management::user_name,
+ &Options::User_management::user_name,
+ &Options::User_management::user_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "version", 'V', "Output version information and exit.", 0, 0, 0,
@@ -290,8 +290,8 @@ static struct my_option my_long_options[] =
{ "wait-timeout", OPT_WAIT_TIMEOUT, "The number of seconds IM waits "
"for activity on a connection before closing it.",
- (uchar* *) &net_read_timeout,
- (uchar* *) &net_read_timeout,
+ &net_read_timeout,
+ &net_read_timeout,
0, GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }
diff --git a/sql-common/client.c b/sql-common/client.c
index 18f01661c0a..2cad8df1f9b 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -2986,6 +2986,11 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
goto error;
}
+ /*
+ Using init_commands is not supported when connecting from within the
+ server.
+ */
+#ifndef MYSQL_SERVER
if (mysql->options.init_commands)
{
DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
@@ -2997,18 +3002,26 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
for (; ptr < end_command; ptr++)
{
- MYSQL_RES *res;
+ int status;
+
if (mysql_real_query(mysql,*ptr, (ulong) strlen(*ptr)))
goto error;
- if (mysql->fields)
- {
- if (!(res= cli_use_result(mysql)))
- goto error;
- mysql_free_result(res);
- }
+
+ do {
+ if (mysql->fields)
+ {
+ MYSQL_RES *res;
+ if (!(res= cli_use_result(mysql)))
+ goto error;
+ mysql_free_result(res);
+ }
+ if ((status= mysql_next_result(mysql)) > 0)
+ goto error;
+ } while (status == 0);
}
mysql->reconnect=reconnect;
}
+#endif
#ifndef TO_BE_DELETED
if (mysql->options.rpl_probe && mysql_rpl_probe(mysql))
diff --git a/sql/authors.h b/sql/authors.h
index 4a321bebb7d..bab319e3dcb 100644
--- a/sql/authors.h
+++ b/sql/authors.h
@@ -86,6 +86,7 @@ struct show_table_authors_st show_table_authors[]= {
{ "Eric Herman", "Amsterdam, Netherlands", "Bug fixing - federated" },
{ "Andrey Hristov", "Walldorf, Germany", "Event scheduler (5.1)" },
{ "Alexander (Alexi) Ivanov", "St. Petersburg, Russia", "Replication" },
+ { "Mattias Jonsson", "Uppsala, Sweden", "Partitioning" },
{ "Alexander (Salle) Keremidarski", "Sofia, Bulgaria",
"Bug fixing" },
{ "Mats Kindahl", "Storvreta, Sweden", "Replication" },
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index 9b428ed6ec9..959f6ec06c0 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -833,8 +833,9 @@ bool get_next_time(const Time_zone *time_zone, my_time_t *next,
}
else
{
- long diff_months= (long) (local_now.year - local_start.year)*12 +
- (local_now.month - local_start.month);
+ long diff_months= ((long) local_now.year - (long) local_start.year)*12 +
+ ((long) local_now.month - (long) local_start.month);
+
/*
Unlike for seconds above, the formula below returns the interval
that, when added to the local_start, will give the time in the
@@ -1432,7 +1433,10 @@ Event_job_data::execute(THD *thd, bool drop)
thd->set_query(sp_sql.c_ptr_safe(), sp_sql.length());
{
- Parser_state parser_state(thd, thd->query(), thd->query_length());
+ Parser_state parser_state;
+ if (parser_state.init(thd, thd->query(), thd->query_length()))
+ goto end;
+
lex_start(thd);
if (parse_sql(thd, & parser_state, creation_ctx))
diff --git a/sql/field.cc b/sql/field.cc
index f621dab7539..597ec4f68d0 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5313,7 +5313,6 @@ String *Field_time::val_str(String *val_buffer,
bool Field_time::get_date(MYSQL_TIME *ltime, uint fuzzydate)
{
- long tmp;
THD *thd= table ? table->in_use : current_thd;
if (!(fuzzydate & TIME_FUZZY_DATE))
{
@@ -5323,19 +5322,7 @@ bool Field_time::get_date(MYSQL_TIME *ltime, uint fuzzydate)
thd->row_count);
return 1;
}
- tmp=(long) sint3korr(ptr);
- ltime->neg=0;
- if (tmp < 0)
- {
- ltime->neg= 1;
- tmp=-tmp;
- }
- ltime->hour=tmp/10000;
- tmp-=ltime->hour*10000;
- ltime->minute= tmp/100;
- ltime->second= tmp % 100;
- ltime->year= ltime->month= ltime->day= ltime->second_part= 0;
- return 0;
+ return Field_time::get_time(ltime);
}
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 0d60832b085..2bd2eabb58b 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -59,6 +59,8 @@
#include <mysql/plugin.h>
+#include "debug_sync.h"
+
static const char *ha_par_ext= ".par";
#ifdef NOT_USED
static int free_share(PARTITION_SHARE * share);
@@ -87,7 +89,9 @@ static int partition_initialize(void *p)
partition_hton->create= partition_create_handler;
partition_hton->partition_flags= partition_flags;
partition_hton->alter_table_flags= alter_table_flags;
- partition_hton->flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN;
+ partition_hton->flags= HTON_NOT_USER_SELECTABLE |
+ HTON_HIDDEN |
+ HTON_TEMPORARY_NOT_SUPPORTED;
return 0;
}
@@ -356,7 +360,7 @@ bool ha_partition::initialize_partition(MEM_ROOT *mem_root)
}
else if (get_from_handler_file(table_share->normalized_path.str, mem_root))
{
- mem_alloc_error(2);
+ my_message(ER_UNKNOWN_ERROR, "Failed to read from the .par file", MYF(0));
DBUG_RETURN(1);
}
/*
@@ -691,6 +695,7 @@ int ha_partition::rename_partitions(const char *path)
DBUG_ASSERT(!strcmp(path, get_canonical_filename(m_file[0], path,
norm_name_buff)));
+ DEBUG_SYNC(ha_thd(), "before_rename_partitions");
if (temp_partitions)
{
/*
@@ -1835,6 +1840,13 @@ uint ha_partition::del_ren_cre_table(const char *from,
handler **file, **abort_file;
DBUG_ENTER("del_ren_cre_table()");
+ /* Not allowed to create temporary partitioned tables */
+ if (create_info && create_info->options & HA_LEX_CREATE_TMP_TABLE)
+ {
+ my_error(ER_PARTITION_NO_TEMPORARY, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+
if (get_from_handler_file(from, ha_thd()->mem_root))
DBUG_RETURN(TRUE);
DBUG_ASSERT(m_file_buffer);
@@ -2610,6 +2622,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(0);
err_handler:
+ DEBUG_SYNC(ha_thd(), "partition_open_error");
while (file-- != m_file)
(*file)->close();
bitmap_free(&m_bulk_insert_started);
diff --git a/sql/handler.cc b/sql/handler.cc
index 2b931b6f5c1..10f14be26ae 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -59,6 +59,7 @@ static const LEX_STRING sys_table_aliases[]=
{ C_STRING_WITH_LEN("NDB") }, { C_STRING_WITH_LEN("NDBCLUSTER") },
{ C_STRING_WITH_LEN("HEAP") }, { C_STRING_WITH_LEN("MEMORY") },
{ C_STRING_WITH_LEN("MERGE") }, { C_STRING_WITH_LEN("MRG_MYISAM") },
+ { C_STRING_WITH_LEN("Aria") }, { C_STRING_WITH_LEN("Maria") },
{NullS, 0}
};
diff --git a/sql/handler.h b/sql/handler.h
index 41af87eb47d..ad4743b78b1 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1032,7 +1032,7 @@ typedef struct st_ha_create_information
ulong avg_row_length;
ulong used_fields;
ulong key_block_size;
- SQL_LIST merge_list;
+ SQL_I_List<TABLE_LIST> merge_list;
handlerton *db_type;
/**
Row type of the table definition.
diff --git a/sql/item.cc b/sql/item.cc
index c670898a91f..2edeb4c0ee0 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -3865,7 +3865,7 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
{
Item **group_by_ref= NULL;
Item **select_ref= NULL;
- ORDER *group_list= (ORDER*) select->group_list.first;
+ ORDER *group_list= select->group_list.first;
bool ambiguous_fields= FALSE;
uint counter;
enum_resolution_type resolution;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 43958b31212..36a999c9e76 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -2786,6 +2786,8 @@ Item *Item_func_case::find_item(String *str)
/* Compare every WHEN argument with it and return the first match */
for (uint i=0 ; i < ncases ; i+=2)
{
+ if (args[i]->real_item()->type() == NULL_ITEM)
+ continue;
cmp_type= item_cmp_type(left_result_type, args[i]->result_type());
DBUG_ASSERT(cmp_type != ROW_RESULT);
DBUG_ASSERT(cmp_items[(uint)cmp_type]);
@@ -4024,9 +4026,17 @@ longlong Item_func_in::val_int()
return (longlong) (!null_value && tmp != negated);
}
+ if ((null_value= args[0]->real_item()->type() == NULL_ITEM))
+ return 0;
+
have_null= 0;
for (uint i= 1 ; i < arg_count ; i++)
{
+ if (args[i]->real_item()->type() == NULL_ITEM)
+ {
+ have_null= TRUE;
+ continue;
+ }
Item_result cmp_type= item_cmp_type(left_result_type, args[i]->result_type());
in_item= cmp_items[(uint)cmp_type];
DBUG_ASSERT(in_item);
@@ -4590,13 +4600,14 @@ Item_func::optimize_type Item_func_like::select_optimize() const
if (args[1]->const_item())
{
String* res2= args[1]->val_str((String *)&cmp.value2);
+ const char *ptr2;
- if (!res2)
+ if (!res2 || !(ptr2= res2->ptr()))
return OPTIMIZE_NONE;
- if (*res2->ptr() != wild_many)
+ if (*ptr2 != wild_many)
{
- if (args[0]->result_type() != STRING_RESULT || *res2->ptr() != wild_one)
+ if (args[0]->result_type() != STRING_RESULT || *ptr2 != wild_one)
return OPTIMIZE_OP;
}
}
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index d1c1d12520e..afde48b56f7 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1313,8 +1313,8 @@ public:
else
{
args[0]->update_used_tables();
- if ((const_item_cache= !(used_tables_cache= args[0]->used_tables())) &&
- !with_subselect)
+ if ((const_item_cache= !(used_tables_cache= args[0]->used_tables()) &&
+ !with_subselect))
{
/* Remember if the value is always NULL or never NULL */
cached_value= (longlong) args[0]->is_null();
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 82bb02f362e..a82c93304e6 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -268,12 +268,12 @@ bool Item_subselect::walk(Item_processor processor, bool walk_subquery,
if (item->walk(processor, walk_subquery, argument))
return 1;
}
- for (order= (ORDER*) lex->order_list.first ; order; order= order->next)
+ for (order= lex->order_list.first ; order; order= order->next)
{
if ((*order->item)->walk(processor, walk_subquery, argument))
return 1;
}
- for (order= (ORDER*) lex->group_list.first ; order; order= order->next)
+ for (order= lex->group_list.first ; order; order= order->next)
{
if ((*order->item)->walk(processor, walk_subquery, argument))
return 1;
@@ -1810,15 +1810,15 @@ int subselect_single_select_engine::prepare()
SELECT_LEX *save_select= thd->lex->current_select;
thd->lex->current_select= select_lex;
if (join->prepare(&select_lex->ref_pointer_array,
- (TABLE_LIST*) select_lex->table_list.first,
+ select_lex->table_list.first,
select_lex->with_wild,
select_lex->where,
select_lex->order_list.elements +
select_lex->group_list.elements,
- (ORDER*) select_lex->order_list.first,
- (ORDER*) select_lex->group_list.first,
+ select_lex->order_list.first,
+ select_lex->group_list.first,
select_lex->having,
- (ORDER*) 0, select_lex,
+ NULL, select_lex,
select_lex->master_unit()))
return 1;
thd->lex->current_select= save_select;
@@ -2482,14 +2482,13 @@ table_map subselect_engine::calc_const_tables(TABLE_LIST *table)
table_map subselect_single_select_engine::upper_select_const_tables()
{
- return calc_const_tables((TABLE_LIST *) select_lex->outer_select()->
- leaf_tables);
+ return calc_const_tables(select_lex->outer_select()->leaf_tables);
}
table_map subselect_union_engine::upper_select_const_tables()
{
- return calc_const_tables((TABLE_LIST *) unit->outer_select()->leaf_tables);
+ return calc_const_tables(unit->outer_select()->leaf_tables);
}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index d87080a2fee..2f79fd65ff3 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -2964,7 +2964,7 @@ int dump_leaf_key(uchar* key, element_count count __attribute__((unused)),
Item_func_group_concat::
Item_func_group_concat(Name_resolution_context *context_arg,
bool distinct_arg, List<Item> *select_list,
- SQL_LIST *order_list, String *separator_arg)
+ SQL_I_List<ORDER> *order_list, String *separator_arg)
:tmp_table_param(0), warning(0),
separator(separator_arg), tree(0), unique_filter(NULL), table(0),
order(0), context(context_arg),
@@ -3008,7 +3008,7 @@ Item_func_group_concat(Name_resolution_context *context_arg,
if (arg_count_order)
{
ORDER **order_ptr= order;
- for (ORDER *order_item= (ORDER*) order_list->first;
+ for (ORDER *order_item= order_list->first;
order_item != NULL;
order_item= order_item->next)
{
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 2922d6c9644..7720de2450f 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1248,7 +1248,7 @@ class Item_func_group_concat : public Item_sum
public:
Item_func_group_concat(Name_resolution_context *context_arg,
bool is_distinct, List<Item> *is_select,
- SQL_LIST *is_order, String *is_separator);
+ SQL_I_List<ORDER> *is_order, String *is_separator);
Item_func_group_concat(THD *thd, Item_func_group_concat *item);
~Item_func_group_concat();
diff --git a/sql/log.cc b/sql/log.cc
index 6094836c031..570418d97dd 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1474,11 +1474,6 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data,
trx_data->has_incident());
trx_data->reset();
- /*
- We need to step the table map version after writing the
- transaction cache to disk.
- */
- mysql_bin_log.update_table_map_version();
statistic_increment(binlog_cache_use, &LOCK_status);
if (trans_log->disk_writes != 0)
{
@@ -1504,13 +1499,6 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data,
}
else // ...statement
trx_data->truncate(trx_data->before_stmt_pos);
-
- /*
- We need to step the table map version on a rollback to ensure
- that a new table map event is generated instead of the one that
- was written to the thrown-away transaction cache.
- */
- mysql_bin_log.update_table_map_version();
}
DBUG_ASSERT(thd->binlog_get_pending_rows_event() == NULL);
@@ -1556,28 +1544,23 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all)
}
/*
- We commit the transaction if:
-
- - We are not in a transaction and committing a statement, or
+ We flush the cache if:
- - We are in a transaction and a full transaction is committed
+ - we are committing a transaction or;
+ - no statement was committed before and just non-transactional
+ tables were updated.
- Otherwise, we accumulate the statement
+ Otherwise, we collect the changes.
*/
- ulonglong const in_transaction=
- thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN);
DBUG_PRINT("debug",
- ("all: %d, empty: %s, in_transaction: %s, all.modified_non_trans_table: %s, stmt.modified_non_trans_table: %s",
+ ("all: %d, empty: %s, all.modified_non_trans_table: %s, stmt.modified_non_trans_table: %s",
all,
YESNO(trx_data->empty()),
- YESNO(in_transaction),
YESNO(thd->transaction.all.modified_non_trans_table),
YESNO(thd->transaction.stmt.modified_non_trans_table)));
-
- if (!in_transaction || all ||
- (!all && !trx_data->at_least_one_stmt_committed &&
- !stmt_has_updated_trans_table(thd) &&
- thd->transaction.stmt.modified_non_trans_table))
+ if (ending_trans(thd, all) ||
+ (trans_has_no_stmt_committed(thd, all) &&
+ !stmt_has_updated_trans_table(thd) && stmt_has_updated_non_trans_table(thd)))
{
Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, TRUE, 0);
error= binlog_end_trans(thd, trx_data, &qev, all);
@@ -1640,7 +1623,7 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
On the other hand, if a statement is transactional, we just safely roll it
back.
*/
- if ((thd->transaction.stmt.modified_non_trans_table ||
+ if ((stmt_has_updated_non_trans_table(thd) ||
(thd->options & OPTION_KEEP_LOG)) &&
mysql_bin_log.check_write_error(thd))
trx_data->set_incident();
@@ -1649,20 +1632,19 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
else
{
/*
- We flush the cache with a rollback, wrapped in a beging/rollback if:
- . aborting a transaction that modified a non-transactional table;
+ We flush the cache with a rollback, wrapped in a begin/rollback if:
+ . aborting a transaction that modified a non-transactional table or
+ the OPTION_KEEP_LOG is activate.
. aborting a statement that modified both transactional and
non-transactional tables but which is not in the boundaries of any
transaction or there was no early change;
- . the OPTION_KEEP_LOG is activate.
*/
- if ((all && thd->transaction.all.modified_non_trans_table) ||
- (!all && thd->transaction.stmt.modified_non_trans_table &&
- !(thd->options & (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT))) ||
- (!all && thd->transaction.stmt.modified_non_trans_table &&
- !trx_data->at_least_one_stmt_committed &&
- thd->current_stmt_binlog_row_based) ||
- ((thd->options & OPTION_KEEP_LOG)))
+ if ((ending_trans(thd, all) &&
+ (trans_has_updated_non_trans_table(thd) ||
+ (thd->options & OPTION_KEEP_LOG))) ||
+ (trans_has_no_stmt_committed(thd, all) &&
+ stmt_has_updated_non_trans_table(thd) &&
+ thd->current_stmt_binlog_row_based))
{
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, TRUE, 0);
error= binlog_end_trans(thd, trx_data, &qev, all);
@@ -1671,8 +1653,8 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
Otherwise, we simply truncate the cache as there is no change on
non-transactional tables as follows.
*/
- else if ((all && !thd->transaction.all.modified_non_trans_table) ||
- (!all && !thd->transaction.stmt.modified_non_trans_table))
+ else if (ending_trans(thd, all) ||
+ (!(thd->options & OPTION_KEEP_LOG) && !stmt_has_updated_non_trans_table(thd)))
error= binlog_end_trans(thd, trx_data, 0, all);
}
if (!all)
@@ -1769,7 +1751,7 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
non-transactional table. Otherwise, truncate the binlog cache starting
from the SAVEPOINT command.
*/
- if (unlikely(thd->transaction.all.modified_non_trans_table ||
+ if (unlikely(trans_has_updated_non_trans_table(thd) ||
(thd->options & OPTION_KEEP_LOG)))
{
String log_query;
@@ -2493,7 +2475,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name,
MYSQL_BIN_LOG::MYSQL_BIN_LOG()
:bytes_written(0), prepared_xids(0), file_id(1), open_count(1),
- need_start_event(TRUE), m_table_map_version(0),
+ need_start_event(TRUE),
is_relay_log(0),
description_event_for_exec(0), description_event_for_queue(0)
{
@@ -4007,6 +3989,67 @@ bool MYSQL_BIN_LOG::is_query_in_union(THD *thd, query_id_t query_id_param)
query_id_param >= thd->binlog_evt_union.first_query_id);
}
+/**
+ This function checks if a transaction, either a multi-statement
+ or a single statement transaction is about to commit or not.
+
+ @param thd The client thread that executed the current statement.
+ @param all Committing a transaction (i.e. TRUE) or a statement
+ (i.e. FALSE).
+ @return
+ @c true if committing a transaction, otherwise @c false.
+*/
+bool ending_trans(const THD* thd, const bool all)
+{
+ return (all || (!all && !(thd->options &
+ (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT))));
+}
+
+/**
+ This function checks if a non-transactional table was updated by
+ the current transaction.
+
+ @param thd The client thread that executed the current statement.
+ @return
+ @c true if a non-transactional table was updated, @c false
+ otherwise.
+*/
+bool trans_has_updated_non_trans_table(const THD* thd)
+{
+ return (thd->transaction.all.modified_non_trans_table ||
+ thd->transaction.stmt.modified_non_trans_table);
+}
+
+/**
+ This function checks if any statement was committed and cached.
+
+ @param thd The client thread that executed the current statement.
+ @param all Committing a transaction (i.e. TRUE) or a statement
+ (i.e. FALSE).
+ @return
+ @c true if at a statement was committed and cached, @c false
+ otherwise.
+*/
+bool trans_has_no_stmt_committed(const THD* thd, bool all)
+{
+ binlog_trx_data *const trx_data=
+ (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
+
+ return (!all && !trx_data->at_least_one_stmt_committed);
+}
+
+/**
+ This function checks if a non-transactional table was updated by the
+ current statement.
+
+ @param thd The client thread that executed the current statement.
+ @return
+ @c true if a non-transactional table was updated, @c false otherwise.
+*/
+bool stmt_has_updated_non_trans_table(const THD* thd)
+{
+ return (thd->transaction.stmt.modified_non_trans_table);
+}
/*
These functions are placed in this file since they need access to
@@ -4139,7 +4182,6 @@ int THD::binlog_write_table_map(TABLE *table, bool is_trans)
DBUG_RETURN(error);
binlog_table_maps++;
- table->s->table_map_version= mysql_bin_log.table_map_version();
DBUG_RETURN(0);
}
@@ -4230,10 +4272,8 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
file= &trx_data->trans_log;
/*
- If we are writing to the log file directly, we could avoid
- locking the log. This does not work since we need to step the
- m_table_map_version below, and that change has to be protected
- by the LOCK_log mutex.
+ If we are not writing to the log file directly, we could avoid
+ locking the log.
*/
pthread_mutex_lock(&LOCK_log);
@@ -4247,24 +4287,6 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
DBUG_RETURN(1);
}
- /*
- We step the table map version if we are writing an event
- representing the end of a statement. We do this regardless of
- wheather we write to the transaction cache or to directly to the
- file.
-
- In an ideal world, we could avoid stepping the table map version
- if we were writing to a transaction cache, since we could then
- reuse the table map that was written earlier in the transaction
- cache. This does not work since STMT_END_F implies closing all
- table mappings on the slave side.
-
- TODO: Find a solution so that table maps does not have to be
- written several times within a transaction.
- */
- if (pending->get_flags(Rows_log_event::STMT_END_F))
- ++m_table_map_version;
-
delete pending;
if (file == &log_file)
@@ -4480,9 +4502,6 @@ err:
set_write_error(thd);
}
- if (event_info->flags & LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F)
- ++m_table_map_version;
-
pthread_mutex_unlock(&LOCK_log);
DBUG_RETURN(error);
}
diff --git a/sql/log.h b/sql/log.h
index c6cf8780c04..1cfd7ce9ae5 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -20,6 +20,11 @@ class Relay_log_info;
class Format_description_log_event;
+bool ending_trans(const THD* thd, const bool all);
+bool trans_has_updated_non_trans_table(const THD* thd);
+bool trans_has_no_stmt_committed(const THD* thd, const bool all);
+bool stmt_has_updated_non_trans_table(const THD* thd);
+
/*
Transaction Coordinator log - a base abstract class
for two different implementations
@@ -272,8 +277,6 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
*/
bool no_auto_events;
- ulonglong m_table_map_version;
-
int write_to_file(IO_CACHE *cache);
/*
This is used to start writing to a new log file. The difference from
@@ -314,14 +317,6 @@ public:
void unlog(ulong cookie, my_xid xid);
int recover(IO_CACHE *log, Format_description_log_event *fdle);
#if !defined(MYSQL_CLIENT)
- bool is_table_mapped(TABLE *table) const
- {
- return table->s->table_map_version == table_map_version();
- }
-
- ulonglong table_map_version() const { return m_table_map_version; }
- void update_table_map_version() { ++m_table_map_version; }
-
int flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event);
int remove_pending_rows_event(THD *thd);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index ee11ab79fd0..a1ecb79ff56 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2405,13 +2405,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);
@@ -7546,12 +7562,6 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
error= 0;
}
-
- if (!cache_stmt)
- {
- DBUG_PRINT("info", ("Marked that we need to keep log"));
- thd->options|= OPTION_KEEP_LOG;
- }
} // if (table)
/*
@@ -8865,11 +8875,28 @@ static bool record_compare(TABLE *table)
{
for (int i = 0 ; i < 2 ; ++i)
{
- saved_x[i]= table->record[i][0];
- saved_filler[i]= table->record[i][table->s->null_bytes - 1];
- table->record[i][0]|= 1U;
- table->record[i][table->s->null_bytes - 1]|=
- 256U - (1U << table->s->last_null_bit_pos);
+ /*
+ If we have an X bit then we need to take care of it.
+ */
+ if (!(table->s->db_options_in_use & HA_OPTION_PACK_RECORD))
+ {
+ saved_x[i]= table->record[i][0];
+ table->record[i][0]|= 1U;
+ }
+
+ /*
+ If (last_null_bit_pos == 0 && null_bytes > 1), then:
+
+ X bit (if any) + N nullable fields + M Field_bit fields = 8 bits
+
+ Ie, the entire byte is used.
+ */
+ if (table->s->last_null_bit_pos > 0)
+ {
+ saved_filler[i]= table->record[i][table->s->null_bytes - 1];
+ table->record[i][table->s->null_bytes - 1]|=
+ 256U - (1U << table->s->last_null_bit_pos);
+ }
}
}
@@ -8909,8 +8936,11 @@ record_compare_exit:
{
for (int i = 0 ; i < 2 ; ++i)
{
- table->record[i][0]= saved_x[i];
- table->record[i][table->s->null_bytes - 1]= saved_filler[i];
+ if (!(table->s->db_options_in_use & HA_OPTION_PACK_RECORD))
+ table->record[i][0]= saved_x[i];
+
+ if (table->s->last_null_bit_pos)
+ table->record[i][table->s->null_bytes - 1]= saved_filler[i];
}
}
@@ -9087,8 +9117,35 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
*/
if (table->key_info->flags & HA_NOSAME)
{
- table->file->ha_index_end();
- goto ok;
+ /* Unique does not have non nullable part */
+ if (!(table->key_info->flags & (HA_NULL_PART_KEY)))
+ {
+ table->file->ha_index_end();
+ goto ok;
+ }
+ else
+ {
+ KEY *keyinfo= table->key_info;
+ /*
+ Unique has nullable part. We need to check if there is any field in the
+ BI image that is null and part of UNNI.
+ */
+ bool null_found= FALSE;
+ for (uint i=0; i < keyinfo->key_parts && !null_found; i++)
+ {
+ uint fieldnr= keyinfo->key_part[i].fieldnr - 1;
+ Field **f= table->field+fieldnr;
+ null_found= (*f)->is_null();
+ }
+
+ if (!null_found)
+ {
+ table->file->ha_index_end();
+ goto ok;
+ }
+
+ /* else fall through to index scan */
+ }
}
/*
diff --git a/sql/log_event.h b/sql/log_event.h
index db3950e6c25..d82fc385d86 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -463,10 +463,10 @@ struct sql_ex_info
#define LOG_EVENT_SUPPRESS_USE_F 0x8
/*
- The table map version internal to the log should be increased after
- the event has been written to the binary log.
+ Note: this is a place holder for the flag
+ LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F (0x10), which is not used any
+ more, please do not reused this value for other flags.
*/
-#define LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F 0x10
/**
@def LOG_EVENT_ARTIFICIAL_F
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 087d4c02d98..b96d1684d77 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -229,11 +229,6 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info
DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event",
const_cast<Relay_log_info*>(rli)->abort_slave= 1;);
error= do_after_row_operations(table, error);
- if (!ev->cache_stmt)
- {
- DBUG_PRINT("info", ("Marked that we need to keep log"));
- ev_thd->options|= OPTION_KEEP_LOG;
- }
}
/*
@@ -342,12 +337,29 @@ static bool record_compare(TABLE *table)
if (table->s->null_bytes > 0)
{
for (int i = 0 ; i < 2 ; ++i)
- {
- saved_x[i]= table->record[i][0];
- saved_filler[i]= table->record[i][table->s->null_bytes - 1];
- table->record[i][0]|= 1U;
- table->record[i][table->s->null_bytes - 1]|=
- 256U - (1U << table->s->last_null_bit_pos);
+ {
+ /*
+ If we have an X bit then we need to take care of it.
+ */
+ if (!(table->s->db_options_in_use & HA_OPTION_PACK_RECORD))
+ {
+ saved_x[i]= table->record[i][0];
+ table->record[i][0]|= 1U;
+ }
+
+ /*
+ If (last_null_bit_pos == 0 && null_bytes > 1), then:
+
+ X bit (if any) + N nullable fields + M Field_bit fields = 8 bits
+
+ Ie, the entire byte is used.
+ */
+ if (table->s->last_null_bit_pos > 0)
+ {
+ saved_filler[i]= table->record[i][table->s->null_bytes - 1];
+ table->record[i][table->s->null_bytes - 1]|=
+ 256U - (1U << table->s->last_null_bit_pos);
+ }
}
}
@@ -387,8 +399,11 @@ record_compare_exit:
{
for (int i = 0 ; i < 2 ; ++i)
{
- table->record[i][0]= saved_x[i];
- table->record[i][table->s->null_bytes - 1]= saved_filler[i];
+ if (!(table->s->db_options_in_use & HA_OPTION_PACK_RECORD))
+ table->record[i][0]= saved_x[i];
+
+ if (table->s->last_null_bit_pos > 0)
+ table->record[i][table->s->null_bytes - 1]= saved_filler[i];
}
}
@@ -1760,11 +1775,6 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event",
const_cast<Relay_log_info*>(rli)->abort_slave= 1;);
error= do_after_row_operations(rli, error);
- if (!cache_stmt)
- {
- DBUG_PRINT("info", ("Marked that we need to keep log"));
- thd->options|= OPTION_KEEP_LOG;
- }
} // if (table)
/*
@@ -2413,8 +2423,35 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli)
*/
if (table->key_info->flags & HA_NOSAME)
{
- table->file->ha_index_end();
- DBUG_RETURN(0);
+ /* Unique does not have non nullable part */
+ if (!(table->key_info->flags & (HA_NULL_PART_KEY)))
+ {
+ table->file->ha_index_end();
+ DBUG_RETURN(0);
+ }
+ else
+ {
+ KEY *keyinfo= table->key_info;
+ /*
+ Unique has nullable part. We need to check if there is any field in the
+ BI image that is null and part of UNNI.
+ */
+ bool null_found= FALSE;
+ for (uint i=0; i < keyinfo->key_parts && !null_found; i++)
+ {
+ uint fieldnr= keyinfo->key_part[i].fieldnr - 1;
+ Field **f= table->field+fieldnr;
+ null_found= (*f)->is_null();
+ }
+
+ if (!null_found)
+ {
+ table->file->ha_index_end();
+ DBUG_RETURN(0);
+ }
+
+ /* else fall through to index scan */
+ }
}
/*
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 864f91df868..299597632dd 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -670,49 +670,6 @@ enum enum_check_fields
CHECK_FIELD_ERROR_FOR_NULL
};
-
-/** Struct to handle simple linked lists. */
-typedef struct st_sql_list {
- uint elements;
- uchar *first;
- uchar **next;
-
- st_sql_list() {} /* Remove gcc warning */
- inline void empty()
- {
- elements=0;
- first=0;
- next= &first;
- }
- inline void link_in_list(uchar *element,uchar **next_ptr)
- {
- elements++;
- (*next)=element;
- next= next_ptr;
- *next=0;
- }
- inline void save_and_clear(struct st_sql_list *save)
- {
- *save= *this;
- empty();
- }
- inline void push_front(struct st_sql_list *save)
- {
- *save->next= first; /* link current list last */
- first= save->first;
- elements+= save->elements;
- }
- inline void push_back(struct st_sql_list *save)
- {
- if (save->first)
- {
- *next= save->first;
- next= save->next;
- elements+= save->elements;
- }
- }
-} SQL_LIST;
-
#if defined(MYSQL_DYNAMIC_PLUGIN) && defined(_WIN32)
extern "C" THD *_current_thd_noinline();
#define _current_thd() _current_thd_noinline()
@@ -1305,7 +1262,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
void prepare_triggers_for_insert_stmt(TABLE *table);
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
- SQL_LIST *order, ha_rows rows, ulonglong options,
+ SQL_I_List<ORDER> *order, ha_rows rows, ulonglong options,
bool reset_auto_increment);
bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create);
@@ -1331,7 +1288,8 @@ bool fix_merge_after_open(TABLE_LIST *old_child_list, TABLE_LIST **old_last,
TABLE_LIST *new_child_list, TABLE_LIST **new_last);
bool reopen_table(TABLE *table);
bool reopen_tables(THD *thd,bool get_locks,bool in_refresh);
-thr_lock_type read_lock_type_for_table(THD *thd, TABLE *table);
+thr_lock_type read_lock_type_for_table(THD *thd, LEX *lex,
+ TABLE_LIST *table_list);
void close_data_files_and_morph_locks(THD *thd, const char *db,
const char *table_name);
void close_handle_and_leave_table_as_lock(TABLE *table);
@@ -1508,7 +1466,7 @@ Create_field * new_create_field(THD *thd, char *field_name, enum_field_types typ
uint uint_geom_type,
Virtual_column_info *vcol_info);
void store_position_for_column(const char *name);
-bool add_to_list(THD *thd, SQL_LIST &list,Item *group,bool asc);
+bool add_to_list(THD *thd, SQL_I_List<ORDER> &list, Item *group,bool asc);
bool push_new_name_resolution_context(THD *thd,
TABLE_LIST *left_op,
TABLE_LIST *right_op);
@@ -1783,7 +1741,7 @@ extern pthread_mutex_t LOCK_gdl;
#define WFRM_PACK_FRM 4
#define WFRM_KEEP_SHARE 8
bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags);
-int abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt);
+int abort_and_upgrade_lock_and_close_table(ALTER_PARTITION_PARAM_TYPE *lpt);
void close_open_tables_and_downgrade(ALTER_PARTITION_PARAM_TYPE *lpt);
void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table);
@@ -2360,6 +2318,7 @@ uint explain_filename(THD* thd, const char *from, char *to, uint to_length,
uint filename_to_tablename(const char *from, char *to, uint to_length);
uint tablename_to_filename(const char *from, char *to, uint to_length);
uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length);
+bool check_mysql50_prefix(const char *name);
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
uint build_table_filename(char *buff, size_t bufflen, const char *db,
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 3d03c5efaa0..261589cfd34 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -181,6 +181,21 @@ typedef fp_except fp_except_t;
/* for IRIX to use set_fpc_csr() */
#include <sys/fpu.h>
#endif
+#ifdef HAVE_FPU_CONTROL_H
+#include <fpu_control.h>
+#endif
+#if defined(__i386__) && !defined(HAVE_FPU_CONTROL_H)
+# define fpu_control_t unsigned int
+# define _FPU_EXTENDED 0x300
+# define _FPU_DOUBLE 0x200
+# if defined(__GNUC__) || defined(__SUNPRO_CC)
+# define _FPU_GETCW(cw) asm volatile ("fnstcw %0" : "=m" (*&cw))
+# define _FPU_SETCW(cw) asm volatile ("fldcw %0" : : "m" (*&cw))
+# else
+# define _FPU_GETCW(cw) (cw= 0)
+# define _FPU_SETCW(cw)
+# endif
+#endif
inline void setup_fpu()
{
@@ -202,7 +217,26 @@ inline void setup_fpu()
/* Set FPU rounding mode to "round-to-nearest" */
fesetround(FE_TONEAREST);
#endif /* HAVE_FESETROUND */
-
+
+ /*
+ x86 (32-bit) requires FPU precision to be explicitly set to 64 bit
+ (double precision) for portable results of floating point operations.
+ However, there is no need to do so if compiler is using SSE2 for floating
+ point, double values will be stored and processed in 64 bits anyway.
+ */
+#if defined(__i386__) && !defined(__SSE2_MATH__)
+#if defined(_WIN32)
+#if !defined(_WIN64)
+ _control87(_PC_53, MCW_PC);
+#endif /* !_WIN64 */
+#else /* !_WIN32 */
+ fpu_control_t cw;
+ _FPU_GETCW(cw);
+ cw= (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
+ _FPU_SETCW(cw);
+#endif /* _WIN32 && */
+#endif /* __i386__ */
+
#if defined(__sgi) && defined(HAVE_SYS_FPU_H)
/* Enable denormalized DOUBLE values support for IRIX */
union fpc_csr n;
@@ -1251,7 +1285,7 @@ extern "C" sig_handler print_signal_warning(int sig)
{
if (global_system_variables.log_warnings)
sql_print_warning("Got signal %d from thread %ld", sig,my_thread_id());
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
my_sigset(sig,print_signal_warning); /* int. thread system calls */
#endif
#if !defined(__WIN__) && !defined(__NETWARE__)
@@ -3083,6 +3117,9 @@ int my_message_sql(uint error, const char *str, myf MyFlags)
DBUG_RETURN(0);
}
+ /* When simulating OOM, skip writing to error log to avoid mtr errors */
+ DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_RETURN(0););
+
if (!thd->no_warnings_for_error &&
!(MyFlags & ME_NO_WARNING_FOR_ERROR))
{
@@ -3095,7 +3132,11 @@ int my_message_sql(uint error, const char *str, myf MyFlags)
thd->no_warnings_for_error= FALSE;
}
}
+
to_error_log:
+ /* When simulating OOM, skip writing to error log to avoid mtr errors */
+ DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_RETURN(0););
+
if (!thd || (MyFlags & ME_NOREFRESH))
(*func)("%s: %s", my_progname_short, str); /* purecov: inspected */
DBUG_RETURN(0);
@@ -3354,6 +3395,13 @@ static int init_common_variables(const char *conf_file_name, int argc,
max_system_variables.pseudo_thread_id= (ulong)~0;
server_start_time= flush_status_time= my_time(0);
+ /* TODO: remove this when my_time_t is 64 bit compatible */
+ if (server_start_time >= (time_t) MY_TIME_T_MAX)
+ {
+ sql_print_error("This MySQL server doesn't support dates later then 2038");
+ return 1;
+ }
+
rpl_filter= new Rpl_filter;
binlog_filter= new Rpl_filter;
if (!rpl_filter || !binlog_filter)
@@ -5976,13 +6024,13 @@ enum options_mysqld
struct my_option my_long_options[] =
{
- {"help", '?', "Display this help and exit.",
- (uchar**) &opt_help, (uchar**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ {"help", '?', "Display this help and exit.",
+ &opt_help, &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
#ifdef HAVE_REPLICATION
{"abort-slave-event-count", OPT_ABORT_SLAVE_EVENT_COUNT,
"Option used by mysql-test for debugging and testing of replication.",
- (uchar**) &abort_slave_event_count, (uchar**) &abort_slave_event_count,
+ &abort_slave_event_count, &abort_slave_event_count,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif /* HAVE_REPLICATION */
{"allow-suspicious-udfs", OPT_ALLOW_SUSPICIOUS_UDFS,
@@ -5990,33 +6038,34 @@ struct my_option my_long_options[] =
"without corresponding xxx_init() or xxx_deinit(). That also means "
"that one can load any function from any library, for example exit() "
"from libc.so",
- (uchar**) &opt_allow_suspicious_udfs, (uchar**) &opt_allow_suspicious_udfs,
+ &opt_allow_suspicious_udfs, &opt_allow_suspicious_udfs,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode will also set transaction isolation level 'serializable'.", 0, 0, 0,
+ {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode "
+ "will also set transaction isolation level 'serializable'.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-increment-increment", OPT_AUTO_INCREMENT,
"Auto-increment columns are incremented by this.",
- (uchar**) &global_system_variables.auto_increment_increment,
- (uchar**) &max_system_variables.auto_increment_increment, 0, GET_ULONG,
+ &global_system_variables.auto_increment_increment,
+ &max_system_variables.auto_increment_increment, 0, GET_ULONG,
OPT_ARG, 1, 1, 65535, 0, 1, 0 },
{"auto-increment-offset", OPT_AUTO_INCREMENT_OFFSET,
"Offset added to Auto-increment columns. Used when auto-increment-increment != 1.",
- (uchar**) &global_system_variables.auto_increment_offset,
- (uchar**) &max_system_variables.auto_increment_offset, 0, GET_ULONG, OPT_ARG,
+ &global_system_variables.auto_increment_offset,
+ &max_system_variables.auto_increment_offset, 0, GET_ULONG, OPT_ARG,
1, 1, 65535, 0, 1, 0 },
{"automatic-sp-privileges", OPT_SP_AUTOMATIC_PRIVILEGES,
"Creating and dropping stored procedures alters ACLs. Disable with --skip-automatic-sp-privileges.",
- (uchar**) &sp_automatic_privileges, (uchar**) &sp_automatic_privileges,
+ &sp_automatic_privileges, &sp_automatic_privileges,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"basedir", 'b',
"Path to installation directory. All paths are usually resolved relative to this.",
- (uchar**) &mysql_home_ptr, (uchar**) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
+ &mysql_home_ptr, &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"big-tables", OPT_BIG_TABLES,
"Allow big result sets by saving all temporary sets on file (solves most 'table full' errors).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.",
- (uchar**) &my_bind_addr_str, (uchar**) &my_bind_addr_str, 0, GET_STR,
+ &my_bind_addr_str, &my_bind_addr_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binlog_format", OPT_BINLOG_FORMAT,
"Does not have any effect without '--log-bin'. "
@@ -6029,10 +6078,11 @@ struct my_option my_long_options[] =
"If ndbcluster is enabled and binlog_format is `mixed', the format switches"
" to 'row' and back implicitly per each query accessing a NDB table."
#endif
- ,(uchar**) &opt_binlog_format, (uchar**) &opt_binlog_format,
+ , &opt_binlog_format, &opt_binlog_format,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binlog-do-db", OPT_BINLOG_DO_DB,
- "Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.",
+ "Tells the master it should log updates for the specified database, "
+ "and exclude all others not explicitly mentioned.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binlog-ignore-db", OPT_BINLOG_IGNORE_DB,
"Tells the master that updates to the given database should not be logged to the binary log.",
@@ -6041,12 +6091,10 @@ struct my_option my_long_options[] =
"The maximum size of a row-based binary log event in bytes. Rows will be "
"grouped into events smaller than this size if possible. "
"The value has to be a multiple of 256.",
- (uchar**) &opt_binlog_rows_event_max_size,
- (uchar**) &opt_binlog_rows_event_max_size, 0,
- GET_ULONG, REQUIRED_ARG,
- /* def_value */ 1024, /* min_value */ 256,
- /* max_value */ (longlong) ULONG_MAX,
- /* sub_size */ 0, /* block_size */ 256,
+ &opt_binlog_rows_event_max_size, &opt_binlog_rows_event_max_size,
+ 0, GET_ULONG, REQUIRED_ARG,
+ /* def_value */ 1024, /* min_value */ 256, /* max_value */ ULONG_MAX,
+ /* sub_size */ 0, /* block_size */ 256,
/* app_type */ 0
},
#ifndef DISABLE_GRANT_OPTIONS
@@ -6055,134 +6103,138 @@ struct my_option my_long_options[] =
#endif
{"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
"Don't ignore client side character set value sent during handshake.",
- (uchar**) &opt_character_set_client_handshake,
- (uchar**) &opt_character_set_client_handshake,
+ &opt_character_set_client_handshake,
+ &opt_character_set_client_handshake,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM,
"Set the filesystem character set.",
- (uchar**) &character_set_filesystem_name,
- (uchar**) &character_set_filesystem_name,
+ &character_set_filesystem_name,
+ &character_set_filesystem_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"character-set-server", 'C', "Set the default character set.",
- (uchar**) &default_character_set_name, (uchar**) &default_character_set_name,
+ &default_character_set_name, &default_character_set_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory where character sets are.", (uchar**) &charsets_dir,
- (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", &charsets_dir,
+ &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"chroot", 'r', "Chroot mysqld daemon during startup.",
- (uchar**) &mysqld_chroot, (uchar**) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG,
+ &mysqld_chroot, &mysqld_chroot, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"collation-server", OPT_DEFAULT_COLLATION, "Set the default collation.",
- (uchar**) &default_collation_name, (uchar**) &default_collation_name,
+ &default_collation_name, &default_collation_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"completion-type", OPT_COMPLETION_TYPE, "Default completion type.",
- (uchar**) &global_system_variables.completion_type,
- (uchar**) &max_system_variables.completion_type, 0, GET_ULONG,
+ &global_system_variables.completion_type,
+ &max_system_variables.completion_type, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 2, 0, 1, 0},
{"concurrent-insert", OPT_CONCURRENT_INSERT,
"Use concurrent insert with MyISAM. Disable with --concurrent-insert=0.",
- (uchar**) &myisam_concurrent_insert, (uchar**) &myisam_concurrent_insert,
+ &myisam_concurrent_insert, &myisam_concurrent_insert,
0, GET_ULONG, OPT_ARG, 1, 0, 2, 0, 0, 0},
{"console", OPT_CONSOLE, "Write error output on screen; don't remove the console window on windows.",
- (uchar**) &opt_console, (uchar**) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ &opt_console, &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"datadir", 'h', "Path to the database root.", (uchar**) &mysql_data_home,
- (uchar**) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"datadir", 'h', "Path to the database root.", &mysql_data_home,
+ &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"deadlock-search-depth-short", OPT_DEADLOCK_SEARCH_DEPTH_SHORT,
"Short search depth for the two-step deadlock detection",
- (uchar**) &global_system_variables.wt_deadlock_search_depth_short,
- (uchar**) &max_system_variables.wt_deadlock_search_depth_short,
+ &global_system_variables.wt_deadlock_search_depth_short,
+ &max_system_variables.wt_deadlock_search_depth_short,
0, GET_ULONG, REQUIRED_ARG, 4, 0, 32, 0, 0, 0},
{"deadlock-search-depth-long", OPT_DEADLOCK_SEARCH_DEPTH_LONG,
"Long search depth for the two-step deadlock detection",
- (uchar**) &global_system_variables.wt_deadlock_search_depth_long,
- (uchar**) &max_system_variables.wt_deadlock_search_depth_long,
+ &global_system_variables.wt_deadlock_search_depth_long,
+ &max_system_variables.wt_deadlock_search_depth_long,
0, GET_ULONG, REQUIRED_ARG, 15, 0, 33, 0, 0, 0},
{"deadlock-timeout-short", OPT_DEADLOCK_TIMEOUT_SHORT,
"Short timeout for the two-step deadlock detection (in microseconds)",
- (uchar**) &global_system_variables.wt_timeout_short,
- (uchar**) &max_system_variables.wt_timeout_short,
+ &global_system_variables.wt_timeout_short,
+ &max_system_variables.wt_timeout_short,
0, GET_ULONG, REQUIRED_ARG, 10000, 0, ULONG_MAX, 0, 0, 0},
{"deadlock-timeout-long", OPT_DEADLOCK_TIMEOUT_LONG,
"Long timeout for the two-step deadlock detection (in microseconds)",
- (uchar**) &global_system_variables.wt_timeout_long,
- (uchar**) &max_system_variables.wt_timeout_long,
+ &global_system_variables.wt_timeout_long,
+ &max_system_variables.wt_timeout_long,
0, GET_ULONG, REQUIRED_ARG, 50000000, 0, ULONG_MAX, 0, 0, 0},
#ifndef DBUG_OFF
- {"debug", '#', "Debug log.", (uchar**) &default_dbug_option,
- (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Debug log.", &default_dbug_option,
+ &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug-crc-break", OPT_DEBUG_CRC,
"Call my_debug_put_break_here() if crc matches this number (for debug).",
- (uchar**) &opt_my_crc_dbug_check, (uchar**) &opt_my_crc_dbug_check,
+ &opt_my_crc_dbug_check, &opt_my_crc_dbug_check,
0, GET_ULONG, REQUIRED_ARG, 0, 0, ~(ulong) 0L, 0, 0, 0},
{"debug-flush", OPT_DEBUG_FLUSH, "Default debug log with flush after write",
- (uchar**) 0, (uchar**) 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"default-character-set", OPT_DEFAULT_CHARACTER_SET_OLD,
"Set the default character set (deprecated option, use --character-set-server instead).",
- (uchar**) &default_character_set_name, (uchar**) &default_character_set_name,
+ &default_character_set_name, &default_character_set_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- {"default-collation", OPT_DEFAULT_COLLATION_OLD, "Set the default collation (deprecated option, use --collation-server instead).",
- (uchar**) &default_collation_name, (uchar**) &default_collation_name,
+ {"default-collation", OPT_DEFAULT_COLLATION_OLD, "Set the default collation "
+ "(deprecated option, use --collation-server instead).",
+ &default_collation_name, &default_collation_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"default-storage-engine", OPT_STORAGE_ENGINE,
"Set the default storage engine (table type) for tables.",
- (uchar**)&default_storage_engine_str, (uchar**)&default_storage_engine_str,
+ &default_storage_engine_str, &default_storage_engine_str,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-table-type", OPT_STORAGE_ENGINE,
"(deprecated) Use --default-storage-engine.",
- (uchar**)&default_storage_engine_str, (uchar**)&default_storage_engine_str,
+ &default_storage_engine_str, &default_storage_engine_str,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-time-zone", OPT_DEFAULT_TIME_ZONE, "Set the default time zone.",
- (uchar**) &default_tz_name, (uchar**) &default_tz_name,
+ &default_tz_name, &default_tz_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE.",
0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL,
- "Don't flush key buffers between writes for any MyISAM table. (Deprecated option, use --delay-key-write=all instead.)",
+ "Don't flush key buffers between writes for any MyISAM table. "
+ "(Deprecated option, use --delay-key-write=all instead.)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_OPENSSL
{"des-key-file", OPT_DES_KEY_FILE,
"Load keys for des_encrypt() and des_encrypt from given file.",
- (uchar**) &des_key_file, (uchar**) &des_key_file, 0, GET_STR, REQUIRED_ARG,
+ &des_key_file, &des_key_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif /* HAVE_OPENSSL */
#ifdef HAVE_REPLICATION
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
"Option used by mysql-test for debugging and testing of replication.",
- (uchar**) &disconnect_slave_event_count,
- (uchar**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
- 0, 0, 0},
+ &disconnect_slave_event_count, &disconnect_slave_event_count,
+ 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif /* HAVE_REPLICATION */
{"enable-locking", OPT_ENABLE_LOCK,
"Deprecated option, use --external-locking instead.",
- (uchar**) &opt_external_locking, (uchar**) &opt_external_locking,
+ &opt_external_locking, &opt_external_locking,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NT__
{"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT).",
- (uchar**) &opt_enable_named_pipe, (uchar**) &opt_enable_named_pipe, 0, GET_BOOL,
+ &opt_enable_named_pipe, &opt_enable_named_pipe, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
#ifdef HAVE_STACK_TRACE_ON_SEGV
{"enable-pstack", OPT_DO_PSTACK, "Print a symbolic stack trace on failure.",
- (uchar**) &opt_do_pstack, (uchar**) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0,
+ &opt_do_pstack, &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
#endif /* HAVE_STACK_TRACE_ON_SEGV */
{"engine-condition-pushdown",
OPT_ENGINE_CONDITION_PUSHDOWN,
"Push supported query conditions to the storage engine.",
- (uchar**) &global_system_variables.engine_condition_pushdown,
- (uchar**) &global_system_variables.engine_condition_pushdown,
+ &global_system_variables.engine_condition_pushdown,
+ &global_system_variables.engine_condition_pushdown,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
/* See how it's handled in get_one_option() */
{"event-scheduler", OPT_EVENT_SCHEDULER, "Enable/disable the event scheduler.",
NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"exit-info", 'T', "Used for debugging. Use at your own risk.", 0, 0, 0,
GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"external-locking", OPT_USE_LOCKING, "Use system (external) locking (disabled by default). With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running. Disable with --skip-external-locking.",
- (uchar**) &opt_external_locking, (uchar**) &opt_external_locking,
+ {"external-locking", OPT_USE_LOCKING, "Use system (external) locking "
+ "(disabled by default). With this option enabled you can run myisamchk "
+ "to test (not repair) tables while the MySQL server is running. "
+ "Disable with --skip-external-locking.",
+ &opt_external_locking, &opt_external_locking,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"flush", OPT_FLUSH, "Flush tables to disk between SQL commands.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -6190,73 +6242,70 @@ struct my_option my_long_options[] =
easier to do */
{"extra-port", OPT_EXTRA_PORT,
"Extra port number to use for tcp-connections in a one-thread-per-connection manner. 0 means don't use another port",
- (uchar**) &mysqld_extra_port,
- (uchar**) &mysqld_extra_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ &mysqld_extra_port,
+ &mysqld_extra_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extra-max-connections", OPT_MAX_CONNECTIONS,
"The number of connections on 'extra-port.",
- (uchar**) &extra_max_connections,
- (uchar**) &extra_max_connections, 0, GET_ULONG, REQUIRED_ARG, 1, 1, 100000,
+ &extra_max_connections,
+ &extra_max_connections, 0, GET_ULONG, REQUIRED_ARG, 1, 1, 100000,
0, 1, 0},
{"gdb", OPT_DEBUGGING,
"Set up signals usable for debugging.",
- (uchar**) &opt_debugging, (uchar**) &opt_debugging,
+ &opt_debugging, &opt_debugging,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"general_log", OPT_GENERAL_LOG,
- "Enable/disable general log.", (uchar**) &opt_log,
- (uchar**) &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ "Enable/disable general log.", &opt_log,
+ &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_LARGE_PAGES
- {"large-pages", OPT_ENABLE_LARGE_PAGES, "Enable support for large pages. \
-Disable with --skip-large-pages.",
- (uchar**) &opt_large_pages, (uchar**) &opt_large_pages, 0, GET_BOOL, NO_ARG, 0, 0, 0,
- 0, 0, 0},
+ {"large-pages", OPT_ENABLE_LARGE_PAGES, "Enable support for large pages. "
+ "Disable with --skip-large-pages.", &opt_large_pages, &opt_large_pages,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"ignore-builtin-innodb", OPT_IGNORE_BUILTIN_INNODB ,
"Disable initialization of builtin InnoDB plugin.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"init-connect", OPT_INIT_CONNECT,
"Command(s) that are executed for each new connection.",
- (uchar**) &opt_init_connect, (uchar**) &opt_init_connect, 0, GET_STR_ALLOC,
+ &opt_init_connect, &opt_init_connect, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DISABLE_GRANT_OPTIONS
{"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup.",
- (uchar**) &opt_init_file, (uchar**) &opt_init_file, 0, GET_STR, REQUIRED_ARG,
+ &opt_init_file, &opt_init_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"init-rpl-role", OPT_INIT_RPL_ROLE, "Set the replication role.", 0, 0, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed by a slave server \
each time the SQL thread starts.",
- (uchar**) &opt_init_slave, (uchar**) &opt_init_slave, 0, GET_STR_ALLOC,
+ &opt_init_slave, &opt_init_slave, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"language", 'L',
"Client error messages in given language. May be given as a full path.",
- (uchar**) &language_ptr, (uchar**) &language_ptr, 0, GET_STR, REQUIRED_ARG,
+ &language_ptr, &language_ptr, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"lc-time-names", OPT_LC_TIME_NAMES,
"Set the language used for the month names and the days of the week.",
- (uchar**) &lc_time_names_name,
- (uchar**) &lc_time_names_name,
+ &lc_time_names_name, &lc_time_names_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"local-infile", OPT_LOCAL_INFILE,
"Enable/disable LOAD DATA LOCAL INFILE (takes values 1 or 0).",
- (uchar**) &opt_local_infile,
- (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG,
+ &opt_local_infile, &opt_local_infile, 0, GET_BOOL, OPT_ARG,
1, 0, 0, 0, 0, 0},
{"log", 'l', "Log connections and queries to file (deprecated option, use "
- "--general_log/--general_log_file instead).", (uchar**) &opt_logname,
- (uchar**) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ "--general_log/--general_log_file instead).", &opt_logname,
+ &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"general_log_file", OPT_GENERAL_LOG_FILE,
- "Log connections and queries to given file.", (uchar**) &opt_logname,
- (uchar**) &opt_logname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Log connections and queries to given file.", &opt_logname,
+ &opt_logname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"log-bin", OPT_BIN_LOG,
"Log update queries in binary format. Optional (but strongly recommended "
"to avoid replication problems if server's hostname changes) argument "
"should be the chosen location for the binary log files.",
- (uchar**) &opt_bin_logname, (uchar**) &opt_bin_logname, 0, GET_STR_ALLOC,
+ &opt_bin_logname, &opt_bin_logname, 0, GET_STR_ALLOC,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-bin-index", OPT_BIN_LOG_INDEX,
"File that holds the names for last binary log files.",
- (uchar**) &opt_binlog_index_name, (uchar**) &opt_binlog_index_name, 0, GET_STR,
+ &opt_binlog_index_name, &opt_binlog_index_name, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef TO_BE_REMOVED_IN_5_1_OR_6_0
/*
@@ -6267,7 +6316,7 @@ each time the SQL thread starts.",
*/
{"log-bin-trust-routine-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS_OLD,
"(deprecated) Use log-bin-trust-function-creators.",
- (uchar**) &trust_function_creators, (uchar**) &trust_function_creators, 0,
+ &trust_function_creators, &trust_function_creators, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
/*
@@ -6282,195 +6331,202 @@ each time the SQL thread starts.",
"Note that if ALL connections to this server ALWAYS use row-based binary "
"logging, the security issues do not exist and the binary logging cannot "
"break, so you can safely set this to 1."
- ,(uchar**) &trust_function_creators, (uchar**) &trust_function_creators, 0,
+ ,&trust_function_creators, &trust_function_creators, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-error", OPT_ERROR_LOG_FILE, "Error log file.",
- (uchar**) &log_error_file_ptr, (uchar**) &log_error_file_ptr, 0, GET_STR,
+ &log_error_file_ptr, &log_error_file_ptr, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.",
- (uchar**) &myisam_log_filename, (uchar**) &myisam_log_filename, 0, GET_STR,
+ &myisam_log_filename, &myisam_log_filename, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-long-format", '0',
- "Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.",
+ "Log some extra information to update log. Please note that this option "
+ "is deprecated; see --log-short-format option.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef WITH_CSV_STORAGE_ENGINE
{"log-output", OPT_LOG_OUTPUT,
"Syntax: log-output[=value[,value...]], where \"value\" could be TABLE, "
"FILE or NONE.",
- (uchar**) &log_output_str, (uchar**) &log_output_str, 0,
+ &log_output_str, &log_output_str, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES,
"Log queries that are executed without benefit of any index to the slow log if it is open.",
- (uchar**) &opt_log_queries_not_using_indexes, (uchar**) &opt_log_queries_not_using_indexes,
+ &opt_log_queries_not_using_indexes, &opt_log_queries_not_using_indexes,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-short-format", OPT_SHORT_LOG_FORMAT,
"Don't log extra information to update and slow-query logs.",
- (uchar**) &opt_short_log_format, (uchar**) &opt_short_log_format,
+ &opt_short_log_format, &opt_short_log_format,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-slave-updates", OPT_LOG_SLAVE_UPDATES,
- "Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.",
- (uchar**) &opt_log_slave_updates, (uchar**) &opt_log_slave_updates, 0, GET_BOOL,
+ "Tells the slave to log the updates from the slave thread to the binary log. "
+ "You will need to turn it on if you plan to daisy-chain the slaves.",
+ &opt_log_slave_updates, &opt_log_slave_updates, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-slow-admin-statements", OPT_LOG_SLOW_ADMIN_STATEMENTS,
- "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open. . Please note that this option is deprecated; see --log-slow-filter for filtering slow query log output",
- (uchar**) &opt_log_slow_admin_statements,
- (uchar**) &opt_log_slow_admin_statements,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements "
+ "to the slow log if it is open.", &opt_log_slow_admin_statements,
+ &opt_log_slow_admin_statements, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-slow-slave-statements", OPT_LOG_SLOW_SLAVE_STATEMENTS,
"Log slow statements executed by slave thread to the slow log if it is open.",
- (uchar**) &opt_log_slow_slave_statements,
- (uchar**) &opt_log_slow_slave_statements,
+ &opt_log_slow_slave_statements,
+ &opt_log_slow_slave_statements,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-slow-queries", OPT_SLOW_QUERY_LOG,
"Log slow queries to a table or log file. Defaults logging to table "
"mysql.slow_log or hostname-slow.log if --log-output=file is used. "
"Must be enabled to activate other slow log options. "
"(deprecated option, use --slow_query_log/--slow_query_log_file instead)",
- (uchar**) &opt_slow_logname, (uchar**) &opt_slow_logname, 0, GET_STR, OPT_ARG,
+ &opt_slow_logname, &opt_slow_logname, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
- {"slow-query-log-file", OPT_SLOW_QUERY_LOG_FILE,
- "Log slow queries to given log file. Defaults logging to hostname-slow.log.",
- (uchar**) &opt_slow_logname, (uchar**) &opt_slow_logname, 0, GET_STR,
+ {"slow_query_log_file", OPT_SLOW_QUERY_LOG_FILE,
+ "Log slow queries to given log file. Defaults logging to hostname-slow.log. "
+ "Must be enabled to activate other slow log options.",
+ &opt_slow_logname, &opt_slow_logname, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"log-tc", OPT_LOG_TC,
"Path to transaction coordinator log (used for transactions that affect "
"more than one storage engine, when binary log is disabled).",
- (uchar**) &opt_tc_log_file, (uchar**) &opt_tc_log_file, 0, GET_STR,
+ &opt_tc_log_file, &opt_tc_log_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_MMAP
{"log-tc-size", OPT_LOG_TC_SIZE, "Size of transaction coordinator log.",
- (uchar**) &opt_tc_log_size, (uchar**) &opt_tc_log_size, 0, GET_ULONG,
+ &opt_tc_log_size, &opt_tc_log_size, 0, GET_ULONG,
REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, (longlong) ULONG_MAX, 0,
TC_LOG_PAGE_SIZE, 0},
#endif
{"log-update", OPT_UPDATE_LOG,
"The update log is deprecated since version 5.0, is replaced by the binary "
"log and this option just turns on --log-bin instead.",
- (uchar**) &opt_update_logname, (uchar**) &opt_update_logname, 0, GET_STR,
+ &opt_update_logname, &opt_update_logname, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-warnings", 'W', "Log some not critical warnings to the log file.",
- (uchar**) &global_system_variables.log_warnings,
- (uchar**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
+ &global_system_variables.log_warnings,
+ &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
0, 0, 0},
{"low-priority-updates", OPT_LOW_PRIORITY_UPDATES,
"INSERT/DELETE/UPDATE has lower priority than selects.",
- (uchar**) &global_system_variables.low_priority_updates,
- (uchar**) &max_system_variables.low_priority_updates,
+ &global_system_variables.low_priority_updates,
+ &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,
+ &master_connect_retry, &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,
+ "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.",
+ &master_host, &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,
+ "The location and name of the file that remembers the master and where "
+ "the I/O replication thread is in the master's binlogs.",
+ &master_info_file, &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,
+ &master_password, &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,
+ "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.", &master_port, &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,
+ &master_retry_count, &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,
+ &master_ssl, &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,
+ &master_ssl_ca, &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,
+ &master_ssl_capath, &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,
+ &master_ssl_cert, &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,
+ &master_ssl_cipher, &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,
+ &master_ssl_key, &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,
+ "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.",
+ &master_user, &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.",
- (uchar**) &max_binlog_dump_events, (uchar**) &max_binlog_dump_events, 0,
+ &max_binlog_dump_events, &max_binlog_dump_events, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif /* HAVE_REPLICATION */
- {"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (uchar**) &locked_in_memory,
- (uchar**) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", &locked_in_memory,
+ &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef SAFE_MUTEX
{"mutex-deadlock-detector", OPT_MUTEX_DEADLOCK_DETECTOR,
"Enable checking of wrong mutex usage.",
- (uchar**) &safe_mutex_deadlock_detector,
- (uchar**) &safe_mutex_deadlock_detector,
+ &safe_mutex_deadlock_detector,
+ &safe_mutex_deadlock_detector,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
#endif
{"myisam-recover", OPT_MYISAM_RECOVER,
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
- (uchar**) &myisam_recover_options_str, (uchar**) &myisam_recover_options_str, 0,
+ &myisam_recover_options_str, &myisam_recover_options_str, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
{"ndb-connectstring", OPT_NDB_CONNECTSTRING,
"Connect string for ndbcluster.",
- (uchar**) &opt_ndb_connectstring,
- (uchar**) &opt_ndb_connectstring,
+ &opt_ndb_connectstring, &opt_ndb_connectstring,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-mgmd-host", OPT_NDB_MGMD,
"Set host and port for ndb_mgmd. Syntax: hostname[:port]",
- (uchar**) &opt_ndb_mgmd,
- (uchar**) &opt_ndb_mgmd,
+ &opt_ndb_mgmd, &opt_ndb_mgmd,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-nodeid", OPT_NDB_NODEID,
"Nodeid for this mysqlserver in the cluster.",
- (uchar**) &opt_ndb_nodeid,
- (uchar**) &opt_ndb_nodeid,
+ &opt_ndb_nodeid,
+ &opt_ndb_nodeid,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-autoincrement-prefetch-sz", OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
"Specify number of autoincrement values that are prefetched.",
- (uchar**) &global_system_variables.ndb_autoincrement_prefetch_sz,
- (uchar**) &max_system_variables.ndb_autoincrement_prefetch_sz,
+ &global_system_variables.ndb_autoincrement_prefetch_sz,
+ &max_system_variables.ndb_autoincrement_prefetch_sz,
0, GET_ULONG, REQUIRED_ARG, 1, 1, 256, 0, 0, 0},
{"ndb-force-send", OPT_NDB_FORCE_SEND,
"Force send of buffers to ndb immediately without waiting for "
"other threads.",
- (uchar**) &global_system_variables.ndb_force_send,
- (uchar**) &global_system_variables.ndb_force_send,
+ &global_system_variables.ndb_force_send,
+ &global_system_variables.ndb_force_send,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb_force_send", OPT_NDB_FORCE_SEND,
"same as --ndb-force-send.",
- (uchar**) &global_system_variables.ndb_force_send,
- (uchar**) &global_system_variables.ndb_force_send,
+ &global_system_variables.ndb_force_send,
+ &global_system_variables.ndb_force_send,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb-extra-logging", OPT_NDB_EXTRA_LOGGING,
"Turn on more logging in the error log.",
- (uchar**) &ndb_extra_logging,
- (uchar**) &ndb_extra_logging,
+ &ndb_extra_logging,
+ &ndb_extra_logging,
0, GET_INT, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_NDB_BINLOG
{"ndb-report-thresh-binlog-epoch-slip", OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP,
@@ -6478,86 +6534,87 @@ thread is in the master's binlogs.",
"E.g., 3 means that if the difference between what epoch has been received "
"from the storage nodes and what has been applied to the binlog is 3 or more, "
"a status message will be sent to the cluster log.",
- (uchar**) &ndb_report_thresh_binlog_epoch_slip,
- (uchar**) &ndb_report_thresh_binlog_epoch_slip,
+ &ndb_report_thresh_binlog_epoch_slip,
+ &ndb_report_thresh_binlog_epoch_slip,
0, GET_ULONG, REQUIRED_ARG, 3, 0, 256, 0, 0, 0},
{"ndb-report-thresh-binlog-mem-usage", OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE,
"Threshold on percentage of free memory before reporting binlog status. E.g., "
"10 means that if amount of available memory for receiving binlog data from "
"the storage nodes goes below 10%, "
"a status message will be sent to the cluster log.",
- (uchar**) &ndb_report_thresh_binlog_mem_usage,
- (uchar**) &ndb_report_thresh_binlog_mem_usage,
+ &ndb_report_thresh_binlog_mem_usage,
+ &ndb_report_thresh_binlog_mem_usage,
0, GET_ULONG, REQUIRED_ARG, 10, 0, 100, 0, 0, 0},
#endif
{"ndb-use-exact-count", OPT_NDB_USE_EXACT_COUNT,
"Use exact records count during query planning and for fast "
"select count(*), disable for faster queries.",
- (uchar**) &global_system_variables.ndb_use_exact_count,
- (uchar**) &global_system_variables.ndb_use_exact_count,
+ &global_system_variables.ndb_use_exact_count,
+ &global_system_variables.ndb_use_exact_count,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb_use_exact_count", OPT_NDB_USE_EXACT_COUNT,
"Same as --ndb-use-exact-count.",
- (uchar**) &global_system_variables.ndb_use_exact_count,
- (uchar**) &global_system_variables.ndb_use_exact_count,
+ &global_system_variables.ndb_use_exact_count,
+ &global_system_variables.ndb_use_exact_count,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb-use-transactions", OPT_NDB_USE_TRANSACTIONS,
"Use transactions for large inserts, if enabled then large "
"inserts will be split into several smaller transactions",
- (uchar**) &global_system_variables.ndb_use_transactions,
- (uchar**) &global_system_variables.ndb_use_transactions,
+ &global_system_variables.ndb_use_transactions,
+ &global_system_variables.ndb_use_transactions,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb_use_transactions", OPT_NDB_USE_TRANSACTIONS,
"Same as --ndb-use-transactions.",
- (uchar**) &global_system_variables.ndb_use_transactions,
- (uchar**) &global_system_variables.ndb_use_transactions,
+ &global_system_variables.ndb_use_transactions,
+ &global_system_variables.ndb_use_transactions,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ndb-shm", OPT_NDB_SHM,
"Use shared memory connections when available.",
- (uchar**) &opt_ndb_shm,
- (uchar**) &opt_ndb_shm,
+ &opt_ndb_shm, &opt_ndb_shm,
0, GET_BOOL, OPT_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0},
{"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,
"Select nodes for transactions in a more optimal way.",
- (uchar**) &opt_ndb_optimized_node_selection,
- (uchar**) &opt_ndb_optimized_node_selection,
+ &opt_ndb_optimized_node_selection,
+ &opt_ndb_optimized_node_selection,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{ "ndb-cache-check-time", OPT_NDB_CACHE_CHECK_TIME,
"A dedicated thread is created to, at the given milliseconds interval, "
"invalidate the query cache if another MySQL server in the cluster has "
"changed the data in the database.",
- (uchar**) &opt_ndb_cache_check_time, (uchar**) &opt_ndb_cache_check_time, 0, GET_ULONG, REQUIRED_ARG,
+ &opt_ndb_cache_check_time, &opt_ndb_cache_check_time, 0, GET_ULONG, REQUIRED_ARG,
0, 0, LONG_TIMEOUT, 0, 1, 0},
{"ndb-index-stat-enable", OPT_NDB_INDEX_STAT_ENABLE,
"Use ndb index statistics in query optimization.",
- (uchar**) &global_system_variables.ndb_index_stat_enable,
- (uchar**) &max_system_variables.ndb_index_stat_enable,
+ &global_system_variables.ndb_index_stat_enable,
+ &max_system_variables.ndb_index_stat_enable,
0, GET_BOOL, OPT_ARG, 0, 0, 1, 0, 0, 0},
#endif
{"ndb-use-copying-alter-table",
OPT_NDB_USE_COPYING_ALTER_TABLE,
- "Force ndbcluster to always copy tables at alter table (should only be used if on-line alter table fails).",
- (uchar**) &global_system_variables.ndb_use_copying_alter_table,
- (uchar**) &global_system_variables.ndb_use_copying_alter_table,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "Force ndbcluster to always copy tables at alter table "
+ "(should only be used if on-line alter table fails).",
+ &global_system_variables.ndb_use_copying_alter_table,
+ &global_system_variables.ndb_use_copying_alter_table,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"new", 'n', "Use very new, possibly 'unsafe', functions.",
- (uchar**) &global_system_variables.new_mode,
- (uchar**) &max_system_variables.new_mode,
+ &global_system_variables.new_mode,
+ &max_system_variables.new_mode,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef NOT_YET
{"no-mix-table-types", OPT_NO_MIX_TYPE,
"Don't allow commands that use two different table types.",
- (uchar**) &opt_no_mix_types, (uchar**) &opt_no_mix_types, 0, GET_BOOL, NO_ARG,
+ &opt_no_mix_types, &opt_no_mix_types, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"old-alter-table", OPT_OLD_ALTER_TABLE,
"Use old, non-optimized alter table.",
- (uchar**) &global_system_variables.old_alter_table,
- (uchar**) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG,
+ &global_system_variables.old_alter_table,
+ &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for 4.0 and older clients).",
- (uchar**) &global_system_variables.old_passwords,
- (uchar**) &max_system_variables.old_passwords, 0, GET_BOOL, NO_ARG,
+ {"old-passwords", OPT_OLD_PASSWORDS, "Use old password "
+ "encryption method (needed for 4.0 and older clients).",
+ &global_system_variables.old_passwords,
+ &max_system_variables.old_passwords, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"one-thread", OPT_ONE_THREAD,
"(Deprecated): Only use one thread (for debugging under Linux). Use "
@@ -6566,10 +6623,10 @@ thread is in the master's binlogs.",
{"old-style-user-limits", OPT_OLD_STYLE_USER_LIMITS,
"Enable old-style user limits (before 5.0.3, user resources were counted "
"per each user+host vs. per account).",
- (uchar**) &opt_old_style_user_limits, (uchar**) &opt_old_style_user_limits,
+ &opt_old_style_user_limits, &opt_old_style_user_limits,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld.",
- (uchar**) &pidfile_name_ptr, (uchar**) &pidfile_name_ptr, 0, GET_STR,
+ &pidfile_name_ptr, &pidfile_name_ptr, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, "
@@ -6577,64 +6634,85 @@ thread is in the master's binlogs.",
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
- (uchar**) &mysqld_port,
- (uchar**) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ &mysqld_port,
+ &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port-open-timeout", OPT_PORT_OPEN_TIMEOUT,
"Maximum time in seconds to wait for the port to become free. "
- "(Default: No wait).", (uchar**) &mysqld_port_timeout,
- (uchar**) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "(Default: No wait).", &mysqld_port_timeout,
+ &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
{"profiling_history_size", OPT_PROFILING, "Limit of query profiling memory.",
- (uchar**) &global_system_variables.profiling_history_size,
- (uchar**) &max_system_variables.profiling_history_size,
+ &global_system_variables.profiling_history_size,
+ &max_system_variables.profiling_history_size,
0, GET_ULONG, REQUIRED_ARG, 15, 0, 100, 0, 0, 0},
#endif
{"relay-log", OPT_RELAY_LOG,
"The location and name to use for relay logs.",
- (uchar**) &opt_relay_logname, (uchar**) &opt_relay_logname, 0,
+ &opt_relay_logname, &opt_relay_logname, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relay-log-index", OPT_RELAY_LOG_INDEX,
"The location and name to use for the file that keeps a list of the last \
relay logs.",
- (uchar**) &opt_relaylog_index_name, (uchar**) &opt_relaylog_index_name, 0,
+ &opt_relaylog_index_name, &opt_relaylog_index_name, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE,
"The location and name of the file that remembers where the SQL replication \
thread is in the relay logs.",
- (uchar**) &relay_log_info_file, (uchar**) &relay_log_info_file, 0, GET_STR,
+ &relay_log_info_file, &relay_log_info_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-do-db", OPT_REPLICATE_DO_DB,
- "Tells the slave thread to restrict replication to the specified database. To specify more than one database, use the directive multiple times, once for each database. Note that this will only work if you do not use cross-database queries such as UPDATE some_db.some_table SET foo='bar' while having selected a different or no database. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-do-table=db_name.%.",
+ "Tells the slave thread to restrict replication to the specified database. "
+ "To specify more than one database, use the directive multiple times, "
+ "once for each database. Note that this will only work if you do not use "
+ "cross-database queries such as UPDATE some_db.some_table SET foo='bar' "
+ "while having selected a different or no database. If you need cross "
+ "database updates to work, make sure you have 3.23.28 or later, and use "
+ "replicate-wild-do-table=db_name.%.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-do-table", OPT_REPLICATE_DO_TABLE,
- "Tells the slave thread to restrict replication to the specified table. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates, in contrast to replicate-do-db.",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Tells the slave thread to restrict replication to the specified table. "
+ "To specify more than one table, use the directive multiple times, once "
+ "for each table. This will work for cross-database updates, in contrast "
+ "to replicate-do-db.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-ignore-db", OPT_REPLICATE_IGNORE_DB,
- "Tells the slave thread to not replicate to the specified database. To specify more than one database to ignore, use the directive multiple times, once for each database. This option will not work if you use cross database updates. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-ignore-table=db_name.%. ",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Tells the slave thread to not replicate to the specified database. To "
+ "specify more than one database to ignore, use the directive multiple "
+ "times, once for each database. This option will not work if you use "
+ "cross database updates. If you need cross database updates to work, "
+ "make sure you have 3.23.28 or later, and use replicate-wild-ignore-"
+ "table=db_name.%. ", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-ignore-table", OPT_REPLICATE_IGNORE_TABLE,
"Tells the slave thread to not replicate to the specified table. To specify "
"more than one table to ignore, use the directive multiple times, once for "
"each table. This will work for cross-database updates, in contrast to "
- "replicate-ignore-db.",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "replicate-ignore-db.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB,
- "Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name.",
+ "Updates to a database with a different name than the original. Example: "
+ "replicate-rewrite-db=master_db_name->slave_db_name.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_REPLICATION
{"replicate-same-server-id", OPT_REPLICATE_SAME_SERVER_ID,
- "In replication, if set to 1, do not skip events having our server id. \
-Default value is 0 (to break infinite loops in circular replication). \
-Can't be set to 1 if --log-slave-updates is used.",
- (uchar**) &replicate_same_server_id,
- (uchar**) &replicate_same_server_id,
+ "In replication, if set to 1, do not skip events having our server id. "
+ "Default value is 0 (to break infinite loops in circular replication). "
+ "Can't be set to 1 if --log-slave-updates is used.",
+ &replicate_same_server_id, &replicate_same_server_id,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE,
- "Tells the slave thread to restrict replication to the tables that match the specified wildcard pattern. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-do-table=foo%.bar% will replicate only updates to tables in all databases that start with foo and whose table names start with bar.",
+ "Tells the slave thread to restrict replication to the tables that match "
+ "the specified wildcard pattern. To specify more than one table, use the "
+ "directive multiple times, once for each table. This will work for cross-"
+ "database updates. Example: replicate-wild-do-table=foo%.bar% will "
+ "replicate only updates to tables in all databases that start with foo "
+ "and whose table names start with bar.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-wild-ignore-table", OPT_REPLICATE_WILD_IGNORE_TABLE,
- "Tells the slave thread to not replicate to the tables that match the given wildcard pattern. To specify more than one table to ignore, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-ignore-table=foo%.bar% will not do updates to tables in databases that start with foo and whose table names start with bar.",
+ "Tells the slave thread to not replicate to the tables that match the "
+ "given wildcard pattern. To specify more than one table to ignore, use "
+ "the directive multiple times, once for each table. This will work for "
+ "cross-database updates. Example: replicate-wild-ignore-table=foo%.bar% "
+ "will not do updates to tables in databases that start with foo and whose "
+ "table names start with bar.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
// In replication, we may need to tell the other servers how to connect
{"report-host", OPT_REPORT_HOST,
@@ -6645,19 +6723,22 @@ Can't be set to 1 if --log-slave-updates is used.",
"from the socket once the slave connects. Due to NAT and other routing "
"issues, that IP may not be valid for connecting to the slave from the "
"master or other hosts.",
- (uchar**) &report_host, (uchar**) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
+ &report_host, &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
0, 0, 0, 0},
{"report-password", OPT_REPORT_PASSWORD, "Undocumented.",
- (uchar**) &report_password, (uchar**) &report_password, 0, GET_STR,
+ &report_password, &report_password, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"report-port", OPT_REPORT_PORT,
- "Port for connecting to slave reported to the master during slave registration. Set it only if the slave is listening on a non-default port or if you have a special tunnel from the master or other clients to the slave. If not sure, leave this option unset.",
- (uchar**) &report_port, (uchar**) &report_port, 0, GET_UINT, REQUIRED_ARG,
+ "Port for connecting to slave reported to the master during slave "
+ "registration. Set it only if the slave is listening on a non-default "
+ "port or if you have a special tunnel from the master or other clients "
+ "to the slave. If not sure, leave this option unset.",
+ &report_port, &report_port, 0, GET_UINT, REQUIRED_ARG,
MYSQL_PORT, 0, 0, 0, 0, 0},
- {"report-user", OPT_REPORT_USER, "Undocumented.", (uchar**) &report_user,
- (uchar**) &report_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"report-user", OPT_REPORT_USER, "Undocumented.", &report_user,
+ &report_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"rpl-recovery-rank", OPT_RPL_RECOVERY_RANK, "Undocumented.",
- (uchar**) &rpl_recovery_rank, (uchar**) &rpl_recovery_rank, 0, GET_ULONG,
+ &rpl_recovery_rank, &rpl_recovery_rank, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -6668,21 +6749,21 @@ Can't be set to 1 if --log-slave-updates is used.",
#endif
{"safe-user-create", OPT_SAFE_USER_CREATE,
"Don't allow new user creation by the user who has no write privileges to the mysql.user table.",
- (uchar**) &opt_safe_user_create, (uchar**) &opt_safe_user_create, 0, GET_BOOL,
+ &opt_safe_user_create, &opt_safe_user_create, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
"Simulate memory shortage when compiled with the --with-debug=full option.",
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"secure-auth", OPT_SECURE_AUTH, "Disallow authentication for accounts that have old (pre-4.1) passwords.",
- (uchar**) &opt_secure_auth, (uchar**) &opt_secure_auth, 0, GET_BOOL, NO_ARG,
+ &opt_secure_auth, &opt_secure_auth, 0, GET_BOOL, NO_ARG,
my_bool(0), 0, 0, 0, 0, 0},
{"secure-file-priv", OPT_SECURE_FILE_PRIV,
"Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory.",
- (uchar**) &opt_secure_file_priv, (uchar**) &opt_secure_file_priv, 0,
+ &opt_secure_file_priv, &opt_secure_file_priv, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID,
"Uniquely identifies the server instance in the community of replication partners.",
- (uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, UINT_MAX32,
+ &server_id, &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, UINT_MAX32,
0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; "
@@ -6690,20 +6771,20 @@ Can't be set to 1 if --log-slave-updates is used.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory", OPT_ENABLE_SHARED_MEMORY,
- "Enable the shared memory.",(uchar**) &opt_enable_shared_memory, (uchar**) &opt_enable_shared_memory,
+ "Enable the shared memory.",&opt_enable_shared_memory, &opt_enable_shared_memory,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"shared-memory-base-name",OPT_SHARED_MEMORY_BASE_NAME,
- "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
+ "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO,
"Show user and password in SHOW SLAVE HOSTS on this master.",
- (uchar**) &opt_show_slave_auth_info, (uchar**) &opt_show_slave_auth_info, 0,
+ &opt_show_slave_auth_info, &opt_show_slave_auth_info, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DISABLE_GRANT_OPTIONS
{"skip-grant-tables", OPT_SKIP_GRANT,
"Start without grant tables. This gives all users FULL ACCESS to all tables.",
- (uchar**) &opt_noacl, (uchar**) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ &opt_noacl, &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
#endif
{"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names.", 0, 0, 0,
@@ -6730,49 +6811,55 @@ Can't be set to 1 if --log-slave-updates is used.",
"Don't allow 'SHOW DATABASE' commands.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"skip-slave-start", OPT_SKIP_SLAVE_START,
- "If set, slave is not autostarted.", (uchar**) &opt_skip_slave_start,
- (uchar**) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "If set, slave is not autostarted.", &opt_skip_slave_start,
+ &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-stack-trace", OPT_SKIP_STACK_TRACE,
"Don't print a stack trace on failure.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
- {"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables. Deprecated option. Use --skip-symbolic-links instead.",
+ {"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables. "
+ "Deprecated option. Use --skip-symbolic-links instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-thread-priority", OPT_SKIP_PRIOR,
"Don't give threads different priorities. Deprecated option.", 0, 0, 0, GET_NO_ARG, NO_ARG,
DEFAULT_SKIP_THREAD_PRIORITY, 0, 0, 0, 0, 0},
#ifdef HAVE_REPLICATION
{"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR,
- "The location where the slave should put its temporary files when \
-replicating a LOAD DATA INFILE command.",
- (uchar**) &slave_load_tmpdir, (uchar**) &slave_load_tmpdir, 0, GET_STR_ALLOC,
+ "The location where the slave should put its temporary files when "
+ "replicating a LOAD DATA INFILE command.",
+ &slave_load_tmpdir, &slave_load_tmpdir, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS,
"Tells the slave thread to continue replication when a query event returns an error from the provided list.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"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},
+ "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.",
+ &slave_exec_mode_str, &slave_exec_mode_str, 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,
- (uchar**) &opt_slow_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ "Enable/disable slow query log.", &opt_slow_log,
+ &opt_slow_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"socket", OPT_SOCKET, "Socket file to use for connection.",
- (uchar**) &mysqld_unix_port, (uchar**) &mysqld_unix_port, 0, GET_STR,
+ &mysqld_unix_port, &mysqld_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_REPLICATION
{"sporadic-binlog-dump-fail", OPT_SPORADIC_BINLOG_DUMP_FAIL,
"Option used by mysql-test for debugging and testing of replication.",
- (uchar**) &opt_sporadic_binlog_dump_fail,
- (uchar**) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ &opt_sporadic_binlog_dump_fail,
+ &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
#endif /* HAVE_REPLICATION */
{"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME,
- "The update log is deprecated since version 5.0, is replaced by the binary \
-log and this option does nothing anymore.",
+ "The update log is deprecated since version 5.0, is replaced by the "
+ "binary log and this option does nothing anymore.",
0, 0, 0, GET_DISABLED, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sql-mode", OPT_SQL_MODE,
- "Syntax: sql-mode=option[,option[,option...]] where option can be one of: REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, ONLY_FULL_GROUP_BY, NO_UNSIGNED_SUBTRACTION.",
- (uchar**) &sql_mode_str, (uchar**) &sql_mode_str, 0, GET_STR, REQUIRED_ARG, 0,
+ "Syntax: sql-mode=option[,option[,option...]] where option can be one "
+ "of: REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, "
+ "ONLY_FULL_GROUP_BY, NO_UNSIGNED_SUBTRACTION.",
+ &sql_mode_str, &sql_mode_str, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
#ifdef HAVE_OPENSSL
#include "sslopt-longopts.h"
@@ -6783,7 +6870,7 @@ log and this option does nothing anymore.",
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"symbolic-links", 's', "Enable symbolic link support.",
- (uchar**) &my_use_symdir, (uchar**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
+ &my_use_symdir, &my_use_symdir, 0, GET_BOOL, NO_ARG,
/*
The system call realpath() produces warnings under valgrind and
purify. These are not suppressed: instead we disable symlinks
@@ -6791,41 +6878,43 @@ log and this option does nothing anymore.",
*/
IF_VALGRIND(0,1), 0, 0, 0, 0, 0},
{"sysdate-is-now", OPT_SYSDATE_IS_NOW,
- "Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within the same statement.",
- (uchar**) &global_system_variables.sysdate_is_now,
+ "Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. "
+ "Since 5.0, SYSDATE() returns a `dynamic' value different for different "
+ "invocations, even within the same statement.",
+ &global_system_variables.sysdate_is_now,
0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
{"tc-heuristic-recover", OPT_TC_HEURISTIC_RECOVER,
- "Decision to use in heuristic recover process. Possible values are COMMIT or ROLLBACK.",
- (uchar**) &opt_tc_heuristic_recover, (uchar**) &opt_tc_heuristic_recover,
+ "Decision to use in heuristic recover process. Possible values are COMMIT "
+ "or ROLLBACK.", &opt_tc_heuristic_recover, &opt_tc_heuristic_recover,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#if defined(ENABLED_DEBUG_SYNC)
{"debug-sync-timeout", OPT_DEBUG_SYNC_TIMEOUT,
"Enable the debug sync facility "
"and optionally specify a default wait timeout in seconds. "
"A zero value keeps the facility disabled.",
- (uchar**) &opt_debug_sync_timeout, 0,
+ &opt_debug_sync_timeout, 0,
0, GET_UINT, OPT_ARG, 0, 0, UINT_MAX, 0, 0, 0},
#endif /* defined(ENABLED_DEBUG_SYNC) */
{"temp-pool", OPT_TEMP_POOL,
#if (ENABLE_TEMP_POOL)
- "Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.",
+ "Using this option will cause most temporary files created to use a small "
+ "set of names, rather than a unique name for each new file.",
#else
"This option is ignored on this OS.",
#endif
- (uchar**) &use_temp_pool, (uchar**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1,
+ &use_temp_pool, &use_temp_pool, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
-
{"test-ignore-wrong-options", OPT_TEST_IGNORE_WRONG_OPTIONS,
"Ignore wrong enums values in command line arguments. Useful only for test scripts",
- (uchar**) &opt_ignore_wrong_options, (uchar**) &opt_ignore_wrong_options,
+ &opt_ignore_wrong_options, &opt_ignore_wrong_options,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"test-expect-abort", OPT_TEST_RESTART,
"Expect that server aborts with 'abort'; Don't write out server variables on 'abort'. Useful only for test scripts",
- (uchar**) &opt_expect_abort, (uchar**) &opt_expect_abort,
+ &opt_expect_abort, &opt_expect_abort,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"timed_mutexes", OPT_TIMED_MUTEXES,
"Specify whether to time mutexes (only InnoDB mutexes are currently supported).",
- (uchar**) &timed_mutexes, (uchar**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0,
+ &timed_mutexes, &timed_mutexes, 0, GET_BOOL, NO_ARG, 0,
0, 0, 0, 0, 0},
{"tmpdir", 't',
"Path for temporary files. Several paths may be specified, separated by a "
@@ -6835,133 +6924,140 @@ log and this option does nothing anymore.",
"colon (:)"
#endif
", in this case they are used in a round-robin fashion.",
- (uchar**) &opt_mysql_tmpdir,
- (uchar**) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ &opt_mysql_tmpdir, &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG,
+ 0, 0, 0, 0, 0, 0},
{"transaction-isolation", OPT_TX_ISOLATION,
"Default transaction isolation level.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
- {"use-symbolic-links", OPT_SYMBOLIC_LINKS, "Enable symbolic link support. Deprecated option; use --symbolic-links instead.",
- (uchar**) &my_use_symdir, (uchar**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
+ {"use-symbolic-links", OPT_SYMBOLIC_LINKS,
+ "Enable symbolic link support. "
+ "Deprecated option; use --symbolic-links instead.",
+ &my_use_symdir, &my_use_symdir, 0, GET_BOOL, NO_ARG,
IF_VALGRIND(0,1), 0, 0, 0, 0, 0},
{"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Used with --help option for detailed help.",
- (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
- 0, 0},
+ &opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"warnings", OPT_WARNINGS, "Deprecated; use --log-warnings instead.",
- (uchar**) &global_system_variables.log_warnings,
- (uchar**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG,
- 1, 0, (longlong) ULONG_MAX, 0, 0, 0},
- { "back_log", OPT_BACK_LOG,
- "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.",
- (uchar**) &back_log, (uchar**) &back_log, 0, GET_ULONG,
- REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 },
+ &global_system_variables.log_warnings,
+ &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG,
+ 1, 0, ULONG_MAX, 0, 0, 0},
+ {"back_log", OPT_BACK_LOG,
+ "The number of outstanding connection requests MySQL can have. This "
+ "comes into play when the main MySQL thread gets very many connection "
+ "requests in a very short time.", &back_log, &back_log, 0, GET_ULONG,
+ REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 },
{"binlog_cache_size", OPT_BINLOG_CACHE_SIZE,
- "The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.",
- (uchar**) &binlog_cache_size, (uchar**) &binlog_cache_size, 0, GET_ULONG,
+ "The size of the cache to hold the SQL statements for the binary log "
+ "during a transaction. If you often use big, multi-statement "
+ "transactions you can increase this to get more performance.",
+ &binlog_cache_size, &binlog_cache_size, 0, GET_ULONG,
REQUIRED_ARG, 32*1024L, IO_SIZE, (longlong) ULONG_MAX, 0, IO_SIZE, 0},
{"bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE,
- "Size of tree cache used in bulk insert optimization. Note that this is a limit per thread.",
- (uchar**) &global_system_variables.bulk_insert_buff_size,
- (uchar**) &max_system_variables.bulk_insert_buff_size,
+ "Size of tree cache used in bulk insert optimization. Note that this "
+ "is a limit per thread.", &global_system_variables.bulk_insert_buff_size,
+ &max_system_variables.bulk_insert_buff_size,
0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, (longlong) ULONG_MAX, 0, 1, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT,
- "The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'.",
- (uchar**) &connect_timeout, (uchar**) &connect_timeout,
+ "The number of seconds the mysqld server is waiting for a connect packet "
+ "before responding with 'Bad handshake'.", &connect_timeout, &connect_timeout,
0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 },
{ "date_format", OPT_DATE_FORMAT,
"The DATE format (for future).",
- (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
- (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
+ &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
+ &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "datetime_format", OPT_DATETIME_FORMAT,
"The DATETIME/TIMESTAMP format (for future).",
- (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
- (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
+ &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
+ &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "default_week_format", OPT_DEFAULT_WEEK_FORMAT,
"The default week format used by WEEK() functions.",
- (uchar**) &global_system_variables.default_week_format,
- (uchar**) &max_system_variables.default_week_format,
+ &global_system_variables.default_week_format,
+ &max_system_variables.default_week_format,
0, GET_ULONG, REQUIRED_ARG, 0, 0, 7L, 0, 1, 0},
{"delayed_insert_limit", OPT_DELAYED_INSERT_LIMIT,
- "After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing.",
- (uchar**) &delayed_insert_limit, (uchar**) &delayed_insert_limit, 0, GET_ULONG,
+ "After inserting delayed_insert_limit rows, the INSERT DELAYED handler "
+ "will check if there are any SELECT statements pending. If so, it allows "
+ "these to execute before continuing.",
+ &delayed_insert_limit, &delayed_insert_limit, 0, GET_ULONG,
REQUIRED_ARG, DELAYED_LIMIT, 1, (longlong) ULONG_MAX, 0, 1, 0},
{"delayed_insert_timeout", OPT_DELAYED_INSERT_TIMEOUT,
"How long a INSERT DELAYED thread should wait for INSERT statements before terminating.",
- (uchar**) &delayed_insert_timeout, (uchar**) &delayed_insert_timeout, 0,
+ &delayed_insert_timeout, &delayed_insert_timeout, 0,
GET_ULONG, REQUIRED_ARG, DELAYED_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{ "delayed_queue_size", OPT_DELAYED_QUEUE_SIZE,
- "What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again.",
- (uchar**) &delayed_queue_size, (uchar**) &delayed_queue_size, 0, GET_ULONG,
+ "What size queue (in rows) should be allocated for handling INSERT DELAYED. "
+ "If the queue becomes full, any client that does INSERT DELAYED will wait "
+ "until there is room in the queue again.",
+ &delayed_queue_size, &delayed_queue_size, 0, GET_ULONG,
REQUIRED_ARG, DELAYED_QUEUE_SIZE, 1, (longlong) ULONG_MAX, 0, 1, 0},
{"div_precision_increment", OPT_DIV_PRECINCREMENT,
"Precision of the result of '/' operator will be increased on that value.",
- (uchar**) &global_system_variables.div_precincrement,
- (uchar**) &max_system_variables.div_precincrement, 0, GET_ULONG,
+ &global_system_variables.div_precincrement,
+ &max_system_variables.div_precincrement, 0, GET_ULONG,
REQUIRED_ARG, 4, 0, DECIMAL_MAX_SCALE, 0, 0, 0},
{"expire_logs_days", OPT_EXPIRE_LOGS_DAYS,
"If non-zero, binary logs will be purged after expire_logs_days "
"days; possible purges happen at startup and at binary log rotation.",
- (uchar**) &expire_logs_days,
- (uchar**) &expire_logs_days, 0, GET_ULONG,
+ &expire_logs_days, &expire_logs_days, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 99, 0, 1, 0},
{ "flush_time", OPT_FLUSH_TIME,
"A dedicated thread is created to flush all tables at the given interval.",
- (uchar**) &flush_time, (uchar**) &flush_time, 0, GET_ULONG, REQUIRED_ARG,
+ &flush_time, &flush_time, 0, GET_ULONG, REQUIRED_ARG,
FLUSH_TIME, 0, LONG_TIMEOUT, 0, 1, 0},
{ "ft_boolean_syntax", OPT_FT_BOOLEAN_SYNTAX,
"List of operators for MATCH ... AGAINST ( ... IN BOOLEAN MODE).",
- 0, 0, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN,
- "The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
- (uchar**) &ft_max_word_len, (uchar**) &ft_max_word_len, 0, GET_ULONG,
+ "The maximum length of the word to be included in a FULLTEXT index. "
+ "Note: FULLTEXT indexes must be rebuilt after changing this variable.",
+ &ft_max_word_len, &ft_max_word_len, 0, GET_ULONG,
REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, HA_FT_MAXCHARLEN, 0, 1, 0},
{ "ft_min_word_len", OPT_FT_MIN_WORD_LEN,
- "The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
- (uchar**) &ft_min_word_len, (uchar**) &ft_min_word_len, 0, GET_ULONG,
+ "The minimum length of the word to be included in a FULLTEXT index. "
+ "Note: FULLTEXT indexes must be rebuilt after changing this variable.",
+ &ft_min_word_len, &ft_min_word_len, 0, GET_ULONG,
REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, 0, 1, 0},
{ "ft_query_expansion_limit", OPT_FT_QUERY_EXPANSION_LIMIT,
"Number of best matches to use for query expansion.",
- (uchar**) &ft_query_expansion_limit, (uchar**) &ft_query_expansion_limit, 0, GET_ULONG,
+ &ft_query_expansion_limit, &ft_query_expansion_limit, 0, GET_ULONG,
REQUIRED_ARG, 20, 0, 1000, 0, 1, 0},
{ "ft_stopword_file", OPT_FT_STOPWORD_FILE,
"Use stopwords from this file instead of built-in list.",
- (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR,
+ &ft_stopword_file, &ft_stopword_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "group_concat_max_len", OPT_GROUP_CONCAT_MAX_LEN,
"The maximum length of the result of function group_concat.",
- (uchar**) &global_system_variables.group_concat_max_len,
- (uchar**) &max_system_variables.group_concat_max_len, 0, GET_ULONG,
+ &global_system_variables.group_concat_max_len,
+ &max_system_variables.group_concat_max_len, 0, GET_ULONG,
REQUIRED_ARG, 1024, 4, (longlong) ULONG_MAX, 0, 1, 0},
{"interactive_timeout", OPT_INTERACTIVE_TIMEOUT,
- "The number of seconds the server waits for activity on an interactive connection before closing it.",
- (uchar**) &global_system_variables.net_interactive_timeout,
- (uchar**) &max_system_variables.net_interactive_timeout, 0,
+ "The number of seconds the server waits for activity on an interactive "
+ "connection before closing it.",
+ &global_system_variables.net_interactive_timeout,
+ &max_system_variables.net_interactive_timeout, 0,
GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"join_buffer_size", OPT_JOIN_BUFF_SIZE,
"The size of the buffer that is used for full joins.",
- (uchar**) &global_system_variables.join_buff_size,
- (uchar**) &max_system_variables.join_buff_size, 0, GET_ULONG,
+ &global_system_variables.join_buff_size,
+ &max_system_variables.join_buff_size, 0, GET_ULONG,
REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, (longlong) ULONG_MAX,
MALLOC_OVERHEAD, IO_SIZE, 0},
{"keep_files_on_create", OPT_KEEP_FILES_ON_CREATE,
"Don't overwrite stale .MYD and .MYI even if no directory is specified.",
- (uchar**) &global_system_variables.keep_files_on_create,
- (uchar**) &max_system_variables.keep_files_on_create,
+ &global_system_variables.keep_files_on_create,
+ &max_system_variables.keep_files_on_create,
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"key_buffer_size", OPT_KEY_BUFFER_SIZE,
"The size of the buffer used for index blocks for MyISAM tables. Increase "
"this to get better index handling (for all reads and multiple writes) to "
"as much as you can afford; 1GB on a 4GB machine that mainly runs MySQL is "
"quite common.",
- (uchar**) &dflt_key_cache_var.param_buff_size,
- (uchar**) 0,
- 0, (GET_ULL | GET_ASK_ADDR),
+ &dflt_key_cache_var.param_buff_size, NULL, NULL, (GET_ULL | GET_ASK_ADDR),
REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, SIZE_T_MAX, MALLOC_OVERHEAD,
IO_SIZE, 0},
{"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
@@ -6969,60 +7065,58 @@ log and this option does nothing anymore.",
"until it is considered aged enough to be downgraded to a warm block. "
"This specifies the percentage ratio of that number of hits to the total "
"number of blocks in key cache.",
- (uchar**) &dflt_key_cache_var.param_age_threshold,
- (uchar**) 0,
- 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
- 300, 100, (longlong) ULONG_MAX, 0, 100, 0},
+ &dflt_key_cache_var.param_age_threshold, 0, 0,
+ (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, 300, 100, (longlong) ULONG_MAX,
+ 0, 100, 0},
{"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE,
"The default size of key cache blocks.",
- (uchar**) &dflt_key_cache_var.param_block_size,
- (uchar**) 0,
- 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
- KEY_CACHE_BLOCK_SIZE, 512, 1024 * 16, 0, 512, 0},
+ &dflt_key_cache_var.param_block_size, NULL, NULL, (GET_ULONG | GET_ASK_ADDR),
+ REQUIRED_ARG, KEY_CACHE_BLOCK_SIZE, 512, 1024 * 16, 0, 512, 0},
{"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT,
- "The minimum percentage of warm blocks in a key cache.",
- (uchar**) &dflt_key_cache_var.param_division_limit,
- (uchar**) 0,
- 0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100,
- 1, 100, 0, 1, 0},
+ "The minimum percentage of warm blocks in key cache.",
+ &dflt_key_cache_var.param_division_limit, 0, 0,
+ (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100, 1, 100, 0, 1, 0},
{"key_cache_segments", OPT_KEY_CACHE_PARTITIONS,
"The number of segments in a key cache",
- (uchar**) &dflt_key_cache_var.param_partitions,
- (uchar**) 0,
+ &dflt_key_cache_var.param_partitions, 0,
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, DEFAULT_KEY_CACHE_PARTITIONS,
0, MAX_KEY_CACHE_PARTITIONS, 0, 1, 0},
{"log-slow-filter", OPT_LOG_SLOW_FILTER,
- "Log only the queries that followed certain execution plan. Multiple flags allowed in a comma-separated string. [admin, filesort, filesort_on_disk, full_join, full_scan, query_cache, query_cache_miss, tmp_table, tmp_table_on_disk]. Sets log-slow-admin-command to ON",
+ "Log only the queries that followed certain execution plan. Multiple flags "
+ "allowed in a comma-separated string. [admin, filesort, filesort_on_disk, "
+ "full_join, full_scan, query_cache, query_cache_miss, tmp_table, "
+ "tmp_table_on_disk]. Sets log-slow-admin-command to ON",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, QPLAN_ALWAYS_SET, 0, 0},
{"log-slow-rate_limit", OPT_LOG_SLOW_RATE_LIMIT,
- "If set, only write to slow log every 'log_slow_rate_limit' query (use this to reduce output on slow query log)",
- (uchar**) &global_system_variables.log_slow_rate_limit,
- (uchar**) &max_system_variables.log_slow_rate_limit, 0, GET_ULONG,
+ "If set, only write to slow log every 'log_slow_rate_limit' query (use "
+ "this to reduce output on slow query log)",
+ &global_system_variables.log_slow_rate_limit,
+ &max_system_variables.log_slow_rate_limit, 0, GET_ULONG,
REQUIRED_ARG, 1, 1, ~0L, 0, 1L, 0},
{"log-slow-verbosity", OPT_LOG_SLOW_VERBOSITY,
- "Choose how verbose the messages to your slow log will be. Multiple flags allowed in a comma-separated string. [query_plan, innodb]",
+ "Choose how verbose the messages to your slow log will be. Multiple flags "
+ "allowed in a comma-separated string. [query_plan, innodb]",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"log-slow-file", OPT_SLOW_QUERY_LOG_FILE,
"Log slow queries to given log file. Defaults logging to hostname-slow.log",
- (uchar**) &opt_slow_logname, (uchar**) &opt_slow_logname, 0, GET_STR,
+ &opt_slow_logname, &opt_slow_logname, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"long_query_time", OPT_LONG_QUERY_TIME,
"Log all queries that have taken more than long_query_time seconds to "
"execute. The argument will be treated as a decimal value with "
"microsecond precision.",
- (uchar**) &long_query_time, (uchar**) &long_query_time, 0, GET_DOUBLE,
+ &long_query_time, &long_query_time, 0, GET_DOUBLE,
REQUIRED_ARG, 10, 0, LONG_TIMEOUT, 0, 0, 0},
{"log-slow-time", OPT_LONG_QUERY_TIME,
"Log all queries that have taken more than long_query_time seconds to execute to file. "
"The argument will be treated as a decimal value with microsecond precission.",
- (uchar**) &long_query_time, (uchar**) &long_query_time, 0, GET_DOUBLE,
+ &long_query_time, &long_query_time, 0, GET_DOUBLE,
REQUIRED_ARG, 10, 0, LONG_TIMEOUT, 0, 0, 0},
{"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES,
"If set to 1, table names are stored in lowercase on disk and table names "
"will be case-insensitive. Should be set to 2 if you are using a case-"
"insensitive file system.",
- (uchar**) &lower_case_table_names,
- (uchar**) &lower_case_table_names, 0, GET_UINT, OPT_ARG,
+ &lower_case_table_names, &lower_case_table_names, 0, GET_UINT, OPT_ARG,
#ifdef FN_NO_CASE_SENCE
1
#else
@@ -7031,184 +7125,207 @@ log and this option does nothing anymore.",
, 0, 2, 0, 1, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"The maximum packet length to send to or receive from server.",
- (uchar**) &global_system_variables.max_allowed_packet,
- (uchar**) &max_system_variables.max_allowed_packet, 0, GET_ULONG,
- REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, 0, 1024, 0},
+ &global_system_variables.max_allowed_packet,
+ &max_system_variables.max_allowed_packet, 0, GET_ULONG,
+ REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
{"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
"Can be used to restrict the total size used to cache a multi-transaction query.",
- (uchar**) &max_binlog_cache_size, (uchar**) &max_binlog_cache_size, 0,
+ &max_binlog_cache_size, &max_binlog_cache_size, 0,
GET_ULL, REQUIRED_ARG, ULONG_MAX, IO_SIZE, ULONGLONG_MAX, 0, IO_SIZE, 0},
{"max_binlog_size", OPT_MAX_BINLOG_SIZE,
- "Binary log will be rotated automatically when the size exceeds this \
-value. Will also apply to relay logs if max_relay_log_size is 0. \
-The minimum value for this variable is 4096.",
- (uchar**) &max_binlog_size, (uchar**) &max_binlog_size, 0, GET_ULONG,
+ "Binary log will be rotated automatically when the size exceeds this "
+ "value. Will also apply to relay logs if max_relay_log_size is 0. "
+ "The minimum value for this variable is 4096.",
+ &max_binlog_size, &max_binlog_size, 0, GET_ULONG,
REQUIRED_ARG, 1024*1024L*1024L, IO_SIZE, 1024*1024L*1024L, 0, IO_SIZE, 0},
{"max_connect_errors", OPT_MAX_CONNECT_ERRORS,
- "If there is more than this number of interrupted connections from a host this host will be blocked from further connections.",
- (uchar**) &max_connect_errors, (uchar**) &max_connect_errors, 0, GET_ULONG,
- REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, (longlong) ULONG_MAX, 0, 1, 0},
+ "If there is more than this number of interrupted connections from a host "
+ "this host will be blocked from further connections.",
+ &max_connect_errors, &max_connect_errors, 0, GET_ULONG,
+ REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, (longlong) ULONG_MAX, 0, 1, 0},
// Default max_connections of 151 is larger than Apache's default max
// children, to avoid "too many connections" error in a common setup
{"max_connections", OPT_MAX_CONNECTIONS,
- "The number of simultaneous clients allowed.", (uchar**) &max_connections,
- (uchar**) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1,
- 0},
+ "The number of simultaneous clients allowed.", &max_connections,
+ &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1, 0},
{"max_delayed_threads", OPT_MAX_DELAYED_THREADS,
- "Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero, which means INSERT DELAYED is not used.",
- (uchar**) &global_system_variables.max_insert_delayed_threads,
- (uchar**) &max_system_variables.max_insert_delayed_threads,
+ "Don't start more than this number of threads to handle INSERT DELAYED "
+ "statements. If set to zero, which means INSERT DELAYED is not used.",
+ &global_system_variables.max_insert_delayed_threads,
+ &max_system_variables.max_insert_delayed_threads,
0, GET_ULONG, REQUIRED_ARG, 20, 0, 16384, 0, 1, 0},
{"max_error_count", OPT_MAX_ERROR_COUNT,
"Max number of errors/warnings to store for a statement.",
- (uchar**) &global_system_variables.max_error_count,
- (uchar**) &max_system_variables.max_error_count,
+ &global_system_variables.max_error_count,
+ &max_system_variables.max_error_count,
0, GET_ULONG, REQUIRED_ARG, DEFAULT_ERROR_COUNT, 0, 65535, 0, 1, 0},
{"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE,
"Don't allow creation of heap tables bigger than this.",
- (uchar**) &global_system_variables.max_heap_table_size,
- (uchar**) &max_system_variables.max_heap_table_size, 0, GET_ULL,
+ &global_system_variables.max_heap_table_size,
+ &max_system_variables.max_heap_table_size, 0, GET_ULL,
REQUIRED_ARG, 16*1024*1024L, 16384, MAX_MEM_TABLE_SIZE,
MALLOC_OVERHEAD, 1024, 0},
{"max_join_size", OPT_MAX_JOIN_SIZE,
"Joins that are probably going to read more than max_join_size records return an error.",
- (uchar**) &global_system_variables.max_join_size,
- (uchar**) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
+ &global_system_variables.max_join_size,
+ &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
HA_POS_ERROR, 1, HA_POS_ERROR, 0, 1, 0},
{"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
"Max number of bytes in sorted records.",
- (uchar**) &global_system_variables.max_length_for_sort_data,
- (uchar**) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
+ &global_system_variables.max_length_for_sort_data,
+ &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
{"max_prepared_stmt_count", OPT_MAX_PREPARED_STMT_COUNT,
"Maximum number of prepared statements in the server.",
- (uchar**) &max_prepared_stmt_count, (uchar**) &max_prepared_stmt_count,
+ &max_prepared_stmt_count, &max_prepared_stmt_count,
0, GET_ULONG, REQUIRED_ARG, 16382, 0, 1*1024*1024, 0, 1, 0},
{"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE,
- "If non-zero: relay log will be rotated automatically when the size exceeds this value; if zero (the default): when the size exceeds max_binlog_size. 0 excepted, the minimum value for this variable is 4096.",
- (uchar**) &max_relay_log_size, (uchar**) &max_relay_log_size, 0, GET_ULONG,
+ "If non-zero: relay log will be rotated automatically when the size "
+ "exceeds this value; if zero (the default): when the size exceeds "
+ "max_binlog_size. 0 excepted, the minimum value for this variable is 4096.",
+ &max_relay_log_size, &max_relay_log_size, 0, GET_ULONG,
REQUIRED_ARG, 0L, 0L, 1024*1024L*1024L, 0, IO_SIZE, 0},
{ "max_seeks_for_key", OPT_MAX_SEEKS_FOR_KEY,
"Limit assumed max number of seeks when looking up rows based on a key.",
- (uchar**) &global_system_variables.max_seeks_for_key,
- (uchar**) &max_system_variables.max_seeks_for_key, 0, GET_ULONG,
+ &global_system_variables.max_seeks_for_key,
+ &max_system_variables.max_seeks_for_key, 0, GET_ULONG,
REQUIRED_ARG, (longlong) ULONG_MAX, 1, (longlong) ULONG_MAX, 0, 1, 0 },
{"max_sort_length", OPT_MAX_SORT_LENGTH,
- "The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).",
- (uchar**) &global_system_variables.max_sort_length,
- (uchar**) &max_system_variables.max_sort_length, 0, GET_ULONG,
+ "The number of bytes to use when sorting BLOB or TEXT values (only the "
+ "first max_sort_length bytes of each value are used; the rest are ignored).",
+ &global_system_variables.max_sort_length,
+ &max_system_variables.max_sort_length, 0, GET_ULONG,
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
{"max_sp_recursion_depth", OPT_MAX_SP_RECURSION_DEPTH,
"Maximum stored procedure recursion depth. (discussed with docs).",
- (uchar**) &global_system_variables.max_sp_recursion_depth,
- (uchar**) &max_system_variables.max_sp_recursion_depth, 0, GET_ULONG,
+ &global_system_variables.max_sp_recursion_depth,
+ &max_system_variables.max_sp_recursion_depth, 0, GET_ULONG,
OPT_ARG, 0, 0, 255, 0, 1, 0 },
{"max_tmp_tables", OPT_MAX_TMP_TABLES,
"Maximum number of temporary tables a client can keep open at a time.",
- (uchar**) &global_system_variables.max_tmp_tables,
- (uchar**) &max_system_variables.max_tmp_tables, 0, GET_ULONG,
+ &global_system_variables.max_tmp_tables,
+ &max_system_variables.max_tmp_tables, 0, GET_ULONG,
REQUIRED_ARG, 32, 1, (longlong) ULONG_MAX, 0, 1, 0},
{"max_user_connections", OPT_MAX_USER_CONNECTIONS,
"The maximum number of active connections for a single user (0 = no limit).",
- (uchar**) &max_user_connections, (uchar**) &max_user_connections, 0, GET_UINT,
+ &max_user_connections, &max_user_connections, 0, GET_UINT,
REQUIRED_ARG, 0, 0, UINT_MAX, 0, 1, 0},
{"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
"After this many write locks, allow some read locks to run in between.",
- (uchar**) &max_write_lock_count, (uchar**) &max_write_lock_count, 0, GET_ULONG,
+ &max_write_lock_count, &max_write_lock_count, 0, GET_ULONG,
REQUIRED_ARG, (longlong) ULONG_MAX, 1, (longlong) ULONG_MAX, 0, 1, 0},
{"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT,
"Don't log queries which examine less than min_examined_row_limit rows to file.",
- (uchar**) &global_system_variables.min_examined_row_limit,
- (uchar**) &max_system_variables.min_examined_row_limit, 0, GET_ULONG,
+ &global_system_variables.min_examined_row_limit,
+ &max_system_variables.min_examined_row_limit, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1L, 0},
{"multi_range_count", OPT_MULTI_RANGE_COUNT,
"Number of key ranges to request at once.",
- (uchar**) &global_system_variables.multi_range_count,
- (uchar**) &max_system_variables.multi_range_count, 0,
+ &global_system_variables.multi_range_count,
+ &max_system_variables.multi_range_count, 0,
GET_ULONG, REQUIRED_ARG, 256, 1, (longlong) ULONG_MAX, 0, 1, 0},
{"myisam_block_size", OPT_MYISAM_BLOCK_SIZE,
"Block size to be used for MyISAM index pages.",
- (uchar**) &opt_myisam_block_size,
- (uchar**) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG,
+ &opt_myisam_block_size, &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG,
MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH,
0, MI_MIN_KEY_BLOCK_LENGTH, 0},
{"myisam_data_pointer_size", OPT_MYISAM_DATA_POINTER_SIZE,
"Default pointer size to be used for MyISAM tables.",
- (uchar**) &myisam_data_pointer_size,
- (uchar**) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG,
+ &myisam_data_pointer_size,
+ &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG,
6, 2, 7, 0, 1, 0},
+ {"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
+ "This is a deprecated option that does nothing anymore. "
+ "It will be removed in MySQL " VER_CELOSIA,
+ &global_system_variables.myisam_max_extra_sort_file_size,
+ &max_system_variables.myisam_max_extra_sort_file_size,
+ 0, GET_ULL, REQUIRED_ARG, (ulonglong) INT_MAX32,
+ 0, (ulonglong) MAX_FILE_SIZE, 0, 1, 0},
{"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
- "Don't use the fast sort index method to created index if the temporary file would get bigger than this.",
- (uchar**) &global_system_variables.myisam_max_sort_file_size,
- (uchar**) &max_system_variables.myisam_max_sort_file_size, 0,
+ "Don't use the fast sort index method to created index if the temporary "
+ "file would get bigger than this.",
+ &global_system_variables.myisam_max_sort_file_size,
+ &max_system_variables.myisam_max_sort_file_size, 0,
GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE,
0, 1024*1024, 0},
{"myisam_mmap_size", OPT_MYISAM_MMAP_SIZE,
"Can be used to restrict the total memory used for memory mmaping of myisam files",
- (uchar**) &myisam_mmap_size, (uchar**) &myisam_mmap_size, 0,
+ &myisam_mmap_size, &myisam_mmap_size, 0,
GET_ULL, REQUIRED_ARG, SIZE_T_MAX, MEMMAP_EXTRA_MARGIN, SIZE_T_MAX, 0, 1, 0},
{"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS,
"Specifies whether several threads should be used when repairing MyISAM "
"tables. For values > 1, one thread is used per index. The value of 1 "
"disables parallel repair.",
- (uchar**) &global_system_variables.myisam_repair_threads,
- (uchar**) &max_system_variables.myisam_repair_threads, 0,
+ &global_system_variables.myisam_repair_threads,
+ &max_system_variables.myisam_repair_threads, 0,
GET_ULONG, REQUIRED_ARG, 1, 1, (longlong) ULONG_MAX, 0, 1, 0},
{"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE,
- "The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.",
- (uchar**) &global_system_variables.myisam_sort_buff_size,
- (uchar**) &max_system_variables.myisam_sort_buff_size, 0,
+ "The buffer that is allocated when sorting the index when doing a REPAIR "
+ "or when creating indexes with CREATE INDEX or ALTER TABLE.",
+ &global_system_variables.myisam_sort_buff_size,
+ &max_system_variables.myisam_sort_buff_size, 0,
GET_ULONG, REQUIRED_ARG, 8192 * 1024, 4096, (longlong) ULONG_MAX, 0, 1, 0},
{"myisam_use_mmap", OPT_MYISAM_USE_MMAP,
"Use memory mapping for reading and writing MyISAM tables.",
- (uchar**) &opt_myisam_use_mmap,
- (uchar**) &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG, 0,
- 0, 0, 0, 0, 0},
+ &opt_myisam_use_mmap, &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG,
+ 0, 0, 0, 0, 0, 0},
{"myisam_stats_method", OPT_MYISAM_STATS_METHOD,
"Specifies how MyISAM index statistics collection code should threat NULLs. "
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
- (uchar**) &myisam_stats_method_str, (uchar**) &myisam_stats_method_str, 0,
+ &myisam_stats_method_str, &myisam_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
"Buffer length for TCP/IP and socket communication.",
- (uchar**) &global_system_variables.net_buffer_length,
- (uchar**) &max_system_variables.net_buffer_length, 0, GET_ULONG,
+ &global_system_variables.net_buffer_length,
+ &max_system_variables.net_buffer_length, 0, GET_ULONG,
REQUIRED_ARG, 16384, 1024, 1024*1024L, 0, 1024, 0},
{"net_read_timeout", OPT_NET_READ_TIMEOUT,
"Number of seconds to wait for more data from a connection before aborting the read.",
- (uchar**) &global_system_variables.net_read_timeout,
- (uchar**) &max_system_variables.net_read_timeout, 0, GET_ULONG,
+ &global_system_variables.net_read_timeout,
+ &max_system_variables.net_read_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"net_retry_count", OPT_NET_RETRY_COUNT,
"If a read on a communication port is interrupted, retry this many times before giving up.",
- (uchar**) &global_system_variables.net_retry_count,
- (uchar**) &max_system_variables.net_retry_count,0,
+ &global_system_variables.net_retry_count,
+ &max_system_variables.net_retry_count,0,
GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, (longlong) ULONG_MAX,
0, 1, 0},
{"net_write_timeout", OPT_NET_WRITE_TIMEOUT,
"Number of seconds to wait for a block to be written to a connection before "
"aborting the write.",
- (uchar**) &global_system_variables.net_write_timeout,
- (uchar**) &max_system_variables.net_write_timeout, 0, GET_ULONG,
+ &global_system_variables.net_write_timeout,
+ &max_system_variables.net_write_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
- {"old", OPT_OLD_MODE, "Use compatible behavior.",
- (uchar**) &global_system_variables.old_mode,
- (uchar**) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG,
+ { "old", OPT_OLD_MODE, "Use compatible behavior.",
+ &global_system_variables.old_mode,
+ &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
- "If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of files.",
- (uchar**) &open_files_limit, (uchar**) &open_files_limit, 0, GET_ULONG,
+ "If this is not 0, then mysqld will use this value to reserve file "
+ "descriptors to use with setrlimit(). If this value is 0 then mysqld "
+ "will reserve max_connections*5 or max_connections + table_cache*2 "
+ "(whichever is larger) number of files.",
+ &open_files_limit, &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, OS_FILE_LIMIT, 0, 1, 0},
{"optimizer_prune_level", OPT_OPTIMIZER_PRUNE_LEVEL,
- "Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows.",
- (uchar**) &global_system_variables.optimizer_prune_level,
- (uchar**) &max_system_variables.optimizer_prune_level,
+ "Controls the heuristic(s) applied during query optimization to prune "
+ "less-promising partial plans from the optimizer search space. Meaning: "
+ "0 - do not apply any heuristic, thus perform exhaustive search; 1 - "
+ "prune plans based on number of retrieved rows.",
+ &global_system_variables.optimizer_prune_level,
+ &max_system_variables.optimizer_prune_level,
0, GET_ULONG, OPT_ARG, 1, 0, 1, 0, 1, 0},
{"optimizer_search_depth", OPT_OPTIMIZER_SEARCH_DEPTH,
- "Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Smaller values than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value; if set to MAX_TABLES+2, the optimizer will switch to the original find_best (used for testing/comparison).",
- (uchar**) &global_system_variables.optimizer_search_depth,
- (uchar**) &max_system_variables.optimizer_search_depth,
+ "Maximum depth of search performed by the query optimizer. Values larger "
+ "than the number of relations in a query result in better query plans, "
+ "but take longer to compile a query. Smaller values than the number of "
+ "tables in a relation result in faster optimization, but may produce "
+ "very bad query plans. If set to 0, the system will automatically pick "
+ "a reasonable value; if set to MAX_TABLES+2, the optimizer will switch "
+ "to the original find_best (used for testing/comparison).",
+ &global_system_variables.optimizer_search_depth,
+ &max_system_variables.optimizer_search_depth,
0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0},
{"optimizer_switch", OPT_OPTIMIZER_SWITCH,
"optimizer_switch=option=val[,option=val...], where option={index_merge, "
@@ -7217,18 +7334,17 @@ The minimum value for this variable is 4096.",
", table_elimination"
#endif
"} and val={on, off, default}.",
- (uchar**) &optimizer_switch_str, (uchar**) &optimizer_switch_str, 0, GET_STR, REQUIRED_ARG,
- /*OPTIMIZER_SWITCH_DEFAULT*/0,
- 0, 0, 0, 0, 0},
- {"plugin-dir", OPT_PLUGIN_DIR,
+ &optimizer_switch_str, &optimizer_switch_str, 0, GET_STR, REQUIRED_ARG,
+ /*OPTIMIZER_SWITCH_DEFAULT*/0, 0, 0, 0, 0, 0},
+ {"plugin_dir", OPT_PLUGIN_DIR,
"Directory for plugins.",
- (uchar**) &opt_plugin_dir_ptr, (uchar**) &opt_plugin_dir_ptr, 0,
+ &opt_plugin_dir_ptr, &opt_plugin_dir_ptr, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"plugin-load", OPT_PLUGIN_LOAD,
"Optional semicolon-separated list of plugins to load, where each plugin is "
"identified as name=library, where name is the plugin name and library "
"is the plugin library in plugin_dir.",
- (uchar**) &opt_plugin_load, (uchar**) &opt_plugin_load, 0,
+ &opt_plugin_load, &opt_plugin_load, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"plugin-maturity", OPT_PLUGIN_MATURITY,
"The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded.",
@@ -7236,199 +7352,207 @@ The minimum value for this variable is 4096.",
GET_ENUM, REQUIRED_ARG, server_maturity, 0, 0, 0, 0, 0},
{"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
"The size of the buffer that is allocated when preloading indexes.",
- (uchar**) &global_system_variables.preload_buff_size,
- (uchar**) &max_system_variables.preload_buff_size, 0, GET_ULONG,
+ &global_system_variables.preload_buff_size,
+ &max_system_variables.preload_buff_size, 0, GET_ULONG,
REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0},
{"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE,
"Allocation block size for query parsing and execution.",
- (uchar**) &global_system_variables.query_alloc_block_size,
- (uchar**) &max_system_variables.query_alloc_block_size, 0, GET_ULONG,
+ &global_system_variables.query_alloc_block_size,
+ &max_system_variables.query_alloc_block_size, 0, GET_ULONG,
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, (longlong) ULONG_MAX, 0, 1024,
0},
#ifdef HAVE_QUERY_CACHE
{"query_cache_limit", OPT_QUERY_CACHE_LIMIT,
"Don't cache results that are bigger than this.",
- (uchar**) &query_cache_limit, (uchar**) &query_cache_limit, 0, GET_ULONG,
+ &query_cache_limit, &query_cache_limit, 0, GET_ULONG,
REQUIRED_ARG, 1024*1024L, 0, (longlong) ULONG_MAX, 0, 1, 0},
{"query_cache_min_res_unit", OPT_QUERY_CACHE_MIN_RES_UNIT,
"Minimal size of unit in which space for results is allocated (last unit "
"will be trimmed after writing all result data).",
- (uchar**) &query_cache_min_res_unit, (uchar**) &query_cache_min_res_unit,
+ &query_cache_min_res_unit, &query_cache_min_res_unit,
0, GET_ULONG, REQUIRED_ARG, QUERY_CACHE_MIN_RESULT_DATA_SIZE,
0, (longlong) ULONG_MAX, 0, 1, 0},
#endif /*HAVE_QUERY_CACHE*/
{"query_cache_size", OPT_QUERY_CACHE_SIZE,
"The memory allocated to store results from old queries.",
- (uchar**) &query_cache_size, (uchar**) &query_cache_size, 0, GET_ULONG,
+ &query_cache_size, &query_cache_size, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1024, 0},
#ifdef HAVE_QUERY_CACHE
{"query_cache_type", OPT_QUERY_CACHE_TYPE,
- "0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT SQL_CACHE ... queries.",
- (uchar**) &global_system_variables.query_cache_type,
- (uchar**) &max_system_variables.query_cache_type,
+ "0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results "
+ "except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT "
+ "SQL_CACHE ... queries.", &global_system_variables.query_cache_type,
+ &max_system_variables.query_cache_type,
0, GET_ULONG, REQUIRED_ARG, 1, 0, 2, 0, 1, 0},
{"query_cache_wlock_invalidate", OPT_QUERY_CACHE_WLOCK_INVALIDATE,
"Invalidate queries in query cache on LOCK for write.",
- (uchar**) &global_system_variables.query_cache_wlock_invalidate,
- (uchar**) &max_system_variables.query_cache_wlock_invalidate,
+ &global_system_variables.query_cache_wlock_invalidate,
+ &max_system_variables.query_cache_wlock_invalidate,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
#endif /*HAVE_QUERY_CACHE*/
{"query_prealloc_size", OPT_QUERY_PREALLOC_SIZE,
"Persistent buffer for query parsing and execution.",
- (uchar**) &global_system_variables.query_prealloc_size,
- (uchar**) &max_system_variables.query_prealloc_size, 0, GET_ULONG,
+ &global_system_variables.query_prealloc_size,
+ &max_system_variables.query_prealloc_size, 0, GET_ULONG,
REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE,
(longlong) ULONG_MAX, 0, 1024, 0},
{"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE,
"Allocation block size for storing ranges during optimization.",
- (uchar**) &global_system_variables.range_alloc_block_size,
- (uchar**) &max_system_variables.range_alloc_block_size, 0, GET_ULONG,
+ &global_system_variables.range_alloc_block_size,
+ &max_system_variables.range_alloc_block_size, 0, GET_ULONG,
REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE,
(longlong) ULONG_MAX, 0, 1024, 0},
{"read_buffer_size", OPT_RECORD_BUFFER,
- "Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.",
- (uchar**) &global_system_variables.read_buff_size,
- (uchar**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
+ "Each thread that does a sequential scan allocates a buffer of this size "
+ "for each table it scans. If you do many sequential scans, you may want "
+ "to increase this value.", &global_system_variables.read_buff_size,
+ &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT_MAX32, MALLOC_OVERHEAD, IO_SIZE,
0},
{"read_only", OPT_READONLY,
"Make all non-temporary tables read-only, with the exception of replication "
"(slave) threads and users with the SUPER privilege.",
- (uchar**) &opt_readonly,
- (uchar**) &opt_readonly,
+ &opt_readonly,
+ &opt_readonly,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
{"read_rnd_buffer_size", OPT_RECORD_RND_BUFFER,
"When reading rows in sorted order after a sort, the rows are read through "
"this buffer to avoid disk seeks. If not set, then it's set to the value of "
"record_buffer.",
- (uchar**) &global_system_variables.read_rnd_buff_size,
- (uchar**) &max_system_variables.read_rnd_buff_size, 0,
+ &global_system_variables.read_rnd_buff_size,
+ &max_system_variables.read_rnd_buff_size, 0,
GET_ULONG, REQUIRED_ARG, 256*1024L, IO_SIZE*2+MALLOC_OVERHEAD,
INT_MAX32, MALLOC_OVERHEAD, IO_SIZE, 0},
{"record_buffer", OPT_RECORD_BUFFER_OLD,
"Alias for read_buffer_size. This variable is deprecated and will be removed in a future release.",
- (uchar**) &global_system_variables.read_buff_size,
- (uchar**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
+ &global_system_variables.read_buff_size,
+ &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT_MAX32, MALLOC_OVERHEAD, IO_SIZE, 0},
#ifdef HAVE_REPLICATION
{"relay_log_purge", OPT_RELAY_LOG_PURGE,
"0 = do not purge relay logs. 1 = purge them as soon as they are no more needed.",
- (uchar**) &relay_log_purge,
- (uchar**) &relay_log_purge, 0, GET_BOOL, NO_ARG,
+ &relay_log_purge,
+ &relay_log_purge, 0, GET_BOOL, NO_ARG,
1, 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,
- (uchar**) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
+ &relay_log_space_limit,
+ &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
(longlong) ULONG_MAX, 0, 1, 0},
{"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL,
"Use compression on master/slave protocol.",
- (uchar**) &opt_slave_compressed_protocol,
- (uchar**) &opt_slave_compressed_protocol,
+ &opt_slave_compressed_protocol,
+ &opt_slave_compressed_protocol,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
{"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT,
"Number of seconds to wait for more data from a master/slave connection before aborting the read.",
- (uchar**) &slave_net_timeout, (uchar**) &slave_net_timeout, 0,
+ &slave_net_timeout, &slave_net_timeout, 0,
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"slave_transaction_retries", OPT_SLAVE_TRANS_RETRIES,
"Number of times the slave SQL thread will retry a transaction in case "
"it failed with a deadlock or elapsed lock wait timeout, "
"before giving up and stopping.",
- (uchar**) &slave_trans_retries, (uchar**) &slave_trans_retries, 0,
+ &slave_trans_retries, &slave_trans_retries, 0,
GET_ULONG, REQUIRED_ARG, 10L, 0L, (longlong) ULONG_MAX, 0, 1, 0},
#endif /* HAVE_REPLICATION */
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
- "If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
- (uchar**) &slow_launch_time, (uchar**) &slow_launch_time, 0, GET_ULONG,
+ "If creating the thread takes longer than this value (in seconds), "
+ "the Slow_launch_threads counter will be incremented.",
+ &slow_launch_time, &slow_launch_time, 0, GET_ULONG,
REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0},
{"sort_buffer_size", OPT_SORT_BUFFER,
"Each thread that needs to do a sort allocates a buffer of this size.",
- (uchar**) &global_system_variables.sortbuff_size,
- (uchar**) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
+ &global_system_variables.sortbuff_size,
+ &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, (longlong) ULONG_MAX,
MALLOC_OVERHEAD, 1, 0},
{"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,
+ &sync_binlog_period, &sync_binlog_period, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, (longlong) ULONG_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,
+ &opt_sync_frm, &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0,
0, 0, 0, 0},
{"table_cache", OPT_TABLE_OPEN_CACHE,
"Deprecated; use --table_open_cache instead.",
- (uchar**) &table_cache_size, (uchar**) &table_cache_size, 0, GET_ULONG,
+ &table_cache_size, &table_cache_size, 0, GET_ULONG,
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
{"table_definition_cache", OPT_TABLE_DEF_CACHE,
"The number of cached table definitions.",
- (uchar**) &table_def_size, (uchar**) &table_def_size,
+ &table_def_size, &table_def_size,
0, GET_ULONG, REQUIRED_ARG, TABLE_DEF_CACHE_DEFAULT, TABLE_DEF_CACHE_MIN,
512*1024L, 0, 1, 0},
{"table_open_cache", OPT_TABLE_OPEN_CACHE,
"The number of cached open tables.",
- (uchar**) &table_cache_size, (uchar**) &table_cache_size, 0, GET_ULONG,
+ &table_cache_size, &table_cache_size, 0, GET_ULONG,
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
{"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT,
"Timeout in seconds to wait for a table level lock before returning an "
"error. Used only if the connection has active cursors.",
- (uchar**) &table_lock_wait_timeout, (uchar**) &table_lock_wait_timeout,
+ &table_lock_wait_timeout, &table_lock_wait_timeout,
0, GET_ULONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
{"thread_cache_size", OPT_THREAD_CACHE_SIZE,
"How many threads we should keep in a cache for reuse.",
- (uchar**) &thread_cache_size, (uchar**) &thread_cache_size, 0, GET_ULONG,
+ &thread_cache_size, &thread_cache_size, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 16384, 0, 1, 0},
{"thread_concurrency", OPT_THREAD_CONCURRENCY,
- "Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.",
- (uchar**) &concurrency, (uchar**) &concurrency, 0, GET_ULONG, REQUIRED_ARG,
+ "Permits the application to give the threads system a hint for the "
+ "desired number of threads that should be run at the same time.",
+ &concurrency, &concurrency, 0, GET_ULONG, REQUIRED_ARG,
DEFAULT_CONCURRENCY, 1, 512, 0, 1, 0},
#if HAVE_POOL_OF_THREADS == 1
{"thread_pool_size", OPT_THREAD_CACHE_SIZE,
"How many threads we should create to handle query requests in case of "
"'thread_handling=pool-of-threads'.",
- (uchar**) &thread_pool_size, (uchar**) &thread_pool_size, 0, GET_ULONG,
+ &thread_pool_size, &thread_pool_size, 0, GET_ULONG,
REQUIRED_ARG, 20, 1, 16384, 0, 1, 0},
#endif
{"thread_stack", OPT_THREAD_STACK,
- "The stack size for each thread.", (uchar**) &my_thread_stack_size,
- (uchar**) &my_thread_stack_size, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
+ "The stack size for each thread.", &my_thread_stack_size,
+ &my_thread_stack_size, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
(sizeof(void*)<=4)?1024L*128L: ((256-16)*1024L), (longlong) ULONG_MAX, 0, 1024, 0},
{ "time_format", OPT_TIME_FORMAT,
"The TIME format (for future).",
- (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
- (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
+ &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
+ &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmp_table_size", OPT_TMP_TABLE_SIZE,
- "If an internal in-memory temporary table exceeds this size, MySQL will"
- " automatically convert it to an on-disk MyISAM/Maria table.",
- (uchar**) &global_system_variables.tmp_table_size,
- (uchar**) &max_system_variables.tmp_table_size, 0, GET_ULL,
- REQUIRED_ARG, 16*1024*1024L, 0, MAX_MEM_TABLE_SIZE, 0, 1, 0},
+ "If an internal in-memory temporary table exceeds this size, MySQL will "
+ "automatically convert it to an on-disk MyISAM/Maria table.",
+ &global_system_variables.tmp_table_size,
+ &max_system_variables.tmp_table_size, 0, GET_ULL,
+ REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
"Allocation block size for transactions to be stored in binary log.",
- (uchar**) &global_system_variables.trans_alloc_block_size,
- (uchar**) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
+ &global_system_variables.trans_alloc_block_size,
+ &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, (longlong) ULONG_MAX, 0, 1024,
0},
{"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE,
"Persistent buffer for transactions to be stored in binary log.",
- (uchar**) &global_system_variables.trans_prealloc_size,
- (uchar**) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
+ &global_system_variables.trans_prealloc_size,
+ &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, (longlong) ULONG_MAX, 0,
1024, 0},
{"thread_handling", OPT_THREAD_HANDLING,
"Define threads usage for handling queries: "
"one-thread-per-connection or no-threads.",
- (uchar**) &opt_thread_handling, (uchar**) &opt_thread_handling,
+ &opt_thread_handling, &opt_thread_handling,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"updatable_views_with_limit", OPT_UPDATABLE_VIEWS_WITH_LIMIT,
- "1 = YES = Don't issue an error message (warning only) if a VIEW without presence of a key of the underlying table is used in queries with a LIMIT clause for updating. 0 = NO = Prohibit update of a VIEW, which does not contain a key of the underlying table and the query uses a LIMIT clause (usually get from GUI tools).",
- (uchar**) &global_system_variables.updatable_views_with_limit,
- (uchar**) &max_system_variables.updatable_views_with_limit,
+ "1 = YES = Don't issue an error message (warning only) if a VIEW without "
+ "presence of a key of the underlying table is used in queries with a "
+ "LIMIT clause for updating. 0 = NO = Prohibit update of a VIEW, which "
+ "does not contain a key of the underlying table and the query uses a "
+ "LIMIT clause (usually get from GUI tools).",
+ &global_system_variables.updatable_views_with_limit,
+ &max_system_variables.updatable_views_with_limit,
0, GET_ULONG, REQUIRED_ARG, 1, 0, 1, 0, 1, 0},
{"wait_timeout", OPT_WAIT_TIMEOUT,
"The number of seconds the server waits for activity on a connection before closing it.",
- (uchar**) &global_system_variables.net_wait_timeout,
- (uchar**) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
+ &global_system_variables.net_wait_timeout,
+ &max_system_variables.net_wait_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT),
0, 1, 0},
{"userstat", OPT_USERSTAT,
@@ -7441,8 +7565,9 @@ The minimum value for this variable is 4096.",
"there are no dependencies between transactional and non-transactional "
"tables such as in the statement INSERT INTO t_myisam SELECT * FROM "
"t_innodb; otherwise, slaves may diverge from the master.",
- (uchar**) &global_system_variables.binlog_direct_non_trans_update, (uchar**) &max_system_variables.binlog_direct_non_trans_update, 0, GET_BOOL, NO_ARG, 0,
- 0, 0, 0, 0, 0},
+ &global_system_variables.binlog_direct_non_trans_update,
+ &max_system_variables.binlog_direct_non_trans_update,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -8978,13 +9103,12 @@ mysqld_get_one_option(int optid,
/** Handle arguments for multiple key caches. */
+C_MODE_START
+static void* mysql_getopt_value(const char *, uint,
+ const struct my_option *, int *);
+C_MODE_END
-extern "C" int mysql_getopt_value(uchar **value,
- const char *keyname, uint key_length,
- const struct my_option *option,
- int *error);
-
-static uchar* *
+static void*
mysql_getopt_value(const char *keyname, uint key_length,
const struct my_option *option, int *error)
{
@@ -9006,13 +9130,13 @@ mysql_getopt_value(const char *keyname, uint key_length,
}
switch (option->id) {
case OPT_KEY_BUFFER_SIZE:
- return (uchar**) &key_cache->param_buff_size;
+ return &key_cache->param_buff_size;
case OPT_KEY_CACHE_BLOCK_SIZE:
- return (uchar**) &key_cache->param_block_size;
+ return &key_cache->param_block_size;
case OPT_KEY_CACHE_DIVISION_LIMIT:
- return (uchar**) &key_cache->param_division_limit;
+ return &key_cache->param_division_limit;
case OPT_KEY_CACHE_AGE_THRESHOLD:
- return (uchar**) &key_cache->param_age_threshold;
+ return &key_cache->param_age_threshold;
case OPT_KEY_CACHE_PARTITIONS:
return (uchar**) &key_cache->param_partitions;
}
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 49199ccb6e4..4796a5601bf 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -16,11 +16,7 @@
/**
@file
- This file is the net layer API for the MySQL client/server protocol,
- which is a tightly coupled, proprietary protocol owned by MySQL AB.
- @note
- Any re-implementations of this protocol must also be under GPL
- unless one has got an license from MySQL AB stating otherwise.
+ This file is the net layer API for the MySQL client/server protocol.
Write and read of logical packets to/from socket.
@@ -914,7 +910,13 @@ my_real_read(NET *net, size_t *complen)
("Packets out of order (Found: %d, expected %u)",
(int) net->buff[net->where_b + 3],
net->pkt_nr));
-#ifdef EXTRA_DEBUG
+ /*
+ We don't make noise server side, since the client is expected
+ to break the protocol for e.g. --send LOAD DATA .. LOCAL where
+ the server expects the client to send a file, but the client
+ may reply with a new command instead.
+ */
+#if defined (EXTRA_DEBUG) && !defined (MYSQL_SERVER)
fflush(stdout);
fprintf(stderr,"Error: Packets out of order (Found: %d, expected %d)\n",
(int) net->buff[net->where_b + 3],
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index ad404a100e3..2f88841d6a2 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1192,7 +1192,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
QUICK_INDEX_MERGE_SELECT::QUICK_INDEX_MERGE_SELECT(THD *thd_param,
TABLE *table)
- :pk_quick_select(NULL), thd(thd_param)
+ :unique(NULL), pk_quick_select(NULL), thd(thd_param)
{
DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::QUICK_INDEX_MERGE_SELECT");
index= MAX_KEY;
@@ -1234,6 +1234,7 @@ QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT()
List_iterator_fast<QUICK_RANGE_SELECT> quick_it(quick_selects);
QUICK_RANGE_SELECT* quick;
DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT");
+ delete unique;
quick_it.rewind();
while ((quick= quick_it++))
quick->file= NULL;
@@ -7593,8 +7594,8 @@ check_quick_keys(PARAM *param, uint idx, SEL_ARG *key_tree,
param->range_count++;
if (!tmp_min_flag && ! tmp_max_flag &&
(uint) key_tree->part+1 == param->table->key_info[keynr].key_parts &&
- (param->table->key_info[keynr].flags & (HA_NOSAME | HA_END_SPACE_KEY)) ==
- HA_NOSAME && min_key_length == max_key_length &&
+ (param->table->key_info[keynr].flags & HA_NOSAME) &&
+ min_key_length == max_key_length &&
!memcmp(param->min_key, param->max_key, min_key_length) &&
!param->first_null_comp)
{
@@ -7883,7 +7884,7 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key,
{
KEY *table_key=quick->head->key_info+quick->index;
flag=EQ_RANGE;
- if ((table_key->flags & (HA_NOSAME | HA_END_SPACE_KEY)) == HA_NOSAME &&
+ if ((table_key->flags & HA_NOSAME) &&
key->part == table_key->key_parts-1)
{
if (!(table_key->flags & HA_NULL_PART_KEY) ||
@@ -7933,7 +7934,7 @@ bool QUICK_RANGE_SELECT::unique_key_range()
if ((tmp->flag & (EQ_RANGE | NULL_RANGE)) == EQ_RANGE)
{
KEY *key=head->key_info+index;
- return ((key->flags & (HA_NOSAME | HA_END_SPACE_KEY)) == HA_NOSAME &&
+ return ((key->flags & HA_NOSAME) &&
key->key_length == tmp->min_length);
}
}
@@ -8052,8 +8053,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
range->min_length= range->max_length= ref->key_length;
range->min_keypart_map= range->max_keypart_map=
make_prev_keypart_map(ref->key_parts);
- range->flag= ((ref->key_length == key_info->key_length &&
- (key_info->flags & HA_END_SPACE_KEY) == 0) ? EQ_RANGE : 0);
+ range->flag= (ref->key_length == key_info->key_length ? EQ_RANGE : 0);
if (!(quick->key_parts=key_part=(KEY_PART *)
alloc_root(&quick->alloc,sizeof(KEY_PART)*ref->key_parts)))
@@ -8123,7 +8123,6 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
List_iterator_fast<QUICK_RANGE_SELECT> cur_quick_it(quick_selects);
QUICK_RANGE_SELECT* cur_quick;
int result;
- Unique *unique= 0;
handler *file= head->file;
DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::read_keys_and_merge");
@@ -8145,11 +8144,24 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
if (cur_quick->init() || cur_quick->reset())
goto err;
- unique= new Unique(refpos_order_cmp, (void *)file,
- file->ref_length,
- thd->variables.sortbuff_size);
- if (!unique)
- goto err;
+ if (unique == NULL)
+ {
+ DBUG_EXECUTE_IF("index_merge_may_not_create_a_Unique", abort(); );
+ DBUG_EXECUTE_IF("only_one_Unique_may_be_created",
+ DBUG_SET("+d,index_merge_may_not_create_a_Unique"); );
+
+ unique= new Unique(refpos_order_cmp, (void *)file,
+ file->ref_length,
+ thd->variables.sortbuff_size);
+ if (!unique)
+ goto err;
+ }
+ else
+ unique->reset();
+
+ DBUG_ASSERT(file->ref_length == unique->get_size());
+ DBUG_ASSERT(thd->variables.sortbuff_size == unique->get_max_in_memory_size());
+
for (;;)
{
while ((result= cur_quick->get_next()) == HA_ERR_END_OF_FILE)
@@ -8193,7 +8205,6 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
sequence.
*/
result= unique->get(head);
- delete unique;
doing_pk_scan= FALSE;
/*
index_merge currently doesn't support "using index" at all
@@ -8204,7 +8215,6 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
DBUG_RETURN(result);
err:
- delete unique;
head->disable_keyread();
DBUG_RETURN(1);
}
@@ -8319,6 +8329,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
if ((error= quick->get_next()))
DBUG_RETURN(error);
}
+ quick->file->position(quick->record);
}
memcpy(last_rowid, quick->file->ref, head->file->ref_length);
last_rowid_count= 1;
@@ -8502,8 +8513,6 @@ int QUICK_RANGE_SELECT::get_next()
{
int result;
KEY_MULTI_RANGE *mrange;
- key_range *start_key;
- key_range *end_key;
DBUG_ENTER("QUICK_RANGE_SELECT::get_next");
DBUG_ASSERT(multi_range_length && multi_range &&
(cur_range >= (QUICK_RANGE**) ranges.buffer) &&
@@ -8543,26 +8552,9 @@ int QUICK_RANGE_SELECT::get_next()
mrange_slot < mrange_end;
mrange_slot++)
{
- start_key= &mrange_slot->start_key;
- end_key= &mrange_slot->end_key;
last_range= *(cur_range++);
-
- start_key->key= (const uchar*) last_range->min_key;
- start_key->length= last_range->min_length;
- start_key->flag= ((last_range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
- (last_range->flag & EQ_RANGE) ?
- HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT);
- start_key->keypart_map= last_range->min_keypart_map;
- end_key->key= (const uchar*) last_range->max_key;
- end_key->length= last_range->max_length;
- /*
- We use HA_READ_AFTER_KEY here because if we are reading on a key
- prefix. We want to find all keys with this prefix.
- */
- end_key->flag= (last_range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
- HA_READ_AFTER_KEY);
- end_key->keypart_map= last_range->max_keypart_map;
-
+ last_range->make_min_endpoint(&mrange_slot->start_key);
+ last_range->make_max_endpoint(&mrange_slot->end_key);
mrange_slot->range_flag= last_range->flag;
}
@@ -8586,51 +8578,54 @@ end:
/*
Get the next record with a different prefix.
- SYNOPSIS
- QUICK_RANGE_SELECT::get_next_prefix()
- prefix_length length of cur_prefix
- cur_prefix prefix of a key to be searched for
+ @param prefix_length length of cur_prefix
+ @param group_key_parts The number of key parts in the group prefix
+ @param cur_prefix prefix of a key to be searched for
- DESCRIPTION
- Each subsequent call to the method retrieves the first record that has a
- prefix with length prefix_length different from cur_prefix, such that the
- record with the new prefix is within the ranges described by
- this->ranges. The record found is stored into the buffer pointed by
- this->record.
- The method is useful for GROUP-BY queries with range conditions to
- discover the prefix of the next group that satisfies the range conditions.
+ Each subsequent call to the method retrieves the first record that has a
+ prefix with length prefix_length and which is different from cur_prefix,
+ such that the record with the new prefix is within the ranges described by
+ this->ranges. The record found is stored into the buffer pointed by
+ this->record. The method is useful for GROUP-BY queries with range
+ conditions to discover the prefix of the next group that satisfies the range
+ conditions.
+
+ @todo
- TODO
This method is a modified copy of QUICK_RANGE_SELECT::get_next(), so both
methods should be unified into a more general one to reduce code
duplication.
- RETURN
- 0 on success
- HA_ERR_END_OF_FILE if returned all keys
- other if some error occurred
+ @retval 0 on success
+ @retval HA_ERR_END_OF_FILE if returned all keys
+ @retval other if some error occurred
*/
int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length,
- key_part_map keypart_map,
+ uint group_key_parts,
uchar *cur_prefix)
{
DBUG_ENTER("QUICK_RANGE_SELECT::get_next_prefix");
+ const key_part_map keypart_map= make_prev_keypart_map(group_key_parts);
for (;;)
{
int result;
- key_range start_key, end_key;
if (last_range)
{
/*
Read the next record in the same range with prefix after cur_prefix.
- */
- DBUG_ASSERT(cur_prefix != 0);
+ */
+ DBUG_ASSERT(cur_prefix != NULL);
result= file->ha_index_read_map(record, cur_prefix, keypart_map,
HA_READ_AFTER_KEY);
- if (result || (file->compare_key(file->end_range) <= 0))
+ if (result || last_range->max_keypart_map == 0)
DBUG_RETURN(result);
+
+ key_range previous_endpoint;
+ last_range->make_max_endpoint(&previous_endpoint, prefix_length, keypart_map);
+ if (file->compare_key(&previous_endpoint) <= 0)
+ DBUG_RETURN(0);
}
uint count= ranges.elements - (cur_range - (QUICK_RANGE**) ranges.buffer);
@@ -8642,21 +8637,9 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length,
}
last_range= *(cur_range++);
- start_key.key= (const uchar*) last_range->min_key;
- start_key.length= min(last_range->min_length, prefix_length);
- start_key.keypart_map= last_range->min_keypart_map & keypart_map;
- start_key.flag= ((last_range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
- (last_range->flag & EQ_RANGE) ?
- HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT);
- end_key.key= (const uchar*) last_range->max_key;
- end_key.length= min(last_range->max_length, prefix_length);
- end_key.keypart_map= last_range->max_keypart_map & keypart_map;
- /*
- We use READ_AFTER_KEY here because if we are reading on a key
- prefix we want to find all keys with this prefix
- */
- end_key.flag= (last_range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
- HA_READ_AFTER_KEY);
+ key_range start_key, end_key;
+ last_range->make_min_endpoint(&start_key, prefix_length, keypart_map);
+ last_range->make_max_endpoint(&end_key, prefix_length, keypart_map);
result= file->read_range_first(last_range->min_keypart_map ? &start_key : 0,
last_range->max_keypart_map ? &end_key : 0,
@@ -8751,9 +8734,9 @@ bool QUICK_RANGE_SELECT::row_in_ranges()
}
/*
- This is a hack: we inherit from QUICK_SELECT so that we can use the
+ This is a hack: we inherit from QUICK_RANGE_SELECT so that we can use the
get_next() interface, but we have to hold a pointer to the original
- QUICK_SELECT because its data are used all over the place. What
+ QUICK_RANGE_SELECT because its data are used all over the place. What
should be done is to factor out the data that is needed into a base
class (QUICK_SELECT), and then have two subclasses (_ASC and _DESC)
which handle the ranges and implement the get_next() function. But
@@ -10276,7 +10259,7 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg,
uint use_index, double read_cost_arg,
ha_rows records_arg, uint key_infix_len_arg,
uchar *key_infix_arg, MEM_ROOT *parent_alloc)
- :join(join_arg), index_info(index_info_arg),
+ :file(table->file), join(join_arg), index_info(index_info_arg),
group_prefix_len(group_prefix_len_arg),
group_key_parts(group_key_parts_arg), have_min(have_min_arg),
have_max(have_max_arg), seen_first_key(FALSE), doing_key_read(FALSE),
@@ -10285,7 +10268,6 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg,
max_functions_it(NULL)
{
head= table;
- file= head->file;
index= use_index;
record= head->record[0];
tmp_record= head->record[1];
@@ -10885,7 +10867,8 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_prefix()
{
uchar *cur_prefix= seen_first_key ? group_prefix : NULL;
if ((result= quick_prefix_select->get_next_prefix(group_prefix_len,
- make_prev_keypart_map(group_key_parts), cur_prefix)))
+ group_key_parts,
+ cur_prefix)))
DBUG_RETURN(result);
seen_first_key= TRUE;
}
diff --git a/sql/opt_range.h b/sql/opt_range.h
index ae02e19974d..758dffe7a52 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -71,6 +71,85 @@ class QUICK_RANGE :public Sql_alloc {
dummy=0;
#endif
}
+
+ /**
+ Initalizes a key_range object for communication with storage engine.
+
+ This function facilitates communication with the Storage Engine API by
+ translating the minimum endpoint of the interval represented by this
+ QUICK_RANGE into an index range endpoint specifier for the engine.
+
+ @param Pointer to an uninitialized key_range C struct.
+
+ @param prefix_length The length of the search key prefix to be used for
+ lookup.
+
+ @param keypart_map A set (bitmap) of keyparts to be used.
+ */
+ void make_min_endpoint(key_range *kr, uint prefix_length,
+ key_part_map keypart_map) {
+ make_min_endpoint(kr);
+ kr->length= min(kr->length, prefix_length);
+ kr->keypart_map&= keypart_map;
+ }
+
+ /**
+ Initalizes a key_range object for communication with storage engine.
+
+ This function facilitates communication with the Storage Engine API by
+ translating the minimum endpoint of the interval represented by this
+ QUICK_RANGE into an index range endpoint specifier for the engine.
+
+ @param Pointer to an uninitialized key_range C struct.
+ */
+ void make_min_endpoint(key_range *kr) {
+ kr->key= (const uchar*)min_key;
+ kr->length= min_length;
+ kr->keypart_map= min_keypart_map;
+ kr->flag= ((flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
+ (flag & EQ_RANGE) ? HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT);
+ }
+
+ /**
+ Initalizes a key_range object for communication with storage engine.
+
+ This function facilitates communication with the Storage Engine API by
+ translating the maximum endpoint of the interval represented by this
+ QUICK_RANGE into an index range endpoint specifier for the engine.
+
+ @param Pointer to an uninitialized key_range C struct.
+
+ @param prefix_length The length of the search key prefix to be used for
+ lookup.
+
+ @param keypart_map A set (bitmap) of keyparts to be used.
+ */
+ void make_max_endpoint(key_range *kr, uint prefix_length,
+ key_part_map keypart_map) {
+ make_max_endpoint(kr);
+ kr->length= min(kr->length, prefix_length);
+ kr->keypart_map&= keypart_map;
+ }
+
+ /**
+ Initalizes a key_range object for communication with storage engine.
+
+ This function facilitates communication with the Storage Engine API by
+ translating the maximum endpoint of the interval represented by this
+ QUICK_RANGE into an index range endpoint specifier for the engine.
+
+ @param Pointer to an uninitialized key_range C struct.
+ */
+ void make_max_endpoint(key_range *kr) {
+ kr->key= (const uchar*)max_key;
+ kr->length= max_length;
+ kr->keypart_map= max_keypart_map;
+ /*
+ We use READ_AFTER_KEY here because if we are reading on a key
+ prefix we want to find all keys with this prefix
+ */
+ kr->flag= (flag & NEAR_MAX ? HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY);
+ }
};
@@ -339,7 +418,7 @@ public:
int reset(void);
int get_next();
void range_end();
- int get_next_prefix(uint prefix_length, key_part_map keypart_map,
+ int get_next_prefix(uint prefix_length, uint group_key_parts,
uchar *cur_prefix);
bool reverse_sorted() { return 0; }
bool unique_key_range();
@@ -429,6 +508,7 @@ public:
class QUICK_INDEX_MERGE_SELECT : public QUICK_SELECT_I
{
+ Unique *unique;
public:
QUICK_INDEX_MERGE_SELECT(THD *thd, TABLE *table);
~QUICK_INDEX_MERGE_SELECT();
@@ -613,13 +693,13 @@ private:
class QUICK_GROUP_MIN_MAX_SELECT : public QUICK_SELECT_I
{
private:
- handler *file; /* The handler used to get data. */
+ handler * const file; /* The handler used to get data. */
JOIN *join; /* Descriptor of the current query */
KEY *index_info; /* The index chosen for data access */
uchar *record; /* Buffer where the next record is returned. */
uchar *tmp_record; /* Temporary storage for next_min(), next_max(). */
uchar *group_prefix; /* Key prefix consisting of the GROUP fields. */
- uint group_prefix_len; /* Length of the group prefix. */
+ const uint group_prefix_len; /* Length of the group prefix. */
uint group_key_parts; /* A number of keyparts in the group prefix */
uchar *last_prefix; /* Prefix of the last group for detecting EOF. */
bool have_min; /* Specify whether we are computing */
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 974eea08871..450ded89653 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -89,6 +89,126 @@ static ulonglong get_exact_record_count(TABLE_LIST *tables)
/**
+ Use index to read MIN(field) value.
+
+ @param table Table object
+ @param ref Reference to the structure where we store the key value
+ @item_field Field used in MIN()
+ @range_fl Whether range endpoint is strict less than
+ @prefix_len Length of common key part for the range
+
+ @retval
+ 0 No errors
+ HA_ERR_... Otherwise
+*/
+
+static int get_index_min_value(TABLE *table, TABLE_REF *ref,
+ Item_field *item_field, uint range_fl,
+ uint prefix_len)
+{
+ int error;
+
+ if (!ref->key_length)
+ error= table->file->ha_index_first(table->record[0]);
+ else
+ {
+ /*
+ Use index to replace MIN/MAX functions with their values
+ according to the following rules:
+
+ 1) Insert the minimum non-null values where the WHERE clause still
+ matches, or
+ 2) a NULL value if there are only NULL values for key_part_k.
+ 3) Fail, producing a row of nulls
+
+ Implementation: Read the smallest value using the search key. If
+ the interval is open, read the next value after the search
+ key. If read fails, and we're looking for a MIN() value for a
+ nullable column, test if there is an exact match for the key.
+ */
+ if (!(range_fl & NEAR_MIN))
+ /*
+ Closed interval: Either The MIN argument is non-nullable, or
+ we have a >= predicate for the MIN argument.
+ */
+ error= table->file->ha_index_read_map(table->record[0],
+ ref->key_buff,
+ make_prev_keypart_map(ref->key_parts),
+ HA_READ_KEY_OR_NEXT);
+ else
+ {
+ /*
+ Open interval: There are two cases:
+ 1) We have only MIN() and the argument column is nullable, or
+ 2) there is a > predicate on it, nullability is irrelevant.
+ We need to scan the next bigger record first.
+ Open interval is not used if the search key involves the last keypart,
+ and it would not work.
+ */
+ DBUG_ASSERT(prefix_len < ref->key_length);
+ error= table->file->ha_index_read_map(table->record[0],
+ ref->key_buff,
+ make_prev_keypart_map(ref->key_parts),
+ HA_READ_AFTER_KEY);
+ /*
+ If the found record is outside the group formed by the search
+ prefix, or there is no such record at all, check if all
+ records in that group have NULL in the MIN argument
+ column. If that is the case return that NULL.
+
+ Check if case 1 from above holds. If it does, we should read
+ the skipped tuple.
+ */
+ if (item_field->field->real_maybe_null() &&
+ ref->key_buff[prefix_len] == 1 &&
+ /*
+ Last keypart (i.e. the argument to MIN) is set to NULL by
+ find_key_for_maxmin only if all other keyparts are bound
+ to constants in a conjunction of equalities. Hence, we
+ can detect this by checking only if the last keypart is
+ NULL.
+ */
+ (error == HA_ERR_KEY_NOT_FOUND ||
+ key_cmp_if_same(table, ref->key_buff, ref->key, prefix_len)))
+ {
+ DBUG_ASSERT(item_field->field->real_maybe_null());
+ error= table->file->ha_index_read_map(table->record[0],
+ ref->key_buff,
+ make_prev_keypart_map(ref->key_parts),
+ HA_READ_KEY_EXACT);
+ }
+ }
+ }
+ return error;
+}
+
+
+/**
+ Use index to read MAX(field) value.
+
+ @param table Table object
+ @param ref Reference to the structure where we store the key value
+ @range_fl Whether range endpoint is strict greater than
+
+ @retval
+ 0 No errors
+ HA_ERR_... Otherwise
+*/
+
+static int get_index_max_value(TABLE *table, TABLE_REF *ref, uint range_fl)
+{
+ return (ref->key_length ?
+ table->file->ha_index_read_map(table->record[0], ref->key_buff,
+ make_prev_keypart_map(ref->key_parts),
+ range_fl & NEAR_MAX ?
+ HA_READ_BEFORE_KEY :
+ HA_READ_PREFIX_LAST_OR_PREV) :
+ table->file->ha_index_last(table->record[0]));
+}
+
+
+
+/**
Substitutes constants for some COUNT(), MIN() and MAX() functions.
@param tables list of leaves of join table tree
@@ -220,9 +340,11 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
const_result= 0;
break;
case Item_sum::MIN_FUNC:
+ case Item_sum::MAX_FUNC:
{
+ int is_max= test(item_sum->sum_func() == Item_sum::MAX_FUNC);
/*
- If MIN(expr) is the first part of a key or if all previous
+ If MIN/MAX(expr) is the first part of a key or if all previous
parts of the key is found in the COND, then we can use
indexes to find the key.
*/
@@ -241,89 +363,25 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
Look for a partial key that can be used for optimization.
If we succeed, ref.key_length will contain the length of
this key, while prefix_len will contain the length of
- the beginning of this key without field used in MIN().
+ the beginning of this key without field used in MIN/MAX().
Type of range for the key part for this field will be
returned in range_fl.
*/
if (table->file->inited || (outer_tables & table->map) ||
- !find_key_for_maxmin(0, &ref, item_field->field, conds,
+ !find_key_for_maxmin(is_max, &ref, item_field->field, conds,
&range_fl, &prefix_len))
{
const_result= 0;
break;
}
- error= table->file->ha_index_init((uint) ref.key, 1);
+ if (!(error= table->file->ha_index_init((uint) ref.key, 1)))
+ error= (is_max ?
+ get_index_max_value(table, &ref, range_fl) :
+ get_index_min_value(table, &ref, item_field, range_fl,
+ prefix_len));
- if (!ref.key_length)
- error= table->file->ha_index_first(table->record[0]);
- else
- {
- /*
- Use index to replace MIN/MAX functions with their values
- according to the following rules:
-
- 1) Insert the minimum non-null values where the WHERE clause still
- matches, or
- 2) a NULL value if there are only NULL values for key_part_k.
- 3) Fail, producing a row of nulls
-
- Implementation: Read the smallest value using the search key. If
- the interval is open, read the next value after the search
- key. If read fails, and we're looking for a MIN() value for a
- nullable column, test if there is an exact match for the key.
- */
- if (!(range_fl & NEAR_MIN))
- /*
- Closed interval: Either The MIN argument is non-nullable, or
- we have a >= predicate for the MIN argument.
- */
- error= table->file->ha_index_read_map(table->record[0],
- ref.key_buff,
- make_prev_keypart_map(ref.key_parts),
- HA_READ_KEY_OR_NEXT);
- else
- {
- /*
- Open interval: There are two cases:
- 1) We have only MIN() and the argument column is nullable, or
- 2) there is a > predicate on it, nullability is irrelevant.
- We need to scan the next bigger record first.
- */
- error= table->file->ha_index_read_map(table->record[0],
- ref.key_buff,
- make_prev_keypart_map(ref.key_parts),
- HA_READ_AFTER_KEY);
- /*
- If the found record is outside the group formed by the search
- prefix, or there is no such record at all, check if all
- records in that group have NULL in the MIN argument
- column. If that is the case return that NULL.
-
- Check if case 1 from above holds. If it does, we should read
- the skipped tuple.
- */
- if (item_field->field->real_maybe_null() &&
- ref.key_buff[prefix_len] == 1 &&
- /*
- Last keypart (i.e. the argument to MIN) is set to NULL by
- find_key_for_maxmin only if all other keyparts are bound
- to constants in a conjunction of equalities. Hence, we
- can detect this by checking only if the last keypart is
- NULL.
- */
- (error == HA_ERR_KEY_NOT_FOUND ||
- key_cmp_if_same(table, ref.key_buff, ref.key, prefix_len)))
- {
- DBUG_ASSERT(item_field->field->real_maybe_null());
- error= table->file->ha_index_read_map(table->record[0],
- ref.key_buff,
- make_prev_keypart_map(ref.key_parts),
- HA_READ_KEY_EXACT);
- }
- }
- }
/* Verify that the read tuple indeed matches the search key */
- if (!error && reckey_in_range(0, &ref, item_field->field,
+ if (!error && reckey_in_range(is_max, &ref, item_field->field,
conds, range_fl, prefix_len))
error= HA_ERR_KEY_NOT_FOUND;
table->disable_keyread();
@@ -352,98 +410,16 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
const_result= 0;
break;
}
- if (!count)
- {
- /* If count == 0, then we know that is_exact_count == TRUE. */
- ((Item_sum_min*) item_sum)->clear(); /* Set to NULL. */
- }
- else
- ((Item_sum_min*) item_sum)->reset(); /* Set to the constant value. */
- ((Item_sum_min*) item_sum)->make_const();
- recalc_const_item= 1;
- break;
- }
- case Item_sum::MAX_FUNC:
- {
/*
- If MAX(expr) is the first part of a key or if all previous
- parts of the key is found in the COND, then we can use
- indexes to find the key.
+ If count == 0 (so is_exact_count == TRUE) and
+ there're no outer joins, set to NULL,
+ otherwise set to the constant value.
*/
- Item *expr=item_sum->get_arg(0);
- if (expr->real_item()->type() == Item::FIELD_ITEM)
- {
- uchar key_buff[MAX_KEY_LENGTH];
- TABLE_REF ref;
- uint range_fl, prefix_len;
-
- ref.key_buff= key_buff;
- Item_field *item_field= (Item_field*) (expr->real_item());
- TABLE *table= item_field->field->table;
-
- /*
- Look for a partial key that can be used for optimization.
- If we succeed, ref.key_length will contain the length of
- this key, while prefix_len will contain the length of
- the beginning of this key without field used in MAX().
- Type of range for the key part for this field will be
- returned in range_fl.
- */
- if (table->file->inited || (outer_tables & table->map) ||
- !find_key_for_maxmin(1, &ref, item_field->field, conds,
- &range_fl, &prefix_len))
- {
- const_result= 0;
- break;
- }
- error= table->file->ha_index_init((uint) ref.key, 1);
-
- if (!ref.key_length)
- error= table->file->ha_index_last(table->record[0]);
- else
- error= table->file->ha_index_read_map(table->record[0], key_buff,
- make_prev_keypart_map(ref.key_parts),
- range_fl & NEAR_MAX ?
- HA_READ_BEFORE_KEY :
- HA_READ_PREFIX_LAST_OR_PREV);
- if (!error && reckey_in_range(1, &ref, item_field->field,
- conds, range_fl, prefix_len))
- error= HA_ERR_KEY_NOT_FOUND;
- table->disable_keyread();
- table->file->ha_index_end();
- if (error)
- {
- if (error == HA_ERR_KEY_NOT_FOUND || error == HA_ERR_END_OF_FILE)
- return HA_ERR_KEY_NOT_FOUND; // No rows matching WHERE
- /* HA_ERR_LOCK_DEADLOCK or some other error */
- table->file->print_error(error, MYF(0));
- table->in_use->fatal_error();
- return(error);
- }
- removed_tables|= table->map;
- }
- else if (!expr->const_item() || !is_exact_count)
- {
- /*
- The optimization is not applicable in both cases:
- (a) 'expr' is a non-constant expression. Then we can't
- replace 'expr' by a constant.
- (b) 'expr' is a costant. According to ANSI, MIN/MAX must return
- NULL if the query does not return any rows. Thus, if we are not
- able to determine if the query returns any rows, we can't apply
- the optimization and replace MIN/MAX with a constant.
- */
- const_result= 0;
- break;
- }
- if (!count)
- {
- /* If count != 1, then we know that is_exact_count == TRUE. */
- ((Item_sum_max*) item_sum)->clear(); /* Set to NULL. */
- }
+ if (!count && !outer_tables)
+ item_sum->clear();
else
- ((Item_sum_max*) item_sum)->reset(); /* Set to the constant value. */
- ((Item_sum_max*) item_sum)->make_const();
+ item_sum->reset();
+ item_sum->make_const();
recalc_const_item= 1;
break;
}
@@ -617,18 +593,19 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
key_part_map *key_part_used, uint *range_fl,
uint *prefix_len)
{
+ DBUG_ENTER("matching_cond");
if (!cond)
- return 1;
+ DBUG_RETURN(TRUE);
Field *field= field_part->field;
if (!(cond->used_tables() & field->table->map))
{
/* Condition doesn't restrict the used table */
- return 1;
+ DBUG_RETURN(TRUE);
}
if (cond->type() == Item::COND_ITEM)
{
if (((Item_cond*) cond)->functype() == Item_func::COND_OR_FUNC)
- return 0;
+ DBUG_RETURN(FALSE);
/* AND */
List_iterator_fast<Item> li(*((Item_cond*) cond)->argument_list());
@@ -637,13 +614,13 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
{
if (!matching_cond(max_fl, ref, keyinfo, field_part, item,
key_part_used, range_fl, prefix_len))
- return 0;
+ DBUG_RETURN(FALSE);
}
- return 1;
+ DBUG_RETURN(TRUE);
}
if (cond->type() != Item::FUNC_ITEM)
- return 0; // Not operator, can't optimize
+ DBUG_RETURN(FALSE); // Not operator, can't optimize
bool eq_type= 0; // =, <=> or IS NULL
bool is_null_safe_eq= FALSE; // The operator is NULL safe, e.g. <=>
@@ -677,7 +654,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
eq_type= 1;
break;
default:
- return 0; // Can't optimize function
+ DBUG_RETURN(FALSE); // Can't optimize function
}
Item *args[3];
@@ -685,11 +662,11 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
/* Test if this is a comparison of a field and constant */
if (!simple_pred((Item_func*) cond, args, &inv))
- return 0;
+ DBUG_RETURN(FALSE);
if (!is_null_safe_eq && !is_null &&
(args[1]->is_null() || (between && args[2]->is_null())))
- return FALSE;
+ DBUG_RETURN(FALSE);
if (inv && !eq_type)
less_fl= 1-less_fl; // Convert '<' -> '>' (etc)
@@ -701,14 +678,14 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
{
if (part > field_part)
- return 0; // Field is beyond the tested parts
+ DBUG_RETURN(FALSE); // Field is beyond the tested parts
if (part->field->eq(((Item_field*) args[0])->field))
break; // Found a part of the key for the field
}
bool is_field_part= part == field_part;
if (!(is_field_part || eq_type))
- return 0;
+ DBUG_RETURN(FALSE);
key_part_map org_key_part_used= *key_part_used;
if (eq_type || between || max_fl == less_fl)
@@ -728,6 +705,17 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
*key_part_used|= (key_part_map) 1 << (part - keyinfo->key_part);
}
+ if (org_key_part_used == *key_part_used &&
+ /*
+ The current search key is not being extended with a new key part. This
+ means that the a condition is added a key part for which there was a
+ previous condition. We can only overwrite such key parts in some special
+ cases, e.g. a > 2 AND a > 1 (here range_fl must be set to something). In
+ all other cases the WHERE condition is always false anyway.
+ */
+ (eq_type || *range_fl == 0))
+ DBUG_RETURN(FALSE);
+
if (org_key_part_used != *key_part_used ||
(is_field_part &&
(between || eq_type || max_fl == less_fl) && !cond->val_int()))
@@ -773,11 +761,11 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
{
if ((!is_null && !cond->val_int()) ||
(is_null && !test(part->field->is_null())))
- return 0; // Impossible test
+ DBUG_RETURN(FALSE); // Impossible test
}
else if (is_field_part)
*range_fl&= ~(max_fl ? NO_MIN_RANGE : NO_MAX_RANGE);
- return 1;
+ DBUG_RETURN(TRUE);
}
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc
index 5d952021365..174dcbf9c13 100644
--- a/sql/opt_table_elimination.cc
+++ b/sql/opt_table_elimination.cc
@@ -1539,7 +1539,7 @@ Dep_value_table *Dep_analysis_context::create_table_value(TABLE *table)
for (uint i=0; i < table->s->keys; i++)
{
KEY *key= table->key_info + i;
- if ((key->flags & (HA_NOSAME | HA_END_SPACE_KEY)) == HA_NOSAME)
+ if (key->flags & HA_NOSAME)
{
Dep_module_key *key_dep;
if (!(key_dep= new Dep_module_key(tbl_dep, i, key->key_parts)))
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 0fa13949aba..9b1b1f70784 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -976,7 +976,7 @@ bool load_master_data(THD* thd)
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))
+ if (flush_master_info(active_mi, FALSE, FALSE))
sql_print_error("Failed to flush master info file");
}
mysql_free_result(master_status_res);
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index b8af53849f1..47fc88c9a8a 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -322,7 +322,7 @@ file '%s')", fname);
mi->inited = 1;
// 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))))
+ if ((error=test(flush_master_info(mi, TRUE, TRUE))))
sql_print_error("Failed to flush master info file");
pthread_mutex_unlock(&mi->data_lock);
DBUG_RETURN(error);
@@ -348,10 +348,13 @@ err:
1 - flush master info failed
0 - all ok
*/
-int flush_master_info(Master_info* mi, bool flush_relay_log_cache)
+int flush_master_info(Master_info* mi,
+ bool flush_relay_log_cache,
+ bool need_lock_relay_log)
{
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));
@@ -368,9 +371,23 @@ 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)
+ {
+ pthread_mutex_t *log_lock= mi->rli.relay_log.get_log_lock();
+ IO_CACHE *log_file= mi->rli.relay_log.get_log_file();
+
+ if (need_lock_relay_log)
+ pthread_mutex_lock(log_lock);
+
+ safe_mutex_assert_owner(log_lock);
+ err= flush_io_cache(log_file);
+
+ if (need_lock_relay_log)
+ pthread_mutex_unlock(log_lock);
+
+ if (err)
+ DBUG_RETURN(2);
+ }
/*
We flushed the relay log BEFORE the master.info file, because if we crash
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index 93fb0a98198..023879f84fa 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -108,7 +108,8 @@ int init_master_info(Master_info* mi, const char* master_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 flush_master_info(Master_info* mi,
+ bool flush_relay_log_cache,
+ bool need_lock_relay_log);
#endif /* HAVE_REPLICATION */
#endif /* RPL_MI_H */
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 26daac1b629..46ae057f97e 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -115,7 +115,7 @@ int init_relay_log_info(Relay_log_info* rli,
/*
The relay log will now be opened, as a SEQ_READ_APPEND IO_CACHE.
Note that the I/O thread flushes it to disk after writing every
- event, in flush_master_info(mi, 1).
+ event, in flush_master_info(mi, 1, ?).
*/
/*
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 5a5e498c785..3e2d27a012d 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -2829,10 +2829,26 @@ int set_var_collation_client::update(THD *thd)
/****************************************************************************/
+bool sys_var_timestamp::check(THD *thd, set_var *var)
+{
+ time_t val;
+ var->save_result.ulonglong_value= var->value->val_int();
+ val= (time_t) var->save_result.ulonglong_value;
+ if (val < (time_t) MY_TIME_T_MIN || val > (time_t) MY_TIME_T_MAX)
+ {
+ my_message(ER_UNKNOWN_ERROR,
+ "This version of MySQL doesn't support dates later than 2038",
+ MYF(0));
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
bool sys_var_timestamp::update(THD *thd, set_var *var)
{
thd->set_time((time_t) var->save_result.ulonglong_value);
- return 0;
+ return FALSE;
}
@@ -4308,8 +4324,14 @@ bool sys_var_thd_dbug::check(THD *thd, set_var *var)
bool sys_var_thd_dbug::update(THD *thd, set_var *var)
{
-#ifndef DBUG_OFF
- const char *command= var ? var->value->str_value.c_ptr() : "";
+ char buf[256];
+ String str(buf, sizeof(buf), system_charset_info), *res;
+ const char *command;
+
+ res= var->value->val_str(&str);
+ command= res ? res->c_ptr(): 0;
+ if (!command)
+ command= "";
if (var->type == OPT_GLOBAL)
DBUG_SET_INITIAL(command);
@@ -4329,7 +4351,6 @@ bool sys_var_thd_dbug::update(THD *thd, set_var *var)
DBUG_PUSH(command);
}
}
-#endif
return 0;
}
diff --git a/sql/set_var.h b/sql/set_var.h
index 4f0ef390cce..54e4ac7e2f1 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -668,6 +668,7 @@ public:
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
:sys_var(name_arg, NULL, binlog_status_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);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
diff --git a/sql/slave.cc b/sql/slave.cc
index e92070ebcc1..3df5c0df0b2 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1439,7 +1439,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi)
" to the relay log, SHOW SLAVE STATUS may be"
" inaccurate");
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
- if (flush_master_info(mi, 1))
+ if (flush_master_info(mi, TRUE, TRUE))
sql_print_error("Failed to flush master info file");
delete ev;
}
@@ -2692,7 +2692,7 @@ Stopping slave I/O thread due to out-of-memory error from master");
"could not queue event from master");
goto err;
}
- if (flush_master_info(mi, 1))
+ if (flush_master_info(mi, TRUE, TRUE))
{
sql_print_error("Failed to flush master info file");
goto err;
diff --git a/sql/sp.cc b/sql/sp.cc
index ac509a3bb2d..e2e7583b901 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -784,7 +784,12 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
thd->spcont= NULL;
{
- Parser_state parser_state(thd, defstr.c_ptr(), defstr.length());
+ Parser_state parser_state;
+ if (parser_state.init(thd, defstr.c_ptr(), defstr.length()))
+ {
+ ret= SP_INTERNAL_ERROR;
+ goto end;
+ }
lex_start(thd);
@@ -1634,8 +1639,7 @@ extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen,
void sp_get_prelocking_info(THD *thd, bool *need_prelocking,
bool *first_no_prelocking)
{
- Sroutine_hash_entry *routine;
- routine= (Sroutine_hash_entry*)thd->lex->sroutines_list.first;
+ Sroutine_hash_entry *routine= thd->lex->sroutines_list.first;
DBUG_ASSERT(routine);
bool first_is_procedure= (routine->key.str[0] == TYPE_ENUM_PROCEDURE);
@@ -1698,7 +1702,7 @@ static bool add_used_routine(LEX *lex, Query_arena *arena,
memcpy(rn->key.str, key->str, key->length + 1);
if (my_hash_insert(&lex->sroutines, (uchar *)rn))
return FALSE;
- lex->sroutines_list.link_in_list((uchar *)rn, (uchar **)&rn->next);
+ lex->sroutines_list.link_in_list(rn, &rn->next);
rn->belong_to_view= belong_to_view;
return TRUE;
}
@@ -1744,7 +1748,7 @@ void sp_add_used_routine(LEX *lex, Query_arena *arena,
void sp_remove_not_own_routines(LEX *lex)
{
Sroutine_hash_entry *not_own_rt, *next_rt;
- for (not_own_rt= *(Sroutine_hash_entry **)lex->sroutines_list_own_last;
+ for (not_own_rt= *lex->sroutines_list_own_last;
not_own_rt; not_own_rt= next_rt)
{
/*
@@ -1755,7 +1759,7 @@ void sp_remove_not_own_routines(LEX *lex)
hash_delete(&lex->sroutines, (uchar *)not_own_rt);
}
- *(Sroutine_hash_entry **)lex->sroutines_list_own_last= NULL;
+ *lex->sroutines_list_own_last= NULL;
lex->sroutines_list.next= lex->sroutines_list_own_last;
lex->sroutines_list.elements= lex->sroutines_list_own_elements;
}
@@ -1836,11 +1840,11 @@ sp_update_stmt_used_routines(THD *thd, LEX *lex, HASH *src,
It will also add elements to end of 'LEX::sroutines_list' list.
*/
-static void sp_update_stmt_used_routines(THD *thd, LEX *lex, SQL_LIST *src,
+static void sp_update_stmt_used_routines(THD *thd, LEX *lex,
+ SQL_I_List<Sroutine_hash_entry> *src,
TABLE_LIST *belong_to_view)
{
- for (Sroutine_hash_entry *rt= (Sroutine_hash_entry *)src->first;
- rt; rt= rt->next)
+ for (Sroutine_hash_entry *rt= src->first; rt; rt= rt->next)
(void)add_used_routine(lex, thd->stmt_arena, &rt->key, belong_to_view);
}
@@ -1975,8 +1979,7 @@ int
sp_cache_routines_and_add_tables(THD *thd, LEX *lex, bool first_no_prelock)
{
return sp_cache_routines_and_add_tables_aux(thd, lex,
- (Sroutine_hash_entry *)lex->sroutines_list.first,
- first_no_prelock);
+ lex->sroutines_list.first, first_no_prelock);
}
@@ -2000,8 +2003,7 @@ sp_cache_routines_and_add_tables(THD *thd, LEX *lex, bool first_no_prelock)
int
sp_cache_routines_and_add_tables_for_view(THD *thd, LEX *lex, TABLE_LIST *view)
{
- Sroutine_hash_entry **last_cached_routine_ptr=
- (Sroutine_hash_entry **)lex->sroutines_list.next;
+ Sroutine_hash_entry **last_cached_routine_ptr= lex->sroutines_list.next;
sp_update_stmt_used_routines(thd, lex, &view->view->sroutines_list,
view->top_table());
return sp_cache_routines_and_add_tables_aux(thd, lex,
@@ -2030,8 +2032,7 @@ sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex,
{
int ret= 0;
- Sroutine_hash_entry **last_cached_routine_ptr=
- (Sroutine_hash_entry **)lex->sroutines_list.next;
+ Sroutine_hash_entry **last_cached_routine_ptr= lex->sroutines_list.next;
if (static_cast<int>(table->lock_type) >=
static_cast<int>(TL_WRITE_ALLOW_WRITE))
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index f7dc2c83641..9f9219566d7 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -34,6 +34,36 @@
extern "C" uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first);
+/**
+ Helper function which operates on a THD object to set the query start_time to
+ the current time.
+
+ @param[in, out] thd The session object
+
+*/
+
+static void reset_start_time_for_sp(THD *thd)
+{
+ /*
+ Do nothing if the context is a trigger or function because time should be
+ constant during the execution of those.
+ */
+ if (!thd->in_sub_stmt)
+ {
+ /*
+ First investigate if there is a cached time stamp
+ */
+ if (thd->user_time)
+ {
+ thd->start_time= thd->user_time;
+ }
+ else
+ {
+ my_micro_time_and_time(&thd->start_time);
+ }
+ }
+}
+
Item_result
sp_map_result_type(enum enum_field_types type)
{
@@ -1227,10 +1257,13 @@ sp_head::execute(THD *thd)
DBUG_PRINT("execute", ("Instruction %u", ip));
- /* Don't change NOW() in FUNCTION or TRIGGER */
- if (!thd->in_sub_stmt)
- thd->set_time(); // Make current_time() et al work
-
+ /*
+ We need to reset start_time to allow for time to flow inside a stored
+ procedure. This is only done for SP since time is suppose to be constant
+ during execution of triggers and functions.
+ */
+ reset_start_time_for_sp(thd);
+
/*
We have to set thd->stmt_arena before executing the instruction
to store in the instruction free_list all new items, created
@@ -1842,8 +1875,6 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
{
bool err_status= FALSE;
uint params = m_pcont->context_var_count();
- /* Query start time may be reset in a multi-stmt SP; keep this for later. */
- ulonglong utime_before_sp_exec= thd->utime_after_lock;
sp_rcontext *save_spcont, *octx;
sp_rcontext *nctx = NULL;
bool save_enable_slow_log;
@@ -2036,8 +2067,6 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
delete nctx;
thd->spcont= save_spcont;
- thd->utime_after_lock= utime_before_sp_exec;
-
DBUG_RETURN(err_status);
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 80134d7c33b..66a4f7694f9 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1248,6 +1248,12 @@ void close_thread_tables(THD *thd)
table->s->table_name.str, (long) table));
#endif
+#if defined(ENABLED_DEBUG_SYNC)
+ /* debug_sync may not be initialized for some slave threads */
+ if (thd->debug_sync_control)
+ DEBUG_SYNC(thd, "before_close_thread_tables");
+#endif
+
/*
We are assuming here that thd->derived_tables contains ONLY derived
tables for this substatement. i.e. instead of approach which uses
@@ -2522,7 +2528,7 @@ bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists)
put in the thread-open-list.
flags Bitmap of flags to modify how open works:
MYSQL_LOCK_IGNORE_FLUSH - Open table even if
- someone has done a flush or namelock on it.
+ someone has done a flush on it.
No version number checking is done.
MYSQL_OPEN_TEMPORARY_ONLY - Open only temporary
table not the base table or view.
@@ -2812,8 +2818,10 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
("Found table '%s.%s' with different refresh version",
table_list->db, table_list->table_name));
- if (flags & MYSQL_LOCK_IGNORE_FLUSH)
+ /* Ignore FLUSH, but not name locks! */
+ if (flags & MYSQL_LOCK_IGNORE_FLUSH && !table->open_placeholder)
{
+ DBUG_ASSERT(table->db_stat);
/* Force close at once after usage */
thd->version= table->s->version;
continue;
@@ -4445,7 +4453,8 @@ bool fix_merge_after_open(TABLE_LIST *old_child_list, TABLE_LIST **old_last,
Return a appropriate read lock type given a table object.
@param thd Thread context
- @param table TABLE object for table to be locked
+ @param lex LEX for the current statement.
+ @param table_list Table list element for table to be locked.
@remark Due to a statement-based replication limitation, statements such as
INSERT INTO .. SELECT FROM .. and CREATE TABLE .. SELECT FROM need
@@ -4454,19 +4463,32 @@ bool fix_merge_after_open(TABLE_LIST *old_child_list, TABLE_LIST **old_last,
source table. If such a statement gets applied on the slave before
the INSERT .. SELECT statement finishes, data on the master could
differ from data on the slave and end-up with a discrepancy between
- the binary log and table state. Furthermore, this does not apply to
- I_S and log tables as it's always unsafe to replicate such tables
- under statement-based replication as the table on the slave might
- contain other data (ie: general_log is enabled on the slave). The
- statement will be marked as unsafe for SBR in decide_logging_format().
+ the binary log and table state.
+ This also applies to SELECT/SET/DO statements which use stored
+ functions. Calls to such functions are going to be logged as a
+ whole and thus should be serialized against concurrent changes
+ to tables used by those functions. This can be avoided if functions
+ only read data but doing so requires more complex analysis than it
+ is done now (unfortunately, due to bug #53921 "Wrong locks for
+ SELECTs used stored functions may lead to broken SBR" this rule
+ is not followed in cases when stored function or trigger use
+ simple SELECT and not a subselect in their body).
+ Furthermore, this does not apply to I_S and log tables as it's
+ always unsafe to replicate such tables under statement-based
+ replication as the table on the slave might contain other data
+ (ie: general_log is enabled on the slave). The statement will
+ be marked as unsafe for SBR in decide_logging_format().
*/
-thr_lock_type read_lock_type_for_table(THD *thd, TABLE *table)
+thr_lock_type read_lock_type_for_table(THD *thd, LEX *lex,
+ TABLE_LIST *table_list)
{
bool log_on= mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG);
ulong binlog_format= thd->variables.binlog_format;
if ((log_on == FALSE) || (binlog_format == BINLOG_FORMAT_ROW) ||
- (table->s->table_category == TABLE_CATEGORY_PERFORMANCE))
+ (table_list->table->s->table_category == TABLE_CATEGORY_PERFORMANCE) ||
+ (lex->sql_command == SQLCOM_SELECT &&
+ ! table_list->prelocking_placeholder))
return TL_READ;
else
return TL_READ_NO_INSERT;
@@ -4483,7 +4505,7 @@ thr_lock_type read_lock_type_for_table(THD *thd, TABLE *table)
counter - number of opened tables will be return using this parameter
flags - bitmap of flags to modify how the tables will be open:
MYSQL_LOCK_IGNORE_FLUSH - open table even if someone has
- done a flush or namelock on it.
+ done a flush on it.
NOTE
Unless we are already in prelocked mode, this function will also precache
@@ -4762,7 +4784,7 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
tables->table->reginfo.lock_type= thd->update_lock_default;
else if (tables->lock_type == TL_READ_DEFAULT)
tables->table->reginfo.lock_type=
- read_lock_type_for_table(thd, tables->table);
+ read_lock_type_for_table(thd, thd->lex, tables);
else
tables->table->reginfo.lock_type= tables->lock_type;
}
@@ -5082,7 +5104,7 @@ int open_and_lock_tables_derived(THD *thd, TABLE_LIST *tables, bool derived)
tables - list of tables for open
flags - bitmap of flags to modify how the tables will be open:
MYSQL_LOCK_IGNORE_FLUSH - open table even if someone has
- done a flush or namelock on it.
+ done a flush on it.
RETURN
FALSE - ok
@@ -5181,53 +5203,75 @@ int decide_logging_format(THD *thd, TABLE_LIST *tables)
set with all the capabilities bits set and one with no
capabilities bits set.
*/
- handler::Table_flags flags_some_set= 0;
- handler::Table_flags flags_all_set=
+ handler::Table_flags flags_write_some_set= 0;
+ handler::Table_flags flags_access_some_set= 0;
+ handler::Table_flags flags_write_all_set=
HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE;
- my_bool multi_engine= FALSE;
- void* prev_ht= NULL;
+ /*
+ If different types of engines are about to be updated.
+ For example: Innodb and Falcon; Innodb and MyIsam.
+ */
+ my_bool multi_write_engine= FALSE;
+ void* prev_write_ht= NULL;
+
+ /*
+ If different types of engines are about to be accessed
+ and any of them is about to be updated. For example:
+ Innodb and Falcon; Innodb and MyIsam.
+ */
+ my_bool multi_access_engine= FALSE;
+ void* prev_access_ht= NULL;
for (TABLE_LIST *table= tables; table; table= table->next_global)
{
if (table->placeholder())
continue;
if (table->table->s->table_category == TABLE_CATEGORY_PERFORMANCE)
thd->lex->set_stmt_unsafe();
+ ulonglong const flags= table->table->file->ha_table_flags();
if (table->lock_type >= TL_WRITE_ALLOW_WRITE)
{
- ulonglong const flags= table->table->file->ha_table_flags();
DBUG_PRINT("info", ("table: %s; ha_table_flags: %s%s",
table->table_name,
FLAGSTR(flags, HA_BINLOG_STMT_CAPABLE),
FLAGSTR(flags, HA_BINLOG_ROW_CAPABLE)));
- if (prev_ht && prev_ht != table->table->file->ht)
- multi_engine= TRUE;
- prev_ht= table->table->file->ht;
- flags_all_set &= flags;
- flags_some_set |= flags;
+ if (prev_write_ht && prev_write_ht != table->table->file->ht)
+ multi_write_engine= TRUE;
+ prev_write_ht= table->table->file->ht;
+ flags_write_all_set &= flags;
+ flags_write_some_set |= flags;
}
- }
-
- DBUG_PRINT("info", ("flags_all_set: %s%s",
- FLAGSTR(flags_all_set, HA_BINLOG_STMT_CAPABLE),
- FLAGSTR(flags_all_set, HA_BINLOG_ROW_CAPABLE)));
- DBUG_PRINT("info", ("flags_some_set: %s%s",
- FLAGSTR(flags_some_set, HA_BINLOG_STMT_CAPABLE),
- FLAGSTR(flags_some_set, HA_BINLOG_ROW_CAPABLE)));
+ if (prev_access_ht && prev_access_ht != table->table->file->ht)
+ multi_access_engine= TRUE;
+ prev_access_ht= table->table->file->ht;
+ flags_access_some_set |= flags;
+ }
+
+ DBUG_PRINT("info", ("flags_write_all_set: %s%s",
+ FLAGSTR(flags_write_all_set, HA_BINLOG_STMT_CAPABLE),
+ FLAGSTR(flags_write_all_set, HA_BINLOG_ROW_CAPABLE)));
+ DBUG_PRINT("info", ("flags_write_some_set: %s%s",
+ FLAGSTR(flags_write_some_set, HA_BINLOG_STMT_CAPABLE),
+ FLAGSTR(flags_write_some_set, HA_BINLOG_ROW_CAPABLE)));
+ DBUG_PRINT("info", ("flags_access_some_set: %s%s",
+ FLAGSTR(flags_access_some_set, HA_BINLOG_STMT_CAPABLE),
+ FLAGSTR(flags_access_some_set, HA_BINLOG_ROW_CAPABLE)));
+ DBUG_PRINT("info", ("multi_write_engine: %s",
+ multi_write_engine ? "TRUE" : "FALSE"));
+ DBUG_PRINT("info", ("multi_access_engine: %s",
+ multi_access_engine ? "TRUE" : "FALSE"));
DBUG_PRINT("info", ("thd->variables.binlog_format: %ld",
thd->variables.binlog_format));
- DBUG_PRINT("info", ("multi_engine: %s",
- multi_engine ? "TRUE" : "FALSE"));
int error= 0;
- if (flags_all_set == 0)
+ if (flags_write_all_set == 0)
{
my_error((error= ER_BINLOG_LOGGING_IMPOSSIBLE), MYF(0),
"Statement cannot be logged to the binary log in"
" row-based nor statement-based format");
}
else if (thd->variables.binlog_format == BINLOG_FORMAT_STMT &&
- (flags_all_set & HA_BINLOG_STMT_CAPABLE) == 0)
+ (flags_write_all_set & HA_BINLOG_STMT_CAPABLE) == 0)
{
my_error((error= ER_BINLOG_LOGGING_IMPOSSIBLE), MYF(0),
"Statement-based format required for this statement,"
@@ -5235,7 +5279,7 @@ int decide_logging_format(THD *thd, TABLE_LIST *tables)
}
else if ((thd->variables.binlog_format == BINLOG_FORMAT_ROW ||
thd->lex->is_stmt_unsafe()) &&
- (flags_all_set & HA_BINLOG_ROW_CAPABLE) == 0)
+ (flags_write_all_set & HA_BINLOG_ROW_CAPABLE) == 0)
{
my_error((error= ER_BINLOG_LOGGING_IMPOSSIBLE), MYF(0),
"Row-based format required for this statement,"
@@ -5248,8 +5292,8 @@ int decide_logging_format(THD *thd, TABLE_LIST *tables)
statement cannot be logged atomically, so we generate an error
rather than allowing the binlog to become corrupt.
*/
- if (multi_engine &&
- (flags_some_set & HA_HAS_OWN_BINLOGGING))
+ if (multi_write_engine &&
+ (flags_write_some_set & HA_HAS_OWN_BINLOGGING))
{
error= ER_BINLOG_LOGGING_IMPOSSIBLE;
my_error(error, MYF(0),
@@ -5257,6 +5301,16 @@ int decide_logging_format(THD *thd, TABLE_LIST *tables)
" than one engine involved and at least one engine"
" is self-logging");
}
+ /*
+ Reading from a self-logging engine and updating another engine
+ generates changes that are written to the binary log in the
+ statement format and may make slaves to diverge. In the mixed
+ mode, such changes should be written to the binary log in the
+ row format.
+ */
+ else if (multi_access_engine &&
+ (flags_access_some_set & HA_HAS_OWN_BINLOGGING))
+ thd->lex->set_stmt_unsafe();
DBUG_PRINT("info", ("error: %d", error));
@@ -5276,7 +5330,7 @@ int decide_logging_format(THD *thd, TABLE_LIST *tables)
here.
*/
if (thd->lex->is_stmt_unsafe() ||
- (flags_all_set & HA_BINLOG_STMT_CAPABLE) == 0)
+ (flags_write_all_set & HA_BINLOG_STMT_CAPABLE) == 0)
{
thd->set_current_stmt_binlog_row_based_if_mixed();
}
@@ -5384,6 +5438,8 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
DBUG_RETURN(-1);
}
+ DEBUG_SYNC(thd, "after_lock_tables_takes_lock");
+
if (thd->lex->requires_prelocking() &&
thd->lex->sql_command != SQLCOM_LOCK_TABLES)
{
@@ -8889,7 +8945,7 @@ bool is_equal(const LEX_STRING *a, const LEX_STRING *b)
/*
SYNOPSIS
- abort_and_upgrade_lock()
+ abort_and_upgrade_lock_and_close_table()
lpt Parameter passing struct
All parameters passed through the ALTER_PARTITION_PARAM_TYPE object
RETURN VALUE
@@ -8898,7 +8954,7 @@ bool is_equal(const LEX_STRING *a, const LEX_STRING *b)
Remember old lock level (for possible downgrade later on), abort all
waiting threads and ensure that all keeping locks currently are
completed such that we own the lock exclusively and no other interaction
- is ongoing.
+ is ongoing. Close the table and hold the name lock.
thd Thread object
table Table object
@@ -8907,18 +8963,26 @@ bool is_equal(const LEX_STRING *a, const LEX_STRING *b)
old_lock_level Old lock level
*/
-int abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt)
+int abort_and_upgrade_lock_and_close_table(ALTER_PARTITION_PARAM_TYPE *lpt)
{
uint flags= RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG;
- DBUG_ENTER("abort_and_upgrade_locks");
+ const char *db= lpt->db;
+ const char *table_name= lpt->table_name;
+ THD *thd= lpt->thd;
+ DBUG_ENTER("abort_and_upgrade_lock_and_close_table");
lpt->old_lock_type= lpt->table->reginfo.lock_type;
+ safe_mutex_assert_not_owner(&LOCK_open);
VOID(pthread_mutex_lock(&LOCK_open));
/* If MERGE child, forward lock handling to parent. */
- mysql_lock_abort(lpt->thd, lpt->table->parent ? lpt->table->parent :
- lpt->table, TRUE);
- VOID(remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name, flags,
- FALSE));
+ mysql_lock_abort(thd, lpt->table->parent ? lpt->table->parent : lpt->table,
+ TRUE);
+ if (remove_table_from_cache(thd, db, table_name, flags, FALSE))
+ {
+ VOID(pthread_mutex_unlock(&LOCK_open));
+ DBUG_RETURN(1);
+ }
+ close_data_files_and_morph_locks(thd, db, table_name);
VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(0);
}
diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc
index 07972d9b3e4..da582c37ae9 100644
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@ -42,9 +42,13 @@ void mysql_client_binlog_statement(THD* thd)
if (check_global_access(thd, SUPER_ACL))
DBUG_VOID_RETURN;
- size_t coded_len= thd->lex->comment.length + 1;
+ size_t coded_len= thd->lex->comment.length;
+ if (!coded_len)
+ {
+ my_error(ER_SYNTAX_ERROR, MYF(0));
+ DBUG_VOID_RETURN;
+ }
size_t decoded_len= base64_needed_decoded_length(coded_len);
- DBUG_ASSERT(coded_len > 0);
/*
Allocation
@@ -145,14 +149,16 @@ void mysql_client_binlog_statement(THD* thd)
/*
Checking that the first event in the buffer is not truncated.
*/
- ulong event_len= uint4korr(bufptr + EVENT_LEN_OFFSET);
- DBUG_PRINT("info", ("event_len=%lu, bytes_decoded=%d",
- event_len, bytes_decoded));
- if (bytes_decoded < EVENT_LEN_OFFSET || (uint) bytes_decoded < event_len)
+ ulong event_len;
+ if (bytes_decoded < EVENT_LEN_OFFSET + 4 ||
+ (event_len= uint4korr(bufptr + EVENT_LEN_OFFSET)) >
+ (uint) bytes_decoded)
{
my_error(ER_SYNTAX_ERROR, MYF(0));
goto end;
}
+ DBUG_PRINT("info", ("event_len=%lu, bytes_decoded=%d",
+ event_len, bytes_decoded));
/*
If we have not seen any Format_description_event, then we must
@@ -190,17 +196,6 @@ void mysql_client_binlog_statement(THD* thd)
bufptr += event_len;
DBUG_PRINT("info",("ev->get_type_code()=%d", ev->get_type_code()));
-#ifndef HAVE_valgrind
- /*
- This debug printout should not be used for valgrind builds
- since it will read from unassigned memory.
- */
- DBUG_PRINT("info",("bufptr+EVENT_TYPE_OFFSET: 0x%lx",
- (long) (bufptr+EVENT_TYPE_OFFSET)));
- DBUG_PRINT("info", ("bytes_decoded: %d bufptr: 0x%lx buf[EVENT_LEN_OFFSET]: %lu",
- bytes_decoded, (long) bufptr,
- (ulong) uint4korr(bufptr+EVENT_LEN_OFFSET)));
-#endif
ev->thd= thd;
/*
We go directly to the application phase, since we don't need
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index a6d783bf6f4..b4e34fc1890 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -2191,9 +2191,21 @@ bool select_export::send_data(List<Item> &items)
const char *from_end_pos;
const char *error_pos;
uint32 bytes;
- bytes= well_formed_copy_nchars(write_cs, cvt_buff, sizeof(cvt_buff),
+ uint64 estimated_bytes=
+ ((uint64) res->length() / res->charset()->mbminlen + 1) *
+ write_cs->mbmaxlen + 1;
+ set_if_smaller(estimated_bytes, UINT_MAX32);
+ if (cvt_str.realloc((uint32) estimated_bytes))
+ {
+ my_error(ER_OUTOFMEMORY, MYF(0), (uint32) estimated_bytes);
+ goto err;
+ }
+
+ bytes= well_formed_copy_nchars(write_cs, (char *) cvt_str.ptr(),
+ cvt_str.alloced_length(),
res->charset(), res->ptr(), res->length(),
- sizeof(cvt_buff),
+ UINT_MAX32, // copy all input chars,
+ // i.e. ignore nchars parameter
&well_formed_error_pos,
&cannot_convert_error_pos,
&from_end_pos);
@@ -2211,6 +2223,15 @@ bool select_export::send_data(List<Item> &items)
"string", printable_buff,
item->name, (ulong) row_count);
}
+ else if (from_end_pos < res->ptr() + res->length())
+ {
+ /*
+ result is longer than UINT_MAX32 and doesn't fit into String
+ */
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
+ item->full_name(), row_count);
+ }
cvt_str.length(bytes);
res= &cvt_str;
}
@@ -3928,7 +3949,6 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end)
if (stmt_end)
{
pending->set_flags(Rows_log_event::STMT_END_F);
- pending->flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
binlog_table_maps= 0;
}
@@ -4056,7 +4076,6 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
{
Query_log_event qinfo(this, query_arg, query_len, is_trans, suppress_use,
errcode);
- qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
/*
Binlog table maps will be irrelevant after a Query_log_event
(they are just removed on the slave side) so after the query
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 3680e28246e..2240236a0e5 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1745,8 +1745,15 @@ public:
*/
ha_rows sent_row_count;
- /*
- number of rows we read, sent or not, including in create_sort_index()
+ /**
+ Number of rows read and/or evaluated for a statement. Used for
+ slow log reporting.
+
+ An examined row is defined as a row that is read and/or evaluated
+ according to a statement condition, including in
+ create_sort_index(). Rows may be counted more than once, e.g., a
+ statement including ORDER BY could possibly evaluate the row in
+ filesort() before reading it for e.g. update.
*/
ha_rows examined_row_count;
@@ -2073,6 +2080,11 @@ public:
start_time= user_time= t;
start_utime= utime_after_lock= my_micro_time();
}
+ /*TODO: this will be obsolete when we have support for 64 bit my_time_t */
+ inline bool is_valid_time()
+ {
+ return (start_time < (time_t) MY_TIME_T_MAX);
+ }
void set_time_after_lock() { utime_after_lock= my_micro_time(); }
ulonglong current_utime() { return my_micro_time(); }
inline ulonglong found_rows(void)
@@ -3001,6 +3013,9 @@ public:
void reset();
bool walk(tree_walk_action action, void *walk_action_arg);
+ uint get_size() const { return size; }
+ ulonglong get_max_in_memory_size() const { return max_in_memory_size; }
+
friend int unique_write_to_file(uchar* key, element_count count, Unique *unique);
friend int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique);
};
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 30c6c4fc653..1c2ae915259 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -257,6 +257,7 @@ end:
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
+
/*
Check for maximum allowable user connections, if the mysqld server is
started with corresponding variable that is greater then 0.
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index b4a0e5c4c7d..1dd659283ac 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -642,6 +642,18 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
goto exit2;
}
+ /*
+ Close and mark for re-open all HANDLER tables which are marked for flush
+ or which there are pending conflicing locks against. This is needed to
+ prevent deadlocks.
+ */
+ if (thd->handler_tables_hash.records)
+ {
+ pthread_mutex_lock(&LOCK_open);
+ mysql_ha_flush(thd);
+ pthread_mutex_unlock(&LOCK_open);
+ }
+
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
/* Check directory */
@@ -788,6 +800,18 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
if ((error=wait_if_global_read_lock(thd,0,1)))
goto exit2;
+ /*
+ Close and mark for re-open all HANDLER tables which are marked for flush
+ or which there are pending conflicing locks against. This is needed to
+ prevent deadlocks.
+ */
+ if (thd->handler_tables_hash.records)
+ {
+ pthread_mutex_lock(&LOCK_open);
+ mysql_ha_flush(thd);
+ pthread_mutex_unlock(&LOCK_open);
+ }
+
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
/*
@@ -886,6 +910,18 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
goto exit2;
}
+ /*
+ Close and mark for re-open all HANDLER tables which are marked for flush
+ or which there are pending conflicing locks against. This is needed to
+ prevent deadlocks.
+ */
+ if (thd->handler_tables_hash.records)
+ {
+ pthread_mutex_lock(&LOCK_open);
+ mysql_ha_flush(thd);
+ pthread_mutex_unlock(&LOCK_open);
+ }
+
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
length= build_table_filename(path, sizeof(path) - 1, db, "", "", 0);
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index acffb9f067f..361a5db1f2c 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -33,7 +33,7 @@
*/
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
- SQL_LIST *order, ha_rows limit, ulonglong options,
+ SQL_I_List<ORDER> *order, ha_rows limit, ulonglong options,
bool reset_auto_increment)
{
bool will_batch;
@@ -84,7 +84,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (select_lex->setup_ref_array(thd, order->elements) ||
setup_order(thd, select_lex->ref_pointer_array, &tables,
- fields, all_fields, (ORDER*) order->first))
+ fields, all_fields, order->first))
{
delete select;
free_underlaid_joins(thd, &thd->lex->select_lex);
@@ -230,14 +230,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
ha_rows examined_rows;
if ((!select || table->quick_keys.is_clear_all()) && limit != HA_POS_ERROR)
- usable_index= get_index_for_order(table, (ORDER*)(order->first), limit);
+ usable_index= get_index_for_order(table, order->first, limit);
if (usable_index == MAX_KEY)
{
table->sort.io_cache= (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL));
- if (!(sortorder= make_unireg_sortorder((ORDER*) order->first,
+ if (!(sortorder= make_unireg_sortorder(order->first,
&length, NULL)) ||
(table->sort.found_records = filesort(thd, table, sortorder, length,
select, HA_POS_ERROR, 1,
@@ -248,6 +248,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
free_underlaid_joins(thd, &thd->lex->select_lex);
DBUG_RETURN(TRUE);
}
+ thd->examined_row_count+= examined_rows;
/*
Filesort has already found and selected the rows we want to delete,
so we don't need the where clause
@@ -265,7 +266,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
free_underlaid_joins(thd, select_lex);
DBUG_RETURN(TRUE);
}
- if (usable_index==MAX_KEY)
+ if (usable_index == MAX_KEY || (select && select->quick))
{
if (init_read_record(&info, thd, table, select, 1, 1, FALSE))
{
@@ -312,6 +313,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
! thd->is_error())
{
update_virtual_fields(thd, table);
+ thd->examined_row_count++;
// thd->is_error() is tested to disallow delete row on error
if (!select || select->skip_record(thd) > 0)
{
@@ -555,7 +557,7 @@ extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b)
int mysql_multi_delete_prepare(THD *thd)
{
LEX *lex= thd->lex;
- TABLE_LIST *aux_tables= (TABLE_LIST *)lex->auxiliary_table_list.first;
+ TABLE_LIST *aux_tables= lex->auxiliary_table_list.first;
TABLE_LIST *target_tbl;
DBUG_ENTER("mysql_multi_delete_prepare");
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 37adf5c403a..782589f7d0f 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -281,13 +281,13 @@ bool mysql_derived_filling(THD *thd, LEX *lex, TABLE_LIST *orig_table_list)
lex->current_select= first_select;
res= mysql_select(thd, &first_select->ref_pointer_array,
- (TABLE_LIST*) first_select->table_list.first,
+ first_select->table_list.first,
first_select->with_wild,
first_select->item_list, first_select->where,
(first_select->order_list.elements+
first_select->group_list.elements),
- (ORDER *) first_select->order_list.first,
- (ORDER *) first_select->group_list.first,
+ first_select->order_list.first,
+ first_select->group_list.first,
first_select->having, (ORDER*) NULL,
(first_select->options | thd->options |
SELECT_NO_UNLOCK),
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 61f29886da8..69be8c8e9b4 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -539,6 +539,14 @@ retry:
my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), keyname, tables->alias);
goto err;
}
+ /* Check if the same index involved. */
+ if ((uint) keyno != table->file->get_index())
+ {
+ if (mode == RNEXT)
+ mode= RFIRST;
+ else if (mode == RPREV)
+ mode= RLAST;
+ }
}
if (insert_fields(thd, &thd->lex->select_lex.context,
@@ -561,9 +569,16 @@ retry:
case RNEXT:
if (table->file->inited != handler::NONE)
{
- error=keyname ?
- table->file->ha_index_next(table->record[0]) :
- table->file->ha_rnd_next(table->record[0]);
+ if (keyname)
+ {
+ /* Check if we read from the same index. */
+ DBUG_ASSERT((uint) keyno == table->file->get_index());
+ error= table->file->ha_index_next(table->record[0]);
+ }
+ else
+ {
+ error= table->file->ha_rnd_next(table->record[0]);
+ }
break;
}
/* else fall through */
@@ -584,6 +599,8 @@ retry:
break;
case RPREV:
DBUG_ASSERT(keyname != 0);
+ /* Check if we read from the same index. */
+ DBUG_ASSERT((uint) keyno == table->file->get_index());
if (table->file->inited != handler::NONE)
{
error=table->file->ha_index_prev(table->record[0]);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index a91c9f1eb54..ea138807122 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1515,7 +1515,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
table->file->adjust_next_insert_id_after_explicit_value(
table->next_number_field->val_int());
info->touched++;
- if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ &&
+ if (((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) &&
!bitmap_is_subset(table->write_set, table->read_set)) ||
compare_record(table))
{
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index e380c94b58a..33121e5301d 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -110,39 +110,31 @@ st_parsing_options::reset()
allows_derived= TRUE;
}
-Lex_input_stream::Lex_input_stream(THD *thd,
- const char* buffer,
- unsigned int length)
-: m_thd(thd),
- yylineno(1),
- yytoklen(0),
- yylval(NULL),
- m_ptr(buffer),
- m_tok_start(NULL),
- m_tok_end(NULL),
- m_end_of_query(buffer + length),
- m_tok_start_prev(NULL),
- m_buf(buffer),
- m_buf_length(length),
- m_echo(TRUE),
- m_cpp_tok_start(NULL),
- m_cpp_tok_start_prev(NULL),
- m_cpp_tok_end(NULL),
- m_body_utf8(NULL),
- m_cpp_utf8_processed_ptr(NULL),
- next_state(MY_LEX_START),
- found_semicolon(NULL),
- ignore_space(test(thd->variables.sql_mode & MODE_IGNORE_SPACE)),
- stmt_prepare_mode(FALSE),
- in_comment(NO_COMMENT),
- m_underscore_cs(NULL)
+
+bool Lex_input_stream::init(THD *thd, const char *buff, unsigned int length)
{
+ DBUG_EXECUTE_IF("bug42064_simulate_oom",
+ DBUG_SET("+d,simulate_out_of_memory"););
+
m_cpp_buf= (char*) thd->alloc(length + 1);
+
+ DBUG_EXECUTE_IF("bug42064_simulate_oom",
+ DBUG_SET("-d,bug42064_simulate_oom"););
+
+ if (m_cpp_buf == NULL)
+ return TRUE;
+
m_cpp_ptr= m_cpp_buf;
+ m_thd= thd;
+ m_ptr= buff;
+ m_end_of_query= buff + length;
+ m_buf= buff;
+ m_buf_length= length;
+ ignore_space= test(thd->variables.sql_mode & MODE_IGNORE_SPACE);
+
+ return FALSE;
}
-Lex_input_stream::~Lex_input_stream()
-{}
/**
The operation is called from the parser in order to
@@ -1653,7 +1645,7 @@ void st_select_lex::init_select()
linkage= UNSPECIFIED_TYPE;
order_list.elements= 0;
order_list.first= 0;
- order_list.next= (uchar**) &order_list.first;
+ order_list.next= &order_list.first;
/* Set limit and offset to default values */
select_limit= 0; /* denotes the default limit = HA_POS_ERROR */
offset_limit= 0; /* denotes the default offset = 0 */
@@ -1984,7 +1976,7 @@ uint st_select_lex::get_in_sum_expr()
TABLE_LIST* st_select_lex::get_table_list()
{
- return (TABLE_LIST*) table_list.first;
+ return table_list.first;
}
List<Item>* st_select_lex::get_item_list()
@@ -2041,9 +2033,8 @@ void st_select_lex_unit::print(String *str, enum_query_type query_type)
if (fake_select_lex->order_list.elements)
{
str->append(STRING_WITH_LEN(" order by "));
- fake_select_lex->print_order(
- str,
- (ORDER *) fake_select_lex->order_list.first,
+ fake_select_lex->print_order(str,
+ fake_select_lex->order_list.first,
query_type);
}
fake_select_lex->print_limit(thd, str, query_type);
@@ -2688,7 +2679,7 @@ TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local)
{
select_lex.context.table_list=
select_lex.context.first_name_resolution_table= first->next_local;
- select_lex.table_list.first= (uchar*) (first->next_local);
+ select_lex.table_list.first= first->next_local;
select_lex.table_list.elements--; //safety
first->next_local= 0;
/*
@@ -2720,7 +2711,7 @@ TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local)
void st_lex::first_lists_tables_same()
{
- TABLE_LIST *first_table= (TABLE_LIST*) select_lex.table_list.first;
+ TABLE_LIST *first_table= select_lex.table_list.first;
if (query_tables != first_table && first_table != 0)
{
TABLE_LIST *next;
@@ -2767,9 +2758,9 @@ void st_lex::link_first_table_back(TABLE_LIST *first,
if (link_to_local)
{
- first->next_local= (TABLE_LIST*) select_lex.table_list.first;
+ first->next_local= select_lex.table_list.first;
select_lex.context.table_list= first;
- select_lex.table_list.first= (uchar*) first;
+ select_lex.table_list.first= first;
select_lex.table_list.elements++; //safety
}
}
@@ -2935,7 +2926,7 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds,
prep_having= *having_conds;
*having_conds= having= prep_having->copy_andor_structure(thd);
}
- fix_prepare_info_in_table_list(thd, (TABLE_LIST *)table_list.first);
+ fix_prepare_info_in_table_list(thd, table_list.first);
}
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index b571d7d707a..2f14f3eb575 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -596,8 +596,8 @@ public:
st_lex *parent_lex;
enum olap_type olap;
/* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */
- SQL_LIST table_list;
- SQL_LIST group_list; /* GROUP BY clause. */
+ SQL_I_List<TABLE_LIST> table_list;
+ SQL_I_List<ORDER> group_list; /* GROUP BY clause. */
List<Item> item_list; /* list of fields & expressions */
List<String> interval_list;
bool is_item_list_lookup;
@@ -619,8 +619,8 @@ public:
TABLE_LIST *leaf_tables;
const char *type; /* type of select for EXPLAIN */
- SQL_LIST order_list; /* ORDER clause */
- SQL_LIST *gorder_list;
+ SQL_I_List<ORDER> order_list; /* ORDER clause */
+ SQL_I_List<ORDER> *gorder_list;
Item *select_limit, *offset_limit; /* LIMIT clause parameters */
// Arrays of pointers to top elements of all_fields list
Item **ref_pointer_array;
@@ -782,7 +782,7 @@ public:
{
order_list.elements= 0;
order_list.first= 0;
- order_list.next= (uchar**) &order_list.first;
+ order_list.next= &order_list.first;
}
/*
This method created for reiniting LEX in mysql_admin_table() and can be
@@ -963,6 +963,8 @@ enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE,
extern const LEX_STRING null_lex_str;
extern const LEX_STRING empty_lex_str;
+struct Sroutine_hash_entry;
+
/*
Class representing list of all tables used by statement.
It also contains information about stored functions used by statement
@@ -1003,9 +1005,9 @@ public:
We use these two members for restoring of 'sroutines_list' to the state
in which it was right after query parsing.
*/
- SQL_LIST sroutines_list;
- uchar **sroutines_list_own_last;
- uint sroutines_list_own_elements;
+ SQL_I_List<Sroutine_hash_entry> sroutines_list;
+ Sroutine_hash_entry **sroutines_list_own_last;
+ uint sroutines_list_own_elements;
/*
These constructor and destructor serve for creation/destruction
@@ -1157,10 +1159,39 @@ enum enum_comment_state
class Lex_input_stream
{
public:
- Lex_input_stream(THD *thd, const char* buff, unsigned int length);
- ~Lex_input_stream();
+ Lex_input_stream() :
+ yylineno(1),
+ yytoklen(0),
+ yylval(NULL),
+ m_tok_start(NULL),
+ m_tok_end(NULL),
+ m_tok_start_prev(NULL),
+ m_echo(TRUE),
+ m_cpp_tok_start(NULL),
+ m_cpp_tok_start_prev(NULL),
+ m_cpp_tok_end(NULL),
+ m_body_utf8(NULL),
+ m_cpp_utf8_processed_ptr(NULL),
+ next_state(MY_LEX_START),
+ found_semicolon(NULL),
+ stmt_prepare_mode(FALSE),
+ in_comment(NO_COMMENT),
+ m_underscore_cs(NULL)
+ {
+ }
+
+ ~Lex_input_stream()
+ {
+ }
/**
+ Object initializer. Must be called before usage.
+
+ @retval FALSE OK
+ @retval TRUE Error
+ */
+ bool init(THD *thd, const char *buff, unsigned int length);
+ /**
Set the echo mode.
When echo is true, characters parsed from the raw input stream are
@@ -1610,7 +1641,8 @@ typedef struct st_lex : public Query_tables_list
*/
List<Name_resolution_context> context_stack;
- SQL_LIST proc_list, auxiliary_table_list, save_list;
+ SQL_I_List<ORDER> proc_list;
+ SQL_I_List<TABLE_LIST> auxiliary_table_list, save_list;
Create_field *last_field;
Item_sum *in_sum_func;
udf_func udf;
@@ -1740,7 +1772,7 @@ typedef struct st_lex : public Query_tables_list
fields to TABLE object at table open (altough for latter pointer to table
being opened is probably enough).
*/
- SQL_LIST trg_table_fields;
+ SQL_I_List<Item_trigger_field> trg_table_fields;
/*
stmt_definition_begin is intended to point to the next word after
@@ -1954,10 +1986,21 @@ public:
class Parser_state
{
public:
- Parser_state(THD *thd, const char* buff, unsigned int length)
- : m_lip(thd, buff, length), m_yacc()
+ Parser_state()
+ : m_yacc()
{}
+ /**
+ Object initializer. Must be called before usage.
+
+ @retval FALSE OK
+ @retval TRUE Error
+ */
+ bool init(THD *thd, const char *buff, unsigned int length)
+ {
+ return m_lip.init(thd, buff, length);
+ }
+
~Parser_state()
{}
diff --git a/sql/sql_list.h b/sql/sql_list.h
index 93cdd20c299..15eb85ab52c 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -55,6 +55,73 @@ public:
};
+/**
+ Simple intrusive linked list.
+
+ @remark Similar in nature to base_list, but intrusive. It keeps a
+ a pointer to the first element in the list and a indirect
+ reference to the last element.
+*/
+template <typename T>
+class SQL_I_List :public Sql_alloc
+{
+public:
+ uint elements;
+ /** The first element in the list. */
+ T *first;
+ /** A reference to the next element in the list. */
+ T **next;
+
+ SQL_I_List() { empty(); }
+
+ SQL_I_List(const SQL_I_List &tmp) :Sql_alloc()
+ {
+ elements= tmp.elements;
+ first= tmp.first;
+ next= elements ? tmp.next : &first;
+ }
+
+ inline void empty()
+ {
+ elements= 0;
+ first= NULL;
+ next= &first;
+ }
+
+ inline void link_in_list(T *element, T **next_ptr)
+ {
+ elements++;
+ (*next)= element;
+ next= next_ptr;
+ *next= NULL;
+ }
+
+ inline void save_and_clear(SQL_I_List<T> *save)
+ {
+ *save= *this;
+ empty();
+ }
+
+ inline void push_front(SQL_I_List<T> *save)
+ {
+ /* link current list last */
+ *save->next= first;
+ first= save->first;
+ elements+= save->elements;
+ }
+
+ inline void push_back(SQL_I_List<T> *save)
+ {
+ if (save->first)
+ {
+ *next= save->first;
+ next= save->next;
+ elements+= save->elements;
+ }
+ }
+};
+
+
/*
Basic single linked list
Used for item and item_buffs.
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index e5ef7bed5e0..d0506d75925 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -511,7 +511,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
else
{
Delete_file_log_event d(thd, db, transactional_table);
- d.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
(void) mysql_bin_log.write(&d);
}
}
@@ -691,7 +690,6 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
(duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :
(ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR),
transactional_table, FALSE, errcode);
- e.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
return mysql_bin_log.write(&e);
}
@@ -929,6 +927,10 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
DBUG_RETURN(1);
}
}
+
+ if (thd->is_error())
+ read_info.error= 1;
+
if (read_info.error)
break;
if (skip_lines)
@@ -1052,7 +1054,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
String &field_term, String &line_start, String &line_term,
String &enclosed_par, int escape, bool get_it_from_net,
bool is_fifo)
- :file(file_par),escape_char(escape)
+ :file(file_par),buffer(0),escape_char(escape)
{
read_charset= cs;
field_term_ptr=(char*) field_term.ptr();
@@ -1101,6 +1103,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
MYF(MY_WME)))
{
my_free((uchar*) buffer,MYF(0)); /* purecov: inspected */
+ buffer= 0;
error=1;
}
else
@@ -1131,9 +1134,8 @@ READ_INFO::~READ_INFO()
{
if (need_end_io_cache)
::end_io_cache(&cache);
- my_free((uchar*) buffer,MYF(0));
- error=1;
}
+ my_free((uchar*) buffer,MYF(MY_ALLOW_ZERO_PTR));
}
diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc
index dccfcbaf8ac..21deef8c664 100644
--- a/sql/sql_olap.cc
+++ b/sql/sql_olap.cc
@@ -146,14 +146,14 @@ int handle_olaps(LEX *lex, SELECT_LEX *select_lex)
lex->last_selects=select_lex;
- for (ORDER *order=(ORDER *)select_lex->group_list.first ; order ; order=order->next)
+ for (ORDER *order= select_lex->group_list.first ; order ; order=order->next)
item_list_copy.push_back(*(order->item));
List<Item> all_fields(select_lex->item_list);
if (setup_tables(lex->thd, &select_lex->context, &select_lex->top_join_list,
- (TABLE_LIST *)select_lex->table_list.first
+ select_lex->table_list.first
&select_lex->leaf_tables, FALSE) ||
setup_fields(lex->thd, 0, select_lex->item_list, MARK_COLUMNS_READ,
&all_fields,1) ||
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 0986a165c7a..af66c9447b0 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -658,7 +658,7 @@ void cleanup_items(Item *item)
*/
static
-int mysql_table_dump(THD *thd, LEX_STRING *db, char *tbl_name)
+int mysql_table_dump(THD *thd, LEX_STRING *db, LEX_STRING *table_name)
{
TABLE* table;
TABLE_LIST* table_list;
@@ -672,7 +672,7 @@ int mysql_table_dump(THD *thd, LEX_STRING *db, char *tbl_name)
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->table_name= table_list->alias= table_name->str;
table_list->lock_type= TL_READ_NO_INSERT;
table_list->prev_global= &table_list; // can be removed after merge with 4.1
@@ -683,8 +683,16 @@ int mysql_table_dump(THD *thd, LEX_STRING *db, char *tbl_name)
goto err;
/* purecov: end */
}
+ if (!table_name->length ||
+ check_table_name(table_name->str, table_name->length, TRUE))
+ {
+ my_error(ER_WRONG_TABLE_NAME, MYF(0),
+ table_name->str ? table_name->str : "NULL");
+ error= 1;
+ goto err;
+ }
if (lower_case_table_names)
- my_casedn_str(files_charset_info, tbl_name);
+ my_casedn_str(files_charset_info, table_name->str);
if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT, 0)))
DBUG_RETURN(1);
@@ -692,7 +700,7 @@ int mysql_table_dump(THD *thd, LEX_STRING *db, char *tbl_name)
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));
+ thd->set_query(table_name->str, table_name->length);
if ((error = mysqld_dump_create_info(thd, table_list, -1)))
{
my_error(ER_GET_ERRNO, MYF(0), my_errno);
@@ -1003,6 +1011,19 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->query_plan_flags= QPLAN_INIT;
thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
thd->set_time();
+ if (!thd->is_valid_time())
+ {
+ /*
+ If the time has got past 2038 we need to shut this server down
+ We do this by making sure every command is a shutdown and we
+ have enough privileges to shut the server down
+
+ TODO: remove this when we have full 64 bit my_time_t support
+ */
+ thd->security_ctx->master_access|= SHUTDOWN_ACL;
+ command= COM_SHUTDOWN;
+ }
+
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id= global_query_id;
@@ -1056,8 +1077,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#endif
case COM_TABLE_DUMP:
{
- char *tbl_name;
- LEX_STRING db;
+ LEX_STRING db, table;
/* 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)
@@ -1083,9 +1103,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
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)
+ table.length= tbl_len;
+ table.str= strmake(db.str, packet + 1, db_len) + 1;
+ strmake(table.str, packet + db_len + 2, tbl_len);
+ if (mysql_table_dump(thd, &db, &table) == 0)
thd->main_da.disable_status();
break;
}
@@ -1304,8 +1325,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
mysql_reset_thd_for_next_command(thd, opt_userstat_running);
thd->lex->
- select_lex.table_list.link_in_list((uchar*) &table_list,
- (uchar**) &table_list.next_local);
+ select_lex.table_list.link_in_list(&table_list,
+ &table_list.next_local);
thd->lex->add_to_query_tables(&table_list);
/* switch on VIEW optimisation: do not fill temporary tables */
@@ -1447,8 +1468,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
SHUTDOWN_DEFAULT is 0. If client is >= 4.1.3, the shutdown level is in
packet[0].
*/
- enum mysql_enum_shutdown_level level=
- (enum mysql_enum_shutdown_level) (uchar) packet[0];
+ enum mysql_enum_shutdown_level level;
+ if (!thd->is_valid_time())
+ level= SHUTDOWN_DEFAULT;
+ else
+ level= (enum mysql_enum_shutdown_level) (uchar) packet[0];
if (level == SHUTDOWN_DEFAULT)
level= SHUTDOWN_WAIT_ALL_BUFFERS; // soon default will be configurable
else if (level != SHUTDOWN_WAIT_ALL_BUFFERS)
@@ -1818,7 +1842,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
{
DBUG_RETURN(1);
}
- TABLE_LIST *table_list= (TABLE_LIST*) select_lex->table_list.first;
+ TABLE_LIST *table_list= select_lex->table_list.first;
table_list->schema_select_lex= schema_select_lex;
table_list->schema_table_reformed= 1;
DBUG_RETURN(0);
@@ -2014,7 +2038,7 @@ mysql_execute_command(THD *thd)
/* first SELECT_LEX (have special meaning for many of non-SELECTcommands) */
SELECT_LEX *select_lex= &lex->select_lex;
/* first table of first SELECT_LEX */
- TABLE_LIST *first_table= (TABLE_LIST*) select_lex->table_list.first;
+ TABLE_LIST *first_table= select_lex->table_list.first;
/* list of all tables in query */
TABLE_LIST *all_tables;
/* most outer SELECT_LEX_UNIT of query */
@@ -2049,7 +2073,7 @@ mysql_execute_command(THD *thd)
all_tables= lex->query_tables;
/* set context for commands which do not use setup_tables */
select_lex->
- context.resolve_in_table_list_only((TABLE_LIST*)select_lex->
+ context.resolve_in_table_list_only(select_lex->
table_list.first);
/*
@@ -2395,7 +2419,7 @@ mysql_execute_command(THD *thd)
thd->enable_slow_log= opt_log_slow_admin_statements;
thd->query_plan_flags|= QPLAN_ADMIN;
res = mysql_backup_table(thd, first_table);
- select_lex->table_list.first= (uchar*) first_table;
+ select_lex->table_list.first= first_table;
lex->query_tables=all_tables;
break;
}
@@ -2408,7 +2432,7 @@ mysql_execute_command(THD *thd)
thd->enable_slow_log= opt_log_slow_admin_statements;
thd->query_plan_flags|= QPLAN_ADMIN;
res = mysql_restore_table(thd, first_table);
- select_lex->table_list.first= (uchar*) first_table;
+ select_lex->table_list.first= first_table;
lex->query_tables=all_tables;
break;
}
@@ -2702,7 +2726,7 @@ mysql_execute_command(THD *thd)
if (create_info.used_fields & HA_CREATE_USED_UNION)
{
TABLE_LIST *tab;
- for (tab= (TABLE_LIST*) create_info.merge_list.first;
+ for (tab= create_info.merge_list.first;
tab;
tab= tab->next_local)
{
@@ -2716,6 +2740,10 @@ mysql_execute_command(THD *thd)
}
}
+ /* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
+ if (create_info.options & HA_LEX_CREATE_TMP_TABLE)
+ thd->options|= OPTION_KEEP_LOG;
+
/*
select_create is currently not re-execution friendly and
needs to be created for every execution of a PS/SP.
@@ -2875,7 +2903,6 @@ end_with_restore_list:
check_access(thd,INSERT_ACL | CREATE_ACL,select_lex->db,&priv,0,0,
is_schema_db(select_lex->db))||
check_merge_table_access(thd, first_table->db,
- (TABLE_LIST *)
create_info.merge_list.first))
goto error; /* purecov: inspected */
if (check_grant(thd, priv_needed, all_tables, 0, UINT_MAX, 0))
@@ -3012,7 +3039,7 @@ end_with_restore_list:
*/
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
- select_lex->table_list.first= (uchar*) first_table;
+ select_lex->table_list.first= first_table;
lex->query_tables=all_tables;
break;
}
@@ -3025,7 +3052,7 @@ end_with_restore_list:
thd->enable_slow_log= opt_log_slow_admin_statements;
thd->query_plan_flags|= QPLAN_ADMIN;
res = mysql_check_table(thd, first_table, &lex->check_opt);
- select_lex->table_list.first= (uchar*) first_table;
+ select_lex->table_list.first= first_table;
lex->query_tables=all_tables;
break;
}
@@ -3046,7 +3073,7 @@ end_with_restore_list:
*/
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
- select_lex->table_list.first= (uchar*) first_table;
+ select_lex->table_list.first= first_table;
lex->query_tables=all_tables;
break;
}
@@ -3070,7 +3097,7 @@ end_with_restore_list:
*/
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
}
- select_lex->table_list.first= (uchar*) first_table;
+ select_lex->table_list.first= first_table;
lex->query_tables=all_tables;
break;
}
@@ -3088,7 +3115,7 @@ end_with_restore_list:
lex->value_list,
select_lex->where,
select_lex->order_list.elements,
- (ORDER *) select_lex->order_list.first,
+ select_lex->order_list.first,
unit->select_limit_cnt,
lex->duplicates, lex->ignore));
/* mysql_update return 2 if we need to switch to multi-update */
@@ -3248,7 +3275,7 @@ end_with_restore_list:
{
/* Skip first table, which is the table we are inserting in */
TABLE_LIST *second_table= first_table->next_local;
- select_lex->table_list.first= (uchar*) second_table;
+ select_lex->table_list.first= second_table;
select_lex->context.table_list=
select_lex->context.first_name_resolution_table= second_table;
res= mysql_insert_select_prepare(thd);
@@ -3279,7 +3306,7 @@ end_with_restore_list:
delete sel_result;
}
/* revert changes for SP */
- select_lex->table_list.first= (uchar*) first_table;
+ select_lex->table_list.first= first_table;
}
/*
@@ -3341,8 +3368,7 @@ end_with_restore_list:
case SQLCOM_DELETE_MULTI:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
- TABLE_LIST *aux_tables=
- (TABLE_LIST *)thd->lex->auxiliary_table_list.first;
+ TABLE_LIST *aux_tables= thd->lex->auxiliary_table_list.first;
multi_delete *del_result;
if (!thd->locked_tables &&
@@ -5362,7 +5388,7 @@ static bool check_show_access(THD *thd, TABLE_LIST *table)
case SCH_STATISTICS:
{
TABLE_LIST *dst_table;
- dst_table= (TABLE_LIST *) table->schema_select_lex->table_list.first;
+ dst_table= table->schema_select_lex->table_list.first;
DBUG_ASSERT(dst_table);
@@ -5982,10 +6008,15 @@ void mysql_parse(THD *thd, const char *inBuf, uint length,
sp_cache_flush_obsolete(&thd->sp_proc_cache);
sp_cache_flush_obsolete(&thd->sp_func_cache);
- Parser_state parser_state(thd, inBuf, length);
-
- bool err= parse_sql(thd, & parser_state, NULL);
- *found_semicolon= parser_state.m_lip.found_semicolon;
+ Parser_state parser_state;
+ bool err;
+ if (!(err= parser_state.init(thd, inBuf, length)))
+ {
+ err= parse_sql(thd, & parser_state, NULL);
+ *found_semicolon= parser_state.m_lip.found_semicolon;
+ }
+ else
+ *found_semicolon= NULL;
if (!err)
{
@@ -6072,14 +6103,17 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
bool error= 0;
DBUG_ENTER("mysql_test_parse_for_slave");
- Parser_state parser_state(thd, inBuf, length);
- lex_start(thd);
- mysql_reset_thd_for_next_command(thd, 0);
+ Parser_state parser_state;
+ if (!(error= parser_state.init(thd, inBuf, length)))
+ {
+ lex_start(thd);
+ mysql_reset_thd_for_next_command(thd, opt_userstat_running);
- if (!parse_sql(thd, & parser_state, NULL) &&
- all_tables_not_ok(thd,(TABLE_LIST*) lex->select_lex.table_list.first))
- error= 1; /* Ignore question */
- thd->end_statement();
+ if (!parse_sql(thd, & parser_state, NULL) &&
+ all_tables_not_ok(thd, lex->select_lex.table_list.first))
+ error= 1; /* Ignore question */
+ thd->end_statement();
+ }
thd->cleanup_after_query();
DBUG_RETURN(error);
}
@@ -6218,7 +6252,7 @@ add_proc_to_list(THD* thd, Item *item)
*item_ptr= item;
order->item=item_ptr;
order->free_me=0;
- thd->lex->proc_list.link_in_list((uchar*) order,(uchar**) &order->next);
+ thd->lex->proc_list.link_in_list(order, &order->next);
return 0;
}
@@ -6227,7 +6261,7 @@ add_proc_to_list(THD* thd, Item *item)
save order by and tables in own lists.
*/
-bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc)
+bool add_to_list(THD *thd, SQL_I_List<ORDER> &list, Item *item,bool asc)
{
ORDER *order;
DBUG_ENTER("add_to_list");
@@ -6239,7 +6273,7 @@ bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc)
order->free_me=0;
order->used=0;
order->counter_used= 0;
- list.link_in_list((uchar*) order,(uchar**) &order->next);
+ list.link_in_list(order, &order->next);
DBUG_RETURN(0);
}
@@ -6353,7 +6387,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
/* check that used name is unique */
if (lock_type != TL_IGNORE)
{
- TABLE_LIST *first_table= (TABLE_LIST*) table_list.first;
+ TABLE_LIST *first_table= table_list.first;
if (lex->sql_command == SQLCOM_CREATE_VIEW)
first_table= first_table ? first_table->next_local : NULL;
for (TABLE_LIST *tables= first_table ;
@@ -6395,7 +6429,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
previous table reference to 'ptr'. Here we also add one element to the
list 'table_list'.
*/
- table_list.link_in_list((uchar*) ptr, (uchar**) &ptr->next_local);
+ table_list.link_in_list(ptr, &ptr->next_local);
ptr->next_name_resolution_table= NULL;
/* Link table in global list (all used tables) */
lex->add_to_query_tables(ptr);
@@ -6628,7 +6662,7 @@ void st_select_lex::set_lock_for_tables(thr_lock_type lock_type)
DBUG_ENTER("set_lock_for_tables");
DBUG_PRINT("enter", ("lock_type: %d for_update: %d", lock_type,
for_update));
- for (TABLE_LIST *tables= (TABLE_LIST*) table_list.first;
+ for (TABLE_LIST *tables= table_list.first;
tables;
tables= tables->next_local)
{
@@ -7355,8 +7389,7 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables)
bool multi_delete_precheck(THD *thd, TABLE_LIST *tables)
{
SELECT_LEX *select_lex= &thd->lex->select_lex;
- TABLE_LIST *aux_tables=
- (TABLE_LIST *)thd->lex->auxiliary_table_list.first;
+ TABLE_LIST *aux_tables= thd->lex->auxiliary_table_list.first;
TABLE_LIST **save_query_tables_own_last= thd->lex->query_tables_own_last;
DBUG_ENTER("multi_delete_precheck");
@@ -7402,13 +7435,13 @@ bool multi_delete_precheck(THD *thd, TABLE_LIST *tables)
bool multi_delete_set_locks_and_link_aux_tables(LEX *lex)
{
- TABLE_LIST *tables= (TABLE_LIST*)lex->select_lex.table_list.first;
+ TABLE_LIST *tables= lex->select_lex.table_list.first;
TABLE_LIST *target_tbl;
DBUG_ENTER("multi_delete_set_locks_and_link_aux_tables");
lex->table_count= 0;
- for (target_tbl= (TABLE_LIST *)lex->auxiliary_table_list.first;
+ for (target_tbl= lex->auxiliary_table_list.first;
target_tbl; target_tbl= target_tbl->next_local)
{
lex->table_count++;
@@ -7578,8 +7611,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
&create_table->grant.privilege, 0, 0,
test(create_table->schema_table)) ||
check_merge_table_access(thd, create_table->db,
- (TABLE_LIST *)
- lex->create_info.merge_list.first))
+ lex->create_info.merge_list.first))
goto err;
if (want_priv != CREATE_TMP_ACL &&
check_grant(thd, want_priv, create_table, 0, 1, 0))
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 65a58ba2f5a..3dae2d1e8b4 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -3893,7 +3893,9 @@ bool mysql_unpack_partition(THD *thd,
thd->lex= &lex;
thd->variables.character_set_client= system_charset_info;
- Parser_state parser_state(thd, part_buf, part_info_len);
+ Parser_state parser_state;
+ if (parser_state.init(thd, part_buf, part_info_len))
+ goto end;
lex_start(thd);
*work_part_info_used= false;
@@ -5956,32 +5958,6 @@ static void alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt)
}
}
-/*
- Unlock and close table before renaming and dropping partitions
- SYNOPSIS
- alter_close_tables()
- lpt Struct carrying parameters
- RETURN VALUES
- 0
-*/
-
-static int alter_close_tables(ALTER_PARTITION_PARAM_TYPE *lpt)
-{
- THD *thd= lpt->thd;
- const char *db= lpt->db;
- const char *table_name= lpt->table_name;
- DBUG_ENTER("alter_close_tables");
- /*
- We need to also unlock tables and close all handlers.
- We set lock to zero to ensure we don't do this twice
- and we set db_stat to zero to ensure we don't close twice.
- */
- pthread_mutex_lock(&LOCK_open);
- close_data_files_and_morph_locks(thd, db, table_name);
- pthread_mutex_unlock(&LOCK_open);
- DBUG_RETURN(0);
-}
-
/*
Handle errors for ALTER TABLE for partitioning
@@ -6279,9 +6255,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
write_log_drop_partition(lpt) ||
ERROR_INJECT_CRASH("crash_drop_partition_3") ||
(not_completed= FALSE) ||
- abort_and_upgrade_lock(lpt) || /* Always returns 0 */
- ERROR_INJECT_CRASH("crash_drop_partition_4") ||
- alter_close_tables(lpt) ||
+ abort_and_upgrade_lock_and_close_table(lpt) ||
ERROR_INJECT_CRASH("crash_drop_partition_5") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
@@ -6346,9 +6320,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
ERROR_INJECT_CRASH("crash_add_partition_2") ||
mysql_change_partitions(lpt) ||
ERROR_INJECT_CRASH("crash_add_partition_3") ||
- abort_and_upgrade_lock(lpt) || /* Always returns 0 */
- ERROR_INJECT_CRASH("crash_add_partition_4") ||
- alter_close_tables(lpt) ||
+ abort_and_upgrade_lock_and_close_table(lpt) ||
ERROR_INJECT_CRASH("crash_add_partition_5") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
@@ -6436,9 +6408,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
write_log_final_change_partition(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_4") ||
(not_completed= FALSE) ||
- abort_and_upgrade_lock(lpt) || /* Always returns 0 */
- ERROR_INJECT_CRASH("crash_change_partition_5") ||
- alter_close_tables(lpt) ||
+ abort_and_upgrade_lock_and_close_table(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_6") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 7c5bbf60b53..c80cc55df4c 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -2140,10 +2140,6 @@ typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_uint_t, uint);
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulong_t, ulong);
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulonglong_t, ulonglong);
-#define SET_PLUGIN_VAR_RESOLVE(opt)\
- *(mysql_sys_var_ptr_p*)&((opt)->resolve)= mysql_sys_var_ptr
-typedef uchar *(*mysql_sys_var_ptr_p)(void* a_thd, int offset);
-
/****************************************************************************
default variable data check and update functions
@@ -2672,11 +2668,49 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
return (uchar*)thd->variables.dynamic_variables_ptr + offset;
}
-static uchar *mysql_sys_var_ptr(void* a_thd, int offset)
+
+/**
+ For correctness and simplicity's sake, a pointer to a function
+ must be compatible with pointed-to type, that is, the return and
+ parameters types must be the same. Thus, a callback function is
+ defined for each scalar type. The functions are assigned in
+ construct_options to their respective types.
+*/
+
+static char *mysql_sys_var_char(THD* thd, int offset)
+{
+ return (char *) intern_sys_var_ptr(thd, offset, true);
+}
+
+static int *mysql_sys_var_int(THD* thd, int offset)
+{
+ return (int *) intern_sys_var_ptr(thd, offset, true);
+}
+
+static long *mysql_sys_var_long(THD* thd, int offset)
{
- return intern_sys_var_ptr((THD *)a_thd, offset, true);
+ return (long *) intern_sys_var_ptr(thd, offset, true);
}
+static unsigned long *mysql_sys_var_ulong(THD* thd, int offset)
+{
+ return (unsigned long *) intern_sys_var_ptr(thd, offset, true);
+}
+
+static long long *mysql_sys_var_longlong(THD* thd, int offset)
+{
+ return (long long *) intern_sys_var_ptr(thd, offset, true);
+}
+
+static unsigned long long *mysql_sys_var_ulonglong(THD* thd, int offset)
+{
+ return (unsigned long long *) intern_sys_var_ptr(thd, offset, true);
+}
+
+static char **mysql_sys_var_str(THD* thd, int offset)
+{
+ return (char **) intern_sys_var_ptr(thd, offset, true);
+}
void plugin_thdvar_init(THD *thd)
{
@@ -3247,25 +3281,25 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
continue;
switch (opt->flags & PLUGIN_VAR_TYPEMASK) {
case PLUGIN_VAR_BOOL:
- SET_PLUGIN_VAR_RESOLVE((thdvar_bool_t *) opt);
+ ((thdvar_bool_t *) opt)->resolve= mysql_sys_var_char;
break;
case PLUGIN_VAR_INT:
- SET_PLUGIN_VAR_RESOLVE((thdvar_int_t *) opt);
+ ((thdvar_int_t *) opt)->resolve= mysql_sys_var_int;
break;
case PLUGIN_VAR_LONG:
- SET_PLUGIN_VAR_RESOLVE((thdvar_long_t *) opt);
+ ((thdvar_long_t *) opt)->resolve= mysql_sys_var_long;
break;
case PLUGIN_VAR_LONGLONG:
- SET_PLUGIN_VAR_RESOLVE((thdvar_longlong_t *) opt);
+ ((thdvar_longlong_t *) opt)->resolve= mysql_sys_var_longlong;
break;
case PLUGIN_VAR_STR:
- SET_PLUGIN_VAR_RESOLVE((thdvar_str_t *) opt);
+ ((thdvar_str_t *) opt)->resolve= mysql_sys_var_str;
break;
case PLUGIN_VAR_ENUM:
- SET_PLUGIN_VAR_RESOLVE((thdvar_enum_t *) opt);
+ ((thdvar_enum_t *) opt)->resolve= mysql_sys_var_ulong;
break;
case PLUGIN_VAR_SET:
- SET_PLUGIN_VAR_RESOLVE((thdvar_set_t *) opt);
+ ((thdvar_set_t *) opt)->resolve= mysql_sys_var_ulonglong;
break;
default:
sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index e4940204386..600c140c776 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -702,6 +702,19 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
}
#ifndef EMBEDDED_LIBRARY
+
+/**
+ Check whether this parameter data type is compatible with long data.
+ Used to detect whether a long data stream has been supplied to a
+ incompatible data type.
+*/
+inline bool is_param_long_data_type(Item_param *param)
+{
+ return ((param->param_type >= MYSQL_TYPE_TINY_BLOB) &&
+ (param->param_type <= MYSQL_TYPE_STRING));
+}
+
+
/**
Routines to assign parameters from data supplied by the client.
@@ -771,6 +784,14 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
DBUG_RETURN(1);
}
}
+ /*
+ A long data stream was supplied for this parameter marker.
+ This was done after prepare, prior to providing a placeholder
+ type (the types are supplied at execute). Check that the
+ supplied type of placeholder can accept a data stream.
+ */
+ else if (!is_param_long_data_type(param))
+ DBUG_RETURN(1);
res= param->query_val_str(&str);
if (param->convert_str_value(thd))
DBUG_RETURN(1); /* out of memory */
@@ -809,6 +830,14 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array,
DBUG_RETURN(1);
}
}
+ /*
+ A long data stream was supplied for this parameter marker.
+ This was done after prepare, prior to providing a placeholder
+ type (the types are supplied at execute). Check that the
+ supplied type of placeholder can accept a data stream.
+ */
+ else if (is_param_long_data_type(param))
+ DBUG_RETURN(1);
if (param->convert_str_value(stmt->thd))
DBUG_RETURN(1); /* out of memory */
}
@@ -1242,7 +1271,7 @@ static int mysql_test_update(Prepared_statement *stmt,
if (mysql_prepare_update(thd, table_list, &select->where,
select->order_list.elements,
- (ORDER *) select->order_list.first))
+ select->order_list.first))
goto error;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -1750,11 +1779,10 @@ error:
static int mysql_insert_select_prepare_tester(THD *thd)
{
SELECT_LEX *first_select= &thd->lex->select_lex;
- TABLE_LIST *second_table= ((TABLE_LIST*)first_select->table_list.first)->
- next_local;
+ TABLE_LIST *second_table= first_select->table_list.first->next_local;
/* Skip first table, which is the table we are inserting in */
- first_select->table_list.first= (uchar *) second_table;
+ first_select->table_list.first= second_table;
thd->lex->select_lex.context.table_list=
thd->lex->select_lex.context.first_name_resolution_table= second_table;
@@ -1791,7 +1819,7 @@ static bool mysql_test_insert_select(Prepared_statement *stmt,
return 1;
/* store it, because mysql_insert_select_prepare_tester change it */
- first_local_table= (TABLE_LIST *)lex->select_lex.table_list.first;
+ first_local_table= lex->select_lex.table_list.first;
DBUG_ASSERT(first_local_table != 0);
res=
@@ -1799,7 +1827,7 @@ static bool mysql_test_insert_select(Prepared_statement *stmt,
&mysql_insert_select_prepare_tester,
OPTION_SETUP_TABLES_DONE);
/* revert changes made by mysql_insert_select_prepare_tester */
- lex->select_lex.table_list.first= (uchar*) first_local_table;
+ lex->select_lex.table_list.first= first_local_table;
return res;
}
@@ -2343,10 +2371,10 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
DBUG_ASSERT(sl->join == 0);
ORDER *order;
/* Fix GROUP list */
- for (order= (ORDER *)sl->group_list.first; order; order= order->next)
+ for (order= sl->group_list.first; order; order= order->next)
order->item= &order->item_ptr;
/* Fix ORDER list */
- for (order= (ORDER *)sl->order_list.first; order; order= order->next)
+ for (order= sl->order_list.first; order; order= order->next)
order->item= &order->item_ptr;
/* clear the no_error flag for INSERT/UPDATE IGNORE */
@@ -2383,7 +2411,7 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
(multi-delete). We do a full clean up, although at the moment all we
need to clean in the tables of MULTI-DELETE list is 'table' member.
*/
- for (TABLE_LIST *tables= (TABLE_LIST*) lex->auxiliary_table_list.first;
+ for (TABLE_LIST *tables= lex->auxiliary_table_list.first;
tables;
tables= tables->next_global)
{
@@ -3038,13 +3066,21 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
old_stmt_arena= thd->stmt_arena;
thd->stmt_arena= this;
- Parser_state parser_state(thd, thd->query(), thd->query_length());
+ Parser_state parser_state;
+ if (parser_state.init(thd, thd->query(), thd->query_length()))
+ {
+ thd->restore_backup_statement(this, &stmt_backup);
+ thd->restore_active_arena(this, &stmt_backup);
+ thd->stmt_arena= old_stmt_arena;
+ DBUG_RETURN(TRUE);
+ }
+
parser_state.m_lip.stmt_prepare_mode= TRUE;
lex_start(thd);
error= parse_sql(thd, & parser_state, NULL) ||
- thd->is_error() ||
- init_param_array(this);
+ thd->is_error() ||
+ init_param_array(this);
lex->set_trg_event_type_for_tables();
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 7772b4d1ed2..1970287b06e 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1279,7 +1279,7 @@ bool change_master(THD* thd, Master_info* mi)
Relay log's IO_CACHE may not be inited, if rli->inited==0 (server was never
a slave before).
*/
- if (flush_master_info(mi, 0))
+ if (flush_master_info(mi, FALSE, FALSE))
{
my_error(ER_RELAY_LOG_INIT, MYF(0), "Failed to flush master info file");
unlock_slave_threads(mi);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 042dc7e0730..59d9d72e778 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -266,15 +266,15 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
setup_tables_done_option changed for next rexecution
*/
res= mysql_select(thd, &select_lex->ref_pointer_array,
- (TABLE_LIST*) select_lex->table_list.first,
+ select_lex->table_list.first,
select_lex->with_wild, select_lex->item_list,
select_lex->where,
select_lex->order_list.elements +
select_lex->group_list.elements,
- (ORDER*) select_lex->order_list.first,
- (ORDER*) select_lex->group_list.first,
+ select_lex->order_list.first,
+ select_lex->group_list.first,
select_lex->having,
- (ORDER*) lex->proc_list.first,
+ lex->proc_list.first,
select_lex->options | thd->options |
setup_tables_done_option,
result, unit, select_lex);
@@ -574,13 +574,21 @@ JOIN::prepare(Item ***rref_pointer_array,
{
Item *item= *ord->item;
/*
- Disregard sort order if there's only "{VAR}CHAR(0) NOT NULL" fields
- there. Such fields don't contain any data to sort.
+ Disregard sort order if there's only
+ zero length NOT NULL fields (e.g. {VAR}CHAR(0) NOT NULL") or
+ zero length NOT NULL string functions there.
+ Such tuples don't contain any data to sort.
*/
if (!real_order &&
- (item->type() != Item::FIELD_ITEM ||
- ((Item_field *) item)->field->maybe_null() ||
- ((Item_field *) item)->field->sort_length()))
+ /* Not a zero length NOT NULL field */
+ ((item->type() != Item::FIELD_ITEM ||
+ ((Item_field *) item)->field->maybe_null() ||
+ ((Item_field *) item)->field->sort_length()) &&
+ /* AND not a zero length NOT NULL string function. */
+ (item->type() != Item::FUNC_ITEM ||
+ item->maybe_null ||
+ item->result_type() != STRING_RESULT ||
+ item->max_length)))
real_order= TRUE;
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM)
@@ -2717,15 +2725,29 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds,
as well as allow us to catch illegal cross references/
Warshall's algorithm is used to build the transitive closure.
As we use bitmaps to represent the relation the complexity
- of the algorithm is O((number of tables)^2).
+ of the algorithm is O((number of tables)^2).
+
+ The classic form of the Warshall's algorithm would look like:
+ for (i= 0; i < table_count; i++)
+ {
+ for (j= 0; j < table_count; j++)
+ {
+ for (k= 0; k < table_count; k++)
+ {
+ if (bitmap_is_set(stat[j].dependent, i) &&
+ bitmap_is_set(stat[i].dependent, k))
+ bitmap_set_bit(stat[j].dependent, k);
+ }
+ }
*/
- for (i= 0, s= stat ; i < table_count ; i++, s++)
+
+ for (s= stat ; s < stat_end ; s++)
{
- for (uint j= 0 ; j < table_count ; j++)
+ table= s->table;
+ for (JOIN_TAB *t= stat ; t < stat_end ; t++)
{
- table= stat[j].table;
- if (s->dependent & table->map)
- s->dependent |= table->reginfo.join_tab->dependent;
+ if (t->dependent & table->map)
+ t->dependent |= table->reginfo.join_tab->dependent;
}
if (outer_join & s->table->map)
s->table->maybe_null= 1;
@@ -2881,8 +2903,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds,
!table->fulltext_searched &&
!table->pos_in_table_list->embedding)
{
- if ((table->key_info[key].flags & (HA_NOSAME | HA_END_SPACE_KEY))
- == HA_NOSAME)
+ if (table->key_info[key].flags & HA_NOSAME)
{
if (const_ref == eq_part)
{ // Found everything for ref.
@@ -5836,8 +5857,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
DBUG_RETURN(0);
if (j->type == JT_CONST)
j->table->const_table= 1;
- else if (((keyinfo->flags & (HA_NOSAME | HA_NULL_PART_KEY |
- HA_END_SPACE_KEY)) != HA_NOSAME) ||
+ else if (((keyinfo->flags & (HA_NOSAME | HA_NULL_PART_KEY)) != HA_NOSAME) ||
keyparts != keyinfo->key_parts || null_ref_key)
{
/* Must read with repeat */
@@ -7279,7 +7299,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
*simple_order=0; // Must do a temp table to sort
else if (!(order_tables & not_const_tables))
{
- if (order->item[0]->with_subselect)
+ if (order->item[0]->with_subselect &&
+ !(join->select_lex->options & SELECT_DESCRIBE))
order->item[0]->val_str(&order->item[0]->str_value);
DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
continue; // skip const item
@@ -8784,6 +8805,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
NESTED_JOIN *nested_join;
TABLE_LIST *prev_table= 0;
List_iterator<TABLE_LIST> li(*join_list);
+ bool straight_join= test(join->select_options & SELECT_STRAIGHT_JOIN);
DBUG_ENTER("simplify_joins");
/*
@@ -8896,7 +8918,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
if (prev_table)
{
/* The order of tables is reverse: prev_table follows table */
- if (prev_table->straight)
+ if (prev_table->straight || straight_join)
prev_table->dep_tables|= used_tables;
if (prev_table->on_expr)
{
@@ -9178,6 +9200,46 @@ static bool check_interleaving_with_nj(JOIN_TAB *next_tab)
/**
Nested joins perspective: Remove the last table from the join order.
+ The algorithm is the reciprocal of check_interleaving_with_nj(), hence
+ parent join nest nodes are updated only when the last table in its child
+ node is removed. The ASCII graphic below will clarify.
+
+ %A table nesting such as <tt> t1 x [ ( t2 x t3 ) x ( t4 x t5 ) ] </tt>is
+ represented by the below join nest tree.
+
+ @verbatim
+ NJ1
+ _/ / \
+ _/ / NJ2
+ _/ / / \
+ / / / \
+ t1 x [ (t2 x t3) x (t4 x t5) ]
+ @endverbatim
+
+ At the point in time when check_interleaving_with_nj() adds the table t5 to
+ the query execution plan, QEP, it also directs the node named NJ2 to mark
+ the table as covered. NJ2 does so by incrementing its @c counter
+ member. Since all of NJ2's tables are now covered by the QEP, the algorithm
+ proceeds up the tree to NJ1, incrementing its counter as well. All join
+ nests are now completely covered by the QEP.
+
+ restore_prev_nj_state() does the above in reverse. As seen above, the node
+ NJ1 contains the nodes t2, t3, and NJ2. Its counter being equal to 3 means
+ that the plan covers t2, t3, and NJ2, @e and that the sub-plan (t4 x t5)
+ completely covers NJ2. The removal of t5 from the partial plan will first
+ decrement NJ2's counter to 1. It will then detect that NJ2 went from being
+ completely to partially covered, and hence the algorithm must continue
+ upwards to NJ1 and decrement its counter to 2. %A subsequent removal of t4
+ will however not influence NJ1 since it did not un-cover the last table in
+ NJ2.
+
+ SYNOPSIS
+ restore_prev_nj_state()
+ last join table to remove, it is assumed to be the last in current
+ partial join order.
+
+ DESCRIPTION
+
Remove the last table from the partial join order and update the nested
joins counters and join->cur_embedding_map. It is ok to call this
function for the first table in join order (for which
@@ -9191,19 +9253,20 @@ static void restore_prev_nj_state(JOIN_TAB *last)
{
TABLE_LIST *last_emb= last->table->pos_in_table_list->embedding;
JOIN *join= last->join;
- while (last_emb)
+ for (;last_emb != NULL; last_emb= last_emb->embedding)
{
- if (!(--last_emb->nested_join->counter))
- join->cur_embedding_map&= ~last_emb->nested_join->nj_map;
- else if (last_emb->nested_join->n_tables-1 ==
- last_emb->nested_join->counter)
- {
- join->cur_embedding_map|= last_emb->nested_join->nj_map;
- break;
- }
- else
+ NESTED_JOIN *nest= last_emb->nested_join;
+ DBUG_ASSERT(nest->counter > 0);
+
+ bool was_fully_covered= nest->is_fully_covered();
+
+ if (--nest->counter == 0)
+ join->cur_embedding_map&= ~nest->nj_map;
+
+ if (!was_fully_covered)
break;
- last_emb= last_emb->embedding;
+
+ join->cur_embedding_map|= nest->nj_map;
}
}
@@ -10337,7 +10400,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
table->null_flags= (uchar*) table->record[0];
share->null_fields= null_count+ hidden_null_count;
- share->null_bytes= null_pack_length;
+ share->null_bytes= share->null_bytes_for_compare= null_pack_length;
}
null_count= (blob_count == 0) ? 1 : 0;
hidden_field_count=param->hidden_field_count;
@@ -10703,7 +10766,7 @@ TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list)
{
table->null_flags= (uchar*) table->record[0];
share->null_fields= null_count;
- share->null_bytes= null_pack_length;
+ share->null_bytes= share->null_bytes_for_compare= null_pack_length;
}
table->in_use= thd; /* field->reset() may access table->in_use */
@@ -13633,6 +13696,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
uint nr;
key_map keys;
uint best_key_parts;
+ uint saved_best_key_parts= 0;
int best_key_direction;
ha_rows best_records;
double read_time;
@@ -13834,6 +13898,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
{
best_key= nr;
best_key_parts= keyinfo->key_parts;
+ saved_best_key_parts= used_key_parts;
best_records= quick_records;
is_best_covering= is_covering;
best_key_direction= direction;
@@ -13920,8 +13985,15 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
*/
}
}
- used_key_parts= best_key_parts;
order_direction= best_key_direction;
+ /*
+ saved_best_key_parts is actual number of used keyparts found by the
+ test_if_order_by_key function. It could differ from keyinfo->key_parts,
+ thus we have to restore it in case of desc order as it affects
+ QUICK_SELECT_DESC behaviour.
+ */
+ used_key_parts= (order_direction == -1) ?
+ saved_best_key_parts : best_key_parts;
}
else
DBUG_RETURN(0);
@@ -17074,15 +17146,15 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
thd->lex->current_select= first;
unit->set_limit(unit->global_parameters);
res= mysql_select(thd, &first->ref_pointer_array,
- (TABLE_LIST*) first->table_list.first,
+ first->table_list.first,
first->with_wild, first->item_list,
first->where,
first->order_list.elements +
first->group_list.elements,
- (ORDER*) first->order_list.first,
- (ORDER*) first->group_list.first,
+ first->order_list.first,
+ first->group_list.first,
first->having,
- (ORDER*) thd->lex->proc_list.first,
+ thd->lex->proc_list.first,
first->options | thd->options | SELECT_DESCRIBE,
result, unit, first);
}
@@ -17392,7 +17464,7 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
if (group_list.elements)
{
str->append(STRING_WITH_LEN(" group by "));
- print_order(str, (ORDER *) group_list.first, query_type);
+ print_order(str, group_list.first, query_type);
switch (olap)
{
case CUBE_TYPE:
@@ -17423,7 +17495,7 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
if (order_list.elements)
{
str->append(STRING_WITH_LEN(" order by "));
- print_order(str, (ORDER *) order_list.first, query_type);
+ print_order(str, order_list.first, query_type);
}
// limit
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 4dca54b6290..e1d223eadad 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -31,6 +31,7 @@
#include "event_data_objects.h"
#endif
#include <my_dir.h>
+#include "debug_sync.h"
#define STR_OR_NIL(S) ((S) ? (S) : "<nil>")
@@ -3354,7 +3355,9 @@ make_table_name_list(THD *thd, List<LEX_STRING> *table_names, LEX *lex,
{
if (with_i_schema)
{
- if (find_schema_table(thd, lookup_field_vals->table_value.str))
+ ST_SCHEMA_TABLE *schema_table=
+ find_schema_table(thd, lookup_field_vals->table_value.str);
+ if (schema_table && !schema_table->hidden)
{
if (table_names->push_back(&lookup_field_vals->table_value))
return 1;
@@ -3431,8 +3434,7 @@ fill_schema_show_cols_or_idxs(THD *thd, TABLE_LIST *tables,
bool res;
LEX_STRING tmp_lex_string, tmp_lex_string1, *db_name, *table_name;
enum_sql_command save_sql_command= lex->sql_command;
- TABLE_LIST *show_table_list= (TABLE_LIST*) tables->schema_select_lex->
- table_list.first;
+ TABLE_LIST *show_table_list= tables->schema_select_lex->table_list.first;
TABLE *table= tables->table;
int error= 1;
DBUG_ENTER("fill_schema_show");
@@ -3878,12 +3880,13 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
goto err;
if (make_table_list(thd, &sel, db_name, table_name))
goto err;
- TABLE_LIST *show_table_list= (TABLE_LIST*) sel.table_list.first;
+ TABLE_LIST *show_table_list= sel.table_list.first;
lex->all_selects_list= &sel;
lex->derived_tables= 0;
lex->sql_command= SQLCOM_SHOW_FIELDS;
show_table_list->i_s_requested_object=
schema_table->i_s_requested_object;
+ DEBUG_SYNC(thd, "before_open_in_get_all_tables");
res= open_normal_and_derived_tables(thd, show_table_list,
MYSQL_LOCK_IGNORE_FLUSH);
lex->sql_command= save_sql_command;
@@ -4622,24 +4625,37 @@ int fill_schema_coll_charset_app(THD *thd, TABLE_LIST *tables, COND *cond)
}
+static inline void copy_field_as_string(Field *to_field, Field *from_field)
+{
+ char buff[MAX_FIELD_WIDTH];
+ String tmp_str(buff, sizeof(buff), system_charset_info);
+ from_field->val_str(&tmp_str);
+ to_field->store(tmp_str.ptr(), tmp_str.length(), system_charset_info);
+}
+
+
bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
const char *wild, bool full_access, const char *sp_user)
{
- String tmp_string;
- String sp_db, sp_name, definer;
MYSQL_TIME time;
LEX *lex= thd->lex;
CHARSET_INFO *cs= system_charset_info;
- get_field(thd->mem_root, proc_table->field[0], &sp_db);
- get_field(thd->mem_root, proc_table->field[1], &sp_name);
- get_field(thd->mem_root, proc_table->field[11], &definer);
+ char sp_db_buff[NAME_LEN + 1], sp_name_buff[NAME_LEN + 1],
+ definer_buff[USERNAME_LENGTH + HOSTNAME_LENGTH + 2];
+ String sp_db(sp_db_buff, sizeof(sp_db_buff), cs);
+ String sp_name(sp_name_buff, sizeof(sp_name_buff), cs);
+ String definer(definer_buff, sizeof(definer_buff), cs);
+
+ proc_table->field[0]->val_str(&sp_db);
+ proc_table->field[1]->val_str(&sp_name);
+ proc_table->field[11]->val_str(&definer);
+
if (!full_access)
- full_access= !strcmp(sp_user, definer.ptr());
- if (!full_access && check_some_routine_access(thd, sp_db.ptr(),
- sp_name.ptr(),
- proc_table->field[2]->
- val_int() ==
- TYPE_ENUM_PROCEDURE))
+ full_access= !strcmp(sp_user, definer.c_ptr_safe());
+ if (!full_access &&
+ check_some_routine_access(thd, sp_db.c_ptr_safe(), sp_name.c_ptr_safe(),
+ proc_table->field[2]->val_int() ==
+ TYPE_ENUM_PROCEDURE))
return 0;
if ((lex->sql_command == SQLCOM_SHOW_STATUS_PROC &&
@@ -4649,55 +4665,42 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
(sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0)
{
restore_record(table, s->default_values);
- if (!wild || !wild[0] || !wild_compare(sp_name.ptr(), wild, 0))
+ if (!wild || !wild[0] || !wild_compare(sp_name.c_ptr_safe(), wild, 0))
{
int enum_idx= (int) proc_table->field[5]->val_int();
table->field[3]->store(sp_name.ptr(), sp_name.length(), cs);
- get_field(thd->mem_root, proc_table->field[3], &tmp_string);
- table->field[0]->store(tmp_string.ptr(), tmp_string.length(), cs);
+ copy_field_as_string(table->field[0], proc_table->field[3]);
table->field[2]->store(sp_db.ptr(), sp_db.length(), cs);
- get_field(thd->mem_root, proc_table->field[2], &tmp_string);
- table->field[4]->store(tmp_string.ptr(), tmp_string.length(), cs);
+ copy_field_as_string(table->field[4], proc_table->field[2]);
if (proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION)
{
- get_field(thd->mem_root, proc_table->field[9], &tmp_string);
- table->field[5]->store(tmp_string.ptr(), tmp_string.length(), cs);
+ copy_field_as_string(table->field[5], proc_table->field[9]);
table->field[5]->set_notnull();
}
if (full_access)
{
- get_field(thd->mem_root, proc_table->field[19], &tmp_string);
- table->field[7]->store(tmp_string.ptr(), tmp_string.length(), cs);
+ copy_field_as_string(table->field[7], proc_table->field[19]);
table->field[7]->set_notnull();
}
table->field[6]->store(STRING_WITH_LEN("SQL"), cs);
table->field[10]->store(STRING_WITH_LEN("SQL"), cs);
- get_field(thd->mem_root, proc_table->field[6], &tmp_string);
- table->field[11]->store(tmp_string.ptr(), tmp_string.length(), cs);
- table->field[12]->store(sp_data_access_name[enum_idx].str,
+ copy_field_as_string(table->field[11], proc_table->field[6]);
+ table->field[12]->store(sp_data_access_name[enum_idx].str,
sp_data_access_name[enum_idx].length , cs);
- get_field(thd->mem_root, proc_table->field[7], &tmp_string);
- table->field[14]->store(tmp_string.ptr(), tmp_string.length(), cs);
+ copy_field_as_string(table->field[14], proc_table->field[7]);
+
bzero((char *)&time, sizeof(time));
((Field_timestamp *) proc_table->field[12])->get_time(&time);
table->field[15]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
bzero((char *)&time, sizeof(time));
((Field_timestamp *) proc_table->field[13])->get_time(&time);
table->field[16]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
- get_field(thd->mem_root, proc_table->field[14], &tmp_string);
- table->field[17]->store(tmp_string.ptr(), tmp_string.length(), cs);
- get_field(thd->mem_root, proc_table->field[15], &tmp_string);
- table->field[18]->store(tmp_string.ptr(), tmp_string.length(), cs);
+ copy_field_as_string(table->field[17], proc_table->field[14]);
+ copy_field_as_string(table->field[18], proc_table->field[15]);
table->field[19]->store(definer.ptr(), definer.length(), cs);
-
- get_field(thd->mem_root, proc_table->field[16], &tmp_string);
- table->field[20]->store(tmp_string.ptr(), tmp_string.length(), cs);
-
- get_field(thd->mem_root, proc_table->field[17], &tmp_string);
- table->field[21]->store(tmp_string.ptr(), tmp_string.length(), cs);
-
- get_field(thd->mem_root, proc_table->field[18], &tmp_string);
- table->field[22]->store(tmp_string.ptr(), tmp_string.length(), cs);
+ copy_field_as_string(table->field[20], proc_table->field[16]);
+ copy_field_as_string(table->field[21], proc_table->field[17]);
+ copy_field_as_string(table->field[22], proc_table->field[18]);
return schema_table_store_record(thd, table);
}
@@ -6906,7 +6909,7 @@ ST_FIELD_INFO engines_fields_info[]=
{
{"ENGINE", 64, MYSQL_TYPE_STRING, 0, 0, "Engine", SKIP_OPEN_TABLE},
{"SUPPORT", 8, MYSQL_TYPE_STRING, 0, 0, "Support", SKIP_OPEN_TABLE},
- {"COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment", SKIP_OPEN_TABLE},
+ {"COMMENT", 160, MYSQL_TYPE_STRING, 0, 0, "Comment", SKIP_OPEN_TABLE},
{"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 1, "Transactions", SKIP_OPEN_TABLE},
{"XA", 3, MYSQL_TYPE_STRING, 0, 1, "XA", SKIP_OPEN_TABLE},
{"SAVEPOINTS", 3 ,MYSQL_TYPE_STRING, 0, 1, "Savepoints", SKIP_OPEN_TABLE},
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 2190353a9cb..b9b5ff47cf6 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -386,6 +386,25 @@ uint filename_to_tablename(const char *from, char *to, uint to_length)
/**
+ Check if given string begins with "#mysql50#" prefix
+
+ @param name string to check cut
+
+ @retval
+ FALSE no prefix found
+ @retval
+ TRUE prefix found
+*/
+
+bool check_mysql50_prefix(const char *name)
+{
+ return (name[0] == '#' &&
+ !strncmp(name, MYSQL50_TABLE_NAME_PREFIX,
+ MYSQL50_TABLE_NAME_PREFIX_LENGTH));
+}
+
+
+/**
Check if given string begins with "#mysql50#" prefix, cut it if so.
@param from string to check and cut
@@ -400,9 +419,7 @@ uint filename_to_tablename(const char *from, char *to, uint to_length)
uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length)
{
- if (from[0] == '#' &&
- !strncmp(from, MYSQL50_TABLE_NAME_PREFIX,
- MYSQL50_TABLE_NAME_PREFIX_LENGTH))
+ if (check_mysql50_prefix(from))
return (uint) (strmake(to, from + MYSQL50_TABLE_NAME_PREFIX_LENGTH,
to_length - 1) - to);
return 0;
@@ -2232,10 +2249,10 @@ static int sort_keys(KEY *a, KEY *b)
{
if (!(b_flags & HA_NOSAME))
return -1;
- if ((a_flags ^ b_flags) & (HA_NULL_PART_KEY | HA_END_SPACE_KEY))
+ if ((a_flags ^ b_flags) & HA_NULL_PART_KEY)
{
/* Sort NOT NULL keys before other keys */
- return (a_flags & (HA_NULL_PART_KEY | HA_END_SPACE_KEY)) ? 1 : -1;
+ return (a_flags & HA_NULL_PART_KEY) ? 1 : -1;
}
if (a->name == primary_key_name)
return -1;
@@ -4633,7 +4650,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
table->next_global= 0;
save_next_local= table->next_local;
table->next_local= 0;
- select->table_list.first= (uchar*)table;
+ select->table_list.first= table;
/*
Time zone tables and SP tables can be add to lex->query_tables list,
so it have to be prepared.
@@ -5347,6 +5364,11 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
*/
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
+ if (src_table->table->file->ht == partition_hton)
+ {
+ my_error(ER_PARTITION_NO_TEMPORARY, MYF(0));
+ goto err;
+ }
if (find_temporary_table(thd, db, table_name))
goto table_exists;
dst_path_length= build_tmptable_filename(thd, dst_path, sizeof(dst_path));
@@ -5411,14 +5433,15 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
/*
For partitioned tables we need to copy the .par file as well since
it is used in open_table_def to even be able to create a new handler.
- There is no way to find out here if the original table is a
- partitioned table so we copy the file and ignore any errors.
*/
- fn_format(tmp_path, dst_path, reg_ext, ".par", MYF(MY_REPLACE_EXT));
- strmov(dst_path, tmp_path);
- fn_format(tmp_path, src_path, reg_ext, ".par", MYF(MY_REPLACE_EXT));
- strmov(src_path, tmp_path);
- my_copy(src_path, dst_path, MYF(MY_DONT_OVERWRITE_FILE));
+ if (src_table->table->file->ht == partition_hton)
+ {
+ fn_format(tmp_path, dst_path, reg_ext, ".par", MYF(MY_REPLACE_EXT));
+ strmov(dst_path, tmp_path);
+ fn_format(tmp_path, src_path, reg_ext, ".par", MYF(MY_REPLACE_EXT));
+ strmov(src_path, tmp_path);
+ my_copy(src_path, dst_path, MYF(MY_DONT_OVERWRITE_FILE));
+ }
#endif
DBUG_EXECUTE_IF("sleep_create_like_before_ha_create", my_sleep(6000000););
@@ -6604,6 +6627,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
uint *index_add_buffer= NULL;
uint candidate_key_count= 0;
bool no_pk;
+ ulong explicit_used_fields= 0;
DBUG_ENTER("mysql_alter_table");
/*
@@ -6874,6 +6898,7 @@ view_err:
change the row format in update_create_info().
*/
create_info->used_fields|= HA_CREATE_USED_ROW_FORMAT;
+ explicit_used_fields|= HA_CREATE_USED_ROW_FORMAT;
}
DBUG_PRINT("info", ("old type: %s new type: %s",
@@ -7034,6 +7059,9 @@ view_err:
if (mysql_prepare_alter_table(thd, table, create_info, alter_info))
goto err;
+ /* Remove markers set for update_create_info */
+ create_info->used_fields&= ~explicit_used_fields;
+
if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
need_copy_table= alter_info->change_level;
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index aafb25013f6..bf4a46a4c67 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -653,7 +653,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
*/
old_field= new_field= table->field;
- for (trg_field= (Item_trigger_field *)(lex->trg_table_fields.first);
+ for (trg_field= lex->trg_table_fields.first;
trg_field; trg_field= trg_field->next_trg_field)
{
/*
@@ -1297,9 +1297,9 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
thd->variables.sql_mode= (ulong)*trg_sql_mode;
- Parser_state parser_state(thd,
- trg_create_str->str,
- trg_create_str->length);
+ Parser_state parser_state;
+ if (parser_state.init(thd, trg_create_str->str, trg_create_str->length))
+ goto err_with_lex_cleanup;
Trigger_creation_ctx *creation_ctx=
Trigger_creation_ctx::create(thd,
@@ -1413,7 +1413,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
*/
triggers->trigger_fields[lex.trg_chistics.event]
[lex.trg_chistics.action_time]=
- (Item_trigger_field *)(lex.trg_table_fields.first);
+ lex.trg_table_fields.first;
/*
Also let us bind these objects to Field objects in table being
opened.
@@ -1423,8 +1423,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
SELECT)...
Anyway some things can be checked only during trigger execution.
*/
- for (Item_trigger_field *trg_field=
- (Item_trigger_field *)(lex.trg_table_fields.first);
+ for (Item_trigger_field *trg_field= lex.trg_table_fields.first;
trg_field;
trg_field= trg_field->next_trg_field)
{
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 61f47bee799..3b2ef92ab48 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -144,20 +144,19 @@ void
st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg)
{
thd_arg->lex->current_select= fake_select_lex;
- fake_select_lex->table_list.link_in_list((uchar *)&result_table_list,
- (uchar **)
- &result_table_list.next_local);
+ fake_select_lex->table_list.link_in_list(&result_table_list,
+ &result_table_list.next_local);
fake_select_lex->context.table_list=
fake_select_lex->context.first_name_resolution_table=
fake_select_lex->get_table_list();
if (!fake_select_lex->first_execution)
{
- for (ORDER *order= (ORDER *) global_parameters->order_list.first;
+ for (ORDER *order= global_parameters->order_list.first;
order;
order= order->next)
order->item= &order->item_ptr;
}
- for (ORDER *order= (ORDER *)global_parameters->order_list.first;
+ for (ORDER *order= global_parameters->order_list.first;
order;
order=order->next)
{
@@ -249,18 +248,18 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
can_skip_order_by= is_union_select && !(sl->braces && sl->explicit_limit);
saved_error= join->prepare(&sl->ref_pointer_array,
- (TABLE_LIST*) sl->table_list.first,
+ sl->table_list.first,
sl->with_wild,
sl->where,
(can_skip_order_by ? 0 :
sl->order_list.elements) +
sl->group_list.elements,
can_skip_order_by ?
- (ORDER*) 0 : (ORDER *)sl->order_list.first,
- (ORDER*) sl->group_list.first,
+ NULL : sl->order_list.first,
+ sl->group_list.first,
sl->having,
- (is_union_select ? (ORDER*) 0 :
- (ORDER*) thd_arg->lex->proc_list.first),
+ (is_union_select ? NULL :
+ thd_arg->lex->proc_list.first),
sl, this);
/* There are no * in the statement anymore (for PS) */
sl->with_wild= 0;
@@ -354,7 +353,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
{
ORDER *ord;
Item_func::Functype ft= Item_func::FT_FUNC;
- for (ord= (ORDER*)global_parameters->order_list.first; ord; ord= ord->next)
+ for (ord= global_parameters->order_list.first; ord; ord= ord->next)
if ((*ord->item)->walk (&Item::find_function_processor, FALSE,
(uchar *) &ft))
{
@@ -416,12 +415,11 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
thd_arg->lex->current_select= fake_select_lex;
saved_error= fake_select_lex->join->
prepare(&fake_select_lex->ref_pointer_array,
- (TABLE_LIST*) fake_select_lex->table_list.first,
+ fake_select_lex->table_list.first,
0, 0,
fake_select_lex->order_list.elements,
- (ORDER*) fake_select_lex->order_list.first,
- (ORDER*) NULL, NULL,
- (ORDER*) NULL,
+ fake_select_lex->order_list.first,
+ NULL, NULL, NULL,
fake_select_lex, this);
fake_select_lex->table_list.empty();
}
@@ -597,8 +595,8 @@ bool st_select_lex_unit::exec()
&result_table_list,
0, item_list, NULL,
global_parameters->order_list.elements,
- (ORDER*)global_parameters->order_list.first,
- (ORDER*) NULL, NULL, (ORDER*) NULL,
+ global_parameters->order_list.first,
+ NULL, NULL, NULL,
fake_select_lex->options | SELECT_NO_UNLOCK,
result, this, fake_select_lex);
}
@@ -620,8 +618,8 @@ bool st_select_lex_unit::exec()
&result_table_list,
0, item_list, NULL,
global_parameters->order_list.elements,
- (ORDER*)global_parameters->order_list.first,
- (ORDER*) NULL, NULL, (ORDER*) NULL,
+ global_parameters->order_list.first,
+ NULL, NULL, NULL,
fake_select_lex->options | SELECT_NO_UNLOCK,
result, this, fake_select_lex);
}
@@ -697,7 +695,7 @@ bool st_select_lex_unit::cleanup()
if (global_parameters->order_list.elements)
{
ORDER *ord;
- for (ord= (ORDER*)global_parameters->order_list.first; ord; ord= ord->next)
+ for (ord= global_parameters->order_list.first; ord; ord= ord->next)
(*ord->item)->walk (&Item::cleanup_processor, 0, 0);
}
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index c231fd7afc6..15251e956be 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -29,12 +29,12 @@
bool compare_record(TABLE *table)
{
- if (table->s->blob_fields + table->s->varchar_fields == 0)
+ if (table->s->can_cmp_whole_record)
return cmp_record(table,record[1]);
/* Compare null bits */
if (memcmp(table->null_flags,
table->null_flags+table->s->rec_buff_length,
- table->s->null_bytes))
+ table->s->null_bytes_for_compare))
return TRUE; // Diff in NULL value
/* Compare updated fields */
for (Field **ptr= table->field ; *ptr ; ptr++)
@@ -394,7 +394,7 @@ int mysql_update(THD *thd,
matching rows before updating the table!
*/
if (used_index < MAX_KEY && old_covering_keys.is_set(used_index))
- table->mark_columns_used_by_index(used_index);
+ table->add_read_columns_used_by_index(used_index);
else
{
table->use_all_columns();
@@ -422,6 +422,7 @@ int mysql_update(THD *thd,
{
goto err;
}
+ thd->examined_row_count+= examined_rows;
/*
Filesort has already found and selected the rows we want to update,
so we don't need the where clause
@@ -473,6 +474,7 @@ int mysql_update(THD *thd,
!thd->killed && !thd->is_error())
{
update_virtual_fields(thd, table);
+ thd->examined_row_count++;
if (!select || select->skip_record(thd) > 0)
{
if (table->file->was_semi_consistent_read())
@@ -581,6 +583,7 @@ int mysql_update(THD *thd,
while (!(error=info.read_record(&info)) && !thd->killed)
{
update_virtual_fields(thd, table);
+ thd->examined_row_count++;
if (!select || select->skip_record(thd) > 0)
{
if (table->file->was_semi_consistent_read())
@@ -1054,7 +1057,7 @@ reopen_tables:
correct order of statements. Otherwise, we use a TL_READ lock to
improve performance.
*/
- tl->lock_type= read_lock_type_for_table(thd, table);
+ tl->lock_type= read_lock_type_for_table(thd, lex, tl);
tl->updating= 0;
/* Update TABLE::lock_type accordingly. */
if (!tl->placeholder() && !using_lock_tables)
@@ -1332,7 +1335,7 @@ int multi_update::prepare(List<Item> &not_used_values,
SELECT_LEX_UNIT *lex_unit)
{
TABLE_LIST *table_ref;
- SQL_LIST update;
+ SQL_I_List<TABLE_LIST> update;
table_map tables_to_update;
Item_field *item;
List_iterator_fast<Item> field_it(*fields);
@@ -1412,11 +1415,11 @@ int multi_update::prepare(List<Item> &not_used_values,
leaf_table_count++;
if (tables_to_update & table->map)
{
- TABLE_LIST *tl= (TABLE_LIST*) thd->memdup((char*) table_ref,
+ TABLE_LIST *tl= (TABLE_LIST*) thd->memdup(table_ref,
sizeof(*tl));
if (!tl)
DBUG_RETURN(1);
- update.link_in_list((uchar*) tl, (uchar**) &tl->next_local);
+ update.link_in_list(tl, &tl->next_local);
tl->shared= table_count++;
table->no_keyread=1;
table->covering_keys.clear_all();
@@ -1437,7 +1440,7 @@ int multi_update::prepare(List<Item> &not_used_values,
table_count= update.elements;
- update_tables= (TABLE_LIST*) update.first;
+ update_tables= update.first;
tmp_tables = (TABLE**) thd->calloc(sizeof(TABLE *) * table_count);
tmp_table_param = (TMP_TABLE_PARAM*) thd->calloc(sizeof(TMP_TABLE_PARAM) *
@@ -1998,9 +2001,11 @@ int multi_update::do_updates()
Setup copy functions to copy fields from temporary table
*/
List_iterator_fast<Item> field_it(*fields_for_table[offset]);
- Field **field= tmp_table->field +
- 1 + unupdated_check_opt_tables.elements; // Skip row pointers
+ Field **field;
Copy_field *copy_field_ptr= copy_field, *copy_field_end;
+
+ /* Skip row pointers */
+ field= tmp_table->field + 1 + unupdated_check_opt_tables.elements;
for ( ; *field ; field++)
{
Item_field *item= (Item_field* ) field_it++;
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 5381ce94411..2112d9b1e1c 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -887,7 +887,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
view->algorithm != VIEW_ALGORITHM_TMPTABLE)))
{
/* TODO: change here when we will support UNIONs */
- for (TABLE_LIST *tbl= (TABLE_LIST *)lex->select_lex.table_list.first;
+ for (TABLE_LIST *tbl= lex->select_lex.table_list.first;
tbl;
tbl= tbl->next_local)
{
@@ -1006,7 +1006,7 @@ loop_out:
*/
if (view->updatable_view &&
!lex->select_lex.master_unit()->is_union() &&
- !((TABLE_LIST*)lex->select_lex.table_list.first)->next_local &&
+ !(lex->select_lex.table_list.first)->next_local &&
find_table_in_global_list(lex->query_tables->next_global,
lex->query_tables->db,
lex->query_tables->table_name))
@@ -1192,9 +1192,10 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
char old_db_buf[NAME_LEN+1];
LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) };
bool dbchanged;
- Parser_state parser_state(thd,
- table->select_stmt.str,
- table->select_stmt.length);
+ Parser_state parser_state;
+ if (parser_state.init(thd, table->select_stmt.str,
+ table->select_stmt.length))
+ goto err;
/*
Use view db name as thread default database, in order to ensure
@@ -1351,8 +1352,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
This may change in future, for example if we enable merging of
views with subqueries in select list.
*/
- view_main_select_tables=
- (TABLE_LIST*)lex->select_lex.table_list.first;
+ view_main_select_tables= lex->select_lex.table_list.first;
/*
Let us set proper lock type for tables of the view's main
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index b63fc0eae4a..e01289ad087 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -516,8 +516,7 @@ set_trigger_new_row(THD *thd, LEX_STRING *name, Item *val)
Let us add this item to list of all Item_trigger_field
objects in trigger.
*/
- lex->trg_table_fields.link_in_list((uchar *) trg_fld,
- (uchar **) &trg_fld->next_trg_field);
+ lex->trg_table_fields.link_in_list(trg_fld, &trg_fld->next_trg_field);
return lex->sphead->add_instr(sp_fld);
}
@@ -4710,11 +4709,9 @@ create_table_option:
TABLE_LIST *table_list= lex->select_lex.get_table_list();
lex->create_info.merge_list= lex->select_lex.table_list;
lex->create_info.merge_list.elements--;
- lex->create_info.merge_list.first=
- (uchar*) (table_list->next_local);
+ lex->create_info.merge_list.first= table_list->next_local;
lex->select_lex.table_list.elements=1;
- lex->select_lex.table_list.next=
- (uchar**) &(table_list->next_local);
+ lex->select_lex.table_list.next= &(table_list->next_local);
table_list->next_local= 0;
lex->create_info.used_fields|= HA_CREATE_USED_UNION;
}
@@ -5847,8 +5844,7 @@ alter:
lex->alter_info.reset();
lex->col_list.empty();
lex->select_lex.init_order();
- lex->select_lex.db=
- ((TABLE_LIST*) lex->select_lex.table_list.first)->db;
+ lex->select_lex.db= (lex->select_lex.table_list.first)->db;
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= 0;
lex->create_info.default_table_charset= NULL;
@@ -8560,9 +8556,8 @@ opt_gorder_clause:
| order_clause
{
SELECT_LEX *select= Select;
- select->gorder_list=
- (SQL_LIST*) sql_memdup((char*) &select->order_list,
- sizeof(st_sql_list));
+ select->gorder_list= new (YYTHD->mem_root)
+ SQL_I_List<ORDER>(select->order_list);
if (select->gorder_list == NULL)
MYSQL_YYABORT;
select->order_list.empty();
@@ -9512,7 +9507,7 @@ procedure_clause:
}
lex->proc_list.elements=0;
lex->proc_list.first=0;
- lex->proc_list.next= (uchar**) &lex->proc_list.first;
+ lex->proc_list.next= &lex->proc_list.first;
Item_field *item= new (YYTHD->mem_root)
Item_field(&lex->current_select->context,
NULL, NULL, $2.str);
@@ -11500,8 +11495,8 @@ simple_ident_q:
Let us add this item to list of all Item_trigger_field objects
in trigger.
*/
- lex->trg_table_fields.link_in_list((uchar*) trg_fld,
- (uchar**) &trg_fld->next_trg_field);
+ lex->trg_table_fields.link_in_list(trg_fld,
+ &trg_fld->next_trg_field);
$$= trg_fld;
}
@@ -11587,7 +11582,7 @@ field_ident:
ident { $$=$1;}
| ident '.' ident '.' ident
{
- TABLE_LIST *table= (TABLE_LIST*) Select->table_list.first;
+ TABLE_LIST *table= Select->table_list.first;
if (my_strcasecmp(table_alias_charset, $1.str, table->db))
{
my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
@@ -11603,7 +11598,7 @@ field_ident:
}
| ident '.' ident
{
- TABLE_LIST *table= (TABLE_LIST*) Select->table_list.first;
+ TABLE_LIST *table= Select->table_list.first;
if (my_strcasecmp(table_alias_charset, $1.str, table->alias))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), $1.str);
diff --git a/sql/table.cc b/sql/table.cc
index 7db7e510ea0..988e082addf 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -52,6 +52,8 @@ static uint find_field(Field **fields, uchar *record, uint start, uint length);
inline bool is_system_table_name(const char *name, uint length);
+static ulong get_form_pos(File file, uchar *head);
+
/**************************************************************************
Object_creation_ctx implementation.
**************************************************************************/
@@ -304,13 +306,6 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
share->version= refresh_version;
/*
- This constant is used to mark that no table map version has been
- assigned. No arithmetic is done on the value: it will be
- overwritten with a value taken from MYSQL_BIN_LOG.
- */
- share->table_map_version= ~(ulonglong)0;
-
- /*
Since alloc_table_share() can be called without any locking (for
example, ha_create_table... functions), we do not assign a table
map id here. Instead we assign a value that is not used
@@ -373,11 +368,6 @@ void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,
share->path.length= share->normalized_path.length= strlen(path);
share->frm_version= FRM_VER_TRUE_VARCHAR;
- /*
- Temporary tables are not replicated, but we set up these fields
- anyway to be able to catch errors.
- */
- share->table_map_version= ~(ulonglong)0;
share->cached_row_logging_check= -1;
/*
@@ -706,6 +696,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
const char **interval_array;
enum legacy_db_type legacy_db_type;
my_bitmap_map *bitmaps;
+ bool null_bits_are_used;
DBUG_ENTER("open_binary_frm");
new_field_pack_flag= head[27];
@@ -714,7 +705,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
disk_buff= 0;
error= 3;
- if (!(pos=get_form_pos(file,head,(TYPELIB*) 0)))
+ /* Position of the form in the form file. */
+ if (!(pos= get_form_pos(file, head)))
goto err; /* purecov: inspected */
share->frm_version= head[2];
@@ -1152,6 +1144,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
goto free_and_err;
record= share->default_values-1; /* Fieldstart = 1 */
+ null_bits_are_used= share->null_fields != 0;
if (share->null_field_first)
{
null_flags= null_pos= (uchar*) record+1;
@@ -1370,6 +1363,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
reg_field->stored_in_db= fld_stored_in_db;
if (field_type == MYSQL_TYPE_BIT && !f_bit_as_char(pack_flag))
{
+ null_bits_are_used= 1;
if ((null_bit_pos+= field_length & 7) > 7)
{
null_pos++;
@@ -1503,12 +1497,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
keyinfo->extra_length+=HA_KEY_BLOB_LENGTH;
key_part->store_length+=HA_KEY_BLOB_LENGTH;
keyinfo->key_length+= HA_KEY_BLOB_LENGTH;
- /*
- Mark that there may be many matching values for one key
- combination ('a', 'a ', 'a '...)
- */
- if (!(field->flags & BINARY_FLAG))
- keyinfo->flags|= HA_END_SPACE_KEY;
}
if (field->type() == MYSQL_TYPE_BIT)
key_part->key_part_flag|= HA_BIT_PART;
@@ -1702,6 +1690,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share->null_bytes= (null_pos - (uchar*) null_flags +
(null_bit_pos + 7) / 8);
share->last_null_bit_pos= null_bit_pos;
+ share->null_bytes_for_compare= null_bits_are_used ? share->null_bytes : 0;
+ share->can_cmp_whole_record= (share->blob_fields == 0 &&
+ share->varchar_fields == 0);
share->db_low_byte_first= handler_file->low_byte_first();
share->column_bitmap_size= bitmap_buffer_size(share->fields);
@@ -1946,7 +1937,14 @@ bool unpack_vcol_info_from_frm(THD *thd,
LEX_STRING *vcol_expr,
bool *error_reported)
{
- bool rc= FALSE;
+ bool rc;
+ char *vcol_expr_str;
+ int str_len;
+ CHARSET_INFO *old_character_set_client;
+ Query_arena *backup_stmt_arena_ptr;
+ Query_arena backup_arena;
+ Query_arena *vcol_arena;
+ Parser_state parser_state;
DBUG_ENTER("unpack_vcol_info_from_frm");
DBUG_ASSERT(vcol_expr);
@@ -1955,9 +1953,6 @@ bool unpack_vcol_info_from_frm(THD *thd,
The string to be parsed has to be of the following format:
"PARSE_VCOL_EXPR (<expr_string_from_frm>)".
*/
- char *vcol_expr_str;
- int str_len= 0;
- CHARSET_INFO *old_character_set_client;
if (!(vcol_expr_str= (char*) alloc_root(&table->mem_root,
vcol_expr->length +
@@ -1979,14 +1974,15 @@ bool unpack_vcol_info_from_frm(THD *thd,
str_len++;
memcpy(vcol_expr_str + str_len, "\0", 1);
str_len++;
- Parser_state parser_state(thd, vcol_expr_str, str_len);
+
+ if (parser_state.init(thd, vcol_expr_str, str_len))
+ goto err;
/*
Step 2: Setup thd for parsing.
*/
- Query_arena *backup_stmt_arena_ptr= thd->stmt_arena;
- Query_arena backup_arena;
- Query_arena *vcol_arena= table->expr_arena;
+ backup_stmt_arena_ptr= thd->stmt_arena;
+ vcol_arena= table->expr_arena;
if (!vcol_arena)
{
Query_arena expr_arena(&table->mem_root, Query_arena::INITIALIZED);
@@ -2019,6 +2015,7 @@ bool unpack_vcol_info_from_frm(THD *thd,
field->vcol_info= 0;
goto err;
}
+ rc= FALSE;
goto end;
err:
@@ -2517,55 +2514,46 @@ void free_field_buffers_larger_than(TABLE *table, uint32 size)
}
}
- /* Find where a form starts */
- /* if formname is NullS then only formnames is read */
+/**
+ Find where a form starts.
+
+ @param head The start of the form file.
+
+ @remark If formname is NULL then only formnames is read.
+
+ @retval The form position.
+*/
-ulong get_form_pos(File file, uchar *head, TYPELIB *save_names)
+static ulong get_form_pos(File file, uchar *head)
{
- uint a_length,names,length;
- uchar *pos,*buf;
+ uchar *pos, *buf;
+ uint names, length;
ulong ret_value=0;
DBUG_ENTER("get_form_pos");
- LINT_INIT(buf);
+ names= uint2korr(head+8);
- names=uint2korr(head+8);
- a_length=(names+2)*sizeof(char *); /* Room for two extra */
+ if (!(names= uint2korr(head+8)))
+ DBUG_RETURN(0);
- if (!save_names)
- a_length=0;
- else
- save_names->type_names=0; /* Clear if error */
+ length= uint2korr(head+4);
- if (names)
- {
- length=uint2korr(head+4);
- VOID(my_seek(file,64L,MY_SEEK_SET,MYF(0)));
- if (!(buf= (uchar*) my_malloc((size_t) length+a_length+names*4,
- MYF(MY_WME))) ||
- my_read(file, buf+a_length, (size_t) (length+names*4),
- MYF(MY_NABP)))
- { /* purecov: inspected */
- x_free((uchar*) buf); /* purecov: inspected */
- DBUG_RETURN(0L); /* purecov: inspected */
- }
- pos= buf+a_length+length;
- ret_value=uint4korr(pos);
- }
- if (! save_names)
- {
- if (names)
- my_free((uchar*) buf,MYF(0));
- }
- else if (!names)
- bzero((char*) save_names,sizeof(save_names));
- else
+ my_seek(file, 64L, MY_SEEK_SET, MYF(0));
+
+ if (!(buf= (uchar*) my_malloc(length+names*4, MYF(MY_WME))))
+ DBUG_RETURN(0);
+
+ if (my_read(file, buf, length+names*4, MYF(MY_NABP)))
{
- char *str;
- const char **tmp = (const char**) buf;
- str=(char *) (buf+a_length);
- fix_type_pointers(&tmp, save_names, 1, &str);
+ x_free(buf);
+ DBUG_RETURN(0);
}
+
+ pos= buf+length;
+ ret_value= uint4korr(pos);
+
+ my_free(buf, MYF(0));
+
DBUG_RETURN(ret_value);
}
@@ -3163,44 +3151,30 @@ bool check_db_name(LEX_STRING *org_name)
{
char *name= org_name->str;
uint name_length= org_name->length;
+ bool check_for_path_chars;
if (!name_length || name_length > NAME_LEN)
return 1;
+ if ((check_for_path_chars= check_mysql50_prefix(name)))
+ {
+ name+= MYSQL50_TABLE_NAME_PREFIX_LENGTH;
+ name_length-= MYSQL50_TABLE_NAME_PREFIX_LENGTH;
+ }
+
if (lower_case_table_names && name != any_db)
my_casedn_str(files_charset_info, name);
-#if defined(USE_MB) && defined(USE_MB_IDENT)
- if (use_mb(system_charset_info))
- {
- name_length= 0;
- bool last_char_is_space= TRUE;
- char *end= name + org_name->length;
- while (name < end)
- {
- int len;
- last_char_is_space= my_isspace(system_charset_info, *name);
- len= my_ismbchar(system_charset_info, name, end);
- if (!len)
- len= 1;
- name+= len;
- name_length++;
- }
- return (last_char_is_space || name_length > NAME_CHAR_LEN);
- }
- else
-#endif
- return ((org_name->str[org_name->length - 1] != ' ') ||
- (name_length > NAME_CHAR_LEN)); /* purecov: inspected */
+ return check_table_name(name, name_length, check_for_path_chars);
}
+
/*
Allow anything as a table name, as long as it doesn't contain an
' ' at the end
returns 1 on error
*/
-
bool check_table_name(const char *name, uint length, bool check_for_path_chars)
{
uint name_length= 0; // name length in symbols
@@ -3228,10 +3202,10 @@ bool check_table_name(const char *name, uint length, bool check_for_path_chars)
continue;
}
}
+#endif
if (check_for_path_chars &&
(*name == '/' || *name == '\\' || *name == '~' || *name == FN_EXTCHAR))
return 1;
-#endif
name++;
name_length++;
}
@@ -4864,6 +4838,27 @@ void st_table::mark_columns_used_by_index(uint index)
/*
+ Add fields used by a specified index to the table's read_set.
+
+ NOTE:
+ The original state can be restored with
+ restore_column_maps_after_mark_index().
+*/
+
+void st_table::add_read_columns_used_by_index(uint index)
+{
+ MY_BITMAP *bitmap= &tmp_set;
+ DBUG_ENTER("st_table::add_read_columns_used_by_index");
+
+ enable_keyread();
+ bitmap_copy(bitmap, read_set);
+ mark_columns_used_by_index_no_reset(index, bitmap);
+ column_bitmaps_set(bitmap, write_set);
+ DBUG_VOID_RETURN;
+}
+
+
+/*
Restore to use normal column maps after key read
NOTES
diff --git a/sql/table.h b/sql/table.h
index d2fe7ba3261..9f6006c9adc 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -408,6 +408,11 @@ typedef struct st_table_share
uint blob_ptr_size; /* 4 or 8 */
uint key_block_size; /* create key_block_size, if used */
uint null_bytes, last_null_bit_pos;
+ /*
+ Same as null_bytes, except that if there is only a 'delete-marker' in
+ the record then this value is 0.
+ */
+ uint null_bytes_for_compare;
uint fields; /* Number of fields */
/* Number of stored fields, generated-only virtual fields are not included */
uint stored_fields;
@@ -442,8 +447,8 @@ typedef struct st_table_share
bool name_lock, replace_with_name_lock;
bool waiting_on_cond; /* Protection against free */
bool deleting; /* going to delete this table */
+ bool can_cmp_whole_record;
ulong table_map_id; /* for row-based replication */
- ulonglong table_map_version;
/*
Cache for row-based replication table share checks that does not
@@ -888,6 +893,7 @@ struct st_table {
void prepare_for_position(void);
void mark_columns_used_by_index_no_reset(uint index, MY_BITMAP *map);
void mark_columns_used_by_index(uint index);
+ void add_read_columns_used_by_index(uint index);
void restore_column_maps_after_mark_index();
void mark_auto_increment_column(void);
void mark_columns_needed_for_update(void);
@@ -1217,7 +1223,7 @@ struct TABLE_LIST
}
/*
- List of tables local to a subquery (used by SQL_LIST). Considers
+ List of tables local to a subquery (used by SQL_I_List). Considers
views as leaves (unlike 'next_leaf' below). Created at parse time
in st_select_lex::add_table_to_list() -> table_list.link_in_list().
*/
@@ -1748,7 +1754,11 @@ typedef struct st_nested_join
*/
table_map used_tables;
table_map not_null_tables; /* tables that rejects nulls */
- struct st_join_table *first_nested;/* the first nested table in the plan */
+ /**
+ Used for pointing out the first table in the plan being covered by this
+ join nest. It is used exclusively within make_outerjoin_info().
+ */
+ struct st_join_table *first_nested;
/*
Used to count tables in the nested join in 2 isolated places:
1. In make_outerjoin_info().
@@ -1763,6 +1773,15 @@ typedef struct st_nested_join
*/
uint n_tables;
nested_join_map nj_map; /* Bit used to identify this nested join*/
+ /**
+ True if this join nest node is completely covered by the query execution
+ plan. This means two things.
+
+ 1. All tables on its @c join_list are covered by the plan.
+
+ 2. All child join nest nodes are fully covered.
+ */
+ bool is_fully_covered() const { return join_list.elements == counter; }
} NESTED_JOIN;
diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc
index 83c4a8ee2a0..da0c25b54dd 100644
--- a/sql/thr_malloc.cc
+++ b/sql/thr_malloc.cc
@@ -21,8 +21,6 @@
extern "C" {
void sql_alloc_error_handler(void)
{
- sql_print_error("%s", ER(ER_OUT_OF_RESOURCES));
-
THD *thd= current_thd;
if (thd)
{
@@ -49,6 +47,12 @@ extern "C" {
ER(ER_OUT_OF_RESOURCES));
}
}
+
+ /* Skip writing to the error log to avoid mtr complaints */
+ DBUG_EXECUTE_IF("simulate_out_of_memory", return;);
+
+ sql_print_error("%s", ER(ER_OUT_OF_RESOURCES));
+
}
}
diff --git a/sql/unireg.cc b/sql/unireg.cc
index a048adbef72..9859d27dd3b 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -113,7 +113,6 @@ bool mysql_create_frm(THD *thd, const char *file_name,
ulong filepos, data_offset;
uint options_len;
uchar fileinfo[64],forminfo[288],*keybuff;
- TYPELIB formnames;
uchar *screen_buff;
char buff[128];
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -124,7 +123,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
DBUG_ENTER("mysql_create_frm");
DBUG_ASSERT(*fn_rext((char*)file_name)); // Check .frm extension
- formnames.type_names=0;
+
if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,0)))
DBUG_RETURN(1);
DBUG_ASSERT(db_file != NULL);
@@ -210,8 +209,15 @@ bool mysql_create_frm(THD *thd, const char *file_name,
key_buff_length= uint4korr(fileinfo+47);
keybuff=(uchar*) my_malloc(key_buff_length, MYF(0));
key_info_length= pack_keys(keybuff, keys, key_info, data_offset);
- VOID(get_form_pos(file,fileinfo,&formnames));
- if (!(filepos=make_new_entry(file,fileinfo,&formnames,"")))
+
+ /*
+ Ensure that there are no forms in this newly created form file.
+ Even if the form file exists, create_frm must truncate it to
+ ensure one form per form file.
+ */
+ DBUG_ASSERT(uint2korr(fileinfo+8) == 0);
+
+ if (!(filepos= make_new_entry(file, fileinfo, NULL, "")))
goto err;
maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000));
int2store(forminfo+2,maxlength);
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c
index 84d4e318b49..0cf795cefdf 100644
--- a/storage/archive/archive_reader.c
+++ b/storage/archive/archive_reader.c
@@ -355,15 +355,14 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-auto-increment", 'A',
"Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.",
- (uchar**) &new_auto_increment,
- (uchar**) &new_auto_increment,
+ &new_auto_increment, &new_auto_increment,
0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's',
"Only print errors. One can use two -s to make archive_reader very silent.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't',
"Path for temporary files.",
- (uchar**) &opt_tmpdir,
+ &opt_tmpdir,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V',
"Print version and exit.",
diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c
index b6814fc1614..bc8183bf777 100644
--- a/storage/heap/hp_create.c
+++ b/storage/heap/hp_create.c
@@ -85,8 +85,6 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
keyinfo->seg[j].type= HA_KEYTYPE_VARTEXT1;
/* fall_through */
case HA_KEYTYPE_VARTEXT1:
- if (!my_binary_compare(keyinfo->seg[j].charset))
- keyinfo->flag|= HA_END_SPACE_KEY;
keyinfo->flag|= HA_VAR_LENGTH_KEY;
length+= 2;
/* Save number of bytes used to store length */
@@ -96,8 +94,6 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
/* Case-insensitiveness is handled in coll->hash_sort */
/* fall_through */
case HA_KEYTYPE_VARTEXT2:
- if (!my_binary_compare(keyinfo->seg[j].charset))
- keyinfo->flag|= HA_END_SPACE_KEY;
keyinfo->flag|= HA_VAR_LENGTH_KEY;
length+= 2;
/* Save number of bytes used to store length */
@@ -111,8 +107,6 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
default:
break;
}
- if (keyinfo->seg[j].flag & HA_END_SPACE_ARE_EQUAL)
- keyinfo->flag|= HA_END_SPACE_KEY;
}
keyinfo->length= length;
length+= keyinfo->rb_tree.size_of_element +
diff --git a/storage/heap/hp_rkey.c b/storage/heap/hp_rkey.c
index 6eeac6acd7b..27d1114770e 100644
--- a/storage/heap/hp_rkey.c
+++ b/storage/heap/hp_rkey.c
@@ -63,7 +63,7 @@ int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key,
info->update= 0;
DBUG_RETURN(my_errno);
}
- if (!(keyinfo->flag & HA_NOSAME) || (keyinfo->flag & HA_END_SPACE_KEY))
+ if (!(keyinfo->flag & HA_NOSAME))
memcpy(info->lastkey, key, (size_t) keyinfo->length);
}
memcpy(record, pos, (size_t) share->reclength);
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt.disabled
index 5918db7ab11..5918db7ab11 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt.disabled
diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
index 423c08c0569..7533205d695 100644
--- a/storage/innobase/buf/buf0flu.c
+++ b/storage/innobase/buf/buf0flu.c
@@ -55,6 +55,7 @@ buf_flush_insert_into_flush_list(
|| (ut_dulint_cmp((UT_LIST_GET_FIRST(buf_pool->flush_list))
->oldest_modification,
block->oldest_modification) <= 0));
+ UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block);
@@ -75,6 +76,7 @@ buf_flush_insert_sorted_into_flush_list(
buf_block_t* b;
ut_ad(mutex_own(&(buf_pool->mutex)));
+ UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
prev_b = NULL;
b = UT_LIST_GET_FIRST(buf_pool->flush_list);
@@ -423,6 +425,7 @@ try_again:
goto try_again;
}
+ UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
ut_memcpy(trx_doublewrite->write_buf
+ UNIV_PAGE_SIZE * trx_doublewrite->first_free,
block->frame, UNIV_PAGE_SIZE);
diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
index b8251a99105..d2b59469cdc 100644
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -618,13 +618,11 @@ dict_table_get_on_id(
if (ut_dulint_cmp(table_id, DICT_FIELDS_ID) <= 0
|| trx->dict_operation_lock_mode == RW_X_LATCH) {
- /* It is a system table which will always exist in the table
- cache: we avoid acquiring the dictionary mutex, because
- if we are doing a rollback to handle an error in TABLE
- CREATE, for example, we already have the mutex! */
- ut_ad(mutex_own(&(dict_sys->mutex))
- || trx->dict_operation_lock_mode == RW_X_LATCH);
+ /* Note: An X latch implies that the transaction
+ already owns the dictionary mutex. */
+
+ ut_ad(mutex_own(&dict_sys->mutex));
return(dict_table_get_on_id_low(table_id));
}
@@ -2586,25 +2584,28 @@ dict_strip_comments(
/* out, own: SQL string stripped from
comments; the caller must free this
with mem_free()! */
- const char* sql_string) /* in: SQL string */
+ const char* sql_string, /* in: SQL string */
+ size_t sql_length) /* in: length of sql_string */
{
char* str;
const char* sptr;
+ const char* eptr = sql_string + sql_length;
char* ptr;
/* unclosed quote character (0 if none) */
char quote = 0;
- str = mem_alloc(strlen(sql_string) + 1);
+ str = mem_alloc(sql_length + 1);
sptr = sql_string;
ptr = str;
for (;;) {
scan_more:
- if (*sptr == '\0') {
+ if (sptr >= eptr || *sptr == '\0') {
+end_of_string:
*ptr = '\0';
- ut_a(ptr <= str + strlen(sql_string));
+ ut_a(ptr <= str + sql_length);
return(str);
}
@@ -2623,30 +2624,35 @@ scan_more:
|| (sptr[0] == '-' && sptr[1] == '-'
&& sptr[2] == ' ')) {
for (;;) {
+ if (++sptr >= eptr) {
+ goto end_of_string;
+ }
+
/* In Unix a newline is 0x0A while in Windows
it is 0x0D followed by 0x0A */
- if (*sptr == (char)0x0A
- || *sptr == (char)0x0D
- || *sptr == '\0') {
-
+ switch (*sptr) {
+ case (char) 0X0A:
+ case (char) 0x0D:
+ case '\0':
goto scan_more;
}
-
- sptr++;
}
} else if (!quote && *sptr == '/' && *(sptr + 1) == '*') {
+ sptr += 2;
for (;;) {
- if (*sptr == '*' && *(sptr + 1) == '/') {
-
- sptr += 2;
-
- goto scan_more;
+ if (sptr >= eptr) {
+ goto end_of_string;
}
- if (*sptr == '\0') {
-
+ switch (*sptr) {
+ case '\0':
goto scan_more;
+ case '*':
+ if (sptr[1] == '/') {
+ sptr += 2;
+ goto scan_more;
+ }
}
sptr++;
@@ -3348,6 +3354,7 @@ dict_create_foreign_constraints(
name before it: test.table2; the
default database id the database of
parameter name */
+ size_t sql_length, /* in: length of sql_string */
const char* name, /* in: table full name in the
normalized form
database_name/table_name */
@@ -3362,7 +3369,7 @@ dict_create_foreign_constraints(
ut_a(trx);
ut_a(trx->mysql_thd);
- str = dict_strip_comments(sql_string);
+ str = dict_strip_comments(sql_string, sql_length);
heap = mem_heap_create(10000);
err = dict_create_foreign_constraints_low(
@@ -3411,7 +3418,8 @@ dict_foreign_parse_drop_constraints(
*constraints_to_drop = mem_heap_alloc(heap, 1000 * sizeof(char*));
- str = dict_strip_comments(*(trx->mysql_query_str));
+ str = dict_strip_comments(*trx->mysql_query_str,
+ *trx->mysql_query_len);
ptr = str;
ut_ad(mutex_own(&(dict_sys->mutex)));
diff --git a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c
index e1074933fe8..1ec1c262a52 100644
--- a/storage/innobase/fsp/fsp0fsp.c
+++ b/storage/innobase/fsp/fsp0fsp.c
@@ -802,12 +802,7 @@ fsp_init_file_page_low(
buf_block_align(page)->check_index_page_at_flush = FALSE;
-#ifdef UNIV_BASIC_LOG_DEBUG
- memset(page, 0xff, UNIV_PAGE_SIZE);
-#endif
- mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- ut_dulint_zero);
- mach_write_to_8(page + FIL_PAGE_LSN, ut_dulint_zero);
+ memset(page, 0, UNIV_PAGE_SIZE);
}
/***************************************************************
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index ebf01fbc296..d10fcb8d31e 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -583,13 +583,13 @@ thd_is_select(
/************************************************************************
Obtain the InnoDB transaction of a MySQL thread. */
inline
-trx_t*&
+trx_t*
thd_to_trx(
/*=======*/
/* out: reference to transaction pointer */
THD* thd) /* in: MySQL thread */
{
- return(*(trx_t**) thd_ha_data(thd, innodb_hton_ptr));
+ return((trx_t*) thd_get_ha_data(thd, innodb_hton_ptr));
}
/************************************************************************
@@ -759,6 +759,10 @@ convert_error_code_to_mysql(
} else if (error == DB_UNSUPPORTED) {
return(HA_ERR_UNSUPPORTED);
+ } else if (error == DB_INTERRUPTED) {
+
+ my_error(ER_QUERY_INTERRUPTED, MYF(0));
+ return(-1);
} else {
return(-1); // Unknown error
}
@@ -1140,6 +1144,15 @@ innobase_next_autoinc(
return(next_value);
}
+/** Copy the current SQL statement.
+* @param[in] thd MySQL client connection
+* @param[in/out] trx InnoDB transaction */
+#define INNOBASE_COPY_STMT(thd, trx) do { \
+ LEX_STRING* stmt = thd_query_string(thd); \
+ (trx)->mysql_query_str = &stmt->str; \
+ (trx)->mysql_query_len = &stmt->length; \
+} while (0)
+
/*************************************************************************
Gets the InnoDB transaction handle for a MySQL handler object, creates
an InnoDB transaction struct if the corresponding MySQL thread struct still
@@ -1151,7 +1164,7 @@ check_trx_exists(
/* out: InnoDB transaction handle */
THD* thd) /* in: user thread handle */
{
- trx_t*& trx = thd_to_trx(thd);
+ trx_t* trx = thd_to_trx(thd);
ut_ad(thd == current_thd);
@@ -1160,11 +1173,14 @@ check_trx_exists(
trx = trx_allocate_for_mysql();
trx->mysql_thd = thd;
- trx->mysql_query_str = thd_query(thd);
+ INNOBASE_COPY_STMT(thd, trx);
/* Update the info whether we should skip XA steps that eat
CPU time */
trx->support_xa = THDVAR(thd, support_xa);
+
+ /* We have a new trx, register with the thread handle */
+ thd_set_ha_data(thd, innodb_hton_ptr, trx);
} else {
if (trx->magic_n != TRX_MAGIC_N) {
mem_analyze_corruption(trx);
@@ -2469,6 +2485,9 @@ innobase_close_connection(
innobase_rollback_trx(trx);
+ /* Release the lock in thread handler */
+ thd_set_ha_data(thd, hton, NULL);
+
thr_local_free(trx->mysql_thread_id);
trx_free_for_mysql(trx);
@@ -3223,6 +3242,11 @@ get_innobase_type_from_mysql_type(
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_LONG_BLOB:
return(DATA_BLOB);
+ case MYSQL_TYPE_NULL:
+ /* MySQL currently accepts "NULL" datatype, but will
+ reject such datatype in the next release. We will cope
+ with it and not trigger assertion failure in 5.1 */
+ break;
default:
assert(0);
}
@@ -5244,7 +5268,22 @@ create_table_def(
field = form->field[i];
col_type = get_innobase_type_from_mysql_type(&unsigned_type,
- field);
+ field);
+
+ if (!col_type) {
+ push_warning_printf(
+ (THD*) trx->mysql_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_CREATE_TABLE,
+ "Error creating table '%s' with "
+ "column '%s'. Please check its "
+ "column type and try to re-create "
+ "the table with an appropriate "
+ "column type.",
+ table->name, (char*) field->field_name);
+ goto err_col;
+ }
+
if (field->null_ptr) {
nulls_allowed = 0;
} else {
@@ -5301,7 +5340,7 @@ create_table_def(
"different column name.",
table->name, (char*) field->field_name,
(char*) field->field_name);
-
+err_col:
dict_mem_table_free(table);
trx_commit_for_mysql(trx);
@@ -5578,7 +5617,7 @@ ha_innobase::create(
trx = trx_allocate_for_mysql();
trx->mysql_thd = thd;
- trx->mysql_query_str = thd_query(thd);
+ INNOBASE_COPY_STMT(thd, trx);
if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) {
trx->check_foreigns = FALSE;
@@ -5674,8 +5713,10 @@ ha_innobase::create(
}
if (*trx->mysql_query_str) {
- error = row_table_add_foreign_constraints(trx,
- *trx->mysql_query_str, norm_name,
+ error = row_table_add_foreign_constraints(
+ trx,
+ *trx->mysql_query_str, *trx->mysql_query_len,
+ norm_name,
create_info->options & HA_LEX_CREATE_TMP_TABLE);
error = convert_error_code_to_mysql(error, NULL);
@@ -5866,7 +5907,7 @@ ha_innobase::delete_table(
trx = trx_allocate_for_mysql();
trx->mysql_thd = thd;
- trx->mysql_query_str = thd_query(thd);
+ INNOBASE_COPY_STMT(thd, trx);
if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) {
trx->check_foreigns = FALSE;
@@ -5955,7 +5996,7 @@ innobase_drop_database(
#endif
trx = trx_allocate_for_mysql();
trx->mysql_thd = thd;
- trx->mysql_query_str = thd_query(thd);
+ INNOBASE_COPY_STMT(thd, trx);
if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) {
trx->check_foreigns = FALSE;
@@ -6025,7 +6066,7 @@ ha_innobase::rename_table(
trx = trx_allocate_for_mysql();
trx->mysql_thd = thd;
- trx->mysql_query_str = thd_query(thd);
+ INNOBASE_COPY_STMT(thd, trx);
if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) {
trx->check_foreigns = FALSE;
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 5b3df16875a..eb9199b8955 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -210,7 +210,7 @@ the definitions are bracketed with #ifdef INNODB_COMPATIBILITY_HOOKS */
extern "C" {
struct charset_info_st *thd_charset(MYSQL_THD thd);
-char **thd_query(MYSQL_THD thd);
+LEX_STRING *thd_query_string(MYSQL_THD thd);
/** Get the file name of the MySQL binlog.
* @return the name of the binlog file
diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h
index ed7ce151718..2be6005622d 100644
--- a/storage/innobase/include/db0err.h
+++ b/storage/innobase/include/db0err.h
@@ -10,6 +10,8 @@ Created 5/24/1996 Heikki Tuuri
#define db0err_h
+#define DB_SUCCESS_LOCKED_REC 9 /* like DB_SUCCESS, but a new
+ explicit record lock was created */
#define DB_SUCCESS 10
/* The following are error codes */
@@ -69,6 +71,9 @@ Created 5/24/1996 Heikki Tuuri
a feature that it can't recoginize or
work with e.g., FT indexes created by
a later version of the engine. */
+#define DB_INTERRUPTED 49 /* the query has been interrupted with
+ "KILL QUERY N;" */
+
/* The following are partial failure codes */
#define DB_FAIL 1000
#define DB_OVERFLOW 1001
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 7d5ff09c7a6..e76f23d0767 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -309,6 +309,7 @@ dict_create_foreign_constraints(
name before it: test.table2; the
default database id the database of
parameter name */
+ size_t sql_length, /* in: length of sql_string */
const char* name, /* in: table full name in the
normalized form
database_name/table_name */
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index beaf17eda01..70b141eafeb 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -292,14 +292,15 @@ lock_sec_rec_modify_check_and_lock(
dict_index_t* index, /* in: secondary index */
que_thr_t* thr); /* in: query thread */
/*************************************************************************
-Like the counterpart for a clustered index below, but now we read a
+Like lock_clust_rec_read_check_and_lock(), but reads a
secondary index record. */
ulint
lock_sec_rec_read_check_and_lock(
/*=============================*/
- /* out: DB_SUCCESS, DB_LOCK_WAIT,
- DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
+ /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC,
+ DB_LOCK_WAIT, DB_DEADLOCK,
+ or DB_QUE_THR_SUSPENDED */
ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set,
does nothing */
rec_t* rec, /* in: user record or page supremum record
@@ -324,8 +325,9 @@ lock on the record. */
ulint
lock_clust_rec_read_check_and_lock(
/*===============================*/
- /* out: DB_SUCCESS, DB_LOCK_WAIT,
- DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
+ /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC,
+ DB_LOCK_WAIT, DB_DEADLOCK,
+ or DB_QUE_THR_SUSPENDED */
ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set,
does nothing */
rec_t* rec, /* in: user record or page supremum record
diff --git a/storage/innobase/include/mach0data.ic b/storage/innobase/include/mach0data.ic
index dc7918c287b..fceb8017121 100644
--- a/storage/innobase/include/mach0data.ic
+++ b/storage/innobase/include/mach0data.ic
@@ -19,7 +19,7 @@ mach_write_to_1(
ulint n) /* in: ulint integer to be stored, >= 0, < 256 */
{
ut_ad(b);
- ut_ad(n <= 0xFFUL);
+ ut_ad((n | 0xFFUL) <= 0xFFUL);
b[0] = (byte)n;
}
@@ -48,7 +48,7 @@ mach_write_to_2(
ulint n) /* in: ulint integer to be stored */
{
ut_ad(b);
- ut_ad(n <= 0xFFFFUL);
+ ut_ad((n | 0xFFFFUL) <= 0xFFFFUL);
b[0] = (byte)(n >> 8);
b[1] = (byte)(n);
@@ -64,10 +64,7 @@ mach_read_from_2(
/* out: ulint integer */
byte* b) /* in: pointer to 2 bytes */
{
- ut_ad(b);
- return( ((ulint)(b[0]) << 8)
- + (ulint)(b[1])
- );
+ return(((ulint)(b[0]) << 8) | (ulint)(b[1]));
}
/************************************************************
@@ -112,7 +109,7 @@ mach_write_to_3(
ulint n) /* in: ulint integer to be stored */
{
ut_ad(b);
- ut_ad(n <= 0xFFFFFFUL);
+ ut_ad((n | 0xFFFFFFUL) <= 0xFFFFFFUL);
b[0] = (byte)(n >> 16);
b[1] = (byte)(n >> 8);
@@ -131,8 +128,8 @@ mach_read_from_3(
{
ut_ad(b);
return( ((ulint)(b[0]) << 16)
- + ((ulint)(b[1]) << 8)
- + (ulint)(b[2])
+ | ((ulint)(b[1]) << 8)
+ | (ulint)(b[2])
);
}
@@ -166,9 +163,9 @@ mach_read_from_4(
{
ut_ad(b);
return( ((ulint)(b[0]) << 24)
- + ((ulint)(b[1]) << 16)
- + ((ulint)(b[2]) << 8)
- + (ulint)(b[3])
+ | ((ulint)(b[1]) << 16)
+ | ((ulint)(b[2]) << 8)
+ | (ulint)(b[3])
);
}
@@ -670,7 +667,7 @@ mach_read_from_2_little_endian(
/* out: unsigned long int */
byte* buf) /* in: from where to read */
{
- return((ulint)(*buf) + ((ulint)(*(buf + 1))) * 256);
+ return((ulint)(buf[0]) | ((ulint)(buf[1]) << 8));
}
/*************************************************************
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index 5430190fa51..488177791a4 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -246,22 +246,20 @@ row_update_for_mysql(
row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL
handle */
/*************************************************************************
-This can only be used when srv_locks_unsafe_for_binlog is TRUE or
-session is using a READ COMMITTED isolation level. Before
-calling this function we must use trx_reset_new_rec_lock_info() and
-trx_register_new_rec_lock() to store the information which new record locks
-really were set. This function removes a newly set lock under prebuilt->pcur,
-and also under prebuilt->clust_pcur. Currently, this is only used and tested
-in the case of an UPDATE or a DELETE statement, where the row lock is of the
-LOCK_X type.
-Thus, this implements a 'mini-rollback' that releases the latest record
-locks we set. */
+This can only be used when srv_locks_unsafe_for_binlog is TRUE or this
+session is using a READ COMMITTED or READ UNCOMMITTED isolation level.
+Before calling this function row_search_for_mysql() must have
+initialized prebuilt->new_rec_locks to store the information which new
+record locks really were set. This function removes a newly set
+clustered index record lock under prebuilt->pcur or
+prebuilt->clust_pcur. Thus, this implements a 'mini-rollback' that
+releases the latest clustered index record lock we set. */
int
row_unlock_for_mysql(
/*=================*/
/* out: error code or DB_SUCCESS */
- row_prebuilt_t* prebuilt, /* in: prebuilt struct in MySQL
+ row_prebuilt_t* prebuilt, /* in/out: prebuilt struct in MySQL
handle */
ibool has_latches_on_recs);/* TRUE if called so that we have
the latches on the records under pcur
@@ -366,6 +364,7 @@ row_table_add_foreign_constraints(
FOREIGN KEY (a, b) REFERENCES table2(c, d),
table2 can be written also with the
database name before it: test.table2 */
+ size_t sql_length, /* in: length of sql_string */
const char* name, /* in: table full name in the
normalized form
database_name/table_name */
@@ -659,18 +658,17 @@ struct row_prebuilt_struct {
ulint new_rec_locks; /* normally 0; if
srv_locks_unsafe_for_binlog is
TRUE or session is using READ
- COMMITTED isolation level, in a
- cursor search, if we set a new
- record lock on an index, this is
- incremented; this is used in
- releasing the locks under the
- cursors if we are performing an
- UPDATE and we determine after
- retrieving the row that it does
- not need to be locked; thus,
- these can be used to implement a
- 'mini-rollback' that releases
- the latest record locks */
+ COMMITTED or READ UNCOMMITTED
+ isolation level, set in
+ row_search_for_mysql() if we set a new
+ record lock on the secondary
+ or clustered index; this is
+ used in row_unlock_for_mysql()
+ when releasing the lock under
+ the cursor if we determine
+ after retrieving the row that
+ it does not need to be locked
+ ('mini-rollback') */
ulint mysql_prefix_len;/* byte offset of the end of
the last requested column */
ulint mysql_row_len; /* length in bytes of a row in the
diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
index 6a61330f97e..9430d4cb723 100644
--- a/storage/innobase/include/sync0sync.h
+++ b/storage/innobase/include/sync0sync.h
@@ -401,7 +401,7 @@ or row lock! */
locked; see e.g.
ibuf_bitmap_get_map_page(). */
#define SYNC_DICT_OPERATION 1001 /* table create, drop, etc. reserve
- this in X-mode, implicit or backround
+ this in X-mode; implicit or backround
operations purge, rollback, foreign
key checks reserve this in S-mode */
#define SYNC_DICT 1000
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index cdbf1970715..97a47d9f46e 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -444,6 +444,8 @@ struct trx_struct{
char** mysql_query_str;/* pointer to the field in mysqld_thd
which contains the pointer to the
current SQL query string */
+ size_t* mysql_query_len;/* pointer to the length of the
+ current SQL query string */
const char* mysql_log_file_name;
/* if MySQL binlog is used, this field
contains a pointer to the latest file
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index ee3a0b27b20..97d022d284e 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -82,9 +82,9 @@ memory is read outside the allocated blocks. */
/* Make a non-inline debug version */
-#ifdef HAVE_purify
+#if defined HAVE_VALGRIND
# define UNIV_DEBUG_VALGRIND
-#endif /* HAVE_purify */
+#endif /* HAVE_VALGRIND */
#if 0
#define UNIV_DEBUG_VALGRIND /* Enable extra
Valgrind instrumentation */
@@ -126,11 +126,6 @@ by one. */
/* the above option prevents forcing of log to disk
at a buffer page write: it should be tested with this
option off; also some ibuf tests are suppressed */
-/*
-#define UNIV_BASIC_LOG_DEBUG
-*/
- /* the above option enables basic recovery debugging:
- new allocated file pages are reset */
#if (!defined(UNIV_DEBUG) && !defined(INSIDE_HA_INNOBASE_CC) && !defined(UNIV_MUST_NOT_INLINE))
/* Definition for inline version */
diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
index 7df8ea50887..04240960b3a 100644
--- a/storage/innobase/lock/lock0lock.c
+++ b/storage/innobase/lock/lock0lock.c
@@ -1739,11 +1739,12 @@ ulint
lock_rec_enqueue_waiting(
/*=====================*/
/* out: DB_LOCK_WAIT, DB_DEADLOCK, or
- DB_QUE_THR_SUSPENDED, or DB_SUCCESS;
- DB_SUCCESS means that there was a deadlock,
- but another transaction was chosen as a
- victim, and we got the lock immediately:
- no need to wait then */
+ DB_QUE_THR_SUSPENDED, or DB_SUCCESS_LOCKED_REC;
+ DB_SUCCESS_LOCKED_REC means that there
+ was a deadlock, but another
+ transaction was chosen as a victim,
+ and we got the lock immediately: no
+ need to wait then */
ulint type_mode,/* in: lock mode this transaction is
requesting: LOCK_S or LOCK_X, possibly ORed
with LOCK_GAP or LOCK_REC_NOT_GAP, ORed
@@ -1804,7 +1805,7 @@ lock_rec_enqueue_waiting(
if (trx->wait_lock == NULL) {
- return(DB_SUCCESS);
+ return(DB_SUCCESS_LOCKED_REC);
}
trx->que_state = TRX_QUE_LOCK_WAIT;
@@ -1903,6 +1904,16 @@ lock_rec_add_to_queue(
return(lock_rec_create(type_mode, rec, index, trx));
}
+/** Record locking request status */
+enum lock_rec_req_status {
+ /** Failed to acquire a lock */
+ LOCK_REC_FAIL,
+ /** Succeeded in acquiring a lock (implicit or already acquired) */
+ LOCK_REC_SUCCESS,
+ /** Explicitly created a new lock */
+ LOCK_REC_SUCCESS_CREATED
+};
+
/*************************************************************************
This is a fast routine for locking a record in the most common cases:
there are no explicit locks on the page, or there is just one lock, owned
@@ -1911,10 +1922,10 @@ which does NOT look at implicit locks! Checks lock compatibility within
explicit locks. This function sets a normal next-key lock, or in the case of
a page supremum record, a gap type lock. */
UNIV_INLINE
-ibool
+enum lock_rec_req_status
lock_rec_lock_fast(
/*===============*/
- /* out: TRUE if locking succeeded */
+ /* out: whether the locking succeeded */
ibool impl, /* in: if TRUE, no lock is set if no wait
is necessary: we assume that the caller will
set an implicit lock */
@@ -1950,19 +1961,19 @@ lock_rec_lock_fast(
lock_rec_create(mode, rec, index, trx);
}
- return(TRUE);
+ return(LOCK_REC_SUCCESS_CREATED);
}
if (lock_rec_get_next_on_page(lock)) {
- return(FALSE);
+ return(LOCK_REC_FAIL);
}
if (lock->trx != trx
|| lock->type_mode != (mode | LOCK_REC)
|| lock_rec_get_n_bits(lock) <= heap_no) {
- return(FALSE);
+ return(LOCK_REC_FAIL);
}
if (!impl) {
@@ -1971,10 +1982,11 @@ lock_rec_lock_fast(
if (!lock_rec_get_nth_bit(lock, heap_no)) {
lock_rec_set_nth_bit(lock, heap_no);
+ return(LOCK_REC_SUCCESS_CREATED);
}
}
- return(TRUE);
+ return(LOCK_REC_SUCCESS);
}
/*************************************************************************
@@ -1986,8 +1998,9 @@ static
ulint
lock_rec_lock_slow(
/*===============*/
- /* out: DB_SUCCESS, DB_LOCK_WAIT, or error
- code */
+ /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC,
+ DB_LOCK_WAIT, DB_DEADLOCK,
+ or DB_QUE_THR_SUSPENDED */
ibool impl, /* in: if TRUE, no lock is set if no wait is
necessary: we assume that the caller will set
an implicit lock */
@@ -1998,7 +2011,6 @@ lock_rec_lock_slow(
que_thr_t* thr) /* in: query thread */
{
trx_t* trx;
- ulint err;
ut_ad(mutex_own(&kernel_mutex));
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
@@ -2017,26 +2029,21 @@ lock_rec_lock_slow(
/* The trx already has a strong enough lock on rec: do
nothing */
- err = DB_SUCCESS;
} else if (lock_rec_other_has_conflicting(mode, rec, trx)) {
/* If another transaction has a non-gap conflicting request in
the queue, as this transaction does not have a lock strong
enough already granted on the record, we have to wait. */
- err = lock_rec_enqueue_waiting(mode, rec, index, thr);
- } else {
- if (!impl) {
- /* Set the requested lock on the record */
+ return(lock_rec_enqueue_waiting(mode, rec, index, thr));
+ } else if (!impl) {
+ /* Set the requested lock on the record */
- lock_rec_add_to_queue(LOCK_REC | mode, rec, index,
- trx);
- }
-
- err = DB_SUCCESS;
+ lock_rec_add_to_queue(LOCK_REC | mode, rec, index, trx);
+ return(DB_SUCCESS_LOCKED_REC);
}
- return(err);
+ return(DB_SUCCESS);
}
/*************************************************************************
@@ -2049,8 +2056,9 @@ static
ulint
lock_rec_lock(
/*==========*/
- /* out: DB_SUCCESS, DB_LOCK_WAIT, or error
- code */
+ /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC,
+ DB_LOCK_WAIT, DB_DEADLOCK, or
+ DB_QUE_THR_SUSPENDED */
ibool impl, /* in: if TRUE, no lock is set if no wait is
necessary: we assume that the caller will set
an implicit lock */
@@ -2060,8 +2068,6 @@ lock_rec_lock(
dict_index_t* index, /* in: index of record */
que_thr_t* thr) /* in: query thread */
{
- ulint err;
-
ut_ad(mutex_own(&kernel_mutex));
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
|| lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
@@ -2073,17 +2079,19 @@ lock_rec_lock(
|| mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP
|| mode - (LOCK_MODE_MASK & mode) == 0);
- if (lock_rec_lock_fast(impl, mode, rec, index, thr)) {
-
- /* We try a simplified and faster subroutine for the most
- common cases */
-
- err = DB_SUCCESS;
- } else {
- err = lock_rec_lock_slow(impl, mode, rec, index, thr);
+ /* We try a simplified and faster subroutine for the most
+ common cases */
+ switch (lock_rec_lock_fast(impl, mode, rec, index, thr)) {
+ case LOCK_REC_SUCCESS:
+ return(DB_SUCCESS);
+ case LOCK_REC_SUCCESS_CREATED:
+ return(DB_SUCCESS_LOCKED_REC);
+ case LOCK_REC_FAIL:
+ return(lock_rec_lock_slow(impl, mode, rec, index, thr));
}
- return(err);
+ ut_error;
+ return(DB_ERROR);
}
/*************************************************************************
@@ -4832,7 +4840,7 @@ lock_rec_insert_check_and_lock(
lock = lock_rec_get_first(next_rec);
- if (lock == NULL) {
+ if (UNIV_LIKELY(lock == NULL)) {
/* We optimize CPU time usage in the simplest case */
lock_mutex_exit_kernel();
@@ -4840,8 +4848,7 @@ lock_rec_insert_check_and_lock(
if (!(index->type & DICT_CLUSTERED)) {
/* Update the page max trx id field */
- page_update_max_trx_id(buf_frame_align(rec),
- thr_get_trx(thr)->id);
+ page_update_max_trx_id(buf_frame_align(rec), trx->id);
}
return(DB_SUCCESS);
@@ -4873,11 +4880,16 @@ lock_rec_insert_check_and_lock(
lock_mutex_exit_kernel();
- if (!(index->type & DICT_CLUSTERED) && (err == DB_SUCCESS)) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ /* fall through */
+ case DB_SUCCESS:
+ if (index->type & DICT_CLUSTERED) {
+ break;
+ }
/* Update the page max trx id field */
- page_update_max_trx_id(buf_frame_align(rec),
- thr_get_trx(thr)->id);
+ page_update_max_trx_id(buf_frame_align(rec), trx->id);
}
#ifdef UNIV_DEBUG
@@ -4984,6 +4996,10 @@ lock_clust_rec_modify_check_and_lock(
ut_ad(lock_rec_queue_validate(rec, index, offsets));
+ if (UNIV_UNLIKELY(err == DB_SUCCESS_LOCKED_REC)) {
+ err = DB_SUCCESS;
+ }
+
return(err);
}
@@ -5043,25 +5059,29 @@ lock_sec_rec_modify_check_and_lock(
}
#endif /* UNIV_DEBUG */
- if (err == DB_SUCCESS) {
+ if (err == DB_SUCCESS || err == DB_SUCCESS_LOCKED_REC) {
/* Update the page max trx id field */
-
+ /* It might not be necessary to do this if
+ err == DB_SUCCESS (no new lock created),
+ but it should not cost too much performance. */
page_update_max_trx_id(buf_frame_align(rec),
thr_get_trx(thr)->id);
+ err = DB_SUCCESS;
}
return(err);
}
/*************************************************************************
-Like the counterpart for a clustered index below, but now we read a
+Like lock_clust_rec_read_check_and_lock(), but reads a
secondary index record. */
ulint
lock_sec_rec_read_check_and_lock(
/*=============================*/
- /* out: DB_SUCCESS, DB_LOCK_WAIT,
- DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
+ /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC,
+ DB_LOCK_WAIT, DB_DEADLOCK,
+ or DB_QUE_THR_SUSPENDED */
ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set,
does nothing */
rec_t* rec, /* in: user record or page supremum record
@@ -5126,8 +5146,9 @@ lock on the record. */
ulint
lock_clust_rec_read_check_and_lock(
/*===============================*/
- /* out: DB_SUCCESS, DB_LOCK_WAIT,
- DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
+ /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC,
+ DB_LOCK_WAIT, DB_DEADLOCK,
+ or DB_QUE_THR_SUSPENDED */
ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set,
does nothing */
rec_t* rec, /* in: user record or page supremum record
@@ -5206,16 +5227,21 @@ lock_clust_rec_read_check_and_lock_alt(
mem_heap_t* tmp_heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
- ulint ret;
+ ulint err;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &tmp_heap);
- ret = lock_clust_rec_read_check_and_lock(flags, rec, index,
+ err = lock_clust_rec_read_check_and_lock(flags, rec, index,
offsets, mode, gap_mode, thr);
if (tmp_heap) {
mem_heap_free(tmp_heap);
}
- return(ret);
+
+ if (UNIV_UNLIKELY(err == DB_SUCCESS_LOCKED_REC)) {
+ err = DB_SUCCESS;
+ }
+
+ return(err);
}
diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c
index 51c295b5098..9786f90fd39 100644
--- a/storage/innobase/row/row0ins.c
+++ b/storage/innobase/row/row0ins.c
@@ -1114,7 +1114,8 @@ static
ulint
row_ins_set_shared_rec_lock(
/*========================*/
- /* out: DB_SUCCESS or error code */
+ /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC,
+ or error code */
ulint type, /* in: LOCK_ORDINARY, LOCK_GAP, or
LOCK_REC_NOT_GAP type lock */
rec_t* rec, /* in: record */
@@ -1145,7 +1146,8 @@ static
ulint
row_ins_set_exclusive_rec_lock(
/*===========================*/
- /* out: DB_SUCCESS or error code */
+ /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC,
+ or error code */
ulint type, /* in: LOCK_ORDINARY, LOCK_GAP, or
LOCK_REC_NOT_GAP type lock */
rec_t* rec, /* in: record */
@@ -1195,9 +1197,7 @@ row_ins_check_foreign_constraint(
dict_table_t* check_table;
dict_index_t* check_index;
ulint n_fields_cmp;
- rec_t* rec;
btr_pcur_t pcur;
- ibool moved;
int cmp;
ulint err;
ulint i;
@@ -1328,12 +1328,12 @@ run_again:
/* Scan index records and check if there is a matching record */
- for (;;) {
- rec = btr_pcur_get_rec(&pcur);
+ do {
+ rec_t* rec = btr_pcur_get_rec(&pcur);
if (page_rec_is_infimum(rec)) {
- goto next_rec;
+ continue;
}
offsets = rec_get_offsets(rec, check_index,
@@ -1343,12 +1343,13 @@ run_again:
err = row_ins_set_shared_rec_lock(
LOCK_ORDINARY, rec, check_index, offsets, thr);
- if (err != DB_SUCCESS) {
-
- break;
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ continue;
+ default:
+ goto end_scan;
}
-
- goto next_rec;
}
cmp = cmp_dtuple_rec(entry, rec, offsets);
@@ -1359,9 +1360,12 @@ run_again:
err = row_ins_set_shared_rec_lock(
LOCK_ORDINARY, rec, check_index,
offsets, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
break;
+ default:
+ goto end_scan;
}
} else {
/* Found a matching record. Lock only
@@ -1372,15 +1376,18 @@ run_again:
LOCK_REC_NOT_GAP, rec, check_index,
offsets, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
break;
+ default:
+ goto end_scan;
}
if (check_ref) {
err = DB_SUCCESS;
- break;
+ goto end_scan;
} else if (foreign->type != 0) {
/* There is an ON UPDATE or ON DELETE
condition: check them in a separate
@@ -1406,7 +1413,7 @@ run_again:
err = DB_FOREIGN_DUPLICATE_KEY;
}
- break;
+ goto end_scan;
}
} else {
row_ins_foreign_report_err(
@@ -1414,48 +1421,39 @@ run_again:
thr, foreign, rec, entry);
err = DB_ROW_IS_REFERENCED;
- break;
+ goto end_scan;
}
}
- }
+ } else {
+ ut_a(cmp < 0);
- if (cmp < 0) {
err = row_ins_set_shared_rec_lock(
LOCK_GAP, rec, check_index, offsets, thr);
- if (err != DB_SUCCESS) {
-
- break;
- }
-
- if (check_ref) {
- err = DB_NO_REFERENCED_ROW;
- row_ins_foreign_report_add_err(
- trx, foreign, rec, entry);
- } else {
- err = DB_SUCCESS;
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ if (check_ref) {
+ err = DB_NO_REFERENCED_ROW;
+ row_ins_foreign_report_add_err(
+ trx, foreign, rec, entry);
+ } else {
+ err = DB_SUCCESS;
+ }
}
- break;
+ goto end_scan;
}
+ } while (btr_pcur_move_to_next(&pcur, &mtr));
- ut_a(cmp == 0);
-next_rec:
- moved = btr_pcur_move_to_next(&pcur, &mtr);
-
- if (!moved) {
- if (check_ref) {
- rec = btr_pcur_get_rec(&pcur);
- row_ins_foreign_report_add_err(
- trx, foreign, rec, entry);
- err = DB_NO_REFERENCED_ROW;
- } else {
- err = DB_SUCCESS;
- }
-
- break;
- }
+ if (check_ref) {
+ row_ins_foreign_report_add_err(
+ trx, foreign, btr_pcur_get_rec(&pcur), entry);
+ err = DB_NO_REFERENCED_ROW;
+ } else {
+ err = DB_SUCCESS;
}
+end_scan:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -1641,10 +1639,8 @@ row_ins_scan_sec_index_for_duplicate(
ulint i;
int cmp;
ulint n_fields_cmp;
- rec_t* rec;
btr_pcur_t pcur;
ulint err = DB_SUCCESS;
- ibool moved;
unsigned allow_duplicates;
mtr_t mtr;
mem_heap_t* heap = NULL;
@@ -1680,12 +1676,12 @@ row_ins_scan_sec_index_for_duplicate(
/* Scan index records and check if there is a duplicate */
- for (;;) {
- rec = btr_pcur_get_rec(&pcur);
+ do {
+ rec_t* rec = btr_pcur_get_rec(&pcur);
if (page_rec_is_infimum(rec)) {
- goto next_rec;
+ continue;
}
offsets = rec_get_offsets(rec, index, offsets,
@@ -1706,14 +1702,18 @@ row_ins_scan_sec_index_for_duplicate(
LOCK_ORDINARY, rec, index, offsets, thr);
}
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
break;
+ default:
+ goto end_scan;
}
if (page_rec_is_supremum(rec)) {
- goto next_rec;
+ continue;
}
cmp = cmp_dtuple_rec(entry, rec, offsets);
@@ -1725,23 +1725,15 @@ row_ins_scan_sec_index_for_duplicate(
thr_get_trx(thr)->error_info = index;
- break;
+ goto end_scan;
}
+ } else {
+ ut_a(cmp < 0);
+ goto end_scan;
}
+ } while (btr_pcur_move_to_next(&pcur, &mtr));
- if (cmp < 0) {
- break;
- }
-
- ut_a(cmp == 0);
-next_rec:
- moved = btr_pcur_move_to_next(&pcur, &mtr);
-
- if (!moved) {
- break;
- }
- }
-
+end_scan:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1837,7 +1829,11 @@ row_ins_duplicate_error_in_clust(
cursor->index, offsets, thr);
}
- if (err != DB_SUCCESS) {
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ break;
+ default:
goto func_exit;
}
@@ -1875,7 +1871,11 @@ row_ins_duplicate_error_in_clust(
cursor->index, offsets, thr);
}
- if (err != DB_SUCCESS) {
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ break;
+ default:
goto func_exit;
}
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
index a0e0ee99775..4a834c4efc2 100644
--- a/storage/innobase/row/row0mysql.c
+++ b/storage/innobase/row/row0mysql.c
@@ -483,6 +483,7 @@ handle_new_error:
} else if (err == DB_ROW_IS_REFERENCED
|| err == DB_NO_REFERENCED_ROW
|| err == DB_CANNOT_ADD_CONSTRAINT
+ || err == DB_INTERRUPTED
|| err == DB_TOO_MANY_CONCURRENT_TRXS) {
if (savept) {
/* Roll back the latest, possibly incomplete
@@ -1454,22 +1455,20 @@ run_again:
}
/*************************************************************************
-This can only be used when srv_locks_unsafe_for_binlog is TRUE or
-this session is using a READ COMMITTED isolation level. Before
-calling this function we must use trx_reset_new_rec_lock_info() and
-trx_register_new_rec_lock() to store the information which new record locks
-really were set. This function removes a newly set lock under prebuilt->pcur,
-and also under prebuilt->clust_pcur. Currently, this is only used and tested
-in the case of an UPDATE or a DELETE statement, where the row lock is of the
-LOCK_X type.
-Thus, this implements a 'mini-rollback' that releases the latest record
-locks we set. */
+This can only be used when srv_locks_unsafe_for_binlog is TRUE or this
+session is using a READ COMMITTED or READ UNCOMMITTED isolation level.
+Before calling this function row_search_for_mysql() must have
+initialized prebuilt->new_rec_locks to store the information which new
+record locks really were set. This function removes a newly set
+clustered index record lock under prebuilt->pcur or
+prebuilt->clust_pcur. Thus, this implements a 'mini-rollback' that
+releases the latest clustered index record lock we set. */
int
row_unlock_for_mysql(
/*=================*/
/* out: error code or DB_SUCCESS */
- row_prebuilt_t* prebuilt, /* in: prebuilt struct in MySQL
+ row_prebuilt_t* prebuilt, /* in/out: prebuilt struct in MySQL
handle */
ibool has_latches_on_recs)/* TRUE if called so that we have
the latches on the records under pcur
@@ -2103,6 +2102,7 @@ row_table_add_foreign_constraints(
FOREIGN KEY (a, b) REFERENCES table2(c, d),
table2 can be written also with the
database name before it: test.table2 */
+ size_t sql_length, /* in: length of sql_string */
const char* name, /* in: table full name in the
normalized form
database_name/table_name */
@@ -2124,8 +2124,8 @@ row_table_add_foreign_constraints(
trx->dict_operation = TRUE;
- err = dict_create_foreign_constraints(trx, sql_string, name,
- reject_fks);
+ err = dict_create_foreign_constraints(trx, sql_string, sql_length,
+ name, reject_fks);
if (err == DB_SUCCESS) {
/* Check that also referencing constraints are ok */
diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
index 1d30249c53e..06a19ba7979 100644
--- a/storage/innobase/row/row0sel.c
+++ b/storage/innobase/row/row0sel.c
@@ -754,8 +754,14 @@ row_sel_get_clust_rec(
0, clust_rec, index, offsets,
node->row_lock_mode, lock_type, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS:
+ case DB_SUCCESS_LOCKED_REC:
+ /* Declare the variable uninitialized in Valgrind.
+ It should be set to DB_SUCCESS at func_exit. */
+ UNIV_MEM_INVALID(&err, sizeof err);
+ break;
+ default:
goto err_exit;
}
} else {
@@ -826,7 +832,8 @@ UNIV_INLINE
ulint
sel_set_rec_lock(
/*=============*/
- /* out: DB_SUCCESS or error code */
+ /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC,
+ or error code */
rec_t* rec, /* in: record */
dict_index_t* index, /* in: index */
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
@@ -1374,11 +1381,15 @@ rec_loop:
node->row_lock_mode,
lock_type, thr);
- if (err != DB_SUCCESS) {
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
+ break;
+ default:
/* Note that in this case we will store in pcur
the PREDECESSOR of the record we are waiting
the lock for */
-
goto lock_wait_or_error;
}
}
@@ -1429,8 +1440,12 @@ skip_lock:
err = sel_set_rec_lock(rec, index, offsets,
node->row_lock_mode, lock_type, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
+ break;
+ default:
goto lock_wait_or_error;
}
}
@@ -2452,6 +2467,7 @@ row_sel_field_store_in_mysql_format(
byte* pad_ptr;
ut_ad(len != UNIV_SQL_NULL);
+ UNIV_MEM_ASSERT_RW(data, len);
if (templ->type == DATA_INT) {
/* Convert integer data from Innobase to a little-endian
@@ -2605,6 +2621,12 @@ row_sel_store_mysql_rec(
prebuilt->blob_heap = NULL;
}
+ /* init null bytes with default values as they might be
+ left uninitialized in some cases and this uninited bytes
+ might be copied into mysql record buffer that leads to
+ valgrind warnings */
+ memcpy(mysql_rec, prebuilt->default_rec, prebuilt->null_bitmap_len);
+
for (i = 0; i < prebuilt->n_template; i++) {
templ = prebuilt->mysql_template + i;
@@ -2687,6 +2709,9 @@ row_sel_store_mysql_rec(
/* MySQL assumes that the field for an SQL
NULL value is set to the default value. */
+ UNIV_MEM_ASSERT_RW(prebuilt->default_rec
+ + templ->mysql_col_offset,
+ templ->mysql_col_len);
mysql_rec[templ->mysql_null_byte_offset]
|= (byte) templ->mysql_null_bit_mask;
memcpy(mysql_rec + templ->mysql_col_offset,
@@ -2741,7 +2766,8 @@ static
ulint
row_sel_get_clust_rec_for_mysql(
/*============================*/
- /* out: DB_SUCCESS or error code */
+ /* out: DB_SUCCESS, DB_SUCCESS_LOCKED_REC,
+ or error code */
row_prebuilt_t* prebuilt,/* in: prebuilt struct in the handle */
dict_index_t* sec_index,/* in: secondary index where rec resides */
rec_t* rec, /* in: record in a non-clustered index; if
@@ -2822,6 +2848,7 @@ row_sel_get_clust_rec_for_mysql(
clust_rec = NULL;
+ err = DB_SUCCESS;
goto func_exit;
}
@@ -2836,8 +2863,11 @@ row_sel_get_clust_rec_for_mysql(
err = lock_clust_rec_read_check_and_lock(
0, clust_rec, clust_index, *offsets,
prebuilt->select_lock_type, LOCK_REC_NOT_GAP, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS:
+ case DB_SUCCESS_LOCKED_REC:
+ break;
+ default:
goto err_exit;
}
} else {
@@ -2896,6 +2926,8 @@ row_sel_get_clust_rec_for_mysql(
rec, sec_index, clust_rec, clust_index));
#endif
}
+
+ err = DB_SUCCESS;
}
func_exit:
@@ -2908,7 +2940,6 @@ func_exit:
btr_pcur_store_position(prebuilt->clust_pcur, mtr);
}
- err = DB_SUCCESS;
err_exit:
return(err);
}
@@ -3007,6 +3038,11 @@ row_sel_pop_cached_row_for_mysql(
for (i = 0; i < prebuilt->n_template; i++) {
templ = prebuilt->mysql_template + i;
+#if 0 /* Some of the cached_rec may legitimately be uninitialized. */
+ UNIV_MEM_ASSERT_RW(cached_rec
+ + templ->mysql_col_offset,
+ templ->mysql_col_len);
+#endif
ut_memcpy(buf + templ->mysql_col_offset,
cached_rec + templ->mysql_col_offset,
templ->mysql_col_len);
@@ -3021,6 +3057,11 @@ row_sel_pop_cached_row_for_mysql(
}
}
else {
+#if 0 /* Some of the cached_rec may legitimately be uninitialized. */
+ UNIV_MEM_ASSERT_RW(prebuilt->fetch_cache
+ [prebuilt->fetch_cache_first],
+ prebuilt->mysql_prefix_len);
+#endif
ut_memcpy(buf,
prebuilt->fetch_cache[prebuilt->fetch_cache_first],
prebuilt->mysql_prefix_len);
@@ -3070,6 +3111,8 @@ row_sel_push_cache_row_for_mysql(
}
ut_ad(prebuilt->fetch_cache_first == 0);
+ UNIV_MEM_INVALID(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
+ prebuilt->mysql_row_len);
if (UNIV_UNLIKELY(!row_sel_store_mysql_rec(
prebuilt->fetch_cache[
@@ -3610,8 +3653,12 @@ shortcut_fails_too_big_rec:
prebuilt->select_lock_type,
LOCK_GAP, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
+ break;
+ default:
goto lock_wait_or_error;
}
}
@@ -3708,8 +3755,12 @@ rec_loop:
prebuilt->select_lock_type,
LOCK_ORDINARY, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
+ break;
+ default:
goto lock_wait_or_error;
}
}
@@ -3840,8 +3891,11 @@ wrong_offs:
prebuilt->select_lock_type, LOCK_GAP,
thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ break;
+ default:
goto lock_wait_or_error;
}
}
@@ -3875,8 +3929,11 @@ wrong_offs:
prebuilt->select_lock_type, LOCK_GAP,
thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ break;
+ default:
goto lock_wait_or_error;
}
}
@@ -3945,15 +4002,21 @@ no_gap_lock:
switch (err) {
rec_t* old_vers;
- case DB_SUCCESS:
+ case DB_SUCCESS_LOCKED_REC:
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level
+ <= TRX_ISO_READ_COMMITTED) {
/* Note that a record of
prebuilt->index was locked. */
prebuilt->new_rec_locks = 1;
}
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
break;
case DB_LOCK_WAIT:
+ /* Never unlock rows that were part of a conflict. */
+ prebuilt->new_rec_locks = 0;
+
if (UNIV_LIKELY(prebuilt->row_read_type
!= ROW_READ_TRY_SEMI_CONSISTENT)
|| unique_search
@@ -3983,7 +4046,6 @@ no_gap_lock:
if (UNIV_LIKELY(trx->wait_lock != NULL)) {
lock_cancel_waiting_and_release(
trx->wait_lock);
- prebuilt->new_rec_locks = 0;
} else {
mutex_exit(&kernel_mutex);
@@ -3995,9 +4057,6 @@ no_gap_lock:
ULINT_UNDEFINED,
&heap);
err = DB_SUCCESS;
- /* Note that a record of
- prebuilt->index was locked. */
- prebuilt->new_rec_locks = 1;
break;
}
mutex_exit(&kernel_mutex);
@@ -4135,27 +4194,30 @@ requires_clust_rec:
err = row_sel_get_clust_rec_for_mysql(prebuilt, index, rec,
thr, &clust_rec,
&offsets, &heap, &mtr);
- if (err != DB_SUCCESS) {
+ switch (err) {
+ case DB_SUCCESS:
+ if (clust_rec == NULL) {
+ /* The record did not exist in the read view */
+ ut_ad(prebuilt->select_lock_type == LOCK_NONE);
+ goto next_rec;
+ }
+ break;
+ case DB_SUCCESS_LOCKED_REC:
+ ut_a(clust_rec != NULL);
+ if (srv_locks_unsafe_for_binlog
+ || trx->isolation_level
+ <= TRX_ISO_READ_COMMITTED) {
+ /* Note that the clustered index record
+ was locked. */
+ prebuilt->new_rec_locks = 2;
+ }
+ err = DB_SUCCESS;
+ break;
+ default:
goto lock_wait_or_error;
}
- if (clust_rec == NULL) {
- /* The record did not exist in the read view */
- ut_ad(prebuilt->select_lock_type == LOCK_NONE);
-
- goto next_rec;
- }
-
- if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE) {
- /* Note that both the secondary index record
- and the clustered index record were locked. */
- ut_ad(prebuilt->new_rec_locks == 1);
- prebuilt->new_rec_locks = 2;
- }
-
if (UNIV_UNLIKELY(rec_get_deleted_flag(clust_rec, comp))) {
/* The record is delete marked: we can skip it */
diff --git a/storage/innobase/row/row0undo.c b/storage/innobase/row/row0undo.c
index f03f84ed1b0..7f31fd0060c 100644
--- a/storage/innobase/row/row0undo.c
+++ b/storage/innobase/row/row0undo.c
@@ -272,7 +272,7 @@ row_undo(
if (locked_data_dict) {
- row_mysql_lock_data_dictionary(trx);
+ row_mysql_freeze_data_dictionary(trx);
}
if (node->state == UNDO_NODE_INSERT) {
@@ -287,7 +287,7 @@ row_undo(
if (locked_data_dict) {
- row_mysql_unlock_data_dictionary(trx);
+ row_mysql_unfreeze_data_dictionary(trx);
}
/* Do some cleanup */
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index a2eed3f171c..5b1184fb416 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -1554,12 +1554,16 @@ srv_suspend_mysql_thread(
mutex_exit(&kernel_mutex);
- if (trx_is_interrupted(trx)
- || (srv_lock_wait_timeout < 100000000
- && wait_time > (double)srv_lock_wait_timeout)) {
+ if (srv_lock_wait_timeout < 100000000
+ && wait_time > (double)srv_lock_wait_timeout) {
trx->error_state = DB_LOCK_WAIT_TIMEOUT;
}
+
+ if (trx_is_interrupted(trx)) {
+
+ trx->error_state = DB_INTERRUPTED;
+ }
#else /* UNIV_HOTBACKUP */
/* This function depends on MySQL code that is not included in
InnoDB Hot Backup builds. Besides, this function should never
diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
index a7950473a17..9d057110d11 100644
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
@@ -102,20 +102,6 @@ static char* srv_monitor_file_name;
#define SRV_MAX_N_PENDING_SYNC_IOS 100
-/* Avoid warnings when using purify */
-
-#ifdef HAVE_purify
-static int inno_bcmp(register const char *s1, register const char *s2,
- register uint len)
-{
- while ((len-- != 0) && (*s1++ == *s2++))
- ;
-
- return(len + 1);
-}
-#define memcmp(A,B,C) inno_bcmp((A),(B),(C))
-#endif
-
static
char*
srv_parse_megabytes(
diff --git a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
index fae479feddc..545226a5994 100644
--- a/storage/innobase/trx/trx0trx.c
+++ b/storage/innobase/trx/trx0trx.c
@@ -131,6 +131,8 @@ trx_create(
trx->mysql_thd = NULL;
trx->mysql_query_str = NULL;
+ trx->mysql_query_len = NULL;
+
trx->active_trans = 0;
trx->duplicates = 0;
@@ -936,6 +938,7 @@ trx_commit_off_kernel(
trx->undo_no = ut_dulint_zero;
trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
trx->mysql_query_str = NULL;
+ trx->mysql_query_len = NULL;
ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
ut_ad(UT_LIST_GET_LEN(trx->trx_locks) == 0);
diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog
index bc69aaca96a..5ebcf1e87a2 100644
--- a/storage/innodb_plugin/ChangeLog
+++ b/storage/innodb_plugin/ChangeLog
@@ -1,3 +1,128 @@
+2010-06-24 The InnoDB Team
+
+ * handler/ha_innodb.cc:
+ Fix Bug#54679 alter table causes compressed row_format to revert
+ to compact
+
+2010-06-22 The InnoDB Team
+
+ * dict/dict0dict.c, dict/dict0mem.c, include/dict0mem.h,
+ include/univ.i, page/page0zip.c, row/row0merge.c:
+ Fix Bug#47991 InnoDB Dictionary Cache memory usage increases
+ indefinitely when renaming tables
+
+2010-06-22 The InnoDB Team
+
+ * handler/ha_innodb.cc:
+ Fix Bug#54686: "field->col->mtype == type" assertion error at
+ row/row0sel.c
+
+2010-06-22 The InnoDB Team
+
+ * handler/ha_innodb.cc, innodb_bug54044.result, innodb_bug54044.test:
+ Fix Bug#54044 Create temporary tables and using innodb crashes.
+
+2010-06-21 The InnoDB Team
+
+ * dict/dict0load.c, fil/fil0fil.c:
+ Fix Bug#54658: InnoDB: Warning: allocated tablespace %lu,
+ old maximum was 0 (introduced in Bug #53578 fix)
+
+2010-06-16 The InnoDB Team
+
+ * row/row0merge.c:
+ Fix Bug#54330 Broken fast index creation
+
+2010-06-10 The InnoDB Team
+
+ * include/log0log.ic, row/row0ins.c, row/row0purge.c,
+ row/row0uins.c, row/row0umod.c, row/row0upd.c:
+ Fix Bug#39168 ERROR: the age of the last checkpoint ... exceeds
+ the log group capacity
+
+2010-06-08 The InnoDB Team
+
+ * dict/dict0load.c:
+ Fix Bug#54009 Server crashes when data is selected from non backed
+ up table for InnoDB plugin
+
+2010-06-02 The InnoDB Team
+
+ * include/db0err.h, include/lock0lock.h, include/row0mysql.h,
+ lock/lock0lock.c, row/row0ins.c, row/row0mysql.c, row/row0sel.c:
+ Fix Bug#53674 InnoDB: Error: unlock row could not find a
+ 4 mode lock on the record
+
+2010-06-01 The InnoDB Team
+
+ * include/sync0rw.h, sync/sync0rw.c:
+ Fix Bug#48197 Concurrent rw_lock_free may cause assertion failure
+
+2010-06-01 The InnoDB Team
+
+ * row/row0umod.c:
+ Fix Bug#53812 assert row/row0umod.c line 660 in txn rollback
+ after crash recovery
+
+2010-05-25 The InnoDB Team
+
+ * handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c:
+ Fix Bug#53592: crash replacing duplicates into table after fast
+ alter table added unique key
+
+2010-05-24 The InnoDB Team
+
+ * dict/dict0boot.c, dict/dict0crea.c, fil/fil0fil.c,
+ include/dict0boot.h, include/fil0fil.h, row/row0mysql.c:
+ Fix Bug#53578: assert on invalid page access, in fil_io()
+
+2010-05-14 The InnoDB Team
+ * mysql-test/innodb_bug48024.test, mysql-test/innodb_bug48024.result,
+ dict/dict0dict.c, handler/ha_innodb.cc, handler/ha_innodb.h,
+ include/dict0dict.h, include/ha_prototypes.h, include/row0mysql.h,
+ include/trx0trx.h, row/row0mysql.c, trx/trx0i_s.c, trx/trx0trx.c:
+ Fix Bug#48024 Innodb doesn't work with multi-statements
+ Fix Bug#53644 InnoDB thinks that /*/ starts and ends a comment
+
+2010-05-12 The InnoDB Team
+
+ * handler/handler0alter.cc:
+ Fix Bug#53591 crash with fast alter table and text/blob prefix
+ primary key
+
+2010-05-12 The InnoDB Team
+
+ * row/row0merge.c:
+ Fix Bug#53471 row_merge_drop_temp_indexes() refers freed memory, SEGVs
+
+2010-05-11 The InnoDB Team
+
+ * mysql-test/innodb_bug53290.test, mysql-test/innodb_bug53290.result,
+ include/rem0cmp.h, rem/rem0cmp.c, row/row0merge.c:
+ Fix Bug#53290 wrong duplicate key error when adding a unique index
+ via fast alter table
+
+2010-05-11 The InnoDB Team
+ * buf/buf0lru.c, include/buf0buf.ic:
+ Fix Bug#53307 valgrind: warnings in main.partition_innodb_plugin
+
+2010-05-05 The InnoDB Team
+
+ * row/row0merge.c:
+ Fix Bug#53256 in a stress test, assert dict/dict0dict.c:815
+ table2 == NULL
+
+2010-05-05 The InnoDB Team
+
+ * handler/ha_innodb.cc:
+ Fix Bug#53165 Setting innodb_change_buffering=DEFAULT produces
+ incorrect result
+
+2010-05-04 The InnoDB Team
+
+ * fsp/fsp0fsp.c:
+ Fix Bug#53306 valgrind: warnings in innodb.innodb
+
2010-05-03 The InnoDB Team
* buf0buf.c:
@@ -48,12 +173,6 @@
Only check the record size at index creation time when
innodb_strict_mode is set or when ROW_FORMAT is DYNAMIC or COMPRESSED.
-2010-04-20 The InnoDB Team
-
- * btr/btr0btr.c, include/univ.i:
- Implement UNIV_BTR_AVOID_COPY, for avoiding writes when a B-tree
- node is split at the first or last record.
-
2010-04-15 The InnoDB Team
* trx/trx0rec.c:
@@ -72,6 +191,10 @@
* mysql-test/innodb_bug38231.test:
Remove non-determinism in the test case.
+2010-03-29 The InnoDB Team
+
+ InnoDB Plugin 1.0.7 released
+
2010-03-18 The InnoDB Team
* CMakeLists.txt:
@@ -194,6 +317,14 @@
Fix Bug#49497 Error 1467 (ER_AUTOINC_READ_FAILED) on inserting
a negative value
+2010-01-28 The InnoDB Team
+ * handler/ha_innodb.h, handler/ha_innodb.cc,
+ handler/handler0alter.cc,
+ mysql-test/innodb_bug47622.test,
+ mysql-test/innodb_bug47622.result:
+ Fix Bug#47622 the new index is added before the existing ones
+ in MySQL, but after one in SE
+
2010-01-27 The InnoDB Team
* include/row0mysql.h, log/log0recv.c, row/row0mysql.c:
diff --git a/storage/innodb_plugin/btr/btr0btr.c b/storage/innodb_plugin/btr/btr0btr.c
index 96fcc2ed821..02677e0a71c 100644
--- a/storage/innodb_plugin/btr/btr0btr.c
+++ b/storage/innodb_plugin/btr/btr0btr.c
@@ -2000,6 +2000,7 @@ func_start:
goto insert_empty;
}
} else if (UNIV_UNLIKELY(insert_left)) {
+ ut_a(n_iterations > 0);
first_rec = page_rec_get_next(page_get_infimum_rec(page));
move_limit = page_rec_get_next(btr_cur_get_rec(cursor));
} else {
@@ -2046,17 +2047,7 @@ insert_empty:
}
/* 5. Move then the records to the new page */
- if (direction == FSP_DOWN
-#ifdef UNIV_BTR_AVOID_COPY
- && page_rec_is_supremum(move_limit)) {
- /* Instead of moving all records, make the new page
- the empty page. */
-
- left_block = block;
- right_block = new_block;
- } else if (direction == FSP_DOWN
-#endif /* UNIV_BTR_AVOID_COPY */
- ) {
+ if (direction == FSP_DOWN) {
/* fputs("Split left\n", stderr); */
if (0
@@ -2099,14 +2090,6 @@ insert_empty:
right_block = block;
lock_update_split_left(right_block, left_block);
-#ifdef UNIV_BTR_AVOID_COPY
- } else if (!split_rec) {
- /* Instead of moving all records, make the new page
- the empty page. */
-
- left_block = new_block;
- right_block = block;
-#endif /* UNIV_BTR_AVOID_COPY */
} else {
/* fputs("Split right\n", stderr); */
diff --git a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c
index 0e603fdca8f..50531ad3bd7 100644
--- a/storage/innodb_plugin/btr/btr0cur.c
+++ b/storage/innodb_plugin/btr/btr0cur.c
@@ -1959,9 +1959,8 @@ any_extern:
err = btr_cur_upd_lock_and_undo(flags, cursor, update, cmpl_info,
thr, mtr, &roll_ptr);
if (err != DB_SUCCESS) {
-err_exit:
- mem_heap_free(heap);
- return(err);
+
+ goto err_exit;
}
/* Ok, we may do the replacement. Store on the page infimum the
@@ -2007,9 +2006,10 @@ err_exit:
page_cur_move_to_next(page_cursor);
+ err = DB_SUCCESS;
+err_exit:
mem_heap_free(heap);
-
- return(DB_SUCCESS);
+ return(err);
}
/*************************************************************//**
@@ -3871,6 +3871,8 @@ btr_store_big_rec_extern_fields(
field_ref += local_len;
}
extern_len = big_rec_vec->fields[i].len;
+ UNIV_MEM_ASSERT_RW(big_rec_vec->fields[i].data,
+ extern_len);
ut_a(extern_len > 0);
@@ -4507,6 +4509,7 @@ btr_copy_blob_prefix(
mtr_commit(&mtr);
if (page_no == FIL_NULL || copy_len != part_len) {
+ UNIV_MEM_ASSERT_RW(buf, copied_len);
return(copied_len);
}
@@ -4690,6 +4693,7 @@ btr_copy_externally_stored_field_prefix_low(
space_id, page_no, offset);
inflateEnd(&d_stream);
mem_heap_free(heap);
+ UNIV_MEM_ASSERT_RW(buf, d_stream.total_out);
return(d_stream.total_out);
} else {
return(btr_copy_blob_prefix(buf, len, space_id,
diff --git a/storage/innodb_plugin/btr/btr0sea.c b/storage/innodb_plugin/btr/btr0sea.c
index ef7afeb1039..c91afa31bf0 100644
--- a/storage/innodb_plugin/btr/btr0sea.c
+++ b/storage/innodb_plugin/btr/btr0sea.c
@@ -182,6 +182,7 @@ void
btr_search_sys_free(void)
/*=====================*/
{
+ rw_lock_free(&btr_search_latch);
mem_free(btr_search_latch_temp);
btr_search_latch_temp = NULL;
mem_heap_free(btr_search_sys->hash_index->heap);
diff --git a/storage/innodb_plugin/buf/buf0buddy.c b/storage/innodb_plugin/buf/buf0buddy.c
index 66d802f8a36..ee5a569c3ff 100644
--- a/storage/innodb_plugin/buf/buf0buddy.c
+++ b/storage/innodb_plugin/buf/buf0buddy.c
@@ -442,11 +442,15 @@ buf_buddy_relocate(
pool), so there is nothing wrong about this. The
mach_read_from_4() calls here will only trigger bogus
Valgrind memcheck warnings in UNIV_DEBUG_VALGRIND builds. */
- bpage = buf_page_hash_get(
- mach_read_from_4((const byte*) src
- + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID),
- mach_read_from_4((const byte*) src
- + FIL_PAGE_OFFSET));
+ ulint space = mach_read_from_4(
+ (const byte*) src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ ulint page_no = mach_read_from_4(
+ (const byte*) src + FIL_PAGE_OFFSET);
+ /* Suppress Valgrind warnings about conditional jump
+ on uninitialized value. */
+ UNIV_MEM_VALID(&space, sizeof space);
+ UNIV_MEM_VALID(&page_no, sizeof page_no);
+ bpage = buf_page_hash_get(space, page_no);
if (!bpage || bpage->zip.data != src) {
/* The block has probably been freshly
@@ -495,7 +499,12 @@ success:
mutex_exit(mutex);
} else if (i == buf_buddy_get_slot(sizeof(buf_page_t))) {
/* This must be a buf_page_t object. */
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no padding in
+ buf_page_t. On other systems, Valgrind could complain
+ about uninitialized pad bytes. */
UNIV_MEM_ASSERT_RW(src, size);
+#endif
if (buf_buddy_relocate_block(src, dst)) {
goto success;
diff --git a/storage/innodb_plugin/buf/buf0buf.c b/storage/innodb_plugin/buf/buf0buf.c
index f299c2df969..660686bac1e 100644
--- a/storage/innodb_plugin/buf/buf0buf.c
+++ b/storage/innodb_plugin/buf/buf0buf.c
@@ -2236,7 +2236,7 @@ wait_until_unfixed:
block->page.buf_fix_count = 1;
buf_block_set_io_fix(block, BUF_IO_READ);
- rw_lock_x_lock(&block->lock);
+ rw_lock_x_lock_func(&block->lock, 0, file, line);
UNIV_MEM_INVALID(bpage, sizeof *bpage);
@@ -2280,7 +2280,12 @@ wait_until_unfixed:
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
mutex_enter(&block->mutex);
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no padding in buf_page_t. On
+ other systems, Valgrind could complain about uninitialized pad
+ bytes. */
UNIV_MEM_ASSERT_RW(&block->page, sizeof block->page);
+#endif
buf_block_buf_fix_inc(block, file, line);
diff --git a/storage/innodb_plugin/buf/buf0flu.c b/storage/innodb_plugin/buf/buf0flu.c
index f2b07492470..d8c0497fa1e 100644
--- a/storage/innodb_plugin/buf/buf0flu.c
+++ b/storage/innodb_plugin/buf/buf0flu.c
@@ -249,6 +249,17 @@ buf_flush_insert_into_flush_list(
ut_d(block->page.in_flush_list = TRUE);
UT_LIST_ADD_FIRST(list, buf_pool->flush_list, &block->page);
+#ifdef UNIV_DEBUG_VALGRIND
+ {
+ ulint zip_size = buf_block_get_zip_size(block);
+
+ if (UNIV_UNLIKELY(zip_size)) {
+ UNIV_MEM_ASSERT_RW(block->page.zip.data, zip_size);
+ } else {
+ UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
+ }
+ }
+#endif /* UNIV_DEBUG_VALGRIND */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_flush_validate_low());
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
@@ -276,6 +287,18 @@ buf_flush_insert_sorted_into_flush_list(
ut_ad(!block->page.in_flush_list);
ut_d(block->page.in_flush_list = TRUE);
+#ifdef UNIV_DEBUG_VALGRIND
+ {
+ ulint zip_size = buf_block_get_zip_size(block);
+
+ if (UNIV_UNLIKELY(zip_size)) {
+ UNIV_MEM_ASSERT_RW(block->page.zip.data, zip_size);
+ } else {
+ UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
+ }
+ }
+#endif /* UNIV_DEBUG_VALGRIND */
+
prev_b = NULL;
/* For the most part when this function is called the flush_rbt
@@ -809,6 +832,7 @@ try_again:
zip_size = buf_page_get_zip_size(bpage);
if (UNIV_UNLIKELY(zip_size)) {
+ UNIV_MEM_ASSERT_RW(bpage->zip.data, zip_size);
/* Copy the compressed page and clear the rest. */
memcpy(trx_doublewrite->write_buf
+ UNIV_PAGE_SIZE * trx_doublewrite->first_free,
@@ -818,6 +842,8 @@ try_again:
+ zip_size, 0, UNIV_PAGE_SIZE - zip_size);
} else {
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
+ UNIV_MEM_ASSERT_RW(((buf_block_t*) bpage)->frame,
+ UNIV_PAGE_SIZE);
memcpy(trx_doublewrite->write_buf
+ UNIV_PAGE_SIZE * trx_doublewrite->first_free,
diff --git a/storage/innodb_plugin/buf/buf0lru.c b/storage/innodb_plugin/buf/buf0lru.c
index 9cfa02ba3ac..78d8d348e2a 100644
--- a/storage/innodb_plugin/buf/buf0lru.c
+++ b/storage/innodb_plugin/buf/buf0lru.c
@@ -1364,7 +1364,7 @@ buf_LRU_make_block_old(
Try to free a block. If bpage is a descriptor of a compressed-only
page, the descriptor object will be freed as well.
-NOTE: If this function returns BUF_LRU_FREED, it will not temporarily
+NOTE: If this function returns BUF_LRU_FREED, it will temporarily
release buf_pool_mutex. Furthermore, the page frame will no longer be
accessible via bpage.
@@ -1393,7 +1393,12 @@ buf_LRU_free_block(
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
ut_ad(!bpage->in_flush_list == !bpage->oldest_modification);
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no padding in buf_page_t. On
+ other systems, Valgrind could complain about uninitialized pad
+ bytes. */
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
+#endif
if (!buf_page_can_relocate(bpage)) {
@@ -1489,8 +1494,13 @@ alloc:
ut_ad(prev_b->in_LRU_list);
ut_ad(buf_page_in_file(prev_b));
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no
+ padding in buf_page_t. On other
+ systems, Valgrind could complain about
+ uninitialized pad bytes. */
UNIV_MEM_ASSERT_RW(prev_b, sizeof *prev_b);
-
+#endif
UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU,
prev_b, b);
@@ -1688,7 +1698,12 @@ buf_LRU_block_remove_hashed_page(
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
ut_a(bpage->buf_fix_count == 0);
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no padding in
+ buf_page_t. On other systems, Valgrind could complain
+ about uninitialized pad bytes. */
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
+#endif
buf_LRU_remove_block(bpage);
diff --git a/storage/innodb_plugin/dict/dict0boot.c b/storage/innodb_plugin/dict/dict0boot.c
index 45d57b8c619..e63c1dc94b9 100644
--- a/storage/innodb_plugin/dict/dict0boot.c
+++ b/storage/innodb_plugin/dict/dict0boot.c
@@ -62,32 +62,47 @@ dict_hdr_get(
}
/**********************************************************************//**
-Returns a new table, index, or tree id.
-@return the new id */
+Returns a new table, index, or space id. */
UNIV_INTERN
-dulint
+void
dict_hdr_get_new_id(
/*================*/
- ulint type) /*!< in: DICT_HDR_ROW_ID, ... */
+ dulint* table_id, /*!< out: table id (not assigned if NULL) */
+ dulint* index_id, /*!< out: index id (not assigned if NULL) */
+ ulint* space_id) /*!< out: space id (not assigned if NULL) */
{
dict_hdr_t* dict_hdr;
dulint id;
mtr_t mtr;
- ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID));
-
mtr_start(&mtr);
dict_hdr = dict_hdr_get(&mtr);
- id = mtr_read_dulint(dict_hdr + type, &mtr);
- id = ut_dulint_add(id, 1);
+ if (table_id) {
+ id = mtr_read_dulint(dict_hdr + DICT_HDR_TABLE_ID, &mtr);
+ id = ut_dulint_add(id, 1);
+ mlog_write_dulint(dict_hdr + DICT_HDR_TABLE_ID, id, &mtr);
+ *table_id = id;
+ }
- mlog_write_dulint(dict_hdr + type, id, &mtr);
+ if (index_id) {
+ id = mtr_read_dulint(dict_hdr + DICT_HDR_INDEX_ID, &mtr);
+ id = ut_dulint_add(id, 1);
+ mlog_write_dulint(dict_hdr + DICT_HDR_INDEX_ID, id, &mtr);
+ *index_id = id;
+ }
- mtr_commit(&mtr);
+ if (space_id) {
+ *space_id = mtr_read_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID,
+ MLOG_4BYTES, &mtr);
+ if (fil_assign_new_space_id(space_id)) {
+ mlog_write_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID,
+ *space_id, MLOG_4BYTES, &mtr);
+ }
+ }
- return(id);
+ mtr_commit(&mtr);
}
/**********************************************************************//**
@@ -151,9 +166,12 @@ dict_hdr_create(
mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
- /* Obsolete, but we must initialize it to 0 anyway. */
- mlog_write_dulint(dict_header + DICT_HDR_MIX_ID,
- ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
+ mlog_write_ulint(dict_header + DICT_HDR_MAX_SPACE_ID,
+ 0, MLOG_4BYTES, mtr);
+
+ /* Obsolete, but we must initialize it anyway. */
+ mlog_write_ulint(dict_header + DICT_HDR_MIX_ID_LOW,
+ DICT_HDR_FIRST_ID, MLOG_4BYTES, mtr);
/* Create the B-tree roots for the clustered indexes of the basic
system tables */
diff --git a/storage/innodb_plugin/dict/dict0crea.c b/storage/innodb_plugin/dict/dict0crea.c
index 653bff4bef6..09353c45c8c 100644
--- a/storage/innodb_plugin/dict/dict0crea.c
+++ b/storage/innodb_plugin/dict/dict0crea.c
@@ -239,16 +239,34 @@ dict_build_table_def_step(
const char* path_or_name;
ibool is_path;
mtr_t mtr;
+ ulint space = 0;
+ ibool file_per_table;
ut_ad(mutex_own(&(dict_sys->mutex)));
table = node->table;
- table->id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
+ /* Cache the global variable "srv_file_per_table" to
+ a local variable before using it. Please note
+ "srv_file_per_table" is not under dict_sys mutex
+ protection, and could be changed while executing
+ this function. So better to cache the current value
+ to a local variable, and all future reference to
+ "srv_file_per_table" should use this local variable. */
+ file_per_table = srv_file_per_table;
+
+ dict_hdr_get_new_id(&table->id, NULL, NULL);
thr_get_trx(thr)->table_id = table->id;
- if (srv_file_per_table) {
+ if (file_per_table) {
+ /* Get a new space id if srv_file_per_table is set */
+ dict_hdr_get_new_id(NULL, NULL, &space);
+
+ if (UNIV_UNLIKELY(space == ULINT_UNDEFINED)) {
+ return(DB_ERROR);
+ }
+
/* We create a new single-table tablespace for the table.
We initially let it be 4 pages:
- page 0 is the fsp header and an extent descriptor page,
@@ -257,8 +275,6 @@ dict_build_table_def_step(
- page 3 will contain the root of the clustered index of the
table we create here. */
- ulint space = 0; /* reset to zero for the call below */
-
if (table->dir_path_of_temp_table) {
/* We place tables created with CREATE TEMPORARY
TABLE in the tmp dir of mysqld server */
@@ -276,7 +292,7 @@ dict_build_table_def_step(
flags = table->flags & ~(~0 << DICT_TF_BITS);
error = fil_create_new_single_table_tablespace(
- &space, path_or_name, is_path,
+ space, path_or_name, is_path,
flags == DICT_TF_COMPACT ? 0 : flags,
FIL_IBD_FILE_INITIAL_SIZE);
table->space = (unsigned int) space;
@@ -561,7 +577,7 @@ dict_build_index_def_step(
ut_ad((UT_LIST_GET_LEN(table->indexes) > 0)
|| dict_index_is_clust(index));
- index->id = dict_hdr_get_new_id(DICT_HDR_INDEX_ID);
+ dict_hdr_get_new_id(NULL, &index->id, NULL);
/* Inherit the space id from the table; we store all indexes of a
table in the same tablespace */
diff --git a/storage/innodb_plugin/dict/dict0dict.c b/storage/innodb_plugin/dict/dict0dict.c
index 83438231689..fe4e058e122 100644
--- a/storage/innodb_plugin/dict/dict0dict.c
+++ b/storage/innodb_plugin/dict/dict0dict.c
@@ -82,7 +82,7 @@ static char dict_ibfk[] = "_ibfk_";
/** array of mutexes protecting dict_index_t::stat_n_diff_key_vals[] */
#define DICT_INDEX_STAT_MUTEX_SIZE 32
-mutex_t dict_index_stat_mutex[DICT_INDEX_STAT_MUTEX_SIZE];
+static mutex_t dict_index_stat_mutex[DICT_INDEX_STAT_MUTEX_SIZE];
/*******************************************************************//**
Tries to find column names for the index and sets the col field of the
@@ -570,13 +570,11 @@ dict_table_get_on_id(
if (ut_dulint_cmp(table_id, DICT_FIELDS_ID) <= 0
|| trx->dict_operation_lock_mode == RW_X_LATCH) {
- /* It is a system table which will always exist in the table
- cache: we avoid acquiring the dictionary mutex, because
- if we are doing a rollback to handle an error in TABLE
- CREATE, for example, we already have the mutex! */
- ut_ad(mutex_own(&(dict_sys->mutex))
- || trx->dict_operation_lock_mode == RW_X_LATCH);
+ /* Note: An X latch implies that the transaction
+ already owns the dictionary mutex. */
+
+ ut_ad(mutex_own(&dict_sys->mutex));
return(dict_table_get_on_id_low(table_id));
}
@@ -850,7 +848,8 @@ dict_table_add_to_cache(
/* Add table to LRU list of tables */
UT_LIST_ADD_FIRST(table_LRU, dict_sys->table_LRU, table);
- dict_sys->size += mem_heap_get_size(table->heap);
+ dict_sys->size += mem_heap_get_size(table->heap)
+ + strlen(table->name) + 1;
}
/**********************************************************************//**
@@ -904,14 +903,21 @@ dict_table_rename_in_cache(
dict_foreign_t* foreign;
dict_index_t* index;
ulint fold;
- ulint old_size;
- const char* old_name;
+ char old_name[MAX_TABLE_NAME_LEN + 1];
ut_ad(table);
ut_ad(mutex_own(&(dict_sys->mutex)));
- old_size = mem_heap_get_size(table->heap);
- old_name = table->name;
+ /* store the old/current name to an automatic variable */
+ if (strlen(table->name) + 1 <= sizeof(old_name)) {
+ memcpy(old_name, table->name, strlen(table->name) + 1);
+ } else {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, "InnoDB: too long table name: '%s', "
+ "max length is %d\n", table->name,
+ MAX_TABLE_NAME_LEN);
+ ut_error;
+ }
fold = ut_fold_string(new_name);
@@ -957,12 +963,22 @@ dict_table_rename_in_cache(
/* Remove table from the hash tables of tables */
HASH_DELETE(dict_table_t, name_hash, dict_sys->table_hash,
ut_fold_string(old_name), table);
- table->name = mem_heap_strdup(table->heap, new_name);
+
+ if (strlen(new_name) > strlen(table->name)) {
+ /* We allocate MAX_TABLE_NAME_LEN+1 bytes here to avoid
+ memory fragmentation, we assume a repeated calls of
+ ut_realloc() with the same size do not cause fragmentation */
+ ut_a(strlen(new_name) <= MAX_TABLE_NAME_LEN);
+ table->name = ut_realloc(table->name, MAX_TABLE_NAME_LEN + 1);
+ }
+ memcpy(table->name, new_name, strlen(new_name) + 1);
/* Add table to hash table of tables */
HASH_INSERT(dict_table_t, name_hash, dict_sys->table_hash, fold,
table);
- dict_sys->size += (mem_heap_get_size(table->heap) - old_size);
+
+ dict_sys->size += strlen(new_name) - strlen(old_name);
+ ut_a(dict_sys->size > 0);
/* Update the table_name field in indexes */
index = dict_table_get_first_index(table);
@@ -1187,7 +1203,7 @@ dict_table_remove_from_cache(
/* Remove table from LRU list of tables */
UT_LIST_REMOVE(table_LRU, dict_sys->table_LRU, table);
- size = mem_heap_get_size(table->heap);
+ size = mem_heap_get_size(table->heap) + strlen(table->name) + 1;
ut_ad(dict_sys->size >= size);
@@ -3008,25 +3024,28 @@ static
char*
dict_strip_comments(
/*================*/
- const char* sql_string) /*!< in: SQL string */
+ const char* sql_string, /*!< in: SQL string */
+ size_t sql_length) /*!< in: length of sql_string */
{
char* str;
const char* sptr;
+ const char* eptr = sql_string + sql_length;
char* ptr;
/* unclosed quote character (0 if none) */
char quote = 0;
- str = mem_alloc(strlen(sql_string) + 1);
+ str = mem_alloc(sql_length + 1);
sptr = sql_string;
ptr = str;
for (;;) {
scan_more:
- if (*sptr == '\0') {
+ if (sptr >= eptr || *sptr == '\0') {
+end_of_string:
*ptr = '\0';
- ut_a(ptr <= str + strlen(sql_string));
+ ut_a(ptr <= str + sql_length);
return(str);
}
@@ -3045,30 +3064,35 @@ scan_more:
|| (sptr[0] == '-' && sptr[1] == '-'
&& sptr[2] == ' ')) {
for (;;) {
+ if (++sptr >= eptr) {
+ goto end_of_string;
+ }
+
/* In Unix a newline is 0x0A while in Windows
it is 0x0D followed by 0x0A */
- if (*sptr == (char)0x0A
- || *sptr == (char)0x0D
- || *sptr == '\0') {
-
+ switch (*sptr) {
+ case (char) 0X0A:
+ case (char) 0x0D:
+ case '\0':
goto scan_more;
}
-
- sptr++;
}
} else if (!quote && *sptr == '/' && *(sptr + 1) == '*') {
+ sptr += 2;
for (;;) {
- if (*sptr == '*' && *(sptr + 1) == '/') {
-
- sptr += 2;
-
- goto scan_more;
+ if (sptr >= eptr) {
+ goto end_of_string;
}
- if (*sptr == '\0') {
-
+ switch (*sptr) {
+ case '\0':
goto scan_more;
+ case '*':
+ if (sptr[1] == '/') {
+ sptr += 2;
+ goto scan_more;
+ }
}
sptr++;
@@ -3749,6 +3773,7 @@ dict_create_foreign_constraints(
name before it: test.table2; the
default database id the database of
parameter name */
+ size_t sql_length, /*!< in: length of sql_string */
const char* name, /*!< in: table full name in the
normalized form
database_name/table_name */
@@ -3763,7 +3788,7 @@ dict_create_foreign_constraints(
ut_a(trx);
ut_a(trx->mysql_thd);
- str = dict_strip_comments(sql_string);
+ str = dict_strip_comments(sql_string, sql_length);
heap = mem_heap_create(10000);
err = dict_create_foreign_constraints_low(
@@ -3796,6 +3821,7 @@ dict_foreign_parse_drop_constraints(
dict_foreign_t* foreign;
ibool success;
char* str;
+ size_t len;
const char* ptr;
const char* id;
FILE* ef = dict_foreign_err_file;
@@ -3810,7 +3836,10 @@ dict_foreign_parse_drop_constraints(
*constraints_to_drop = mem_heap_alloc(heap, 1000 * sizeof(char*));
- str = dict_strip_comments(*(trx->mysql_query_str));
+ ptr = innobase_get_stmt(trx->mysql_thd, &len);
+
+ str = dict_strip_comments(ptr, len);
+
ptr = str;
ut_ad(mutex_own(&(dict_sys->mutex)));
diff --git a/storage/innodb_plugin/dict/dict0load.c b/storage/innodb_plugin/dict/dict0load.c
index 377818308c5..3c495d21786 100644
--- a/storage/innodb_plugin/dict/dict0load.c
+++ b/storage/innodb_plugin/dict/dict0load.c
@@ -316,7 +316,7 @@ dict_check_tablespaces_and_store_max_id(
dict_index_t* sys_index;
btr_pcur_t pcur;
const rec_t* rec;
- ulint max_space_id = 0;
+ ulint max_space_id;
mtr_t mtr;
mutex_enter(&(dict_sys->mutex));
@@ -327,6 +327,11 @@ dict_check_tablespaces_and_store_max_id(
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!dict_table_is_comp(sys_tables));
+ max_space_id = mtr_read_ulint(dict_hdr_get(&mtr)
+ + DICT_HDR_MAX_SPACE_ID,
+ MLOG_4BYTES, &mtr);
+ fil_set_max_space_id_if_bigger(max_space_id);
+
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
TRUE, &mtr);
loop:
@@ -973,6 +978,7 @@ err_exit:
/* Try to open the tablespace */
if (!fil_open_single_table_tablespace(
TRUE, space,
+ flags == DICT_TF_COMPACT ? 0 :
flags & ~(~0 << DICT_TF_BITS), name)) {
/* We failed to find a sensible
tablespace file */
diff --git a/storage/innodb_plugin/dict/dict0mem.c b/storage/innodb_plugin/dict/dict0mem.c
index 66b4b43f296..3287247029f 100644
--- a/storage/innodb_plugin/dict/dict0mem.c
+++ b/storage/innodb_plugin/dict/dict0mem.c
@@ -68,7 +68,8 @@ dict_mem_table_create(
table->heap = heap;
table->flags = (unsigned int) flags;
- table->name = mem_heap_strdup(heap, name);
+ table->name = ut_malloc(strlen(name) + 1);
+ memcpy(table->name, name, strlen(name) + 1);
table->space = (unsigned int) space;
table->n_cols = (unsigned int) (n_cols + DATA_N_SYS_COLS);
@@ -106,6 +107,7 @@ dict_mem_table_free(
#ifndef UNIV_HOTBACKUP
mutex_free(&(table->autoinc_mutex));
#endif /* UNIV_HOTBACKUP */
+ ut_free(table->name);
mem_heap_free(table->heap);
}
diff --git a/storage/innodb_plugin/fil/fil0fil.c b/storage/innodb_plugin/fil/fil0fil.c
index 963e306c00c..796fe921a7e 100644
--- a/storage/innodb_plugin/fil/fil0fil.c
+++ b/storage/innodb_plugin/fil/fil0fil.c
@@ -279,6 +279,10 @@ struct fil_system_struct {
request */
UT_LIST_BASE_NODE_T(fil_space_t) space_list;
/*!< list of all file spaces */
+ ibool space_id_reuse_warned;
+ /* !< TRUE if fil_space_create()
+ has issued a warning about
+ potential space_id reuse */
};
/** The tablespace memory cache. This variable is NULL before the module is
@@ -1193,7 +1197,19 @@ try_again:
space->tablespace_version = fil_system->tablespace_version;
space->mark = FALSE;
- if (purpose == FIL_TABLESPACE && id > fil_system->max_assigned_id) {
+ if (UNIV_LIKELY(purpose == FIL_TABLESPACE && !recv_recovery_on)
+ && UNIV_UNLIKELY(id > fil_system->max_assigned_id)) {
+ if (!fil_system->space_id_reuse_warned) {
+ fil_system->space_id_reuse_warned = TRUE;
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Warning: allocated tablespace %lu,"
+ " old maximum was %lu\n",
+ (ulong) id,
+ (ulong) fil_system->max_assigned_id);
+ }
+
fil_system->max_assigned_id = id;
}
@@ -1231,19 +1247,25 @@ try_again:
Assigns a new space id for a new single-table tablespace. This works simply by
incrementing the global counter. If 4 billion id's is not enough, we may need
to recycle id's.
-@return new tablespace id; ULINT_UNDEFINED if could not assign an id */
-static
-ulint
-fil_assign_new_space_id(void)
-/*=========================*/
+@return TRUE if assigned, FALSE if not */
+UNIV_INTERN
+ibool
+fil_assign_new_space_id(
+/*====================*/
+ ulint* space_id) /*!< in/out: space id */
{
- ulint id;
+ ulint id;
+ ibool success;
mutex_enter(&fil_system->mutex);
- fil_system->max_assigned_id++;
+ id = *space_id;
+
+ if (id < fil_system->max_assigned_id) {
+ id = fil_system->max_assigned_id;
+ }
- id = fil_system->max_assigned_id;
+ id++;
if (id > (SRV_LOG_SPACE_FIRST_ID / 2) && (id % 1000000UL == 0)) {
ut_print_timestamp(stderr);
@@ -1259,7 +1281,11 @@ fil_assign_new_space_id(void)
(ulong) SRV_LOG_SPACE_FIRST_ID);
}
- if (id >= SRV_LOG_SPACE_FIRST_ID) {
+ success = (id < SRV_LOG_SPACE_FIRST_ID);
+
+ if (success) {
+ *space_id = fil_system->max_assigned_id = id;
+ } else {
ut_print_timestamp(stderr);
fprintf(stderr,
"InnoDB: You have run out of single-table"
@@ -1269,14 +1295,12 @@ fil_assign_new_space_id(void)
" have to dump all your tables and\n"
"InnoDB: recreate the whole InnoDB installation.\n",
(ulong) id);
- fil_system->max_assigned_id--;
-
- id = ULINT_UNDEFINED;
+ *space_id = ULINT_UNDEFINED;
}
mutex_exit(&fil_system->mutex);
- return(id);
+ return(success);
}
/*******************************************************************//**
@@ -1512,7 +1536,7 @@ fil_init(
ut_a(hash_size > 0);
ut_a(max_n_open > 0);
- fil_system = mem_alloc(sizeof(fil_system_t));
+ fil_system = mem_zalloc(sizeof(fil_system_t));
mutex_create(&fil_system->mutex, SYNC_ANY_LATCH);
@@ -1521,16 +1545,7 @@ fil_init(
UT_LIST_INIT(fil_system->LRU);
- fil_system->n_open = 0;
fil_system->max_n_open = max_n_open;
-
- fil_system->modification_counter = 0;
- fil_system->max_assigned_id = 0;
-
- fil_system->tablespace_version = 0;
-
- UT_LIST_INIT(fil_system->unflushed_spaces);
- UT_LIST_INIT(fil_system->space_list);
}
/*******************************************************************//**
@@ -2115,7 +2130,7 @@ fil_op_log_parse_or_replay(
fil_create_directory_for_tablename(name);
if (fil_create_new_single_table_tablespace(
- &space_id, name, FALSE, flags,
+ space_id, name, FALSE, flags,
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
ut_error;
}
@@ -2562,9 +2577,7 @@ UNIV_INTERN
ulint
fil_create_new_single_table_tablespace(
/*===================================*/
- ulint* space_id, /*!< in/out: space id; if this is != 0,
- then this is an input parameter,
- otherwise output */
+ ulint space_id, /*!< in: space id */
const char* tablename, /*!< in: the table name in the usual
databasename/tablename format
of InnoDB, or a dir path to a temp
@@ -2584,6 +2597,8 @@ fil_create_new_single_table_tablespace(
ibool success;
char* path;
+ ut_a(space_id > 0);
+ ut_a(space_id < SRV_LOG_SPACE_FIRST_ID);
ut_a(size >= FIL_IBD_FILE_INITIAL_SIZE);
/* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for
ROW_FORMAT=COMPACT
@@ -2640,38 +2655,21 @@ fil_create_new_single_table_tablespace(
return(DB_ERROR);
}
- buf2 = ut_malloc(3 * UNIV_PAGE_SIZE);
- /* Align the memory for file i/o if we might have O_DIRECT set */
- page = ut_align(buf2, UNIV_PAGE_SIZE);
-
ret = os_file_set_size(path, file, size * UNIV_PAGE_SIZE, 0);
if (!ret) {
- ut_free(buf2);
- os_file_close(file);
- os_file_delete(path);
-
- mem_free(path);
- return(DB_OUT_OF_FILE_SPACE);
- }
-
- if (*space_id == 0) {
- *space_id = fil_assign_new_space_id();
- }
-
- /* printf("Creating tablespace %s id %lu\n", path, *space_id); */
-
- if (*space_id == ULINT_UNDEFINED) {
- ut_free(buf2);
+ err = DB_OUT_OF_FILE_SPACE;
error_exit:
os_file_close(file);
error_exit2:
os_file_delete(path);
mem_free(path);
- return(DB_ERROR);
+ return(err);
}
+ /* printf("Creating tablespace %s id %lu\n", path, space_id); */
+
/* We have to write the space id to the file immediately and flush the
file to disk. This is because in crash recovery we must be aware what
tablespaces exist and what are their space id's, so that we can apply
@@ -2681,10 +2679,14 @@ error_exit2:
with zeros from the call of os_file_set_size(), until a buffer pool
flush would write to it. */
+ buf2 = ut_malloc(3 * UNIV_PAGE_SIZE);
+ /* Align the memory for file i/o if we might have O_DIRECT set */
+ page = ut_align(buf2, UNIV_PAGE_SIZE);
+
memset(page, '\0', UNIV_PAGE_SIZE);
- fsp_header_init_fields(page, *space_id, flags);
- mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, *space_id);
+ fsp_header_init_fields(page, space_id, flags);
+ mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
if (!(flags & DICT_TF_ZSSIZE_MASK)) {
buf_flush_init_for_writing(page, NULL, 0);
@@ -2715,6 +2717,7 @@ error_exit2:
" to tablespace ", stderr);
ut_print_filename(stderr, path);
putc('\n', stderr);
+ err = DB_ERROR;
goto error_exit;
}
@@ -2724,22 +2727,20 @@ error_exit2:
fputs("InnoDB: Error: file flush of tablespace ", stderr);
ut_print_filename(stderr, path);
fputs(" failed\n", stderr);
+ err = DB_ERROR;
goto error_exit;
}
os_file_close(file);
- if (*space_id == ULINT_UNDEFINED) {
- goto error_exit2;
- }
-
- success = fil_space_create(path, *space_id, flags, FIL_TABLESPACE);
+ success = fil_space_create(path, space_id, flags, FIL_TABLESPACE);
if (!success) {
+ err = DB_ERROR;
goto error_exit2;
}
- fil_node_create(path, size, *space_id, FALSE);
+ fil_node_create(path, size, space_id, FALSE);
#ifndef UNIV_HOTBACKUP
{
@@ -2750,7 +2751,7 @@ error_exit2:
fil_op_write_log(flags
? MLOG_FILE_CREATE2
: MLOG_FILE_CREATE,
- *space_id,
+ space_id,
is_temp ? MLOG_FILE_FLAG_TEMP : 0,
flags,
tablename, NULL, &mtr);
@@ -3541,39 +3542,6 @@ next_datadir_item:
return(err);
}
-/********************************************************************//**
-If we need crash recovery, and we have called
-fil_load_single_table_tablespaces() and dict_load_single_table_tablespaces(),
-we can call this function to print an error message of orphaned .ibd files
-for which there is not a data dictionary entry with a matching table name
-and space id. */
-UNIV_INTERN
-void
-fil_print_orphaned_tablespaces(void)
-/*================================*/
-{
- fil_space_t* space;
-
- mutex_enter(&fil_system->mutex);
-
- space = UT_LIST_GET_FIRST(fil_system->space_list);
-
- while (space) {
- if (space->purpose == FIL_TABLESPACE && space->id != 0
- && !space->mark) {
- fputs("InnoDB: Warning: tablespace ", stderr);
- ut_print_filename(stderr, space->name);
- fprintf(stderr, " of id %lu has no matching table in\n"
- "InnoDB: the InnoDB data dictionary.\n",
- (ulong) space->id);
- }
-
- space = UT_LIST_GET_NEXT(space_list, space);
- }
-
- mutex_exit(&fil_system->mutex);
-}
-
/*******************************************************************//**
Returns TRUE if a single-table tablespace does not exist in the memory cache,
or is being deleted there.
diff --git a/storage/innodb_plugin/fsp/fsp0fsp.c b/storage/innodb_plugin/fsp/fsp0fsp.c
index c7f1a299d8a..2bae8481d20 100644
--- a/storage/innodb_plugin/fsp/fsp0fsp.c
+++ b/storage/innodb_plugin/fsp/fsp0fsp.c
@@ -869,12 +869,10 @@ fsp_init_file_page_low(
return;
}
- UNIV_MEM_INVALID(page, UNIV_PAGE_SIZE);
+ memset(page, 0, UNIV_PAGE_SIZE);
mach_write_to_4(page + FIL_PAGE_OFFSET, buf_block_get_page_no(block));
- memset(page + FIL_PAGE_LSN, 0, 8);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
buf_block_get_space(block));
- memset(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM, 0, 8);
}
#ifndef UNIV_HOTBACKUP
diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
index 0fc6e786f4c..1c2a880c070 100644
--- a/storage/innodb_plugin/handler/ha_innodb.cc
+++ b/storage/innodb_plugin/handler/ha_innodb.cc
@@ -1004,6 +1004,29 @@ innobase_get_charset(
return(thd_charset((THD*) mysql_thd));
}
+/**********************************************************************//**
+Determines the current SQL statement.
+@return SQL statement string */
+extern "C" UNIV_INTERN
+const char*
+innobase_get_stmt(
+/*==============*/
+ void* mysql_thd, /*!< in: MySQL thread handle */
+ size_t* length) /*!< out: length of the SQL statement */
+{
+#if MYSQL_VERSION_ID >= 50142
+ LEX_STRING* stmt;
+
+ stmt = thd_query_string((THD*) mysql_thd);
+ *length = stmt->length;
+ return(stmt->str);
+#else
+ const char* stmt_str = thd_query((THD*) mysql_thd);
+ *length = strlen(stmt_str);
+ return(stmt_str);
+#endif
+}
+
#if defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN)
extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list;
/*******************************************************************//**
@@ -1314,7 +1337,6 @@ innobase_trx_allocate(
trx = trx_allocate_for_mysql();
trx->mysql_thd = thd;
- trx->mysql_query_str = thd_query(thd);
innobase_trx_init(thd, trx);
@@ -3928,6 +3950,11 @@ get_innobase_type_from_mysql_type(
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_LONG_BLOB:
return(DATA_BLOB);
+ case MYSQL_TYPE_NULL:
+ /* MySQL currently accepts "NULL" datatype, but will
+ reject such datatype in the next release. We will cope
+ with it and not trigger assertion failure in 5.1 */
+ break;
default:
ut_error;
}
@@ -5357,6 +5384,9 @@ ha_innobase::index_read(
prebuilt->index_usable = FALSE;
DBUG_RETURN(HA_ERR_CRASHED);
}
+ if (UNIV_UNLIKELY(!prebuilt->index_usable)) {
+ DBUG_RETURN(HA_ERR_TABLE_DEF_CHANGED);
+ }
/* Note that if the index for which the search template is built is not
necessarily prebuilt->index, but can also be the clustered index */
@@ -5547,7 +5577,8 @@ ha_innobase::change_active_index(
keynr);
/* The caller seems to ignore this. Thus, we must check
this again in row_search_for_mysql(). */
- DBUG_RETURN(2);
+ DBUG_RETURN(convert_error_code_to_mysql(DB_MISSING_HISTORY,
+ 0, NULL));
}
ut_a(prebuilt->search_tuple != 0);
@@ -5975,7 +6006,22 @@ create_table_def(
field = form->field[i];
col_type = get_innobase_type_from_mysql_type(&unsigned_type,
- field);
+ field);
+
+ if (!col_type) {
+ push_warning_printf(
+ (THD*) trx->mysql_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_CREATE_TABLE,
+ "Error creating table '%s' with "
+ "column '%s'. Please check its "
+ "column type and try to re-create "
+ "the table with an appropriate "
+ "column type.",
+ table->name, (char*) field->field_name);
+ goto err_col;
+ }
+
if (field->null_ptr) {
nulls_allowed = 0;
} else {
@@ -6033,7 +6079,7 @@ create_table_def(
if (dict_col_name_is_reserved(field->field_name)){
my_error(ER_WRONG_COLUMN_NAME, MYF(0),
field->field_name);
-
+err_col:
dict_mem_table_free(table);
trx_commit_for_mysql(trx);
@@ -6433,6 +6479,9 @@ ha_innobase::create(
/* Cache the value of innodb_file_format, in case it is
modified by another thread while the table is being created. */
const ulint file_format = srv_file_format;
+ const char* stmt;
+ size_t stmt_len;
+ enum row_type row_type;
DBUG_ENTER("ha_innobase::create");
@@ -6553,94 +6602,94 @@ ha_innobase::create(
}
}
- if (create_info->used_fields & HA_CREATE_USED_ROW_FORMAT) {
- if (flags) {
- /* KEY_BLOCK_SIZE was specified. */
- if (form->s->row_type != ROW_TYPE_COMPRESSED) {
- /* ROW_FORMAT other than COMPRESSED
- ignores KEY_BLOCK_SIZE. It does not
- make sense to reject conflicting
- KEY_BLOCK_SIZE and ROW_FORMAT, because
- such combinations can be obtained
- with ALTER TABLE anyway. */
- push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ignoring KEY_BLOCK_SIZE=%lu"
- " unless ROW_FORMAT=COMPRESSED.",
- create_info->key_block_size);
- flags = 0;
- }
- } else {
- /* No KEY_BLOCK_SIZE */
- if (form->s->row_type == ROW_TYPE_COMPRESSED) {
- /* ROW_FORMAT=COMPRESSED without
- KEY_BLOCK_SIZE implies half the
- maximum KEY_BLOCK_SIZE. */
- flags = (DICT_TF_ZSSIZE_MAX - 1)
- << DICT_TF_ZSSIZE_SHIFT
- | DICT_TF_COMPACT
- | DICT_TF_FORMAT_ZIP
- << DICT_TF_FORMAT_SHIFT;
+ row_type = form->s->row_type;
+
+ if (flags) {
+ /* KEY_BLOCK_SIZE was specified. */
+ if (!(create_info->used_fields & HA_CREATE_USED_ROW_FORMAT)) {
+ /* ROW_FORMAT was not specified;
+ default to ROW_FORMAT=COMPRESSED */
+ row_type = ROW_TYPE_COMPRESSED;
+ } else if (row_type != ROW_TYPE_COMPRESSED) {
+ /* ROW_FORMAT other than COMPRESSED
+ ignores KEY_BLOCK_SIZE. It does not
+ make sense to reject conflicting
+ KEY_BLOCK_SIZE and ROW_FORMAT, because
+ such combinations can be obtained
+ with ALTER TABLE anyway. */
+ push_warning_printf(
+ thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ignoring KEY_BLOCK_SIZE=%lu"
+ " unless ROW_FORMAT=COMPRESSED.",
+ create_info->key_block_size);
+ flags = 0;
+ }
+ } else {
+ /* No KEY_BLOCK_SIZE */
+ if (row_type == ROW_TYPE_COMPRESSED) {
+ /* ROW_FORMAT=COMPRESSED without
+ KEY_BLOCK_SIZE implies half the
+ maximum KEY_BLOCK_SIZE. */
+ flags = (DICT_TF_ZSSIZE_MAX - 1)
+ << DICT_TF_ZSSIZE_SHIFT
+ | DICT_TF_COMPACT
+ | DICT_TF_FORMAT_ZIP
+ << DICT_TF_FORMAT_SHIFT;
#if DICT_TF_ZSSIZE_MAX < 1
# error "DICT_TF_ZSSIZE_MAX < 1"
#endif
- }
}
+ }
- switch (form->s->row_type) {
- const char* row_format_name;
- case ROW_TYPE_REDUNDANT:
- break;
- case ROW_TYPE_COMPRESSED:
- case ROW_TYPE_DYNAMIC:
- row_format_name
- = form->s->row_type == ROW_TYPE_COMPRESSED
- ? "COMPRESSED"
- : "DYNAMIC";
-
- if (!srv_file_per_table) {
- push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s"
- " requires innodb_file_per_table.",
- row_format_name);
- } else if (file_format < DICT_TF_FORMAT_ZIP) {
- push_warning_printf(
- thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ROW_FORMAT=%s"
- " requires innodb_file_format >"
- " Antelope.",
- row_format_name);
- } else {
- flags |= DICT_TF_COMPACT
- | (DICT_TF_FORMAT_ZIP
- << DICT_TF_FORMAT_SHIFT);
- break;
- }
+ switch (row_type) {
+ const char* row_format_name;
+ case ROW_TYPE_REDUNDANT:
+ break;
+ case ROW_TYPE_COMPRESSED:
+ case ROW_TYPE_DYNAMIC:
+ row_format_name
+ = row_type == ROW_TYPE_COMPRESSED
+ ? "COMPRESSED"
+ : "DYNAMIC";
- /* fall through */
- case ROW_TYPE_NOT_USED:
- case ROW_TYPE_FIXED:
- default:
- push_warning(thd,
- MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: assuming ROW_FORMAT=COMPACT.");
- case ROW_TYPE_DEFAULT:
- case ROW_TYPE_COMPACT:
- flags = DICT_TF_COMPACT;
+ if (!srv_file_per_table) {
+ push_warning_printf(
+ thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ROW_FORMAT=%s"
+ " requires innodb_file_per_table.",
+ row_format_name);
+ } else if (file_format < DICT_TF_FORMAT_ZIP) {
+ push_warning_printf(
+ thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ROW_FORMAT=%s"
+ " requires innodb_file_format >"
+ " Antelope.",
+ row_format_name);
+ } else {
+ flags |= DICT_TF_COMPACT
+ | (DICT_TF_FORMAT_ZIP
+ << DICT_TF_FORMAT_SHIFT);
break;
}
- } else if (!flags) {
- /* No KEY_BLOCK_SIZE or ROW_FORMAT specified:
- use ROW_FORMAT=COMPACT by default. */
+
+ /* fall through */
+ case ROW_TYPE_NOT_USED:
+ case ROW_TYPE_FIXED:
+ default:
+ push_warning(thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: assuming ROW_FORMAT=COMPACT.");
+ case ROW_TYPE_DEFAULT:
+ case ROW_TYPE_COMPACT:
flags = DICT_TF_COMPACT;
+ break;
}
/* Look for a primary key */
@@ -6649,7 +6698,7 @@ ha_innobase::create(
(int) form->s->primary_key :
-1);
- /* Our function row_get_mysql_key_number_for_index assumes
+ /* Our function innobase_get_mysql_key_number_for_index assumes
the primary key is always number 0, if it exists */
ut_a(primary_key_no == -1 || primary_key_no == 0);
@@ -6709,9 +6758,11 @@ ha_innobase::create(
}
}
- if (*trx->mysql_query_str) {
- error = row_table_add_foreign_constraints(trx,
- *trx->mysql_query_str, norm_name,
+ stmt = innobase_get_stmt(thd, &stmt_len);
+
+ if (stmt) {
+ error = row_table_add_foreign_constraints(
+ trx, stmt, stmt_len, norm_name,
create_info->options & HA_LEX_CREATE_TMP_TABLE);
error = convert_error_code_to_mysql(error, flags, NULL);
@@ -6996,7 +7047,6 @@ innobase_drop_database(
/* In the Windows plugin, thd = current_thd is always NULL */
trx = trx_allocate_for_mysql();
trx->mysql_thd = NULL;
- trx->mysql_query_str = NULL;
#else
trx = innobase_trx_allocate(thd);
#endif
@@ -7196,6 +7246,10 @@ ha_innobase::records_in_range(
n_rows = HA_POS_ERROR;
goto func_exit;
}
+ if (UNIV_UNLIKELY(!row_merge_is_index_usable(prebuilt->trx, index))) {
+ n_rows = HA_ERR_TABLE_DEF_CHANGED;
+ goto func_exit;
+ }
heap = mem_heap_create(2 * (key->key_parts * sizeof(dfield_t)
+ sizeof(dtuple_t)));
@@ -7365,6 +7419,86 @@ ha_innobase::read_time(
}
/*********************************************************************//**
+Calculates the key number used inside MySQL for an Innobase index. We will
+first check the "index translation table" for a match of the index to get
+the index number. If there does not exist an "index translation table",
+or not able to find the index in the translation table, then we will fall back
+to the traditional way of looping through dict_index_t list to find a
+match. In this case, we have to take into account if we generated a
+default clustered index for the table
+@return the key number used inside MySQL */
+static
+unsigned int
+innobase_get_mysql_key_number_for_index(
+/*====================================*/
+ INNOBASE_SHARE* share, /*!< in: share structure for index
+ translation table. */
+ const TABLE* table, /*!< in: table in MySQL data
+ dictionary */
+ dict_table_t* ib_table,/*!< in: table in Innodb data
+ dictionary */
+ const dict_index_t* index) /*!< in: index */
+{
+ const dict_index_t* ind;
+ unsigned int i;
+
+ ut_ad(index);
+ ut_ad(ib_table);
+ ut_ad(table);
+ ut_ad(share);
+
+ /* If index does not belong to the table of share structure. Search
+ index->table instead */
+ if (index->table != ib_table) {
+ i = 0;
+ ind = dict_table_get_first_index(index->table);
+
+ while (index != ind) {
+ ind = dict_table_get_next_index(ind);
+ i++;
+ }
+
+ if (row_table_got_default_clust_index(index->table)) {
+ ut_a(i > 0);
+ i--;
+ }
+
+ return(i);
+ }
+
+ /* If index translation table exists, we will first check
+ the index through index translation table for a match. */
+ if (share->idx_trans_tbl.index_mapping) {
+ for (i = 0; i < share->idx_trans_tbl.index_count; i++) {
+ if (share->idx_trans_tbl.index_mapping[i] == index) {
+ return(i);
+ }
+ }
+
+ /* Print an error message if we cannot find the index
+ ** in the "index translation table". */
+ sql_print_error("Cannot find index %s in InnoDB index "
+ "translation table.", index->name);
+ }
+
+ /* If we do not have an "index translation table", or not able
+ to find the index in the translation table, we'll directly find
+ matching index in the dict_index_t list */
+ for (i = 0; i < table->s->keys; i++) {
+ ind = dict_table_get_index_on_name(
+ ib_table, table->key_info[i].name);
+
+ if (index == ind) {
+ return(i);
+ }
+ }
+
+ sql_print_error("Cannot find matching index number for index %s "
+ "in InnoDB index list.", index->name);
+
+ return(0);
+}
+/*********************************************************************//**
Returns statistics information of the table to the MySQL interpreter,
in various fields of the handle object. */
UNIV_INTERN
@@ -7633,8 +7767,8 @@ ha_innobase::info(
err_index = trx_get_error_info(prebuilt->trx);
if (err_index) {
- errkey = (unsigned int)
- row_get_mysql_key_number_for_index(err_index);
+ errkey = innobase_get_mysql_key_number_for_index(
+ share, table, ib_table, err_index);
} else {
errkey = (unsigned int) prebuilt->trx->error_key_num;
}
@@ -10346,7 +10480,35 @@ innodb_old_blocks_pct_update(
}
/*************************************************************//**
-Check if it is a valid value of innodb_change_buffering. This function is
+Find the corresponding ibuf_use_t value that indexes into
+innobase_change_buffering_values[] array for the input
+change buffering option name.
+@return corresponding IBUF_USE_* value for the input variable
+name, or IBUF_USE_COUNT if not able to find a match */
+static
+ibuf_use_t
+innodb_find_change_buffering_value(
+/*===============================*/
+ const char* input_name) /*!< in: input change buffering
+ option name */
+{
+ ulint use;
+
+ for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
+ use++) {
+ /* found a match */
+ if (!innobase_strcasecmp(
+ input_name, innobase_change_buffering_values[use])) {
+ return((ibuf_use_t)use);
+ }
+ }
+
+ /* Did not find any match */
+ return(IBUF_USE_COUNT);
+}
+
+/*************************************************************//**
+Check if it is a valid value of innodb_change_buffering. This function is
registered as a callback with MySQL.
@return 0 for valid innodb_change_buffering */
static
@@ -10370,19 +10532,22 @@ innodb_change_buffering_validate(
change_buffering_input = value->val_str(value, buff, &len);
if (change_buffering_input != NULL) {
- ulint use;
+ ibuf_use_t use;
- for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
- use++) {
- if (!innobase_strcasecmp(
- change_buffering_input,
- innobase_change_buffering_values[use])) {
- *(ibuf_use_t*) save = (ibuf_use_t) use;
- return(0);
- }
+ use = innodb_find_change_buffering_value(
+ change_buffering_input);
+
+ if (use != IBUF_USE_COUNT) {
+ /* Find a matching change_buffering option value. */
+ *static_cast<const char**>(save) =
+ innobase_change_buffering_values[use];
+
+ return(0);
}
}
+ /* No corresponding change buffering option for user supplied
+ "change_buffering_input" */
return(1);
}
@@ -10393,21 +10558,27 @@ static
void
innodb_change_buffering_update(
/*===========================*/
- THD* thd, /*!< in: thread handle */
- struct st_mysql_sys_var* var, /*!< in: pointer to
- system variable */
- void* var_ptr, /*!< out: where the
- formal string goes */
- const void* save) /*!< in: immediate result
- from check function */
+ THD* thd, /*!< in: thread handle */
+ struct st_mysql_sys_var* var, /*!< in: pointer to
+ system variable */
+ void* var_ptr,/*!< out: where the
+ formal string goes */
+ const void* save) /*!< in: immediate result
+ from check function */
{
+ ibuf_use_t use;
+
ut_a(var_ptr != NULL);
ut_a(save != NULL);
- ut_a((*(ibuf_use_t*) save) < IBUF_USE_COUNT);
- ibuf_use = *(const ibuf_use_t*) save;
+ use = innodb_find_change_buffering_value(
+ *static_cast<const char*const*>(save));
+
+ ut_a(use < IBUF_USE_COUNT);
- *(const char**) var_ptr = innobase_change_buffering_values[ibuf_use];
+ ibuf_use = use;
+ *static_cast<const char**>(var_ptr) =
+ *static_cast<const char*const*>(save);
}
static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff)
@@ -10735,7 +10906,7 @@ static MYSQL_SYSVAR_STR(change_buffering, innobase_change_buffering,
"Buffer changes to reduce random access: "
"OFF, ON, none, inserts.",
innodb_change_buffering_validate,
- innodb_change_buffering_update, NULL);
+ innodb_change_buffering_update, "inserts");
static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
PLUGIN_VAR_RQCMDARG,
diff --git a/storage/innodb_plugin/handler/ha_innodb.h b/storage/innodb_plugin/handler/ha_innodb.h
index 8a3e1ccff82..9789e4ba639 100644
--- a/storage/innodb_plugin/handler/ha_innodb.h
+++ b/storage/innodb_plugin/handler/ha_innodb.h
@@ -231,7 +231,11 @@ the definitions are bracketed with #ifdef INNODB_COMPATIBILITY_HOOKS */
extern "C" {
struct charset_info_st *thd_charset(MYSQL_THD thd);
+#if MYSQL_VERSION_ID >= 50142
+LEX_STRING *thd_query_string(MYSQL_THD thd);
+#else
char **thd_query(MYSQL_THD thd);
+#endif
/** Get the file name of the MySQL binlog.
* @return the name of the binlog file
diff --git a/storage/innodb_plugin/handler/handler0alter.cc b/storage/innodb_plugin/handler/handler0alter.cc
index e474c318c58..e936bfafa0e 100644
--- a/storage/innodb_plugin/handler/handler0alter.cc
+++ b/storage/innodb_plugin/handler/handler0alter.cc
@@ -894,6 +894,8 @@ error:
prebuilt->trx->error_info = NULL;
/* fall through */
default:
+ trx->error_state = DB_SUCCESS;
+
if (new_primary) {
if (indexed_table != innodb_table) {
row_merge_drop_table(trx, indexed_table);
diff --git a/storage/innodb_plugin/include/buf0buf.ic b/storage/innodb_plugin/include/buf0buf.ic
index 378c3590181..23db684806c 100644
--- a/storage/innodb_plugin/include/buf0buf.ic
+++ b/storage/innodb_plugin/include/buf0buf.ic
@@ -931,7 +931,12 @@ buf_page_hash_get(
ut_a(buf_page_in_file(bpage));
ut_ad(bpage->in_page_hash);
ut_ad(!bpage->in_zip_hash);
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no padding in
+ buf_page_t. On other systems, Valgrind could complain
+ about uninitialized pad bytes. */
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
+#endif
}
return(bpage);
diff --git a/storage/innodb_plugin/include/buf0lru.h b/storage/innodb_plugin/include/buf0lru.h
index 009430af35b..5a9cfd059f3 100644
--- a/storage/innodb_plugin/include/buf0lru.h
+++ b/storage/innodb_plugin/include/buf0lru.h
@@ -96,7 +96,7 @@ buf_LRU_insert_zip_clean(
Try to free a block. If bpage is a descriptor of a compressed-only
page, the descriptor object will be freed as well.
-NOTE: If this function returns BUF_LRU_FREED, it will not temporarily
+NOTE: If this function returns BUF_LRU_FREED, it will temporarily
release buf_pool_mutex. Furthermore, the page frame will no longer be
accessible via bpage.
diff --git a/storage/innodb_plugin/include/db0err.h b/storage/innodb_plugin/include/db0err.h
index 747e9b5364e..c841c2b4afe 100644
--- a/storage/innodb_plugin/include/db0err.h
+++ b/storage/innodb_plugin/include/db0err.h
@@ -28,6 +28,8 @@ Created 5/24/1996 Heikki Tuuri
enum db_err {
+ DB_SUCCESS_LOCKED_REC = 9, /*!< like DB_SUCCESS, but a new
+ explicit record lock was created */
DB_SUCCESS = 10,
/* The following are error codes */
diff --git a/storage/innodb_plugin/include/dict0boot.h b/storage/innodb_plugin/include/dict0boot.h
index 1a13bd1503a..148b5cbe250 100644
--- a/storage/innodb_plugin/include/dict0boot.h
+++ b/storage/innodb_plugin/include/dict0boot.h
@@ -46,13 +46,14 @@ dict_hdr_get(
/*=========*/
mtr_t* mtr); /*!< in: mtr */
/**********************************************************************//**
-Returns a new row, table, index, or tree id.
-@return the new id */
+Returns a new table, index, or space id. */
UNIV_INTERN
-dulint
+void
dict_hdr_get_new_id(
/*================*/
- ulint type); /*!< in: DICT_HDR_ROW_ID, ... */
+ dulint* table_id, /*!< out: table id (not assigned if NULL) */
+ dulint* index_id, /*!< out: index id (not assigned if NULL) */
+ ulint* space_id); /*!< out: space id (not assigned if NULL) */
/**********************************************************************//**
Returns a new row id.
@return the new id */
@@ -119,7 +120,8 @@ dict_create(void);
#define DICT_HDR_ROW_ID 0 /* The latest assigned row id */
#define DICT_HDR_TABLE_ID 8 /* The latest assigned table id */
#define DICT_HDR_INDEX_ID 16 /* The latest assigned index id */
-#define DICT_HDR_MIX_ID 24 /* Obsolete, always 0. */
+#define DICT_HDR_MAX_SPACE_ID 24 /* The latest assigned space id, or 0*/
+#define DICT_HDR_MIX_ID_LOW 28 /* Obsolete,always DICT_HDR_FIRST_ID */
#define DICT_HDR_TABLES 32 /* Root of the table index tree */
#define DICT_HDR_TABLE_IDS 36 /* Root of the table index tree */
#define DICT_HDR_COLUMNS 40 /* Root of the column index tree */
diff --git a/storage/innodb_plugin/include/dict0dict.h b/storage/innodb_plugin/include/dict0dict.h
index 79dcbb30de2..3a1bee4cd89 100644
--- a/storage/innodb_plugin/include/dict0dict.h
+++ b/storage/innodb_plugin/include/dict0dict.h
@@ -352,6 +352,7 @@ dict_create_foreign_constraints(
name before it: test.table2; the
default database id the database of
parameter name */
+ size_t sql_length, /*!< in: length of sql_string */
const char* name, /*!< in: table full name in the
normalized form
database_name/table_name */
diff --git a/storage/innodb_plugin/include/dict0mem.h b/storage/innodb_plugin/include/dict0mem.h
index 9996fb59a75..2fce1e00927 100644
--- a/storage/innodb_plugin/include/dict0mem.h
+++ b/storage/innodb_plugin/include/dict0mem.h
@@ -382,7 +382,7 @@ initialized to 0, NULL or FALSE in dict_mem_table_create(). */
struct dict_table_struct{
dulint id; /*!< id of the table */
mem_heap_t* heap; /*!< memory heap */
- const char* name; /*!< table name */
+ char* name; /*!< table name */
const char* dir_path_of_temp_table;/*!< NULL or the directory path
where a TEMPORARY table that was explicitly
created by a user should be placed if
diff --git a/storage/innodb_plugin/include/fil0fil.h b/storage/innodb_plugin/include/fil0fil.h
index de8ef9e9687..c894875b352 100644
--- a/storage/innodb_plugin/include/fil0fil.h
+++ b/storage/innodb_plugin/include/fil0fil.h
@@ -225,6 +225,16 @@ fil_space_create(
0 for uncompressed tablespaces */
ulint purpose);/*!< in: FIL_TABLESPACE, or FIL_LOG if log */
/*******************************************************************//**
+Assigns a new space id for a new single-table tablespace. This works simply by
+incrementing the global counter. If 4 billion id's is not enough, we may need
+to recycle id's.
+@return TRUE if assigned, FALSE if not */
+UNIV_INTERN
+ibool
+fil_assign_new_space_id(
+/*====================*/
+ ulint* space_id); /*!< in/out: space id */
+/*******************************************************************//**
Returns the size of the space in pages. The tablespace must be cached in the
memory cache.
@return space size, 0 if space not found */
@@ -427,9 +437,7 @@ UNIV_INTERN
ulint
fil_create_new_single_table_tablespace(
/*===================================*/
- ulint* space_id, /*!< in/out: space id; if this is != 0,
- then this is an input parameter,
- otherwise output */
+ ulint space_id, /*!< in: space id */
const char* tablename, /*!< in: the table name in the usual
databasename/tablename format
of InnoDB, or a dir path to a temp
@@ -498,16 +506,6 @@ UNIV_INTERN
ulint
fil_load_single_table_tablespaces(void);
/*===================================*/
-/********************************************************************//**
-If we need crash recovery, and we have called
-fil_load_single_table_tablespaces() and dict_load_single_table_tablespaces(),
-we can call this function to print an error message of orphaned .ibd files
-for which there is not a data dictionary entry with a matching table name
-and space id. */
-UNIV_INTERN
-void
-fil_print_orphaned_tablespaces(void);
-/*================================*/
/*******************************************************************//**
Returns TRUE if a single-table tablespace does not exist in the memory cache,
or is being deleted there.
diff --git a/storage/innodb_plugin/include/ha_prototypes.h b/storage/innodb_plugin/include/ha_prototypes.h
index b737a00b3dc..e897a233a6a 100644
--- a/storage/innodb_plugin/include/ha_prototypes.h
+++ b/storage/innodb_plugin/include/ha_prototypes.h
@@ -215,11 +215,21 @@ innobase_casedn_str(
/**********************************************************************//**
Determines the connection character set.
@return connection character set */
+UNIV_INTERN
struct charset_info_st*
innobase_get_charset(
/*=================*/
void* mysql_thd); /*!< in: MySQL thread handle */
-
+/**********************************************************************//**
+Determines the current SQL statement.
+@return SQL statement string */
+UNIV_INTERN
+const char*
+innobase_get_stmt(
+/*==============*/
+ void* mysql_thd, /*!< in: MySQL thread handle */
+ size_t* length) /*!< out: length of the SQL statement */
+ __attribute__((nonnull));
/******************************************************************//**
This function is used to find the storage length in bytes of the first n
characters for prefix indexes using a multibyte character set. The function
diff --git a/storage/innodb_plugin/include/lock0lock.h b/storage/innodb_plugin/include/lock0lock.h
index 7d76cbe3c75..b3e1e5c4537 100644
--- a/storage/innodb_plugin/include/lock0lock.h
+++ b/storage/innodb_plugin/include/lock0lock.h
@@ -340,11 +340,12 @@ lock_sec_rec_modify_check_and_lock(
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr); /*!< in/out: mini-transaction */
/*********************************************************************//**
-Like the counterpart for a clustered index below, but now we read a
+Like lock_clust_rec_read_check_and_lock(), but reads a
secondary index record.
-@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
+or DB_QUE_THR_SUSPENDED */
UNIV_INTERN
-ulint
+enum db_err
lock_sec_rec_read_check_and_lock(
/*=============================*/
ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG
@@ -371,9 +372,10 @@ if the query thread should anyway be suspended for some reason; if not, then
puts the transaction and the query thread to the lock wait state and inserts a
waiting request for a record lock to the lock queue. Sets the requested mode
lock on the record.
-@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
+or DB_QUE_THR_SUSPENDED */
UNIV_INTERN
-ulint
+enum db_err
lock_clust_rec_read_check_and_lock(
/*===============================*/
ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG
diff --git a/storage/innodb_plugin/include/log0log.ic b/storage/innodb_plugin/include/log0log.ic
index 139f4041a36..1ce00fd7313 100644
--- a/storage/innodb_plugin/include/log0log.ic
+++ b/storage/innodb_plugin/include/log0log.ic
@@ -433,7 +433,10 @@ void
log_free_check(void)
/*================*/
{
- /* ut_ad(sync_thread_levels_empty()); */
+
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(sync_thread_levels_empty_gen(TRUE));
+#endif /* UNIV_SYNC_DEBUG */
if (log_sys->check_flush_or_checkpoint) {
diff --git a/storage/innodb_plugin/include/mach0data.ic b/storage/innodb_plugin/include/mach0data.ic
index ef20356bd31..96d2417ac81 100644
--- a/storage/innodb_plugin/include/mach0data.ic
+++ b/storage/innodb_plugin/include/mach0data.ic
@@ -36,7 +36,7 @@ mach_write_to_1(
ulint n) /*!< in: ulint integer to be stored, >= 0, < 256 */
{
ut_ad(b);
- ut_ad(n <= 0xFFUL);
+ ut_ad((n | 0xFFUL) <= 0xFFUL);
b[0] = (byte)n;
}
@@ -65,7 +65,7 @@ mach_write_to_2(
ulint n) /*!< in: ulint integer to be stored */
{
ut_ad(b);
- ut_ad(n <= 0xFFFFUL);
+ ut_ad((n | 0xFFFFUL) <= 0xFFFFUL);
b[0] = (byte)(n >> 8);
b[1] = (byte)(n);
@@ -81,10 +81,7 @@ mach_read_from_2(
/*=============*/
const byte* b) /*!< in: pointer to 2 bytes */
{
- ut_ad(b);
- return( ((ulint)(b[0]) << 8)
- + (ulint)(b[1])
- );
+ return(((ulint)(b[0]) << 8) | (ulint)(b[1]));
}
/********************************************************//**
@@ -129,7 +126,7 @@ mach_write_to_3(
ulint n) /*!< in: ulint integer to be stored */
{
ut_ad(b);
- ut_ad(n <= 0xFFFFFFUL);
+ ut_ad((n | 0xFFFFFFUL) <= 0xFFFFFFUL);
b[0] = (byte)(n >> 16);
b[1] = (byte)(n >> 8);
@@ -148,8 +145,8 @@ mach_read_from_3(
{
ut_ad(b);
return( ((ulint)(b[0]) << 16)
- + ((ulint)(b[1]) << 8)
- + (ulint)(b[2])
+ | ((ulint)(b[1]) << 8)
+ | (ulint)(b[2])
);
}
@@ -183,9 +180,9 @@ mach_read_from_4(
{
ut_ad(b);
return( ((ulint)(b[0]) << 24)
- + ((ulint)(b[1]) << 16)
- + ((ulint)(b[2]) << 8)
- + (ulint)(b[3])
+ | ((ulint)(b[1]) << 16)
+ | ((ulint)(b[2]) << 8)
+ | (ulint)(b[3])
);
}
@@ -721,7 +718,7 @@ mach_read_from_2_little_endian(
/*===========================*/
const byte* buf) /*!< in: from where to read */
{
- return((ulint)(*buf) + ((ulint)(*(buf + 1))) * 256);
+ return((ulint)(buf[0]) | ((ulint)(buf[1]) << 8));
}
/*********************************************************//**
diff --git a/storage/innodb_plugin/include/rem0cmp.h b/storage/innodb_plugin/include/rem0cmp.h
index 072f74267ea..2f751a38864 100644
--- a/storage/innodb_plugin/include/rem0cmp.h
+++ b/storage/innodb_plugin/include/rem0cmp.h
@@ -148,7 +148,9 @@ cmp_rec_rec_simple(
const rec_t* rec2, /*!< in: physical record */
const ulint* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
const ulint* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
- const dict_index_t* index); /*!< in: data dictionary index */
+ const dict_index_t* index, /*!< in: data dictionary index */
+ ibool* null_eq);/*!< out: set to TRUE if
+ found matching null values */
/*************************************************************//**
This function is used to compare two physical records. Only the common
first fields are compared, and if an externally stored field is
diff --git a/storage/innodb_plugin/include/row0mysql.h b/storage/innodb_plugin/include/row0mysql.h
index d2a8734c61f..39ea240772c 100644
--- a/storage/innodb_plugin/include/row0mysql.h
+++ b/storage/innodb_plugin/include/row0mysql.h
@@ -253,15 +253,6 @@ row_table_got_default_clust_index(
/*==============================*/
const dict_table_t* table); /*!< in: table */
/*********************************************************************//**
-Calculates the key number used inside MySQL for an Innobase index. We have
-to take into account if we generated a default clustered index for the table
-@return the key number used inside MySQL */
-UNIV_INTERN
-ulint
-row_get_mysql_key_number_for_index(
-/*===============================*/
- const dict_index_t* index); /*!< in: index */
-/*********************************************************************//**
Does an update or delete of a row for MySQL.
@return error code or DB_SUCCESS */
UNIV_INTERN
@@ -273,27 +264,26 @@ row_update_for_mysql(
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL
handle */
/*********************************************************************//**
-This can only be used when srv_locks_unsafe_for_binlog is TRUE or
-session is using a READ COMMITTED isolation level. Before
-calling this function we must use trx_reset_new_rec_lock_info() and
-trx_register_new_rec_lock() to store the information which new record locks
-really were set. This function removes a newly set lock under prebuilt->pcur,
-and also under prebuilt->clust_pcur. Currently, this is only used and tested
-in the case of an UPDATE or a DELETE statement, where the row lock is of the
-LOCK_X type.
-Thus, this implements a 'mini-rollback' that releases the latest record
-locks we set.
-@return error code or DB_SUCCESS */
+This can only be used when srv_locks_unsafe_for_binlog is TRUE or this
+session is using a READ COMMITTED or READ UNCOMMITTED isolation level.
+Before calling this function row_search_for_mysql() must have
+initialized prebuilt->new_rec_locks to store the information which new
+record locks really were set. This function removes a newly set
+clustered index record lock under prebuilt->pcur or
+prebuilt->clust_pcur. Thus, this implements a 'mini-rollback' that
+releases the latest clustered index record lock we set.
+@return error code or DB_SUCCESS */
UNIV_INTERN
int
row_unlock_for_mysql(
/*=================*/
- row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in MySQL
+ row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct in MySQL
handle */
- ibool has_latches_on_recs);/*!< TRUE if called so that we have
- the latches on the records under pcur
- and clust_pcur, and we do not need to
- reposition the cursors. */
+ ibool has_latches_on_recs);/*!< in: TRUE if called
+ so that we have the latches on
+ the records under pcur and
+ clust_pcur, and we do not need
+ to reposition the cursors. */
/*********************************************************************//**
Creates an query graph node of 'update' type to be used in the MySQL
interface.
@@ -403,6 +393,7 @@ row_table_add_foreign_constraints(
FOREIGN KEY (a, b) REFERENCES table2(c, d),
table2 can be written also with the
database name before it: test.table2 */
+ size_t sql_length, /*!< in: length of sql_string */
const char* name, /*!< in: table full name in the
normalized form
database_name/table_name */
@@ -710,18 +701,17 @@ struct row_prebuilt_struct {
ulint new_rec_locks; /*!< normally 0; if
srv_locks_unsafe_for_binlog is
TRUE or session is using READ
- COMMITTED isolation level, in a
- cursor search, if we set a new
- record lock on an index, this is
- incremented; this is used in
- releasing the locks under the
- cursors if we are performing an
- UPDATE and we determine after
- retrieving the row that it does
- not need to be locked; thus,
- these can be used to implement a
- 'mini-rollback' that releases
- the latest record locks */
+ COMMITTED or READ UNCOMMITTED
+ isolation level, set in
+ row_search_for_mysql() if we set a new
+ record lock on the secondary
+ or clustered index; this is
+ used in row_unlock_for_mysql()
+ when releasing the lock under
+ the cursor if we determine
+ after retrieving the row that
+ it does not need to be locked
+ ('mini-rollback') */
ulint mysql_prefix_len;/*!< byte offset of the end of
the last requested column */
ulint mysql_row_len; /*!< length in bytes of a row in the
diff --git a/storage/innodb_plugin/include/sync0rw.h b/storage/innodb_plugin/include/sync0rw.h
index 6f7e13220c1..175f3deb77c 100644
--- a/storage/innodb_plugin/include/sync0rw.h
+++ b/storage/innodb_plugin/include/sync0rw.h
@@ -555,11 +555,12 @@ struct rw_lock_struct {
unsigned cline:14; /*!< Line where created */
unsigned last_s_line:14; /*!< Line number where last time s-locked */
unsigned last_x_line:14; /*!< Line number where last time x-locked */
+#ifdef UNIV_DEBUG
ulint magic_n; /*!< RW_LOCK_MAGIC_N */
-};
-
/** Value of rw_lock_struct::magic_n */
#define RW_LOCK_MAGIC_N 22643
+#endif /* UNIV_DEBUG */
+};
#ifdef UNIV_SYNC_DEBUG
/** The structure for storing debug info of an rw-lock */
diff --git a/storage/innodb_plugin/include/sync0sync.h b/storage/innodb_plugin/include/sync0sync.h
index d470b823fc3..71c9920a10b 100644
--- a/storage/innodb_plugin/include/sync0sync.h
+++ b/storage/innodb_plugin/include/sync0sync.h
@@ -438,7 +438,7 @@ or row lock! */
#define SYNC_FILE_FORMAT_TAG 1200 /* Used to serialize access to the
file format tag */
#define SYNC_DICT_OPERATION 1001 /* table create, drop, etc. reserve
- this in X-mode, implicit or backround
+ this in X-mode; implicit or backround
operations purge, rollback, foreign
key checks reserve this in S-mode */
#define SYNC_DICT 1000
diff --git a/storage/innodb_plugin/include/trx0trx.h b/storage/innodb_plugin/include/trx0trx.h
index 6872fb463c0..abd175d365b 100644
--- a/storage/innodb_plugin/include/trx0trx.h
+++ b/storage/innodb_plugin/include/trx0trx.h
@@ -560,9 +560,6 @@ struct trx_struct{
/*------------------------------*/
void* mysql_thd; /*!< MySQL thread handle corresponding
to this trx, or NULL */
- char** mysql_query_str;/* pointer to the field in mysqld_thd
- which contains the pointer to the
- current SQL query string */
const char* mysql_log_file_name;
/* if MySQL binlog is used, this field
contains a pointer to the latest file
diff --git a/storage/innodb_plugin/include/univ.i b/storage/innodb_plugin/include/univ.i
index 49717760456..b8e595161b9 100644
--- a/storage/innodb_plugin/include/univ.i
+++ b/storage/innodb_plugin/include/univ.i
@@ -46,7 +46,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 0
-#define INNODB_VERSION_BUGFIX 8
+#define INNODB_VERSION_BUGFIX 10
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
@@ -165,9 +165,9 @@ command. Not tested on Windows. */
#define UNIV_COMPILE_TEST_FUNCS
*/
-#ifdef HAVE_purify
+#if defined HAVE_VALGRIND
# define UNIV_DEBUG_VALGRIND
-#endif /* HAVE_purify */
+#endif /* HAVE_VALGRIND */
#if 0
#define UNIV_DEBUG_VALGRIND /* Enable extra
Valgrind instrumentation */
@@ -205,10 +205,6 @@ operations (very slow); also UNIV_DEBUG must be defined */
adaptive hash index */
#define UNIV_SRV_PRINT_LATCH_WAITS /* enable diagnostic output
in sync0sync.c */
-#define UNIV_BTR_AVOID_COPY /* when splitting B-tree nodes,
- do not move any records when
- all the records would
- be moved */
#define UNIV_BTR_PRINT /* enable functions for
printing B-trees */
#define UNIV_ZIP_DEBUG /* extensive consistency checks
@@ -294,6 +290,12 @@ management to ensure correct alignment for doubles etc. */
/* Maximum number of parallel threads in a parallelized operation */
#define UNIV_MAX_PARALLELISM 32
+/* The maximum length of a table name. This is the MySQL limit and is
+defined in mysql_com.h like NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN, the
+number does not include a terminating '\0'. InnoDB probably can handle
+longer names internally */
+#define MAX_TABLE_NAME_LEN 192
+
/*
UNIVERSAL TYPE DEFINITIONS
==========================
diff --git a/storage/innodb_plugin/lock/lock0lock.c b/storage/innodb_plugin/lock/lock0lock.c
index 04e5fe1a65a..77d69d11a2d 100644
--- a/storage/innodb_plugin/lock/lock0lock.c
+++ b/storage/innodb_plugin/lock/lock0lock.c
@@ -1733,11 +1733,11 @@ lock_rec_create(
Enqueues a waiting request for a lock which cannot be granted immediately.
Checks for deadlocks.
@return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or
-DB_SUCCESS; DB_SUCCESS means that there was a deadlock, but another
-transaction was chosen as a victim, and we got the lock immediately:
-no need to wait then */
+DB_SUCCESS_LOCKED_REC; DB_SUCCESS_LOCKED_REC means that
+there was a deadlock, but another transaction was chosen as a victim,
+and we got the lock immediately: no need to wait then */
static
-ulint
+enum db_err
lock_rec_enqueue_waiting(
/*=====================*/
ulint type_mode,/*!< in: lock mode this
@@ -1809,7 +1809,7 @@ lock_rec_enqueue_waiting(
if (trx->wait_lock == NULL) {
- return(DB_SUCCESS);
+ return(DB_SUCCESS_LOCKED_REC);
}
trx->que_state = TRX_QUE_LOCK_WAIT;
@@ -1925,6 +1925,16 @@ somebody_waits:
return(lock_rec_create(type_mode, block, heap_no, index, trx));
}
+/** Record locking request status */
+enum lock_rec_req_status {
+ /** Failed to acquire a lock */
+ LOCK_REC_FAIL,
+ /** Succeeded in acquiring a lock (implicit or already acquired) */
+ LOCK_REC_SUCCESS,
+ /** Explicitly created a new lock */
+ LOCK_REC_SUCCESS_CREATED
+};
+
/*********************************************************************//**
This is a fast routine for locking a record in the most common cases:
there are no explicit locks on the page, or there is just one lock, owned
@@ -1932,9 +1942,9 @@ by this transaction, and of the right type_mode. This is a low-level function
which does NOT look at implicit locks! Checks lock compatibility within
explicit locks. This function sets a normal next-key lock, or in the case of
a page supremum record, a gap type lock.
-@return TRUE if locking succeeded */
+@return whether the locking succeeded */
UNIV_INLINE
-ibool
+enum lock_rec_req_status
lock_rec_lock_fast(
/*===============*/
ibool impl, /*!< in: if TRUE, no lock is set
@@ -1973,19 +1983,19 @@ lock_rec_lock_fast(
lock_rec_create(mode, block, heap_no, index, trx);
}
- return(TRUE);
+ return(LOCK_REC_SUCCESS_CREATED);
}
if (lock_rec_get_next_on_page(lock)) {
- return(FALSE);
+ return(LOCK_REC_FAIL);
}
if (lock->trx != trx
|| lock->type_mode != (mode | LOCK_REC)
|| lock_rec_get_n_bits(lock) <= heap_no) {
- return(FALSE);
+ return(LOCK_REC_FAIL);
}
if (!impl) {
@@ -1994,10 +2004,11 @@ lock_rec_lock_fast(
if (!lock_rec_get_nth_bit(lock, heap_no)) {
lock_rec_set_nth_bit(lock, heap_no);
+ return(LOCK_REC_SUCCESS_CREATED);
}
}
- return(TRUE);
+ return(LOCK_REC_SUCCESS);
}
/*********************************************************************//**
@@ -2005,9 +2016,10 @@ This is the general, and slower, routine for locking a record. This is a
low-level function which does NOT look at implicit locks! Checks lock
compatibility within explicit locks. This function sets a normal next-key
lock, or in the case of a page supremum record, a gap type lock.
-@return DB_SUCCESS, DB_LOCK_WAIT, or error code */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
+or DB_QUE_THR_SUSPENDED */
static
-ulint
+enum db_err
lock_rec_lock_slow(
/*===============*/
ibool impl, /*!< in: if TRUE, no lock is set
@@ -2024,7 +2036,6 @@ lock_rec_lock_slow(
que_thr_t* thr) /*!< in: query thread */
{
trx_t* trx;
- ulint err;
ut_ad(mutex_own(&kernel_mutex));
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
@@ -2043,27 +2054,23 @@ lock_rec_lock_slow(
/* The trx already has a strong enough lock on rec: do
nothing */
- err = DB_SUCCESS;
} else if (lock_rec_other_has_conflicting(mode, block, heap_no, trx)) {
/* If another transaction has a non-gap conflicting request in
the queue, as this transaction does not have a lock strong
enough already granted on the record, we have to wait. */
- err = lock_rec_enqueue_waiting(mode, block, heap_no,
- index, thr);
- } else {
- if (!impl) {
- /* Set the requested lock on the record */
-
- lock_rec_add_to_queue(LOCK_REC | mode, block,
- heap_no, index, trx);
- }
+ return(lock_rec_enqueue_waiting(mode, block, heap_no,
+ index, thr));
+ } else if (!impl) {
+ /* Set the requested lock on the record */
- err = DB_SUCCESS;
+ lock_rec_add_to_queue(LOCK_REC | mode, block,
+ heap_no, index, trx);
+ return(DB_SUCCESS_LOCKED_REC);
}
- return(err);
+ return(DB_SUCCESS);
}
/*********************************************************************//**
@@ -2072,9 +2079,10 @@ possible, enqueues a waiting lock request. This is a low-level function
which does NOT look at implicit locks! Checks lock compatibility within
explicit locks. This function sets a normal next-key lock, or in the case
of a page supremum record, a gap type lock.
-@return DB_SUCCESS, DB_LOCK_WAIT, or error code */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
+or DB_QUE_THR_SUSPENDED */
static
-ulint
+enum db_err
lock_rec_lock(
/*==========*/
ibool impl, /*!< in: if TRUE, no lock is set
@@ -2090,8 +2098,6 @@ lock_rec_lock(
dict_index_t* index, /*!< in: index of record */
que_thr_t* thr) /*!< in: query thread */
{
- ulint err;
-
ut_ad(mutex_own(&kernel_mutex));
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
|| lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
@@ -2103,18 +2109,20 @@ lock_rec_lock(
|| mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP
|| mode - (LOCK_MODE_MASK & mode) == 0);
- if (lock_rec_lock_fast(impl, mode, block, heap_no, index, thr)) {
-
- /* We try a simplified and faster subroutine for the most
- common cases */
-
- err = DB_SUCCESS;
- } else {
- err = lock_rec_lock_slow(impl, mode, block,
- heap_no, index, thr);
+ /* We try a simplified and faster subroutine for the most
+ common cases */
+ switch (lock_rec_lock_fast(impl, mode, block, heap_no, index, thr)) {
+ case LOCK_REC_SUCCESS:
+ return(DB_SUCCESS);
+ case LOCK_REC_SUCCESS_CREATED:
+ return(DB_SUCCESS_LOCKED_REC);
+ case LOCK_REC_FAIL:
+ return(lock_rec_lock_slow(impl, mode, block,
+ heap_no, index, thr));
}
- return(err);
+ ut_error;
+ return(DB_ERROR);
}
/*********************************************************************//**
@@ -3935,8 +3943,8 @@ lock_rec_unlock(
const rec_t* rec, /*!< in: record */
enum lock_mode lock_mode)/*!< in: LOCK_S or LOCK_X */
{
+ lock_t* first_lock;
lock_t* lock;
- lock_t* release_lock = NULL;
ulint heap_no;
ut_ad(trx && rec);
@@ -3946,48 +3954,40 @@ lock_rec_unlock(
mutex_enter(&kernel_mutex);
- lock = lock_rec_get_first(block, heap_no);
+ first_lock = lock_rec_get_first(block, heap_no);
/* Find the last lock with the same lock_mode and transaction
from the record. */
- while (lock != NULL) {
+ for (lock = first_lock; lock != NULL;
+ lock = lock_rec_get_next(heap_no, lock)) {
if (lock->trx == trx && lock_get_mode(lock) == lock_mode) {
- release_lock = lock;
ut_a(!lock_get_wait(lock));
+ lock_rec_reset_nth_bit(lock, heap_no);
+ goto released;
}
-
- lock = lock_rec_get_next(heap_no, lock);
}
- /* If a record lock is found, release the record lock */
-
- if (UNIV_LIKELY(release_lock != NULL)) {
- lock_rec_reset_nth_bit(release_lock, heap_no);
- } else {
- mutex_exit(&kernel_mutex);
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Error: unlock row could not"
- " find a %lu mode lock on the record\n",
- (ulong) lock_mode);
+ mutex_exit(&kernel_mutex);
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: unlock row could not"
+ " find a %lu mode lock on the record\n",
+ (ulong) lock_mode);
- return;
- }
+ return;
+released:
/* Check if we can now grant waiting lock requests */
- lock = lock_rec_get_first(block, heap_no);
-
- while (lock != NULL) {
+ for (lock = first_lock; lock != NULL;
+ lock = lock_rec_get_next(heap_no, lock)) {
if (lock_get_wait(lock)
&& !lock_rec_has_to_wait_in_queue(lock)) {
/* Grant the lock */
lock_grant(lock);
}
-
- lock = lock_rec_get_next(heap_no, lock);
}
mutex_exit(&kernel_mutex);
@@ -5080,7 +5080,14 @@ lock_rec_insert_check_and_lock(
lock_mutex_exit_kernel();
- if ((err == DB_SUCCESS) && !dict_index_is_clust(index)) {
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ /* fall through */
+ case DB_SUCCESS:
+ if (dict_index_is_clust(index)) {
+ break;
+ }
/* Update the page max trx id field */
page_update_max_trx_id(block,
buf_block_get_page_zip(block),
@@ -5203,6 +5210,10 @@ lock_clust_rec_modify_check_and_lock(
ut_ad(lock_rec_queue_validate(block, rec, index, offsets));
+ if (UNIV_UNLIKELY(err == DB_SUCCESS_LOCKED_REC)) {
+ err = DB_SUCCESS;
+ }
+
return(err);
}
@@ -5269,22 +5280,27 @@ lock_sec_rec_modify_check_and_lock(
}
#endif /* UNIV_DEBUG */
- if (err == DB_SUCCESS) {
+ if (err == DB_SUCCESS || err == DB_SUCCESS_LOCKED_REC) {
/* Update the page max trx id field */
+ /* It might not be necessary to do this if
+ err == DB_SUCCESS (no new lock created),
+ but it should not cost too much performance. */
page_update_max_trx_id(block,
buf_block_get_page_zip(block),
thr_get_trx(thr)->id, mtr);
+ err = DB_SUCCESS;
}
return(err);
}
/*********************************************************************//**
-Like the counterpart for a clustered index below, but now we read a
+Like lock_clust_rec_read_check_and_lock(), but reads a
secondary index record.
-@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
+or DB_QUE_THR_SUSPENDED */
UNIV_INTERN
-ulint
+enum db_err
lock_sec_rec_read_check_and_lock(
/*=============================*/
ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG
@@ -5305,8 +5321,8 @@ lock_sec_rec_read_check_and_lock(
LOCK_REC_NOT_GAP */
que_thr_t* thr) /*!< in: query thread */
{
- ulint err;
- ulint heap_no;
+ enum db_err err;
+ ulint heap_no;
ut_ad(!dict_index_is_clust(index));
ut_ad(block->frame == page_align(rec));
@@ -5357,9 +5373,10 @@ if the query thread should anyway be suspended for some reason; if not, then
puts the transaction and the query thread to the lock wait state and inserts a
waiting request for a record lock to the lock queue. Sets the requested mode
lock on the record.
-@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
+or DB_QUE_THR_SUSPENDED */
UNIV_INTERN
-ulint
+enum db_err
lock_clust_rec_read_check_and_lock(
/*===============================*/
ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG
@@ -5380,8 +5397,8 @@ lock_clust_rec_read_check_and_lock(
LOCK_REC_NOT_GAP */
que_thr_t* thr) /*!< in: query thread */
{
- ulint err;
- ulint heap_no;
+ enum db_err err;
+ ulint heap_no;
ut_ad(dict_index_is_clust(index));
ut_ad(block->frame == page_align(rec));
@@ -5452,17 +5469,22 @@ lock_clust_rec_read_check_and_lock_alt(
mem_heap_t* tmp_heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
- ulint ret;
+ ulint err;
rec_offs_init(offsets_);
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &tmp_heap);
- ret = lock_clust_rec_read_check_and_lock(flags, block, rec, index,
+ err = lock_clust_rec_read_check_and_lock(flags, block, rec, index,
offsets, mode, gap_mode, thr);
if (tmp_heap) {
mem_heap_free(tmp_heap);
}
- return(ret);
+
+ if (UNIV_UNLIKELY(err == DB_SUCCESS_LOCKED_REC)) {
+ err = DB_SUCCESS;
+ }
+
+ return(err);
}
/*******************************************************************//**
diff --git a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c
index b244e3974b3..9f937b9def2 100644
--- a/storage/innodb_plugin/os/os0file.c
+++ b/storage/innodb_plugin/os/os0file.c
@@ -1339,7 +1339,11 @@ try_again:
/* When srv_file_per_table is on, file creation failure may not
be critical to the whole instance. Do not crash the server in
- case of unknown errors. */
+ case of unknown errors.
+ Please note "srv_file_per_table" is a global variable with
+ no explicit synchronization protection. It could be
+ changed during this execution path. It might not have the
+ same value as the one when building the table definition */
if (srv_file_per_table) {
retry = os_file_handle_error_no_exit(name,
create_mode == OS_FILE_CREATE ?
@@ -1426,7 +1430,11 @@ try_again:
/* When srv_file_per_table is on, file creation failure may not
be critical to the whole instance. Do not crash the server in
- case of unknown errors. */
+ case of unknown errors.
+ Please note "srv_file_per_table" is a global variable with
+ no explicit synchronization protection. It could be
+ changed during this execution path. It might not have the
+ same value as the one when building the table definition */
if (srv_file_per_table) {
retry = os_file_handle_error_no_exit(name,
create_mode == OS_FILE_CREATE ?
diff --git a/storage/innodb_plugin/page/page0zip.c b/storage/innodb_plugin/page/page0zip.c
index aa5e39ff04a..d3b1edefc6b 100644
--- a/storage/innodb_plugin/page/page0zip.c
+++ b/storage/innodb_plugin/page/page0zip.c
@@ -571,7 +571,7 @@ page_zip_dir_encode(
/* Traverse the list of stored records in the collation order,
starting from the first user record. */
- rec = page + PAGE_NEW_INFIMUM, TRUE;
+ rec = page + PAGE_NEW_INFIMUM;
i = 0;
@@ -1464,6 +1464,7 @@ page_zip_fields_free(
dict_table_t* table = index->table;
mem_heap_free(index->heap);
mutex_free(&(table->autoinc_mutex));
+ ut_free(table->name);
mem_heap_free(table->heap);
}
}
@@ -3117,8 +3118,13 @@ page_zip_validate_low(
temp_page_zip in a debugger when running valgrind --db-attach. */
VALGRIND_GET_VBITS(page, temp_page, UNIV_PAGE_SIZE);
UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
+# if UNIV_WORD_SIZE == 4
VALGRIND_GET_VBITS(page_zip, &temp_page_zip, sizeof temp_page_zip);
+ /* On 32-bit systems, there is no padding in page_zip_des_t.
+ On other systems, Valgrind could complain about uninitialized
+ pad bytes. */
UNIV_MEM_ASSERT_RW(page_zip, sizeof *page_zip);
+# endif
VALGRIND_GET_VBITS(page_zip->data, temp_page,
page_zip_get_size(page_zip));
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
diff --git a/storage/innodb_plugin/rem/rem0cmp.c b/storage/innodb_plugin/rem/rem0cmp.c
index e6dab0bc66b..35b67992558 100644
--- a/storage/innodb_plugin/rem/rem0cmp.c
+++ b/storage/innodb_plugin/rem/rem0cmp.c
@@ -706,7 +706,9 @@ cmp_rec_rec_simple(
const rec_t* rec2, /*!< in: physical record */
const ulint* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
const ulint* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
- const dict_index_t* index) /*!< in: data dictionary index */
+ const dict_index_t* index, /*!< in: data dictionary index */
+ ibool* null_eq)/*!< out: set to TRUE if
+ found matching null values */
{
ulint rec1_f_len; /*!< length of current field in rec1 */
const byte* rec1_b_ptr; /*!< pointer to the current byte
@@ -753,6 +755,9 @@ cmp_rec_rec_simple(
|| rec2_f_len == UNIV_SQL_NULL) {
if (rec1_f_len == rec2_f_len) {
+ if (null_eq) {
+ *null_eq = TRUE;
+ }
goto next_field;
diff --git a/storage/innodb_plugin/row/row0ins.c b/storage/innodb_plugin/row/row0ins.c
index 230dc45dadc..a193bf21f7c 100644
--- a/storage/innodb_plugin/row/row0ins.c
+++ b/storage/innodb_plugin/row/row0ins.c
@@ -51,6 +51,15 @@ Created 4/20/1996 Heikki Tuuri
#define ROW_INS_PREV 1
#define ROW_INS_NEXT 2
+/*************************************************************************
+IMPORTANT NOTE: Any operation that generates redo MUST check that there
+is enough space in the redo log before for that operation. This is
+done by calling log_free_check(). The reason for checking the
+availability of the redo log space before the start of the operation is
+that we MUST not hold any synchonization objects when performing the
+check.
+If you make a change in this module make sure that no codepath is
+introduced where a call to log_free_check() is bypassed. */
/*********************************************************************//**
Creates an insert node struct.
@@ -1121,9 +1130,9 @@ nonstandard_exit_func:
/*********************************************************************//**
Sets a shared lock on a record. Used in locking possible duplicate key
records and also in checking foreign key constraints.
-@return DB_SUCCESS or error code */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, or error code */
static
-ulint
+enum db_err
row_ins_set_shared_rec_lock(
/*========================*/
ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
@@ -1134,7 +1143,7 @@ row_ins_set_shared_rec_lock(
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
que_thr_t* thr) /*!< in: query thread */
{
- ulint err;
+ enum db_err err;
ut_ad(rec_offs_validate(rec, index, offsets));
@@ -1152,9 +1161,9 @@ row_ins_set_shared_rec_lock(
/*********************************************************************//**
Sets a exclusive lock on a record. Used in locking possible duplicate key
records
-@return DB_SUCCESS or error code */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, or error code */
static
-ulint
+enum db_err
row_ins_set_exclusive_rec_lock(
/*===========================*/
ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
@@ -1165,7 +1174,7 @@ row_ins_set_exclusive_rec_lock(
const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
que_thr_t* thr) /*!< in: query thread */
{
- ulint err;
+ enum db_err err;
ut_ad(rec_offs_validate(rec, index, offsets));
@@ -1205,7 +1214,6 @@ row_ins_check_foreign_constraint(
dict_index_t* check_index;
ulint n_fields_cmp;
btr_pcur_t pcur;
- ibool moved;
int cmp;
ulint err;
ulint i;
@@ -1336,13 +1344,13 @@ run_again:
/* Scan index records and check if there is a matching record */
- for (;;) {
+ do {
const rec_t* rec = btr_pcur_get_rec(&pcur);
const buf_block_t* block = btr_pcur_get_block(&pcur);
if (page_rec_is_infimum(rec)) {
- goto next_rec;
+ continue;
}
offsets = rec_get_offsets(rec, check_index,
@@ -1353,12 +1361,13 @@ run_again:
err = row_ins_set_shared_rec_lock(LOCK_ORDINARY, block,
rec, check_index,
offsets, thr);
- if (err != DB_SUCCESS) {
-
- break;
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ continue;
+ default:
+ goto end_scan;
}
-
- goto next_rec;
}
cmp = cmp_dtuple_rec(entry, rec, offsets);
@@ -1369,9 +1378,12 @@ run_again:
err = row_ins_set_shared_rec_lock(
LOCK_ORDINARY, block,
rec, check_index, offsets, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
break;
+ default:
+ goto end_scan;
}
} else {
/* Found a matching record. Lock only
@@ -1382,15 +1394,18 @@ run_again:
LOCK_REC_NOT_GAP, block,
rec, check_index, offsets, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
break;
+ default:
+ goto end_scan;
}
if (check_ref) {
err = DB_SUCCESS;
- break;
+ goto end_scan;
} else if (foreign->type != 0) {
/* There is an ON UPDATE or ON DELETE
condition: check them in a separate
@@ -1416,7 +1431,7 @@ run_again:
err = DB_FOREIGN_DUPLICATE_KEY;
}
- break;
+ goto end_scan;
}
/* row_ins_foreign_check_on_constraint
@@ -1429,49 +1444,41 @@ run_again:
thr, foreign, rec, entry);
err = DB_ROW_IS_REFERENCED;
- break;
+ goto end_scan;
}
}
- }
+ } else {
+ ut_a(cmp < 0);
- if (cmp < 0) {
err = row_ins_set_shared_rec_lock(
LOCK_GAP, block,
rec, check_index, offsets, thr);
- if (err != DB_SUCCESS) {
- break;
- }
-
- if (check_ref) {
- err = DB_NO_REFERENCED_ROW;
- row_ins_foreign_report_add_err(
- trx, foreign, rec, entry);
- } else {
- err = DB_SUCCESS;
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ if (check_ref) {
+ err = DB_NO_REFERENCED_ROW;
+ row_ins_foreign_report_add_err(
+ trx, foreign, rec, entry);
+ } else {
+ err = DB_SUCCESS;
+ }
}
- break;
+ goto end_scan;
}
+ } while (btr_pcur_move_to_next(&pcur, &mtr));
- ut_a(cmp == 0);
-next_rec:
- moved = btr_pcur_move_to_next(&pcur, &mtr);
-
- if (!moved) {
- if (check_ref) {
- rec = btr_pcur_get_rec(&pcur);
- row_ins_foreign_report_add_err(
- trx, foreign, rec, entry);
- err = DB_NO_REFERENCED_ROW;
- } else {
- err = DB_SUCCESS;
- }
-
- break;
- }
+ if (check_ref) {
+ row_ins_foreign_report_add_err(
+ trx, foreign, btr_pcur_get_rec(&pcur), entry);
+ err = DB_NO_REFERENCED_ROW;
+ } else {
+ err = DB_SUCCESS;
}
+end_scan:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -1719,9 +1726,13 @@ row_ins_scan_sec_index_for_duplicate(
rec, index, offsets, thr);
}
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
break;
+ default:
+ goto end_scan;
}
if (page_rec_is_supremum(rec)) {
@@ -1738,17 +1749,15 @@ row_ins_scan_sec_index_for_duplicate(
thr_get_trx(thr)->error_info = index;
- break;
+ goto end_scan;
}
+ } else {
+ ut_a(cmp < 0);
+ goto end_scan;
}
-
- if (cmp < 0) {
- break;
- }
-
- ut_a(cmp == 0);
} while (btr_pcur_move_to_next(&pcur, &mtr));
+end_scan:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1837,7 +1846,11 @@ row_ins_duplicate_error_in_clust(
cursor->index, offsets, thr);
}
- if (err != DB_SUCCESS) {
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ break;
+ default:
goto func_exit;
}
@@ -1877,7 +1890,11 @@ row_ins_duplicate_error_in_clust(
rec, cursor->index, offsets, thr);
}
- if (err != DB_SUCCESS) {
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ break;
+ default:
goto func_exit;
}
diff --git a/storage/innodb_plugin/row/row0merge.c b/storage/innodb_plugin/row/row0merge.c
index d61d626f92e..70cc7912fad 100644
--- a/storage/innodb_plugin/row/row0merge.c
+++ b/storage/innodb_plugin/row/row0merge.c
@@ -717,14 +717,16 @@ row_merge_read(
}
/********************************************************************//**
-Read a merge block from the file system.
+Write a merge block to the file system.
@return TRUE if request was successful, FALSE if fail */
static
ibool
row_merge_write(
/*============*/
int fd, /*!< in: file descriptor */
- ulint offset, /*!< in: offset where to write */
+ ulint offset, /*!< in: offset where to read
+ in number of row_merge_block_t
+ elements */
const void* buf) /*!< in: data */
{
ib_uint64_t ofs = ((ib_uint64_t) offset)
@@ -1075,11 +1077,14 @@ row_merge_cmp(
record to be compared */
const ulint* offsets1, /*!< in: first record offsets */
const ulint* offsets2, /*!< in: second record offsets */
- const dict_index_t* index) /*!< in: index */
+ const dict_index_t* index, /*!< in: index */
+ ibool* null_eq) /*!< out: set to TRUE if
+ found matching null values */
{
int cmp;
- cmp = cmp_rec_rec_simple(mrec1, mrec2, offsets1, offsets2, index);
+ cmp = cmp_rec_rec_simple(mrec1, mrec2, offsets1, offsets2, index,
+ null_eq);
#ifdef UNIV_DEBUG
if (row_merge_print_cmp) {
@@ -1445,11 +1450,13 @@ corrupt:
}
while (mrec0 && mrec1) {
+ ibool null_eq = FALSE;
switch (row_merge_cmp(mrec0, mrec1,
- offsets0, offsets1, index)) {
+ offsets0, offsets1, index,
+ &null_eq)) {
case 0:
if (UNIV_UNLIKELY
- (dict_index_is_unique(index))) {
+ (dict_index_is_unique(index) && !null_eq)) {
innobase_rec_to_mysql(table, mrec0,
index, offsets0);
mem_heap_free(heap);
@@ -1571,22 +1578,28 @@ row_merge(
const dict_index_t* index, /*!< in: index being created */
merge_file_t* file, /*!< in/out: file containing
index entries */
- ulint* half, /*!< in/out: half the file */
row_merge_block_t* block, /*!< in/out: 3 buffers */
int* tmpfd, /*!< in/out: temporary file handle */
- TABLE* table) /*!< in/out: MySQL table, for
+ TABLE* table, /*!< in/out: MySQL table, for
reporting erroneous key value
if applicable */
+ ulint* num_run,/*!< in/out: Number of runs remain
+ to be merged */
+ ulint* run_offset) /*!< in/out: Array contains the
+ first offset number for each merge
+ run */
{
ulint foffs0; /*!< first input offset */
ulint foffs1; /*!< second input offset */
ulint error; /*!< error code */
merge_file_t of; /*!< output file */
- const ulint ihalf = *half;
+ const ulint ihalf = run_offset[*num_run / 2];
/*!< half the input file */
- ulint ohalf; /*!< half the output file */
+ ulint n_run = 0;
+ /*!< num of runs generated from this merge */
UNIV_MEM_ASSERT_W(block[0], 3 * sizeof block[0]);
+
ut_ad(ihalf < file->offset);
of.fd = *tmpfd;
@@ -1594,17 +1607,20 @@ row_merge(
of.n_rec = 0;
/* Merge blocks to the output file. */
- ohalf = 0;
foffs0 = 0;
foffs1 = ihalf;
+ UNIV_MEM_INVALID(run_offset, *num_run * sizeof *run_offset);
+
for (; foffs0 < ihalf && foffs1 < file->offset; foffs0++, foffs1++) {
- ulint ahalf; /*!< arithmetic half the input file */
if (UNIV_UNLIKELY(trx_is_interrupted(trx))) {
return(DB_INTERRUPTED);
}
+ /* Remember the offset number for this run */
+ run_offset[n_run++] = of.offset;
+
error = row_merge_blocks(index, file, block,
&foffs0, &foffs1, &of, table);
@@ -1612,21 +1628,6 @@ row_merge(
return(error);
}
- /* Record the offset of the output file when
- approximately half the output has been generated. In
- this way, the next invocation of row_merge() will
- spend most of the time in this loop. The initial
- estimate is ohalf==0. */
- ahalf = file->offset / 2;
- ut_ad(ohalf <= of.offset);
-
- /* Improve the estimate until reaching half the input
- file size, or we can not get any closer to it. All
- comparands should be non-negative when !(ohalf < ahalf)
- because ohalf <= of.offset. */
- if (ohalf < ahalf || of.offset - ahalf < ohalf - ahalf) {
- ohalf = of.offset;
- }
}
/* Copy the last blocks, if there are any. */
@@ -1636,6 +1637,9 @@ row_merge(
return(DB_INTERRUPTED);
}
+ /* Remember the offset number for this run */
+ run_offset[n_run++] = of.offset;
+
if (!row_merge_blocks_copy(index, file, block, &foffs0, &of)) {
return(DB_CORRUPTION);
}
@@ -1648,6 +1652,9 @@ row_merge(
return(DB_INTERRUPTED);
}
+ /* Remember the offset number for this run */
+ run_offset[n_run++] = of.offset;
+
if (!row_merge_blocks_copy(index, file, block, &foffs1, &of)) {
return(DB_CORRUPTION);
}
@@ -1659,10 +1666,23 @@ row_merge(
return(DB_CORRUPTION);
}
+ ut_ad(n_run <= *num_run);
+
+ *num_run = n_run;
+
+ /* Each run can contain one or more offsets. As merge goes on,
+ the number of runs (to merge) will reduce until we have one
+ single run. So the number of runs will always be smaller than
+ the number of offsets in file */
+ ut_ad((*num_run) <= file->offset);
+
+ /* The number of offsets in output file is always equal or
+ smaller than input file */
+ ut_ad(of.offset <= file->offset);
+
/* Swap file descriptors for the next pass. */
*tmpfd = file->fd;
*file = of;
- *half = ohalf;
UNIV_MEM_INVALID(block[0], 3 * sizeof block[0]);
@@ -1687,27 +1707,44 @@ row_merge_sort(
if applicable */
{
ulint half = file->offset / 2;
+ ulint num_runs;
+ ulint* run_offset;
+ ulint error = DB_SUCCESS;
+
+ /* Record the number of merge runs we need to perform */
+ num_runs = file->offset;
+
+ /* If num_runs are less than 1, nothing to merge */
+ if (num_runs <= 1) {
+ return(error);
+ }
+
+ /* "run_offset" records each run's first offset number */
+ run_offset = (ulint*) mem_alloc(file->offset * sizeof(ulint));
+
+ /* This tells row_merge() where to start for the first round
+ of merge. */
+ run_offset[half] = half;
/* The file should always contain at least one byte (the end
of file marker). Thus, it must be at least one block. */
ut_ad(file->offset > 0);
+ /* Merge the runs until we have one big run */
do {
- ulint error;
+ error = row_merge(trx, index, file, block, tmpfd,
+ table, &num_runs, run_offset);
- error = row_merge(trx, index, file, &half,
- block, tmpfd, table);
+ UNIV_MEM_ASSERT_RW(run_offset, num_runs * sizeof *run_offset);
if (error != DB_SUCCESS) {
- return(error);
+ break;
}
+ } while (num_runs > 1);
- /* half > 0 should hold except when the file consists
- of one block. No need to merge further then. */
- ut_ad(half > 0 || file->offset == 1);
- } while (half < file->offset && half > 0);
+ mem_free(run_offset);
- return(DB_SUCCESS);
+ return(error);
}
/*************************************************************//**
@@ -2087,13 +2124,16 @@ row_merge_drop_temp_indexes(void)
btr_pcur_store_position(&pcur, &mtr);
btr_pcur_commit_specify_mtr(&pcur, &mtr);
- table = dict_load_table_on_id(table_id);
+ table = dict_table_get_on_id_low(table_id);
if (table) {
dict_index_t* index;
+ dict_index_t* next_index;
for (index = dict_table_get_first_index(table);
- index; index = dict_table_get_next_index(index)) {
+ index; index = next_index) {
+
+ next_index = dict_table_get_next_index(index);
if (*index->name == TEMP_INDEX_PREFIX) {
row_merge_drop_index(index, table, trx);
@@ -2296,7 +2336,7 @@ row_merge_rename_tables(
{
ulint err = DB_ERROR;
pars_info_t* info;
- const char* old_name= old_table->name;
+ char old_name[MAX_TABLE_NAME_LEN + 1];
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_ad(old_table != new_table);
@@ -2304,6 +2344,17 @@ row_merge_rename_tables(
ut_a(trx->dict_operation_lock_mode == RW_X_LATCH);
+ /* store the old/current name to an automatic variable */
+ if (strlen(old_table->name) + 1 <= sizeof(old_name)) {
+ memcpy(old_name, old_table->name, strlen(old_table->name) + 1);
+ } else {
+ ut_print_timestamp(stderr);
+ fprintf(stderr, "InnoDB: too long table name: '%s', "
+ "max length is %d\n", old_table->name,
+ MAX_TABLE_NAME_LEN);
+ ut_error;
+ }
+
trx->op_info = "renaming tables";
/* We use the private SQL parser of Innobase to generate the query
diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c
index 24abf8067f2..feeb7fc80b7 100644
--- a/storage/innodb_plugin/row/row0mysql.c
+++ b/storage/innodb_plugin/row/row0mysql.c
@@ -522,6 +522,7 @@ handle_new_error:
case DB_CANNOT_ADD_CONSTRAINT:
case DB_TOO_MANY_CONCURRENT_TRXS:
case DB_OUT_OF_FILE_SPACE:
+ case DB_INTERRUPTED:
if (savept) {
/* Roll back the latest, possibly incomplete
insertion or update */
@@ -624,6 +625,8 @@ row_create_prebuilt(
prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = 99999999;
+ UNIV_MEM_INVALID(&prebuilt->stored_select_lock_type,
+ sizeof prebuilt->stored_select_lock_type);
prebuilt->search_tuple = dtuple_create(
heap, 2 * dict_table_get_n_cols(table));
@@ -1427,27 +1430,26 @@ run_again:
}
/*********************************************************************//**
-This can only be used when srv_locks_unsafe_for_binlog is TRUE or
-this session is using a READ COMMITTED isolation level. Before
-calling this function we must use trx_reset_new_rec_lock_info() and
-trx_register_new_rec_lock() to store the information which new record locks
-really were set. This function removes a newly set lock under prebuilt->pcur,
-and also under prebuilt->clust_pcur. Currently, this is only used and tested
-in the case of an UPDATE or a DELETE statement, where the row lock is of the
-LOCK_X type.
-Thus, this implements a 'mini-rollback' that releases the latest record
-locks we set.
-@return error code or DB_SUCCESS */
+This can only be used when srv_locks_unsafe_for_binlog is TRUE or this
+session is using a READ COMMITTED or READ UNCOMMITTED isolation level.
+Before calling this function row_search_for_mysql() must have
+initialized prebuilt->new_rec_locks to store the information which new
+record locks really were set. This function removes a newly set
+clustered index record lock under prebuilt->pcur or
+prebuilt->clust_pcur. Thus, this implements a 'mini-rollback' that
+releases the latest clustered index record lock we set.
+@return error code or DB_SUCCESS */
UNIV_INTERN
int
row_unlock_for_mysql(
/*=================*/
- row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in MySQL
+ row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct in MySQL
handle */
- ibool has_latches_on_recs)/*!< TRUE if called so that we have
- the latches on the records under pcur
- and clust_pcur, and we do not need to
- reposition the cursors. */
+ ibool has_latches_on_recs)/*!< in: TRUE if called so
+ that we have the latches on
+ the records under pcur and
+ clust_pcur, and we do not need
+ to reposition the cursors. */
{
btr_pcur_t* pcur = prebuilt->pcur;
btr_pcur_t* clust_pcur = prebuilt->clust_pcur;
@@ -1645,37 +1647,6 @@ row_table_got_default_clust_index(
}
/*********************************************************************//**
-Calculates the key number used inside MySQL for an Innobase index. We have
-to take into account if we generated a default clustered index for the table
-@return the key number used inside MySQL */
-UNIV_INTERN
-ulint
-row_get_mysql_key_number_for_index(
-/*===============================*/
- const dict_index_t* index) /*!< in: index */
-{
- const dict_index_t* ind;
- ulint i;
-
- ut_a(index);
-
- i = 0;
- ind = dict_table_get_first_index(index->table);
-
- while (index != ind) {
- ind = dict_table_get_next_index(ind);
- i++;
- }
-
- if (row_table_got_default_clust_index(index->table)) {
- ut_a(i > 0);
- i--;
- }
-
- return(i);
-}
-
-/*********************************************************************//**
Locks the data dictionary in shared mode from modifications, for performing
foreign key check, rollback, or other operation invisible to MySQL. */
UNIV_INTERN
@@ -2059,6 +2030,7 @@ row_table_add_foreign_constraints(
FOREIGN KEY (a, b) REFERENCES table2(c, d),
table2 can be written also with the
database name before it: test.table2 */
+ size_t sql_length, /*!< in: length of sql_string */
const char* name, /*!< in: table full name in the
normalized form
database_name/table_name */
@@ -2080,8 +2052,8 @@ row_table_add_foreign_constraints(
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
- err = dict_create_foreign_constraints(trx, sql_string, name,
- reject_fks);
+ err = dict_create_foreign_constraints(trx, sql_string, sql_length,
+ name, reject_fks);
if (err == DB_SUCCESS) {
/* Check that also referencing constraints are ok */
err = dict_load_foreigns(name, TRUE);
@@ -2425,7 +2397,7 @@ row_discard_tablespace_for_mysql(
goto funct_exit;
}
- new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
+ dict_hdr_get_new_id(&new_id, NULL, NULL);
/* Remove all locks except the table-level S and X locks. */
lock_remove_all_on_table(table, FALSE);
@@ -2787,10 +2759,11 @@ row_truncate_table_for_mysql(
dict_index_t* index;
- space = 0;
+ dict_hdr_get_new_id(NULL, NULL, &space);
- if (fil_create_new_single_table_tablespace(
- &space, table->name, FALSE, flags,
+ if (space == ULINT_UNDEFINED
+ || fil_create_new_single_table_tablespace(
+ space, table->name, FALSE, flags,
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -2895,7 +2868,7 @@ next_rec:
mem_heap_free(heap);
- new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
+ dict_hdr_get_new_id(&new_id, NULL, NULL);
info = pars_info_create();
diff --git a/storage/innodb_plugin/row/row0purge.c b/storage/innodb_plugin/row/row0purge.c
index 500ebe571ab..835af990672 100644
--- a/storage/innodb_plugin/row/row0purge.c
+++ b/storage/innodb_plugin/row/row0purge.c
@@ -44,6 +44,16 @@ Created 3/14/1997 Heikki Tuuri
#include "row0mysql.h"
#include "log0log.h"
+/*************************************************************************
+IMPORTANT NOTE: Any operation that generates redo MUST check that there
+is enough space in the redo log before for that operation. This is
+done by calling log_free_check(). The reason for checking the
+availability of the redo log space before the start of the operation is
+that we MUST not hold any synchonization objects when performing the
+check.
+If you make a change in this module make sure that no codepath is
+introduced where a call to log_free_check() is bypassed. */
+
/********************************************************************//**
Creates a purge node to a query graph.
@return own: purge node */
@@ -126,6 +136,7 @@ row_purge_remove_clust_if_poss_low(
pcur = &(node->pcur);
btr_cur = btr_pcur_get_btr_cur(pcur);
+ log_free_check();
mtr_start(&mtr);
success = row_purge_reposition_pcur(mode, node, &mtr);
diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c
index d0702a0cd2f..2861235a995 100644
--- a/storage/innodb_plugin/row/row0sel.c
+++ b/storage/innodb_plugin/row/row0sel.c
@@ -863,8 +863,14 @@ row_sel_get_clust_rec(
clust_rec, index, offsets,
node->row_lock_mode, lock_type, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS:
+ case DB_SUCCESS_LOCKED_REC:
+ /* Declare the variable uninitialized in Valgrind.
+ It should be set to DB_SUCCESS at func_exit. */
+ UNIV_MEM_INVALID(&err, sizeof err);
+ break;
+ default:
goto err_exit;
}
} else {
@@ -934,9 +940,9 @@ err_exit:
/*********************************************************************//**
Sets a lock on a record.
-@return DB_SUCCESS or error code */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, or error code */
UNIV_INLINE
-ulint
+enum db_err
sel_set_rec_lock(
/*=============*/
const buf_block_t* block, /*!< in: buffer block of rec */
@@ -948,8 +954,8 @@ sel_set_rec_lock(
LOC_REC_NOT_GAP */
que_thr_t* thr) /*!< in: query thread */
{
- trx_t* trx;
- ulint err;
+ trx_t* trx;
+ enum db_err err;
trx = thr_get_trx(thr);
@@ -1482,11 +1488,15 @@ rec_loop:
node->row_lock_mode,
lock_type, thr);
- if (err != DB_SUCCESS) {
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
+ break;
+ default:
/* Note that in this case we will store in pcur
the PREDECESSOR of the record we are waiting
the lock for */
-
goto lock_wait_or_error;
}
}
@@ -1538,8 +1548,12 @@ skip_lock:
rec, index, offsets,
node->row_lock_mode, lock_type, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
+ break;
+ default:
goto lock_wait_or_error;
}
}
@@ -2498,6 +2512,7 @@ row_sel_field_store_in_mysql_format(
byte* pad_ptr;
ut_ad(len != UNIV_SQL_NULL);
+ UNIV_MEM_ASSERT_RW(data, len);
switch (templ->type) {
case DATA_INT:
@@ -2663,6 +2678,12 @@ row_sel_store_mysql_rec(
prebuilt->blob_heap = NULL;
}
+ /* init null bytes with default values as they might be
+ left uninitialized in some cases and these uninited bytes
+ might be copied into mysql record buffer that leads to
+ valgrind warnings */
+ memcpy(mysql_rec, prebuilt->default_rec, prebuilt->null_bitmap_len);
+
for (i = 0; i < prebuilt->n_template; i++) {
templ = prebuilt->mysql_template + i;
@@ -2746,6 +2767,9 @@ row_sel_store_mysql_rec(
/* MySQL assumes that the field for an SQL
NULL value is set to the default value. */
+ UNIV_MEM_ASSERT_RW(prebuilt->default_rec
+ + templ->mysql_col_offset,
+ templ->mysql_col_len);
mysql_rec[templ->mysql_null_byte_offset]
|= (byte) templ->mysql_null_bit_mask;
memcpy(mysql_rec + templ->mysql_col_offset,
@@ -2797,9 +2821,9 @@ row_sel_build_prev_vers_for_mysql(
Retrieves the clustered index record corresponding to a record in a
non-clustered index. Does the necessary locking. Used in the MySQL
interface.
-@return DB_SUCCESS or error code */
+@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, or error code */
static
-ulint
+enum db_err
row_sel_get_clust_rec_for_mysql(
/*============================*/
row_prebuilt_t* prebuilt,/*!< in: prebuilt struct in the handle */
@@ -2826,7 +2850,7 @@ row_sel_get_clust_rec_for_mysql(
dict_index_t* clust_index;
const rec_t* clust_rec;
rec_t* old_vers;
- ulint err;
+ enum db_err err;
trx_t* trx;
*out_rec = NULL;
@@ -2885,6 +2909,7 @@ row_sel_get_clust_rec_for_mysql(
clust_rec = NULL;
+ err = DB_SUCCESS;
goto func_exit;
}
@@ -2900,8 +2925,11 @@ row_sel_get_clust_rec_for_mysql(
0, btr_pcur_get_block(prebuilt->clust_pcur),
clust_rec, clust_index, *offsets,
prebuilt->select_lock_type, LOCK_REC_NOT_GAP, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS:
+ case DB_SUCCESS_LOCKED_REC:
+ break;
+ default:
goto err_exit;
}
} else {
@@ -2961,6 +2989,8 @@ row_sel_get_clust_rec_for_mysql(
rec, sec_index, clust_rec, clust_index));
#endif
}
+
+ err = DB_SUCCESS;
}
func_exit:
@@ -2973,7 +3003,6 @@ func_exit:
btr_pcur_store_position(prebuilt->clust_pcur, mtr);
}
- err = DB_SUCCESS;
err_exit:
return(err);
}
@@ -3070,6 +3099,11 @@ row_sel_pop_cached_row_for_mysql(
for (i = 0; i < prebuilt->n_template; i++) {
templ = prebuilt->mysql_template + i;
+#if 0 /* Some of the cached_rec may legitimately be uninitialized. */
+ UNIV_MEM_ASSERT_RW(cached_rec
+ + templ->mysql_col_offset,
+ templ->mysql_col_len);
+#endif
ut_memcpy(buf + templ->mysql_col_offset,
cached_rec + templ->mysql_col_offset,
templ->mysql_col_len);
@@ -3084,6 +3118,11 @@ row_sel_pop_cached_row_for_mysql(
}
}
else {
+#if 0 /* Some of the cached_rec may legitimately be uninitialized. */
+ UNIV_MEM_ASSERT_RW(prebuilt->fetch_cache
+ [prebuilt->fetch_cache_first],
+ prebuilt->mysql_prefix_len);
+#endif
ut_memcpy(buf,
prebuilt->fetch_cache[prebuilt->fetch_cache_first],
prebuilt->mysql_prefix_len);
@@ -3134,6 +3173,8 @@ row_sel_push_cache_row_for_mysql(
}
ut_ad(prebuilt->fetch_cache_first == 0);
+ UNIV_MEM_INVALID(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
+ prebuilt->mysql_row_len);
if (UNIV_UNLIKELY(!row_sel_store_mysql_rec(
prebuilt->fetch_cache[
@@ -3595,6 +3636,13 @@ shortcut_fails_too_big_rec:
trx->has_search_latch = FALSE;
}
+ ut_ad(prebuilt->sql_stat_start || trx->conc_state == TRX_ACTIVE);
+ ut_ad(trx->conc_state == TRX_NOT_STARTED
+ || trx->conc_state == TRX_ACTIVE);
+ ut_ad(prebuilt->sql_stat_start
+ || prebuilt->select_lock_type != LOCK_NONE
+ || trx->read_view);
+
trx_start_if_not_started(trx);
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
@@ -3679,8 +3727,12 @@ shortcut_fails_too_big_rec:
prebuilt->select_lock_type,
LOCK_GAP, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
+ break;
+ default:
goto lock_wait_or_error;
}
}
@@ -3778,8 +3830,12 @@ rec_loop:
prebuilt->select_lock_type,
LOCK_ORDINARY, thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
+ break;
+ default:
goto lock_wait_or_error;
}
}
@@ -3909,8 +3965,11 @@ wrong_offs:
prebuilt->select_lock_type, LOCK_GAP,
thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ break;
+ default:
goto lock_wait_or_error;
}
}
@@ -3945,8 +4004,11 @@ wrong_offs:
prebuilt->select_lock_type, LOCK_GAP,
thr);
- if (err != DB_SUCCESS) {
-
+ switch (err) {
+ case DB_SUCCESS_LOCKED_REC:
+ case DB_SUCCESS:
+ break;
+ default:
goto lock_wait_or_error;
}
}
@@ -4016,15 +4078,21 @@ no_gap_lock:
switch (err) {
const rec_t* old_vers;
- case DB_SUCCESS:
+ case DB_SUCCESS_LOCKED_REC:
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level
+ <= TRX_ISO_READ_COMMITTED) {
/* Note that a record of
prebuilt->index was locked. */
prebuilt->new_rec_locks = 1;
}
+ err = DB_SUCCESS;
+ case DB_SUCCESS:
break;
case DB_LOCK_WAIT:
+ /* Never unlock rows that were part of a conflict. */
+ prebuilt->new_rec_locks = 0;
+
if (UNIV_LIKELY(prebuilt->row_read_type
!= ROW_READ_TRY_SEMI_CONSISTENT)
|| unique_search
@@ -4054,7 +4122,6 @@ no_gap_lock:
if (UNIV_LIKELY(trx->wait_lock != NULL)) {
lock_cancel_waiting_and_release(
trx->wait_lock);
- prebuilt->new_rec_locks = 0;
} else {
mutex_exit(&kernel_mutex);
@@ -4066,9 +4133,6 @@ no_gap_lock:
ULINT_UNDEFINED,
&heap);
err = DB_SUCCESS;
- /* Note that a record of
- prebuilt->index was locked. */
- prebuilt->new_rec_locks = 1;
break;
}
mutex_exit(&kernel_mutex);
@@ -4205,27 +4269,30 @@ requires_clust_rec:
err = row_sel_get_clust_rec_for_mysql(prebuilt, index, rec,
thr, &clust_rec,
&offsets, &heap, &mtr);
- if (err != DB_SUCCESS) {
+ switch (err) {
+ case DB_SUCCESS:
+ if (clust_rec == NULL) {
+ /* The record did not exist in the read view */
+ ut_ad(prebuilt->select_lock_type == LOCK_NONE);
+ goto next_rec;
+ }
+ break;
+ case DB_SUCCESS_LOCKED_REC:
+ ut_a(clust_rec != NULL);
+ if (srv_locks_unsafe_for_binlog
+ || trx->isolation_level
+ <= TRX_ISO_READ_COMMITTED) {
+ /* Note that the clustered index record
+ was locked. */
+ prebuilt->new_rec_locks = 2;
+ }
+ err = DB_SUCCESS;
+ break;
+ default:
goto lock_wait_or_error;
}
- if (clust_rec == NULL) {
- /* The record did not exist in the read view */
- ut_ad(prebuilt->select_lock_type == LOCK_NONE);
-
- goto next_rec;
- }
-
- if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE) {
- /* Note that both the secondary index record
- and the clustered index record were locked. */
- ut_ad(prebuilt->new_rec_locks == 1);
- prebuilt->new_rec_locks = 2;
- }
-
if (UNIV_UNLIKELY(rec_get_deleted_flag(clust_rec, comp))) {
/* The record is delete marked: we can skip it */
diff --git a/storage/innodb_plugin/row/row0uins.c b/storage/innodb_plugin/row/row0uins.c
index 9f9c814f1a5..930a5cf13b6 100644
--- a/storage/innodb_plugin/row/row0uins.c
+++ b/storage/innodb_plugin/row/row0uins.c
@@ -46,6 +46,16 @@ Created 2/25/1997 Heikki Tuuri
#include "ibuf0ibuf.h"
#include "log0log.h"
+/*************************************************************************
+IMPORTANT NOTE: Any operation that generates redo MUST check that there
+is enough space in the redo log before for that operation. This is
+done by calling log_free_check(). The reason for checking the
+availability of the redo log space before the start of the operation is
+that we MUST not hold any synchonization objects when performing the
+check.
+If you make a change in this module make sure that no codepath is
+introduced where a call to log_free_check() is bypassed. */
+
/***************************************************************//**
Removes a clustered index record. The pcur in node was positioned on the
record, now it is detached.
@@ -152,7 +162,6 @@ row_undo_ins_remove_sec_low(
ulint err;
mtr_t mtr;
- log_free_check();
mtr_start(&mtr);
found = row_search_index_entry(index, entry, mode, &pcur, &mtr);
@@ -335,6 +344,7 @@ row_undo_ins(
transactions. */
ut_a(trx_is_recv(node->trx));
} else {
+ log_free_check();
err = row_undo_ins_remove_sec(node->index, entry);
if (err != DB_SUCCESS) {
@@ -346,5 +356,6 @@ row_undo_ins(
node->index = dict_table_get_next_index(node->index);
}
+ log_free_check();
return(row_undo_ins_remove_clust_rec(node));
}
diff --git a/storage/innodb_plugin/row/row0umod.c b/storage/innodb_plugin/row/row0umod.c
index e7245dbee41..8464b0f95cc 100644
--- a/storage/innodb_plugin/row/row0umod.c
+++ b/storage/innodb_plugin/row/row0umod.c
@@ -58,12 +58,22 @@ delete marked clustered index record was delete unmarked and possibly also
some of its fields were changed. Now, it is possible that the delete marked
version has become obsolete at the time the undo is started. */
+/*************************************************************************
+IMPORTANT NOTE: Any operation that generates redo MUST check that there
+is enough space in the redo log before for that operation. This is
+done by calling log_free_check(). The reason for checking the
+availability of the redo log space before the start of the operation is
+that we MUST not hold any synchonization objects when performing the
+check.
+If you make a change in this module make sure that no codepath is
+introduced where a call to log_free_check() is bypassed. */
+
/***********************************************************//**
Checks if also the previous version of the clustered index record was
modified or inserted by the same transaction, and its undo number is such
that it should be undone in the same rollback.
@return TRUE if also previous modify or insert of this row should be undone */
-UNIV_INLINE
+static
ibool
row_undo_mod_undo_also_prev_vers(
/*=============================*/
@@ -231,6 +241,8 @@ row_undo_mod_clust(
ut_ad(node && thr);
+ log_free_check();
+
/* Check if also the previous version of the clustered index record
should be undone in this same rollback operation */
@@ -657,24 +669,55 @@ row_undo_mod_upd_exist_sec(
/* Build the newest version of the index entry */
entry = row_build_index_entry(node->row, node->ext,
index, heap);
- ut_a(entry);
- /* NOTE that if we updated the fields of a
- delete-marked secondary index record so that
- alphabetically they stayed the same, e.g.,
- 'abc' -> 'aBc', we cannot return to the original
- values because we do not know them. But this should
- not cause problems because in row0sel.c, in queries
- we always retrieve the clustered index record or an
- earlier version of it, if the secondary index record
- through which we do the search is delete-marked. */
-
- err = row_undo_mod_del_mark_or_remove_sec(node, thr,
- index,
- entry);
- if (err != DB_SUCCESS) {
- mem_heap_free(heap);
-
- return(err);
+ if (UNIV_UNLIKELY(!entry)) {
+ /* The server must have crashed in
+ row_upd_clust_rec_by_insert(), in
+ row_ins_index_entry_low() before
+ btr_store_big_rec_extern_fields()
+ has written the externally stored columns
+ (BLOBs) of the new clustered index entry. */
+
+ /* The table must be in DYNAMIC or COMPRESSED
+ format. REDUNDANT and COMPACT formats
+ store a local 768-byte prefix of each
+ externally stored column. */
+ ut_a(dict_table_get_format(index->table)
+ >= DICT_TF_FORMAT_ZIP);
+
+ /* This is only legitimate when
+ rolling back an incomplete transaction
+ after crash recovery. */
+ ut_a(thr_get_trx(thr)->is_recovered);
+
+ /* The server must have crashed before
+ completing the insert of the new
+ clustered index entry and before
+ inserting to the secondary indexes.
+ Because node->row was not yet written
+ to this index, we can ignore it. But
+ we must restore node->undo_row. */
+ } else {
+ /* NOTE that if we updated the fields of a
+ delete-marked secondary index record so that
+ alphabetically they stayed the same, e.g.,
+ 'abc' -> 'aBc', we cannot return to the
+ original values because we do not know them.
+ But this should not cause problems because
+ in row0sel.c, in queries we always retrieve
+ the clustered index record or an earlier
+ version of it, if the secondary index record
+ through which we do the search is
+ delete-marked. */
+
+ err = row_undo_mod_del_mark_or_remove_sec(
+ node, thr, index, entry);
+ if (err != DB_SUCCESS) {
+ mem_heap_free(heap);
+
+ return(err);
+ }
+
+ mem_heap_empty(heap);
}
/* We may have to update the delete mark in the
@@ -683,7 +726,6 @@ row_undo_mod_upd_exist_sec(
the secondary index record if we updated its fields
but alphabetically they stayed the same, e.g.,
'abc' -> 'aBc'. */
- mem_heap_empty(heap);
entry = row_build_index_entry(node->undo_row,
node->undo_ext,
index, heap);
diff --git a/storage/innodb_plugin/row/row0undo.c b/storage/innodb_plugin/row/row0undo.c
index 3d739c9689a..9ef842b5114 100644
--- a/storage/innodb_plugin/row/row0undo.c
+++ b/storage/innodb_plugin/row/row0undo.c
@@ -297,7 +297,7 @@ row_undo(
if (locked_data_dict) {
- row_mysql_lock_data_dictionary(trx);
+ row_mysql_freeze_data_dictionary(trx);
}
if (node->state == UNDO_NODE_INSERT) {
@@ -312,7 +312,7 @@ row_undo(
if (locked_data_dict) {
- row_mysql_unlock_data_dictionary(trx);
+ row_mysql_unfreeze_data_dictionary(trx);
}
/* Do some cleanup */
diff --git a/storage/innodb_plugin/row/row0upd.c b/storage/innodb_plugin/row/row0upd.c
index 95d1d00aeef..d0aaecd3dae 100644
--- a/storage/innodb_plugin/row/row0upd.c
+++ b/storage/innodb_plugin/row/row0upd.c
@@ -92,6 +92,16 @@ the x-latch freed? The most efficient way for performing a
searched delete is obviously to keep the x-latch for several
steps of query graph execution. */
+/*************************************************************************
+IMPORTANT NOTE: Any operation that generates redo MUST check that there
+is enough space in the redo log before for that operation. This is
+done by calling log_free_check(). The reason for checking the
+availability of the redo log space before the start of the operation is
+that we MUST not hold any synchonization objects when performing the
+check.
+If you make a change in this module make sure that no codepath is
+introduced where a call to log_free_check() is bypassed. */
+
/***********************************************************//**
Checks if an update vector changes some of the first ordering fields of an
index record. This is only used in foreign key checks and we can assume
@@ -1453,7 +1463,6 @@ row_upd_sec_index_entry(
entry = row_build_index_entry(node->row, node->ext, index, heap);
ut_a(entry);
- log_free_check();
mtr_start(&mtr);
found = row_search_index_entry(index, entry, BTR_MODIFY_LEAF, &pcur,
@@ -1529,7 +1538,7 @@ Updates the secondary index record if it is changed in the row update or
deletes it if this is a delete.
@return DB_SUCCESS if operation successfully completed, else error
code or DB_LOCK_WAIT */
-UNIV_INLINE
+static
ulint
row_upd_sec_step(
/*=============*/
@@ -2015,6 +2024,7 @@ row_upd(
if (node->state == UPD_NODE_UPDATE_CLUSTERED
|| node->state == UPD_NODE_INSERT_CLUSTERED) {
+ log_free_check();
err = row_upd_clust_step(node, thr);
if (err != DB_SUCCESS) {
@@ -2029,6 +2039,8 @@ row_upd(
}
while (node->index != NULL) {
+
+ log_free_check();
err = row_upd_sec_step(node, thr);
if (err != DB_SUCCESS) {
diff --git a/storage/innodb_plugin/setup.sh b/storage/innodb_plugin/setup.sh
index 23fe729a406..b5d8299d411 100755
--- a/storage/innodb_plugin/setup.sh
+++ b/storage/innodb_plugin/setup.sh
@@ -21,7 +21,7 @@
set -eu
-TARGETDIR=../storage/innobase
+TARGETDIR=../storage/innodb_plugin
# link the build scripts
BUILDSCRIPTS="compile-innodb compile-innodb-debug"
diff --git a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c
index 63c355cea32..f7e7e351bdc 100644
--- a/storage/innodb_plugin/srv/srv0srv.c
+++ b/storage/innodb_plugin/srv/srv0srv.c
@@ -1609,12 +1609,16 @@ srv_suspend_mysql_thread(
innodb_lock_wait_timeout, because trx->mysql_thd == NULL. */
lock_wait_timeout = thd_lock_wait_timeout(trx->mysql_thd);
- if (trx_is_interrupted(trx)
- || (lock_wait_timeout < 100000000
- && wait_time > (double) lock_wait_timeout)) {
+ if (lock_wait_timeout < 100000000
+ && wait_time > (double) lock_wait_timeout) {
trx->error_state = DB_LOCK_WAIT_TIMEOUT;
}
+
+ if (trx_is_interrupted(trx)) {
+
+ trx->error_state = DB_INTERRUPTED;
+ }
}
/********************************************************************//**
diff --git a/storage/innodb_plugin/sync/sync0arr.c b/storage/innodb_plugin/sync/sync0arr.c
index ed9e25bf2f2..3c825e2202b 100644
--- a/storage/innodb_plugin/sync/sync0arr.c
+++ b/storage/innodb_plugin/sync/sync0arr.c
@@ -498,7 +498,9 @@ sync_array_cell_print(
|| type == RW_LOCK_WAIT_EX
|| type == RW_LOCK_SHARED) {
- fputs(type == RW_LOCK_EX ? "X-lock on" : "S-lock on", file);
+ fputs(type == RW_LOCK_EX ? "X-lock on"
+ : type == RW_LOCK_WAIT_EX ? "X-lock (wait_ex) on"
+ : "S-lock on", file);
rwlock = cell->old_wait_rw_lock;
diff --git a/storage/innodb_plugin/sync/sync0rw.c b/storage/innodb_plugin/sync/sync0rw.c
index d231b6acdf7..52eaa5d0f43 100644
--- a/storage/innodb_plugin/sync/sync0rw.c
+++ b/storage/innodb_plugin/sync/sync0rw.c
@@ -267,7 +267,7 @@ rw_lock_create_func(
lock->level = level;
#endif /* UNIV_SYNC_DEBUG */
- lock->magic_n = RW_LOCK_MAGIC_N;
+ ut_d(lock->magic_n = RW_LOCK_MAGIC_N);
lock->cfile_name = cfile_name;
lock->cline = (unsigned int) cline;
@@ -282,10 +282,8 @@ rw_lock_create_func(
mutex_enter(&rw_lock_list_mutex);
- if (UT_LIST_GET_LEN(rw_lock_list) > 0) {
- ut_a(UT_LIST_GET_FIRST(rw_lock_list)->magic_n
- == RW_LOCK_MAGIC_N);
- }
+ ut_ad(UT_LIST_GET_FIRST(rw_lock_list) == NULL
+ || UT_LIST_GET_FIRST(rw_lock_list)->magic_n == RW_LOCK_MAGIC_N);
UT_LIST_ADD_FIRST(list, rw_lock_list, lock);
@@ -305,8 +303,6 @@ rw_lock_free(
ut_ad(rw_lock_validate(lock));
ut_a(lock->lock_word == X_LOCK_DECR);
- lock->magic_n = 0;
-
#ifndef INNODB_RW_LOCKS_USE_ATOMICS
mutex_free(rw_lock_get_mutex(lock));
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
@@ -316,16 +312,16 @@ rw_lock_free(
os_event_free(lock->wait_ex_event);
- if (UT_LIST_GET_PREV(list, lock)) {
- ut_a(UT_LIST_GET_PREV(list, lock)->magic_n == RW_LOCK_MAGIC_N);
- }
- if (UT_LIST_GET_NEXT(list, lock)) {
- ut_a(UT_LIST_GET_NEXT(list, lock)->magic_n == RW_LOCK_MAGIC_N);
- }
+ ut_ad(UT_LIST_GET_PREV(list, lock) == NULL
+ || UT_LIST_GET_PREV(list, lock)->magic_n == RW_LOCK_MAGIC_N);
+ ut_ad(UT_LIST_GET_NEXT(list, lock) == NULL
+ || UT_LIST_GET_NEXT(list, lock)->magic_n == RW_LOCK_MAGIC_N);
UT_LIST_REMOVE(list, rw_lock_list, lock);
mutex_exit(&rw_lock_list_mutex);
+
+ ut_d(lock->magic_n = 0);
}
#ifdef UNIV_DEBUG
@@ -344,7 +340,7 @@ rw_lock_validate(
ulint waiters = rw_lock_get_waiters(lock);
lint lock_word = lock->lock_word;
- ut_a(lock->magic_n == RW_LOCK_MAGIC_N);
+ ut_ad(lock->magic_n == RW_LOCK_MAGIC_N);
ut_a(waiters == 0 || waiters == 1);
ut_a(lock_word > -X_LOCK_DECR ||(-lock_word) % X_LOCK_DECR == 0);
diff --git a/storage/innodb_plugin/trx/trx0i_s.c b/storage/innodb_plugin/trx/trx0i_s.c
index c160eb2942a..5bc8302d0c0 100644
--- a/storage/innodb_plugin/trx/trx0i_s.c
+++ b/storage/innodb_plugin/trx/trx0i_s.c
@@ -429,6 +429,9 @@ fill_trx_row(
which to copy volatile
strings */
{
+ const char* stmt;
+ size_t stmt_len;
+
row->trx_id = trx_get_id(trx);
row->trx_started = (ib_time_t) trx->start_time;
row->trx_state = trx_get_que_state_str(trx);
@@ -449,37 +452,32 @@ fill_trx_row(
row->trx_weight = (ullint) ut_conv_dulint_to_longlong(TRX_WEIGHT(trx));
- if (trx->mysql_thd != NULL) {
- row->trx_mysql_thread_id
- = thd_get_thread_id(trx->mysql_thd);
- } else {
+ if (trx->mysql_thd == NULL) {
/* For internal transactions e.g., purge and transactions
being recovered at startup there is no associated MySQL
thread data structure. */
row->trx_mysql_thread_id = 0;
+ row->trx_query = NULL;
+ return(TRUE);
}
- if (trx->mysql_query_str != NULL && *trx->mysql_query_str != NULL) {
+ row->trx_mysql_thread_id = thd_get_thread_id(trx->mysql_thd);
+ stmt = innobase_get_stmt(trx->mysql_thd, &stmt_len);
- if (strlen(*trx->mysql_query_str)
- > TRX_I_S_TRX_QUERY_MAX_LEN) {
+ if (stmt != NULL) {
- char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
+ char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
- memcpy(query, *trx->mysql_query_str,
- TRX_I_S_TRX_QUERY_MAX_LEN);
- query[TRX_I_S_TRX_QUERY_MAX_LEN] = '\0';
+ if (stmt_len > TRX_I_S_TRX_QUERY_MAX_LEN) {
+ stmt_len = TRX_I_S_TRX_QUERY_MAX_LEN;
+ }
- row->trx_query = ha_storage_put_memlim(
- cache->storage, query,
- TRX_I_S_TRX_QUERY_MAX_LEN + 1,
- MAX_ALLOWED_FOR_STORAGE(cache));
- } else {
+ memcpy(query, stmt, stmt_len);
+ query[stmt_len] = '\0';
- row->trx_query = ha_storage_put_str_memlim(
- cache->storage, *trx->mysql_query_str,
- MAX_ALLOWED_FOR_STORAGE(cache));
- }
+ row->trx_query = ha_storage_put_memlim(
+ cache->storage, stmt, stmt_len + 1,
+ MAX_ALLOWED_FOR_STORAGE(cache));
if (row->trx_query == NULL) {
diff --git a/storage/innodb_plugin/trx/trx0trx.c b/storage/innodb_plugin/trx/trx0trx.c
index 6ef7e62e6ae..9722bb59a5e 100644
--- a/storage/innodb_plugin/trx/trx0trx.c
+++ b/storage/innodb_plugin/trx/trx0trx.c
@@ -119,7 +119,6 @@ trx_create(
trx->table_id = ut_dulint_zero;
trx->mysql_thd = NULL;
- trx->mysql_query_str = NULL;
trx->active_trans = 0;
trx->duplicates = 0;
@@ -940,7 +939,6 @@ trx_commit_off_kernel(
trx->rseg = NULL;
trx->undo_no = ut_dulint_zero;
trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
- trx->mysql_query_str = NULL;
ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
ut_ad(UT_LIST_GET_LEN(trx->trx_locks) == 0);
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 4c81fbe521f..9176e99c912 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -785,6 +785,9 @@ static int maria_create_trn_for_mysql(MARIA_HA *info)
(uchar*) thd->query(),
thd->query_length());
}
+ else
+ DBUG_PRINT("info", ("lock_type: %d trnman_flags: %u",
+ info->lock_type, trnman_get_flags(trn))); /* QQ */
#endif
DBUG_RETURN(0);
}
@@ -1091,7 +1094,8 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
if (!maria_is_crashed(file) &&
(((param.testflag & T_CHECK_ONLY_CHANGED) &&
!(share->state.changed & (STATE_CHANGED | STATE_CRASHED |
- STATE_CRASHED_ON_REPAIR)) &&
+ STATE_CRASHED_ON_REPAIR |
+ STATE_IN_REPAIR)) &&
share->state.open_count == 0) ||
((param.testflag & T_FAST) && (share->state.open_count ==
(uint) (share->global_changed ? 1 :
@@ -1128,14 +1132,15 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
if (!error)
{
if ((share->state.changed & (STATE_CHANGED |
- STATE_CRASHED_ON_REPAIR |
+ STATE_CRASHED_ON_REPAIR | STATE_IN_REPAIR |
STATE_CRASHED | STATE_NOT_ANALYZED)) ||
(param.testflag & T_STATISTICS) || maria_is_crashed(file))
{
file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
pthread_mutex_lock(&share->intern_lock);
- share->state.changed &= ~(STATE_CHANGED | STATE_CRASHED |
- STATE_CRASHED_ON_REPAIR);
+ DBUG_PRINT("info", ("Reseting crashed state"));
+ share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED |
+ STATE_CRASHED_ON_REPAIR | STATE_IN_REPAIR);
if (!(table->db_stat & HA_READ_ONLY))
error= maria_update_state_info(&param, file,
UPDATE_TIME | UPDATE_OPEN_COUNT |
@@ -1549,8 +1554,9 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
{
if ((share->state.changed & STATE_CHANGED) || maria_is_crashed(file))
{
- share->state.changed &= ~(STATE_CHANGED | STATE_CRASHED |
- STATE_CRASHED_ON_REPAIR);
+ DBUG_PRINT("info", ("Reseting crashed state"));
+ share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED |
+ STATE_CRASHED_ON_REPAIR | STATE_IN_REPAIR);
file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
}
/*
@@ -2396,6 +2402,15 @@ int ha_maria::delete_table(const char *name)
}
+/* This is mainly for temporary tables, so no logging necessary */
+
+void ha_maria::drop_table(const char *name)
+{
+ (void) close();
+ (void) maria_delete_table(name);
+}
+
+
int ha_maria::external_lock(THD *thd, int lock_type)
{
DBUG_ENTER("ha_maria::external_lock");
diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h
index d7eeb0a68f7..6402571f043 100644
--- a/storage/maria/ha_maria.h
+++ b/storage/maria/ha_maria.h
@@ -135,6 +135,7 @@ public:
ulonglong *nb_reserved_values);
int rename_table(const char *from, const char *to);
int delete_table(const char *name);
+ void drop_table(const char *name);
int check(THD * thd, HA_CHECK_OPT * check_opt);
int analyze(THD * thd, HA_CHECK_OPT * check_opt);
int repair(THD * thd, HA_CHECK_OPT * check_opt);
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 89701913c9a..2c29fa27278 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -1377,7 +1377,8 @@ void _ma_compact_block_page(uchar *buff, uint block_size, uint rownr,
uint freed_size= 0;
uchar *dir, *end;
DBUG_ENTER("_ma_compact_block_page");
- DBUG_PRINT("enter", ("rownr: %u", rownr));
+ DBUG_PRINT("enter", ("rownr: %u min_read_from: %lu", rownr,
+ (ulong) min_read_from));
DBUG_ASSERT(max_entry > 0 &&
max_entry < (block_size - PAGE_HEADER_SIZE -
PAGE_SUFFIX_SIZE) / DIR_ENTRY_SIZE);
@@ -3407,13 +3408,14 @@ static my_bool allocate_and_write_block_record(MARIA_HA *info,
DBUG_ASSERT(row->checksum == (info->s->calc_checksum)(info, record));
}
}
+ DBUG_PRINT("info", ("rowid: %lu (%lu:%u) length: %u", (ulong) row->lastpos,
+ (ulong) ma_recordpos_to_page(row->lastpos),
+ ma_recordpos_to_dir_entry(row->lastpos),
+ row_pos.length));
if (write_block_record(info, (uchar*) 0, record, row,
blocks, blocks->block->org_bitmap_value != 0,
&row_pos, undo_lsn, 0))
- goto err; /* Error reading bitmap */
- DBUG_PRINT("exit", ("rowid: %lu (%lu:%u)", (ulong) row->lastpos,
- (ulong) ma_recordpos_to_page(row->lastpos),
- ma_recordpos_to_dir_entry(row->lastpos)));
+ goto err;
/* Now let checkpoint happen but don't commit */
DBUG_EXECUTE_IF("maria_over_alloc_bitmap", sleep(1000););
DBUG_RETURN(0);
@@ -4404,13 +4406,15 @@ crashed:
1 error
*/
-static my_bool read_long_data(MARIA_HA *info, uchar *to, ulong length,
+static my_bool read_long_data2(MARIA_HA *info, uchar *to, ulong length,
MARIA_EXTENT_CURSOR *extent,
uchar **data, uchar **end_of_data)
{
- DBUG_ENTER("read_long_data");
+ uint left_length;
+ left_length= (uint) (*end_of_data - *data);
+ DBUG_ENTER("read_long_data2");
DBUG_PRINT("enter", ("length: %lu left_length: %u",
- length, (uint) (*end_of_data - *data)));
+ length, left_length));
DBUG_ASSERT(*data <= *end_of_data);
/*
@@ -4422,14 +4426,15 @@ static my_bool read_long_data(MARIA_HA *info, uchar *to, ulong length,
This may change in the future, which is why we have the loop written
the way it's written.
*/
- if (extent->first_extent && length > (ulong) (*end_of_data - *data))
+ if (extent->first_extent && length > left_length)
+ {
*end_of_data= *data;
+ left_length= 0;
+ }
for(;;)
{
- uint left_length;
- left_length= (uint) (*end_of_data - *data);
- if (likely(left_length >= length))
+ if (unlikely(left_length >= length))
{
memcpy(to, *data, length);
(*data)+= length;
@@ -4441,10 +4446,25 @@ static my_bool read_long_data(MARIA_HA *info, uchar *to, ulong length,
length-= left_length;
if (!(*data= read_next_extent(info, extent, end_of_data)))
break;
+ left_length= (uint) (*end_of_data - *data);
}
DBUG_RETURN(1);
}
+static inline my_bool read_long_data(MARIA_HA *info, uchar *to, ulong length,
+ MARIA_EXTENT_CURSOR *extent,
+ uchar **data, uchar **end_of_data)
+{
+ uint left_length= (uint) (*end_of_data - *data);
+ if (likely(left_length >= length))
+ {
+ memcpy(to, *data, length);
+ (*data)+= length;
+ return 0;
+ }
+ return read_long_data2(info, to, length, extent, data, end_of_data);
+}
+
/*
Read a record from page (helper function for _ma_read_block_record())
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 69b1566a2bb..dd26046767f 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -154,6 +154,9 @@ int maria_chk_status(HA_CHECK *param, MARIA_HA *info)
if (maria_is_crashed_on_repair(info))
_ma_check_print_warning(param,
"Table is marked as crashed and last repair failed");
+ else if (maria_in_repair(info))
+ _ma_check_print_warning(param,
+ "Last repair was aborted before finishing");
else if (maria_is_crashed(info))
_ma_check_print_warning(param,
"Table is marked as crashed");
@@ -2242,7 +2245,7 @@ static my_bool protect_against_repair_crash(MARIA_HA *info,
if ((param->testflag & T_NO_CREATE_RENAME_LSN) == 0)
{
/* this can be true only for a transactional table */
- maria_mark_crashed_on_repair(info);
+ maria_mark_in_repair(info);
if (_ma_state_info_write(share,
MA_STATE_INFO_WRITE_DONT_MOVE_OFFSET |
MA_STATE_INFO_WRITE_LOCK))
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index 98ccb3e23cd..a43513cfaa0 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -209,6 +209,7 @@ static MARIA_HA *maria_clone_internal(MARIA_SHARE *share, const char *name,
DBUG_RETURN(m_info);
err:
+ DBUG_PRINT("error", ("error: %d", my_errno));
save_errno=my_errno ? my_errno : HA_ERR_END_OF_FILE;
if ((save_errno == HA_ERR_CRASHED) ||
(save_errno == HA_ERR_CRASHED_ON_USAGE) ||
@@ -918,10 +919,15 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
if (!(m_info= maria_clone_internal(share, name, mode, data_file)))
goto err;
+ if (maria_is_crashed(m_info))
+ DBUG_PRINT("warning", ("table is crashed: changed: %u",
+ share->state.changed));
+
pthread_mutex_unlock(&THR_LOCK_maria);
DBUG_RETURN(m_info);
err:
+ DBUG_PRINT("error", ("error: %d errpos: %d", my_errno, errpos));
save_errno=my_errno ? my_errno : HA_ERR_END_OF_FILE;
if ((save_errno == HA_ERR_CRASHED) ||
(save_errno == HA_ERR_CRASHED_ON_USAGE) ||
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index e74f52b2ef6..58f16658957 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -1,4 +1,5 @@
/* Copyright (C) 2006, 2007 MySQL AB
+ Copyright (C) 2010 Monty Program 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
@@ -56,6 +57,7 @@ static ulong skipped_undo_phase;
static ulonglong now; /**< for tracking execution time of phases */
static int (*save_error_handler_hook)(uint, const char *,myf);
static uint recovery_warnings; /**< count of warnings */
+static uint recovery_found_crashed_tables;
#define prototype_redo_exec_hook(R) \
static int exec_REDO_LOGREC_ ## R(const TRANSLOG_HEADER_BUFFER *rec)
@@ -107,7 +109,8 @@ prototype_undo_exec_hook(UNDO_KEY_DELETE);
prototype_undo_exec_hook(UNDO_KEY_DELETE_WITH_ROOT);
prototype_undo_exec_hook(UNDO_BULK_INSERT);
-static int run_redo_phase(LSN lsn, enum maria_apply_log_way apply);
+static int run_redo_phase(LSN lsn, LSN end_lsn,
+ enum maria_apply_log_way apply);
static uint end_of_redo_phase(my_bool prepare_for_undo_phase);
static int run_undo_phase(uint uncommitted);
static void display_record_position(const LOG_DESC *log_desc,
@@ -215,11 +218,11 @@ int maria_recovery_from_log(void)
#endif
tprint(trace_file, "TRACE of the last MARIA recovery from mysqld\n");
DBUG_ASSERT(maria_pagecache->inited);
- res= maria_apply_log(LSN_IMPOSSIBLE, MARIA_LOG_APPLY, trace_file,
- TRUE, TRUE, TRUE, &warnings_count);
+ res= maria_apply_log(LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, MARIA_LOG_APPLY,
+ trace_file, TRUE, TRUE, TRUE, &warnings_count);
if (!res)
{
- if (warnings_count == 0)
+ if (warnings_count == 0 && recovery_found_crashed_tables == 0)
tprint(trace_file, "SUCCESS\n");
else
tprint(trace_file, "DOUBTFUL (%u warnings, check previous output)\n",
@@ -237,6 +240,7 @@ int maria_recovery_from_log(void)
@param from_lsn LSN from which log reading/applying should start;
LSN_IMPOSSIBLE means "use last checkpoint"
+ @param end_lsn Apply until this. LSN_IMPOSSIBLE means until end.
@param apply how log records should be applied or not
@param trace_file trace file where progress/debug messages will go
@param skip_DDLs_arg Should DDL records (CREATE/RENAME/DROP/REPAIR)
@@ -253,7 +257,8 @@ int maria_recovery_from_log(void)
@retval !=0 Error
*/
-int maria_apply_log(LSN from_lsn, enum maria_apply_log_way apply,
+int maria_apply_log(LSN from_lsn, LSN end_lsn,
+ enum maria_apply_log_way apply,
FILE *trace_file,
my_bool should_run_undo_phase, my_bool skip_DDLs_arg,
my_bool take_checkpoints, uint *warnings_count)
@@ -261,14 +266,16 @@ int maria_apply_log(LSN from_lsn, enum maria_apply_log_way apply,
int error= 0;
uint uncommitted_trans;
ulonglong old_now;
+ my_bool abort_message_printed= 0;
DBUG_ENTER("maria_apply_log");
DBUG_ASSERT(apply == MARIA_LOG_APPLY || !should_run_undo_phase);
DBUG_ASSERT(!maria_multi_threaded);
- recovery_warnings= 0;
+ recovery_warnings= recovery_found_crashed_tables= 0;
maria_recovery_changed_data= 0;
/* checkpoints can happen only if TRNs have been built */
DBUG_ASSERT(should_run_undo_phase || !take_checkpoints);
+ DBUG_ASSERT(end_lsn == LSN_IMPOSSIBLE || should_run_undo_phase == 0);
all_active_trans= (struct st_trn_for_recovery *)
my_malloc((SHORT_TRID_MAX + 1) * sizeof(struct st_trn_for_recovery),
MYF(MY_ZEROFILL));
@@ -314,7 +321,7 @@ int maria_apply_log(LSN from_lsn, enum maria_apply_log_way apply,
now= my_getsystime();
in_redo_phase= TRUE;
trnman_init(max_trid_in_control_file);
- if (run_redo_phase(from_lsn, apply))
+ if (run_redo_phase(from_lsn, end_lsn, apply))
{
ma_message_no_user(0, "Redo phase failed");
trnman_destroy();
@@ -322,6 +329,15 @@ int maria_apply_log(LSN from_lsn, enum maria_apply_log_way apply,
}
trnman_destroy();
+ if (end_lsn != LSN_IMPOSSIBLE)
+ {
+ abort_message_printed= 1;
+ my_message(HA_ERR_INITIALIZATION,
+ "Maria recovery aborted as end_lsn/end of file was reached",
+ MYF(0));
+ goto err2;
+ }
+
if ((uncommitted_trans=
end_of_redo_phase(should_run_undo_phase)) == (uint)-1)
{
@@ -438,10 +454,15 @@ int maria_apply_log(LSN from_lsn, enum maria_apply_log_way apply,
goto end;
err:
- error= 1;
tprint(tracef, "\nRecovery of tables with transaction logs FAILED\n");
+err2:
if (trns_created)
delete_all_transactions();
+ error= 1;
+ if (close_all_tables())
+ {
+ ma_message_no_user(0, "closing of tables failed");
+ }
end:
error_handler_hook= save_error_handler_hook;
hash_free(&all_dirty_pages);
@@ -456,7 +477,7 @@ end:
log_record_buffer.str= NULL;
log_record_buffer.length= 0;
ma_checkpoint_end();
- *warnings_count= recovery_warnings;
+ *warnings_count= recovery_warnings + recovery_found_crashed_tables;
if (recovery_message_printed != REC_MSG_NONE)
{
if (procent_printed)
@@ -478,7 +499,7 @@ end:
maria_recovery_changed_data= 1;
}
- if (error)
+ if (error && !abort_message_printed)
my_message(HA_ERR_INITIALIZATION,
"Maria recovery failed. Please run maria_chk -r on all maria "
"tables and delete all maria_log.######## files", MYF(0));
@@ -726,9 +747,12 @@ prototype_redo_exec_hook(REDO_CREATE_TABLE)
maria_close(info);
info= NULL;
}
- else /* one or two files absent, or header corrupted... */
- tprint(tracef, "Table '%s' can't be opened, probably does not exist\n",
- name);
+ else
+ {
+ /* one or two files absent, or header corrupted... */
+ tprint(tracef, "Table '%s' can't be opened (Error: %d)\n",
+ name, my_errno);
+ }
/* if does not exist, or is older, overwrite it */
ptr= name + strlen(name) + 1;
if ((flags= ptr[0] ? HA_DONT_TOUCH_DATA : 0))
@@ -1206,6 +1230,7 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
*/
tprint(tracef, ", record is corrupted");
info= NULL;
+ recovery_warnings++;
goto end;
}
tprint(tracef, "Table '%s', id %u", name, sid);
@@ -1215,6 +1240,8 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
tprint(tracef, ", is absent (must have been dropped later?)"
" or its header is so corrupted that we cannot open it;"
" we skip it");
+ if (my_errno != ENOENT)
+ recovery_found_crashed_tables++;
error= 0;
goto end;
}
@@ -1238,6 +1265,7 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
*/
tprint(tracef, ", is not transactional. Ignoring open request");
error= -1;
+ recovery_warnings++;
goto end;
}
if (cmp_translog_addr(lsn_of_file_id, share->state.create_rename_lsn) <= 0)
@@ -1246,6 +1274,7 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
" LOGREC_FILE_ID's LSN (%lu,0x%lx), ignoring open request",
LSN_IN_PARTS(share->state.create_rename_lsn),
LSN_IN_PARTS(lsn_of_file_id));
+ recovery_warnings++;
error= -1;
goto end;
/*
@@ -1257,6 +1286,7 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
{
eprint(tracef, "Table '%s' is crashed, skipping it. Please repair it with"
" maria_chk -r", share->open_file_name.str);
+ recovery_found_crashed_tables++;
error= -1; /* not fatal, try with other tables */
goto end;
/*
@@ -1275,6 +1305,7 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
(kfile_len == MY_FILEPOS_ERROR))
{
tprint(tracef, ", length unknown\n");
+ recovery_warnings++;
goto end;
}
if (share->state.state.data_file_length != dfile_len)
@@ -2358,7 +2389,7 @@ prototype_undo_exec_hook(UNDO_BULK_INSERT)
}
-static int run_redo_phase(LSN lsn, enum maria_apply_log_way apply)
+static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply)
{
TRANSLOG_HEADER_BUFFER rec;
struct st_translog_scanner_data scanner;
@@ -2486,6 +2517,17 @@ static int run_redo_phase(LSN lsn, enum maria_apply_log_way apply)
tprint(tracef, "Cannot find record where it should be\n");
goto err;
}
+ if (lsn_end != LSN_IMPOSSIBLE && rec2.lsn >= lsn_end)
+ {
+ tprint(tracef,
+ "lsn_end reached at (%lu,0x%lx). "
+ "Skipping rest of redo entries",
+ LSN_IN_PARTS(rec2.lsn));
+ translog_destroy_scanner(&scanner);
+ translog_free_record_header(&rec);
+ return(0);
+ }
+
if (translog_scanner_init(rec2.lsn, 1, &scanner2, 1))
{
tprint(tracef, "Scanner2 init failed\n");
diff --git a/storage/maria/ma_recovery.h b/storage/maria/ma_recovery.h
index aa8fa7ecae9..0bfcdd17d39 100644
--- a/storage/maria/ma_recovery.h
+++ b/storage/maria/ma_recovery.h
@@ -26,7 +26,7 @@ C_MODE_START
enum maria_apply_log_way
{ MARIA_LOG_APPLY, MARIA_LOG_DISPLAY_HEADER, MARIA_LOG_CHECK };
int maria_recovery_from_log(void);
-int maria_apply_log(LSN lsn, enum maria_apply_log_way apply,
+int maria_apply_log(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply,
FILE *trace_file,
my_bool execute_undo_phase, my_bool skip_DDLs,
my_bool take_checkpoints, uint *warnings_count);
diff --git a/storage/maria/ma_recovery_util.c b/storage/maria/ma_recovery_util.c
index a45a990472e..19e61daf4ef 100644
--- a/storage/maria/ma_recovery_util.c
+++ b/storage/maria/ma_recovery_util.c
@@ -57,8 +57,16 @@ void tprint(FILE *trace_file __attribute__ ((unused)),
const char *format __attribute__ ((unused)), ...)
{
va_list args;
+#ifndef DBUG_OFF
+ {
+ char buff[1024];
+ va_start(args, format);
+ vsnprintf(buff, sizeof(buff)-1, format, args);
+ DBUG_PRINT("info", ("%s", buff));
+ va_end(args);
+ }
+#endif
va_start(args, format);
- DBUG_PRINT("info", ("%s", format));
if (trace_file != NULL)
{
if (procent_printed)
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index 5e3ccdfaed1..a552d15a650 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -1987,9 +1987,9 @@ static my_bool _ma_log_split(MARIA_PAGE *ma_page,
uint changed_length)
{
LSN lsn;
- uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 3+3+3+3+3+2];
+ uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 3+3+3+3+3+2 +7];
uchar *log_pos;
- LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 3];
+ LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 4];
uint offset= (uint) (key_pos - ma_page->buff);
uint translog_parts, extra_length;
MARIA_HA *info= ma_page->info;
@@ -2085,6 +2085,22 @@ static my_bool _ma_log_split(MARIA_PAGE *ma_page,
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= (uint) (log_pos -
log_data);
+#ifdef EXTRA_DEBUG_KEY_CHANGES
+ {
+ int page_length= ma_page->size;
+ ha_checksum crc;
+ crc= my_checksum(0, ma_page->buff + LSN_STORE_SIZE,
+ page_length - LSN_STORE_SIZE);
+ log_pos[0]= KEY_OP_CHECK;
+ int2store(log_pos+1, page_length);
+ int4store(log_pos+3, crc);
+ log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].str= log_pos;
+ log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].length= 7;
+ extra_length+= 7;
+ translog_parts++;
+ }
+#endif
+
DBUG_RETURN(translog_write_record(&lsn, LOGREC_REDO_INDEX,
info->trn, info,
(translog_size_t)
@@ -2122,8 +2138,8 @@ static my_bool _ma_log_del_prefix(MARIA_PAGE *ma_page,
int move_length)
{
LSN lsn;
- uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 12], *log_pos;
- LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2];
+ uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 12 + 7], *log_pos;
+ LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 3];
uint offset= (uint) (key_pos - ma_page->buff);
uint diff_length= org_length + move_length - new_length;
uint translog_parts, extra_length;
@@ -2190,6 +2206,22 @@ static my_bool _ma_log_del_prefix(MARIA_PAGE *ma_page,
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= (uint) (log_pos -
log_data);
+#ifdef EXTRA_DEBUG_KEY_CHANGES
+ {
+ int page_length= ma_page->size;
+ ha_checksum crc;
+ crc= my_checksum(0, ma_page->buff + LSN_STORE_SIZE,
+ page_length - LSN_STORE_SIZE);
+ log_pos[0]= KEY_OP_CHECK;
+ int2store(log_pos+1, page_length);
+ int4store(log_pos+3, crc);
+ log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].str= log_pos;
+ log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].length= 7;
+ extra_length+= 7;
+ translog_parts++;
+ }
+#endif
+
DBUG_RETURN(translog_write_record(&lsn, LOGREC_REDO_INDEX,
info->trn, info,
(translog_size_t)
@@ -2215,9 +2247,9 @@ static my_bool _ma_log_key_middle(MARIA_PAGE *ma_page,
uint key_length, int move_length)
{
LSN lsn;
- uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 3+5+3+3+3];
+ uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 3+5+3+3+3 + 7];
uchar *log_pos;
- LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 4];
+ LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 5];
uint key_offset;
uint translog_parts, extra_length;
my_off_t page;
@@ -2300,6 +2332,22 @@ static my_bool _ma_log_key_middle(MARIA_PAGE *ma_page,
key_length);
}
+#ifdef EXTRA_DEBUG_KEY_CHANGES
+ {
+ int page_length= ma_page->size;
+ ha_checksum crc;
+ crc= my_checksum(0, ma_page->buff + LSN_STORE_SIZE,
+ page_length - LSN_STORE_SIZE);
+ log_pos[0]= KEY_OP_CHECK;
+ int2store(log_pos+1, page_length);
+ int4store(log_pos+3, crc);
+ log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].str= log_pos;
+ log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].length= 7;
+ extra_length+= 7;
+ translog_parts++;
+ }
+#endif
+
DBUG_RETURN(translog_write_record(&lsn, LOGREC_REDO_INDEX,
info->trn, info,
(translog_size_t)
@@ -2327,6 +2375,7 @@ static my_bool _ma_log_middle(MARIA_PAGE *ma_page,
uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 3 + 5], *log_pos;
MARIA_HA *info= ma_page->info;
my_off_t page;
+ uint translog_parts, extra_length;
DBUG_ENTER("_ma_log_middle");
DBUG_PRINT("enter", ("page: %lu", (ulong) page));
@@ -2352,12 +2401,31 @@ static my_bool _ma_log_middle(MARIA_PAGE *ma_page,
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= ((char*) buff +
info->s->keypage_header);
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= data_changed_first;
+ translog_parts= 2;
+ extra_length= data_changed_first;
+
+#ifdef EXTRA_DEBUG_KEY_CHANGES
+ {
+ int page_length= ma_page->size;
+ ha_checksum crc;
+ crc= my_checksum(0, ma_page->buff + LSN_STORE_SIZE,
+ page_length - LSN_STORE_SIZE);
+ log_pos[0]= KEY_OP_CHECK;
+ int2store(log_pos+1, page_length);
+ int4store(log_pos+3, crc);
+ log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].str= log_pos;
+ log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].length= 7;
+ extra_length+= 7;
+ translog_parts++;
+ }
+#endif
+
DBUG_RETURN(translog_write_record(&lsn, LOGREC_REDO_INDEX,
info->trn, info,
(translog_size_t)
log_array[TRANSLOG_INTERNAL_PARTS +
- 0].length + data_changed_first,
- TRANSLOG_INTERNAL_PARTS + 2,
+ 0].length + extra_length,
+ TRANSLOG_INTERNAL_PARTS + translog_parts,
log_array, log_data, NULL));
}
#endif
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index 0bf38ac5dc8..985e9d2bc85 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -42,6 +42,7 @@ static CHARSET_INFO *set_collation;
static int stopwords_inited= 0;
static MY_TMPDIR maria_chk_tmpdir;
static my_bool opt_transaction_logging, opt_debug, opt_require_control_file;
+static my_bool opt_warning_for_wrong_transid;
static const char *type_names[]=
{
@@ -193,7 +194,7 @@ enum options_mc {
OPT_FT_MAX_WORD_LEN, OPT_FT_STOPWORD_FILE,
OPT_MAX_RECORD_LENGTH, OPT_AUTO_CLOSE, OPT_STATS_METHOD, OPT_TRANSACTION_LOG,
OPT_SKIP_SAFEMALLOC, OPT_ZEROFILL_KEEP_LSN, OPT_REQUIRE_CONTROL_FILE,
- OPT_LOG_DIR, OPT_DATADIR
+ OPT_LOG_DIR, OPT_DATADIR, OPT_WARNING_FOR_WRONG_TRANSID
};
static struct my_option my_long_options[] =
@@ -213,7 +214,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.",
- (uchar**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (char**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"check", 'c',
"Check table for errors.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -233,8 +234,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"data-file-length", 'D',
"Max length of data file (when recreating data-file when it's full).",
- (uchar**) &check_param.max_data_file_length,
- (uchar**) &check_param.max_data_file_length,
+ &check_param.max_data_file_length,
+ &check_param.max_data_file_length,
0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extend-check", 'e',
"If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.",
@@ -256,20 +257,20 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"keys-used", 'k',
"Tell MARIA to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts.",
- (uchar**) &check_param.keys_in_use,
- (uchar**) &check_param.keys_in_use,
+ &check_param.keys_in_use,
+ &check_param.keys_in_use,
0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0},
{"datadir", OPT_DATADIR,
"Path for control file (and logs if --log-dir not used).",
- (uchar**) &maria_data_root, 0, 0, GET_STR, REQUIRED_ARG,
+ &maria_data_root, 0, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"log-dir", OPT_LOG_DIR,
"Path for log files.",
- (uchar**) &opt_log_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (char**) &opt_log_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"max-record-length", OPT_MAX_RECORD_LENGTH,
"Skip rows bigger than this if maria_chk can't allocate memory to hold it",
- (uchar**) &check_param.max_record_length,
- (uchar**) &check_param.max_record_length,
+ &check_param.max_record_length,
+ &check_param.max_record_length,
0, GET_ULL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0},
{"medium-check", 'm',
"Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.",
@@ -302,12 +303,13 @@ static struct my_option my_long_options[] =
#endif
{"set-auto-increment", 'A',
"Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.",
- (uchar**) &check_param.auto_increment_value,
- (uchar**) &check_param.auto_increment_value,
+ &check_param.auto_increment_value,
+ &check_param.auto_increment_value,
0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"set-collation", OPT_SET_COLLATION,
"Change the collation used by the index",
- (uchar**) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (char**) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG,
+ 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -326,19 +328,19 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sort-records", 'R',
"Sort records according to an index. This makes your data much more localized and may speed up things. (It may be VERY slow to do a sort the first time!)",
- (uchar**) &check_param.opt_sort_key,
- (uchar**) &check_param.opt_sort_key,
+ &check_param.opt_sort_key,
+ &check_param.opt_sort_key,
0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"tmpdir", 't',
- "Path for temporary files.",
- (uchar**) &opt_tmpdir,
+ {"tmpdir", 't', "Path for temporary files.", (char**) &opt_tmpdir,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"transaction-log", OPT_TRANSACTION_LOG,
"Log repair command to transaction log",
- (uchar**) &opt_transaction_logging, (uchar**) &opt_transaction_logging,
+ &opt_transaction_logging, &opt_transaction_logging,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"update-state", 'U',
- "Mark tables as crashed if any errors were found.",
+ "Mark tables as crashed if any errors were found and clean if check didn't "
+ "find any errors. This allows one to get rid of warnings like 'table not "
+ "properly closed'",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"unpack", 'u',
"Unpack file packed with mariapack.",
@@ -350,48 +352,53 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"wait", 'w', "Wait if table is locked.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"warning-for-wrong-transaction-id", OPT_WARNING_FOR_WRONG_TRANSID,
+ "Give a warning if we find a transaction id in the table that is bigger"
+ "than what exists in the control file. Use --skip-... to disable warning",
+ &opt_warning_for_wrong_transid, &opt_warning_for_wrong_transid,
+ 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{ "page_buffer_size", OPT_PAGE_BUFFER_SIZE,
"Size of page buffer. Used by --safe-repair",
- (uchar**) &check_param.use_buffers, (uchar**) &check_param.use_buffers, 0,
+ &check_param.use_buffers, &check_param.use_buffers, 0,
GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, 1024L*1024L,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0},
{ "read_buffer_size", OPT_READ_BUFFER_SIZE, "",
- (uchar**) &check_param.read_buffer_length,
- (uchar**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ &check_param.read_buffer_length,
+ &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
- (uchar**) &check_param.write_buffer_length,
- (uchar**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ &check_param.write_buffer_length,
+ &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE,
"Size of sort buffer. Used by --recover",
- (uchar**) &check_param.sort_buffer_length,
- (uchar**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ &check_param.sort_buffer_length,
+ &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
- (uchar**) &check_param.sort_key_blocks,
- (uchar**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
+ &check_param.sort_key_blocks,
+ &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0},
- { "decode_bits", OPT_DECODE_BITS, "", (uchar**) &decode_bits,
- (uchar**) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
- { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (uchar**) &ft_min_word_len,
- (uchar**) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
+ { "decode_bits", OPT_DECODE_BITS, "", &decode_bits,
+ &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
+ { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", &ft_min_word_len,
+ &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
0, 1, 0},
- { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (uchar**) &ft_max_word_len,
- (uchar**) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
+ { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", &ft_max_word_len,
+ &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
HA_FT_MAXCHARLEN, 0, 1, 0},
{ "maria_ft_stopword_file", OPT_FT_STOPWORD_FILE,
"Use stopwords from this file instead of built-in list.",
- (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR,
+ (char**) &ft_stopword_file, (char**) &ft_stopword_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "stats_method", OPT_STATS_METHOD,
"Specifies how index statistics collection code should treat NULLs. "
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
- (uchar**) &maria_stats_method_str, (uchar**) &maria_stats_method_str, 0,
+ (char**) &maria_stats_method_str, (char**) &maria_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "zerofill", 'z',
"Fill empty space in data and index files with zeroes",
@@ -990,7 +997,7 @@ static int maria_chk(HA_CHECK *param, char *filename)
if ((param->testflag & (T_REP_ANY | T_SORT_RECORDS)) &&
((share->state.changed & (STATE_CHANGED | STATE_CRASHED |
- STATE_CRASHED_ON_REPAIR) ||
+ STATE_CRASHED_ON_REPAIR | STATE_IN_REPAIR) ||
!(param->testflag & T_CHECK_ONLY_CHANGED))))
need_to_check=1;
@@ -1008,7 +1015,7 @@ static int maria_chk(HA_CHECK *param, char *filename)
}
if ((param->testflag & T_CHECK_ONLY_CHANGED) &&
(share->state.changed & (STATE_CHANGED | STATE_CRASHED |
- STATE_CRASHED_ON_REPAIR)))
+ STATE_CRASHED_ON_REPAIR | STATE_IN_REPAIR)))
need_to_check=1;
if (!need_to_check)
{
@@ -1225,8 +1232,11 @@ static int maria_chk(HA_CHECK *param, char *filename)
if (!error && (param->testflag & T_ZEROFILL))
error= maria_zerofill(param, info, filename);
if (!error)
+ {
+ DBUG_PRINT("info", ("Reseting crashed state"));
share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED |
- STATE_CRASHED_ON_REPAIR);
+ STATE_CRASHED_ON_REPAIR | STATE_IN_REPAIR);
+ }
else
maria_mark_crashed(info);
}
@@ -1239,6 +1249,8 @@ static int maria_chk(HA_CHECK *param, char *filename)
llstr(info->state->records,llbuff),
llstr(info->state->del,llbuff2));
maria_chk_init_for_check(param, info);
+ if (opt_warning_for_wrong_transid == 0)
+ param->max_trid= ~ (ulonglong) 0;
error= maria_chk_status(param,info);
maria_intersect_keys_active(share->state.key_map, param->keys_in_use);
error|= maria_chk_size(param,info);
@@ -1275,11 +1287,15 @@ static int maria_chk(HA_CHECK *param, char *filename)
}
if (!error)
{
- if ((share->state.changed & STATE_CHANGED) &&
- (param->testflag & T_UPDATE_STATE))
+ if (((share->state.changed &
+ (STATE_CHANGED | STATE_CRASHED | STATE_CRASHED_ON_REPAIR |
+ STATE_IN_REPAIR)) ||
+ share->state.open_count != 0)
+ && (param->testflag & T_UPDATE_STATE))
info->update|=HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
+ DBUG_PRINT("info", ("Reseting crashed state"));
share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED |
- STATE_CRASHED_ON_REPAIR);
+ STATE_CRASHED_ON_REPAIR | STATE_IN_REPAIR);
}
else if (!maria_is_crashed(info) &&
(param->testflag & T_UPDATE_STATE))
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index 868885c961b..e9980cf9695 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -611,6 +611,7 @@ struct st_maria_handler
#define STATE_NOT_ZEROFILLED 128
#define STATE_NOT_MOVABLE 256
#define STATE_MOVED 512 /* set if base->uuid != maria_uuid */
+#define STATE_IN_REPAIR 1024 /* We are running repair on table */
/* options to maria_read_cache */
@@ -666,11 +667,17 @@ struct st_maria_handler
#define maria_mark_crashed_on_repair(x) do{(x)->s->state.changed|= \
STATE_CRASHED|STATE_CRASHED_ON_REPAIR; \
(x)->update|= HA_STATE_CHANGED; \
- DBUG_PRINT("error", \
- ("Marked table crashed")); \
+ DBUG_PRINT("error", ("Marked table crashed on repair")); \
+ }while(0)
+#define maria_mark_in_repair(x) do{(x)->s->state.changed|= \
+ STATE_CRASHED | STATE_IN_REPAIR; \
+ (x)->update|= HA_STATE_CHANGED; \
+ DBUG_PRINT("error", ("Marked table crashed for repair")); \
}while(0)
#define maria_is_crashed(x) ((x)->s->state.changed & STATE_CRASHED)
#define maria_is_crashed_on_repair(x) ((x)->s->state.changed & STATE_CRASHED_ON_REPAIR)
+#define maria_in_repair(x) ((x)->s->state.changed & STATE_IN_REPAIR)
+
#ifdef EXTRA_DEBUG
/**
Brings additional information in certain debug builds and in standalone
diff --git a/storage/maria/maria_ftdump.c b/storage/maria/maria_ftdump.c
index 8b545e6e9af..895bbf85b0f 100644
--- a/storage/maria/maria_ftdump.c
+++ b/storage/maria/maria_ftdump.c
@@ -46,7 +46,7 @@ static struct my_option my_long_options[] =
{"stats", 's', "Report global stats.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Be verbose.",
- (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ &verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c
index 78cf86fc6a9..0673f571a6b 100644
--- a/storage/maria/maria_pack.c
+++ b/storage/maria/maria_pack.c
@@ -259,10 +259,10 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"backup", 'b', "Make a backup of the table as table_name.OLD.",
- (uchar**) &backup, (uchar**) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ &backup, &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR_MP,
- "Directory where character sets are.", (uchar**) &charsets_dir,
- (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", &charsets_dir,
+ &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
@@ -270,7 +270,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"join", 'j',
"Join all given tables into 'new_table_name'. All tables MUST have identical layouts.",
- (uchar**) &join_table, (uchar**) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ &join_table, &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -284,8 +284,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"wait", 'w', "Wait and retry if table is in use.", (uchar**) &opt_wait,
- (uchar**) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"wait", 'w', "Wait and retry if table is in use.", &opt_wait,
+ &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/maria/maria_read_log.c b/storage/maria/maria_read_log.c
index 2b2fa692f24..a526eede4d7 100644
--- a/storage/maria/maria_read_log.c
+++ b/storage/maria/maria_read_log.c
@@ -1,4 +1,5 @@
/* Copyright (C) 2007 MySQL AB
+ Copyright (C) 2010 Monty Program 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
@@ -32,7 +33,7 @@ static my_bool opt_display_only, opt_apply, opt_apply_undo, opt_silent;
static my_bool opt_check;
static const char *opt_tmpdir;
static ulong opt_page_buffer_size;
-static ulonglong opt_start_from_lsn;
+static ulonglong opt_start_from_lsn, opt_end_lsn;
static MY_TMPDIR maria_chk_tmpdir;
@@ -119,8 +120,14 @@ int main(int argc, char **argv)
LSN_IN_PARTS(lsn));
}
+ if (opt_end_lsn != LSN_IMPOSSIBLE)
+ {
+ /* We can't apply undo if we use end_lsn */
+ opt_apply_undo= 0;
+ }
+
fprintf(stdout, "TRACE of the last maria_read_log\n");
- if (maria_apply_log(lsn, opt_apply ? MARIA_LOG_APPLY :
+ if (maria_apply_log(lsn, opt_end_lsn, opt_apply ? MARIA_LOG_APPLY :
(opt_check ? MARIA_LOG_CHECK :
MARIA_LOG_DISPLAY_HEADER), opt_silent ? NULL : stdout,
opt_apply_undo, FALSE, FALSE, &warnings_count))
@@ -150,6 +157,9 @@ err:
#include "ma_check_standalone.h"
+enum options_mc {
+ OPT_CHARSETS_DIR=256
+};
static struct my_option my_long_options[] =
{
@@ -158,6 +168,9 @@ static struct my_option my_long_options[] =
" Displays a lot of information if not run with --silent",
(uchar **) &opt_apply, (uchar **) &opt_apply, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"character-sets-dir", OPT_CHARSETS_DIR,
+ "Directory where character sets are.",
+ (char**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"check", 'c',
"if --display-only, check if record is fully readable (for debugging)",
(uchar **) &opt_check, (uchar **) &opt_check, 0,
@@ -171,17 +184,20 @@ static struct my_option my_long_options[] =
{"display-only", 'd', "display brief info read from records' header",
(uchar **) &opt_display_only, (uchar **) &opt_display_only, 0, GET_BOOL,
NO_ARG,0, 0, 0, 0, 0, 0},
- {"maria_log_dir_path", 'l',
+ {"maria-log-dir-path", 'l',
"Path to the directory where to store transactional log",
(uchar **) &maria_data_root, (uchar **) &maria_data_root, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- { "page_buffer_size", 'P', "",
- (uchar**) &opt_page_buffer_size, (uchar**) &opt_page_buffer_size, 0,
+ { "page-buffer-size", 'P', "",
+ &opt_page_buffer_size, &opt_page_buffer_size, 0,
GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT,
(long) USE_BUFFER_INIT, (long) ~(ulong) 0, (long) MALLOC_OVERHEAD,
(long) IO_SIZE, 0},
- { "start_from_lsn", 'o', "Start reading log from this lsn",
- (uchar**) &opt_start_from_lsn, (uchar**) &opt_start_from_lsn,
+ { "start-from-lsn", 'o', "Start reading log from this lsn",
+ &opt_start_from_lsn, &opt_start_from_lsn,
+ 0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 },
+ { "end-lsn", 'e', "Stop applying at this lsn. If end-lsn is used, UNDO:s "
+ "will not be applied", &opt_end_lsn, &opt_end_lsn,
0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 },
{"silent", 's', "Print less information during apply/undo phase",
(uchar **) &opt_silent, (uchar **) &opt_silent, 0,
@@ -193,7 +209,7 @@ static struct my_option my_long_options[] =
#else
"colon (:)"
#endif
- , (uchar**) &opt_tmpdir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ , (char**) &opt_tmpdir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"undo", 'u', "Apply UNDO records to tables. (disable with --disable-undo)",
(uchar **) &opt_apply_undo, (uchar **) &opt_apply_undo, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
@@ -206,7 +222,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- VOID(printf("%s Ver 1.2 for %s on %s\n",
+ VOID(printf("%s Ver 1.3 for %s on %s\n",
my_progname_short, SYSTEM_TYPE, MACHINE_TYPE));
NETWARE_SET_SCREEN_MODE(1);
}
diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c
index ceb8ad2ae2d..2e03606ca7c 100644
--- a/storage/maria/trnman.c
+++ b/storage/maria/trnman.c
@@ -176,6 +176,7 @@ int trnman_init(TrID initial_trid)
trnman_active_transactions= 0;
trnman_committed_transactions= 0;
trnman_allocated_transactions= 0;
+ dummy_transaction_object.min_read_from= ~(TrID) 0; /* for recovery */
pool= 0;
global_trid_generator= initial_trid;
diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c
index aea8d86e380..39303fb80e5 100644
--- a/storage/myisam/mi_test1.c
+++ b/storage/myisam/mi_test1.c
@@ -539,21 +539,21 @@ static struct my_option my_long_options[] =
{"debug", '#', "Undocumented",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"delete_rows", 'd', "Undocumented", (uchar**) &remove_count,
- (uchar**) &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+ {"delete_rows", 'd', "Undocumented", &remove_count,
+ &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
{"help", '?', "Display help and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"insert_rows", 'i', "Undocumented", (uchar**) &insert_count,
- (uchar**) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+ {"insert_rows", 'i', "Undocumented", &insert_count,
+ &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
{"key_alpha", 'a', "Use a key of type HA_KEYTYPE_TEXT",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"key_binary_pack", 'B', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"key_blob", 'b', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"key_cache", 'K', "Undocumented", (uchar**) &key_cacheing,
- (uchar**) &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"key_length", 'k', "Undocumented", (uchar**) &key_length, (uchar**) &key_length,
+ {"key_cache", 'K', "Undocumented", &key_cacheing,
+ &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"key_length", 'k', "Undocumented", &key_length, &key_length,
0, GET_UINT, REQUIRED_ARG, 6, 0, 0, 0, 0, 0},
{"key_multiple", 'm', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -564,21 +564,21 @@ static struct my_option my_long_options[] =
{"key_varchar", 'w', "Test VARCHAR keys",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"null_fields", 'N', "Define fields with NULL",
- (uchar**) &null_fields, (uchar**) &null_fields, 0, GET_BOOL, NO_ARG,
+ &null_fields, &null_fields, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"row_fixed_size", 'S', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"row_pointer_size", 'R', "Undocumented", (uchar**) &rec_pointer_size,
- (uchar**) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"row_pointer_size", 'R', "Undocumented", &rec_pointer_size,
+ &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Undocumented",
- (uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"skip_update", 'U', "Undocumented", (uchar**) &skip_update,
- (uchar**) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"unique", 'C', "Undocumented", (uchar**) &opt_unique, (uchar**) &opt_unique, 0,
+ &silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"skip_update", 'U', "Undocumented", &skip_update,
+ &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"unique", 'C', "Undocumented", &opt_unique, &opt_unique, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"update_rows", 'u', "Undocumented", (uchar**) &update_count,
- (uchar**) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
- {"verbose", 'v', "Be more verbose", (uchar**) &verbose, (uchar**) &verbose, 0,
+ {"update_rows", 'u', "Undocumented", &update_count,
+ &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+ {"verbose", 'v', "Be more verbose", &verbose, &verbose, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Print version number and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index d5d1c548717..c7ab2baa87c 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -168,7 +168,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.",
- (uchar**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (char**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"check", 'c',
"Check table for errors.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -188,8 +188,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"data-file-length", 'D',
"Max length of data file (when recreating data-file when it's full).",
- (uchar**) &check_param.max_data_file_length,
- (uchar**) &check_param.max_data_file_length,
+ &check_param.max_data_file_length,
+ &check_param.max_data_file_length,
0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extend-check", 'e',
"If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.",
@@ -211,13 +211,13 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"keys-used", 'k',
"Tell MyISAM to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts.",
- (uchar**) &check_param.keys_in_use,
- (uchar**) &check_param.keys_in_use,
+ &check_param.keys_in_use,
+ &check_param.keys_in_use,
0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0},
{"max-record-length", OPT_MAX_RECORD_LENGTH,
"Skip rows bigger than this if myisamchk can't allocate memory to hold it",
- (uchar**) &check_param.max_record_length,
- (uchar**) &check_param.max_record_length,
+ &check_param.max_record_length,
+ &check_param.max_record_length,
0, GET_ULL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0},
{"medium-check", 'm',
"Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.",
@@ -246,12 +246,13 @@ static struct my_option my_long_options[] =
#endif
{"set-auto-increment", 'A',
"Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.",
- (uchar**) &check_param.auto_increment_value,
- (uchar**) &check_param.auto_increment_value,
+ &check_param.auto_increment_value,
+ &check_param.auto_increment_value,
0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"set-collation", OPT_SET_COLLATION,
"Change the collation used by the index",
- (uchar**) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ (char**) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG,
+ 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -263,12 +264,11 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sort-records", 'R',
"Sort records according to an index. This makes your data much more localized and may speed up things. (It may be VERY slow to do a sort the first time!)",
- (uchar**) &check_param.opt_sort_key,
- (uchar**) &check_param.opt_sort_key,
+ &check_param.opt_sort_key,
+ &check_param.opt_sort_key,
0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't',
- "Path for temporary files.",
- (uchar**) &opt_tmpdir,
+ "Path for temporary files.", (char**) &opt_tmpdir,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"update-state", 'U',
"Mark tables as crashed if any errors were found.",
@@ -286,54 +286,54 @@ static struct my_option my_long_options[] =
"Wait if table is locked.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "key_buffer_size", OPT_KEY_BUFFER_SIZE, "",
- (uchar**) &check_param.use_buffers, (uchar**) &check_param.use_buffers, 0,
+ &check_param.use_buffers, &check_param.use_buffers, 0,
GET_ULL, REQUIRED_ARG, USE_BUFFER_INIT, MALLOC_OVERHEAD,
SIZE_T_MAX, MALLOC_OVERHEAD, IO_SIZE, 0},
{ "key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, "",
- (uchar**) &opt_key_cache_block_size,
- (uchar**) &opt_key_cache_block_size, 0,
+ &opt_key_cache_block_size,
+ &opt_key_cache_block_size, 0,
GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH,
MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0},
{ "myisam_block_size", OPT_MYISAM_BLOCK_SIZE, "",
- (uchar**) &opt_myisam_block_size, (uchar**) &opt_myisam_block_size, 0,
+ &opt_myisam_block_size, &opt_myisam_block_size, 0,
GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH,
MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0},
{ "read_buffer_size", OPT_READ_BUFFER_SIZE, "",
- (uchar**) &check_param.read_buffer_length,
- (uchar**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ &check_param.read_buffer_length,
+ &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
- (uchar**) &check_param.write_buffer_length,
- (uchar**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ &check_param.write_buffer_length,
+ &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
- (uchar**) &check_param.sort_buffer_length,
- (uchar**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ &check_param.sort_buffer_length,
+ &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
ULONG_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
- (uchar**) &check_param.sort_key_blocks,
- (uchar**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
+ &check_param.sort_key_blocks,
+ &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0},
- { "decode_bits", OPT_DECODE_BITS, "", (uchar**) &decode_bits,
- (uchar**) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
- { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (uchar**) &ft_min_word_len,
- (uchar**) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
+ { "decode_bits", OPT_DECODE_BITS, "", &decode_bits,
+ &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
+ { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", &ft_min_word_len,
+ &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
0, 1, 0},
- { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (uchar**) &ft_max_word_len,
- (uchar**) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
+ { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", &ft_max_word_len,
+ &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
HA_FT_MAXCHARLEN, 0, 1, 0},
{ "ft_stopword_file", OPT_FT_STOPWORD_FILE,
"Use stopwords from this file instead of built-in list.",
- (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR,
+ (char**) &ft_stopword_file, (char**) &ft_stopword_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"stats_method", OPT_STATS_METHOD,
"Specifies how index statistics collection code should treat NULLs. "
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
- (uchar**) &myisam_stats_method_str, (uchar**) &myisam_stats_method_str, 0,
+ (char**) &myisam_stats_method_str, (char**) &myisam_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c
index 8b4ccfe3256..c441acf6c3f 100644
--- a/storage/myisam/myisamlog.c
+++ b/storage/myisam/myisamlog.c
@@ -382,18 +382,18 @@ static int examine_log(char * file_name, char **table_names)
curr_file_info->show_name);
if (my_b_read(&cache,(uchar*) head,2))
goto err;
+ buff= 0;
file_info.name=0;
file_info.show_name=0;
file_info.record=0;
- if (read_string(&cache,(uchar**) (char*) &file_info.name,
- (uint) mi_uint2korr(head)))
+ if (read_string(&cache, &buff, (uint) mi_uint2korr(head)))
goto err;
{
uint i;
char *pos,*to;
/* Fix if old DOS files to new format */
- for (pos=file_info.name; (pos=strchr(pos,'\\')) ; pos++)
+ for (pos=file_info.name=(char*)buff; (pos=strchr(pos,'\\')) ; pos++)
*pos= '/';
pos=file_info.name;
@@ -692,7 +692,7 @@ static int read_string(IO_CACHE *file, register uchar* *to, register uint length
*to= 0;
DBUG_RETURN(1);
}
- *((char*) *to+length)= '\0';
+ *((uchar*) *to+length)= '\0';
DBUG_RETURN (0);
} /* read_string */
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index 3d96dfaafa1..f2b28a008fc 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -257,10 +257,10 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"backup", 'b', "Make a backup of the table as table_name.OLD.",
- (uchar**) &backup, (uchar**) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ &backup, &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR_MP,
- "Directory where character sets are.", (uchar**) &charsets_dir,
- (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory where character sets are.", (char**) &charsets_dir,
+ (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
@@ -268,7 +268,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"join", 'j',
"Join all given tables into 'new_table_name'. All tables MUST have identical layouts.",
- (uchar**) &join_table, (uchar**) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ &join_table, &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -282,8 +282,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"wait", 'w', "Wait and retry if table is in use.", (uchar**) &opt_wait,
- (uchar**) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"wait", 'w', "Wait and retry if table is in use.", &opt_wait,
+ &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index f27f22761b1..c6e5c24590a 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -1134,8 +1134,8 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
goto err;
create_info->merge_list.elements++;
- (*create_info->merge_list.next) = (uchar*) ptr;
- create_info->merge_list.next= (uchar**) &ptr->next_local;
+ (*create_info->merge_list.next) = ptr;
+ create_info->merge_list.next= &ptr->next_local;
}
*create_info->merge_list.next=0;
}
@@ -1157,7 +1157,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
{
char buff[FN_REFLEN];
const char **table_names, **pos;
- TABLE_LIST *tables= (TABLE_LIST*) create_info->merge_list.first;
+ TABLE_LIST *tables= create_info->merge_list.first;
THD *thd= current_thd;
size_t dirlgt= dirname_length(name);
DBUG_ENTER("ha_myisammrg::create");
diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt
index 8bdc029329d..759bb525bdf 100644
--- a/storage/xtradb/CMakeLists.txt
+++ b/storage/xtradb/CMakeLists.txt
@@ -80,21 +80,11 @@ SET(XTRADB_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
trx/trx0i_s.c trx/trx0purge.c trx/trx0rec.c trx/trx0roll.c trx/trx0rseg.c
trx/trx0sys.c trx/trx0trx.c trx/trx0undo.c
usr/usr0sess.c
- ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c ut/ut0vec.c
+ ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rbt.c ut/ut0rnd.c ut/ut0ut.c ut/ut0vec.c
ut/ut0list.c ut/ut0wqueue.c)
-ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DIB_HAVE_PAUSE_INSTRUCTION)
+# Windows atomics do not perform well. Disable Windows atomics by default.
+# See bug#52102 for details.
+#ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DINNODB_RW_LOCKS_USE_ATOMICS -DHAVE_IB_PAUSE_INSTRUCTION)
+ADD_DEFINITIONS(-DHAVE_IB_PAUSE_INSTRUCTION)
-IF (MYSQL_VERSION_ID GREATER "50137")
- MYSQL_STORAGE_ENGINE(XTRADB)
- GET_TARGET_PROPERTY(LIB_LOCATION ha_xtradb LOCATION)
- IF(LIB_LOCATION)
- SET_TARGET_PROPERTIES(ha_xtradb PROPERTIES OUTPUT_NAME ha_xtradb)
- ENDIF(LIB_LOCATION)
-ELSE (MYSQL_VERSION_ID GREATER "50137")
- IF (NOT SOURCE_SUBLIBS)
- ADD_DEFINITIONS(-D_WIN32 -DMYSQL_SERVER)
- ADD_LIBRARY(xtradb STATIC ${XTRADB_SOURCES})
- # Require mysqld_error.h, which is built as part of the GenError
- ADD_DEPENDENCIES(xtradb GenError)
- ENDIF (NOT SOURCE_SUBLIBS)
-ENDIF (MYSQL_VERSION_ID GREATER "50137")
+MYSQL_STORAGE_ENGINE(XTRADB)
diff --git a/storage/xtradb/ChangeLog b/storage/xtradb/ChangeLog
index 1a6e07fd147..bc69aaca96a 100644
--- a/storage/xtradb/ChangeLog
+++ b/storage/xtradb/ChangeLog
@@ -1,3 +1,262 @@
+2010-05-03 The InnoDB Team
+
+ * buf0buf.c:
+ Fix Bug#53248 compressed tables page checksum mismatch after
+ re-enabling innodb_checksums
+
+2010-04-28 The InnoDB Team
+
+ * log/log0recv.h, log/log0recv.c:
+ Fix Bug#53122 InnoDB recovery uses too big a hash table for redo
+ log records
+
+2010-04-27 The InnoDB Team
+
+ * handler/ha_innodb.cc, lock/lock0lock.c, row/row0mysql.c,
+ row/row0sel.c:
+ Fix Bug#48607 READ UNCOMMITTED uses more locks than READ COMMITTED
+ in InnoDB 5.1+
+
+2010-04-26 The InnoDB Team
+
+ * row/row0sel.c:
+ Fix Bug#52663 Lost update incrementing column value under
+ READ COMMITTED isolation level
+
+2010-04-22 The InnoDB Team
+
+ * include/dict0boot.h, dict/dict0boot.c:
+ Fix a bug that prevented the crash recovery of fast CREATE INDEX
+ from dropping partially created indexes.
+
+2010-04-21 The InnoDB Team
+
+ * btr/btr0btr.c:
+ Fix Bug#52964 Infinite loop in btr_page_split_and_insert()
+ in ROW_FORMAT=COMPRESSED
+
+2010-04-21 The InnoDB Team
+
+ * data/data0data.c:
+ Fix Bug#52745 Failing assertion: blob_no < page_zip->n_blobs
+
+2010-04-20 The InnoDB Team
+
+ * dict/dict0crea.c, handler/ha_innodb.cc, include/trx0trx.h:
+ Fix Bug#50495 'Row size too large' for plugin, but works for
+ built-in InnoDB
+ Only check the record size at index creation time when
+ innodb_strict_mode is set or when ROW_FORMAT is DYNAMIC or COMPRESSED.
+
+2010-04-20 The InnoDB Team
+
+ * btr/btr0btr.c, include/univ.i:
+ Implement UNIV_BTR_AVOID_COPY, for avoiding writes when a B-tree
+ node is split at the first or last record.
+
+2010-04-15 The InnoDB Team
+
+ * trx/trx0rec.c:
+ Fix Bug#52746 InnoDB purge thread crashed with table containing
+ prefix indexed blobs
+
+2010-03-31 The InnoDB Team
+
+ * mysql-test/innodb_bug51920.test, mysql-test/innodb_bug51920.result,
+ srv/srv0srv.c:
+ Fix Bug#51920 InnoDB connections in row lock wait ignore KILL
+ until lock wait timeout
+
+2010-03-31 The InnoDB Team
+
+ * mysql-test/innodb_bug38231.test:
+ Remove non-determinism in the test case.
+
+2010-03-18 The InnoDB Team
+
+ * CMakeLists.txt:
+ Fix Bug#52102 InnoDB Plugin shows performance drop compared to
+ InnoDB (Windows)
+
+2010-03-18 The InnoDB Team
+
+ * buf0buf.ic:
+ When comparing the time of the first access to a block against
+ innodb_old_blocks_time, use 32-bit arithmetics. The comparison was
+ incorrect on 64-bit systems.
+
+2010-03-11 The InnoDB Team
+
+ * buf0buf.h, buf0buf.ic:
+ Fix and clarify the latching of some buf_block_t members.
+ Note that check_index_page_at_flush is not protected by any mutex.
+ Note and assert that lock_hash_val is protected by the rw-latch.
+
+2010-03-10 The InnoDB Team
+
+ * trx/trx0sys.c:
+ Fix Bug#51653 outdated reference to set-variable
+
+2010-03-10 The InnoDB Team
+
+ * handler/ha_innodb.cc, mysql-test/innodb_bug21704.result,
+ mysql-test/innodb_bug47621.result, mysql-test/innodb_bug47621.test:
+ Fix Bug#47621 MySQL and InnoDB data dictionaries will become out of
+ sync when renaming columns
+
+2010-03-10 The InnoDB Team
+
+ * handler/ha_innodb.cc:
+ Fix Bug#51356 Many Valgrind errors in error messages
+ with concurrent DDL
+
+2010-03-10 The InnoDB Team
+
+ * handler/ha_innodb.cc, handler/handler0alter.cc,
+ mysql-test/innodb_bug51378.result, mysql-test/innodb_bug51378.test:
+ Fix Bug#51378 Init 'ref_length' to correct value, in case an out
+ of bound MySQL primary_key
+
+2010-03-10 The InnoDB Team
+
+ * log/log0recv.c:
+ Remove a bogus assertion about page numbers exceeding 0x90000000
+ in the redo log. Abort when encountering a corrupted redo log
+ record, unless innodb_force_recovery is set.
+
+2010-03-09 The InnoDB Team
+
+ * handler/ha_innodb.cc:
+ Make SHOW ENGINE INNODB MUTEX STATUS display SUM(os_waits)
+ for the buffer pool block mutexes and locks.
+
+2010-03-08 The InnoDB Team
+
+ * fil/fil0fil.c:
+ Fix ALTER TABLE ... IMPORT TABLESPACE of compressed tables.
+
+2010-03-03 The InnoDB Team
+
+ * handler/handler0alter.cc, innodb-index.result, innodb-index.test,
+ innodb.result, innodb.test:
+ Disallow a duplicate index name when creating an index.
+
+2010-02-11 The InnoDB Team
+
+ * include/mem0mem.h, include/mem0mem.ic, mem/mem0mem.c:
+ Fix Bug#49535 Available memory check slows down crash
+ recovery tens of times
+
+2010-02-09 The InnoDB Team
+
+ * buf/buf0buf.c:
+ Fix Bug#38901 InnoDB logs error repeatedly when trying to load
+ page into buffer pool
+
+2010-02-09 The InnoDB Team
+
+ * srv/srv0srv.c:
+ Let the master thread sleep if the amount of work to be done is
+ calibrated as taking less than a second.
+
+2010-02-04 The InnoDB Team
+
+ * btr/btr0btr.c, btr/btr0cur.c, btr/btr0pcur.c, buf/buf0buf.c,
+ include/btr0btr.h, include/btr0cur.h, include/btr0pcur.h,
+ include/btr0pcur.ic, include/buf0buf.h, row/row0ins.c, row/row0sel.c:
+ Pass the file name and line number of the caller of the
+ b-tree cursor functions to the buffer pool requests, in order
+ to make the latch diagnostics more accurate.
+
+2010-02-03 The InnoDB Team
+
+ * lock/lock0lock.c:
+ Fix Bug#49001 SHOW INNODB STATUS deadlock info incorrect
+ when deadlock detection aborts
+
+2010-02-03 The InnoDB Team
+
+ * buf/buf0lru.c:
+ Fix Bug#35077 Very slow DROP TABLE (ALTER TABLE, OPTIMIZE TABLE)
+ on compressed tables
+
+2010-02-03 The InnoDB Team
+
+ * handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c:
+ Clean up CHECK TABLE error handling.
+
+2010-02-01 The InnoDB Team
+
+ * handler/ha_innodb.cc, mysql-test/innodb-autoinc.test,
+ mysql-test/innodb-autoinc.result,
+ mysql-test/innodb-autoinc-44030.test,
+ mysql-test/innodb-autoinc-44030.result:
+ Fix Bug#49497 Error 1467 (ER_AUTOINC_READ_FAILED) on inserting
+ a negative value
+
+2010-01-27 The InnoDB Team
+
+ * include/row0mysql.h, log/log0recv.c, row/row0mysql.c:
+ Drop temporary tables at startup.
+ This addresses the third aspect of
+ Bug#41609 Crash recovery does not work for InnoDB temporary tables.
+
+2010-01-21 The InnoDB Team
+
+ * buf/buf0buf.c:
+ Do not merge buffered inserts to compressed pages before
+ the redo log has been applied in crash recovery.
+
+2010-01-13 The InnoDB Team
+
+ * row/row0sel.c:
+ On the READ UNCOMMITTED isolation level, do not attempt to access
+ a clustered index record that has been marked for deletion. The
+ built-in InnoDB in MySQL 5.1 and earlier would attempt to retrieve
+ a previous version of the record in this case.
+
+2010-01-13 The InnoDB Team
+
+ * buf/buf0buf.c:
+ When disabling the adaptive hash index, check the block state
+ before checking block->is_hashed, because the latter may be
+ uninitialized right after server startup.
+
+2010-01-12 The InnoDB Team
+
+ * handler/ha_innodb.cc, handler/ha_innodb.h:
+ Fix Bug#46193 crash when accessing tables after enabling
+ innodb_force_recovery option
+
+2010-01-12 The InnoDB Team
+
+ * row/row0mysql.c:
+ Fix Bug#49238 Creating/Dropping a temporary table while at 1023
+ transactions will cause assert.
+
+2009-12-02 The InnoDB Team
+
+ * srv/srv0start.c:
+ Display the zlib version number at startup.
+ InnoDB compressed tables use zlib, and the implementation depends
+ on the zlib function compressBound(), whose definition was slightly
+ changed in zlib version 1.2.3.1 in 2006. MySQL bundles zlib 1.2.3
+ from 2005, but some installations use a more recent zlib.
+
+2009-11-30 The InnoDB Team
+
+ * dict/dict0crea.c, dict/dict0mem.c, dict/dict0load.c,
+ dict/dict0boot.c, fil/fil0fil.c, handler/ha_innodb.cc,
+ include/dict0mem.h, row/row0mysql.c:
+ Fix the bogus warning messages for non-existing temporary
+ tables that were reported in
+ Bug#41609 Crash recovery does not work for InnoDB temporary tables.
+ The actual crash recovery bug was corrected on 2009-04-29.
+
+2009-11-27 The InnoDB Team
+
+ InnoDB Plugin 1.0.6 released
+
2009-11-20 The InnoDB Team
* handler/ha_innodb.cc:
@@ -79,8 +338,8 @@
sync/sync0arr.c, sync/sync0sync.c, thr/thr0loc.c, trx/trx0i_s.c,
trx/trx0purge.c, trx/trx0rseg.c, trx/trx0sys.c, trx/trx0undo.c,
usr/usr0sess.c, ut/ut0mem.c:
- Fix Bug #45992 innodb memory not freed after shutdown
- Fix Bug #46656 InnoDB plugin: memory leaks (Valgrind)
+ Fix Bug#45992 innodb memory not freed after shutdown
+ Fix Bug#46656 InnoDB plugin: memory leaks (Valgrind)
2009-10-29 The InnoDB Team
@@ -422,7 +681,7 @@
* dict/dict0dict.c:
When an index column cannot be found in the table during index
creation, display additional diagnostic before an assertion failure.
- This does NOT fix Bug #44571 InnoDB Plugin crashes on ADD INDEX,
+ This does NOT fix Bug#44571 InnoDB Plugin crashes on ADD INDEX,
but it helps understand the reason of the crash.
2009-06-17 The InnoDB Team
@@ -535,6 +794,12 @@
Fix Bug#44320 InnoDB: missing DB_ROLL_PTR in Table Monitor COLUMNS
output
+2009-04-29 The InnoDB Team
+
+ * fil/fil0fil.c, include/fil0fil.h, include/mtr0mtr.h,
+ log/log0recv.c:
+ Fix Bug#41609 Crash recovery does not work for InnoDB temporary tables
+
2009-04-23 The InnoDB Team
* row/row0mysql.c:
diff --git a/storage/xtradb/Makefile.am b/storage/xtradb/Makefile.am
index 97d3eda7938..172b9099568 100644
--- a/storage/xtradb/Makefile.am
+++ b/storage/xtradb/Makefile.am
@@ -217,6 +217,7 @@ noinst_HEADERS= \
include/ut0lst.h \
include/ut0mem.h \
include/ut0mem.ic \
+ include/ut0rbt.h \
include/ut0rnd.h \
include/ut0rnd.ic \
include/ut0sort.h \
@@ -319,6 +320,7 @@ libxtradb_a_SOURCES= \
ut/ut0dbg.c \
ut/ut0list.c \
ut/ut0mem.c \
+ ut/ut0rbt.c \
ut/ut0rnd.c \
ut/ut0ut.c \
ut/ut0vec.c \
diff --git a/storage/xtradb/btr/btr0btr.c b/storage/xtradb/btr/btr0btr.c
index 520c18553ea..12e57dcc490 100644
--- a/storage/xtradb/btr/btr0btr.c
+++ b/storage/xtradb/btr/btr0btr.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -604,13 +604,15 @@ an x-latch on the tree.
@return rec_get_offsets() of the node pointer record */
static
ulint*
-btr_page_get_father_node_ptr(
-/*=========================*/
+btr_page_get_father_node_ptr_func(
+/*==============================*/
ulint* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
btr_cur_t* cursor, /*!< in: cursor pointing to user record,
out: cursor on node pointer record,
its page x-latched */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
dtuple_t* tuple;
@@ -634,7 +636,8 @@ btr_page_get_father_node_ptr(
tuple = dict_index_build_node_ptr(index, user_rec, 0, heap, level);
btr_cur_search_to_nth_level(index, level + 1, tuple, PAGE_CUR_LE,
- BTR_CONT_MODIFY_TREE, cursor, 0, mtr);
+ BTR_CONT_MODIFY_TREE, cursor, 0,
+ file, line, mtr);
node_ptr = btr_cur_get_rec(cursor);
ut_ad(!page_rec_is_comp(node_ptr)
@@ -682,6 +685,9 @@ btr_page_get_father_node_ptr(
return(offsets);
}
+#define btr_page_get_father_node_ptr(of,heap,cur,mtr) \
+ btr_page_get_father_node_ptr_func(of,heap,cur,__FILE__,__LINE__,mtr)
+
/************************************************************//**
Returns the upper level node pointer to a page. It is assumed that mtr holds
an x-latch on the tree.
@@ -1475,11 +1481,11 @@ Calculates a split record such that the tuple will certainly fit on
its half-page when the split is performed. We assume in this function
only that the cursor page has at least one user record.
@return split record, or NULL if tuple will be the first record on
-upper half-page */
+the lower or upper half-page (determined by btr_page_tuple_smaller()) */
static
rec_t*
-btr_page_get_sure_split_rec(
-/*========================*/
+btr_page_get_split_rec(
+/*===================*/
btr_cur_t* cursor, /*!< in: cursor at which insert should be made */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext) /*!< in: number of externally stored columns */
@@ -1692,11 +1698,13 @@ Inserts a data tuple to a tree on a non-leaf level. It is assumed
that mtr holds an x-latch on the tree. */
UNIV_INTERN
void
-btr_insert_on_non_leaf_level(
-/*=========================*/
+btr_insert_on_non_leaf_level_func(
+/*==============================*/
dict_index_t* index, /*!< in: index */
ulint level, /*!< in: level, must be > 0 */
dtuple_t* tuple, /*!< in: the record to be inserted */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
big_rec_t* dummy_big_rec;
@@ -1708,7 +1716,7 @@ btr_insert_on_non_leaf_level(
btr_cur_search_to_nth_level(index, level, tuple, PAGE_CUR_LE,
BTR_CONT_MODIFY_TREE,
- &cursor, 0, mtr);
+ &cursor, 0, file, line, mtr);
err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG
| BTR_KEEP_SYS_FLAG
@@ -1854,6 +1862,37 @@ btr_attach_half_pages(
}
/*************************************************************//**
+Determine if a tuple is smaller than any record on the page.
+@return TRUE if smaller */
+static
+ibool
+btr_page_tuple_smaller(
+/*===================*/
+ btr_cur_t* cursor, /*!< in: b-tree cursor */
+ const dtuple_t* tuple, /*!< in: tuple to consider */
+ ulint* offsets,/*!< in/out: temporary storage */
+ ulint n_uniq, /*!< in: number of unique fields
+ in the index page records */
+ mem_heap_t** heap) /*!< in/out: heap for offsets */
+{
+ buf_block_t* block;
+ const rec_t* first_rec;
+ page_cur_t pcur;
+
+ /* Read the first user record in the page. */
+ block = btr_cur_get_block(cursor);
+ page_cur_set_before_first(block, &pcur);
+ page_cur_move_to_next(&pcur);
+ first_rec = page_cur_get_rec(&pcur);
+
+ offsets = rec_get_offsets(
+ first_rec, cursor->index, offsets,
+ n_uniq, heap);
+
+ return(cmp_dtuple_rec(tuple, first_rec, offsets) < 0);
+}
+
+/*************************************************************//**
Splits an index page to halves and inserts the tuple. It is assumed
that mtr holds an x-latch to the index tree. NOTE: the tree x-latch is
released within this function! NOTE that the operation of this
@@ -1923,12 +1962,17 @@ func_start:
/* 1. Decide the split record; split_rec == NULL means that the
tuple to be inserted should be the first record on the upper
half-page */
+ insert_left = FALSE;
if (n_iterations > 0) {
direction = FSP_UP;
hint_page_no = page_no + 1;
- split_rec = btr_page_get_sure_split_rec(cursor, tuple, n_ext);
+ split_rec = btr_page_get_split_rec(cursor, tuple, n_ext);
+ if (UNIV_UNLIKELY(split_rec == NULL)) {
+ insert_left = btr_page_tuple_smaller(
+ cursor, tuple, offsets, n_uniq, &heap);
+ }
} else if (btr_page_get_split_rec_to_right(cursor, &split_rec)) {
direction = FSP_UP;
hint_page_no = page_no + 1;
@@ -1936,37 +1980,24 @@ func_start:
} else if (btr_page_get_split_rec_to_left(cursor, &split_rec)) {
direction = FSP_DOWN;
hint_page_no = page_no - 1;
+ ut_ad(split_rec);
} else {
direction = FSP_UP;
hint_page_no = page_no + 1;
- if (page_get_n_recs(page) == 1) {
- page_cur_t pcur;
-
- /* There is only one record in the index page
- therefore we can't split the node in the middle
- by default. We need to determine whether the
- new record will be inserted to the left or right. */
-
- /* Read the first (and only) record in the page. */
- page_cur_set_before_first(block, &pcur);
- page_cur_move_to_next(&pcur);
- first_rec = page_cur_get_rec(&pcur);
+ /* If there is only one record in the index page, we
+ can't split the node in the middle by default. We need
+ to determine whether the new record will be inserted
+ to the left or right. */
- offsets = rec_get_offsets(
- first_rec, cursor->index, offsets,
- n_uniq, &heap);
-
- /* If the new record is less than the existing record
- the split in the middle will copy the existing
- record to the new node. */
- if (cmp_dtuple_rec(tuple, first_rec, offsets) < 0) {
- split_rec = page_get_middle_rec(page);
- } else {
- split_rec = NULL;
- }
- } else {
+ if (page_get_n_recs(page) > 1) {
split_rec = page_get_middle_rec(page);
+ } else if (btr_page_tuple_smaller(cursor, tuple,
+ offsets, n_uniq, &heap)) {
+ split_rec = page_rec_get_next(
+ page_get_infimum_rec(page));
+ } else {
+ split_rec = NULL;
}
}
@@ -1996,11 +2027,15 @@ func_start:
avoid further splits by inserting the record
to an empty page. */
split_rec = NULL;
- goto insert_right;
+ goto insert_empty;
}
+ } else if (UNIV_UNLIKELY(insert_left)) {
+ first_rec = page_rec_get_next(page_get_infimum_rec(page));
+ move_limit = page_rec_get_next(btr_cur_get_rec(cursor));
} else {
-insert_right:
- insert_left = FALSE;
+insert_empty:
+ ut_ad(!split_rec);
+ ut_ad(!insert_left);
buf = mem_alloc(rec_get_converted_size(cursor->index,
tuple, n_ext));
@@ -2024,7 +2059,11 @@ insert_right:
&& btr_page_insert_fits(cursor, split_rec,
offsets, tuple, n_ext, heap);
} else {
- mem_free(buf);
+ if (!insert_left) {
+ mem_free(buf);
+ buf = NULL;
+ }
+
insert_will_fit = !new_page_zip
&& btr_page_insert_fits(cursor, NULL,
NULL, tuple, n_ext, heap);
@@ -2037,7 +2076,17 @@ insert_right:
}
/* 5. Move then the records to the new page */
- if (direction == FSP_DOWN) {
+ if (direction == FSP_DOWN
+#ifdef UNIV_BTR_AVOID_COPY
+ && page_rec_is_supremum(move_limit)) {
+ /* Instead of moving all records, make the new page
+ the empty page. */
+
+ left_block = block;
+ right_block = new_block;
+ } else if (direction == FSP_DOWN
+#endif /* UNIV_BTR_AVOID_COPY */
+ ) {
/* fputs("Split left\n", stderr); */
if (0
@@ -2080,6 +2129,14 @@ insert_right:
right_block = block;
lock_update_split_left(right_block, left_block);
+#ifdef UNIV_BTR_AVOID_COPY
+ } else if (!split_rec) {
+ /* Instead of moving all records, make the new page
+ the empty page. */
+
+ left_block = new_block;
+ right_block = block;
+#endif /* UNIV_BTR_AVOID_COPY */
} else {
/* fputs("Split right\n", stderr); */
diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c
index 06b54bc7120..0e75b4e8442 100644
--- a/storage/xtradb/btr/btr0cur.c
+++ b/storage/xtradb/btr/btr0cur.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -372,6 +372,8 @@ btr_cur_search_to_nth_level(
ulint has_search_latch,/*!< in: info on the latch mode the
caller currently has on btr_search_latch:
RW_S_LATCH, or 0 */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
page_cur_t* page_cursor;
@@ -550,7 +552,7 @@ btr_cur_search_to_nth_level(
retry_page_get:
block = buf_page_get_gen(space, zip_size, page_no,
rw_latch, guess, buf_mode,
- __FILE__, __LINE__, mtr);
+ file, line, mtr);
if (block == NULL) {
if (srv_pass_corrupt_table && buf_mode != BUF_GET_IF_IN_POOL) {
page_cursor->block = 0;
@@ -727,13 +729,15 @@ func_exit:
Opens a cursor at either end of an index. */
UNIV_INTERN
void
-btr_cur_open_at_index_side(
-/*=======================*/
+btr_cur_open_at_index_side_func(
+/*============================*/
ibool from_left, /*!< in: TRUE if open to the low end,
FALSE if to the high end */
dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: latch mode */
btr_cur_t* cursor, /*!< in: cursor */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
page_cur_t* page_cursor;
@@ -778,7 +782,7 @@ btr_cur_open_at_index_side(
page_t* page;
block = buf_page_get_gen(space, zip_size, page_no,
RW_NO_LATCH, NULL, BUF_GET,
- __FILE__, __LINE__, mtr);
+ file, line, mtr);
page = buf_block_get_frame(block);
if (srv_pass_corrupt_table && !page) {
@@ -869,11 +873,13 @@ btr_cur_open_at_index_side(
Positions a cursor at a randomly chosen position within a B-tree. */
UNIV_INTERN
void
-btr_cur_open_at_rnd_pos(
-/*====================*/
+btr_cur_open_at_rnd_pos_func(
+/*=========================*/
dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_cur_t* cursor, /*!< in/out: B-tree cursor */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
page_cur_t* page_cursor;
@@ -908,7 +914,7 @@ btr_cur_open_at_rnd_pos(
block = buf_page_get_gen(space, zip_size, page_no,
RW_NO_LATCH, NULL, BUF_GET,
- __FILE__, __LINE__, mtr);
+ file, line, mtr);
page = buf_block_get_frame(block);
if (srv_pass_corrupt_table && !page) {
@@ -1229,7 +1235,6 @@ btr_cur_optimistic_insert(
ibool inherit;
ulint zip_size;
ulint rec_size;
- mem_heap_t* heap = NULL;
ulint err;
*big_rec = NULL;
@@ -1315,10 +1320,6 @@ btr_cur_optimistic_insert(
index, entry, big_rec_vec);
}
- if (heap) {
- mem_heap_free(heap);
- }
-
return(DB_TOO_BIG_RECORD);
}
}
@@ -1341,15 +1342,11 @@ fail_err:
dtuple_convert_back_big_rec(index, entry, big_rec_vec);
}
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
-
return(err);
}
if (UNIV_UNLIKELY(max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT
- || max_size < rec_size)
+ || max_size < rec_size)
&& UNIV_LIKELY(page_get_n_recs(page) > 1)
&& page_get_max_insert_size(page, 1) < rec_size) {
@@ -1415,10 +1412,6 @@ fail_err:
}
}
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
-
#ifdef BTR_CUR_HASH_ADAPT
if (!reorg && leaf && (cursor->flag == BTR_CUR_HASH)) {
btr_search_update_hash_node_on_insert(cursor);
@@ -3282,7 +3275,8 @@ btr_estimate_n_rows_in_range(
btr_cur_search_to_nth_level(index, 0, tuple1, mode1,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
- &cursor, 0, &mtr);
+ &cursor, 0,
+ __FILE__, __LINE__, &mtr);
} else {
btr_cur_open_at_index_side(TRUE, index,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
@@ -3299,7 +3293,8 @@ btr_estimate_n_rows_in_range(
btr_cur_search_to_nth_level(index, 0, tuple2, mode2,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
- &cursor, 0, &mtr);
+ &cursor, 0,
+ __FILE__, __LINE__, &mtr);
} else {
btr_cur_open_at_index_side(FALSE, index,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
@@ -3438,7 +3433,7 @@ btr_estimate_n_pages_not_null(
btr_cur_search_to_nth_level(index, 0, tuple1, PAGE_CUR_G,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
- &cursor, 0, &mtr);
+ &cursor, 0, __FILE__, __LINE__, &mtr);
mtr_commit(&mtr);
@@ -3588,9 +3583,11 @@ btr_estimate_number_of_different_key_vals(
effective_pages = btr_estimate_n_pages_not_null(index, 1 /*k*/, first_rec_path);
if (!effective_pages) {
+ dict_index_stat_mutex_enter(index);
for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j] = (ib_int64_t)index->stat_n_leaf_pages;
}
+ dict_index_stat_mutex_exit(index);
return;
} else if (effective_pages > index->stat_n_leaf_pages) {
effective_pages = index->stat_n_leaf_pages;
@@ -3732,6 +3729,8 @@ btr_estimate_number_of_different_key_vals(
also the pages used for external storage of fields (those pages are
included in index->stat_n_leaf_pages) */
+ dict_index_stat_mutex_enter(index);
+
for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j]
= ((n_diff[j]
@@ -3770,8 +3769,9 @@ btr_estimate_number_of_different_key_vals(
}
}
- mem_free(n_diff);
+ dict_index_stat_mutex_exit(index);
+ mem_free(n_diff);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -4639,7 +4639,7 @@ btr_free_externally_stored_field(
/* In the rollback of uncommitted transactions, we may
encounter a clustered index record whose BLOBs have
not been written. There is nothing to free then. */
- ut_a(rb_ctx == RB_RECOVERY);
+ ut_a(rb_ctx == RB_RECOVERY || rb_ctx == RB_RECOVERY_PURGE_REC);
return;
}
@@ -4685,7 +4685,7 @@ btr_free_externally_stored_field(
|| (mach_read_from_1(field_ref + BTR_EXTERN_LEN)
& BTR_EXTERN_OWNER_FLAG)
/* Rollback and inherited field */
- || (rb_ctx != RB_NONE
+ || ((rb_ctx == RB_NORMAL || rb_ctx == RB_RECOVERY)
&& (mach_read_from_1(field_ref + BTR_EXTERN_LEN)
& BTR_EXTERN_INHERITED_FLAG))) {
diff --git a/storage/xtradb/btr/btr0pcur.c b/storage/xtradb/btr/btr0pcur.c
index 86beea5a899..537c26f6bf2 100644
--- a/storage/xtradb/btr/btr0pcur.c
+++ b/storage/xtradb/btr/btr0pcur.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -211,10 +211,12 @@ record and it can be restored on a user record whose ordering fields
are identical to the ones of the original user record */
UNIV_INTERN
ibool
-btr_pcur_restore_position(
-/*======================*/
+btr_pcur_restore_position_func(
+/*===========================*/
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: detached persistent cursor */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
dict_index_t* index;
@@ -223,6 +225,9 @@ btr_pcur_restore_position(
ulint old_mode;
mem_heap_t* heap;
+ ut_ad(mtr);
+ ut_ad(mtr->state == MTR_ACTIVE);
+
index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor));
if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED)
@@ -263,7 +268,8 @@ btr_pcur_restore_position(
if (UNIV_LIKELY(buf_page_optimistic_get(
latch_mode,
cursor->block_when_stored,
- cursor->modify_clock, mtr))) {
+ cursor->modify_clock,
+ file, line, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
buf_block_dbg_add_level(btr_pcur_get_block(cursor),
@@ -318,8 +324,8 @@ btr_pcur_restore_position(
mode = PAGE_CUR_L;
}
- btr_pcur_open_with_no_init(index, tuple, mode, latch_mode,
- cursor, 0, mtr);
+ btr_pcur_open_with_no_init_func(index, tuple, mode, latch_mode,
+ cursor, 0, file, line, mtr);
/* Restore the old search mode */
cursor->search_mode = old_mode;
@@ -568,8 +574,8 @@ before first in tree. The latching mode must be BTR_SEARCH_LEAF or
BTR_MODIFY_LEAF. */
UNIV_INTERN
void
-btr_pcur_open_on_user_rec(
-/*======================*/
+btr_pcur_open_on_user_rec_func(
+/*===========================*/
dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ... */
@@ -577,9 +583,12 @@ btr_pcur_open_on_user_rec(
BTR_MODIFY_LEAF */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent
cursor */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
- btr_pcur_open(index, tuple, mode, latch_mode, cursor, mtr);
+ btr_pcur_open_func(index, tuple, mode, latch_mode, cursor,
+ file, line, mtr);
if ((mode == PAGE_CUR_GE) || (mode == PAGE_CUR_G)) {
diff --git a/storage/xtradb/buf/buf0buddy.c b/storage/xtradb/buf/buf0buddy.c
index d5e45745757..e4a79026d3a 100644
--- a/storage/xtradb/buf/buf0buddy.c
+++ b/storage/xtradb/buf/buf0buddy.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2006, 2010, Innobase Oy. All Rights Reserved.
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
@@ -430,6 +430,8 @@ buf_buddy_relocate_block(
}
mutex_exit(&flush_list_mutex);
+ UNIV_MEM_INVALID(bpage, sizeof *bpage);
+
mutex_exit(&buf_pool_zip_mutex);
mutex_exit(&zip_free_mutex);
return(TRUE);
@@ -567,7 +569,12 @@ success:
}
} else if (i == buf_buddy_get_slot(sizeof(buf_page_t))) {
/* This must be a buf_page_t object. */
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no padding in
+ buf_page_t. On other systems, Valgrind could complain
+ about uninitialized pad bytes. */
UNIV_MEM_ASSERT_RW(src, size);
+#endif
mutex_exit(&zip_free_mutex);
diff --git a/storage/xtradb/buf/buf0buf.c b/storage/xtradb/buf/buf0buf.c
index 79a9488e339..a5a9e1d9004 100644
--- a/storage/xtradb/buf/buf0buf.c
+++ b/storage/xtradb/buf/buf0buf.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -277,6 +277,8 @@ the read requests for the whole area.
#ifndef UNIV_HOTBACKUP
/** Value in microseconds */
static const int WAIT_FOR_READ = 5000;
+/** Number of attemtps made to read in a page in the buffer pool */
+static const ulint BUF_PAGE_READ_MAX_RETRIES = 100;
/** The buffer buf_pool of the database */
UNIV_INTERN buf_pool_t* buf_pool = NULL;
@@ -826,7 +828,7 @@ buf_chunk_init(
buf_block_init(block, frame);
-#ifdef HAVE_purify
+#ifdef HAVE_valgrind
/* Wipe contents of frame to eliminate a Purify warning */
memset(block->frame, '\0', UNIV_PAGE_SIZE);
#endif
@@ -1150,7 +1152,9 @@ buf_pool_drop_hash_index(void)
when we have an x-latch on btr_search_latch;
see the comment in buf0buf.h */
- if (!block->is_hashed) {
+ if (buf_block_get_state(block)
+ != BUF_BLOCK_FILE_PAGE
+ || !block->is_hashed) {
continue;
}
@@ -1283,8 +1287,6 @@ buf_relocate(
HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, bpage);
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold, dpage);
-
- UNIV_MEM_INVALID(bpage, sizeof *bpage);
}
/********************************************************************//**
@@ -1980,14 +1982,14 @@ buf_zip_decompress(
buf_block_t* block, /*!< in/out: block */
ibool check) /*!< in: TRUE=verify the page checksum */
{
- const byte* frame = block->page.zip.data;
+ const byte* frame = block->page.zip.data;
+ ulint stamp_checksum = mach_read_from_4(
+ frame + FIL_PAGE_SPACE_OR_CHKSUM);
ut_ad(buf_block_get_zip_size(block));
ut_a(buf_block_get_space(block) != 0);
- if (UNIV_LIKELY(check)) {
- ulint stamp_checksum = mach_read_from_4(
- frame + FIL_PAGE_SPACE_OR_CHKSUM);
+ if (UNIV_LIKELY(check && stamp_checksum != BUF_NO_CHECKSUM_MAGIC)) {
ulint calc_checksum = page_zip_calc_checksum(
frame, page_zip_get_size(&block->page.zip));
@@ -2196,6 +2198,7 @@ buf_page_get_gen(
unsigned access_time;
ulint fix_type;
ibool must_read;
+ ulint retries = 0;
mutex_t* block_mutex;
trx_t* trx = NULL;
ulint sec;
@@ -2204,6 +2207,7 @@ buf_page_get_gen(
ib_uint64_t finish_time;
ut_ad(mtr);
+ ut_ad(mtr->state == MTR_ACTIVE);
ut_ad((rw_latch == RW_S_LATCH)
|| (rw_latch == RW_X_LATCH)
|| (rw_latch == RW_NO_LATCH));
@@ -2271,7 +2275,29 @@ loop2:
return(NULL);
}
- buf_read_page(space, zip_size, offset, trx);
+ if (buf_read_page(space, zip_size, offset, trx)) {
+ retries = 0;
+ } else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
+ ++retries;
+ } else {
+ fprintf(stderr, "InnoDB: Error: Unable"
+ " to read tablespace %lu page no"
+ " %lu into the buffer pool after"
+ " %lu attempts\n"
+ "InnoDB: The most probable cause"
+ " of this error may be that the"
+ " table has been corrupted.\n"
+ "InnoDB: You can try to fix this"
+ " problem by using"
+ " innodb_force_recovery.\n"
+ "InnoDB: Please see reference manual"
+ " for more details.\n"
+ "InnoDB: Aborting...\n",
+ space, offset,
+ BUF_PAGE_READ_MAX_RETRIES);
+
+ ut_error;
+ }
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 37 || buf_validate());
@@ -2414,22 +2440,8 @@ wait_until_unfixed:
ut_ad(!block->page.in_flush_list);
} else {
/* Relocate buf_pool->flush_list. */
- buf_page_t* b;
-
- b = UT_LIST_GET_PREV(flush_list, &block->page);
- ut_ad(block->page.in_flush_list);
- UT_LIST_REMOVE(flush_list, buf_pool->flush_list,
- &block->page);
-
- if (b) {
- UT_LIST_INSERT_AFTER(
- flush_list, buf_pool->flush_list, b,
- &block->page);
- } else {
- UT_LIST_ADD_FIRST(
- flush_list, buf_pool->flush_list,
- &block->page);
- }
+ buf_flush_relocate_on_flush_list(bpage,
+ &block->page);
}
mutex_exit(&flush_list_mutex);
@@ -2447,6 +2459,9 @@ wait_until_unfixed:
block->page.buf_fix_count = 1;
buf_block_set_io_fix(block, BUF_IO_READ);
rw_lock_x_lock(&block->lock);
+
+ UNIV_MEM_INVALID(bpage, sizeof *bpage);
+
mutex_exit(block_mutex);
mutex_exit(&buf_pool_zip_mutex);
@@ -2461,8 +2476,9 @@ wait_until_unfixed:
/* Decompress the page and apply buffered operations
while not holding buf_pool_mutex or block->mutex. */
success = buf_zip_decompress(block, srv_use_checksums);
+ ut_a(success);
- if (UNIV_LIKELY(success)) {
+ if (UNIV_LIKELY(!recv_no_ibuf_operations)) {
ibuf_merge_or_delete_for_page(block, space, offset,
zip_size, TRUE);
}
@@ -2478,14 +2494,6 @@ wait_until_unfixed:
buf_pool->n_pend_unzip--;
mutex_exit(&buf_pool_mutex);
rw_lock_x_unlock(&block->lock);
-
- if (UNIV_UNLIKELY(!success)) {
-
- //buf_pool_mutex_exit();
- mutex_exit(block_mutex);
- return(NULL);
- }
-
break;
case BUF_BLOCK_ZIP_FREE:
@@ -2500,7 +2508,12 @@ wait_until_unfixed:
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
//mutex_enter(&block->mutex);
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no padding in buf_page_t. On
+ other systems, Valgrind could complain about uninitialized pad
+ bytes. */
UNIV_MEM_ASSERT_RW(&block->page, sizeof block->page);
+#endif
buf_block_buf_fix_inc(block, file, line);
@@ -2603,8 +2616,8 @@ page.
@return TRUE if success */
UNIV_INTERN
ibool
-buf_page_optimistic_get_func(
-/*=========================*/
+buf_page_optimistic_get(
+/*====================*/
ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH */
buf_block_t* block, /*!< in: guessed buffer block */
ib_uint64_t modify_clock,/*!< in: modify clock value if mode is
@@ -2618,7 +2631,9 @@ buf_page_optimistic_get_func(
ulint fix_type;
trx_t* trx = NULL;
- ut_ad(mtr && block);
+ ut_ad(block);
+ ut_ad(mtr);
+ ut_ad(mtr->state == MTR_ACTIVE);
ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
mutex_enter(&block->mutex);
@@ -2738,6 +2753,7 @@ buf_page_get_known_nowait(
trx_t* trx = NULL;
ut_ad(mtr);
+ ut_ad(mtr->state == MTR_ACTIVE);
ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
mutex_enter(&block->mutex);
@@ -2846,6 +2862,9 @@ buf_page_try_get_func(
ibool success;
ulint fix_type;
+ ut_ad(mtr);
+ ut_ad(mtr->state == MTR_ACTIVE);
+
//buf_pool_mutex_enter();
rw_lock_s_lock(&page_hash_latch);
block = buf_block_hash_get(space_id, page_no);
@@ -3249,6 +3268,7 @@ buf_page_create(
ulint time_ms = ut_time_ms();
ut_ad(mtr);
+ ut_ad(mtr->state == MTR_ACTIVE);
ut_ad(space || !zip_size);
free_block = buf_LRU_get_free_block(0);
@@ -3431,7 +3451,8 @@ buf_page_io_complete(
read_space_id = mach_read_from_4(
frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- if (bpage->space == TRX_SYS_SPACE
+ if ((bpage->space == TRX_SYS_SPACE
+ || (srv_doublewrite_file && bpage->space == TRX_DOUBLEWRITE_SPACE))
&& trx_doublewrite_page_inside(bpage->offset)) {
ut_print_timestamp(stderr);
@@ -3503,7 +3524,7 @@ corrupt:
REFMAN "forcing-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
- if (srv_pass_corrupt_table && bpage->space > 0
+ if (srv_pass_corrupt_table && !trx_sys_sys_space(bpage->space)
&& bpage->space < SRV_LOG_SPACE_FIRST_ID) {
fprintf(stderr,
"InnoDB: space %u will be treated as corrupt.\n",
diff --git a/storage/xtradb/buf/buf0flu.c b/storage/xtradb/buf/buf0flu.c
index 1735f6ac3cb..17588475bbf 100644
--- a/storage/xtradb/buf/buf0flu.c
+++ b/storage/xtradb/buf/buf0flu.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
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
@@ -88,6 +88,146 @@ buf_flush_validate_low(void);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
/********************************************************************//**
+Insert a block in the flush_rbt and returns a pointer to its
+predecessor or NULL if no predecessor. The ordering is maintained
+on the basis of the <oldest_modification, space, offset> key.
+@return pointer to the predecessor or NULL if no predecessor. */
+static
+buf_page_t*
+buf_flush_insert_in_flush_rbt(
+/*==========================*/
+ buf_page_t* bpage) /*!< in: bpage to be inserted. */
+{
+ buf_page_t* prev = NULL;
+ const ib_rbt_node_t* c_node;
+ const ib_rbt_node_t* p_node;
+
+ //ut_ad(buf_pool_mutex_own());
+ ut_ad(mutex_own(&flush_list_mutex));
+
+ /* Insert this buffer into the rbt. */
+ c_node = rbt_insert(buf_pool->flush_rbt, &bpage, &bpage);
+ ut_a(c_node != NULL);
+
+ /* Get the predecessor. */
+ p_node = rbt_prev(buf_pool->flush_rbt, c_node);
+
+ if (p_node != NULL) {
+ prev = *rbt_value(buf_page_t*, p_node);
+ ut_a(prev != NULL);
+ }
+
+ return(prev);
+}
+
+/********************************************************************//**
+Delete a bpage from the flush_rbt. */
+static
+void
+buf_flush_delete_from_flush_rbt(
+/*============================*/
+ buf_page_t* bpage) /*!< in: bpage to be removed. */
+{
+
+ ibool ret = FALSE;
+
+ //ut_ad(buf_pool_mutex_own());
+ ut_ad(mutex_own(&flush_list_mutex));
+ ret = rbt_delete(buf_pool->flush_rbt, &bpage);
+ ut_ad(ret);
+}
+
+/********************************************************************//**
+Compare two modified blocks in the buffer pool. The key for comparison
+is:
+key = <oldest_modification, space, offset>
+This comparison is used to maintian ordering of blocks in the
+buf_pool->flush_rbt.
+Note that for the purpose of flush_rbt, we only need to order blocks
+on the oldest_modification. The other two fields are used to uniquely
+identify the blocks.
+@return < 0 if b2 < b1, 0 if b2 == b1, > 0 if b2 > b1 */
+static
+int
+buf_flush_block_cmp(
+/*================*/
+ const void* p1, /*!< in: block1 */
+ const void* p2) /*!< in: block2 */
+{
+ int ret;
+ const buf_page_t* b1;
+ const buf_page_t* b2;
+
+ ut_ad(p1 != NULL);
+ ut_ad(p2 != NULL);
+
+ b1 = *(const buf_page_t**) p1;
+ b2 = *(const buf_page_t**) p2;
+
+ ut_ad(b1 != NULL);
+ ut_ad(b2 != NULL);
+
+ ut_ad(b1->in_flush_list);
+ ut_ad(b2->in_flush_list);
+
+ if (b2->oldest_modification
+ > b1->oldest_modification) {
+ return(1);
+ }
+
+ if (b2->oldest_modification
+ < b1->oldest_modification) {
+ return(-1);
+ }
+
+ /* If oldest_modification is same then decide on the space. */
+ ret = (int)(b2->space - b1->space);
+
+ /* Or else decide ordering on the offset field. */
+ return(ret ? ret : (int)(b2->offset - b1->offset));
+}
+
+/********************************************************************//**
+Initialize the red-black tree to speed up insertions into the flush_list
+during recovery process. Should be called at the start of recovery
+process before any page has been read/written. */
+UNIV_INTERN
+void
+buf_flush_init_flush_rbt(void)
+/*==========================*/
+{
+ //buf_pool_mutex_enter();
+ mutex_enter(&flush_list_mutex);
+
+ /* Create red black tree for speedy insertions in flush list. */
+ buf_pool->flush_rbt = rbt_create(sizeof(buf_page_t*),
+ buf_flush_block_cmp);
+ //buf_pool_mutex_exit();
+ mutex_exit(&flush_list_mutex);
+}
+
+/********************************************************************//**
+Frees up the red-black tree. */
+UNIV_INTERN
+void
+buf_flush_free_flush_rbt(void)
+/*==========================*/
+{
+ //buf_pool_mutex_enter();
+ mutex_enter(&flush_list_mutex);
+
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
+ ut_a(buf_flush_validate_low());
+#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
+
+ rbt_free(buf_pool->flush_rbt);
+ buf_pool->flush_rbt = NULL;
+
+ //buf_pool_mutex_exit();
+ mutex_exit(&flush_list_mutex);
+}
+
+/********************************************************************//**
Inserts a modified block into the flush list. */
UNIV_INTERN
void
@@ -102,6 +242,13 @@ buf_flush_insert_into_flush_list(
|| (UT_LIST_GET_FIRST(buf_pool->flush_list)->oldest_modification
<= block->page.oldest_modification));
+ /* If we are in the recovery then we need to update the flush
+ red-black tree as well. */
+ if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
+ buf_flush_insert_sorted_into_flush_list(block);
+ return;
+ }
+
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
ut_ad(block->page.in_LRU_list);
ut_ad(block->page.in_page_hash);
@@ -140,26 +287,27 @@ buf_flush_insert_sorted_into_flush_list(
ut_d(block->page.in_flush_list = TRUE);
prev_b = NULL;
- b = UT_LIST_GET_FIRST(buf_pool->flush_list);
- if (srv_fast_recovery) {
- /* speed hack */
- if (b == NULL || b->oldest_modification < block->page.oldest_modification) {
- UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, &block->page);
+ /* For the most part when this function is called the flush_rbt
+ should not be NULL. In a very rare boundary case it is possible
+ that the flush_rbt has already been freed by the recovery thread
+ before the last page was hooked up in the flush_list by the
+ io-handler thread. In that case we'll just do a simple
+ linear search in the else block. */
+ if (buf_pool->flush_rbt) {
+
+ prev_b = buf_flush_insert_in_flush_rbt(&block->page);
+
} else {
- b = UT_LIST_GET_LAST(buf_pool->flush_list);
- if (b->oldest_modification < block->page.oldest_modification) {
- /* align oldest_modification not to sort */
- block->page.oldest_modification = b->oldest_modification;
+
+ b = UT_LIST_GET_FIRST(buf_pool->flush_list);
+
+ while (b && b->oldest_modification
+ > block->page.oldest_modification) {
+ ut_ad(b->in_flush_list);
+ prev_b = b;
+ b = UT_LIST_GET_NEXT(flush_list, b);
}
- UT_LIST_ADD_LAST(flush_list, buf_pool->flush_list, &block->page);
- }
- } else {
- /* normal */
- while (b && b->oldest_modification > block->page.oldest_modification) {
- ut_ad(b->in_flush_list);
- prev_b = b;
- b = UT_LIST_GET_NEXT(flush_list, b);
}
if (prev_b == NULL) {
@@ -168,7 +316,6 @@ buf_flush_insert_sorted_into_flush_list(
UT_LIST_INSERT_AFTER(flush_list, buf_pool->flush_list,
prev_b, &block->page);
}
- }
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_flush_validate_low());
@@ -262,7 +409,6 @@ buf_flush_remove(
mutex_enter(&flush_list_mutex);
ut_ad(bpage->in_flush_list);
- ut_d(bpage->in_flush_list = FALSE);
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_PAGE:
@@ -285,6 +431,15 @@ buf_flush_remove(
break;
}
+ /* If the flush_rbt is active then delete from it as well. */
+ if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
+ buf_flush_delete_from_flush_rbt(bpage);
+ }
+
+ /* Must be done after we have removed it from the flush_rbt
+ because we assert on in_flush_list in comparison function. */
+ ut_d(bpage->in_flush_list = FALSE);
+
bpage->oldest_modification = 0;
ut_d(UT_LIST_VALIDATE(flush_list, buf_page_t, buf_pool->flush_list,
@@ -293,6 +448,64 @@ buf_flush_remove(
}
/********************************************************************//**
+Relocates a buffer control block on the flush_list.
+Note that it is assumed that the contents of bpage has already been
+copied to dpage. */
+UNIV_INTERN
+void
+buf_flush_relocate_on_flush_list(
+/*=============================*/
+ buf_page_t* bpage, /*!< in/out: control block being moved */
+ buf_page_t* dpage) /*!< in/out: destination block */
+{
+ buf_page_t* prev;
+ buf_page_t* prev_b = NULL;
+
+ //ut_ad(buf_pool_mutex_own());
+ ut_ad(mutex_own(&flush_list_mutex));
+
+ ut_ad(mutex_own(buf_page_get_mutex(bpage)));
+
+ ut_ad(bpage->in_flush_list);
+ ut_ad(dpage->in_flush_list);
+
+ /* If recovery is active we must swap the control blocks in
+ the flush_rbt as well. */
+ if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
+ buf_flush_delete_from_flush_rbt(bpage);
+ prev_b = buf_flush_insert_in_flush_rbt(dpage);
+ }
+
+ /* Must be done after we have removed it from the flush_rbt
+ because we assert on in_flush_list in comparison function. */
+ ut_d(bpage->in_flush_list = FALSE);
+
+ prev = UT_LIST_GET_PREV(flush_list, bpage);
+ UT_LIST_REMOVE(flush_list, buf_pool->flush_list, bpage);
+
+ if (prev) {
+ ut_ad(prev->in_flush_list);
+ UT_LIST_INSERT_AFTER(
+ flush_list,
+ buf_pool->flush_list,
+ prev, dpage);
+ } else {
+ UT_LIST_ADD_FIRST(
+ flush_list,
+ buf_pool->flush_list,
+ dpage);
+ }
+
+ /* Just an extra check. Previous in flush_list
+ should be the same control block as in flush_rbt. */
+ ut_a(!buf_pool->flush_rbt || prev_b == prev);
+
+#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
+ ut_a(buf_flush_validate_low());
+#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
+}
+
+/********************************************************************//**
Updates the flush system data structures when a write is completed. */
UNIV_INTERN
void
@@ -452,7 +665,8 @@ corrupted_page:
write_buf = trx_doublewrite->write_buf;
i = 0;
- fil_io(OS_FILE_WRITE, TRUE, TRX_SYS_SPACE, 0,
+ fil_io(OS_FILE_WRITE, TRUE,
+ (srv_doublewrite_file ? TRX_DOUBLEWRITE_SPACE : TRX_SYS_SPACE), 0,
trx_doublewrite->block1, 0, len,
(void*) write_buf, NULL);
@@ -489,7 +703,8 @@ corrupted_page:
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
ut_ad(i == TRX_SYS_DOUBLEWRITE_BLOCK_SIZE);
- fil_io(OS_FILE_WRITE, TRUE, TRX_SYS_SPACE, 0,
+ fil_io(OS_FILE_WRITE, TRUE,
+ (srv_doublewrite_file ? TRX_DOUBLEWRITE_SPACE : TRX_SYS_SPACE), 0,
trx_doublewrite->block2, 0, len,
(void*) write_buf, NULL);
@@ -519,7 +734,7 @@ corrupted_page:
flush:
/* Now flush the doublewrite buffer data to disk */
- fil_flush(TRX_SYS_SPACE);
+ fil_flush(srv_doublewrite_file ? TRX_DOUBLEWRITE_SPACE : TRX_SYS_SPACE);
/* We know that the writes have been flushed to disk now
and in recovery we will find them in the doublewrite buffer
@@ -1473,24 +1688,45 @@ ibool
buf_flush_validate_low(void)
/*========================*/
{
- buf_page_t* bpage;
+ buf_page_t* bpage;
+ const ib_rbt_node_t* rnode = NULL;
UT_LIST_VALIDATE(flush_list, buf_page_t, buf_pool->flush_list,
ut_ad(ut_list_node_313->in_flush_list));
bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
+ /* If we are in recovery mode i.e.: flush_rbt != NULL
+ then each block in the flush_list must also be present
+ in the flush_rbt. */
+ if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
+ rnode = rbt_first(buf_pool->flush_rbt);
+ }
+
while (bpage != NULL) {
const ib_uint64_t om = bpage->oldest_modification;
ut_ad(bpage->in_flush_list);
//ut_a(buf_page_in_file(bpage)); /* optimistic */
ut_a(om > 0);
+ if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
+ ut_a(rnode);
+ buf_page_t* rpage = *rbt_value(buf_page_t*,
+ rnode);
+ ut_a(rpage);
+ ut_a(rpage == bpage);
+ rnode = rbt_next(buf_pool->flush_rbt, rnode);
+ }
+
bpage = UT_LIST_GET_NEXT(flush_list, bpage);
ut_a(!bpage || om >= bpage->oldest_modification);
}
+ /* By this time we must have exhausted the traversal of
+ flush_rbt (if active) as well. */
+ ut_a(rnode == NULL);
+
return(TRUE);
}
diff --git a/storage/xtradb/buf/buf0lru.c b/storage/xtradb/buf/buf0lru.c
index 58e2c23275b..65fdf342e4f 100644
--- a/storage/xtradb/buf/buf0lru.c
+++ b/storage/xtradb/buf/buf0lru.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
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
@@ -371,21 +371,39 @@ scan_again:
bpage = UT_LIST_GET_LAST(buf_pool->LRU);
while (bpage != NULL) {
- mutex_t* block_mutex = buf_page_get_mutex_enter(bpage);
buf_page_t* prev_bpage;
+ ibool prev_bpage_buf_fix = FALSE;
ut_a(buf_page_in_file(bpage));
prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
- if (!block_mutex) {
- bpage = prev_bpage;
- continue;
- }
+ /* bpage->space and bpage->io_fix are protected by
+ buf_pool_mutex and block_mutex. It is safe to check
+ them while holding buf_pool_mutex only. */
+
+ if (buf_page_get_space(bpage) != id) {
+ /* Skip this block, as it does not belong to
+ the space that is being invalidated. */
+ } else if (buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
+ /* We cannot remove this page during this scan
+ yet; maybe the system is currently reading it
+ in, or flushing the modifications to the file */
+
+ all_freed = FALSE;
+ } else {
+ mutex_t* block_mutex = buf_page_get_mutex_enter(bpage);
- if (buf_page_get_space(bpage) == id) {
- if (bpage->buf_fix_count > 0
- || buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
+ if (!block_mutex) {
+ /* It may be impossible case...
+ Something wrong, so will be scan_again */
+
+ all_freed = FALSE;
+
+ goto next_page_no_mutex;
+ }
+
+ if (bpage->buf_fix_count > 0) {
/* We cannot remove this page during
this scan yet; maybe the system is
@@ -405,8 +423,40 @@ scan_again:
(ulong) buf_page_get_page_no(bpage));
}
#endif
- if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE
- && ((buf_block_t*) bpage)->is_hashed) {
+ if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) {
+ /* This is a compressed-only block
+ descriptor. Ensure that prev_bpage
+ cannot be relocated when bpage is freed. */
+ if (UNIV_LIKELY(prev_bpage != NULL)) {
+ switch (buf_page_get_state(
+ prev_bpage)) {
+ case BUF_BLOCK_FILE_PAGE:
+ /* Descriptors of uncompressed
+ blocks will not be relocated,
+ because we are holding the
+ buf_pool_mutex. */
+ break;
+ case BUF_BLOCK_ZIP_PAGE:
+ case BUF_BLOCK_ZIP_DIRTY:
+ /* Descriptors of compressed-
+ only blocks can be relocated,
+ unless they are buffer-fixed.
+ Because both bpage and
+ prev_bpage are protected by
+ buf_pool_zip_mutex, it is
+ not necessary to acquire
+ further mutexes. */
+ ut_ad(&buf_pool_zip_mutex
+ == block_mutex);
+ ut_ad(mutex_own(block_mutex));
+ prev_bpage_buf_fix = TRUE;
+ prev_bpage->buf_fix_count++;
+ break;
+ default:
+ ut_error;
+ }
+ }
+ } else if (((buf_block_t*) bpage)->is_hashed) {
ulint page_no;
ulint zip_size;
@@ -432,7 +482,8 @@ scan_again:
buf_flush_remove(bpage);
}
- /* Remove from the LRU list */
+ /* Remove from the LRU list. */
+
if (buf_LRU_block_remove_hashed_page(bpage, TRUE)
!= BUF_BLOCK_ZIP_FREE) {
buf_LRU_block_free_hashed_page((buf_block_t*)
@@ -444,18 +495,27 @@ scan_again:
ut_ad(block_mutex == &buf_pool_zip_mutex);
ut_ad(!mutex_own(block_mutex));
- /* The compressed block descriptor
- (bpage) has been deallocated and
- block_mutex released. Also,
- buf_buddy_free() may have relocated
- prev_bpage. Rescan the LRU list. */
+ if (prev_bpage_buf_fix) {
+ /* We temporarily buffer-fixed
+ prev_bpage, so that
+ buf_buddy_free() could not
+ relocate it, in case it was a
+ compressed-only block
+ descriptor. */
+
+ mutex_enter(block_mutex);
+ ut_ad(prev_bpage->buf_fix_count > 0);
+ prev_bpage->buf_fix_count--;
+ mutex_exit(block_mutex);
+ }
- bpage = UT_LIST_GET_LAST(buf_pool->LRU);
- continue;
+ goto next_page_no_mutex;
}
- }
next_page:
- mutex_exit(block_mutex);
+ mutex_exit(block_mutex);
+ }
+
+next_page_no_mutex:
bpage = prev_bpage;
}
@@ -1425,7 +1485,12 @@ buf_LRU_free_block(
ut_ad(buf_page_in_file(bpage));
//ut_ad(bpage->in_LRU_list);
ut_ad(!bpage->in_flush_list == !bpage->oldest_modification);
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no padding in buf_page_t. On
+ other systems, Valgrind could complain about uninitialized pad
+ bytes. */
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
+#endif
if (!bpage->in_LRU_list || !block_mutex || !buf_page_can_relocate(bpage)) {
@@ -1558,8 +1623,13 @@ not_freed:
ut_ad(prev_b->in_LRU_list);
ut_ad(buf_page_in_file(prev_b));
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no
+ padding in buf_page_t. On other
+ systems, Valgrind could complain about
+ uninitialized pad bytes. */
UNIV_MEM_ASSERT_RW(prev_b, sizeof *prev_b);
-
+#endif
UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU,
prev_b, b);
@@ -1600,26 +1670,8 @@ not_freed:
if (b->state == BUF_BLOCK_ZIP_PAGE) {
buf_LRU_insert_zip_clean(b);
} else {
- buf_page_t* prev;
-
- ut_ad(b->in_flush_list);
- ut_d(bpage->in_flush_list = FALSE);
-
- prev = UT_LIST_GET_PREV(flush_list, b);
- UT_LIST_REMOVE(flush_list, buf_pool->flush_list, b);
-
- if (prev) {
- ut_ad(prev->in_flush_list);
- UT_LIST_INSERT_AFTER(
- flush_list,
- buf_pool->flush_list,
- prev, b);
- } else {
- UT_LIST_ADD_FIRST(
- flush_list,
- buf_pool->flush_list,
- b);
- }
+ /* Relocate on buf_pool->flush_list. */
+ buf_flush_relocate_on_flush_list(bpage, b);
}
mutex_exit(&flush_list_mutex);
@@ -1792,7 +1844,12 @@ buf_LRU_block_remove_hashed_page(
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
ut_a(bpage->buf_fix_count == 0);
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no padding in
+ buf_page_t. On other systems, Valgrind could complain
+ about uninitialized pad bytes. */
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
+#endif
buf_LRU_remove_block(bpage);
diff --git a/storage/xtradb/buf/buf0rea.c b/storage/xtradb/buf/buf0rea.c
index e5d04df797f..59de70d9a8a 100644
--- a/storage/xtradb/buf/buf0rea.c
+++ b/storage/xtradb/buf/buf0rea.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
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
@@ -86,7 +86,9 @@ buf_read_page_low(
wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER;
mode = mode & ~OS_AIO_SIMULATED_WAKE_LATER;
- if (trx_doublewrite && space == TRX_SYS_SPACE
+ if (trx_doublewrite
+ && (space == TRX_SYS_SPACE
+ || (srv_doublewrite_file && space == TRX_DOUBLEWRITE_SPACE))
&& ( (offset >= trx_doublewrite->block1
&& offset < trx_doublewrite->block1
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
@@ -656,6 +658,50 @@ buf_read_recv_pages(
/* It is a single table tablespace and the .ibd file is
missing: do nothing */
+ /* the log records should be treated here same reason
+ for http://bugs.mysql.com/bug.php?id=43948 */
+
+ if (recv_recovery_is_on()) {
+ recv_addr_t* recv_addr;
+
+ mutex_enter(&(recv_sys->mutex));
+
+ if (recv_sys->apply_log_recs == FALSE) {
+ mutex_exit(&(recv_sys->mutex));
+ goto not_to_recover;
+ }
+
+ for (i = 0; i < n_stored; i++) {
+ /* recv_get_fil_addr_struct() */
+ recv_addr = HASH_GET_FIRST(recv_sys->addr_hash,
+ hash_calc_hash(ut_fold_ulint_pair(space, page_nos[i]),
+ recv_sys->addr_hash));
+ while (recv_addr) {
+ if ((recv_addr->space == space)
+ && (recv_addr->page_no == page_nos[i])) {
+ break;
+ }
+ recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
+ }
+
+ if ((recv_addr == NULL)
+ || (recv_addr->state == RECV_BEING_PROCESSED)
+ || (recv_addr->state == RECV_PROCESSED)) {
+ continue;
+ }
+
+ recv_addr->state = RECV_PROCESSED;
+
+ ut_a(recv_sys->n_addrs);
+ recv_sys->n_addrs--;
+ }
+
+ mutex_exit(&(recv_sys->mutex));
+
+ fprintf(stderr, " (cannot find space: %lu)", space);
+ }
+not_to_recover:
+
return;
}
@@ -674,10 +720,10 @@ buf_read_recv_pages(
count++;
- if (count > 5000) {
+ if (count > 1000) {
fprintf(stderr,
"InnoDB: Error: InnoDB has waited for"
- " 50 seconds for pending\n"
+ " 10 seconds for pending\n"
"InnoDB: reads to the buffer pool to"
" be finished.\n"
"InnoDB: Number of pending reads %lu,"
diff --git a/storage/xtradb/data/data0data.c b/storage/xtradb/data/data0data.c
index e3c1f1b4f23..0715b49bf9c 100644
--- a/storage/xtradb/data/data0data.c
+++ b/storage/xtradb/data/data0data.c
@@ -666,6 +666,21 @@ dtuple_convert_big_rec(
goto skip_field;
}
+ /* In DYNAMIC and COMPRESSED format, store
+ locally any non-BLOB columns whose maximum
+ length does not exceed 256 bytes. This is
+ because there is no room for the "external
+ storage" flag when the maximum length is 255
+ bytes or less. This restriction trivially
+ holds in REDUNDANT and COMPACT format, because
+ there we always store locally columns whose
+ length is up to local_len == 788 bytes.
+ @see rec_init_offsets_comp_ordinary */
+ if (ifield->col->mtype != DATA_BLOB
+ && ifield->col->len < 256) {
+ goto skip_field;
+ }
+
longest_i = i;
longest = savings;
diff --git a/storage/xtradb/dict/dict0boot.c b/storage/xtradb/dict/dict0boot.c
index 0eb73e6c2f9..0a713f0deaa 100644
--- a/storage/xtradb/dict/dict0boot.c
+++ b/storage/xtradb/dict/dict0boot.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -275,6 +275,9 @@ dict_boot(void)
and (TYPE & DICT_TF_FORMAT_MASK) are nonzero and TYPE = table->flags */
dict_mem_table_add_col(table, heap, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, heap, "MIX_ID", DATA_BINARY, 0, 0);
+ /* MIX_LEN may contain additional table flags when
+ ROW_FORMAT!=REDUNDANT. Currently, these flags include
+ DICT_TF2_TEMPORARY. */
dict_mem_table_add_col(table, heap, "MIX_LEN", DATA_INT, 0, 4);
dict_mem_table_add_col(table, heap, "CLUSTER_NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "SPACE", DATA_INT, 0, 4);
@@ -358,7 +361,7 @@ dict_boot(void)
dict_mem_table_add_col(table, heap, "SPACE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, heap, "PAGE_NO", DATA_INT, 0, 4);
- /* The '+ 2' below comes from the 2 system fields */
+ /* The '+ 2' below comes from the fields DB_TRX_ID, DB_ROLL_PTR */
#if DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2
#error "DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2"
#endif
@@ -368,6 +371,9 @@ dict_boot(void)
#if DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2
#error "DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2"
#endif
+#if DICT_SYS_INDEXES_NAME_FIELD != 2 + 2
+#error "DICT_SYS_INDEXES_NAME_FIELD != 2 + 2"
+#endif
table->id = DICT_INDEXES_ID;
dict_table_add_to_cache(table, heap);
diff --git a/storage/xtradb/dict/dict0crea.c b/storage/xtradb/dict/dict0crea.c
index e315716551e..d4e735c73ca 100644
--- a/storage/xtradb/dict/dict0crea.c
+++ b/storage/xtradb/dict/dict0crea.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -51,16 +51,18 @@ static
dtuple_t*
dict_create_sys_tables_tuple(
/*=========================*/
- dict_table_t* table, /*!< in: table */
- mem_heap_t* heap) /*!< in: memory heap from which the memory for
- the built tuple is allocated */
+ const dict_table_t* table, /*!< in: table */
+ mem_heap_t* heap) /*!< in: memory heap from
+ which the memory for the built
+ tuple is allocated */
{
dict_table_t* sys_tables;
dtuple_t* entry;
dfield_t* dfield;
byte* ptr;
- ut_ad(table && heap);
+ ut_ad(table);
+ ut_ad(heap);
sys_tables = dict_sys->sys_tables;
@@ -69,18 +71,18 @@ dict_create_sys_tables_tuple(
dict_table_copy_types(entry, sys_tables);
/* 0: NAME -----------------------------*/
- dfield = dtuple_get_nth_field(entry, 0);
+ dfield = dtuple_get_nth_field(entry, 0/*NAME*/);
dfield_set_data(dfield, table->name, ut_strlen(table->name));
/* 3: ID -------------------------------*/
- dfield = dtuple_get_nth_field(entry, 1);
+ dfield = dtuple_get_nth_field(entry, 1/*ID*/);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, table->id);
dfield_set_data(dfield, ptr, 8);
/* 4: N_COLS ---------------------------*/
- dfield = dtuple_get_nth_field(entry, 2);
+ dfield = dtuple_get_nth_field(entry, 2/*N_COLS*/);
#if DICT_TF_COMPACT != 1
#error
@@ -91,40 +93,41 @@ dict_create_sys_tables_tuple(
| ((table->flags & DICT_TF_COMPACT) << 31));
dfield_set_data(dfield, ptr, 4);
/* 5: TYPE -----------------------------*/
- dfield = dtuple_get_nth_field(entry, 3);
+ dfield = dtuple_get_nth_field(entry, 3/*TYPE*/);
ptr = mem_heap_alloc(heap, 4);
- if (table->flags & ~DICT_TF_COMPACT) {
+ if (table->flags & (~DICT_TF_COMPACT & ~(~0 << DICT_TF_BITS))) {
ut_a(table->flags & DICT_TF_COMPACT);
ut_a(dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP);
ut_a(((ulonglong) table->flags & DICT_TF_ZSSIZE_MASK)
<= (ulonglong) (DICT_TF_ZSSIZE_MAX << DICT_TF_ZSSIZE_SHIFT));
- ut_a(!(table->flags & (~0 << DICT_TF_BITS)));
- mach_write_to_4(ptr, table->flags);
+ ut_a(!(table->flags & (~0 << DICT_TF2_BITS)));
+ mach_write_to_4(ptr, table->flags & ~(~0 << DICT_TF_BITS));
} else {
mach_write_to_4(ptr, DICT_TABLE_ORDINARY);
}
dfield_set_data(dfield, ptr, 4);
/* 6: MIX_ID (obsolete) ---------------------------*/
- dfield = dtuple_get_nth_field(entry, 4);
+ dfield = dtuple_get_nth_field(entry, 4/*MIX_ID*/);
ptr = mem_heap_zalloc(heap, 8);
dfield_set_data(dfield, ptr, 8);
- /* 7: MIX_LEN (obsolete) --------------------------*/
+ /* 7: MIX_LEN (additional flags) --------------------------*/
- dfield = dtuple_get_nth_field(entry, 5);
+ dfield = dtuple_get_nth_field(entry, 5/*MIX_LEN*/);
- ptr = mem_heap_zalloc(heap, 4);
+ ptr = mem_heap_alloc(heap, 4);
+ mach_write_to_4(ptr, table->flags >> DICT_TF2_SHIFT);
dfield_set_data(dfield, ptr, 4);
/* 8: CLUSTER_NAME ---------------------*/
- dfield = dtuple_get_nth_field(entry, 6);
+ dfield = dtuple_get_nth_field(entry, 6/*CLUSTER_NAME*/);
dfield_set_null(dfield); /* not supported */
/* 9: SPACE ----------------------------*/
- dfield = dtuple_get_nth_field(entry, 7);
+ dfield = dtuple_get_nth_field(entry, 7/*SPACE*/);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, table->space);
@@ -143,19 +146,21 @@ static
dtuple_t*
dict_create_sys_columns_tuple(
/*==========================*/
- dict_table_t* table, /*!< in: table */
- ulint i, /*!< in: column number */
- mem_heap_t* heap) /*!< in: memory heap from which the memory for
- the built tuple is allocated */
+ const dict_table_t* table, /*!< in: table */
+ ulint i, /*!< in: column number */
+ mem_heap_t* heap) /*!< in: memory heap from
+ which the memory for the built
+ tuple is allocated */
{
dict_table_t* sys_columns;
dtuple_t* entry;
const dict_col_t* column;
dfield_t* dfield;
byte* ptr;
- const char* col_name;
+ const char* col_name;
- ut_ad(table && heap);
+ ut_ad(table);
+ ut_ad(heap);
column = dict_table_get_nth_col(table, i);
@@ -166,47 +171,47 @@ dict_create_sys_columns_tuple(
dict_table_copy_types(entry, sys_columns);
/* 0: TABLE_ID -----------------------*/
- dfield = dtuple_get_nth_field(entry, 0);
+ dfield = dtuple_get_nth_field(entry, 0/*TABLE_ID*/);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, table->id);
dfield_set_data(dfield, ptr, 8);
/* 1: POS ----------------------------*/
- dfield = dtuple_get_nth_field(entry, 1);
+ dfield = dtuple_get_nth_field(entry, 1/*POS*/);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, i);
dfield_set_data(dfield, ptr, 4);
/* 4: NAME ---------------------------*/
- dfield = dtuple_get_nth_field(entry, 2);
+ dfield = dtuple_get_nth_field(entry, 2/*NAME*/);
col_name = dict_table_get_col_name(table, i);
dfield_set_data(dfield, col_name, ut_strlen(col_name));
/* 5: MTYPE --------------------------*/
- dfield = dtuple_get_nth_field(entry, 3);
+ dfield = dtuple_get_nth_field(entry, 3/*MTYPE*/);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, column->mtype);
dfield_set_data(dfield, ptr, 4);
/* 6: PRTYPE -------------------------*/
- dfield = dtuple_get_nth_field(entry, 4);
+ dfield = dtuple_get_nth_field(entry, 4/*PRTYPE*/);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, column->prtype);
dfield_set_data(dfield, ptr, 4);
/* 7: LEN ----------------------------*/
- dfield = dtuple_get_nth_field(entry, 5);
+ dfield = dtuple_get_nth_field(entry, 5/*LEN*/);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, column->len);
dfield_set_data(dfield, ptr, 4);
/* 8: PREC ---------------------------*/
- dfield = dtuple_get_nth_field(entry, 6);
+ dfield = dtuple_get_nth_field(entry, 6/*PREC*/);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, 0/* unused */);
@@ -230,6 +235,7 @@ dict_build_table_def_step(
dict_table_t* table;
dtuple_t* row;
ulint error;
+ ulint flags;
const char* path_or_name;
ibool is_path;
mtr_t mtr;
@@ -268,9 +274,10 @@ dict_build_table_def_step(
ut_ad(!dict_table_zip_size(table)
|| dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP);
+ flags = table->flags & ~(~0 << DICT_TF_BITS);
error = fil_create_new_single_table_tablespace(
&space, path_or_name, is_path,
- table->flags == DICT_TF_COMPACT ? 0 : table->flags,
+ flags == DICT_TF_COMPACT ? 0 : flags,
FIL_IBD_FILE_INITIAL_SIZE);
table->space = (unsigned int) space;
@@ -286,7 +293,7 @@ dict_build_table_def_step(
mtr_commit(&mtr);
} else {
/* Create in the system tablespace: disallow new features */
- table->flags &= DICT_TF_COMPACT;
+ table->flags &= (~0 << DICT_TF_BITS) | DICT_TF_COMPACT;
}
row = dict_create_sys_tables_tuple(table, node->heap);
@@ -322,9 +329,10 @@ static
dtuple_t*
dict_create_sys_indexes_tuple(
/*==========================*/
- dict_index_t* index, /*!< in: index */
- mem_heap_t* heap) /*!< in: memory heap from which the memory for
- the built tuple is allocated */
+ const dict_index_t* index, /*!< in: index */
+ mem_heap_t* heap) /*!< in: memory heap from
+ which the memory for the built
+ tuple is allocated */
{
dict_table_t* sys_indexes;
dict_table_t* table;
@@ -333,7 +341,8 @@ dict_create_sys_indexes_tuple(
byte* ptr;
ut_ad(mutex_own(&(dict_sys->mutex)));
- ut_ad(index && heap);
+ ut_ad(index);
+ ut_ad(heap);
sys_indexes = dict_sys->sys_indexes;
@@ -344,32 +353,32 @@ dict_create_sys_indexes_tuple(
dict_table_copy_types(entry, sys_indexes);
/* 0: TABLE_ID -----------------------*/
- dfield = dtuple_get_nth_field(entry, 0);
+ dfield = dtuple_get_nth_field(entry, 0/*TABLE_ID*/);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, table->id);
dfield_set_data(dfield, ptr, 8);
/* 1: ID ----------------------------*/
- dfield = dtuple_get_nth_field(entry, 1);
+ dfield = dtuple_get_nth_field(entry, 1/*ID*/);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, index->id);
dfield_set_data(dfield, ptr, 8);
/* 4: NAME --------------------------*/
- dfield = dtuple_get_nth_field(entry, 2);
+ dfield = dtuple_get_nth_field(entry, 2/*NAME*/);
dfield_set_data(dfield, index->name, ut_strlen(index->name));
/* 5: N_FIELDS ----------------------*/
- dfield = dtuple_get_nth_field(entry, 3);
+ dfield = dtuple_get_nth_field(entry, 3/*N_FIELDS*/);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, index->n_fields);
dfield_set_data(dfield, ptr, 4);
/* 6: TYPE --------------------------*/
- dfield = dtuple_get_nth_field(entry, 4);
+ dfield = dtuple_get_nth_field(entry, 4/*TYPE*/);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, index->type);
@@ -381,7 +390,7 @@ dict_create_sys_indexes_tuple(
#error "DICT_SYS_INDEXES_SPACE_NO_FIELD != 7"
#endif
- dfield = dtuple_get_nth_field(entry, 5);
+ dfield = dtuple_get_nth_field(entry, 5/*SPACE*/);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, index->space);
@@ -393,7 +402,7 @@ dict_create_sys_indexes_tuple(
#error "DICT_SYS_INDEXES_PAGE_NO_FIELD != 8"
#endif
- dfield = dtuple_get_nth_field(entry, 6);
+ dfield = dtuple_get_nth_field(entry, 6/*PAGE_NO*/);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, FIL_NULL);
@@ -412,10 +421,11 @@ static
dtuple_t*
dict_create_sys_fields_tuple(
/*=========================*/
- dict_index_t* index, /*!< in: index */
- ulint i, /*!< in: field number */
- mem_heap_t* heap) /*!< in: memory heap from which the memory for
- the built tuple is allocated */
+ const dict_index_t* index, /*!< in: index */
+ ulint i, /*!< in: field number */
+ mem_heap_t* heap) /*!< in: memory heap from
+ which the memory for the built
+ tuple is allocated */
{
dict_table_t* sys_fields;
dtuple_t* entry;
@@ -425,7 +435,8 @@ dict_create_sys_fields_tuple(
ibool index_contains_column_prefix_field = FALSE;
ulint j;
- ut_ad(index && heap);
+ ut_ad(index);
+ ut_ad(heap);
for (j = 0; j < index->n_fields; j++) {
if (dict_index_get_nth_field(index, j)->prefix_len > 0) {
@@ -443,7 +454,7 @@ dict_create_sys_fields_tuple(
dict_table_copy_types(entry, sys_fields);
/* 0: INDEX_ID -----------------------*/
- dfield = dtuple_get_nth_field(entry, 0);
+ dfield = dtuple_get_nth_field(entry, 0/*INDEX_ID*/);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, index->id);
@@ -451,7 +462,7 @@ dict_create_sys_fields_tuple(
dfield_set_data(dfield, ptr, 8);
/* 1: POS + PREFIX LENGTH ----------------------------*/
- dfield = dtuple_get_nth_field(entry, 1);
+ dfield = dtuple_get_nth_field(entry, 1/*POS*/);
ptr = mem_heap_alloc(heap, 4);
@@ -471,7 +482,7 @@ dict_create_sys_fields_tuple(
dfield_set_data(dfield, ptr, 4);
/* 4: COL_NAME -------------------------*/
- dfield = dtuple_get_nth_field(entry, 2);
+ dfield = dtuple_get_nth_field(entry, 2/*COL_NAME*/);
dfield_set_data(dfield, field->name,
ut_strlen(field->name));
@@ -602,6 +613,7 @@ dict_create_index_tree_step(
dict_table_t* sys_indexes;
dict_table_t* table;
dtuple_t* search_tuple;
+ ulint zip_size;
btr_pcur_t pcur;
mtr_t mtr;
@@ -626,8 +638,9 @@ dict_create_index_tree_step(
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
- node->page_no = btr_create(index->type, index->space,
- dict_table_zip_size(index->table),
+ zip_size = dict_table_zip_size(index->table);
+
+ node->page_no = btr_create(index->type, index->space, zip_size,
index->id, index, &mtr);
/* printf("Created a new index tree in space %lu root page %lu\n",
index->space, index->page_no); */
@@ -1092,8 +1105,11 @@ dict_create_index_step(
dulint index_id = node->index->id;
- err = dict_index_add_to_cache(node->table, node->index,
- FIL_NULL, TRUE);
+ err = dict_index_add_to_cache(
+ node->table, node->index, FIL_NULL,
+ trx_is_strict(trx)
+ || dict_table_get_format(node->table)
+ >= DICT_TF_FORMAT_ZIP);
node->index = dict_index_get_if_in_cache_low(index_id);
ut_a(!node->index == (err != DB_SUCCESS));
diff --git a/storage/xtradb/dict/dict0dict.c b/storage/xtradb/dict/dict0dict.c
index 7b4174b4b15..1d088b2e02b 100644
--- a/storage/xtradb/dict/dict0dict.c
+++ b/storage/xtradb/dict/dict0dict.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -81,6 +81,10 @@ UNIV_INTERN rw_lock_t dict_operation_lock;
/** Identifies generated InnoDB foreign key names */
static char dict_ibfk[] = "_ibfk_";
+/** array of mutexes protecting dict_index_t::stat_n_diff_key_vals[] */
+#define DICT_INDEX_STAT_MUTEX_SIZE 32
+mutex_t dict_index_stat_mutex[DICT_INDEX_STAT_MUTEX_SIZE];
+
/*******************************************************************//**
Tries to find column names for the index and sets the col field of the
index.
@@ -141,7 +145,7 @@ static
void
dict_field_print_low(
/*=================*/
- dict_field_t* field); /*!< in: field */
+ const dict_field_t* field); /*!< in: field */
/*********************************************************************//**
Frees a foreign key struct. */
static
@@ -240,6 +244,45 @@ dict_mutex_exit_for_mysql(void)
mutex_exit(&(dict_sys->mutex));
}
+/** Get the mutex that protects index->stat_n_diff_key_vals[] */
+#define GET_INDEX_STAT_MUTEX(index) \
+ (&dict_index_stat_mutex[ut_fold_dulint(index->id) \
+ % DICT_INDEX_STAT_MUTEX_SIZE])
+
+/**********************************************************************//**
+Lock the appropriate mutex to protect index->stat_n_diff_key_vals[].
+index->id is used to pick the right mutex and it should not change
+before dict_index_stat_mutex_exit() is called on this index. */
+UNIV_INTERN
+void
+dict_index_stat_mutex_enter(
+/*========================*/
+ const dict_index_t* index) /*!< in: index */
+{
+ ut_ad(index != NULL);
+ ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
+ ut_ad(index->cached);
+ ut_ad(!index->to_be_dropped);
+
+ mutex_enter(GET_INDEX_STAT_MUTEX(index));
+}
+
+/**********************************************************************//**
+Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */
+UNIV_INTERN
+void
+dict_index_stat_mutex_exit(
+/*=======================*/
+ const dict_index_t* index) /*!< in: index */
+{
+ ut_ad(index != NULL);
+ ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
+ ut_ad(index->cached);
+ ut_ad(!index->to_be_dropped);
+
+ mutex_exit(GET_INDEX_STAT_MUTEX(index));
+}
+
/********************************************************************//**
Decrements the count of open MySQL handles to a table. */
UNIV_INTERN
@@ -608,6 +651,8 @@ void
dict_init(void)
/*===========*/
{
+ int i;
+
dict_sys = mem_alloc(sizeof(dict_sys_t));
mutex_create(&dict_sys->mutex, SYNC_DICT);
@@ -628,6 +673,10 @@ dict_init(void)
ut_a(dict_foreign_err_file);
mutex_create(&dict_foreign_err_mutex, SYNC_ANY_LATCH);
+
+ for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) {
+ mutex_create(&dict_index_stat_mutex[i], SYNC_INDEX_TREE);
+ }
}
/**********************************************************************//**
@@ -1442,11 +1491,7 @@ dict_index_too_big_for_tree(
goto add_field_size;
}
- if (srv_relax_table_creation) {
- field_max_size = dict_col_get_min_size(col);
- } else {
field_max_size = dict_col_get_max_size(col);
- }
field_ext_max_size = field_max_size < 256 ? 1 : 2;
if (field->prefix_len) {
@@ -1527,6 +1572,7 @@ dict_index_add_to_cache(
if (!dict_index_find_cols(table, index)) {
+ dict_mem_index_free(index);
return(DB_CORRUPTION);
}
@@ -4247,9 +4293,13 @@ dict_update_statistics_low(
index = dict_table_get_first_index(table);
+ dict_index_stat_mutex_enter(index);
+
table->stat_n_rows = index->stat_n_diff_key_vals[
dict_index_get_n_unique(index)];
+ dict_index_stat_mutex_exit(index);
+
table->stat_clustered_index_size = index->stat_index_size;
table->stat_sum_of_other_index_sizes = sum_of_index_sizes
@@ -4428,6 +4478,8 @@ dict_index_print_low(
ut_ad(mutex_own(&(dict_sys->mutex)));
+ dict_index_stat_mutex_enter(index);
+
if (index->n_user_defined_cols > 0) {
n_vals = index->stat_n_diff_key_vals[
index->n_user_defined_cols];
@@ -4435,6 +4487,8 @@ dict_index_print_low(
n_vals = index->stat_n_diff_key_vals[1];
}
+ dict_index_stat_mutex_exit(index);
+
if (dict_index_is_clust(index)) {
type_string = "clustered index";
} else if (dict_index_is_unique(index)) {
@@ -4480,7 +4534,7 @@ static
void
dict_field_print_low(
/*=================*/
- dict_field_t* field) /*!< in: field */
+ const dict_field_t* field) /*!< in: field */
{
ut_ad(mutex_own(&(dict_sys->mutex)));
@@ -4844,8 +4898,10 @@ UNIV_INTERN
void
dict_table_check_for_dup_indexes(
/*=============================*/
- const dict_table_t* table) /*!< in: Check for dup indexes
+ const dict_table_t* table, /*!< in: Check for dup indexes
in this table */
+ ibool tmp_ok) /*!< in: TRUE=allow temporary
+ index names */
{
/* Check for duplicates, ignoring indexes that are marked
as to be dropped */
@@ -4853,13 +4909,17 @@ dict_table_check_for_dup_indexes(
const dict_index_t* index1;
const dict_index_t* index2;
+ ut_ad(mutex_own(&dict_sys->mutex));
+
/* The primary index _must_ exist */
ut_a(UT_LIST_GET_LEN(table->indexes) > 0);
index1 = UT_LIST_GET_FIRST(table->indexes);
- index2 = UT_LIST_GET_NEXT(indexes, index1);
- while (index1 && index2) {
+ do {
+ ut_ad(tmp_ok || *index1->name != TEMP_INDEX_PREFIX);
+
+ index2 = UT_LIST_GET_NEXT(indexes, index1);
while (index2) {
@@ -4871,8 +4931,7 @@ dict_table_check_for_dup_indexes(
}
index1 = UT_LIST_GET_NEXT(indexes, index1);
- index2 = UT_LIST_GET_NEXT(indexes, index1);
- }
+ } while (index1);
}
#endif /* UNIV_DEBUG */
@@ -4925,6 +4984,10 @@ dict_close(void)
mem_free(dict_sys);
dict_sys = NULL;
+
+ for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) {
+ mutex_free(&dict_index_stat_mutex[i]);
+ }
}
/*************************************************************************
@@ -4939,7 +5002,7 @@ dict_table_set_corrupt_by_space(
dict_table_t* table;
ibool found = FALSE;
- ut_a(space_id != 0 && space_id < SRV_LOG_SPACE_FIRST_ID);
+ ut_a(!trx_sys_sys_space(space_id) && space_id < SRV_LOG_SPACE_FIRST_ID);
if (need_mutex)
mutex_enter(&(dict_sys->mutex));
diff --git a/storage/xtradb/dict/dict0load.c b/storage/xtradb/dict/dict0load.c
index 46cce5050cd..528c3786254 100644
--- a/storage/xtradb/dict/dict0load.c
+++ b/storage/xtradb/dict/dict0load.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -40,6 +40,7 @@ Created 4/24/1996 Heikki Tuuri
#include "rem0cmp.h"
#include "srv0start.h"
#include "srv0srv.h"
+#include "trx0sys.h"
/****************************************************************//**
Compare the name of an index column.
@@ -260,7 +261,7 @@ dict_sys_tables_get_flags(
return(0);
}
- field = rec_get_nth_field_old(rec, 4, &len);
+ field = rec_get_nth_field_old(rec, 4/*N_COLS*/, &len);
n_cols = mach_read_from_4(field);
if (UNIV_UNLIKELY(!(n_cols & 0x80000000UL))) {
@@ -390,15 +391,35 @@ loop:
mtr_commit(&mtr);
- if (space_id != 0 && in_crash_recovery) {
+ if (trx_sys_sys_space(space_id)) {
+ /* The system tablespace always exists. */
+ } else if (in_crash_recovery) {
/* Check that the tablespace (the .ibd file) really
- exists; print a warning to the .err log if not */
-
- fil_space_for_table_exists_in_mem(space_id, name,
- FALSE, TRUE, TRUE);
- }
+ exists; print a warning to the .err log if not.
+ Do not print warnings for temporary tables. */
+ ibool is_temp;
+
+ field = rec_get_nth_field_old(rec, 4, &len);
+ if (0x80000000UL & mach_read_from_4(field)) {
+ /* ROW_FORMAT=COMPACT: read the is_temp
+ flag from SYS_TABLES.MIX_LEN. */
+ field = rec_get_nth_field_old(rec, 7, &len);
+ is_temp = mach_read_from_4(field)
+ & DICT_TF2_TEMPORARY;
+ } else {
+ /* For tables created with old versions
+ of InnoDB, SYS_TABLES.MIX_LEN may contain
+ garbage. Such tables would always be
+ in ROW_FORMAT=REDUNDANT. Pretend that
+ all such tables are non-temporary. That is,
+ do not suppress error printouts about
+ temporary tables not being found. */
+ is_temp = FALSE;
+ }
- if (space_id != 0 && !in_crash_recovery) {
+ fil_space_for_table_exists_in_mem(
+ space_id, name, is_temp, TRUE, !is_temp);
+ } else {
/* It is a normal database startup: create the space
object and check that the .ibd file exists. */
@@ -878,7 +899,7 @@ err_exit:
space = mach_read_from_4(field);
/* Check if the tablespace exists and has the right name */
- if (space != 0) {
+ if (!trx_sys_sys_space(space)) {
flags = dict_sys_tables_get_flags(rec);
if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) {
@@ -894,43 +915,72 @@ err_exit:
(ulong) flags);
goto err_exit;
}
+ } else {
+ flags = 0;
+ }
- if (fil_space_for_table_exists_in_mem(space, name, FALSE,
- FALSE, FALSE)) {
- /* Ok; (if we did a crash recovery then the tablespace
- can already be in the memory cache) */
- } else {
- /* In >= 4.1.9, InnoDB scans the data dictionary also
- at a normal mysqld startup. It is an error if the
- space object does not exist in memory. */
+ ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS"));
+ field = rec_get_nth_field_old(rec, 4, &len);
+ n_cols = mach_read_from_4(field);
+
+ /* The high-order bit of N_COLS is the "compact format" flag.
+ For tables in that format, MIX_LEN may hold additional flags. */
+ if (n_cols & 0x80000000UL) {
+ ulint flags2;
+
+ flags |= DICT_TF_COMPACT;
+
+ ut_a(name_of_col_is(sys_tables, sys_index, 7, "MIX_LEN"));
+ field = rec_get_nth_field_old(rec, 7, &len);
+
+ flags2 = mach_read_from_4(field);
+
+ if (flags2 & (~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT))) {
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: Warning: table ", stderr);
+ ut_print_filename(stderr, name);
+ fprintf(stderr, "\n"
+ "InnoDB: in InnoDB data dictionary"
+ " has unknown flags %lx.\n",
+ (ulong) flags2);
+
+ flags2 &= ~(~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT));
+ }
+
+ flags |= flags2 << DICT_TF2_SHIFT;
+ }
+
+ /* See if the tablespace is available. */
+ if (trx_sys_sys_space(space)) {
+ /* The system tablespace is always available. */
+ } else if (!fil_space_for_table_exists_in_mem(
+ space, name,
+ (flags >> DICT_TF2_SHIFT) & DICT_TF2_TEMPORARY,
+ FALSE, FALSE)) {
+
+ if ((flags >> DICT_TF2_SHIFT) & DICT_TF2_TEMPORARY) {
+ /* Do not bother to retry opening temporary tables. */
+ ibd_file_missing = TRUE;
+ } else {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: error: space object of table %s,\n"
+ " InnoDB: error: space object of table");
+ ut_print_filename(stderr, name);
+ fprintf(stderr, ",\n"
"InnoDB: space id %lu did not exist in memory."
" Retrying an open.\n",
- name, (ulong)space);
+ (ulong) space);
/* Try to open the tablespace */
if (!fil_open_single_table_tablespace(
- TRUE, space, flags, name)) {
- /* We failed to find a sensible tablespace
- file */
+ TRUE, space,
+ flags & ~(~0 << DICT_TF_BITS), name)) {
+ /* We failed to find a sensible
+ tablespace file */
ibd_file_missing = TRUE;
}
}
- } else {
- flags = 0;
- }
-
- ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS"));
-
- field = rec_get_nth_field_old(rec, 4, &len);
- n_cols = mach_read_from_4(field);
-
- /* The high-order bit of N_COLS is the "compact format" flag. */
- if (n_cols & 0x80000000UL) {
- flags |= DICT_TF_COMPACT;
}
table = dict_mem_table_create(name, space, n_cols & ~0x80000000UL,
diff --git a/storage/xtradb/dict/dict0mem.c b/storage/xtradb/dict/dict0mem.c
index acf550befad..388d46568ac 100644
--- a/storage/xtradb/dict/dict0mem.c
+++ b/storage/xtradb/dict/dict0mem.c
@@ -59,7 +59,7 @@ dict_mem_table_create(
mem_heap_t* heap;
ut_ad(name);
- ut_a(!(flags & (~0 << DICT_TF_BITS)));
+ ut_a(!(flags & (~0 << DICT_TF2_BITS)));
heap = mem_heap_create(DICT_HEAP_SIZE);
diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c
index 3e63c0795f8..08789691159 100644
--- a/storage/xtradb/fil/fil0fil.c
+++ b/storage/xtradb/fil/fil0fil.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
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
@@ -38,6 +38,7 @@ Created 10/25/1995 Heikki Tuuri
#include "mtr0mtr.h"
#include "mtr0log.h"
#include "dict0dict.h"
+#include "page0page.h"
#include "page0zip.h"
#include "trx0trx.h"
#include "trx0sys.h"
@@ -675,14 +676,14 @@ fil_node_open_file(
size_bytes = (((ib_uint64_t)size_high) << 32)
+ (ib_uint64_t)size_low;
#ifdef UNIV_HOTBACKUP
- if (space->id == 0) {
+ if (trx_sys_sys_space(space->id)) {
node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
os_file_close(node->handle);
goto add_size;
}
#endif /* UNIV_HOTBACKUP */
ut_a(space->purpose != FIL_LOG);
- ut_a(space->id != 0);
+ ut_a(!trx_sys_sys_space(space->id));
if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
fprintf(stderr,
@@ -728,7 +729,7 @@ fil_node_open_file(
}
if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
- || space_id == 0)) {
+ || trx_sys_sys_space(space_id))) {
fprintf(stderr,
"InnoDB: Error: tablespace id %lu"
" in file %s is not sensible\n",
@@ -790,7 +791,7 @@ add_size:
system->n_open++;
- if (space->purpose == FIL_TABLESPACE && space->id != 0) {
+ if (space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(space->id)) {
/* Put the node to the LRU list */
UT_LIST_ADD_FIRST(LRU, system->LRU, node);
}
@@ -823,7 +824,7 @@ fil_node_close_file(
ut_a(system->n_open > 0);
system->n_open--;
- if (node->space->purpose == FIL_TABLESPACE && node->space->id != 0) {
+ if (node->space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(node->space->id)) {
ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
/* The node is in the LRU list, remove it */
@@ -909,7 +910,7 @@ fil_mutex_enter_and_prepare_for_io(
retry:
mutex_enter(&fil_system->mutex);
- if (space_id == 0 || space_id >= SRV_LOG_SPACE_FIRST_ID) {
+ if (trx_sys_sys_space(space_id) || space_id >= SRV_LOG_SPACE_FIRST_ID) {
/* We keep log files and system tablespace files always open;
this is important in preventing deadlocks in this module, as
a page read completion often performs another read from the
@@ -1104,10 +1105,13 @@ fil_space_create(
fil_space_t* space;
/* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for
- ROW_FORMAT=COMPACT (table->flags == DICT_TF_COMPACT) and
+ ROW_FORMAT=COMPACT
+ ((table->flags & ~(~0 << DICT_TF_BITS)) == DICT_TF_COMPACT) and
ROW_FORMAT=REDUNDANT (table->flags == 0). For any other
- format, the tablespace flags should equal table->flags. */
+ format, the tablespace flags should equal
+ (table->flags & ~(~0 << DICT_TF_BITS)). */
ut_a(flags != DICT_TF_COMPACT);
+ ut_a(!(flags & (~0UL << DICT_TF_BITS)));
try_again:
/*printf(
@@ -1136,7 +1140,7 @@ try_again:
" tablespace memory cache!\n",
(ulong) space->id);
- if (id == 0 || purpose != FIL_TABLESPACE) {
+ if (trx_sys_sys_space(id) || purpose != FIL_TABLESPACE) {
mutex_exit(&fil_system->mutex);
@@ -1530,7 +1534,7 @@ fil_init(
fil_system->max_n_open = max_n_open;
fil_system->modification_counter = 0;
- fil_system->max_assigned_id = 0;
+ fil_system->max_assigned_id = TRX_SYS_SPACE_MAX;
fil_system->tablespace_version = 0;
@@ -1557,7 +1561,7 @@ fil_open_log_and_system_tablespace_files(void)
space = UT_LIST_GET_FIRST(fil_system->space_list);
while (space != NULL) {
- if (space->purpose != FIL_TABLESPACE || space->id == 0) {
+ if (space->purpose != FIL_TABLESPACE || trx_sys_sys_space(space->id)) {
node = UT_LIST_GET_FIRST(space->chain);
while (node != NULL) {
@@ -2591,10 +2595,13 @@ fil_create_new_single_table_tablespace(
ut_a(size >= FIL_IBD_FILE_INITIAL_SIZE);
/* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for
- ROW_FORMAT=COMPACT (table->flags == DICT_TF_COMPACT) and
+ ROW_FORMAT=COMPACT
+ ((table->flags & ~(~0 << DICT_TF_BITS)) == DICT_TF_COMPACT) and
ROW_FORMAT=REDUNDANT (table->flags == 0). For any other
- format, the tablespace flags should equal table->flags. */
+ format, the tablespace flags should equal
+ (table->flags & ~(~0 << DICT_TF_BITS)). */
ut_a(flags != DICT_TF_COMPACT);
+ ut_a(!(flags & (~0UL << DICT_TF_BITS)));
path = fil_make_ibd_name(tablename, is_temp);
@@ -2795,6 +2802,7 @@ fil_reset_too_high_lsns(
ib_int64_t offset;
ulint zip_size;
ibool success;
+ page_zip_des_t page_zip;
filepath = fil_make_ibd_name(name, FALSE);
@@ -2842,6 +2850,12 @@ fil_reset_too_high_lsns(
space_id = fsp_header_get_space_id(page);
zip_size = fsp_header_get_zip_size(page);
+ page_zip_des_init(&page_zip);
+ page_zip_set_size(&page_zip, zip_size);
+ if (zip_size) {
+ page_zip.data = page + UNIV_PAGE_SIZE;
+ }
+
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Flush lsn in the tablespace file %lu"
@@ -2876,20 +2890,23 @@ fil_reset_too_high_lsns(
/* We have to reset the lsn */
if (zip_size) {
- memcpy(page + UNIV_PAGE_SIZE, page, zip_size);
+ memcpy(page_zip.data, page, zip_size);
buf_flush_init_for_writing(
- page, page + UNIV_PAGE_SIZE,
- current_lsn);
+ page, &page_zip, current_lsn);
+ success = os_file_write(
+ filepath, file, page_zip.data,
+ (ulint) offset & 0xFFFFFFFFUL,
+ (ulint) (offset >> 32), zip_size);
} else {
buf_flush_init_for_writing(
page, NULL, current_lsn);
+ success = os_file_write(
+ filepath, file, page,
+ (ulint)(offset & 0xFFFFFFFFUL),
+ (ulint)(offset >> 32),
+ UNIV_PAGE_SIZE);
}
- success = os_file_write(filepath, file, page,
- (ulint)(offset & 0xFFFFFFFFUL),
- (ulint)(offset >> 32),
- zip_size
- ? zip_size
- : UNIV_PAGE_SIZE);
+
if (!success) {
goto func_exit;
@@ -2965,10 +2982,13 @@ fil_open_single_table_tablespace(
filepath = fil_make_ibd_name(name, FALSE);
/* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for
- ROW_FORMAT=COMPACT (table->flags == DICT_TF_COMPACT) and
+ ROW_FORMAT=COMPACT
+ ((table->flags & ~(~0 << DICT_TF_BITS)) == DICT_TF_COMPACT) and
ROW_FORMAT=REDUNDANT (table->flags == 0). For any other
- format, the tablespace flags should equal table->flags. */
+ format, the tablespace flags should equal
+ (table->flags & ~(~0 << DICT_TF_BITS)). */
ut_a(flags != DICT_TF_COMPACT);
+ ut_a(!(flags & (~0UL << DICT_TF_BITS)));
file = os_file_create_simple_no_error_handling(
filepath, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success);
@@ -3018,7 +3038,8 @@ fil_open_single_table_tablespace(
space_id = fsp_header_get_space_id(page);
space_flags = fsp_header_get_flags(page);
- if (srv_expand_import && (space_id != id || space_flags != flags)) {
+ if (srv_expand_import
+ && (space_id != id || space_flags != (flags & ~(~0 << DICT_TF_BITS)))) {
dulint old_id[31];
dulint new_id[31];
ulint root_page[31];
@@ -3359,7 +3380,8 @@ skip_write:
ut_free(buf2);
- if (UNIV_UNLIKELY(space_id != id || space_flags != flags)) {
+ if (UNIV_UNLIKELY(space_id != id
+ || space_flags != (flags & ~(~0 << DICT_TF_BITS)))) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: tablespace id and flags in file ",
@@ -3598,7 +3620,7 @@ fil_load_single_table_tablespace(
}
#ifndef UNIV_HOTBACKUP
- if (space_id == ULINT_UNDEFINED || space_id == 0) {
+ if (space_id == ULINT_UNDEFINED || trx_sys_sys_space(space_id)) {
fprintf(stderr,
"InnoDB: Error: tablespace id %lu in file %s"
" is not sensible\n",
@@ -3607,7 +3629,7 @@ fil_load_single_table_tablespace(
goto func_exit;
}
#else
- if (space_id == ULINT_UNDEFINED || space_id == 0) {
+ if (space_id == ULINT_UNDEFINED || trx_sys_sys_space(space_id)) {
char* new_path;
fprintf(stderr,
@@ -3886,7 +3908,7 @@ fil_print_orphaned_tablespaces(void)
space = UT_LIST_GET_FIRST(fil_system->space_list);
while (space) {
- if (space->purpose == FIL_TABLESPACE && space->id != 0
+ if (space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(space->id)
&& !space->mark) {
fputs("InnoDB: Warning: tablespace ", stderr);
ut_print_filename(stderr, space->name);
@@ -4461,7 +4483,7 @@ fil_node_prepare_for_io(
}
if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
- && space->id != 0) {
+ && !trx_sys_sys_space(space->id)) {
/* The node is in the LRU list, remove it */
ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
@@ -4507,7 +4529,7 @@ fil_node_complete_io(
}
if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE
- && node->space->id != 0) {
+ && !trx_sys_sys_space(node->space->id)) {
/* The node must be put back to the LRU list */
UT_LIST_ADD_FIRST(LRU, system->LRU, node);
}
@@ -5141,7 +5163,7 @@ fil_validate(void)
ut_a(fil_node->n_pending == 0);
ut_a(fil_node->open);
ut_a(fil_node->space->purpose == FIL_TABLESPACE);
- ut_a(fil_node->space->id != 0);
+ ut_a(!trx_sys_sys_space(fil_node->space->id));
fil_node = UT_LIST_GET_NEXT(LRU, fil_node);
}
@@ -5223,8 +5245,10 @@ void
fil_close(void)
/*===========*/
{
+#ifndef UNIV_HOTBACKUP
/* The mutex should already have been freed. */
ut_ad(fil_system->mutex.magic_n == 0);
+#endif /* !UNIV_HOTBACKUP */
hash_table_free(fil_system->spaces);
diff --git a/storage/xtradb/fsp/fsp0fsp.c b/storage/xtradb/fsp/fsp0fsp.c
index 19722623611..cd28186109f 100644
--- a/storage/xtradb/fsp/fsp0fsp.c
+++ b/storage/xtradb/fsp/fsp0fsp.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
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
@@ -48,7 +48,7 @@ Created 11/29/1995 Heikki Tuuri
# include "log0log.h"
#endif /* UNIV_HOTBACKUP */
#include "dict0mem.h"
-
+#include "trx0sys.h"
#define FSP_HEADER_OFFSET FIL_PAGE_DATA /* Offset of the space header
within a file page */
@@ -392,11 +392,11 @@ UNIV_INLINE
ibool
xdes_get_bit(
/*=========*/
- xdes_t* descr, /*!< in: descriptor */
- ulint bit, /*!< in: XDES_FREE_BIT or XDES_CLEAN_BIT */
- ulint offset, /*!< in: page offset within extent:
- 0 ... FSP_EXTENT_SIZE - 1 */
- mtr_t* mtr) /*!< in: mtr */
+ const xdes_t* descr, /*!< in: descriptor */
+ ulint bit, /*!< in: XDES_FREE_BIT or XDES_CLEAN_BIT */
+ ulint offset, /*!< in: page offset within extent:
+ 0 ... FSP_EXTENT_SIZE - 1 */
+ mtr_t* mtr) /*!< in: mtr */
{
ulint index;
ulint byte_index;
@@ -533,8 +533,8 @@ UNIV_INLINE
ulint
xdes_get_n_used(
/*============*/
- xdes_t* descr, /*!< in: descriptor */
- mtr_t* mtr) /*!< in: mtr */
+ const xdes_t* descr, /*!< in: descriptor */
+ mtr_t* mtr) /*!< in: mtr */
{
ulint i;
ulint count = 0;
@@ -557,8 +557,8 @@ UNIV_INLINE
ibool
xdes_is_free(
/*=========*/
- xdes_t* descr, /*!< in: descriptor */
- mtr_t* mtr) /*!< in: mtr */
+ const xdes_t* descr, /*!< in: descriptor */
+ mtr_t* mtr) /*!< in: mtr */
{
if (0 == xdes_get_n_used(descr, mtr)) {
@@ -575,8 +575,8 @@ UNIV_INLINE
ibool
xdes_is_full(
/*=========*/
- xdes_t* descr, /*!< in: descriptor */
- mtr_t* mtr) /*!< in: mtr */
+ const xdes_t* descr, /*!< in: descriptor */
+ mtr_t* mtr) /*!< in: mtr */
{
if (FSP_EXTENT_SIZE == xdes_get_n_used(descr, mtr)) {
@@ -592,7 +592,7 @@ UNIV_INLINE
void
xdes_set_state(
/*===========*/
- xdes_t* descr, /*!< in: descriptor */
+ xdes_t* descr, /*!< in/out: descriptor */
ulint state, /*!< in: state to set */
mtr_t* mtr) /*!< in: mtr handle */
{
@@ -611,8 +611,8 @@ UNIV_INLINE
ulint
xdes_get_state(
/*===========*/
- xdes_t* descr, /*!< in: descriptor */
- mtr_t* mtr) /*!< in: mtr handle */
+ const xdes_t* descr, /*!< in: descriptor */
+ mtr_t* mtr) /*!< in: mtr handle */
{
ulint state;
@@ -708,7 +708,7 @@ UNIV_INLINE
xdes_t*
xdes_get_descriptor_with_space_hdr(
/*===============================*/
- fsp_header_t* sp_header,/*!< in: space header, x-latched */
+ fsp_header_t* sp_header,/*!< in/out: space header, x-latched */
ulint space, /*!< in: space id */
ulint offset, /*!< in: page offset;
if equal to the free limit,
@@ -878,14 +878,10 @@ fsp_init_file_page_low(
return;
}
-#ifdef UNIV_BASIC_LOG_DEBUG
- memset(page, 0xff, UNIV_PAGE_SIZE);
-#endif
+ memset(page, 0, UNIV_PAGE_SIZE);
mach_write_to_4(page + FIL_PAGE_OFFSET, buf_block_get_page_no(block));
- memset(page + FIL_PAGE_LSN, 0, 8);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
buf_block_get_space(block));
- memset(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM, 0, 8);
}
#ifndef UNIV_HOTBACKUP
@@ -1013,10 +1009,10 @@ fsp_header_init(
flst_init(header + FSP_SEG_INODES_FREE, mtr);
mlog_write_dulint(header + FSP_SEG_ID, ut_dulint_create(0, 1), mtr);
- if (space == 0) {
+ if (space == TRX_SYS_SPACE || space == TRX_DOUBLEWRITE_SPACE) {
fsp_fill_free_list(FALSE, space, header, mtr);
btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,
- 0, 0, ut_dulint_add(DICT_IBUF_ID_MIN, space),
+ space, 0, ut_dulint_add(DICT_IBUF_ID_MIN, space),
dict_ind_redundant, mtr);
} else {
fsp_fill_free_list(TRUE, space, header, mtr);
@@ -1351,7 +1347,7 @@ fsp_fill_free_list(
descriptor page and ibuf bitmap page;
then we do not allocate more extents */
ulint space, /*!< in: space */
- fsp_header_t* header, /*!< in: space header */
+ fsp_header_t* header, /*!< in/out: space header */
mtr_t* mtr) /*!< in: mtr */
{
ulint limit;
diff --git a/storage/xtradb/ha/ha0ha.c b/storage/xtradb/ha/ha0ha.c
index cb5e541b55d..9d9d341ad39 100644
--- a/storage/xtradb/ha/ha0ha.c
+++ b/storage/xtradb/ha/ha0ha.c
@@ -101,6 +101,8 @@ ha_clear(
ulint i;
ulint n;
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EXCLUSIVE));
#endif /* UNIV_SYNC_DEBUG */
@@ -146,7 +148,9 @@ ha_insert_for_fold_func(
ha_node_t* prev_node;
ulint hash;
- ut_ad(table && data);
+ ut_ad(data);
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
ut_a(block->frame == page_align(data));
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -237,6 +241,8 @@ ha_delete_hash_node(
hash_table_t* table, /*!< in: hash table */
ha_node_t* del_node) /*!< in: node to be deleted */
{
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
# ifndef UNIV_HOTBACKUP
if (table->adaptive) {
@@ -267,6 +273,8 @@ ha_search_and_update_if_found_func(
{
ha_node_t* node;
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ASSERT_HASH_MUTEX_OWN(table, fold);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
ut_a(new_block->frame == page_align(new_data));
@@ -304,6 +312,8 @@ ha_remove_all_nodes_to_page(
{
ha_node_t* node;
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ASSERT_HASH_MUTEX_OWN(table, fold);
node = ha_chain_get_first(table, fold);
@@ -353,6 +363,8 @@ ha_validate(
ibool ok = TRUE;
ulint i;
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ut_a(start_index <= end_index);
ut_a(start_index < hash_get_n_cells(table));
ut_a(end_index < hash_get_n_cells(table));
@@ -404,6 +416,8 @@ builds, see http://bugs.mysql.com/36941 */
#endif /* PRINT_USED_CELLS */
ulint n_bufs;
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
#ifdef PRINT_USED_CELLS
for (i = 0; i < hash_get_n_cells(table); i++) {
diff --git a/storage/xtradb/ha/hash0hash.c b/storage/xtradb/ha/hash0hash.c
index 2800d7793f8..30c304dafcd 100644
--- a/storage/xtradb/ha/hash0hash.c
+++ b/storage/xtradb/ha/hash0hash.c
@@ -119,7 +119,7 @@ hash_create(
table->heaps = NULL;
#endif /* !UNIV_HOTBACKUP */
table->heap = NULL;
- table->magic_n = HASH_TABLE_MAGIC_N;
+ ut_d(table->magic_n = HASH_TABLE_MAGIC_N);
/* Initialize the cell array */
hash_table_clear(table);
@@ -135,6 +135,8 @@ hash_table_free(
/*============*/
hash_table_t* table) /*!< in, own: hash table */
{
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
#ifndef UNIV_HOTBACKUP
ut_a(table->mutexes == NULL);
#endif /* !UNIV_HOTBACKUP */
@@ -160,6 +162,8 @@ hash_create_mutexes_func(
{
ulint i;
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ut_a(n_mutexes > 0);
ut_a(ut_is_2pow(n_mutexes));
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 8c439f65720..ad4a1f8d3bd 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -1,7 +1,8 @@
/*****************************************************************************
-Copyright (c) 2000, 2009, MySQL AB & Innobase Oy. All Rights Reserved.
+Copyright (c) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
+Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are
incorporated with their permission, and subject to the conditions contained in
the file COPYING.Google.
+Portions of this file contain modifications contributed and copyrighted
+by Percona Inc.. Those modifications are
+gratefully acknowledged and are described briefly in the InnoDB
+documentation. The contributions by Percona Inc. are incorporated with
+their permission, and subject to the conditions contained in the file
+COPYING.Percona.
+
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.
@@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-/***********************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
-Copyright (c) 2009, Percona Inc.
-
-Portions of this file contain modifications contributed and copyrighted
-by Percona Inc.. Those modifications are
-gratefully acknowledged and are described briefly in the InnoDB
-documentation. The contributions by Percona Inc. are incorporated with
-their permission, and subject to the conditions contained in the file
-COPYING.Percona.
-
-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
-
-***********************************************************************/
/* TODO list for the InnoDB handler in 5.0:
- Remove the flag trx->active_trans and look at trx->conc_state
@@ -141,7 +123,6 @@ static ulong commit_threads = 0;
static pthread_mutex_t commit_threads_m;
static pthread_cond_t commit_cond;
static pthread_mutex_t commit_cond_m;
-static pthread_mutex_t analyze_mutex;
static bool innodb_inited = 0;
#define INSIDE_HA_INNOBASE_CC
@@ -184,6 +165,7 @@ static char* innobase_data_file_path = NULL;
static char* innobase_log_group_home_dir = NULL;
static char* innobase_file_format_name = NULL;
static char* innobase_change_buffering = NULL;
+static char* innobase_doublewrite_file = NULL;
/* Note: This variable can be set to on/off and any of the supported
file formats in the configuration file, but can only be set to any
@@ -356,7 +338,7 @@ static MYSQL_THDVAR_ULONG(lock_wait_timeout, PLUGIN_VAR_RQCMDARG,
static handler *innobase_create_handler(handlerton *hton,
- TABLE_SHARE *table,
+ TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_innobase(hton, table);
@@ -469,8 +451,9 @@ static
int
innobase_start_trx_and_assign_read_view(
/*====================================*/
- handlerton* hton, /*!< in: Innodb handlerton */
- THD* thd); /*!< in: MySQL thread handle of the user for whom
+ /* out: 0 */
+ handlerton* hton, /* in: Innodb handlerton */
+ THD* thd); /* in: MySQL thread handle of the user for whom
the transaction should be committed */
/****************************************************************//**
Flushes InnoDB logs to disk and makes a checkpoint. Really, a commit flushes
@@ -552,6 +535,8 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_data_written, SHOW_LONG},
{"dblwr_pages_written",
(char*) &export_vars.innodb_dblwr_pages_written, SHOW_LONG},
+ {"deadlocks",
+ (char*) &export_vars.innodb_deadlocks, SHOW_LONG},
{"dblwr_writes",
(char*) &export_vars.innodb_dblwr_writes, SHOW_LONG},
{"dict_tables",
@@ -1893,6 +1878,19 @@ trx_is_interrupted(
return(trx && trx->mysql_thd && thd_killed((THD*) trx->mysql_thd));
}
+/**********************************************************************//**
+Determines if the currently running transaction is in strict mode.
+@return TRUE if strict */
+extern "C" UNIV_INTERN
+ibool
+trx_is_strict(
+/*==========*/
+ trx_t* trx) /*!< in: transaction */
+{
+ return(trx && trx->mysql_thd
+ && THDVAR((THD*) trx->mysql_thd, strict_mode));
+}
+
/**************************************************************//**
Resets some fields of a prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */
@@ -2229,6 +2227,8 @@ mem_free_and_error:
goto error;
}
+ srv_doublewrite_file = innobase_doublewrite_file;
+
srv_extra_undoslots = (ibool) innobase_extra_undoslots;
/* -------------- Log files ---------------------------*/
@@ -2327,7 +2327,7 @@ mem_free_and_error:
}
sql_print_error("InnoDB: invalid value "
- "innodb_file_format_check=%s",
+ "innodb_change_buffering=%s",
innobase_change_buffering);
goto mem_free_and_error;
}
@@ -2366,7 +2366,6 @@ innobase_change_buffering_inited_ok:
srv_force_recovery = (ulint) innobase_force_recovery;
- srv_fast_recovery = (ibool) innobase_fast_recovery;
srv_recovery_stats = (ibool) innobase_recovery_stats;
srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
@@ -2496,7 +2495,6 @@ skip_overwrite:
pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&analyze_mutex, MY_MUTEX_INIT_FAST);
pthread_cond_init(&commit_cond, NULL);
innodb_inited= 1;
#ifdef MYSQL_DYNAMIC_PLUGIN
@@ -2551,7 +2549,6 @@ innobase_end(
pthread_mutex_destroy(&prepare_commit_mutex);
pthread_mutex_destroy(&commit_threads_m);
pthread_mutex_destroy(&commit_cond_m);
- pthread_mutex_destroy(&analyze_mutex);
pthread_cond_destroy(&commit_cond);
}
@@ -2588,10 +2585,7 @@ innobase_alter_table_flags(
{
return(HA_ONLINE_ADD_INDEX_NO_WRITES
| HA_ONLINE_DROP_INDEX_NO_WRITES
- /* Current InnoDB doesn't sort unique indexes along mysqld's order
- It is dangerous to use index. So it is disabled until
- the bug http://bugs.mysql.com/47622 */
- /* | HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES */
+ | HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES
| HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES
| HA_ONLINE_ADD_PK_INDEX_NO_WRITES);
}
@@ -3286,59 +3280,370 @@ normalize_table_name(
}
/********************************************************************//**
+Get the upper limit of the MySQL integral and floating-point type.
+@return maximum allowed value for the field */
+static
+ulonglong
+innobase_get_int_col_max_value(
+/*===========================*/
+ const Field* field) /*!< in: MySQL field */
+{
+ ulonglong max_value = 0;
+
+ switch(field->key_type()) {
+ /* TINY */
+ case HA_KEYTYPE_BINARY:
+ max_value = 0xFFULL;
+ break;
+ case HA_KEYTYPE_INT8:
+ max_value = 0x7FULL;
+ break;
+ /* SHORT */
+ case HA_KEYTYPE_USHORT_INT:
+ max_value = 0xFFFFULL;
+ break;
+ case HA_KEYTYPE_SHORT_INT:
+ max_value = 0x7FFFULL;
+ break;
+ /* MEDIUM */
+ case HA_KEYTYPE_UINT24:
+ max_value = 0xFFFFFFULL;
+ break;
+ case HA_KEYTYPE_INT24:
+ max_value = 0x7FFFFFULL;
+ break;
+ /* LONG */
+ case HA_KEYTYPE_ULONG_INT:
+ max_value = 0xFFFFFFFFULL;
+ break;
+ case HA_KEYTYPE_LONG_INT:
+ max_value = 0x7FFFFFFFULL;
+ break;
+ /* BIG */
+ case HA_KEYTYPE_ULONGLONG:
+ max_value = 0xFFFFFFFFFFFFFFFFULL;
+ break;
+ case HA_KEYTYPE_LONGLONG:
+ max_value = 0x7FFFFFFFFFFFFFFFULL;
+ break;
+ case HA_KEYTYPE_FLOAT:
+ /* We use the maximum as per IEEE754-2008 standard, 2^24 */
+ max_value = 0x1000000ULL;
+ break;
+ case HA_KEYTYPE_DOUBLE:
+ /* We use the maximum as per IEEE754-2008 standard, 2^53 */
+ max_value = 0x20000000000000ULL;
+ break;
+ default:
+ ut_error;
+ }
+
+ return(max_value);
+}
+
+/*******************************************************************//**
+This function checks whether the index column information
+is consistent between KEY info from mysql and that from innodb index.
+@return TRUE if all column types match. */
+static
+ibool
+innobase_match_index_columns(
+/*=========================*/
+ const KEY* key_info, /*!< in: Index info
+ from mysql */
+ const dict_index_t* index_info) /*!< in: Index info
+ from Innodb */
+{
+ const KEY_PART_INFO* key_part;
+ const KEY_PART_INFO* key_end;
+ const dict_field_t* innodb_idx_fld;
+ const dict_field_t* innodb_idx_fld_end;
+
+ DBUG_ENTER("innobase_match_index_columns");
+
+ /* Check whether user defined index column count matches */
+ if (key_info->key_parts != index_info->n_user_defined_cols) {
+ DBUG_RETURN(FALSE);
+ }
+
+ key_part = key_info->key_part;
+ key_end = key_part + key_info->key_parts;
+ innodb_idx_fld = index_info->fields;
+ innodb_idx_fld_end = index_info->fields + index_info->n_fields;
+
+ /* Check each index column's datatype. We do not check
+ column name because there exists case that index
+ column name got modified in mysql but such change does not
+ propagate to InnoDB.
+ One hidden assumption here is that the index column sequences
+ are matched up between those in mysql and Innodb. */
+ for (; key_part != key_end; ++key_part) {
+ ulint col_type;
+ ibool is_unsigned;
+ ulint mtype = innodb_idx_fld->col->mtype;
+
+ /* Need to translate to InnoDB column type before
+ comparison. */
+ col_type = get_innobase_type_from_mysql_type(&is_unsigned,
+ key_part->field);
+
+ /* Ignore Innodb specific system columns. */
+ while (mtype == DATA_SYS) {
+ innodb_idx_fld++;
+
+ if (innodb_idx_fld >= innodb_idx_fld_end) {
+ DBUG_RETURN(FALSE);
+ }
+ }
+
+ if (col_type != mtype) {
+ /* Column Type mismatches */
+ DBUG_RETURN(FALSE);
+ }
+
+ innodb_idx_fld++;
+ }
+
+ DBUG_RETURN(TRUE);
+}
+
+/*******************************************************************//**
+This function builds a translation table in INNOBASE_SHARE
+structure for fast index location with mysql array number from its
+table->key_info structure. This also provides the necessary translation
+between the key order in mysql key_info and Innodb ib_table->indexes if
+they are not fully matched with each other.
+Note we do not have any mutex protecting the translation table
+building based on the assumption that there is no concurrent
+index creation/drop and DMLs that requires index lookup. All table
+handle will be closed before the index creation/drop.
+@return TRUE if index translation table built successfully */
+static
+ibool
+innobase_build_index_translation(
+/*=============================*/
+ const TABLE* table, /*!< in: table in MySQL data
+ dictionary */
+ dict_table_t* ib_table, /*!< in: table in Innodb data
+ dictionary */
+ INNOBASE_SHARE* share) /*!< in/out: share structure
+ where index translation table
+ will be constructed in. */
+{
+ ulint mysql_num_index;
+ ulint ib_num_index;
+ dict_index_t** index_mapping;
+ ibool ret = TRUE;
+
+ DBUG_ENTER("innobase_build_index_translation");
+
+ mysql_num_index = table->s->keys;
+ ib_num_index = UT_LIST_GET_LEN(ib_table->indexes);
+
+ index_mapping = share->idx_trans_tbl.index_mapping;
+
+ /* If there exists inconsistency between MySQL and InnoDB dictionary
+ (metadata) information, the number of index defined in MySQL
+ could exceed that in InnoDB, do not build index translation
+ table in such case */
+ if (UNIV_UNLIKELY(ib_num_index < mysql_num_index)) {
+ ret = FALSE;
+ goto func_exit;
+ }
+
+ /* If index entry count is non-zero, nothing has
+ changed since last update, directly return TRUE */
+ if (share->idx_trans_tbl.index_count) {
+ /* Index entry count should still match mysql_num_index */
+ ut_a(share->idx_trans_tbl.index_count == mysql_num_index);
+ goto func_exit;
+ }
+
+ /* The number of index increased, rebuild the mapping table */
+ if (mysql_num_index > share->idx_trans_tbl.array_size) {
+ index_mapping = (dict_index_t**) my_realloc(index_mapping,
+ mysql_num_index *
+ sizeof(*index_mapping),
+ MYF(MY_ALLOW_ZERO_PTR));
+
+ if (!index_mapping) {
+ ret = FALSE;
+ goto func_exit;
+ }
+
+ share->idx_trans_tbl.array_size = mysql_num_index;
+ }
+
+
+ /* For each index in the mysql key_info array, fetch its
+ corresponding InnoDB index pointer into index_mapping
+ array. */
+ for (ulint count = 0; count < mysql_num_index; count++) {
+
+ /* Fetch index pointers into index_mapping according to mysql
+ index sequence */
+ index_mapping[count] = dict_table_get_index_on_name(
+ ib_table, table->key_info[count].name);
+
+ if (!index_mapping[count]) {
+ sql_print_error("Cannot find index %s in InnoDB "
+ "index dictionary.",
+ table->key_info[count].name);
+ ret = FALSE;
+ goto func_exit;
+ }
+
+ /* Double check fetched index has the same
+ column info as those in mysql key_info. */
+ if (!innobase_match_index_columns(&table->key_info[count],
+ index_mapping[count])) {
+ sql_print_error("Found index %s whose column info "
+ "does not match that of MySQL.",
+ table->key_info[count].name);
+ ret = FALSE;
+ goto func_exit;
+ }
+ }
+
+ /* Successfully built the translation table */
+ share->idx_trans_tbl.index_count = mysql_num_index;
+
+func_exit:
+ if (!ret) {
+ /* Build translation table failed. */
+ my_free(index_mapping, MYF(MY_ALLOW_ZERO_PTR));
+
+ share->idx_trans_tbl.array_size = 0;
+ share->idx_trans_tbl.index_count = 0;
+ index_mapping = NULL;
+ }
+
+ share->idx_trans_tbl.index_mapping = index_mapping;
+
+ DBUG_RETURN(ret);
+}
+
+/*******************************************************************//**
+This function uses index translation table to quickly locate the
+requested index structure.
+Note we do not have mutex protection for the index translatoin table
+access, it is based on the assumption that there is no concurrent
+translation table rebuild (fter create/drop index) and DMLs that
+require index lookup.
+@return dict_index_t structure for requested index. NULL if
+fail to locate the index structure. */
+static
+dict_index_t*
+innobase_index_lookup(
+/*==================*/
+ INNOBASE_SHARE* share, /*!< in: share structure for index
+ translation table. */
+ uint keynr) /*!< in: index number for the requested
+ index */
+{
+ if (!share->idx_trans_tbl.index_mapping
+ || keynr >= share->idx_trans_tbl.index_count) {
+ return(NULL);
+ }
+
+ return(share->idx_trans_tbl.index_mapping[keynr]);
+}
+
+/************************************************************************
Set the autoinc column max value. This should only be called once from
-ha_innobase::open(). Therefore there's no need for a covering lock.
-@return DB_SUCCESS or error code */
+ha_innobase::open(). Therefore there's no need for a covering lock. */
UNIV_INTERN
-ulint
+void
ha_innobase::innobase_initialize_autoinc()
/*======================================*/
{
- dict_index_t* index;
ulonglong auto_inc;
- const char* col_name;
- ulint error;
+ const Field* field = table->found_next_number_field;
- col_name = table->found_next_number_field->field_name;
- index = innobase_get_index(table->s->next_number_index);
+ if (field != NULL) {
+ auto_inc = innobase_get_int_col_max_value(field);
+ } else {
+ /* We have no idea what's been passed in to us as the
+ autoinc column. We set it to the 0, effectively disabling
+ updates to the table. */
+ auto_inc = 0;
- /* Execute SELECT MAX(col_name) FROM TABLE; */
- error = row_search_max_autoinc(index, col_name, &auto_inc);
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: Unable to determine the AUTOINC "
+ "column name\n");
+ }
- switch (error) {
- case DB_SUCCESS:
+ if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
+ /* If the recovery level is set so high that writes
+ are disabled we force the AUTOINC counter to 0
+ value effectively disabling writes to the table.
+ Secondly, we avoid reading the table in case the read
+ results in failure due to a corrupted table/index.
+
+ We will not return an error to the client, so that the
+ tables can be dumped with minimal hassle. If an error
+ were returned in this case, the first attempt to read
+ the table would fail and subsequent SELECTs would succeed. */
+ auto_inc = 0;
+ } else if (field == NULL) {
+ /* This is a far more serious error, best to avoid
+ opening the table and return failure. */
+ my_error(ER_AUTOINC_READ_FAILED, MYF(0));
+ } else {
+ dict_index_t* index;
+ const char* col_name;
+ ulonglong read_auto_inc;
+ ulint err;
- /* At the this stage we don't know the increment
- or the offset, so use default inrement of 1. */
- ++auto_inc;
- break;
+ update_thd(ha_thd());
- case DB_RECORD_NOT_FOUND:
- ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: MySQL and InnoDB data "
- "dictionaries are out of sync.\n"
- "InnoDB: Unable to find the AUTOINC column %s in the "
- "InnoDB table %s.\n"
- "InnoDB: We set the next AUTOINC column value to the "
- "maximum possible value,\n"
- "InnoDB: in effect disabling the AUTOINC next value "
- "generation.\n"
- "InnoDB: You can either set the next AUTOINC value "
- "explicitly using ALTER TABLE\n"
- "InnoDB: or fix the data dictionary by recreating "
- "the table.\n",
- col_name, index->table->name);
-
- auto_inc = 0xFFFFFFFFFFFFFFFFULL;
- break;
+ ut_a(prebuilt->trx == thd_to_trx(user_thd));
- default:
- return(error);
+ col_name = field->field_name;
+ index = innobase_get_index(table->s->next_number_index);
+
+ /* Execute SELECT MAX(col_name) FROM TABLE; */
+ err = row_search_max_autoinc(index, col_name, &read_auto_inc);
+
+ switch (err) {
+ case DB_SUCCESS:
+ /* At the this stage we do not know the increment
+ or the offset, so use a default increment of 1. */
+ auto_inc = read_auto_inc + 1;
+ break;
+
+ case DB_RECORD_NOT_FOUND:
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: MySQL and InnoDB data "
+ "dictionaries are out of sync.\n"
+ "InnoDB: Unable to find the AUTOINC column "
+ "%s in the InnoDB table %s.\n"
+ "InnoDB: We set the next AUTOINC column "
+ "value to 0,\n"
+ "InnoDB: in effect disabling the AUTOINC "
+ "next value generation.\n"
+ "InnoDB: You can either set the next "
+ "AUTOINC value explicitly using ALTER TABLE\n"
+ "InnoDB: or fix the data dictionary by "
+ "recreating the table.\n",
+ col_name, index->table->name);
+
+ /* This will disable the AUTOINC generation. */
+ auto_inc = 0;
+
+ /* We want the open to succeed, so that the user can
+ take corrective action. ie. reads should succeed but
+ updates should fail. */
+ err = DB_SUCCESS;
+ break;
+ default:
+ /* row_search_max_autoinc() should only return
+ one of DB_SUCCESS or DB_RECORD_NOT_FOUND. */
+ ut_error;
+ }
}
dict_table_autoinc_initialize(prebuilt->table, auto_inc);
-
- return(DB_SUCCESS);
}
/*****************************************************************//**
@@ -3491,6 +3796,11 @@ retry:
primary_key = table->s->primary_key;
key_used_on_scan = primary_key;
+ if (!innobase_build_index_translation(table, ib_table, share)) {
+ sql_print_error("Build InnoDB index translation table for"
+ " Table %s failed", name);
+ }
+
/* Allocate a buffer for a 'row reference'. A row reference is
a string of bytes of length ref_length which uniquely specifies
a row in our table. Note that MySQL may also compare two row
@@ -3498,31 +3808,85 @@ retry:
of length ref_length! */
if (!row_table_got_default_clust_index(ib_table)) {
- if (primary_key >= MAX_KEY) {
- sql_print_error("Table %s has a primary key in InnoDB data "
- "dictionary, but not in MySQL!", name);
- }
-
prebuilt->clust_index_was_generated = FALSE;
- /* MySQL allocates the buffer for ref. key_info->key_length
- includes space for all key columns + one byte for each column
- that may be NULL. ref_length must be as exact as possible to
- save space, because all row reference buffers are allocated
- based on ref_length. */
+ if (UNIV_UNLIKELY(primary_key >= MAX_KEY)) {
+ sql_print_error("Table %s has a primary key in "
+ "InnoDB data dictionary, but not "
+ "in MySQL!", name);
+
+ /* This mismatch could cause further problems
+ if not attended, bring this to the user's attention
+ by printing a warning in addition to log a message
+ in the errorlog */
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_NO_SUCH_INDEX,
+ "InnoDB: Table %s has a "
+ "primary key in InnoDB data "
+ "dictionary, but not in "
+ "MySQL!", name);
+
+ /* If primary_key >= MAX_KEY, its (primary_key)
+ value could be out of bound if continue to index
+ into key_info[] array. Find InnoDB primary index,
+ and assign its key_length to ref_length.
+ In addition, since MySQL indexes are sorted starting
+ with primary index, unique index etc., initialize
+ ref_length to the first index key length in
+ case we fail to find InnoDB cluster index.
+
+ Please note, this will not resolve the primary
+ index mismatch problem, other side effects are
+ possible if users continue to use the table.
+ However, we allow this table to be opened so
+ that user can adopt necessary measures for the
+ mismatch while still being accessible to the table
+ date. */
+ ref_length = table->key_info[0].key_length;
+
+ /* Find correspoinding cluster index
+ key length in MySQL's key_info[] array */
+ for (ulint i = 0; i < table->s->keys; i++) {
+ dict_index_t* index;
+ index = innobase_get_index(i);
+ if (dict_index_is_clust(index)) {
+ ref_length =
+ table->key_info[i].key_length;
+ }
+ }
+ } else {
+ /* MySQL allocates the buffer for ref.
+ key_info->key_length includes space for all key
+ columns + one byte for each column that may be
+ NULL. ref_length must be as exact as possible to
+ save space, because all row reference buffers are
+ allocated based on ref_length. */
- ref_length = table->key_info[primary_key].key_length;
+ ref_length = table->key_info[primary_key].key_length;
+ }
} else {
if (primary_key != MAX_KEY) {
- sql_print_error("Table %s has no primary key in InnoDB data "
- "dictionary, but has one in MySQL! If you "
- "created the table with a MySQL version < "
- "3.23.54 and did not define a primary key, "
- "but defined a unique key with all non-NULL "
- "columns, then MySQL internally treats that "
- "key as the primary key. You can fix this "
- "error by dump + DROP + CREATE + reimport "
- "of the table.", name);
+ sql_print_error(
+ "Table %s has no primary key in InnoDB data "
+ "dictionary, but has one in MySQL! If you "
+ "created the table with a MySQL version < "
+ "3.23.54 and did not define a primary key, "
+ "but defined a unique key with all non-NULL "
+ "columns, then MySQL internally treats that "
+ "key as the primary key. You can fix this "
+ "error by dump + DROP + CREATE + reimport "
+ "of the table.", name);
+
+ /* This mismatch could cause further problems
+ if not attended, bring this to the user attention
+ by printing a warning in addition to log a message
+ in the errorlog */
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_NO_SUCH_INDEX,
+ "InnoDB: Table %s has no "
+ "primary key in InnoDB data "
+ "dictionary, but has one in "
+ "MySQL!", name);
}
prebuilt->clust_index_was_generated = TRUE;
@@ -3564,8 +3928,6 @@ retry:
/* Only if the table has an AUTOINC column. */
if (prebuilt->table != NULL && table->found_next_number_field != NULL) {
- ulint error;
-
dict_table_autoinc_lock(prebuilt->table);
/* Since a table can already be "open" in InnoDB's internal
@@ -3574,8 +3936,7 @@ retry:
autoinc value from a previous MySQL open. */
if (dict_table_autoinc_read(prebuilt->table) == 0) {
- error = innobase_initialize_autoinc();
- ut_a(error == DB_SUCCESS);
+ innobase_initialize_autoinc();
}
dict_table_autoinc_unlock(prebuilt->table);
@@ -3866,6 +4227,11 @@ get_innobase_type_from_mysql_type(
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_LONG_BLOB:
return(DATA_BLOB);
+ case MYSQL_TYPE_NULL:
+ /* MySQL currently accepts "NULL" datatype, but will
+ reject such datatype in the next release. We will cope
+ with it and not trigger assertion failure in 5.1 */
+ break;
default:
ut_error;
}
@@ -4397,67 +4763,6 @@ skip_field:
}
/********************************************************************//**
-Get the upper limit of the MySQL integral and floating-point type. */
-UNIV_INTERN
-ulonglong
-ha_innobase::innobase_get_int_col_max_value(
-/*========================================*/
- const Field* field)
-{
- ulonglong max_value = 0;
-
- switch(field->key_type()) {
- /* TINY */
- case HA_KEYTYPE_BINARY:
- max_value = 0xFFULL;
- break;
- case HA_KEYTYPE_INT8:
- max_value = 0x7FULL;
- break;
- /* SHORT */
- case HA_KEYTYPE_USHORT_INT:
- max_value = 0xFFFFULL;
- break;
- case HA_KEYTYPE_SHORT_INT:
- max_value = 0x7FFFULL;
- break;
- /* MEDIUM */
- case HA_KEYTYPE_UINT24:
- max_value = 0xFFFFFFULL;
- break;
- case HA_KEYTYPE_INT24:
- max_value = 0x7FFFFFULL;
- break;
- /* LONG */
- case HA_KEYTYPE_ULONG_INT:
- max_value = 0xFFFFFFFFULL;
- break;
- case HA_KEYTYPE_LONG_INT:
- max_value = 0x7FFFFFFFULL;
- break;
- /* BIG */
- case HA_KEYTYPE_ULONGLONG:
- max_value = 0xFFFFFFFFFFFFFFFFULL;
- break;
- case HA_KEYTYPE_LONGLONG:
- max_value = 0x7FFFFFFFFFFFFFFFULL;
- break;
- case HA_KEYTYPE_FLOAT:
- /* We use the maximum as per IEEE754-2008 standard, 2^24 */
- max_value = 0x1000000ULL;
- break;
- case HA_KEYTYPE_DOUBLE:
- /* We use the maximum as per IEEE754-2008 standard, 2^53 */
- max_value = 0x20000000000000ULL;
- break;
- default:
- ut_error;
- }
-
- return(max_value);
-}
-
-/********************************************************************//**
This special handling is really to overcome the limitations of MySQL's
binlogging. We need to eliminate the non-determinism that will arise in
INSERT ... SELECT type of statements, since MySQL binlog only stores the
@@ -4686,11 +4991,17 @@ no_commit:
prebuilt->autoinc_error = DB_SUCCESS;
if ((error = update_auto_increment())) {
-
/* We don't want to mask autoinc overflow errors. */
- if (prebuilt->autoinc_error != DB_SUCCESS) {
- error = (int) prebuilt->autoinc_error;
+ /* Handle the case where the AUTOINC sub-system
+ failed during initialization. */
+ if (prebuilt->autoinc_error == DB_UNSUPPORTED) {
+ error_result = ER_AUTOINC_READ_FAILED;
+ /* Set the error message to report too. */
+ my_error(ER_AUTOINC_READ_FAILED, MYF(0));
+ goto func_exit;
+ } else if (prebuilt->autoinc_error != DB_SUCCESS) {
+ error = (int) prebuilt->autoinc_error;
goto report_error;
}
@@ -5175,7 +5486,7 @@ ha_innobase::unlock_row(void)
case ROW_READ_WITH_LOCKS:
if (!srv_locks_unsafe_for_binlog
&& prebuilt->trx->isolation_level
- != TRX_ISO_READ_COMMITTED) {
+ > TRX_ISO_READ_COMMITTED) {
break;
}
/* fall through */
@@ -5214,7 +5525,7 @@ ha_innobase::try_semi_consistent_read(bool yes)
if (yes
&& (srv_locks_unsafe_for_binlog
- || prebuilt->trx->isolation_level == TRX_ISO_READ_COMMITTED)) {
+ || prebuilt->trx->isolation_level <= TRX_ISO_READ_COMMITTED)) {
prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
} else {
prebuilt->row_read_type = ROW_READ_WITH_LOCKS;
@@ -5517,14 +5828,30 @@ ha_innobase::innobase_get_index(
DBUG_ENTER("innobase_get_index");
ha_statistic_increment(&SSV::ha_read_key_count);
- ut_ad(user_thd == ha_thd());
- ut_a(prebuilt->trx == thd_to_trx(user_thd));
-
if (keynr != MAX_KEY && table->s->keys > 0) {
key = table->key_info + keynr;
- index = dict_table_get_index_on_name(prebuilt->table,
- key->name);
+ index = innobase_index_lookup(share, keynr);
+
+ if (index) {
+ ut_a(ut_strcmp(index->name, key->name) == 0);
+ } else {
+ /* Can't find index with keynr in the translation
+ table. Only print message if the index translation
+ table exists */
+ if (share->idx_trans_tbl.index_mapping) {
+ sql_print_error("InnoDB could not find "
+ "index %s key no %u for "
+ "table %s through its "
+ "index translation table",
+ key ? key->name : "NULL",
+ keynr,
+ prebuilt->table->name);
+ }
+
+ index = dict_table_get_index_on_name(prebuilt->table,
+ key->name);
+ }
} else {
index = dict_table_get_first_index(prebuilt->table);
}
@@ -5590,7 +5917,7 @@ ha_innobase::change_active_index(
dtuple_set_n_fields(prebuilt->search_tuple, prebuilt->index->n_fields);
dict_index_copy_types(prebuilt->search_tuple, prebuilt->index,
- prebuilt->index->n_fields);
+ prebuilt->index->n_fields);
/* MySQL changes the active index for a handle also during some
queries, for example SELECT MAX(a), SUM(a) first retrieves the MAX()
@@ -6025,7 +6352,22 @@ create_table_def(
continue;
col_type = get_innobase_type_from_mysql_type(&unsigned_type,
- field);
+ field);
+
+ if (!col_type) {
+ push_warning_printf(
+ (THD*) trx->mysql_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_CANT_CREATE_TABLE,
+ "Error creating table '%s' with "
+ "column '%s'. Please check its "
+ "column type and try to re-create "
+ "the table with an appropriate "
+ "column type.",
+ table->name, (char*) field->field_name);
+ goto err_col;
+ }
+
if (field->null_ptr) {
nulls_allowed = 0;
} else {
@@ -6083,7 +6425,7 @@ create_table_def(
if (dict_col_name_is_reserved(field->field_name)){
my_error(ER_WRONG_COLUMN_NAME, MYF(0),
field->field_name);
-
+err_col:
dict_mem_table_free(table);
trx_commit_for_mysql(trx);
@@ -6106,9 +6448,11 @@ create_table_def(
if (error == DB_DUPLICATE_KEY) {
char buf[100];
- innobase_convert_identifier(buf, sizeof buf,
- table_name, strlen(table_name),
- trx->mysql_thd, TRUE);
+ char* buf_end = innobase_convert_identifier(
+ buf, sizeof buf - 1, table_name, strlen(table_name),
+ trx->mysql_thd, TRUE);
+
+ *buf_end = '\0';
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), buf);
}
@@ -6710,6 +7054,10 @@ ha_innobase::create(
goto cleanup;
}
+ if (create_info->options & HA_LEX_CREATE_TMP_TABLE) {
+ flags |= DICT_TF2_TEMPORARY << DICT_TF2_SHIFT;
+ }
+
error = create_table_def(trx, form, norm_name,
create_info->options & HA_LEX_CREATE_TMP_TABLE ? name2 : NULL,
flags);
@@ -7241,10 +7589,15 @@ ha_innobase::records_in_range(
key = table->key_info + active_index;
- index = dict_table_get_index_on_name(prebuilt->table, key->name);
+ index = innobase_get_index(keynr);
- /* MySQL knows about this index and so we must be able to find it.*/
- ut_a(index);
+ /* There exists possibility of not being able to find requested
+ index due to inconsistency between MySQL and InoDB dictionary info.
+ Necessary message should have been printed in innobase_get_index() */
+ if (UNIV_UNLIKELY(!index)) {
+ n_rows = HA_POS_ERROR;
+ goto func_exit;
+ }
heap = mem_heap_create(2 * (key->key_parts * sizeof(dfield_t)
+ sizeof(dtuple_t)));
@@ -7289,6 +7642,7 @@ ha_innobase::records_in_range(
mem_heap_free(heap);
+func_exit:
my_free(key_val_buff2, MYF(0));
prebuilt->trx->op_info = (char*)"";
@@ -7440,6 +7794,7 @@ ha_innobase::info(
char path[FN_REFLEN];
os_file_stat_t stat_info;
+
DBUG_ENTER("info");
/* If we are forcing recovery at a high level, we will suppress
@@ -7602,13 +7957,29 @@ ha_innobase::info(
}
if (flag & HA_STATUS_CONST) {
- index = dict_table_get_first_index(ib_table);
+ /* Verify the number of index in InnoDB and MySQL
+ matches up. If prebuilt->clust_index_was_generated
+ holds, InnoDB defines GEN_CLUST_INDEX internally */
+ ulint num_innodb_index = UT_LIST_GET_LEN(ib_table->indexes)
+ - prebuilt->clust_index_was_generated;
- if (prebuilt->clust_index_was_generated) {
- index = dict_table_get_next_index(index);
+ if (table->s->keys != num_innodb_index) {
+ sql_print_error("Table %s contains %lu "
+ "indexes inside InnoDB, which "
+ "is different from the number of "
+ "indexes %u defined in the MySQL ",
+ ib_table->name, num_innodb_index,
+ table->s->keys);
}
for (i = 0; i < table->s->keys; i++) {
+ /* We could get index quickly through internal
+ index mapping with the index translation table.
+ The identity of index (match up index name with
+ that of table->key_info[i]) is already verified in
+ innobase_get_index(). */
+ index = innobase_get_index(i);
+
if (index == NULL) {
sql_print_error("Table %s contains fewer "
"indexes inside InnoDB than "
@@ -7637,6 +8008,8 @@ ha_innobase::info(
break;
}
+ dict_index_stat_mutex_enter(index);
+
if (index->stat_n_diff_key_vals[j + 1] == 0) {
rec_per_key = stats.records;
@@ -7645,6 +8018,8 @@ ha_innobase::info(
index->stat_n_diff_key_vals[j + 1]);
}
+ dict_index_stat_mutex_exit(index);
+
/* Since MySQL seems to favor table scans
too much over index searches, we pretend
index selectivity is 2 times better than
@@ -7660,8 +8035,6 @@ ha_innobase::info(
rec_per_key >= ~(ulong) 0 ? ~(ulong) 0 :
(ulong) rec_per_key;
}
-
- index = dict_table_get_next_index(index);
}
}
@@ -7705,15 +8078,9 @@ ha_innobase::analyze(
return(HA_ADMIN_CORRUPT);
}
- /* Serialize ANALYZE TABLE inside InnoDB, see
- Bug#38996 Race condition in ANALYZE TABLE */
- pthread_mutex_lock(&analyze_mutex);
-
/* Simply call ::info() with all the flags */
info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
- pthread_mutex_unlock(&analyze_mutex);
-
if (share->ib_table->is_corrupt) {
return(HA_ADMIN_CORRUPT);
}
@@ -7747,8 +8114,13 @@ ha_innobase::check(
HA_CHECK_OPT* check_opt) /*!< in: check options, currently
ignored */
{
- ulint ret;
+ dict_index_t* index;
+ ulint n_rows;
+ ulint n_rows_in_table = ULINT_UNDEFINED;
+ ibool is_ok = TRUE;
+ ulint old_isolation_level;
+ DBUG_ENTER("ha_innobase::check");
DBUG_ASSERT(thd == ha_thd());
ut_a(prebuilt->trx);
ut_a(prebuilt->trx->magic_n == TRX_MAGIC_N);
@@ -7761,21 +8133,144 @@ ha_innobase::check(
build_template(prebuilt, NULL, table, ROW_MYSQL_WHOLE_ROW);
}
- ret = row_check_table_for_mysql(prebuilt);
+ if (prebuilt->table->ibd_file_missing) {
+ sql_print_error("InnoDB: Error:\n"
+ "InnoDB: MySQL is trying to use a table handle"
+ " but the .ibd file for\n"
+ "InnoDB: table %s does not exist.\n"
+ "InnoDB: Have you deleted the .ibd file"
+ " from the database directory under\n"
+ "InnoDB: the MySQL datadir, or have you"
+ " used DISCARD TABLESPACE?\n"
+ "InnoDB: Please refer to\n"
+ "InnoDB: " REFMAN "innodb-troubleshooting.html\n"
+ "InnoDB: how you can resolve the problem.\n",
+ prebuilt->table->name);
+ DBUG_RETURN(HA_ADMIN_CORRUPT);
+ }
+
+ prebuilt->trx->op_info = "checking table";
- if (ret != DB_INTERRUPTED && share->ib_table->is_corrupt) {
- return(HA_ADMIN_CORRUPT);
+ old_isolation_level = prebuilt->trx->isolation_level;
+
+ /* We must run the index record counts at an isolation level
+ >= READ COMMITTED, because a dirty read can see a wrong number
+ of records in some index; to play safe, we use always
+ REPEATABLE READ here */
+
+ prebuilt->trx->isolation_level = TRX_ISO_REPEATABLE_READ;
+
+ /* Enlarge the fatal lock wait timeout during CHECK TABLE. */
+ mutex_enter(&kernel_mutex);
+ srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
+ mutex_exit(&kernel_mutex);
+
+ for (index = dict_table_get_first_index(prebuilt->table);
+ index != NULL;
+ index = dict_table_get_next_index(index)) {
+#if 0
+ fputs("Validating index ", stderr);
+ ut_print_name(stderr, trx, FALSE, index->name);
+ putc('\n', stderr);
+#endif
+
+ if (!btr_validate_index(index, prebuilt->trx)) {
+ is_ok = FALSE;
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_NOT_KEYFILE,
+ "InnoDB: The B-tree of"
+ " index '%-.200s' is corrupted.",
+ index->name);
+ continue;
+ }
+
+ /* Instead of invoking change_active_index(), set up
+ a dummy template for non-locking reads, disabling
+ access to the clustered index. */
+ prebuilt->index = index;
+
+ prebuilt->index_usable = row_merge_is_index_usable(
+ prebuilt->trx, prebuilt->index);
+
+ if (UNIV_UNLIKELY(!prebuilt->index_usable)) {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ HA_ERR_TABLE_DEF_CHANGED,
+ "InnoDB: Insufficient history for"
+ " index '%-.200s'",
+ index->name);
+ continue;
+ }
+
+ prebuilt->sql_stat_start = TRUE;
+ prebuilt->template_type = ROW_MYSQL_DUMMY_TEMPLATE;
+ prebuilt->n_template = 0;
+ prebuilt->need_to_access_clustered = FALSE;
+
+ dtuple_set_n_fields(prebuilt->search_tuple, 0);
+
+ prebuilt->select_lock_type = LOCK_NONE;
+
+ if (!row_check_index_for_mysql(prebuilt, index, &n_rows)) {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_NOT_KEYFILE,
+ "InnoDB: The B-tree of"
+ " index '%-.200s' is corrupted.",
+ index->name);
+ is_ok = FALSE;
+ }
+
+ if (thd_killed(user_thd)) {
+ break;
+ }
+
+#if 0
+ fprintf(stderr, "%lu entries in index %s\n", n_rows,
+ index->name);
+#endif
+
+ if (index == dict_table_get_first_index(prebuilt->table)) {
+ n_rows_in_table = n_rows;
+ } else if (n_rows != n_rows_in_table) {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_NOT_KEYFILE,
+ "InnoDB: Index '%-.200s'"
+ " contains %lu entries,"
+ " should be %lu.",
+ index->name,
+ (ulong) n_rows,
+ (ulong) n_rows_in_table);
+ is_ok = FALSE;
+ }
}
- switch (ret) {
- case DB_SUCCESS:
- return(HA_ADMIN_OK);
- case DB_INTERRUPTED:
+ /* Restore the original isolation level */
+ prebuilt->trx->isolation_level = old_isolation_level;
+
+ /* We validate also the whole adaptive hash index for all tables
+ at every CHECK TABLE */
+
+ if (!btr_search_validate()) {
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_NOT_KEYFILE,
+ "InnoDB: The adaptive hash index is corrupted.");
+ is_ok = FALSE;
+ }
+
+ /* Restore the fatal lock wait timeout after CHECK TABLE. */
+ mutex_enter(&kernel_mutex);
+ srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
+ mutex_exit(&kernel_mutex);
+
+ prebuilt->trx->op_info = "";
+ if (thd_killed(user_thd)) {
my_error(ER_QUERY_INTERRUPTED, MYF(0));
- return(-1);
- default:
+ }
+
+ if (share->ib_table->is_corrupt) {
return(HA_ADMIN_CORRUPT);
}
+
+ DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
}
/*************************************************************//**
@@ -8439,7 +8934,9 @@ ha_innobase::external_lock(
if (trx->n_mysql_tables_in_use == 0) {
#ifdef EXTENDED_SLOWLOG
- increment_thd_innodb_stats(thd, trx->io_reads,
+ increment_thd_innodb_stats(thd,
+ (unsigned long long) ut_conv_dulint_to_longlong(trx->id),
+ trx->io_reads,
trx->io_read,
trx->io_reads_wait_timer,
trx->lock_que_wait_timer,
@@ -8619,8 +9116,8 @@ innodb_show_status(
mutex_enter(&srv_monitor_file_mutex);
rewind(srv_monitor_file);
- srv_printf_innodb_monitor(srv_monitor_file,
- &trx_list_start, &trx_list_end);
+ srv_printf_innodb_monitor(srv_monitor_file, FALSE,
+ &trx_list_start, &trx_list_end);
flen = ftell(srv_monitor_file);
os_file_set_eof(srv_monitor_file);
@@ -8677,19 +9174,25 @@ innodb_show_status(
}
/************************************************************************//**
-Implements the SHOW MUTEX STATUS command. . */
+Implements the SHOW MUTEX STATUS command.
+@return TRUE on failure, FALSE on success. */
static
bool
innodb_mutex_show_status(
/*=====================*/
- handlerton* hton, /*!< in: the innodb handlerton */
+ handlerton* hton, /*!< in: the innodb handlerton */
THD* thd, /*!< in: the MySQL query thread of the
caller */
- stat_print_fn* stat_print)
+ stat_print_fn* stat_print) /*!< in: function for printing
+ statistics */
{
char buf1[IO_SIZE], buf2[IO_SIZE];
mutex_t* mutex;
rw_lock_t* lock;
+ ulint block_mutex_oswait_count = 0;
+ ulint block_lock_oswait_count = 0;
+ mutex_t* block_mutex = NULL;
+ rw_lock_t* block_lock = NULL;
#ifdef UNIV_DEBUG
ulint rw_lock_count= 0;
ulint rw_lock_count_spin_loop= 0;
@@ -8704,12 +9207,16 @@ innodb_mutex_show_status(
mutex_enter(&mutex_list_mutex);
- mutex = UT_LIST_GET_FIRST(mutex_list);
+ for (mutex = UT_LIST_GET_FIRST(mutex_list); mutex != NULL;
+ mutex = UT_LIST_GET_NEXT(list, mutex)) {
+ if (mutex->count_os_wait == 0) {
+ continue;
+ }
- while (mutex != NULL) {
- if (mutex->count_os_wait == 0
- || buf_pool_is_block_mutex(mutex)) {
- goto next_mutex;
+ if (buf_pool_is_block_mutex(mutex)) {
+ block_mutex = mutex;
+ block_mutex_oswait_count += mutex->count_os_wait;
+ continue;
}
#ifdef UNIV_DEBUG
if (mutex->mutex_type != 1) {
@@ -8736,8 +9243,7 @@ innodb_mutex_show_status(
DBUG_RETURN(1);
}
}
- }
- else {
+ } else {
rw_lock_count += mutex->count_using;
rw_lock_count_spin_loop += mutex->count_spin_loop;
rw_lock_count_spin_rounds += mutex->count_spin_rounds;
@@ -8749,7 +9255,7 @@ innodb_mutex_show_status(
buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s",
mutex->cmutex_name);
buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu",
- mutex->count_os_wait);
+ (ulong) mutex->count_os_wait);
if (stat_print(thd, innobase_hton_name,
hton_name_len, buf1, buf1len,
@@ -8758,45 +9264,81 @@ innodb_mutex_show_status(
DBUG_RETURN(1);
}
#endif /* UNIV_DEBUG */
+ }
-next_mutex:
- mutex = UT_LIST_GET_NEXT(list, mutex);
+ if (block_mutex) {
+ buf1len = (uint) my_snprintf(buf1, sizeof buf1,
+ "combined %s",
+ block_mutex->cmutex_name);
+ buf2len = (uint) my_snprintf(buf2, sizeof buf2,
+ "os_waits=%lu",
+ (ulong) block_mutex_oswait_count);
+
+ if (stat_print(thd, innobase_hton_name,
+ hton_name_len, buf1, buf1len,
+ buf2, buf2len)) {
+ mutex_exit(&mutex_list_mutex);
+ DBUG_RETURN(1);
+ }
}
mutex_exit(&mutex_list_mutex);
mutex_enter(&rw_lock_list_mutex);
- lock = UT_LIST_GET_FIRST(rw_lock_list);
-
- while (lock != NULL) {
- if (lock->count_os_wait
- && !buf_pool_is_block_lock(lock)) {
- buf1len= my_snprintf(buf1, sizeof(buf1), "%s",
- lock->lock_name);
- buf2len= my_snprintf(buf2, sizeof(buf2),
- "os_waits=%lu", lock->count_os_wait);
-
- if (stat_print(thd, innobase_hton_name,
- hton_name_len, buf1, buf1len,
- buf2, buf2len)) {
- mutex_exit(&rw_lock_list_mutex);
- DBUG_RETURN(1);
- }
+ for (lock = UT_LIST_GET_FIRST(rw_lock_list); lock != NULL;
+ lock = UT_LIST_GET_NEXT(list, lock)) {
+ if (lock->count_os_wait == 0) {
+ continue;
+ }
+
+ if (buf_pool_is_block_lock(lock)) {
+ block_lock = lock;
+ block_lock_oswait_count += lock->count_os_wait;
+ continue;
+ }
+
+ buf1len = my_snprintf(buf1, sizeof buf1, "%s",
+ lock->lock_name);
+ buf2len = my_snprintf(buf2, sizeof buf2, "os_waits=%lu",
+ (ulong) lock->count_os_wait);
+
+ if (stat_print(thd, innobase_hton_name,
+ hton_name_len, buf1, buf1len,
+ buf2, buf2len)) {
+ mutex_exit(&rw_lock_list_mutex);
+ DBUG_RETURN(1);
+ }
+ }
+
+ if (block_lock) {
+ buf1len = (uint) my_snprintf(buf1, sizeof buf1,
+ "combined %s",
+ block_lock->lock_name);
+ buf2len = (uint) my_snprintf(buf2, sizeof buf2,
+ "os_waits=%lu",
+ (ulong) block_lock_oswait_count);
+
+ if (stat_print(thd, innobase_hton_name,
+ hton_name_len, buf1, buf1len,
+ buf2, buf2len)) {
+ mutex_exit(&rw_lock_list_mutex);
+ DBUG_RETURN(1);
}
- lock = UT_LIST_GET_NEXT(list, lock);
}
mutex_exit(&rw_lock_list_mutex);
#ifdef UNIV_DEBUG
- buf2len= my_snprintf(buf2, sizeof(buf2),
- "count=%lu, spin_waits=%lu, spin_rounds=%lu, "
- "os_waits=%lu, os_yields=%lu, os_wait_times=%lu",
- rw_lock_count, rw_lock_count_spin_loop,
- rw_lock_count_spin_rounds,
- rw_lock_count_os_wait, rw_lock_count_os_yield,
- (ulong) (rw_lock_wait_time/1000));
+ buf2len = my_snprintf(buf2, sizeof buf2,
+ "count=%lu, spin_waits=%lu, spin_rounds=%lu, "
+ "os_waits=%lu, os_yields=%lu, os_wait_times=%lu",
+ (ulong) rw_lock_count,
+ (ulong) rw_lock_count_spin_loop,
+ (ulong) rw_lock_count_spin_rounds,
+ (ulong) rw_lock_count_os_wait,
+ (ulong) rw_lock_count_os_yield,
+ (ulong) (rw_lock_wait_time / 1000));
if (stat_print(thd, innobase_hton_name, hton_name_len,
STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len)) {
@@ -8858,6 +9400,11 @@ static INNOBASE_SHARE* get_share(const char* table_name)
innobase_open_tables, fold, share);
thr_lock_init(&share->lock);
+
+ /* Index translation table initialization */
+ share->idx_trans_tbl.index_mapping = NULL;
+ share->idx_trans_tbl.index_count = 0;
+ share->idx_trans_tbl.array_size = 0;
}
share->use_count++;
@@ -8888,6 +9435,11 @@ static void free_share(INNOBASE_SHARE* share)
HASH_DELETE(INNOBASE_SHARE, table_name_hash,
innobase_open_tables, fold, share);
thr_lock_delete(&share->lock);
+
+ /* Free any memory from index translation table */
+ my_free(share->idx_trans_tbl.index_mapping,
+ MYF(MY_ALLOW_ZERO_PTR));
+
my_free(share, MYF(0));
/* TODO: invoke HASH_MIGRATE if innobase_open_tables
@@ -8990,7 +9542,7 @@ ha_innobase::store_lock(
isolation_level = trx->isolation_level;
if ((srv_locks_unsafe_for_binlog
- || isolation_level == TRX_ISO_READ_COMMITTED)
+ || isolation_level <= TRX_ISO_READ_COMMITTED)
&& isolation_level != TRX_ISO_SERIALIZABLE
&& (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT)
&& (sql_command == SQLCOM_INSERT_SELECT
@@ -9122,7 +9674,10 @@ ha_innobase::innobase_get_autoinc(
*value = dict_table_autoinc_read(prebuilt->table);
/* It should have been initialized during open. */
- ut_a(*value != 0);
+ if (*value == 0) {
+ prebuilt->autoinc_error = DB_UNSUPPORTED;
+ dict_table_autoinc_unlock(prebuilt->table);
+ }
}
return(prebuilt->autoinc_error);
@@ -9738,33 +10293,60 @@ innobase_set_cursor_view(
(cursor_view_t*) curview);
}
+/*******************************************************************//**
+If col_name is not NULL, check whether the named column is being
+renamed in the table. If col_name is not provided, check
+whether any one of columns in the table is being renamed.
+@return true if the column is being renamed */
+static
+bool
+check_column_being_renamed(
+/*=======================*/
+ const TABLE* table, /*!< in: MySQL table */
+ const char* col_name) /*!< in: name of the column */
+{
+ uint k;
+ Field* field;
+
+ for (k = 0; k < table->s->fields; k++) {
+ field = table->field[k];
-/***********************************************************************
-Check whether any of the given columns is being renamed in the table. */
+ if (field->flags & FIELD_IS_RENAMED) {
+
+ /* If col_name is not provided, return
+ if the field is marked as being renamed. */
+ if (!col_name) {
+ return(true);
+ }
+
+ /* If col_name is provided, return only
+ if names match */
+ if (innobase_strcasecmp(field->field_name,
+ col_name) == 0) {
+ return(true);
+ }
+ }
+ }
+
+ return(false);
+}
+
+/*******************************************************************//**
+Check whether any of the given columns is being renamed in the table.
+@return true if any of col_names is being renamed in table */
static
bool
column_is_being_renamed(
/*====================*/
- /* out: true if any of col_names is
- being renamed in table */
- TABLE* table, /* in: MySQL table */
- uint n_cols, /* in: number of columns */
- const char** col_names) /* in: names of the columns */
+ TABLE* table, /*!< in: MySQL table */
+ uint n_cols, /*!< in: number of columns */
+ const char** col_names) /*!< in: names of the columns */
{
uint j;
- uint k;
- Field* field;
- const char* col_name;
for (j = 0; j < n_cols; j++) {
- col_name = col_names[j];
- for (k = 0; k < table->s->fields; k++) {
- field = table->field[k];
- if ((field->flags & FIELD_IS_RENAMED)
- && innobase_strcasecmp(field->field_name,
- col_name) == 0) {
- return(true);
- }
+ if (check_column_being_renamed(table, col_names[j])) {
+ return(true);
}
}
@@ -9855,18 +10437,13 @@ ha_innobase::check_if_incompatible_data(
DBUG_RETURN(COMPATIBLE_DATA_NO);
}
- /* Renaming column asynchronizes dictionary between mysqld and InnoDB...
- If not synchronized, treat as COMPATIBLE_DATA_NO
- until the bug http://bugs.mysql.com/47621 is fixed officialily */
- {
- uint i;
- for (i = 0; i < table->s->fields; i++) {
- if (table->field[i]->flags & FIELD_IN_ADD_INDEX
- && innobase_strcasecmp(table->field[i]->field_name,
- dict_table_get_col_name(prebuilt->table, i))) {
- DBUG_RETURN(COMPATIBLE_DATA_NO);
- }
- }
+ /* For column rename operation, MySQL does not supply enough
+ information (new column name etc.) for InnoDB to make appropriate
+ system metadata change. To avoid system metadata inconsistency,
+ currently we can just request a table rebuild/copy by returning
+ COMPATIBLE_DATA_NO */
+ if (check_column_being_renamed(table, NULL)) {
+ DBUG_RETURN(COMPATIBLE_DATA_NO);
}
/* Check if a column participating in a foreign key is being renamed.
@@ -10396,8 +10973,8 @@ static MYSQL_SYSVAR_BOOL(extra_undoslots, innobase_extra_undoslots,
static MYSQL_SYSVAR_BOOL(fast_recovery, innobase_fast_recovery,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
- "Enable to use speed hack of recovery avoiding flush list sorting.",
- NULL, NULL, TRUE);
+ "obsolete option. affects nothing.",
+ NULL, NULL, FALSE);
static MYSQL_SYSVAR_BOOL(recovery_stats, innobase_recovery_stats,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
@@ -10690,6 +11267,11 @@ static MYSQL_SYSVAR_STR(data_file_path, innobase_data_file_path,
"Path to individual files and their sizes.",
NULL, NULL, NULL);
+static MYSQL_SYSVAR_STR(doublewrite_file, innobase_doublewrite_file,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Path to special datafile for doublewrite buffer. (default is "": not used) ### ONLY FOR EXPERTS!!! ###",
+ NULL, NULL, NULL);
+
static MYSQL_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"The AUTOINC lock modes supported by InnoDB: "
@@ -10714,13 +11296,13 @@ static MYSQL_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc,
static MYSQL_SYSVAR_STR(change_buffering, innobase_change_buffering,
PLUGIN_VAR_RQCMDARG,
"Buffer changes to reduce random access: "
- "OFF, ON, inserting, deleting, changing, or purging.",
+ "OFF, ON, none, inserts.",
innodb_change_buffering_validate,
innodb_change_buffering_update, NULL);
static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
PLUGIN_VAR_RQCMDARG,
- "Number of pages that must be accessed sequentially for InnoDB to"
+ "Number of pages that must be accessed sequentially for InnoDB to "
"trigger a readahead.",
NULL, NULL, 56, 0, 64, 0);
@@ -10833,11 +11415,6 @@ static MYSQL_SYSVAR_ULONG(dict_size_limit, srv_dict_size_limit,
"Limit the allocated memory for dictionary cache. (0: unlimited)",
NULL, NULL, 0, 0, LONG_MAX, 0);
-static MYSQL_SYSVAR_ULINT(relax_table_creation, srv_relax_table_creation,
- PLUGIN_VAR_RQCMDARG,
- "Relax limitation of column size at table creation as builtin InnoDB.",
- NULL, NULL, 0, 0, 1, 0);
-
static MYSQL_SYSVAR_ULINT(pass_corrupt_table, srv_pass_corrupt_table,
PLUGIN_VAR_RQCMDARG,
"Pass corruptions of user tables as 'corrupt table' instead of not crashing itself, "
@@ -10856,6 +11433,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(commit_concurrency),
MYSQL_SYSVAR(concurrency_tickets),
MYSQL_SYSVAR(data_file_path),
+ MYSQL_SYSVAR(doublewrite_file),
MYSQL_SYSVAR(data_home_dir),
MYSQL_SYSVAR(doublewrite),
MYSQL_SYSVAR(extra_undoslots),
@@ -10926,7 +11504,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(read_ahead_threshold),
MYSQL_SYSVAR(io_capacity),
MYSQL_SYSVAR(use_purge_thread),
- MYSQL_SYSVAR(relax_table_creation),
MYSQL_SYSVAR(pass_corrupt_table),
NULL
};
@@ -10936,8 +11513,8 @@ mysql_declare_plugin(xtradb)
MYSQL_STORAGE_ENGINE_PLUGIN,
&innobase_storage_engine,
innobase_hton_name,
- "Innobase Oy",
- "Supports transactions, row-level locking, and foreign keys",
+ "Percona",
+ "XtraDB engine based on InnoDB plugin. Supports transactions, row-level locking, and foreign keys",
PLUGIN_LICENSE_GPL,
innobase_init, /* Plugin Init */
NULL, /* Plugin Deinit */
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index ff93b68793c..5f5f6de98ba 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2009, MySQL AB & Innobase Oy. All Rights Reserved.
+Copyright (c) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved.
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
@@ -27,16 +27,32 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#pragma interface /* gcc class implementation */
#endif
+/* Structure defines translation table between mysql index and innodb
+index structures */
+typedef struct innodb_idx_translate_struct {
+ ulint index_count; /*!< number of valid index entries
+ in the index_mapping array */
+ ulint array_size; /*!< array size of index_mapping */
+ dict_index_t** index_mapping; /*!< index pointer array directly
+ maps to index in Innodb from MySQL
+ array index */
+} innodb_idx_translate_t;
+
+
/** InnoDB table share */
typedef struct st_innobase_share {
- THR_LOCK lock; /*!< MySQL lock protecting
- this structure */
- const char* table_name; /*!< InnoDB table name */
- uint use_count; /*!< reference count,
- incremented in get_share()
- and decremented in free_share() */
- void* table_name_hash;/*!< hash table chain node */
- dict_table_t* ib_table;
+ THR_LOCK lock; /*!< MySQL lock protecting
+ this structure */
+ const char* table_name; /*!< InnoDB table name */
+ uint use_count; /*!< reference count,
+ incremented in get_share()
+ and decremented in
+ free_share() */
+ void* table_name_hash;/*!< hash table chain node */
+ innodb_idx_translate_t idx_trans_tbl; /*!< index translation
+ table between MySQL and
+ Innodb */
+ dict_table_t* ib_table;
} INNOBASE_SHARE;
@@ -92,9 +108,8 @@ class ha_innobase: public handler
ulint innobase_reset_autoinc(ulonglong auto_inc);
ulint innobase_get_autoinc(ulonglong* value);
ulint innobase_update_autoinc(ulonglong auto_inc);
- ulint innobase_initialize_autoinc();
+ void innobase_initialize_autoinc();
dict_index_t* innobase_get_index(uint keynr);
- ulonglong innobase_get_int_col_max_value(const Field* field);
/* Init values for the class: */
public:
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index e060d88b3b8..2eb9c9f474c 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2005, 2010, Innobase Oy. All Rights Reserved.
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
@@ -229,9 +229,11 @@ static
int
innobase_check_index_keys(
/*======================*/
- const KEY* key_info, /*!< in: Indexes to be created */
- ulint num_of_keys) /*!< in: Number of indexes to
- be created */
+ const KEY* key_info, /*!< in: Indexes to be
+ created */
+ ulint num_of_keys, /*!< in: Number of
+ indexes to be created */
+ const dict_table_t* table) /*!< in: Existing indexes */
{
ulint key_num;
@@ -248,9 +250,22 @@ innobase_check_index_keys(
const KEY& key2 = key_info[i];
if (0 == strcmp(key.name, key2.name)) {
- sql_print_error("InnoDB: key name `%s` appears"
- " twice in CREATE INDEX\n",
- key.name);
+ my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0),
+ key.name);
+
+ return(ER_WRONG_NAME_FOR_INDEX);
+ }
+ }
+
+ /* Check that the same index name does not already exist. */
+
+ for (const dict_index_t* index
+ = dict_table_get_first_index(table);
+ index; index = dict_table_get_next_index(index)) {
+
+ if (0 == strcmp(key.name, index->name)) {
+ my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0),
+ key.name);
return(ER_WRONG_NAME_FOR_INDEX);
}
@@ -258,7 +273,7 @@ innobase_check_index_keys(
/* Check that MySQL does not try to create a column
prefix index field on an inappropriate data type and
- that the same colum does not appear twice in the index. */
+ that the same column does not appear twice in the index. */
for (ulint i = 0; i < key.key_parts; i++) {
const KEY_PART_INFO& key_part1
@@ -289,14 +304,8 @@ innobase_check_index_keys(
}
}
- sql_print_error("InnoDB: MySQL is trying to"
- " create a column prefix"
- " index field on an"
- " inappropriate data type."
- " column `%s`,"
- " index `%s`.\n",
- field->field_name,
- key.name);
+ my_error(ER_WRONG_KEY_COLUMN, MYF(0),
+ field->field_name);
return(ER_WRONG_KEY_COLUMN);
}
@@ -309,11 +318,8 @@ innobase_check_index_keys(
continue;
}
- sql_print_error("InnoDB: column `%s`"
- " is not allowed to occur"
- " twice in index `%s`.\n",
- key_part1.field->field_name,
- key.name);
+ my_error(ER_WRONG_KEY_COLUMN, MYF(0),
+ key_part1.field->field_name);
return(ER_WRONG_KEY_COLUMN);
}
}
@@ -522,12 +528,14 @@ innobase_create_key_def(
key_info->name, "PRIMARY");
/* If there is a UNIQUE INDEX consisting entirely of NOT NULL
- columns, MySQL will treat it as a PRIMARY KEY unless the
- table already has one. */
+ columns and if the index does not contain column prefix(es)
+ (only prefix/part of the column is indexed), MySQL will treat the
+ index as a PRIMARY KEY unless the table already has one. */
if (!new_primary && (key_info->flags & HA_NOSAME)
+ && (!(key_info->flags & HA_KEY_HAS_PART_KEY_SEG))
&& row_table_got_default_clust_index(table)) {
- uint key_part = key_info->key_parts;
+ uint key_part = key_info->key_parts;
new_primary = TRUE;
@@ -656,12 +664,18 @@ ha_innobase::add_index(
innodb_table = indexed_table
= dict_table_get(prebuilt->table->name, FALSE);
+ if (UNIV_UNLIKELY(!innodb_table)) {
+ error = HA_ERR_NO_SUCH_TABLE;
+ goto err_exit;
+ }
+
/* Check if the index name is reserved. */
if (innobase_index_name_is_reserved(trx, key_info, num_of_keys)) {
error = ER_WRONG_NAME_FOR_INDEX;
} else {
/* Check that index keys are sensible */
- error = innobase_check_index_keys(key_info, num_of_keys);
+ error = innobase_check_index_keys(key_info, num_of_keys,
+ innodb_table);
}
if (UNIV_UNLIKELY(error)) {
@@ -708,6 +722,8 @@ err_exit:
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
+ ut_d(dict_table_check_for_dup_indexes(innodb_table, FALSE));
+
/* If a new primary key is defined for the table we need
to drop the original table and rebuild all indexes. */
@@ -740,6 +756,8 @@ err_exit:
user_thd);
}
+ ut_d(dict_table_check_for_dup_indexes(innodb_table,
+ FALSE));
row_mysql_unlock_data_dictionary(trx);
goto err_exit;
}
@@ -764,6 +782,10 @@ err_exit:
ut_ad(error == DB_SUCCESS);
+ /* We will need to rebuild index translation table. Set
+ valid index entry count in the translation table to zero */
+ share->idx_trans_tbl.index_count = 0;
+
/* Commit the data dictionary transaction in order to release
the table locks on the system tables. This means that if
MySQL crashes while creating a new primary key inside
@@ -799,18 +821,6 @@ err_exit:
index, num_of_idx, table);
error_handling:
-#ifdef UNIV_DEBUG
- /* TODO: At the moment we can't handle the following statement
- in our debugging code below:
-
- alter table t drop index b, add index (b);
-
- The fix will have to parse the SQL and note that the index
- being added has the same name as the one being dropped and
- ignore that in the dup index check.*/
- //dict_table_check_for_dup_indexes(prebuilt->table);
-#endif
-
/* After an error, remove all those index definitions from the
dictionary which were defined. */
@@ -822,6 +832,8 @@ error_handling:
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
+
if (!new_primary) {
error = row_merge_rename_indexes(trx, indexed_table);
@@ -909,6 +921,7 @@ convert_error:
}
if (dict_locked) {
+ ut_d(dict_table_check_for_dup_indexes(innodb_table, FALSE));
row_mysql_unlock_data_dictionary(trx);
}
@@ -951,6 +964,7 @@ ha_innobase::prepare_drop_index(
/* Test and mark all the indexes to be dropped */
row_mysql_lock_data_dictionary(trx);
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
/* Check that none of the indexes have previously been flagged
for deletion. */
@@ -1116,6 +1130,7 @@ func_exit:
} while (index);
}
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
row_mysql_unlock_data_dictionary(trx);
DBUG_RETURN(err);
@@ -1162,6 +1177,7 @@ ha_innobase::final_drop_index(
prebuilt->table->flags, user_thd);
row_mysql_lock_data_dictionary(trx);
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
if (UNIV_UNLIKELY(err)) {
@@ -1198,11 +1214,12 @@ ha_innobase::final_drop_index(
ut_a(!index->to_be_dropped);
}
-#ifdef UNIV_DEBUG
- dict_table_check_for_dup_indexes(prebuilt->table);
-#endif
+ /* We will need to rebuild index translation table. Set
+ valid index entry count in the translation table to zero */
+ share->idx_trans_tbl.index_count = 0;
func_exit:
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
trx_commit_for_mysql(trx);
trx_commit_for_mysql(prebuilt->trx);
row_mysql_unlock_data_dictionary(trx);
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index c0112cbf1e3..cc30bdee1dd 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -3538,6 +3538,9 @@ i_s_innodb_index_stats_fill(
i_s_table->field[3]->store(index->n_uniq);
row_per_keys[0] = '\0';
+
+ /* It is remained optimistic operation still for now */
+ //dict_index_stat_mutex_enter(index);
if (index->stat_n_diff_key_vals) {
for (i = 1; i <= index->n_uniq; i++) {
ib_int64_t rec_per_key;
@@ -3551,6 +3554,8 @@ i_s_innodb_index_stats_fill(
strncat(row_per_keys, buff, 256 - strlen(row_per_keys));
}
}
+ //dict_index_stat_mutex_exit(index);
+
field_store_string(i_s_table->field[4], row_per_keys);
i_s_table->field[5]->store(index->stat_index_size);
@@ -3857,6 +3862,14 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_admin_command_maria =
static ST_FIELD_INFO i_s_innodb_sys_tables_info[] =
{
+ {STRUCT_FLD(field_name, "SCHEMA"),
+ STRUCT_FLD(field_length, NAME_LEN),
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, 0),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
{STRUCT_FLD(field_name, "NAME"),
STRUCT_FLD(field_length, NAME_LEN),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
@@ -4015,6 +4028,54 @@ copy_string_field(
static
int
+copy_name_fields(
+/*=============*/
+ TABLE* table,
+ int table_field_1,
+ const rec_t* rec,
+ int rec_field)
+{
+ int status;
+ const byte* data;
+ ulint len;
+
+ data = rec_get_nth_field_old(rec, rec_field, &len);
+ if (len == UNIV_SQL_NULL) {
+ table->field[table_field_1]->set_null();
+ table->field[table_field_1 + 1]->set_null();
+ status = 0; /* success */
+ } else {
+ char buf[NAME_LEN * 2 + 2];
+ char* ptr;
+
+ if (len > NAME_LEN * 2 + 1) {
+ table->field[table_field_1]->set_null();
+ status = field_store_string(table->field[table_field_1 + 1],
+ "###TOO LONG NAME###");
+ goto end_func;
+ }
+
+ strncpy(buf, (char*)data, len);
+ buf[len] = '\0';
+ ptr = strchr(buf, '/');
+ if (ptr) {
+ *ptr = '\0';
+ ++ptr;
+
+ status = field_store_string(table->field[table_field_1], buf);
+ status |= field_store_string(table->field[table_field_1 + 1], ptr);
+ } else {
+ table->field[table_field_1]->set_null();
+ status = field_store_string(table->field[table_field_1 + 1], buf);
+ }
+ }
+
+end_func:
+ return status;
+}
+
+static
+int
copy_int_field(
/*===========*/
TABLE* table,
@@ -4083,49 +4144,49 @@ copy_sys_tables_rec(
/* NAME */
field = dict_index_get_nth_col_pos(index, 0);
- status = copy_string_field(table, 0, rec, field);
+ status = copy_name_fields(table, 0, rec, field);
if (status) {
return status;
}
/* ID */
field = dict_index_get_nth_col_pos(index, 1);
- status = copy_id_field(table, 1, rec, field);
+ status = copy_id_field(table, 2, rec, field);
if (status) {
return status;
}
/* N_COLS */
field = dict_index_get_nth_col_pos(index, 2);
- status = copy_int_field(table, 2, rec, field);
+ status = copy_int_field(table, 3, rec, field);
if (status) {
return status;
}
/* TYPE */
field = dict_index_get_nth_col_pos(index, 3);
- status = copy_int_field(table, 3, rec, field);
+ status = copy_int_field(table, 4, rec, field);
if (status) {
return status;
}
/* MIX_ID */
field = dict_index_get_nth_col_pos(index, 4);
- status = copy_id_field(table, 4, rec, field);
+ status = copy_id_field(table, 5, rec, field);
if (status) {
return status;
}
/* MIX_LEN */
field = dict_index_get_nth_col_pos(index, 5);
- status = copy_int_field(table, 5, rec, field);
+ status = copy_int_field(table, 6, rec, field);
if (status) {
return status;
}
/* CLUSTER_NAME */
field = dict_index_get_nth_col_pos(index, 6);
- status = copy_string_field(table, 6, rec, field);
+ status = copy_string_field(table, 7, rec, field);
if (status) {
return status;
}
/* SPACE */
field = dict_index_get_nth_col_pos(index, 7);
- status = copy_int_field(table, 7, rec, field);
+ status = copy_int_field(table, 8, rec, field);
if (status) {
return status;
}
diff --git a/storage/xtradb/handler/innodb_patch_info.h b/storage/xtradb/handler/innodb_patch_info.h
index 5fa50129a04..38b97411340 100644
--- a/storage/xtradb/handler/innodb_patch_info.h
+++ b/storage/xtradb/handler/innodb_patch_info.h
@@ -41,8 +41,8 @@ struct innodb_enhancement {
{"innodb_admin_command_base","XtraDB specific command interface through i_s","","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_show_lock_name","Show mutex/lock name instead of crated file/line","","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_extend_slow","Extended statistics in slow.log","It is InnoDB-part only. It needs to patch also to mysqld.","http://www.percona.com/docs/wiki/percona-xtradb"},
-{"innodb_relax_table_creation","Relax limitation of column size at table creation as builtin InnoDB.","","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_lru_dump_restore","Dump and restore command for content of buffer pool","","http://www.percona.com/docs/wiki/percona-xtradb"},
+{"innodb_separate_doublewrite","Add option 'innodb_doublewrite_file' to separate doublewrite dedicated tablespace","","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_pass_corrupt_table","Treat tables as corrupt instead of crash, when meet corrupt blocks","","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_fast_checksum","Using the checksum on 32bit-unit calculation","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_files_extend","allow >4GB transaction log files, and can vary universal page size of datafiles","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.c b/storage/xtradb/ibuf/ibuf0ibuf.c
index 94f3751dd04..e01c2d6b800 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.c
+++ b/storage/xtradb/ibuf/ibuf0ibuf.c
@@ -733,24 +733,41 @@ page containing the descriptor bits for the file page; the bitmap page
is x-latched */
static
page_t*
-ibuf_bitmap_get_map_page(
-/*=====================*/
- ulint space, /*!< in: space id of the file page */
- ulint page_no,/*!< in: page number of the file page */
- ulint zip_size,/*!< in: compressed page size in bytes;
- 0 for uncompressed pages */
- mtr_t* mtr) /*!< in: mtr */
+ibuf_bitmap_get_map_page_func(
+/*==========================*/
+ ulint space, /*!< in: space id of the file page */
+ ulint page_no,/*!< in: page number of the file page */
+ ulint zip_size,/*!< in: compressed page size in bytes;
+ 0 for uncompressed pages */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
+ mtr_t* mtr) /*!< in: mtr */
{
buf_block_t* block;
- block = buf_page_get(space, zip_size,
- ibuf_bitmap_page_no_calc(zip_size, page_no),
- RW_X_LATCH, mtr);
+ block = buf_page_get_gen(space, zip_size,
+ ibuf_bitmap_page_no_calc(zip_size, page_no),
+ RW_X_LATCH, NULL, BUF_GET,
+ file, line, mtr);
buf_block_dbg_add_level(block, SYNC_IBUF_BITMAP);
return(buf_block_get_frame(block));
}
+/********************************************************************//**
+Gets the ibuf bitmap page where the bits describing a given file page are
+stored.
+@return bitmap page where the file page is mapped, that is, the bitmap
+page containing the descriptor bits for the file page; the bitmap page
+is x-latched
+@param space in: space id of the file page
+@param page_no in: page number of the file page
+@param zip_size in: compressed page size in bytes; 0 for uncompressed pages
+@param mtr in: mini-transaction */
+#define ibuf_bitmap_get_map_page(space, page_no, zip_size, mtr) \
+ ibuf_bitmap_get_map_page_func(space, page_no, zip_size, \
+ __FILE__, __LINE__, mtr)
+
/************************************************************************//**
Sets the free bits of the page in the ibuf bitmap. This is done in a separate
mini-transaction, hence this operation does not restrict further work to only
diff --git a/storage/xtradb/include/btr0btr.h b/storage/xtradb/include/btr0btr.h
index d5c8258513c..5e6a76c7d21 100644
--- a/storage/xtradb/include/btr0btr.h
+++ b/storage/xtradb/include/btr0btr.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -193,6 +193,10 @@ btr_leaf_page_release(
mtr_t* mtr); /*!< in: mtr */
/**************************************************************//**
Gets the child node file address in a node pointer.
+NOTE: the offsets array must contain all offsets for the record since
+we read the last field according to offsets and assume that it contains
+the child page number. In other words offsets must have been retrieved
+with rec_get_offsets(n_fields=ULINT_UNDEFINED).
@return child node address */
UNIV_INLINE
ulint
@@ -317,12 +321,16 @@ Inserts a data tuple to a tree on a non-leaf level. It is assumed
that mtr holds an x-latch on the tree. */
UNIV_INTERN
void
-btr_insert_on_non_leaf_level(
-/*=========================*/
+btr_insert_on_non_leaf_level_func(
+/*==============================*/
dict_index_t* index, /*!< in: index */
ulint level, /*!< in: level, must be > 0 */
dtuple_t* tuple, /*!< in: the record to be inserted */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
+# define btr_insert_on_non_leaf_level(i,l,t,m) \
+ btr_insert_on_non_leaf_level_func(i,l,t,__FILE__,__LINE__,m)
#endif /* !UNIV_HOTBACKUP */
/****************************************************************//**
Sets a record as the predefined minimum record. */
diff --git a/storage/xtradb/include/btr0btr.ic b/storage/xtradb/include/btr0btr.ic
index 4aa4a41f50d..c9c38f3c3b3 100644
--- a/storage/xtradb/include/btr0btr.ic
+++ b/storage/xtradb/include/btr0btr.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -257,6 +257,10 @@ btr_page_set_prev(
/**************************************************************//**
Gets the child node file address in a node pointer.
+NOTE: the offsets array must contain all offsets for the record since
+we read the last field according to offsets and assume that it contains
+the child page number. In other words offsets must have been retrieved
+with rec_get_offsets(n_fields=ULINT_UNDEFINED).
@return child node address */
UNIV_INLINE
ulint
diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h
index 480a3877e54..716f15c4267 100644
--- a/storage/xtradb/include/btr0cur.h
+++ b/storage/xtradb/include/btr0cur.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -152,29 +152,39 @@ btr_cur_search_to_nth_level(
ulint has_search_latch,/*!< in: latch mode the caller
currently has on btr_search_latch:
RW_S_LATCH, or 0 */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
/*****************************************************************//**
Opens a cursor at either end of an index. */
UNIV_INTERN
void
-btr_cur_open_at_index_side(
-/*=======================*/
+btr_cur_open_at_index_side_func(
+/*============================*/
ibool from_left, /*!< in: TRUE if open to the low end,
FALSE if to the high end */
dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: latch mode */
btr_cur_t* cursor, /*!< in: cursor */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
+#define btr_cur_open_at_index_side(f,i,l,c,m) \
+ btr_cur_open_at_index_side_func(f,i,l,c,__FILE__,__LINE__,m)
/**********************************************************************//**
Positions a cursor at a randomly chosen position within a B-tree. */
UNIV_INTERN
void
-btr_cur_open_at_rnd_pos(
-/*====================*/
+btr_cur_open_at_rnd_pos_func(
+/*=========================*/
dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_cur_t* cursor, /*!< in/out: B-tree cursor */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
+#define btr_cur_open_at_rnd_pos(i,l,c,m) \
+ btr_cur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m)
/*************************************************************//**
Tries to perform an insert to a page in an index tree, next to cursor.
It is assumed that mtr holds an x-latch on the page. The operation does
diff --git a/storage/xtradb/include/btr0pcur.h b/storage/xtradb/include/btr0pcur.h
index 12b1375d8b7..2334a266280 100644
--- a/storage/xtradb/include/btr0pcur.h
+++ b/storage/xtradb/include/btr0pcur.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -82,8 +82,8 @@ Initializes and opens a persistent cursor to an index tree. It should be
closed with btr_pcur_close. */
UNIV_INLINE
void
-btr_pcur_open(
-/*==========*/
+btr_pcur_open_func(
+/*===============*/
dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ...;
@@ -94,14 +94,18 @@ btr_pcur_open(
record! */
ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
+#define btr_pcur_open(i,t,md,l,c,m) \
+ btr_pcur_open_func(i,t,md,l,c,__FILE__,__LINE__,m)
/**************************************************************//**
Opens an persistent cursor to an index tree without initializing the
cursor. */
UNIV_INLINE
void
-btr_pcur_open_with_no_init(
-/*=======================*/
+btr_pcur_open_with_no_init_func(
+/*============================*/
dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ...;
@@ -119,7 +123,12 @@ btr_pcur_open_with_no_init(
ulint has_search_latch,/*!< in: latch mode the caller
currently has on btr_search_latch:
RW_S_LATCH, or 0 */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
+#define btr_pcur_open_with_no_init(ix,t,md,l,cur,has,m) \
+ btr_pcur_open_with_no_init_func(ix,t,md,l,cur,has,__FILE__,__LINE__,m)
+
/*****************************************************************//**
Opens a persistent cursor at either end of an index. */
UNIV_INLINE
@@ -160,8 +169,8 @@ before first in tree. The latching mode must be BTR_SEARCH_LEAF or
BTR_MODIFY_LEAF. */
UNIV_INTERN
void
-btr_pcur_open_on_user_rec(
-/*======================*/
+btr_pcur_open_on_user_rec_func(
+/*===========================*/
dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ... */
@@ -169,17 +178,25 @@ btr_pcur_open_on_user_rec(
BTR_MODIFY_LEAF */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent
cursor */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
+#define btr_pcur_open_on_user_rec(i,t,md,l,c,m) \
+ btr_pcur_open_on_user_rec_func(i,t,md,l,c,__FILE__,__LINE__,m)
/**********************************************************************//**
Positions a cursor at a randomly chosen position within a B-tree. */
UNIV_INLINE
void
-btr_pcur_open_at_rnd_pos(
-/*=====================*/
+btr_pcur_open_at_rnd_pos_func(
+/*==========================*/
dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in/out: B-tree pcur */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
+#define btr_pcur_open_at_rnd_pos(i,l,c,m) \
+ btr_pcur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m)
/**************************************************************//**
Frees the possible old_rec_buf buffer of a persistent cursor and sets the
latch mode of the persistent cursor to BTR_NO_LATCHES. */
@@ -218,11 +235,15 @@ record and it can be restored on a user record whose ordering fields
are identical to the ones of the original user record */
UNIV_INTERN
ibool
-btr_pcur_restore_position(
-/*======================*/
+btr_pcur_restore_position_func(
+/*===========================*/
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: detached persistent cursor */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
+#define btr_pcur_restore_position(l,cur,mtr) \
+ btr_pcur_restore_position_func(l,cur,__FILE__,__LINE__,mtr)
/**************************************************************//**
If the latch mode of the cursor is BTR_LEAF_SEARCH or BTR_LEAF_MODIFY,
releases the page latch and bufferfix reserved by the cursor.
@@ -260,20 +281,13 @@ btr_pcur_get_mtr(
/*=============*/
btr_pcur_t* cursor); /*!< in: persistent cursor */
/**************************************************************//**
-Commits the pcur mtr and sets the pcur latch mode to BTR_NO_LATCHES,
+Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES,
that is, the cursor becomes detached. If there have been modifications
to the page where pcur is positioned, this can be used instead of
btr_pcur_release_leaf. Function btr_pcur_store_position should be used
before calling this, if restoration of cursor is wanted later. */
UNIV_INLINE
void
-btr_pcur_commit(
-/*============*/
- btr_pcur_t* pcur); /*!< in: persistent cursor */
-/**************************************************************//**
-Differs from btr_pcur_commit in that we can specify the mtr to commit. */
-UNIV_INLINE
-void
btr_pcur_commit_specify_mtr(
/*========================*/
btr_pcur_t* pcur, /*!< in: persistent cursor */
diff --git a/storage/xtradb/include/btr0pcur.ic b/storage/xtradb/include/btr0pcur.ic
index 0ca7223f861..0c38797e6c5 100644
--- a/storage/xtradb/include/btr0pcur.ic
+++ b/storage/xtradb/include/btr0pcur.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -395,30 +395,13 @@ btr_pcur_move_to_next(
}
/**************************************************************//**
-Commits the pcur mtr and sets the pcur latch mode to BTR_NO_LATCHES,
+Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES,
that is, the cursor becomes detached. If there have been modifications
to the page where pcur is positioned, this can be used instead of
btr_pcur_release_leaf. Function btr_pcur_store_position should be used
before calling this, if restoration of cursor is wanted later. */
UNIV_INLINE
void
-btr_pcur_commit(
-/*============*/
- btr_pcur_t* pcur) /*!< in: persistent cursor */
-{
- ut_a(pcur->pos_state == BTR_PCUR_IS_POSITIONED);
-
- pcur->latch_mode = BTR_NO_LATCHES;
-
- mtr_commit(pcur->mtr);
-
- pcur->pos_state = BTR_PCUR_WAS_POSITIONED;
-}
-
-/**************************************************************//**
-Differs from btr_pcur_commit in that we can specify the mtr to commit. */
-UNIV_INLINE
-void
btr_pcur_commit_specify_mtr(
/*========================*/
btr_pcur_t* pcur, /*!< in: persistent cursor */
@@ -483,8 +466,8 @@ Initializes and opens a persistent cursor to an index tree. It should be
closed with btr_pcur_close. */
UNIV_INLINE
void
-btr_pcur_open(
-/*==========*/
+btr_pcur_open_func(
+/*===============*/
dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ...;
@@ -495,6 +478,8 @@ btr_pcur_open(
record! */
ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
btr_cur_t* btr_cursor;
@@ -511,7 +496,7 @@ btr_pcur_open(
btr_cursor = btr_pcur_get_btr_cur(cursor);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
- btr_cursor, 0, mtr);
+ btr_cursor, 0, file, line, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->trx_if_known = NULL;
@@ -522,8 +507,8 @@ Opens an persistent cursor to an index tree without initializing the
cursor. */
UNIV_INLINE
void
-btr_pcur_open_with_no_init(
-/*=======================*/
+btr_pcur_open_with_no_init_func(
+/*============================*/
dict_index_t* index, /*!< in: index */
const dtuple_t* tuple, /*!< in: tuple on which search done */
ulint mode, /*!< in: PAGE_CUR_L, ...;
@@ -541,6 +526,8 @@ btr_pcur_open_with_no_init(
ulint has_search_latch,/*!< in: latch mode the caller
currently has on btr_search_latch:
RW_S_LATCH, or 0 */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
btr_cur_t* btr_cursor;
@@ -553,7 +540,8 @@ btr_pcur_open_with_no_init(
btr_cursor = btr_pcur_get_btr_cur(cursor);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
- btr_cursor, has_search_latch, mtr);
+ btr_cursor, has_search_latch,
+ file, line, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
@@ -600,11 +588,13 @@ btr_pcur_open_at_index_side(
Positions a cursor at a randomly chosen position within a B-tree. */
UNIV_INLINE
void
-btr_pcur_open_at_rnd_pos(
-/*=====================*/
+btr_pcur_open_at_rnd_pos_func(
+/*==========================*/
dict_index_t* index, /*!< in: index */
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in/out: B-tree pcur */
+ const char* file, /*!< in: file name */
+ ulint line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
/* Initialize the cursor */
@@ -614,8 +604,9 @@ btr_pcur_open_at_rnd_pos(
btr_pcur_init(cursor);
- btr_cur_open_at_rnd_pos(index, latch_mode,
- btr_pcur_get_btr_cur(cursor), mtr);
+ btr_cur_open_at_rnd_pos_func(index, latch_mode,
+ btr_pcur_get_btr_cur(cursor),
+ file, line, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index c95fcc00dd3..f93510be6d6 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
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
@@ -33,6 +33,7 @@ Created 11/5/1995 Heikki Tuuri
#include "hash0hash.h"
#include "ut0byte.h"
#include "page0types.h"
+#include "ut0rbt.h"
#ifndef UNIV_HOTBACKUP
#include "os0proc.h"
@@ -202,20 +203,14 @@ with care. */
#define buf_page_get_with_no_latch(SP, ZS, OF, MTR) buf_page_get_gen(\
SP, ZS, OF, RW_NO_LATCH, NULL,\
BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
-/**************************************************************//**
-NOTE! The following macros should be used instead of
-buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and
-RW_X_LATCH are allowed as LA! */
-#define buf_page_optimistic_get(LA, BL, MC, MTR) \
- buf_page_optimistic_get_func(LA, BL, MC, __FILE__, __LINE__, MTR)
/********************************************************************//**
This is the general function used to get optimistic access to a database
page.
@return TRUE if success */
UNIV_INTERN
ibool
-buf_page_optimistic_get_func(
-/*=========================*/
+buf_page_optimistic_get(
+/*====================*/
ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH */
buf_block_t* block, /*!< in: guessed block */
ib_uint64_t modify_clock,/*!< in: modify clock value if mode is
@@ -1205,15 +1200,21 @@ struct buf_block_struct{
rw_lock_t lock; /*!< read-write lock of the buffer
frame */
unsigned lock_hash_val:32;/*!< hashed value of the page address
- in the record lock hash table */
- unsigned check_index_page_at_flush:1;
+ in the record lock hash table;
+ protected by buf_block_t::lock
+ (or buf_block_t::mutex, buf_pool_mutex
+ in buf_page_get_gen(),
+ buf_page_init_for_read()
+ and buf_page_create()) */
+ ibool check_index_page_at_flush;
/*!< TRUE if we know that this is
an index page, and want the database
to check its consistency before flush;
note that there may be pages in the
buffer pool which are index pages,
but this flag is not set because
- we do not keep track of all pages */
+ we do not keep track of all pages;
+ NOT protected by any mutex */
/* @} */
/** @name Optimistic search field */
/* @{ */
@@ -1379,6 +1380,19 @@ struct buf_pool_struct{
/*!< this is in the set state
when there is no flush batch
of the given type running */
+ ib_rbt_t* flush_rbt; /* !< a red-black tree is used
+ exclusively during recovery to
+ speed up insertions in the
+ flush_list. This tree contains
+ blocks in order of
+ oldest_modification LSN and is
+ kept in sync with the
+ flush_list.
+ Each member of the tree MUST
+ also be on the flush_list.
+ This tree is relevant only in
+ recovery and is set to NULL
+ once the recovery is over. */
ulint freed_page_clock;/*!< a sequence number used
to count the number of buffer
blocks removed from the end of
diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic
index c9809fbdcd8..93cc68e7fc9 100644
--- a/storage/xtradb/include/buf0buf.ic
+++ b/storage/xtradb/include/buf0buf.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -81,7 +81,7 @@ buf_page_peek_if_too_old(
unsigned access_time = buf_page_is_accessed(bpage);
if (access_time > 0
- && (ut_time_ms() - access_time)
+ && ((ib_uint32_t) (ut_time_ms() - access_time))
>= buf_LRU_old_threshold_ms) {
return(TRUE);
}
@@ -743,6 +743,12 @@ buf_block_get_lock_hash_val(
/*========================*/
const buf_block_t* block) /*!< in: block */
{
+ ut_ad(block);
+ ut_ad(buf_page_in_file(&block->page));
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(rw_lock_own(&(((buf_block_t*) block)->lock), RW_LOCK_EXCLUSIVE)
+ || rw_lock_own(&(((buf_block_t*) block)->lock), RW_LOCK_SHARED));
+#endif /* UNIV_SYNC_DEBUG */
return(block->lock_hash_val);
}
@@ -967,7 +973,12 @@ buf_page_hash_get(
ut_a(buf_page_in_file(bpage));
ut_ad(bpage->in_page_hash);
ut_ad(!bpage->in_zip_hash);
+#if UNIV_WORD_SIZE == 4
+ /* On 32-bit systems, there is no padding in
+ buf_page_t. On other systems, Valgrind could complain
+ about uninitialized pad bytes. */
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
+#endif
}
return(bpage);
diff --git a/storage/xtradb/include/buf0flu.h b/storage/xtradb/include/buf0flu.h
index cac4bf9fe4b..2f7108fda1b 100644
--- a/storage/xtradb/include/buf0flu.h
+++ b/storage/xtradb/include/buf0flu.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
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
@@ -40,6 +40,16 @@ buf_flush_remove(
/*=============*/
buf_page_t* bpage); /*!< in: pointer to the block in question */
/********************************************************************//**
+Relocates a buffer control block on the flush_list.
+Note that it is assumed that the contents of bpage has already been
+copied to dpage. */
+UNIV_INTERN
+void
+buf_flush_relocate_on_flush_list(
+/*=============================*/
+ buf_page_t* bpage, /*!< in/out: control block being moved */
+ buf_page_t* dpage); /*!< in/out: destination block */
+/********************************************************************//**
Updates the flush system data structures when a write is completed. */
UNIV_INTERN
void
@@ -140,8 +150,8 @@ how much redo the workload is generating and at what rate. */
struct buf_flush_stat_struct
{
- ib_uint64_t redo; /**< amount of redo generated. */
- ulint n_flushed; /**< number of pages flushed. */
+ ib_uint64_t redo; /*!< amount of redo generated. */
+ ulint n_flushed; /*!< number of pages flushed. */
};
/** Statistics for selecting flush rate of dirty pages. */
@@ -176,6 +186,22 @@ buf_flush_validate(void);
/*====================*/
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
+/******************************************************************//**
+Initialize the red-black tree to speed up insertions into the flush_list
+during recovery process. Should be called at the start of recovery
+process before any page has been read/written. */
+UNIV_INTERN
+void
+buf_flush_init_flush_rbt(void);
+/*==========================*/
+
+/******************************************************************//**
+Frees up the red-black tree. */
+UNIV_INTERN
+void
+buf_flush_free_flush_rbt(void);
+/*==========================*/
+
/** When buf_flush_free_margin is called, it tries to make this many blocks
available to replacement in the free list and at the end of the LRU list (to
make sure that a read-ahead batch can be read efficiently in a single
diff --git a/storage/xtradb/include/data0type.ic b/storage/xtradb/include/data0type.ic
index 240b4288f39..2bf67a941bd 100644
--- a/storage/xtradb/include/data0type.ic
+++ b/storage/xtradb/include/data0type.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -285,6 +285,10 @@ dtype_new_store_for_order_and_null_size(
#endif
ulint len;
+ ut_ad(type);
+ ut_ad(type->mtype >= DATA_VARCHAR);
+ ut_ad(type->mtype <= DATA_MYSQL);
+
buf[0] = (byte)(type->mtype & 0xFFUL);
if (type->prtype & DATA_BINARY_TYPE) {
diff --git a/storage/xtradb/include/dict0boot.h b/storage/xtradb/include/dict0boot.h
index 51d37ee98d1..1a13bd1503a 100644
--- a/storage/xtradb/include/dict0boot.h
+++ b/storage/xtradb/include/dict0boot.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -137,6 +137,7 @@ clustered index */
#define DICT_SYS_INDEXES_PAGE_NO_FIELD 8
#define DICT_SYS_INDEXES_SPACE_NO_FIELD 7
#define DICT_SYS_INDEXES_TYPE_FIELD 6
+#define DICT_SYS_INDEXES_NAME_FIELD 4
/* When a row id which is zero modulo this number (which must be a power of
two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h
index 8272bfe2422..0879e91ab33 100644
--- a/storage/xtradb/include/dict0dict.h
+++ b/storage/xtradb/include/dict0dict.h
@@ -928,9 +928,10 @@ UNIV_INTERN
void
dict_table_check_for_dup_indexes(
/*=============================*/
- const dict_table_t* table); /*!< in: Check for dup indexes
+ const dict_table_t* table, /*!< in: Check for dup indexes
in this table */
-
+ ibool tmp_ok);/*!< in: TRUE=allow temporary
+ index names */
#endif /* UNIV_DEBUG */
/**********************************************************************//**
Builds a node pointer out of a physical record and a page number.
@@ -1060,6 +1061,22 @@ UNIV_INTERN
void
dict_mutex_exit_for_mysql(void);
/*===========================*/
+/**********************************************************************//**
+Lock the appropriate mutex to protect index->stat_n_diff_key_vals[].
+index->id is used to pick the right mutex and it should not change
+before dict_index_stat_mutex_exit() is called on this index. */
+UNIV_INTERN
+void
+dict_index_stat_mutex_enter(
+/*========================*/
+ const dict_index_t* index); /*!< in: index */
+/**********************************************************************//**
+Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */
+UNIV_INTERN
+void
+dict_index_stat_mutex_exit(
+/*=======================*/
+ const dict_index_t* index); /*!< in: index */
/********************************************************************//**
Checks if the database name in two table names is the same.
@return TRUE if same db name */
diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h
index 603ecfda3f9..ee3107a3be1 100644
--- a/storage/xtradb/include/dict0mem.h
+++ b/storage/xtradb/include/dict0mem.h
@@ -80,21 +80,39 @@ combination of types */
/** File format */
/* @{ */
#define DICT_TF_FORMAT_SHIFT 5 /* file format */
-#define DICT_TF_FORMAT_MASK (127 << DICT_TF_FORMAT_SHIFT)
+#define DICT_TF_FORMAT_MASK \
+((~(~0 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT)
#define DICT_TF_FORMAT_51 0 /*!< InnoDB/MySQL up to 5.1 */
#define DICT_TF_FORMAT_ZIP 1 /*!< InnoDB plugin for 5.1:
compressed tables,
new BLOB treatment */
/** Maximum supported file format */
#define DICT_TF_FORMAT_MAX DICT_TF_FORMAT_ZIP
-
+/* @} */
#define DICT_TF_BITS 6 /*!< number of flag bits */
#if (1 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT)) <= DICT_TF_FORMAT_MAX
# error "DICT_TF_BITS is insufficient for DICT_TF_FORMAT_MAX"
#endif
/* @} */
+
+/** @brief Additional table flags.
+
+These flags will be stored in SYS_TABLES.MIX_LEN. All unused flags
+will be written as 0. The column may contain garbage for tables
+created with old versions of InnoDB that only implemented
+ROW_FORMAT=REDUNDANT. */
+/* @{ */
+#define DICT_TF2_SHIFT DICT_TF_BITS
+ /*!< Shift value for
+ table->flags. */
+#define DICT_TF2_TEMPORARY 1 /*!< TRUE for tables from
+ CREATE TEMPORARY TABLE. */
+#define DICT_TF2_BITS (DICT_TF2_SHIFT + 1)
+ /*!< Total number of bits
+ in table->flags. */
/* @} */
+
/**********************************************************************//**
Creates a table memory object.
@return own: table object */
@@ -374,7 +392,7 @@ struct dict_table_struct{
unsigned space:32;
/*!< space where the clustered index of the
table is placed */
- unsigned flags:DICT_TF_BITS;/*!< DICT_TF_COMPACT, ... */
+ unsigned flags:DICT_TF2_BITS;/*!< DICT_TF_COMPACT, ... */
unsigned ibd_file_missing:1;
/*!< TRUE if this is in a single-table
tablespace and the .ibd file is missing; then
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index bacaafa1c72..163cacf2892 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
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
@@ -110,9 +110,10 @@ extern fil_addr_t fil_addr_null;
contents of this field is valid
for all uncompressed pages. */
#define FIL_PAGE_FILE_FLUSH_LSN 26 /*!< this is only defined for the
- first page in a data file: the file
- has been flushed to disk at least up
- to this lsn */
+ first page in a system tablespace
+ data file (ibdata*, not *.ibd):
+ the file has been flushed to disk
+ at least up to this lsn */
#define FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID 34 /*!< starting from 4.1.x this
contains the space id of the page */
#define FIL_PAGE_DATA 38 /*!< start of the data on the page */
diff --git a/storage/xtradb/include/hash0hash.h b/storage/xtradb/include/hash0hash.h
index 977cb829f35..b17c21a45ef 100644
--- a/storage/xtradb/include/hash0hash.h
+++ b/storage/xtradb/include/hash0hash.h
@@ -434,11 +434,12 @@ struct hash_table_struct {
these heaps */
#endif /* !UNIV_HOTBACKUP */
mem_heap_t* heap;
+#ifdef UNIV_DEBUG
ulint magic_n;
+# define HASH_TABLE_MAGIC_N 76561114
+#endif /* UNIV_DEBUG */
};
-#define HASH_TABLE_MAGIC_N 76561114
-
#ifndef UNIV_NONINL
#include "hash0hash.ic"
#endif
diff --git a/storage/xtradb/include/hash0hash.ic b/storage/xtradb/include/hash0hash.ic
index 19da2d50701..0b437894e2e 100644
--- a/storage/xtradb/include/hash0hash.ic
+++ b/storage/xtradb/include/hash0hash.ic
@@ -35,6 +35,8 @@ hash_get_nth_cell(
hash_table_t* table, /*!< in: hash table */
ulint n) /*!< in: cell index */
{
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ut_ad(n < table->n_cells);
return(table->array + n);
@@ -48,6 +50,8 @@ hash_table_clear(
/*=============*/
hash_table_t* table) /*!< in/out: hash table */
{
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
memset(table->array, 0x0,
table->n_cells * sizeof(*table->array));
}
@@ -61,6 +65,8 @@ hash_get_n_cells(
/*=============*/
hash_table_t* table) /*!< in: table */
{
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
return(table->n_cells);
}
@@ -74,6 +80,8 @@ hash_calc_hash(
ulint fold, /*!< in: folded value */
hash_table_t* table) /*!< in: hash table */
{
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
return(ut_hash_ulint(fold, table->n_cells));
}
@@ -88,6 +96,8 @@ hash_get_mutex_no(
hash_table_t* table, /*!< in: hash table */
ulint fold) /*!< in: fold */
{
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ut_ad(ut_is_2pow(table->n_mutexes));
return(ut_2pow_remainder(hash_calc_hash(fold, table),
table->n_mutexes));
@@ -103,6 +113,8 @@ hash_get_nth_heap(
hash_table_t* table, /*!< in: hash table */
ulint i) /*!< in: index of the heap */
{
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ut_ad(i < table->n_mutexes);
return(table->heaps[i]);
@@ -120,6 +132,9 @@ hash_get_heap(
{
ulint i;
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
+
if (table->heap) {
return(table->heap);
}
@@ -139,6 +154,8 @@ hash_get_nth_mutex(
hash_table_t* table, /*!< in: hash table */
ulint i) /*!< in: index of the mutex */
{
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ut_ad(i < table->n_mutexes);
return(table->mutexes + i);
@@ -156,6 +173,9 @@ hash_get_mutex(
{
ulint i;
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
+
i = hash_get_mutex_no(table, fold);
return(hash_get_nth_mutex(table, i));
diff --git a/storage/xtradb/include/lock0lock.h b/storage/xtradb/include/lock0lock.h
index 82e4c9bd976..89a6977b589 100644
--- a/storage/xtradb/include/lock0lock.h
+++ b/storage/xtradb/include/lock0lock.h
@@ -43,6 +43,7 @@ extern ibool lock_print_waits;
#endif /* UNIV_DEBUG */
/* Buffer for storing information about the most recent deadlock error */
extern FILE* lock_latest_err_file;
+extern ulint srv_n_lock_deadlock_count;
/*********************************************************************//**
Gets the size of a lock struct.
@@ -613,13 +614,16 @@ lock_rec_print(
FILE* file, /*!< in: file where to print */
const lock_t* lock); /*!< in: record type lock */
/*********************************************************************//**
-Prints info of locks for all transactions. */
+Prints info of locks for all transactions.
+@return FALSE if not able to obtain kernel mutex
+and exits without printing info */
UNIV_INTERN
-void
+ibool
lock_print_info_summary(
/*====================*/
- FILE* file); /*!< in: file where to print */
-/*********************************************************************//**
+ FILE* file, /*!< in: file where to print */
+ ibool nowait);/*!< in: whether to wait for the kernel mutex */
+/*************************************************************************
Prints info of locks for each transaction. */
UNIV_INTERN
void
diff --git a/storage/xtradb/include/log0log.h b/storage/xtradb/include/log0log.h
index 135aeb69e2d..8fce4ef96bc 100644
--- a/storage/xtradb/include/log0log.h
+++ b/storage/xtradb/include/log0log.h
@@ -1,23 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
-
-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
-
-*****************************************************************************/
-/*****************************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2009, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -825,7 +808,17 @@ struct log_struct{
written to some log group; for this to
be advanced, it is enough that the
write i/o has been completed for all
- log groups */
+ log groups.
+ Note that since InnoDB currently
+ has only one log group therefore
+ this value is redundant. Also it
+ is possible that this value
+ falls behind the
+ flushed_to_disk_lsn transiently.
+ It is appropriate to use either
+ flushed_to_disk_lsn or
+ write_lsn which are always
+ up-to-date and accurate. */
ib_uint64_t write_lsn; /*!< end lsn for the current running
write */
ulint write_end_offset;/*!< the data in buffer has
diff --git a/storage/xtradb/include/log0log.ic b/storage/xtradb/include/log0log.ic
index 36d151a3064..139f4041a36 100644
--- a/storage/xtradb/include/log0log.ic
+++ b/storage/xtradb/include/log0log.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
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
@@ -314,12 +314,15 @@ log_reserve_and_write_fast(
ulint data_len;
#ifdef UNIV_LOG_LSN_DEBUG
/* length of the LSN pseudo-record */
- ulint lsn_len = 1
- + mach_get_compressed_size(log_sys->lsn >> 32)
- + mach_get_compressed_size(log_sys->lsn & 0xFFFFFFFFUL);
+ ulint lsn_len;
#endif /* UNIV_LOG_LSN_DEBUG */
mutex_enter(&log_sys->mutex);
+#ifdef UNIV_LOG_LSN_DEBUG
+ lsn_len = 1
+ + mach_get_compressed_size(log_sys->lsn >> 32)
+ + mach_get_compressed_size(log_sys->lsn & 0xFFFFFFFFUL);
+#endif /* UNIV_LOG_LSN_DEBUG */
data_len = len
#ifdef UNIV_LOG_LSN_DEBUG
diff --git a/storage/xtradb/include/log0recv.h b/storage/xtradb/include/log0recv.h
index ac6b19a3f6a..15065267250 100644
--- a/storage/xtradb/include/log0recv.h
+++ b/storage/xtradb/include/log0recv.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved.
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
@@ -176,6 +176,12 @@ UNIV_INTERN
void
recv_recovery_from_checkpoint_finish(void);
/*======================================*/
+/********************************************************//**
+Initiates the rollback of active transactions. */
+UNIV_INTERN
+void
+recv_recovery_rollback_active(void);
+/*===============================*/
/*******************************************************//**
Scans log from a buffer and stores new log data to the parsing buffer.
Parses and hashes the log records if new data found. Unless
@@ -258,12 +264,14 @@ void
recv_sys_init(
/*==========*/
ulint available_memory); /*!< in: available memory in bytes */
+#ifndef UNIV_HOTBACKUP
/********************************************************//**
Reset the state of the recovery system variables. */
UNIV_INTERN
void
recv_sys_var_init(void);
/*===================*/
+#endif /* !UNIV_HOTBACKUP */
/*******************************************************************//**
Empties the hash table of stored log records, applying them to appropriate
pages. */
@@ -360,8 +368,8 @@ typedef struct recv_addr_struct recv_addr_t;
struct recv_addr_struct{
enum recv_addr_state state;
/*!< recovery state of the page */
- ulint space; /*!< space id */
- ulint page_no;/*!< page number */
+ unsigned space:32;/*!< space id */
+ unsigned page_no:32;/*!< page number */
UT_LIST_BASE_NODE_T(recv_t)
rec_list;/*!< list of log records for this page */
hash_node_t addr_hash;/*!< hash node in the hash bucket chain */
diff --git a/storage/xtradb/include/mem0dbg.h b/storage/xtradb/include/mem0dbg.h
index a064af5c678..d81e1418b2b 100644
--- a/storage/xtradb/include/mem0dbg.h
+++ b/storage/xtradb/include/mem0dbg.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -28,6 +28,13 @@ Created 6/9/1994 Heikki Tuuri
check fields whose sizes are given below */
#ifdef UNIV_MEM_DEBUG
+# ifndef UNIV_HOTBACKUP
+/* The mutex which protects in the debug version the hash table
+containing the list of live memory heaps, and also the global
+variables in mem0dbg.c. */
+extern mutex_t mem_hash_mutex;
+# endif /* !UNIV_HOTBACKUP */
+
#define MEM_FIELD_HEADER_SIZE ut_calc_align(2 * sizeof(ulint),\
UNIV_MEM_ALIGNMENT)
#define MEM_FIELD_TRAILER_SIZE sizeof(ulint)
diff --git a/storage/xtradb/include/mem0dbg.ic b/storage/xtradb/include/mem0dbg.ic
index cb9245411dc..b0c8178a623 100644
--- a/storage/xtradb/include/mem0dbg.ic
+++ b/storage/xtradb/include/mem0dbg.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -25,9 +25,6 @@ Created 6/8/1994 Heikki Tuuri
*************************************************************************/
#ifdef UNIV_MEM_DEBUG
-# ifndef UNIV_HOTBACKUP
-extern mutex_t mem_hash_mutex;
-# endif /* !UNIV_HOTBACKUP */
extern ulint mem_current_allocated_memory;
/******************************************************************//**
diff --git a/storage/xtradb/include/mem0mem.h b/storage/xtradb/include/mem0mem.h
index 98f8748e529..ee28cf7b225 100644
--- a/storage/xtradb/include/mem0mem.h
+++ b/storage/xtradb/include/mem0mem.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -359,6 +359,9 @@ struct mem_block_info_struct {
to the heap is also the first block in this list,
though it also contains the base node of the list. */
ulint len; /*!< physical length of this block in bytes */
+ ulint total_size; /* physical length in bytes of all blocks
+ in the heap. This is defined only in the base
+ node and is set to ULINT_UNDEFINED in others. */
ulint type; /*!< type of heap: MEM_HEAP_DYNAMIC, or
MEM_HEAP_BUF possibly ORed to MEM_HEAP_BTR_SEARCH */
ulint free; /*!< offset in bytes of the first free position for
diff --git a/storage/xtradb/include/mem0mem.ic b/storage/xtradb/include/mem0mem.ic
index e7080d8c508..cbce2edc661 100644
--- a/storage/xtradb/include/mem0mem.ic
+++ b/storage/xtradb/include/mem0mem.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -579,18 +579,12 @@ mem_heap_get_size(
/*==============*/
mem_heap_t* heap) /*!< in: heap */
{
- mem_block_t* block;
ulint size = 0;
ut_ad(mem_heap_check(heap));
- block = heap;
-
- while (block != NULL) {
+ size = heap->total_size;
- size += mem_block_get_len(block);
- block = UT_LIST_GET_NEXT(list, block);
- }
#ifndef UNIV_HOTBACKUP
if (heap->free_block) {
size += UNIV_PAGE_SIZE;
diff --git a/storage/xtradb/include/mtr0log.ic b/storage/xtradb/include/mtr0log.ic
index 5c24c38b337..db017c7d16e 100644
--- a/storage/xtradb/include/mtr0log.ic
+++ b/storage/xtradb/include/mtr0log.ic
@@ -27,8 +27,8 @@ Created 12/7/1995 Heikki Tuuri
#include "ut0lst.h"
#include "buf0buf.h"
#include "fsp0types.h"
+#include "srv0srv.h"
#include "trx0sys.h"
-
/********************************************************//**
Opens a buffer to mlog. It must be closed with mlog_close.
@return buffer, NULL if log mode MTR_LOG_NONE */
@@ -201,7 +201,8 @@ mlog_write_initial_log_record_fast(
the doublewrite buffer is located in pages
FSP_EXTENT_SIZE, ..., 3 * FSP_EXTENT_SIZE - 1 in the
system tablespace */
- if (space == TRX_SYS_SPACE
+ if ((space == TRX_SYS_SPACE
+ || (srv_doublewrite_file && space == TRX_DOUBLEWRITE_SPACE))
&& offset >= FSP_EXTENT_SIZE && offset < 3 * FSP_EXTENT_SIZE) {
if (trx_doublewrite_buf_is_being_created) {
/* Do nothing: we only come to this branch in an
diff --git a/storage/xtradb/include/mtr0mtr.ic b/storage/xtradb/include/mtr0mtr.ic
index 310c7c4117f..18f8e87b3cf 100644
--- a/storage/xtradb/include/mtr0mtr.ic
+++ b/storage/xtradb/include/mtr0mtr.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
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
@@ -70,6 +70,7 @@ mtr_memo_push(
ut_ad(type <= MTR_MEMO_X_LOCK);
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
+ ut_ad(mtr->state == MTR_ACTIVE);
memo = &(mtr->memo);
@@ -92,6 +93,7 @@ mtr_set_savepoint(
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
+ ut_ad(mtr->state == MTR_ACTIVE);
memo = &(mtr->memo);
@@ -149,6 +151,7 @@ mtr_memo_contains(
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
+ ut_ad(mtr->state == MTR_ACTIVE || mtr->state == MTR_COMMITTING);
memo = &(mtr->memo);
diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h
index 3eff5216867..eeab8a2b5d9 100644
--- a/storage/xtradb/include/os0file.h
+++ b/storage/xtradb/include/os0file.h
@@ -1,23 +1,6 @@
-/*****************************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
-
-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
-
-*****************************************************************************/
/***********************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted
diff --git a/storage/xtradb/include/que0que.h b/storage/xtradb/include/que0que.h
index 420f34550e2..39f8d07af89 100644
--- a/storage/xtradb/include/que0que.h
+++ b/storage/xtradb/include/que0que.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -30,6 +30,7 @@ Created 5/27/1996 Heikki Tuuri
#include "data0data.h"
#include "dict0types.h"
#include "trx0trx.h"
+#include "trx0roll.h"
#include "srv0srv.h"
#include "usr0types.h"
#include "que0types.h"
@@ -215,6 +216,16 @@ trx_t*
thr_get_trx(
/*========*/
que_thr_t* thr); /*!< in: query thread */
+/*******************************************************************//**
+Determines if this thread is rolling back an incomplete transaction
+in crash recovery.
+@return TRUE if thr is rolling back an incomplete transaction in crash
+recovery */
+UNIV_INLINE
+ibool
+thr_is_recv(
+/*========*/
+ const que_thr_t* thr); /*!< in: query thread */
/***********************************************************************//**
Gets the type of a graph node. */
UNIV_INLINE
diff --git a/storage/xtradb/include/que0que.ic b/storage/xtradb/include/que0que.ic
index a1c0dc1e77a..bd936670e1e 100644
--- a/storage/xtradb/include/que0que.ic
+++ b/storage/xtradb/include/que0que.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -38,6 +38,20 @@ thr_get_trx(
return(thr->graph->trx);
}
+/*******************************************************************//**
+Determines if this thread is rolling back an incomplete transaction
+in crash recovery.
+@return TRUE if thr is rolling back an incomplete transaction in crash
+recovery */
+UNIV_INLINE
+ibool
+thr_is_recv(
+/*========*/
+ const que_thr_t* thr) /*!< in: query thread */
+{
+ return(trx_is_recv(thr->graph->trx));
+}
+
/***********************************************************************//**
Gets the first thr in a fork. */
UNIV_INLINE
diff --git a/storage/xtradb/include/row0mysql.h b/storage/xtradb/include/row0mysql.h
index b05241f00f8..d2a8734c61f 100644
--- a/storage/xtradb/include/row0mysql.h
+++ b/storage/xtradb/include/row0mysql.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2000, 2010, Innobase Oy. All Rights Reserved.
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
@@ -451,6 +451,12 @@ row_drop_table_for_mysql(
const char* name, /*!< in: table name */
trx_t* trx, /*!< in: transaction handle */
ibool drop_db);/*!< in: TRUE=dropping whole database */
+/*********************************************************************//**
+Drop all temporary tables during crash recovery. */
+UNIV_INTERN
+void
+row_mysql_drop_temp_tables(void);
+/*============================*/
/*********************************************************************//**
Discards the tablespace of a table which stored in an .ibd file. Discarding
@@ -494,14 +500,19 @@ row_rename_table_for_mysql(
trx_t* trx, /*!< in: transaction handle */
ibool commit); /*!< in: if TRUE then commit trx */
/*********************************************************************//**
-Checks a table for corruption.
-@return DB_ERROR or DB_SUCCESS */
+Checks that the index contains entries in an ascending order, unique
+constraint is not broken, and calculates the number of index entries
+in the read view of the current transaction.
+@return DB_SUCCESS if ok */
UNIV_INTERN
ulint
-row_check_table_for_mysql(
+row_check_index_for_mysql(
/*======================*/
- row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL
- handle */
+ row_prebuilt_t* prebuilt, /*!< in: prebuilt struct
+ in MySQL handle */
+ const dict_index_t* index, /*!< in: index */
+ ulint* n_rows); /*!< out: number of entries
+ seen in the consistent read */
/*********************************************************************//**
Determines if a table is a magic monitor table.
diff --git a/storage/xtradb/include/row0sel.h b/storage/xtradb/include/row0sel.h
index 01a5afaa23e..8544b9d08ba 100644
--- a/storage/xtradb/include/row0sel.h
+++ b/storage/xtradb/include/row0sel.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved.
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
@@ -105,17 +105,6 @@ row_fetch_print(
/*============*/
void* row, /*!< in: sel_node_t* */
void* user_arg); /*!< in: not used */
-/****************************************************************//**
-Callback function for fetch that stores an unsigned 4 byte integer to the
-location pointed. The column's type must be DATA_INT, DATA_UNSIGNED, length
-= 4.
-@return always returns NULL */
-UNIV_INTERN
-void*
-row_fetch_store_uint4(
-/*==================*/
- void* row, /*!< in: sel_node_t* */
- void* user_arg); /*!< in: data pointer */
/***********************************************************//**
Prints a row in a select result.
@return query thread to run next or NULL */
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index 99ad3ad03d0..a463075f435 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -1,7 +1,8 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, 2009, Google Inc.
+Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are
incorporated with their permission, and subject to the conditions contained in
the file COPYING.Google.
+Portions of this file contain modifications contributed and copyrighted
+by Percona Inc.. Those modifications are
+gratefully acknowledged and are described briefly in the InnoDB
+documentation. The contributions by Percona Inc. are incorporated with
+their permission, and subject to the conditions contained in the file
+COPYING.Percona.
+
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.
@@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-/***********************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
-Copyright (c) 2009, Percona Inc.
-
-Portions of this file contain modifications contributed and copyrighted
-by Percona Inc.. Those modifications are
-gratefully acknowledged and are described briefly in the InnoDB
-documentation. The contributions by Percona Inc. are incorporated with
-their permission, and subject to the conditions contained in the file
-COPYING.Percona.
-
-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
-
-***********************************************************************/
/**************************************************//**
@file include/srv0srv.h
@@ -133,9 +115,10 @@ extern char** srv_data_file_names;
extern ulint* srv_data_file_sizes;
extern ulint* srv_data_file_is_raw_partition;
+extern char* srv_doublewrite_file;
+
extern ibool srv_extra_undoslots;
-extern ibool srv_fast_recovery;
extern ibool srv_recovery_stats;
extern ulint srv_use_purge_thread;
@@ -247,7 +230,6 @@ extern ulong srv_read_ahead;
extern ulong srv_adaptive_checkpoint;
extern ulong srv_expand_import;
-extern ulint srv_relax_table_creation;
extern ulint srv_pass_corrupt_table;
extern ulong srv_extra_rsegments;
@@ -265,7 +247,8 @@ extern ibool srv_print_innodb_tablespace_monitor;
extern ibool srv_print_verbose_log;
extern ibool srv_print_innodb_table_monitor;
-extern ibool srv_lock_timeout_and_monitor_active;
+extern ibool srv_lock_timeout_active;
+extern ibool srv_monitor_active;
extern ibool srv_error_monitor_active;
extern ulong srv_n_spin_wait_rounds;
@@ -595,15 +578,23 @@ srv_release_mysql_thread_if_suspended(
MySQL OS thread */
/*********************************************************************//**
A thread which wakes up threads whose lock wait may have lasted too long.
-This also prints the info output by various InnoDB monitors.
@return a dummy parameter */
UNIV_INTERN
os_thread_ret_t
-srv_lock_timeout_and_monitor_thread(
-/*================================*/
+srv_lock_timeout_thread(
+/*====================*/
void* arg); /*!< in: a dummy parameter required by
os_thread_create */
/*********************************************************************//**
+A thread which prints the info output by various InnoDB monitors.
+@return a dummy parameter */
+UNIV_INTERN
+os_thread_ret_t
+srv_monitor_thread(
+/*===============*/
+ void* arg); /*!< in: a dummy parameter required by
+ os_thread_create */
+/*************************************************************************
A thread which prints warnings about semaphore waits which have lasted
too long. These can be used to track bugs which cause hangs.
@return a dummy parameter */
@@ -614,12 +605,15 @@ srv_error_monitor_thread(
void* arg); /*!< in: a dummy parameter required by
os_thread_create */
/******************************************************************//**
-Outputs to a file the output of the InnoDB Monitor. */
+Outputs to a file the output of the InnoDB Monitor.
+@return FALSE if not all information printed
+due to failure to obtain necessary mutex */
UNIV_INTERN
-void
+ibool
srv_printf_innodb_monitor(
/*======================*/
FILE* file, /*!< in: output stream */
+ ibool nowait, /*!< in: whether to wait for kernel mutex */
ulint* trx_start, /*!< out: file position of the start of
the list of active transactions */
ulint* trx_end); /*!< out: file position of the end of
@@ -664,6 +658,7 @@ struct export_var_struct{
ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
+ ulint innodb_deadlocks; /* ??? */
ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */
ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */
ibool innodb_have_atomic_builtins; /*!< HAVE_ATOMIC_BUILTINS */
diff --git a/storage/xtradb/include/sync0rw.h b/storage/xtradb/include/sync0rw.h
index 85fa014d77a..1fe517ab30a 100644
--- a/storage/xtradb/include/sync0rw.h
+++ b/storage/xtradb/include/sync0rw.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -429,8 +429,9 @@ ibool
rw_lock_own(
/*========*/
rw_lock_t* lock, /*!< in: rw-lock */
- ulint lock_type); /*!< in: lock type: RW_LOCK_SHARED,
+ ulint lock_type) /*!< in: lock type: RW_LOCK_SHARED,
RW_LOCK_EX */
+ __attribute__((warn_unused_result));
#endif /* UNIV_SYNC_DEBUG */
/******************************************************************//**
Checks if somebody has locked the rw-lock in the specified mode. */
diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h
index c653e44b5bd..7e210ea82f1 100644
--- a/storage/xtradb/include/sync0sync.h
+++ b/storage/xtradb/include/sync0sync.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -206,7 +206,8 @@ UNIV_INTERN
ibool
mutex_own(
/*======*/
- const mutex_t* mutex); /*!< in: mutex */
+ const mutex_t* mutex) /*!< in: mutex */
+ __attribute__((warn_unused_result));
#endif /* UNIV_DEBUG */
#ifdef UNIV_SYNC_DEBUG
/******************************************************************//**
@@ -238,16 +239,27 @@ ibool
sync_thread_levels_empty(void);
/*==========================*/
/******************************************************************//**
-Checks that the level array for the current thread is empty.
-@return TRUE if empty except the exceptions specified below */
+Checks if the level array for the current thread contains a
+mutex or rw-latch at the specified level.
+@return a matching latch, or NULL if not found */
UNIV_INTERN
-ibool
-sync_thread_levels_empty_gen(
-/*=========================*/
+void*
+sync_thread_levels_contains(
+/*========================*/
+ ulint level); /*!< in: latching order level
+ (SYNC_DICT, ...)*/
+/******************************************************************//**
+Checks if the level array for the current thread is empty.
+@return a latch, or NULL if empty except the exceptions specified below */
+UNIV_INTERN
+void*
+sync_thread_levels_nonempty_gen(
+/*============================*/
ibool dict_mutex_allowed); /*!< in: TRUE if dictionary mutex is
allowed to be owned by the thread,
also purge_is_running mutex is
allowed */
+#define sync_thread_levels_empty_gen(d) (!sync_thread_levels_nonempty_gen(d))
/******************************************************************//**
Gets the debug information for a reserved mutex. */
UNIV_INTERN
diff --git a/storage/xtradb/include/trx0rseg.h b/storage/xtradb/include/trx0rseg.h
index 0d7dc60329f..303188f09f2 100644
--- a/storage/xtradb/include/trx0rseg.h
+++ b/storage/xtradb/include/trx0rseg.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
diff --git a/storage/xtradb/include/trx0sys.h b/storage/xtradb/include/trx0sys.h
index 13d93d5a77a..8b941cdd4e6 100644
--- a/storage/xtradb/include/trx0sys.h
+++ b/storage/xtradb/include/trx0sys.h
@@ -124,6 +124,22 @@ trx_sys_hdr_page(
/*=============*/
ulint space, /*!< in: space */
ulint page_no);/*!< in: page number */
+/***************************************************************//**
+Checks if a space is the system tablespaces.
+@return TRUE if system tablespace */
+UNIV_INLINE
+ibool
+trx_sys_sys_space(
+/*==============*/
+ ulint space); /*!< in: space */
+/***************************************************************//**
+Checks if a space is the doublewrite tablespace.
+@return TRUE if doublewrite tablespace */
+UNIV_INLINE
+ibool
+trx_sys_doublewrite_space(
+/*======================*/
+ ulint space); /*!< in: space */
/*****************************************************************//**
Creates and initializes the central memory structures for the transaction
system. This is called when the database is started. */
@@ -137,6 +153,13 @@ UNIV_INTERN
void
trx_sys_create(void);
/*================*/
+/*****************************************************************//**
+Creates and initializes the dummy transaction system page for tablespace. */
+UNIV_INTERN
+void
+trx_sys_dummy_create(
+/*=================*/
+ ulint space);
/*********************************************************************
Create extra rollback segments when create_new_db */
UNIV_INTERN
@@ -343,12 +366,14 @@ UNIV_INTERN
void
trx_sys_file_format_tag_init(void);
/*==============================*/
+#ifndef UNIV_HOTBACKUP
/*****************************************************************//**
Shutdown/Close the transaction system. */
UNIV_INTERN
void
trx_sys_close(void);
/*===============*/
+#endif /* !UNIV_HOTBACKUP */
/*****************************************************************//**
Get the name representation of the file format from its id.
@return pointer to the name */
@@ -444,6 +469,8 @@ trx_sys_file_format_id_to_name(
/* Space id and page no where the trx system file copy resides */
#define TRX_SYS_SPACE 0 /* the SYSTEM tablespace */
+#define TRX_DOUBLEWRITE_SPACE 1 /* the doublewrite buffer tablespace if used */
+#define TRX_SYS_SPACE_MAX 9 /* reserved max space id for system tablespaces */
#include "fsp0fsp.h"
#define TRX_SYS_PAGE_NO FSP_TRX_SYS_PAGE_NO
@@ -507,7 +534,6 @@ this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */
within that file */
#define TRX_SYS_MYSQL_LOG_NAME 12 /*!< MySQL log file name */
-#ifndef UNIV_HOTBACKUP
/** Doublewrite buffer */
/* @{ */
/** The offset of the doublewrite buffer header on the trx system header page */
@@ -559,6 +585,7 @@ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_NO. */
#define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE
/* @} */
+#ifndef UNIV_HOTBACKUP
/** File format tag */
/* @{ */
/** The offset of the file format tag on the trx system header page
diff --git a/storage/xtradb/include/trx0sys.ic b/storage/xtradb/include/trx0sys.ic
index 820d31d0692..c7b09d4aec2 100644
--- a/storage/xtradb/include/trx0sys.ic
+++ b/storage/xtradb/include/trx0sys.ic
@@ -71,6 +71,40 @@ trx_sys_hdr_page(
}
/***************************************************************//**
+Checks if a space is the system tablespaces.
+@return TRUE if system tablespace */
+UNIV_INLINE
+ibool
+trx_sys_sys_space(
+/*==============*/
+ ulint space) /*!< in: space */
+{
+ if (srv_doublewrite_file) {
+ /* several spaces are reserved */
+ return((ibool)(space <= TRX_SYS_SPACE_MAX));
+ } else {
+ return((ibool)(space == TRX_SYS_SPACE));
+ }
+}
+
+/***************************************************************//**
+Checks if a space is the doublewrite tablespace.
+@return TRUE if doublewrite tablespace */
+UNIV_INLINE
+ibool
+trx_sys_doublewrite_space(
+/*======================*/
+ ulint space) /*!< in: space */
+{
+ if (srv_doublewrite_file) {
+ /* doublewrite buffer is separated */
+ return((ibool)(space == TRX_DOUBLEWRITE_SPACE));
+ } else {
+ return((ibool)(space == TRX_SYS_SPACE));
+ }
+}
+
+/***************************************************************//**
Gets the pointer in the nth slot of the rseg array.
@return pointer to rseg object, NULL if slot not in use */
UNIV_INLINE
diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h
index 3b845e498d0..4a4b54b93a0 100644
--- a/storage/xtradb/include/trx0trx.h
+++ b/storage/xtradb/include/trx0trx.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -338,9 +338,7 @@ trx_commit_step(
/**********************************************************************//**
Prints info about a transaction to the given file. The caller must own the
-kernel mutex and must have called
-innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL
-or InnoDB cannot meanwhile change the info printed here. */
+kernel mutex. */
UNIV_INTERN
void
trx_print(
@@ -351,7 +349,7 @@ trx_print(
use the default max length */
/** Type of data dictionary operation */
-enum trx_dict_op {
+typedef enum trx_dict_op {
/** The transaction is not modifying the data dictionary. */
TRX_DICT_OP_NONE = 0,
/** The transaction is creating a table or an index, or
@@ -363,7 +361,7 @@ enum trx_dict_op {
existing table. In crash recovery, the data dictionary
must be locked, but the table must not be dropped. */
TRX_DICT_OP_INDEX = 2
-};
+} trx_dict_op_t;
/**********************************************************************//**
Determine if a transaction is a dictionary operation.
@@ -393,6 +391,14 @@ ibool
trx_is_interrupted(
/*===============*/
trx_t* trx); /*!< in: transaction */
+/**********************************************************************//**
+Determines if the currently running transaction is in strict mode.
+@return TRUE if strict */
+UNIV_INTERN
+ibool
+trx_is_strict(
+/*==========*/
+ trx_t* trx); /*!< in: transaction */
#else /* !UNIV_HOTBACKUP */
#define trx_is_interrupted(trx) FALSE
#endif /* !UNIV_HOTBACKUP */
@@ -465,69 +471,79 @@ rolling back after a database recovery */
struct trx_struct{
ulint magic_n;
- /* All the next fields are protected by the kernel mutex, except the
- undo logs which are protected by undo_mutex */
+
+ /* These fields are not protected by any mutex. */
const char* op_info; /*!< English text describing the
current operation, or an empty
string */
- unsigned is_purge:1; /*!< 0=user transaction, 1=purge */
- unsigned is_recovered:1; /*!< 0=normal transaction,
- 1=recovered, must be rolled back */
- unsigned conc_state:2; /*!< state of the trx from the point
+ ulint conc_state; /*!< state of the trx from the point
of view of concurrency control:
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
... */
- unsigned que_state:2; /*!< valid when conc_state == TRX_ACTIVE:
- TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT,
- ... */
- unsigned isolation_level:2;/* TRX_ISO_REPEATABLE_READ, ... */
- unsigned check_foreigns:1;/* normally TRUE, but if the user
+ ulint isolation_level;/* TRX_ISO_REPEATABLE_READ, ... */
+ ulint check_foreigns; /* normally TRUE, but if the user
wants to suppress foreign key checks,
(in table imports, for example) we
set this FALSE */
- unsigned check_unique_secondary:1;
+ ulint check_unique_secondary;
/* normally TRUE, but if the user
wants to speed up inserts by
suppressing unique key checks
for secondary indexes when we decide
if we can use the insert buffer for
them, we set this FALSE */
- unsigned support_xa:1; /*!< normally we do the XA two-phase
+ ulint support_xa; /*!< normally we do the XA two-phase
commit steps, but by setting this to
FALSE, one can save CPU time and about
150 bytes in the undo log size as then
we skip XA steps */
- unsigned flush_log_later:1;/* In 2PC, we hold the
+ ulint flush_log_later;/* In 2PC, we hold the
prepare_commit mutex across
both phases. In that case, we
defer flush of the logs to disk
until after we release the
mutex. */
- unsigned must_flush_log_later:1;/* this flag is set to TRUE in
+ ulint must_flush_log_later;/* this flag is set to TRUE in
trx_commit_off_kernel() if
flush_log_later was TRUE, and there
were modifications by the transaction;
in that case we must flush the log
in trx_commit_complete_for_mysql() */
- unsigned dict_operation:2;/**< @see enum trx_dict_op */
- unsigned duplicates:2; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
- unsigned active_trans:2; /*!< 1 - if a transaction in MySQL
+ ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
+ ulint active_trans; /*!< 1 - if a transaction in MySQL
is active. 2 - if prepare_commit_mutex
was taken */
- unsigned has_search_latch:1;
+ ulint has_search_latch;
/* TRUE if this trx has latched the
search system latch in S-mode */
- unsigned declared_to_be_inside_innodb:1;
+ ulint deadlock_mark; /*!< a mark field used in deadlock
+ checking algorithm. */
+ trx_dict_op_t dict_operation; /**< @see enum trx_dict_op */
+
+ /* Fields protected by the srv_conc_mutex. */
+ ulint declared_to_be_inside_innodb;
/* this is TRUE if we have declared
this transaction in
srv_conc_enter_innodb to be inside the
InnoDB engine */
- unsigned handling_signals:1;/* this is TRUE as long as the trx
- is handling signals */
- unsigned dict_operation_lock_mode:2;
- /* 0, RW_S_LATCH, or RW_X_LATCH:
+
+ /* Fields protected by dict_operation_lock. The very latch
+ it is used to track. */
+ ulint dict_operation_lock_mode;
+ /*!< 0, RW_S_LATCH, or RW_X_LATCH:
the latch mode trx currently holds
on dict_operation_lock */
+
+ /* All the next fields are protected by the kernel mutex, except the
+ undo logs which are protected by undo_mutex */
+ ulint is_purge; /*!< 0=user transaction, 1=purge */
+ ulint is_recovered; /*!< 0=normal transaction,
+ 1=recovered, must be rolled back */
+ ulint que_state; /*!< valid when conc_state
+ == TRX_ACTIVE: TRX_QUE_RUNNING,
+ TRX_QUE_LOCK_WAIT, ... */
+ ulint handling_signals;/* this is TRUE as long as the trx
+ is handling signals */
time_t start_time; /*!< time the trx object was created
or the state last time became
TRX_ACTIVE */
@@ -657,11 +673,6 @@ struct trx_struct{
wait_thrs; /*!< query threads belonging to this
trx that are in the QUE_THR_LOCK_WAIT
state */
- ulint deadlock_mark; /*!< a mark field used in deadlock
- checking algorithm. This must be
- in its own machine word, because
- it can be changed by other
- threads while holding kernel_mutex. */
/*------------------------------*/
mem_heap_t* lock_heap; /*!< memory heap for the locks of the
transaction */
diff --git a/storage/xtradb/include/trx0types.h b/storage/xtradb/include/trx0types.h
index 24cf57d53d5..40a7256cbfd 100644
--- a/storage/xtradb/include/trx0types.h
+++ b/storage/xtradb/include/trx0types.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -70,6 +70,13 @@ typedef struct trx_named_savept_struct trx_named_savept_t;
enum trx_rb_ctx {
RB_NONE = 0, /*!< no rollback */
RB_NORMAL, /*!< normal rollback */
+ RB_RECOVERY_PURGE_REC,
+ /*!< rolling back an incomplete transaction,
+ in crash recovery, rolling back an
+ INSERT that was performed by updating a
+ delete-marked record; if the delete-marked record
+ no longer exists in an active read view, it will
+ be purged */
RB_RECOVERY /*!< rolling back an incomplete transaction,
in crash recovery */
};
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 09b28ce72dd..834428e652f 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Sun Microsystems, Inc.
@@ -46,8 +46,8 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 0
-#define INNODB_VERSION_BUGFIX 6
-#define PERCONA_INNODB_VERSION 10
+#define INNODB_VERSION_BUGFIX 8
+#define PERCONA_INNODB_VERSION 11.2
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
@@ -118,7 +118,7 @@ if we are compiling on Windows. */
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
# include <sys/stat.h>
-# if !defined(__NETWARE__) && !defined(__WIN__)
+# if !defined(__NETWARE__) && !defined(__WIN__)
# include <sys/mman.h> /* mmap() for os0proc.c */
# endif
@@ -168,6 +168,9 @@ command. Not tested on Windows. */
#define UNIV_COMPILE_TEST_FUNCS
*/
+#ifdef HAVE_valgrind
+# define UNIV_DEBUG_VALGRIND
+#endif /* HAVE_valgrind */
#if 0
#define UNIV_DEBUG_VALGRIND /* Enable extra
Valgrind instrumentation */
@@ -205,6 +208,10 @@ operations (very slow); also UNIV_DEBUG must be defined */
adaptive hash index */
#define UNIV_SRV_PRINT_LATCH_WAITS /* enable diagnostic output
in sync0sync.c */
+#define UNIV_BTR_AVOID_COPY /* when splitting B-tree nodes,
+ do not move any records when
+ all the records would
+ be moved */
#define UNIV_BTR_PRINT /* enable functions for
printing B-trees */
#define UNIV_ZIP_DEBUG /* extensive consistency checks
@@ -232,11 +239,6 @@ by one. */
/* the above option prevents forcing of log to disk
at a buffer page write: it should be tested with this
option off; also some ibuf tests are suppressed */
-/*
-#define UNIV_BASIC_LOG_DEBUG
-*/
- /* the above option enables basic recovery debugging:
- new allocated file pages are reset */
/* Linkage specifier for non-static InnoDB symbols (variables and functions)
that are only referenced from within InnoDB, not from MySQL */
diff --git a/storage/xtradb/include/ut0rbt.h b/storage/xtradb/include/ut0rbt.h
new file mode 100644
index 00000000000..6fd050acfe7
--- /dev/null
+++ b/storage/xtradb/include/ut0rbt.h
@@ -0,0 +1,309 @@
+/*****************************************************************************
+Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
+
+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
+
+*****************************************************************************/
+
+/*******************************************************************//**
+@file include/ut0rbt.h
+Red-Black tree implementation.
+
+Created 2007-03-20 Sunny Bains
+************************************************************************/
+
+#ifndef INNOBASE_UT0RBT_H
+#define INNOBASE_UT0RBT_H
+
+#if !defined(IB_RBT_TESTING)
+#include "univ.i"
+#include "ut0mem.h"
+#else
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#define ut_malloc malloc
+#define ut_free free
+#define ulint unsigned long
+#define ut_a(c) assert(c)
+#define ut_error assert(0)
+#define ibool unsigned int
+#define TRUE 1
+#define FALSE 0
+#endif
+
+/* Red black tree typedefs */
+typedef struct ib_rbt_struct ib_rbt_t;
+typedef struct ib_rbt_node_struct ib_rbt_node_t;
+/* FIXME: Iterator is a better name than _bound_ */
+typedef struct ib_rbt_bound_struct ib_rbt_bound_t;
+typedef void (*ib_rbt_print_node)(const ib_rbt_node_t* node);
+typedef int (*ib_rbt_compare)(const void* p1, const void* p2);
+
+/* Red black tree color types */
+enum ib_rbt_color_enum {
+ IB_RBT_RED,
+ IB_RBT_BLACK
+};
+
+typedef enum ib_rbt_color_enum ib_rbt_color_t;
+
+/* Red black tree node */
+struct ib_rbt_node_struct {
+ ib_rbt_color_t color; /* color of this node */
+
+ ib_rbt_node_t* left; /* points left child */
+ ib_rbt_node_t* right; /* points right child */
+ ib_rbt_node_t* parent; /* points parent node */
+
+ char value[1]; /* Data value */
+};
+
+/* Red black tree instance.*/
+struct ib_rbt_struct {
+ ib_rbt_node_t* nil; /* Black colored node that is
+ used as a sentinel. This is
+ pre-allocated too.*/
+
+ ib_rbt_node_t* root; /* Root of the tree, this is
+ pre-allocated and the first
+ data node is the left child.*/
+
+ ulint n_nodes; /* Total number of data nodes */
+
+ ib_rbt_compare compare; /* Fn. to use for comparison */
+ ulint sizeof_value; /* Sizeof the item in bytes */
+};
+
+/* The result of searching for a key in the tree, this is useful for
+a speedy lookup and insert if key doesn't exist.*/
+struct ib_rbt_bound_struct {
+ const ib_rbt_node_t*
+ last; /* Last node visited */
+
+ int result; /* Result of comparing with
+ the last non-nil node that
+ was visited */
+};
+
+/* Size in elements (t is an rb tree instance) */
+#define rbt_size(t) (t->n_nodes)
+
+/* Check whether the rb tree is empty (t is an rb tree instance) */
+#define rbt_empty(t) (rbt_size(t) == 0)
+
+/* Get data value (t is the data type, n is an rb tree node instance) */
+#define rbt_value(t, n) ((t*) &n->value[0])
+
+/* Compare a key with the node value (t is tree, k is key, n is node)*/
+#define rbt_compare(t, k, n) (t->compare(k, n->value))
+
+/****************************************************************//**
+Free an instance of a red black tree */
+UNIV_INTERN
+void
+rbt_free(
+/*=====*/
+ ib_rbt_t* tree); /*!< in: rb tree to free */
+/****************************************************************//**
+Create an instance of a red black tree
+@return rb tree instance */
+UNIV_INTERN
+ib_rbt_t*
+rbt_create(
+/*=======*/
+ size_t sizeof_value, /*!< in: size in bytes */
+ ib_rbt_compare compare); /*!< in: comparator */
+/****************************************************************//**
+Delete a node from the red black tree, identified by key.
+@return TRUE if success FALSE if not found */
+UNIV_INTERN
+ibool
+rbt_delete(
+/*=======*/
+ ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key); /*!< in: key to delete */
+/****************************************************************//**
+Remove a node from the rb tree, the node is not free'd, that is the
+callers responsibility.
+@return the deleted node with the const. */
+UNIV_INTERN
+ib_rbt_node_t*
+rbt_remove_node(
+/*============*/
+ ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t*
+ node); /*!< in: node to delete, this
+ is a fudge and declared const
+ because the caller has access
+ only to const nodes.*/
+/****************************************************************//**
+Find a matching node in the rb tree.
+@return node if found else return NULL */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_lookup(
+/*=======*/
+ const ib_rbt_t* tree, /*!< in: rb tree to search */
+ const void* key); /*!< in: key to lookup */
+/****************************************************************//**
+Generic insert of a value in the rb tree.
+@return inserted node */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_insert(
+/*=======*/
+ ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key, /*!< in: key for ordering */
+ const void* value); /*!< in: data that will be
+ copied to the node.*/
+/****************************************************************//**
+Add a new node to the tree, useful for data that is pre-sorted.
+@return appended node */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_add_node(
+/*=========*/
+ ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: parent */
+ const void* value); /*!< in: this value is copied
+ to the node */
+/****************************************************************//**
+Return the left most data node in the tree
+@return left most node */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_first(
+/*======*/
+ const ib_rbt_t* tree); /*!< in: rb tree */
+/****************************************************************//**
+Return the right most data node in the tree
+@return right most node */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_last(
+/*=====*/
+ const ib_rbt_t* tree); /*!< in: rb tree */
+/****************************************************************//**
+Return the next node from current.
+@return successor node to current that is passed in. */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_next(
+/*=====*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* /*!< in: current node */
+ current);
+/****************************************************************//**
+Return the prev node from current.
+@return precedessor node to current that is passed in */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_prev(
+/*=====*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* /*!< in: current node */
+ current);
+/****************************************************************//**
+Find the node that has the lowest key that is >= key.
+@return node that satisfies the lower bound constraint or NULL */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_lower_bound(
+/*============*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key); /*!< in: key to search */
+/****************************************************************//**
+Find the node that has the greatest key that is <= key.
+@return node that satisifies the upper bound constraint or NULL */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_upper_bound(
+/*============*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key); /*!< in: key to search */
+/****************************************************************//**
+Search for the key, a node will be retuned in parent.last, whether it
+was found or not. If not found then parent.last will contain the
+parent node for the possibly new key otherwise the matching node.
+@return result of last comparison */
+UNIV_INTERN
+int
+rbt_search(
+/*=======*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: search bounds */
+ const void* key); /*!< in: key to search */
+/****************************************************************//**
+Search for the key, a node will be retuned in parent.last, whether it
+was found or not. If not found then parent.last will contain the
+parent node for the possibly new key otherwise the matching node.
+@return result of last comparison */
+UNIV_INTERN
+int
+rbt_search_cmp(
+/*===========*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: search bounds */
+ const void* key, /*!< in: key to search */
+ ib_rbt_compare compare); /*!< in: comparator */
+/****************************************************************//**
+Clear the tree, deletes (and free's) all the nodes. */
+UNIV_INTERN
+void
+rbt_clear(
+/*======*/
+ ib_rbt_t* tree); /*!< in: rb tree */
+/****************************************************************//**
+Merge the node from dst into src. Return the number of nodes merged.
+@return no. of recs merged */
+UNIV_INTERN
+ulint
+rbt_merge_uniq(
+/*===========*/
+ ib_rbt_t* dst, /*!< in: dst rb tree */
+ const ib_rbt_t* src); /*!< in: src rb tree */
+/****************************************************************//**
+Merge the node from dst into src. Return the number of nodes merged.
+Delete the nodes from src after copying node to dst. As a side effect
+the duplicates will be left untouched in the src, since we don't support
+duplicates (yet). NOTE: src and dst must be similar, the function doesn't
+check for this condition (yet).
+@return no. of recs merged */
+UNIV_INTERN
+ulint
+rbt_merge_uniq_destructive(
+/*=======================*/
+ ib_rbt_t* dst, /*!< in: dst rb tree */
+ ib_rbt_t* src); /*!< in: src rb tree */
+/****************************************************************//**
+Verify the integrity of the RB tree. For debugging. 0 failure else height
+of tree (in count of black nodes).
+@return TRUE if OK FALSE if tree invalid. */
+UNIV_INTERN
+ibool
+rbt_validate(
+/*=========*/
+ const ib_rbt_t* tree); /*!< in: tree to validate */
+/****************************************************************//**
+Iterate over the tree in depth first order. */
+UNIV_INTERN
+void
+rbt_print(
+/*======*/
+ const ib_rbt_t* tree, /*!< in: tree to traverse */
+ ib_rbt_print_node print); /*!< in: print function */
+
+#endif /* INNOBASE_UT0RBT_H */
diff --git a/storage/xtradb/include/ut0rnd.ic b/storage/xtradb/include/ut0rnd.ic
index 372b5b6d5b7..c2043660efd 100644
--- a/storage/xtradb/include/ut0rnd.ic
+++ b/storage/xtradb/include/ut0rnd.ic
@@ -152,6 +152,7 @@ ut_hash_ulint(
ulint key, /*!< in: value to be hashed */
ulint table_size) /*!< in: hash table size */
{
+ ut_ad(table_size);
key = key ^ UT_HASH_RANDOM_MASK2;
return(key % table_size);
diff --git a/storage/xtradb/lock/lock0lock.c b/storage/xtradb/lock/lock0lock.c
index 59394f13766..b103ee79578 100644
--- a/storage/xtradb/lock/lock0lock.c
+++ b/storage/xtradb/lock/lock0lock.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -376,6 +376,7 @@ UNIV_INTERN FILE* lock_latest_err_file;
/* Flags for recursive deadlock search */
#define LOCK_VICTIM_IS_START 1
#define LOCK_VICTIM_IS_OTHER 2
+#define LOCK_EXCEED_MAX_DEPTH 3
/********************************************************************//**
Checks if a lock request results in a deadlock.
@@ -394,24 +395,25 @@ Looks recursively for a deadlock.
deadlock and we chose 'start' as the victim, LOCK_VICTIM_IS_OTHER if a
deadlock was found and we chose some other trx as a victim: we must do
the search again in this last case because there may be another
-deadlock! */
+deadlock!
+LOCK_EXCEED_MAX_DEPTH if the lock search exceeds max steps or max depth. */
static
ulint
lock_deadlock_recursive(
/*====================*/
trx_t* start, /*!< in: recursion starting point */
trx_t* trx, /*!< in: a transaction waiting for a lock */
- lock_t* wait_lock, /*!< in: the lock trx is waiting to be granted */
+ lock_t* wait_lock, /*!< in: lock that is waiting to be granted */
ulint* cost, /*!< in/out: number of calculation steps thus
far: if this exceeds LOCK_MAX_N_STEPS_...
- we return LOCK_VICTIM_IS_START */
+ we return LOCK_EXCEED_MAX_DEPTH */
ulint depth); /*!< in: recursion depth: if this exceeds
LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we
- return LOCK_VICTIM_IS_START */
+ return LOCK_EXCEED_MAX_DEPTH */
/*********************************************************************//**
Gets the nth bit of a record lock.
-@return TRUE if bit set */
+@return TRUE if bit set also if i == ULINT_UNDEFINED return FALSE*/
UNIV_INLINE
ibool
lock_rec_get_nth_bit(
@@ -1222,7 +1224,7 @@ lock_rec_get_first_on_page(
/*********************************************************************//**
Gets the next explicit lock request on a record.
-@return next lock, NULL if none exists */
+@return next lock, NULL if none exists or if heap_no == ULINT_UNDEFINED */
UNIV_INLINE
lock_t*
lock_rec_get_next(
@@ -2404,7 +2406,7 @@ lock_rec_inherit_to_gap(
if (!lock_rec_get_insert_intention(lock)
&& !((srv_locks_unsafe_for_binlog
|| lock->trx->isolation_level
- == TRX_ISO_READ_COMMITTED)
+ <= TRX_ISO_READ_COMMITTED)
&& lock_get_mode(lock) == LOCK_X)) {
lock_rec_add_to_queue(LOCK_REC | LOCK_GAP
@@ -3267,8 +3269,6 @@ lock_deadlock_occurs(
lock_t* lock, /*!< in: lock the transaction is requesting */
trx_t* trx) /*!< in: transaction */
{
- dict_table_t* table;
- dict_index_t* index;
trx_t* mark_trx;
ulint ret;
ulint cost = 0;
@@ -3290,31 +3290,51 @@ retry:
ret = lock_deadlock_recursive(trx, trx, lock, &cost, 0);
- if (ret == LOCK_VICTIM_IS_OTHER) {
+ switch (ret) {
+ case LOCK_VICTIM_IS_OTHER:
/* We chose some other trx as a victim: retry if there still
is a deadlock */
-
goto retry;
- }
- if (UNIV_UNLIKELY(ret == LOCK_VICTIM_IS_START)) {
- if (lock_get_type_low(lock) & LOCK_TABLE) {
- table = lock->un_member.tab_lock.table;
- index = NULL;
+ case LOCK_EXCEED_MAX_DEPTH:
+ /* If the lock search exceeds the max step
+ or the max depth, the current trx will be
+ the victim. Print its information. */
+ rewind(lock_latest_err_file);
+ ut_print_timestamp(lock_latest_err_file);
+
+ fputs("TOO DEEP OR LONG SEARCH IN THE LOCK TABLE"
+ " WAITS-FOR GRAPH, WE WILL ROLL BACK"
+ " FOLLOWING TRANSACTION \n",
+ lock_latest_err_file);
+
+ fputs("\n*** TRANSACTION:\n", lock_latest_err_file);
+ trx_print(lock_latest_err_file, trx, 3000);
+
+ fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n",
+ lock_latest_err_file);
+
+ if (lock_get_type(lock) == LOCK_REC) {
+ lock_rec_print(lock_latest_err_file, lock);
} else {
- index = lock->index;
- table = index->table;
+ lock_table_print(lock_latest_err_file, lock);
}
+ break;
- lock_deadlock_found = TRUE;
-
+ case LOCK_VICTIM_IS_START:
+ srv_n_lock_deadlock_count++;
fputs("*** WE ROLL BACK TRANSACTION (2)\n",
lock_latest_err_file);
+ break;
- return(TRUE);
+ default:
+ /* No deadlock detected*/
+ return(FALSE);
}
- return(FALSE);
+ lock_deadlock_found = TRUE;
+
+ return(TRUE);
}
/********************************************************************//**
@@ -3323,25 +3343,26 @@ Looks recursively for a deadlock.
deadlock and we chose 'start' as the victim, LOCK_VICTIM_IS_OTHER if a
deadlock was found and we chose some other trx as a victim: we must do
the search again in this last case because there may be another
-deadlock! */
+deadlock!
+LOCK_EXCEED_MAX_DEPTH if the lock search exceeds max steps or max depth. */
static
ulint
lock_deadlock_recursive(
/*====================*/
trx_t* start, /*!< in: recursion starting point */
trx_t* trx, /*!< in: a transaction waiting for a lock */
- lock_t* wait_lock, /*!< in: the lock trx is waiting to be granted */
+ lock_t* wait_lock, /*!< in: lock that is waiting to be granted */
ulint* cost, /*!< in/out: number of calculation steps thus
far: if this exceeds LOCK_MAX_N_STEPS_...
- we return LOCK_VICTIM_IS_START */
+ we return LOCK_EXCEED_MAX_DEPTH */
ulint depth) /*!< in: recursion depth: if this exceeds
LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we
- return LOCK_VICTIM_IS_START */
+ return LOCK_EXCEED_MAX_DEPTH */
{
+ ulint ret;
lock_t* lock;
- ulint bit_no = ULINT_UNDEFINED;
trx_t* lock_trx;
- ulint ret;
+ ulint heap_no = ULINT_UNDEFINED;
ut_a(trx);
ut_a(start);
@@ -3357,27 +3378,44 @@ lock_deadlock_recursive(
*cost = *cost + 1;
- lock = wait_lock;
-
if (lock_get_type_low(wait_lock) == LOCK_REC) {
+ ulint space;
+ ulint page_no;
+
+ heap_no = lock_rec_find_set_bit(wait_lock);
+ ut_a(heap_no != ULINT_UNDEFINED);
+
+ space = wait_lock->un_member.rec_lock.space;
+ page_no = wait_lock->un_member.rec_lock.page_no;
+
+ lock = lock_rec_get_first_on_page_addr(space, page_no);
+
+ /* Position the iterator on the first matching record lock. */
+ while (lock != NULL
+ && lock != wait_lock
+ && !lock_rec_get_nth_bit(lock, heap_no)) {
+
+ lock = lock_rec_get_next_on_page(lock);
+ }
+
+ if (lock == wait_lock) {
+ lock = NULL;
+ }
- bit_no = lock_rec_find_set_bit(wait_lock);
+ ut_ad(lock == NULL || lock_rec_get_nth_bit(lock, heap_no));
- ut_a(bit_no != ULINT_UNDEFINED);
+ } else {
+ lock = wait_lock;
}
/* Look at the locks ahead of wait_lock in the lock queue */
for (;;) {
- if (lock_get_type_low(lock) & LOCK_TABLE) {
-
- lock = UT_LIST_GET_PREV(un_member.tab_lock.locks,
- lock);
- } else {
- ut_ad(lock_get_type_low(lock) == LOCK_REC);
- ut_a(bit_no != ULINT_UNDEFINED);
+ /* Get previous table lock. */
+ if (heap_no == ULINT_UNDEFINED) {
- lock = (lock_t*) lock_rec_get_prev(lock, bit_no);
+ lock = UT_LIST_GET_PREV(
+ un_member.tab_lock.locks, lock);
}
if (lock == NULL) {
@@ -3395,7 +3433,7 @@ lock_deadlock_recursive(
lock_trx = lock->trx;
- if (lock_trx == start || too_far) {
+ if (lock_trx == start) {
/* We came back to the recursion starting
point: a deadlock detected; or we have
@@ -3442,19 +3480,10 @@ lock_deadlock_recursive(
}
#ifdef UNIV_DEBUG
if (lock_print_waits) {
- fputs("Deadlock detected"
- " or too long search\n",
+ fputs("Deadlock detected\n",
stderr);
}
#endif /* UNIV_DEBUG */
- if (too_far) {
-
- fputs("TOO DEEP OR LONG SEARCH"
- " IN THE LOCK TABLE"
- " WAITS-FOR GRAPH\n", ef);
-
- return(LOCK_VICTIM_IS_START);
- }
if (trx_weight_cmp(wait_lock->trx,
start) >= 0) {
@@ -3490,6 +3519,21 @@ lock_deadlock_recursive(
return(LOCK_VICTIM_IS_OTHER);
}
+ if (too_far) {
+
+#ifdef UNIV_DEBUG
+ if (lock_print_waits) {
+ fputs("Deadlock search exceeds"
+ " max steps or depth.\n",
+ stderr);
+ }
+#endif /* UNIV_DEBUG */
+ /* The information about transaction/lock
+ to be rolled back is available in the top
+ level. Do not print anything here. */
+ return(LOCK_EXCEED_MAX_DEPTH);
+ }
+
if (lock_trx->que_state == TRX_QUE_LOCK_WAIT) {
/* Another trx ahead has requested lock in an
@@ -3499,12 +3543,28 @@ lock_deadlock_recursive(
ret = lock_deadlock_recursive(
start, lock_trx,
lock_trx->wait_lock, cost, depth + 1);
+
if (ret != 0) {
return(ret);
}
}
}
+ /* Get the next record lock to check. */
+ if (heap_no != ULINT_UNDEFINED) {
+
+ ut_a(lock != NULL);
+
+ do {
+ lock = lock_rec_get_next_on_page(lock);
+ } while (lock != NULL
+ && lock != wait_lock
+ && !lock_rec_get_nth_bit(lock, heap_no));
+
+ if (lock == wait_lock) {
+ lock = NULL;
+ }
+ }
}/* end of the 'for (;;)'-loop */
}
@@ -3706,9 +3766,10 @@ lock_table_enqueue_waiting(
/*********************************************************************//**
Checks if other transactions have an incompatible mode lock request in
-the lock queue. */
+the lock queue.
+@return lock or NULL */
UNIV_INLINE
-ibool
+lock_t*
lock_table_other_has_incompatible(
/*==============================*/
trx_t* trx, /*!< in: transaction, or NULL if all
@@ -3730,13 +3791,13 @@ lock_table_other_has_incompatible(
&& (!lock_mode_compatible(lock_get_mode(lock), mode))
&& (wait || !(lock_get_wait(lock)))) {
- return(TRUE);
+ return(lock);
}
lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, lock);
}
- return(FALSE);
+ return(NULL);
}
/*********************************************************************//**
@@ -4260,31 +4321,34 @@ lock_rec_print(
putc('\n', file);
if ( srv_show_verbose_locks ) {
- block = buf_page_try_get(space, page_no, &mtr);
+ block = buf_page_try_get(space, page_no, &mtr);
+
+ for (i = 0; i < lock_rec_get_n_bits(lock); ++i) {
+
+ if (!lock_rec_get_nth_bit(lock, i)) {
+ continue;
+ }
+
+ fprintf(file, "Record lock, heap no %lu", (ulong) i);
+
if (block) {
- for (i = 0; i < lock_rec_get_n_bits(lock); i++) {
+ const rec_t* rec;
- if (lock_rec_get_nth_bit(lock, i)) {
+ rec = page_find_rec_with_heap_no(
+ buf_block_get_frame(block), i);
- const rec_t* rec
- = page_find_rec_with_heap_no(
- buf_block_get_frame(block), i);
- offsets = rec_get_offsets(
- rec, lock->index, offsets,
- ULINT_UNDEFINED, &heap);
+ offsets = rec_get_offsets(
+ rec, lock->index, offsets,
+ ULINT_UNDEFINED, &heap);
- fprintf(file, "Record lock, heap no %lu ",
- (ulong) i);
- rec_print_new(file, rec, offsets);
- putc('\n', file);
- }
- }
- } else {
- for (i = 0; i < lock_rec_get_n_bits(lock); i++) {
- fprintf(file, "Record lock, heap no %lu\n", (ulong) i);
- }
+ putc(' ', file);
+ rec_print_new(file, rec, offsets);
}
+
+ putc('\n', file);
+ }
}
+
mtr_commit(&mtr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -4329,14 +4393,26 @@ lock_get_n_rec_locks(void)
#endif /* PRINT_NUM_OF_LOCK_STRUCTS */
/*********************************************************************//**
-Prints info of locks for all transactions. */
+Prints info of locks for all transactions.
+@return FALSE if not able to obtain kernel mutex
+and exits without printing info */
UNIV_INTERN
-void
+ibool
lock_print_info_summary(
/*====================*/
- FILE* file) /*!< in: file where to print */
+ FILE* file, /*!< in: file where to print */
+ ibool nowait) /*!< in: whether to wait for the kernel mutex */
{
- lock_mutex_enter_kernel();
+ /* if nowait is FALSE, wait on the kernel mutex,
+ otherwise return immediately if fail to obtain the
+ mutex. */
+ if (!nowait) {
+ lock_mutex_enter_kernel();
+ } else if (mutex_enter_nowait(&kernel_mutex)) {
+ fputs("FAIL TO OBTAIN KERNEL MUTEX, "
+ "SKIP LOCK INFO PRINTING\n", file);
+ return(FALSE);
+ }
if (lock_deadlock_found) {
fputs("------------------------\n"
@@ -4368,6 +4444,7 @@ lock_print_info_summary(
"Total number of lock structs in row lock hash table %lu\n",
(ulong) lock_get_n_rec_locks());
#endif /* PRINT_NUM_OF_LOCK_STRUCTS */
+ return(TRUE);
}
/*********************************************************************//**
@@ -4648,6 +4725,7 @@ lock_rec_queue_validate(
ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
block, heap_no, impl_trx));
}
+#if 0
} else {
/* The kernel mutex may get released temporarily in the
@@ -4658,6 +4736,27 @@ lock_rec_queue_validate(
(fil_space_t::latch), the following check WILL break
latching order and may cause a deadlock of threads. */
+ /* NOTE: This is a bogus check that would fail in the
+ following case: Our transaction is updating a
+ row. After it has updated the clustered index record,
+ it goes to a secondary index record and finds someone
+ else holding an explicit S- or X-lock on that
+ secondary index record, presumably from a locking
+ read. Our transaction cannot update the secondary
+ index immediately, but places a waiting X-lock request
+ on the secondary index record. There is nothing
+ illegal in this. The assertion is simply too strong. */
+
+ /* From the locking point of view, each secondary
+ index is a separate table. A lock that is held on
+ secondary index rec does not give any rights to modify
+ or read the clustered index rec. Therefore, we can
+ think of the sec index as a separate 'table' from the
+ clust index 'table'. Conversely, a transaction that
+ has acquired a lock on and modified a clustered index
+ record may need to wait for a lock on the
+ corresponding record in a secondary index. */
+
impl_trx = lock_sec_rec_some_has_impl_off_kernel(
rec, index, offsets);
@@ -4668,6 +4767,7 @@ lock_rec_queue_validate(
ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
block, heap_no, impl_trx));
}
+#endif
}
lock = lock_rec_get_first(block, heap_no);
@@ -4765,6 +4865,13 @@ loop:
|| lock->trx->conc_state == TRX_PREPARED
|| lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
+# ifdef UNIV_SYNC_DEBUG
+ /* Only validate the record queues when this thread is not
+ holding a space->latch. Deadlocks are possible due to
+ latching order violation when UNIV_DEBUG is defined while
+ UNIV_SYNC_DEBUG is not. */
+ if (!sync_thread_levels_contains(SYNC_FSP))
+# endif /* UNIV_SYNC_DEBUG */
for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) {
if (i == 1 || lock_rec_get_nth_bit(lock, i)) {
@@ -4930,7 +5037,7 @@ lock_rec_insert_check_and_lock(
}
trx = thr_get_trx(thr);
- next_rec = page_rec_get_next((rec_t*) rec);
+ next_rec = page_rec_get_next_const(rec);
next_rec_heap_no = page_rec_get_heap_no(next_rec);
lock_mutex_enter_kernel();
diff --git a/storage/xtradb/log/log0log.c b/storage/xtradb/log/log0log.c
index f2487407071..03d097d1c12 100644
--- a/storage/xtradb/log/log0log.c
+++ b/storage/xtradb/log/log0log.c
@@ -1,23 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
-
-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
-
-*****************************************************************************/
-/*****************************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2009, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -2045,7 +2028,7 @@ log_checkpoint(
return(TRUE);
}
- ut_ad(log_sys->written_to_all_lsn >= oldest_lsn);
+ ut_ad(log_sys->flushed_to_disk_lsn >= oldest_lsn);
if (log_sys->n_pending_checkpoint_writes > 0) {
/* A checkpoint write is running */
@@ -3127,7 +3110,7 @@ loop:
if (srv_fast_shutdown < 2
&& (srv_error_monitor_active
- || srv_lock_timeout_and_monitor_active)) {
+ || srv_lock_timeout_active || srv_monitor_active)) {
mutex_exit(&kernel_mutex);
diff --git a/storage/xtradb/log/log0recv.c b/storage/xtradb/log/log0recv.c
index 25eee07067c..1c9b4960ee4 100644
--- a/storage/xtradb/log/log0recv.c
+++ b/storage/xtradb/log/log0recv.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved.
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
@@ -138,7 +138,9 @@ UNIV_INTERN ulint recv_max_parsed_page_no;
/** This many frames must be left free in the buffer pool when we scan
the log and store the scanned log records in the buffer pool: we will
use these free frames to read in pages when we start applying the
-log records to the database. */
+log records to the database.
+This is the default value. If the actual size of the buffer pool is
+larger than 10 MB we'll set this value to 512. */
UNIV_INTERN ulint recv_n_pool_free_frames;
/** The maximum lsn we see for a page during the recovery process. If this
@@ -242,6 +244,7 @@ recv_sys_mem_free(void)
}
}
+#ifndef UNIV_HOTBACKUP
/************************************************************
Reset the state of the recovery system variables. */
UNIV_INTERN
@@ -251,7 +254,7 @@ recv_sys_var_init(void)
{
recv_lsn_checks_on = FALSE;
- recv_n_pool_free_frames = 1024;
+ recv_n_pool_free_frames = 256;
recv_recovery_on = FALSE;
@@ -277,10 +280,11 @@ recv_sys_var_init(void)
recv_max_parsed_page_no = 0;
- recv_n_pool_free_frames = 1024;
+ recv_n_pool_free_frames = 256;
recv_max_page_lsn = 0;
}
+#endif /* !UNIV_HOTBACKUP */
/************************************************************
Inits the recovery system for a recovery operation. */
@@ -295,20 +299,37 @@ recv_sys_init(
return;
}
+ /* Initialize red-black tree for fast insertions into the
+ flush_list during recovery process.
+ As this initialization is done while holding the buffer pool
+ mutex we perform it before acquiring recv_sys->mutex. */
+#ifndef UNIV_HOTBACKUP
+ buf_flush_init_flush_rbt();
+
mutex_enter(&(recv_sys->mutex));
-#ifndef UNIV_HOTBACKUP
recv_sys->heap = mem_heap_create_in_buffer(256);
#else /* !UNIV_HOTBACKUP */
recv_sys->heap = mem_heap_create(256);
recv_is_from_backup = TRUE;
#endif /* !UNIV_HOTBACKUP */
+ /* Set appropriate value of recv_n_pool_free_frames. */
+ if (buf_pool_get_curr_size() >= (10 * 1024 * 1024)) {
+ /* Buffer pool of size greater than 10 MB. */
+ recv_n_pool_free_frames = 512;
+ }
+
+ if (buf_pool_get_curr_size() >= (32 * 1024 * 1024)) {
+ /* Buffer pool of size greater than 32 MB. */
+ recv_n_pool_free_frames = 1024;
+ }
+
recv_sys->buf = ut_malloc(RECV_PARSING_BUF_SIZE);
recv_sys->len = 0;
recv_sys->recovered_offset = 0;
- recv_sys->addr_hash = hash_create(available_memory / 64);
+ recv_sys->addr_hash = hash_create(available_memory / 512);
recv_sys->n_addrs = 0;
recv_sys->apply_log_recs = FALSE;
@@ -348,7 +369,7 @@ recv_sys_empty_hash(void)
hash_table_free(recv_sys->addr_hash);
mem_heap_empty(recv_sys->heap);
- recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256);
+ recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 512);
}
#ifndef UNIV_HOTBACKUP
@@ -373,6 +394,9 @@ recv_sys_debug_free(void)
recv_sys->last_block_buf_start = NULL;
mutex_exit(&(recv_sys->mutex));
+
+ /* Free up the flush_rbt. */
+ buf_flush_free_flush_rbt();
}
# endif /* UNIV_LOG_DEBUG */
@@ -2117,15 +2141,6 @@ recv_parse_log_rec(
}
#endif /* UNIV_LOG_LSN_DEBUG */
- /* Check that page_no is sensible */
-
- if (UNIV_UNLIKELY(*page_no > 0x8FFFFFFFUL)) {
-
- recv_sys->found_corrupt_log = TRUE;
-
- return(0);
- }
-
new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr,
NULL, NULL);
if (UNIV_UNLIKELY(new_ptr == NULL)) {
@@ -2234,6 +2249,14 @@ recv_report_corrupt_log(
putc('\n', stderr);
}
+#ifndef UNIV_HOTBACKUP
+ if (!srv_force_recovery) {
+ fputs("InnoDB: Set innodb_force_recovery"
+ " to ignore this error.\n", stderr);
+ ut_error;
+ }
+#endif /* !UNIV_HOTBACKUP */
+
fputs("InnoDB: WARNING: the log file may have been corrupt and it\n"
"InnoDB: is possible that the log scan did not proceed\n"
"InnoDB: far enough in recovery! Please run CHECK TABLE\n"
@@ -2623,7 +2646,7 @@ recv_scan_log_recs(
ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0);
- ut_ad(len > 0);
+ ut_ad(len >= OS_FILE_LOG_BLOCK_SIZE);
ut_a(store_to_hash <= TRUE);
finished = FALSE;
@@ -2748,6 +2771,16 @@ recv_scan_log_recs(
recv_sys->found_corrupt_log = TRUE;
+#ifndef UNIV_HOTBACKUP
+ if (!srv_force_recovery) {
+ fputs("InnoDB: Set"
+ " innodb_force_recovery"
+ " to ignore this error.\n",
+ stderr);
+ ut_error;
+ }
+#endif /* !UNIV_HOTBACKUP */
+
} else if (!recv_sys->found_corrupt_log) {
more_data = recv_sys_add_to_parsing_buf(
log_block, scanned_lsn);
@@ -3277,8 +3310,6 @@ void
recv_recovery_from_checkpoint_finish(void)
/*======================================*/
{
- int i;
-
/* Apply the hashed log records to the respective file pages */
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
@@ -3403,9 +3434,16 @@ recv_recovery_from_checkpoint_finish(void)
The data dictionary latch should guarantee that there is at
most one data dictionary transaction active at a time. */
trx_rollback_or_clean_recovered(FALSE);
+}
- /* Drop partially created indexes. */
- row_merge_drop_temp_indexes();
+/********************************************************//**
+Initiates the rollback of active transactions. */
+UNIV_INTERN
+void
+recv_recovery_rollback_active(void)
+/*===============================*/
+{
+ int i;
#ifdef UNIV_SYNC_DEBUG
/* Wait for a while so that created threads have time to suspend
@@ -3415,6 +3453,11 @@ recv_recovery_from_checkpoint_finish(void)
/* Switch latching order checks on in sync0sync.c */
sync_order_checks_on = TRUE;
#endif
+ /* Drop partially created indexes. */
+ row_merge_drop_temp_indexes();
+ /* Drop temporary tables. */
+ row_mysql_drop_temp_tables();
+
if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) {
/* Rollback the uncommitted transactions which have no user
session */
diff --git a/storage/xtradb/mem/mem0dbg.c b/storage/xtradb/mem/mem0dbg.c
index 01eda20ec45..1cd2ff15bab 100644
--- a/storage/xtradb/mem/mem0dbg.c
+++ b/storage/xtradb/mem/mem0dbg.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -180,6 +180,10 @@ mem_close(void)
{
mem_pool_free(mem_comm_pool);
mem_comm_pool = NULL;
+#ifdef UNIV_MEM_DEBUG
+ mutex_free(&mem_hash_mutex);
+ mem_hash_initialized = FALSE;
+#endif /* UNIV_MEM_DEBUG */
}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/mem/mem0mem.c b/storage/xtradb/mem/mem0mem.c
index ccb2fd8a7b4..c0ce8a3e1ac 100644
--- a/storage/xtradb/mem/mem0mem.c
+++ b/storage/xtradb/mem/mem0mem.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -383,6 +383,20 @@ mem_heap_create_block(
mem_block_set_free(block, MEM_BLOCK_HEADER_SIZE);
mem_block_set_start(block, MEM_BLOCK_HEADER_SIZE);
+ if (UNIV_UNLIKELY(heap == NULL)) {
+ /* This is the first block of the heap. The field
+ total_size should be initialized here */
+ block->total_size = len;
+ } else {
+ /* Not the first allocation for the heap. This block's
+ total_length field should be set to undefined. */
+ ut_d(block->total_size = ULINT_UNDEFINED);
+ UNIV_MEM_INVALID(&block->total_size,
+ sizeof block->total_size);
+
+ heap->total_size += len;
+ }
+
ut_ad((ulint)MEM_BLOCK_HEADER_SIZE < len);
return(block);
@@ -471,6 +485,10 @@ mem_heap_block_free(
mem_pool_mutex_exit();
#endif
+
+ ut_ad(heap->total_size >= block->len);
+ heap->total_size -= block->len;
+
type = heap->type;
len = block->len;
block->magic_n = MEM_FREED_BLOCK_MAGIC_N;
diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c
index d3b3edea29f..c79a41626c9 100644
--- a/storage/xtradb/os/os0file.c
+++ b/storage/xtradb/os/os0file.c
@@ -1,23 +1,6 @@
-/*****************************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
-
-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
-
-*****************************************************************************/
/***********************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted
@@ -846,7 +829,15 @@ next_file:
#ifdef HAVE_READDIR_R
ret = readdir_r(dir, (struct dirent*)dirent_buf, &ent);
- if (ret != 0) {
+ if (ret != 0
+#ifdef UNIV_AIX
+ /* On AIX, only if we got non-NULL 'ent' (result) value and
+ a non-zero 'ret' (return) value, it indicates a failed
+ readdir_r() call. An NULL 'ent' with an non-zero 'ret'
+ would indicate the "end of the directory" is reached. */
+ && ent != NULL
+#endif
+ ) {
fprintf(stderr,
"InnoDB: cannot read directory %s, error %lu\n",
dirname, (ulong)ret);
@@ -4030,6 +4021,9 @@ os_aio_simulated_handle(
ulint i;
time_t now;
+ /* Fix compiler warning */
+ *consecutive_ios = NULL;
+
segment = os_aio_get_array_and_local_segment(&array, global_segment);
restart:
diff --git a/storage/xtradb/page/page0page.c b/storage/xtradb/page/page0page.c
index ab2ba60570e..10008f9ac25 100644
--- a/storage/xtradb/page/page0page.c
+++ b/storage/xtradb/page/page0page.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -658,6 +658,14 @@ page_copy_rec_list_end(
index, mtr);
}
+ /* Update PAGE_MAX_TRX_ID on the uncompressed page.
+ Modifications will be redo logged and copied to the compressed
+ page in page_zip_compress() or page_zip_reorganize() below. */
+ if (dict_index_is_sec_or_ibuf(index) && page_is_leaf(page)) {
+ page_update_max_trx_id(new_block, NULL,
+ page_get_max_trx_id(page), mtr);
+ }
+
if (UNIV_LIKELY_NULL(new_page_zip)) {
mtr_set_log_mode(mtr, log_mode);
@@ -696,15 +704,10 @@ page_copy_rec_list_end(
}
}
- /* Update the lock table, MAX_TRX_ID, and possible hash index */
+ /* Update the lock table and possible hash index */
lock_move_rec_list_end(new_block, block, rec);
- if (dict_index_is_sec_or_ibuf(index) && page_is_leaf(page)) {
- page_update_max_trx_id(new_block, new_page_zip,
- page_get_max_trx_id(page), mtr);
- }
-
btr_search_move_or_delete_hash_entries(new_block, block, index);
return(ret);
@@ -772,6 +775,16 @@ page_copy_rec_list_start(
mem_heap_free(heap);
}
+ /* Update PAGE_MAX_TRX_ID on the uncompressed page.
+ Modifications will be redo logged and copied to the compressed
+ page in page_zip_compress() or page_zip_reorganize() below. */
+ if (dict_index_is_sec_or_ibuf(index)
+ && page_is_leaf(page_align(rec))) {
+ page_update_max_trx_id(new_block, NULL,
+ page_get_max_trx_id(page_align(rec)),
+ mtr);
+ }
+
if (UNIV_LIKELY_NULL(new_page_zip)) {
mtr_set_log_mode(mtr, log_mode);
@@ -809,14 +822,7 @@ page_copy_rec_list_start(
}
}
- /* Update MAX_TRX_ID, the lock table, and possible hash index */
-
- if (dict_index_is_sec_or_ibuf(index)
- && page_is_leaf(page_align(rec))) {
- page_update_max_trx_id(new_block, new_page_zip,
- page_get_max_trx_id(page_align(rec)),
- mtr);
- }
+ /* Update the lock table and possible hash index */
lock_move_rec_list_start(new_block, block, rec, ret);
@@ -2408,8 +2414,13 @@ page_validate(
}
offs = page_offset(rec_get_start(rec, offsets));
+ i = rec_offs_size(offsets);
+ if (UNIV_UNLIKELY(offs + i >= UNIV_PAGE_SIZE)) {
+ fputs("InnoDB: record offset out of bounds\n", stderr);
+ goto func_exit;
+ }
- for (i = rec_offs_size(offsets); i--; ) {
+ while (i--) {
if (UNIV_UNLIKELY(buf[offs + i])) {
/* No other record may overlap this */
@@ -2517,8 +2528,13 @@ n_owned_zero:
count++;
offs = page_offset(rec_get_start(rec, offsets));
+ i = rec_offs_size(offsets);
+ if (UNIV_UNLIKELY(offs + i >= UNIV_PAGE_SIZE)) {
+ fputs("InnoDB: record offset out of bounds\n", stderr);
+ goto func_exit;
+ }
- for (i = rec_offs_size(offsets); i--; ) {
+ while (i--) {
if (UNIV_UNLIKELY(buf[offs + i])) {
fputs("InnoDB: Record overlaps another"
diff --git a/storage/xtradb/page/page0zip.c b/storage/xtradb/page/page0zip.c
index c5c373781a2..7ef44f3246f 100644
--- a/storage/xtradb/page/page0zip.c
+++ b/storage/xtradb/page/page0zip.c
@@ -3117,8 +3117,13 @@ page_zip_validate_low(
temp_page_zip in a debugger when running valgrind --db-attach. */
VALGRIND_GET_VBITS(page, temp_page, UNIV_PAGE_SIZE);
UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
+# if UNIV_WORD_SIZE == 4
VALGRIND_GET_VBITS(page_zip, &temp_page_zip, sizeof temp_page_zip);
+ /* On 32-bit systems, there is no padding in page_zip_des_t.
+ On other systems, Valgrind could complain about uninitialized
+ pad bytes. */
UNIV_MEM_ASSERT_RW(page_zip, sizeof *page_zip);
+# endif
VALGRIND_GET_VBITS(page_zip->data, temp_page,
page_zip_get_size(page_zip));
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
diff --git a/storage/xtradb/plug.in b/storage/xtradb/plug.in
index c77bd15be1b..37c895fb520 100644
--- a/storage/xtradb/plug.in
+++ b/storage/xtradb/plug.in
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
+# Copyright (c) 2006, 2010, Innobase Oy. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
diff --git a/storage/xtradb/rem/rem0rec.c b/storage/xtradb/rem/rem0rec.c
index 1c8b3fd8c1e..37ba8ca2ffe 100644
--- a/storage/xtradb/rem/rem0rec.c
+++ b/storage/xtradb/rem/rem0rec.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
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
@@ -212,6 +212,13 @@ rec_get_n_extern_new(
const dict_col_t* col
= dict_field_get_col(field);
len = *lens--;
+ /* If the maximum length of the field is up
+ to 255 bytes, the actual length is always
+ stored in one byte. If the maximum length is
+ more than 255 bytes, the actual length is
+ stored in one byte for 0..127. The length
+ will be encoded in two bytes when it is 128 or
+ more, or when the field is stored externally. */
if (UNIV_UNLIKELY(col->len > 255)
|| UNIV_UNLIKELY(col->mtype == DATA_BLOB)) {
if (len & 0x80) {
@@ -294,6 +301,13 @@ rec_init_offsets_comp_ordinary(
const dict_col_t* col
= dict_field_get_col(field);
len = *lens--;
+ /* If the maximum length of the field is up
+ to 255 bytes, the actual length is always
+ stored in one byte. If the maximum length is
+ more than 255 bytes, the actual length is
+ stored in one byte for 0..127. The length
+ will be encoded in two bytes when it is 128 or
+ more, or when the field is stored externally. */
if (UNIV_UNLIKELY(col->len > 255)
|| UNIV_UNLIKELY(col->mtype
== DATA_BLOB)) {
@@ -425,6 +439,15 @@ rec_init_offsets(
const dict_col_t* col
= dict_field_get_col(field);
len = *lens--;
+ /* If the maximum length of the field
+ is up to 255 bytes, the actual length
+ is always stored in one byte. If the
+ maximum length is more than 255 bytes,
+ the actual length is stored in one
+ byte for 0..127. The length will be
+ encoded in two bytes when it is 128 or
+ more, or when the field is stored
+ externally. */
if (UNIV_UNLIKELY(col->len > 255)
|| UNIV_UNLIKELY(col->mtype
== DATA_BLOB)) {
@@ -647,6 +670,13 @@ rec_get_offsets_reverse(
const dict_col_t* col
= dict_field_get_col(field);
len = *lens++;
+ /* If the maximum length of the field is up
+ to 255 bytes, the actual length is always
+ stored in one byte. If the maximum length is
+ more than 255 bytes, the actual length is
+ stored in one byte for 0..127. The length
+ will be encoded in two bytes when it is 128 or
+ more, or when the field is stored externally. */
if (UNIV_UNLIKELY(col->len > 255)
|| UNIV_UNLIKELY(col->mtype == DATA_BLOB)) {
if (len & 0x80) {
@@ -695,19 +725,9 @@ rec_get_nth_field_offs_old(
ulint os;
ulint next_os;
- ut_ad(rec && len);
- ut_ad(n < rec_get_n_fields_old(rec));
-
- if (UNIV_UNLIKELY(n > REC_MAX_N_FIELDS)) {
- fprintf(stderr, "Error: trying to access field %lu in rec\n",
- (ulong) n);
- ut_error;
- }
-
- if (UNIV_UNLIKELY(rec == NULL)) {
- fputs("Error: rec is NULL pointer\n", stderr);
- ut_error;
- }
+ ut_ad(len);
+ ut_a(rec);
+ ut_a(n < rec_get_n_fields_old(rec));
if (rec_get_1byte_offs_flag(rec)) {
os = rec_1_get_field_start_offs(rec, n);
@@ -791,12 +811,20 @@ rec_get_converted_size_comp_prefix(
ut_ad(len <= col->len || col->mtype == DATA_BLOB);
+ /* If the maximum length of a variable-length field
+ is up to 255 bytes, the actual length is always stored
+ in one byte. If the maximum length is more than 255
+ bytes, the actual length is stored in one byte for
+ 0..127. The length will be encoded in two bytes when
+ it is 128 or more, or when the field is stored externally. */
+
if (field->fixed_len) {
ut_ad(len == field->fixed_len);
/* dict_index_add_col() should guarantee this */
ut_ad(!field->prefix_len
|| field->fixed_len == field->prefix_len);
} else if (dfield_is_ext(&fields[i])) {
+ ut_ad(col->len >= 256 || col->mtype == DATA_BLOB);
extra_size += 2;
} else if (len < 128
|| (col->len < 256 && col->mtype != DATA_BLOB)) {
@@ -1096,6 +1124,8 @@ rec_convert_dtuple_to_rec_comp(
/* Store the data and the offsets */
for (i = 0, field = fields; i < n_fields; i++, field++) {
+ const dict_field_t* ifield;
+
type = dfield_get_type(field);
len = dfield_get_len(field);
@@ -1130,12 +1160,20 @@ rec_convert_dtuple_to_rec_comp(
/* only nullable fields can be null */
ut_ad(!dfield_is_null(field));
- fixed_len = dict_index_get_nth_field(index, i)->fixed_len;
-
+ ifield = dict_index_get_nth_field(index, i);
+ fixed_len = ifield->fixed_len;
+ /* If the maximum length of a variable-length field
+ is up to 255 bytes, the actual length is always stored
+ in one byte. If the maximum length is more than 255
+ bytes, the actual length is stored in one byte for
+ 0..127. The length will be encoded in two bytes when
+ it is 128 or more, or when the field is stored externally. */
if (fixed_len) {
ut_ad(len == fixed_len);
ut_ad(!dfield_is_ext(field));
} else if (dfield_is_ext(field)) {
+ ut_ad(ifield->col->len >= 256
+ || ifield->col->mtype == DATA_BLOB);
ut_ad(len <= REC_MAX_INDEX_COL_LEN
+ BTR_EXTERN_FIELD_REF_SIZE);
*lens-- = (byte) (len >> 8) | 0xc0;
@@ -1225,11 +1263,20 @@ rec_convert_dtuple_to_rec(
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
const ulint* offsets;
+ ulint i;
rec_offs_init(offsets_);
offsets = rec_get_offsets(rec, index,
offsets_, ULINT_UNDEFINED, &heap);
ut_ad(rec_validate(rec, offsets));
+ ut_ad(dtuple_get_n_fields(dtuple)
+ == rec_offs_n_fields(offsets));
+
+ for (i = 0; i < rec_offs_n_fields(offsets); i++) {
+ ut_ad(!dfield_is_ext(dtuple_get_nth_field(dtuple, i))
+ == !rec_offs_nth_extern(offsets, i));
+ }
+
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1412,6 +1459,13 @@ rec_copy_prefix_to_buf(
prefix_len += field->fixed_len;
} else {
ulint len = *lens--;
+ /* If the maximum length of the column is up
+ to 255 bytes, the actual length is always
+ stored in one byte. If the maximum length is
+ more than 255 bytes, the actual length is
+ stored in one byte for 0..127. The length
+ will be encoded in two bytes when it is 128 or
+ more, or when the column is stored externally. */
if (col->len > 255 || col->mtype == DATA_BLOB) {
if (len & 0x80) {
/* 1exxxxxx */
diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c
index 4b104ced649..d7475d613ad 100644
--- a/storage/xtradb/row/row0ins.c
+++ b/storage/xtradb/row/row0ins.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -1997,7 +1997,7 @@ row_ins_index_entry_low(
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
mode | BTR_INSERT | ignore_sec_unique,
- &cursor, 0, &mtr);
+ &cursor, 0, __FILE__, __LINE__, &mtr);
if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
/* The insertion was made to the insert buffer already during
@@ -2055,7 +2055,8 @@ row_ins_index_entry_low(
btr_cur_search_to_nth_level(index, 0, entry,
PAGE_CUR_LE,
mode | BTR_INSERT,
- &cursor, 0, &mtr);
+ &cursor, 0,
+ __FILE__, __LINE__, &mtr);
}
}
@@ -2110,7 +2111,8 @@ function_exit:
mtr_start(&mtr);
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
- BTR_MODIFY_TREE, &cursor, 0, &mtr);
+ BTR_MODIFY_TREE, &cursor, 0,
+ __FILE__, __LINE__, &mtr);
rec = btr_cur_get_rec(&cursor);
offsets = rec_get_offsets(rec, index, NULL,
ULINT_UNDEFINED, &heap);
diff --git a/storage/xtradb/row/row0merge.c b/storage/xtradb/row/row0merge.c
index 93b2095dc26..6ee93d24ed3 100644
--- a/storage/xtradb/row/row0merge.c
+++ b/storage/xtradb/row/row0merge.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2005, 2010, Innobase Oy. All Rights Reserved.
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
@@ -424,14 +424,13 @@ row_merge_dup_report(
row_merge_dup_t* dup, /*!< in/out: for reporting duplicates */
const dfield_t* entry) /*!< in: duplicate index entry */
{
- mrec_buf_t buf;
+ mrec_buf_t* buf;
const dtuple_t* tuple;
dtuple_t tuple_store;
const rec_t* rec;
const dict_index_t* index = dup->index;
ulint n_fields= dict_index_get_n_fields(index);
- mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ mem_heap_t* heap;
ulint* offsets;
ulint n_ext;
@@ -441,22 +440,22 @@ row_merge_dup_report(
return;
}
- rec_offs_init(offsets_);
-
/* Convert the tuple to a record and then to MySQL format. */
+ heap = mem_heap_create((1 + REC_OFFS_HEADER_SIZE + n_fields)
+ * sizeof *offsets
+ + sizeof *buf);
+
+ buf = mem_heap_alloc(heap, sizeof *buf);
tuple = dtuple_from_fields(&tuple_store, entry, n_fields);
n_ext = dict_index_is_clust(index) ? dtuple_get_n_ext(tuple) : 0;
- rec = rec_convert_dtuple_to_rec(buf, index, tuple, n_ext);
- offsets = rec_get_offsets(rec, index, offsets_, ULINT_UNDEFINED,
- &heap);
+ rec = rec_convert_dtuple_to_rec(*buf, index, tuple, n_ext);
+ offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
innobase_rec_to_mysql(dup->table, rec, index, offsets);
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
+ mem_heap_free(heap);
}
/*************************************************************//**
@@ -627,22 +626,26 @@ row_merge_buf_write(
}
/******************************************************//**
-Create a memory heap and allocate space for row_merge_rec_offsets().
+Create a memory heap and allocate space for row_merge_rec_offsets()
+and mrec_buf_t[3].
@return memory heap */
static
mem_heap_t*
row_merge_heap_create(
/*==================*/
const dict_index_t* index, /*!< in: record descriptor */
+ mrec_buf_t** buf, /*!< out: 3 buffers */
ulint** offsets1, /*!< out: offsets */
ulint** offsets2) /*!< out: offsets */
{
ulint i = 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index);
- mem_heap_t* heap = mem_heap_create(2 * i * sizeof *offsets1);
+ mem_heap_t* heap = mem_heap_create(2 * i * sizeof **offsets1
+ + 3 * sizeof **buf);
- *offsets1 = mem_heap_alloc(heap, i * sizeof *offsets1);
- *offsets2 = mem_heap_alloc(heap, i * sizeof *offsets2);
+ *buf = mem_heap_alloc(heap, 3 * sizeof **buf);
+ *offsets1 = mem_heap_alloc(heap, i * sizeof **offsets1);
+ *offsets2 = mem_heap_alloc(heap, i * sizeof **offsets2);
(*offsets1)[0] = (*offsets2)[0] = i;
(*offsets1)[1] = (*offsets2)[1] = dict_index_get_n_fields(index);
@@ -1401,7 +1404,8 @@ row_merge_blocks(
{
mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */
- mrec_buf_t buf[3]; /*!< buffer for handling split mrec in block[] */
+ mrec_buf_t* buf; /*!< buffer for handling
+ split mrec in block[] */
const byte* b0; /*!< pointer to block[0] */
const byte* b1; /*!< pointer to block[1] */
byte* b2; /*!< pointer to block[2] */
@@ -1421,7 +1425,7 @@ row_merge_blocks(
}
#endif /* UNIV_DEBUG */
- heap = row_merge_heap_create(index, &offsets0, &offsets1);
+ heap = row_merge_heap_create(index, &buf, &offsets0, &offsets1);
/* Write a record and read the next record. Split the output
file in two halves, which can be merged on the following pass. */
@@ -1507,7 +1511,7 @@ row_merge_blocks_copy(
{
mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */
- mrec_buf_t buf[3]; /*!< buffer for handling
+ mrec_buf_t* buf; /*!< buffer for handling
split mrec in block[] */
const byte* b0; /*!< pointer to block[0] */
byte* b2; /*!< pointer to block[2] */
@@ -1525,7 +1529,7 @@ row_merge_blocks_copy(
}
#endif /* UNIV_DEBUG */
- heap = row_merge_heap_create(index, &offsets0, &offsets1);
+ heap = row_merge_heap_create(index, &buf, &offsets0, &offsets1);
/* Write a record and read the next record. Split the output
file in two halves, which can be merged on the following pass. */
@@ -1767,7 +1771,6 @@ row_merge_insert_index_tuples(
int fd, /*!< in: file descriptor */
row_merge_block_t* block) /*!< in/out: file buffer */
{
- mrec_buf_t buf;
const byte* b;
que_thr_t* thr;
ins_node_t* node;
@@ -1786,7 +1789,7 @@ row_merge_insert_index_tuples(
trx->op_info = "inserting index entries";
- graph_heap = mem_heap_create(500);
+ graph_heap = mem_heap_create(500 + sizeof(mrec_buf_t));
node = ins_node_create(INS_DIRECT, table, graph_heap);
thr = pars_complete_graph_for_exec(node, trx, graph_heap);
@@ -1808,12 +1811,14 @@ row_merge_insert_index_tuples(
if (!row_merge_read(fd, foffs, block)) {
error = DB_CORRUPTION;
} else {
+ mrec_buf_t* buf = mem_heap_alloc(graph_heap, sizeof *buf);
+
for (;;) {
const mrec_t* mrec;
dtuple_t* dtuple;
ulint n_ext;
- b = row_merge_read_rec(block, &buf, b, index,
+ b = row_merge_read_rec(block, buf, b, index,
fd, &foffs, &mrec, offsets);
if (UNIV_UNLIKELY(!b)) {
/* End of list, or I/O error */
@@ -1984,14 +1989,12 @@ row_merge_drop_index(
/* Drop the field definitions of the index. */
"DELETE FROM SYS_FIELDS WHERE INDEX_ID = :indexid;\n"
/* Drop the index definition and the B-tree. */
- "DELETE FROM SYS_INDEXES WHERE ID = :indexid\n"
- " AND TABLE_ID = :tableid;\n"
+ "DELETE FROM SYS_INDEXES WHERE ID = :indexid;\n"
"END;\n";
ut_ad(index && table && trx);
pars_info_add_dulint_literal(info, "indexid", index->id);
- pars_info_add_dulint_literal(info, "tableid", table->id);
trx_start_if_not_started(trx);
trx->op_info = "dropping index";
@@ -2040,47 +2043,79 @@ row_merge_drop_temp_indexes(void)
/*=============================*/
{
trx_t* trx;
- ulint err;
-
- /* We use the private SQL parser of Innobase to generate the
- query graphs needed in deleting the dictionary data from system
- tables in Innobase. Deleting a row from SYS_INDEXES table also
- frees the file segments of the B-tree associated with the index. */
- static const char drop_temp_indexes[] =
- "PROCEDURE DROP_TEMP_INDEXES_PROC () IS\n"
- "indexid CHAR;\n"
- "DECLARE CURSOR c IS SELECT ID FROM SYS_INDEXES\n"
- "WHERE SUBSTR(NAME,0,1)='" TEMP_INDEX_PREFIX_STR "';\n"
- "BEGIN\n"
- "\tOPEN c;\n"
- "\tWHILE 1=1 LOOP\n"
- "\t\tFETCH c INTO indexid;\n"
- "\t\tIF (SQL % NOTFOUND) THEN\n"
- "\t\t\tEXIT;\n"
- "\t\tEND IF;\n"
- "\t\tDELETE FROM SYS_FIELDS WHERE INDEX_ID = indexid;\n"
- "\t\tDELETE FROM SYS_INDEXES WHERE ID = indexid;\n"
- "\tEND LOOP;\n"
- "\tCLOSE c;\n"
- "\tCOMMIT WORK;\n"
- "END;\n";
+ btr_pcur_t pcur;
+ mtr_t mtr;
+ /* Load the table definitions that contain partially defined
+ indexes, so that the data dictionary information can be checked
+ when accessing the tablename.ibd files. */
trx = trx_allocate_for_background();
trx->op_info = "dropping partially created indexes";
row_mysql_lock_data_dictionary(trx);
- /* Incomplete transactions may be holding some locks on the
- data dictionary tables. However, they should never have been
- able to lock the records corresponding to the partially
- created indexes that we are attempting to delete, because the
- table was locked when the indexes were being created. We will
- drop the partially created indexes before the rollback of
- incomplete transactions is initiated. Thus, this should not
- interfere with the incomplete transactions. */
- trx->isolation_level = TRX_ISO_READ_UNCOMMITTED;
- err = que_eval_sql(NULL, drop_temp_indexes, FALSE, trx);
- ut_a(err == DB_SUCCESS);
+ mtr_start(&mtr);
+
+ btr_pcur_open_at_index_side(
+ TRUE,
+ dict_table_get_first_index(dict_sys->sys_indexes),
+ BTR_SEARCH_LEAF, &pcur, TRUE, &mtr);
+
+ for (;;) {
+ const rec_t* rec;
+ const byte* field;
+ ulint len;
+ dulint table_id;
+ dict_table_t* table;
+ btr_pcur_move_to_next_user_rec(&pcur, &mtr);
+
+ if (!btr_pcur_is_on_user_rec(&pcur)) {
+ break;
+ }
+
+ rec = btr_pcur_get_rec(&pcur);
+ field = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_NAME_FIELD,
+ &len);
+ if (len == UNIV_SQL_NULL || len == 0
+ || (char) *field != TEMP_INDEX_PREFIX) {
+ continue;
+ }
+
+ /* This is a temporary index. */
+
+ field = rec_get_nth_field_old(rec, 0/*TABLE_ID*/, &len);
+ if (len != 8) {
+ /* Corrupted TABLE_ID */
+ continue;
+ }
+
+ table_id = mach_read_from_8(field);
+
+ btr_pcur_store_position(&pcur, &mtr);
+ btr_pcur_commit_specify_mtr(&pcur, &mtr);
+
+ table = dict_load_table_on_id(table_id);
+
+ if (table) {
+ dict_index_t* index;
+
+ for (index = dict_table_get_first_index(table);
+ index; index = dict_table_get_next_index(index)) {
+
+ if (*index->name == TEMP_INDEX_PREFIX) {
+ row_merge_drop_index(index, table, trx);
+ trx_commit_for_mysql(trx);
+ }
+ }
+ }
+
+ mtr_start(&mtr);
+ btr_pcur_restore_position(BTR_SEARCH_LEAF,
+ &pcur, &mtr);
+ }
+
+ btr_pcur_close(&pcur);
+ mtr_commit(&mtr);
row_mysql_unlock_data_dictionary(trx);
trx_free_for_background(trx);
}
diff --git a/storage/xtradb/row/row0mysql.c b/storage/xtradb/row/row0mysql.c
index 8585b816911..e520065ea04 100644
--- a/storage/xtradb/row/row0mysql.c
+++ b/storage/xtradb/row/row0mysql.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2000, 2010, Innobase Oy. All Rights Reserved.
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
@@ -485,7 +485,7 @@ next_column:
/****************************************************************//**
Handles user errors and lock waits detected by the database engine.
@return TRUE if it was a lock wait and we should continue running the
-query thread */
+query thread and in that case the thr is ALREADY in the running state. */
UNIV_INTERN
ibool
row_mysql_handle_errors(
@@ -1461,7 +1461,7 @@ row_unlock_for_mysql(
if (UNIV_UNLIKELY
(!srv_locks_unsafe_for_binlog
- && trx->isolation_level != TRX_ISO_READ_COMMITTED)) {
+ && trx->isolation_level > TRX_ISO_READ_COMMITTED)) {
fprintf(stderr,
"InnoDB: Error: calling row_unlock_for_mysql though\n"
@@ -3258,19 +3258,13 @@ check_next_foreign:
"END;\n"
, FALSE, trx);
- if (err != DB_SUCCESS) {
- ut_a(err == DB_OUT_OF_FILE_SPACE);
-
- err = DB_MUST_GET_MORE_FILE_SPACE;
-
- row_mysql_handle_errors(&err, trx, NULL, NULL);
-
- ut_error;
- } else {
- ibool is_path;
+ switch (err) {
+ ibool is_temp;
const char* name_or_path;
mem_heap_t* heap;
+ case DB_SUCCESS:
+
heap = mem_heap_create(200);
/* Clone the name, in case it has been allocated
@@ -3280,12 +3274,13 @@ check_next_foreign:
space_id = table->space;
if (table->dir_path_of_temp_table != NULL) {
- is_path = TRUE;
name_or_path = mem_heap_strdup(
heap, table->dir_path_of_temp_table);
+ is_temp = TRUE;
} else {
- is_path = FALSE;
name_or_path = name;
+ is_temp = (table->flags >> DICT_TF2_SHIFT)
+ & DICT_TF2_TEMPORARY;
}
dict_table_remove_from_cache(table);
@@ -3302,11 +3297,11 @@ check_next_foreign:
/* Do not drop possible .ibd tablespace if something went
wrong: we do not want to delete valuable data of the user */
- if (err == DB_SUCCESS && space_id > 0) {
+ if (err == DB_SUCCESS && !trx_sys_sys_space(space_id)) {
if (!fil_space_for_table_exists_in_mem(space_id,
name_or_path,
- is_path,
- FALSE, TRUE)) {
+ is_temp, FALSE,
+ !is_temp)) {
err = DB_SUCCESS;
fprintf(stderr,
@@ -3335,7 +3330,27 @@ check_next_foreign:
}
mem_heap_free(heap);
+ break;
+
+ case DB_TOO_MANY_CONCURRENT_TRXS:
+ /* Cannot even find a free slot for the
+ the undo log. We can directly exit here
+ and return the DB_TOO_MANY_CONCURRENT_TRXS
+ error. */
+ break;
+
+ case DB_OUT_OF_FILE_SPACE:
+ err = DB_MUST_GET_MORE_FILE_SPACE;
+
+ row_mysql_handle_errors(&err, trx, NULL, NULL);
+
+ /* Fall through to raise error */
+
+ default:
+ /* No other possible error returns */
+ ut_error;
}
+
funct_exit:
if (locked_dictionary) {
@@ -3351,6 +3366,90 @@ funct_exit:
return((int) err);
}
+/*********************************************************************//**
+Drop all temporary tables during crash recovery. */
+UNIV_INTERN
+void
+row_mysql_drop_temp_tables(void)
+/*============================*/
+{
+ trx_t* trx;
+ btr_pcur_t pcur;
+ mtr_t mtr;
+ mem_heap_t* heap;
+
+ trx = trx_allocate_for_background();
+ trx->op_info = "dropping temporary tables";
+ row_mysql_lock_data_dictionary(trx);
+
+ heap = mem_heap_create(200);
+
+ mtr_start(&mtr);
+
+ btr_pcur_open_at_index_side(
+ TRUE,
+ dict_table_get_first_index(dict_sys->sys_tables),
+ BTR_SEARCH_LEAF, &pcur, TRUE, &mtr);
+
+ for (;;) {
+ const rec_t* rec;
+ const byte* field;
+ ulint len;
+ const char* table_name;
+ dict_table_t* table;
+
+ btr_pcur_move_to_next_user_rec(&pcur, &mtr);
+
+ if (!btr_pcur_is_on_user_rec(&pcur)) {
+ break;
+ }
+
+ rec = btr_pcur_get_rec(&pcur);
+ field = rec_get_nth_field_old(rec, 4/*N_COLS*/, &len);
+ if (len != 4 || !(mach_read_from_4(field) & 0x80000000UL)) {
+ continue;
+ }
+
+ /* Because this is not a ROW_FORMAT=REDUNDANT table,
+ the is_temp flag is valid. Examine it. */
+
+ field = rec_get_nth_field_old(rec, 7/*MIX_LEN*/, &len);
+ if (len != 4
+ || !(mach_read_from_4(field) & DICT_TF2_TEMPORARY)) {
+ continue;
+ }
+
+ /* This is a temporary table. */
+ field = rec_get_nth_field_old(rec, 0/*NAME*/, &len);
+ if (len == UNIV_SQL_NULL || len == 0) {
+ /* Corrupted SYS_TABLES.NAME */
+ continue;
+ }
+
+ table_name = mem_heap_strdupl(heap, (const char*) field, len);
+
+ btr_pcur_store_position(&pcur, &mtr);
+ btr_pcur_commit_specify_mtr(&pcur, &mtr);
+
+ table = dict_load_table(table_name);
+
+ if (table) {
+ row_drop_table_for_mysql(table_name, trx, FALSE);
+ trx_commit_for_mysql(trx);
+ }
+
+ mtr_start(&mtr);
+ btr_pcur_restore_position(BTR_SEARCH_LEAF,
+ &pcur, &mtr);
+ }
+
+ btr_pcur_close(&pcur);
+ mtr_commit(&mtr);
+ mem_heap_free(heap);
+ row_mysql_unlock_data_dictionary(trx);
+ trx_free_for_background(trx);
+}
+
/*******************************************************************//**
Drop all foreign keys in a database, see Bug#18942.
Called at the end of row_drop_database_for_mysql().
@@ -3902,14 +4001,15 @@ Checks that the index contains entries in an ascending order, unique
constraint is not broken, and calculates the number of index entries
in the read view of the current transaction.
@return TRUE if ok */
-static
+UNIV_INTERN
ibool
-row_scan_and_check_index(
-/*=====================*/
- row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in MySQL */
- dict_index_t* index, /*!< in: index */
- ulint* n_rows) /*!< out: number of entries seen in the
- current consistent read */
+row_check_index_for_mysql(
+/*======================*/
+ row_prebuilt_t* prebuilt, /*!< in: prebuilt struct
+ in MySQL handle */
+ const dict_index_t* index, /*!< in: index */
+ ulint* n_rows) /*!< out: number of entries
+ seen in the consistent read */
{
dtuple_t* prev_entry = NULL;
ulint matched_fields;
@@ -3930,31 +4030,9 @@ row_scan_and_check_index(
*n_rows = 0;
- if (!row_merge_is_index_usable(prebuilt->trx, index)) {
- /* A newly created index may lack some delete-marked
- records that may exist in the read view of
- prebuilt->trx. Thus, such indexes must not be
- accessed by consistent read. */
- return(is_ok);
- }
-
buf = mem_alloc(UNIV_PAGE_SIZE);
heap = mem_heap_create(100);
- /* Make a dummy template in prebuilt, which we will use
- in scanning the index entries */
-
- prebuilt->index = index;
- /* row_merge_is_index_usable() was already checked above. */
- prebuilt->index_usable = TRUE;
- prebuilt->sql_stat_start = TRUE;
- prebuilt->template_type = ROW_MYSQL_DUMMY_TEMPLATE;
- prebuilt->n_template = 0;
- prebuilt->need_to_access_clustered = FALSE;
-
- dtuple_set_n_fields(prebuilt->search_tuple, 0);
-
- prebuilt->select_lock_type = LOCK_NONE;
cnt = 1000;
ret = row_search_for_mysql(buf, PAGE_CUR_G, prebuilt, 0, 0);
@@ -4073,119 +4151,6 @@ not_ok:
}
/*********************************************************************//**
-Checks a table for corruption.
-@return DB_ERROR or DB_SUCCESS */
-UNIV_INTERN
-ulint
-row_check_table_for_mysql(
-/*======================*/
- row_prebuilt_t* prebuilt) /*!< in: prebuilt struct in MySQL
- handle */
-{
- dict_table_t* table = prebuilt->table;
- dict_index_t* index;
- ulint n_rows;
- ulint n_rows_in_table = ULINT_UNDEFINED;
- ulint ret = DB_SUCCESS;
- ulint old_isolation_level;
-
- if (table->ibd_file_missing) {
- ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: Error:\n"
- "InnoDB: MySQL is trying to use a table handle"
- " but the .ibd file for\n"
- "InnoDB: table %s does not exist.\n"
- "InnoDB: Have you deleted the .ibd file"
- " from the database directory under\n"
- "InnoDB: the MySQL datadir, or have you"
- " used DISCARD TABLESPACE?\n"
- "InnoDB: Look from\n"
- "InnoDB: " REFMAN "innodb-troubleshooting.html\n"
- "InnoDB: how you can resolve the problem.\n",
- table->name);
- return(DB_ERROR);
- }
-
- prebuilt->trx->op_info = "checking table";
-
- old_isolation_level = prebuilt->trx->isolation_level;
-
- /* We must run the index record counts at an isolation level
- >= READ COMMITTED, because a dirty read can see a wrong number
- of records in some index; to play safe, we use always
- REPEATABLE READ here */
-
- prebuilt->trx->isolation_level = TRX_ISO_REPEATABLE_READ;
-
- /* Enlarge the fatal lock wait timeout during CHECK TABLE. */
- mutex_enter(&kernel_mutex);
- srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
- mutex_exit(&kernel_mutex);
-
- index = dict_table_get_first_index(table);
-
- while (index != NULL) {
- /* fputs("Validating index ", stderr);
- ut_print_name(stderr, trx, FALSE, index->name);
- putc('\n', stderr); */
-
- if (!btr_validate_index(index, prebuilt->trx)) {
- ret = DB_ERROR;
- } else {
- if (!row_scan_and_check_index(prebuilt,index, &n_rows)){
- ret = DB_ERROR;
- }
-
- if (trx_is_interrupted(prebuilt->trx)) {
- ret = DB_INTERRUPTED;
- break;
- }
-
- /* fprintf(stderr, "%lu entries in index %s\n", n_rows,
- index->name); */
-
- if (index == dict_table_get_first_index(table)) {
- n_rows_in_table = n_rows;
- } else if (n_rows != n_rows_in_table) {
-
- ret = DB_ERROR;
-
- fputs("Error: ", stderr);
- dict_index_name_print(stderr,
- prebuilt->trx, index);
- fprintf(stderr,
- " contains %lu entries,"
- " should be %lu\n",
- (ulong) n_rows,
- (ulong) n_rows_in_table);
- }
- }
-
- index = dict_table_get_next_index(index);
- }
-
- /* Restore the original isolation level */
- prebuilt->trx->isolation_level = old_isolation_level;
-
- /* We validate also the whole adaptive hash index for all tables
- at every CHECK TABLE */
-
- if (!btr_search_validate()) {
-
- ret = DB_ERROR;
- }
-
- /* Restore the fatal lock wait timeout after CHECK TABLE. */
- mutex_enter(&kernel_mutex);
- srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
- mutex_exit(&kernel_mutex);
-
- prebuilt->trx->op_info = "";
-
- return(ret);
-}
-
-/*********************************************************************//**
Determines if a table is a magic monitor table.
@return TRUE if monitor table */
UNIV_INTERN
diff --git a/storage/xtradb/row/row0row.c b/storage/xtradb/row/row0row.c
index 128ac3ba3e8..cb7dfa2b7c9 100644
--- a/storage/xtradb/row/row0row.c
+++ b/storage/xtradb/row/row0row.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -915,6 +915,10 @@ row_raw_format(
ret = row_raw_format_int(data, data_len, prtype,
buf, buf_size, &format_in_hex);
+ if (format_in_hex) {
+
+ goto format_in_hex;
+ }
break;
case DATA_CHAR:
case DATA_VARCHAR:
@@ -923,14 +927,15 @@ row_raw_format(
ret = row_raw_format_str(data, data_len, prtype,
buf, buf_size, &format_in_hex);
+ if (format_in_hex) {
+
+ goto format_in_hex;
+ }
+
break;
/* XXX support more data types */
default:
-
- format_in_hex = TRUE;
- }
-
- if (format_in_hex) {
+ format_in_hex:
if (UNIV_LIKELY(buf_size > 2)) {
diff --git a/storage/xtradb/row/row0sel.c b/storage/xtradb/row/row0sel.c
index 1d5d525cca6..43e67ff6ded 100644
--- a/storage/xtradb/row/row0sel.c
+++ b/storage/xtradb/row/row0sel.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -132,7 +132,8 @@ index record.
NOTE: the comparison is NOT done as a binary comparison, but character
fields are compared with collation!
@return TRUE if the secondary record is equal to the corresponding
-fields in the clustered record, when compared with collation */
+fields in the clustered record, when compared with collation;
+FALSE if not equal or if the clustered record has been marked for deletion */
static
ibool
row_sel_sec_rec_is_for_clust_rec(
@@ -431,10 +432,6 @@ row_sel_fetch_columns(
data = rec_get_nth_field(rec, offsets,
field_no, &len);
- if (len == UNIV_SQL_NULL) {
- len = UNIV_SQL_NULL;
- }
-
needs_copy = column->copy_val;
}
@@ -855,7 +852,7 @@ row_sel_get_clust_rec(
trx = thr_get_trx(thr);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
lock_type = LOCK_REC_NOT_GAP;
} else {
lock_type = LOCK_ORDINARY;
@@ -1468,7 +1465,7 @@ rec_loop:
if (srv_locks_unsafe_for_binlog
|| trx->isolation_level
- == TRX_ISO_READ_COMMITTED) {
+ <= TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(next_rec)) {
@@ -1525,7 +1522,7 @@ skip_lock:
trx = thr_get_trx(thr);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(rec)) {
@@ -2170,36 +2167,6 @@ row_fetch_print(
return((void*)42);
}
-/****************************************************************//**
-Callback function for fetch that stores an unsigned 4 byte integer to the
-location pointed. The column's type must be DATA_INT, DATA_UNSIGNED, length
-= 4.
-@return always returns NULL */
-UNIV_INTERN
-void*
-row_fetch_store_uint4(
-/*==================*/
- void* row, /*!< in: sel_node_t* */
- void* user_arg) /*!< in: data pointer */
-{
- sel_node_t* node = row;
- ib_uint32_t* val = user_arg;
- ulint tmp;
-
- dfield_t* dfield = que_node_get_val(node->select_list);
- const dtype_t* type = dfield_get_type(dfield);
- ulint len = dfield_get_len(dfield);
-
- ut_a(dtype_get_mtype(type) == DATA_INT);
- ut_a(dtype_get_prtype(type) & DATA_UNSIGNED);
- ut_a(len == 4);
-
- tmp = mach_read_from_4(dfield_get_data(dfield));
- *val = (ib_uint32_t) tmp;
-
- return(NULL);
-}
-
/***********************************************************//**
Prints a row in a select result.
@return query thread to run next or NULL */
@@ -2696,6 +2663,12 @@ row_sel_store_mysql_rec(
prebuilt->blob_heap = NULL;
}
+ /* init null bytes with default values as they might be
+ left uninitialized in some cases and these uninited bytes
+ might be copied into mysql record buffer that leads to
+ valgrind warnings */
+ memcpy(mysql_rec, prebuilt->default_rec, prebuilt->null_bitmap_len);
+
for (i = 0; i < prebuilt->n_template; i++) {
templ = prebuilt->mysql_template + i;
@@ -2981,6 +2954,7 @@ row_sel_get_clust_rec_for_mysql(
if (clust_rec
&& (old_vers
+ || trx->isolation_level <= TRX_ISO_READ_UNCOMMITTED
|| rec_get_deleted_flag(rec, dict_table_is_comp(
sec_index->table)))
&& !row_sel_sec_rec_is_for_clust_rec(
@@ -3202,14 +3176,17 @@ row_sel_try_search_shortcut_for_mysql(
ut_ad(dict_index_is_clust(index));
ut_ad(!prebuilt->templ_contains_blob);
+#ifndef UNIV_SEARCH_DEBUG
btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, pcur,
-#ifndef UNIV_SEARCH_DEBUG
RW_S_LATCH,
-#else
+ mtr);
+#else /* UNIV_SEARCH_DEBUG */
+ btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE,
+ BTR_SEARCH_LEAF, pcur,
0,
-#endif
mtr);
+#endif /* UNIV_SEARCH_DEBUG */
rec = btr_pcur_get_rec(pcur);
if (!page_rec_is_user_rec(rec)) {
@@ -3694,7 +3671,7 @@ shortcut_fails_too_big_rec:
&& !page_rec_is_supremum(rec)
&& set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the next index record
@@ -3797,7 +3774,7 @@ rec_loop:
if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a lock on the index record */
@@ -3931,7 +3908,7 @@ wrong_offs:
if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
|| trx->isolation_level
- == TRX_ISO_READ_COMMITTED)
+ <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the index
@@ -3967,7 +3944,7 @@ wrong_offs:
if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
|| trx->isolation_level
- == TRX_ISO_READ_COMMITTED)
+ <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the index
@@ -4015,7 +3992,7 @@ wrong_offs:
if (!set_also_gap_locks
|| srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED
|| (unique_search
&& !UNIV_UNLIKELY(rec_get_deleted_flag(rec, comp)))) {
@@ -4054,7 +4031,7 @@ no_gap_lock:
const rec_t* old_vers;
case DB_SUCCESS:
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
/* Note that a record of
prebuilt->index was locked. */
prebuilt->new_rec_locks = 1;
@@ -4063,6 +4040,7 @@ no_gap_lock:
case DB_LOCK_WAIT:
if (UNIV_LIKELY(prebuilt->row_read_type
!= ROW_READ_TRY_SEMI_CONSISTENT)
+ || unique_search
|| index != clust_index) {
goto lock_wait_or_error;
@@ -4186,7 +4164,7 @@ no_gap_lock:
/* The record is delete-marked: we can skip it */
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE
&& !did_semi_consistent_read) {
@@ -4253,7 +4231,7 @@ requires_clust_rec:
}
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Note that both the secondary index record
and the clustered index record were locked. */
@@ -4266,7 +4244,7 @@ requires_clust_rec:
/* The record is delete marked: we can skip it */
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* No need to keep a lock on a delete-marked
@@ -4477,7 +4455,7 @@ lock_wait_or_error:
moves_up, &mtr);
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& !same_user_rec) {
/* Since we were not able to restore the cursor
@@ -4641,7 +4619,6 @@ row_search_autoinc_read_column(
ut_a(len != UNIV_SQL_NULL);
- /* we assume AUTOINC value cannot be negative */
switch (mtype) {
case DATA_INT:
ut_a(len <= sizeof value);
@@ -4650,12 +4627,12 @@ row_search_autoinc_read_column(
case DATA_FLOAT:
ut_a(len == sizeof(float));
- value = mach_float_read(data);
+ value = (ib_uint64_t) mach_float_read(data);
break;
case DATA_DOUBLE:
ut_a(len == sizeof(double));
- value = mach_double_read(data);
+ value = (ib_uint64_t) mach_double_read(data);
break;
default:
diff --git a/storage/xtradb/row/row0umod.c b/storage/xtradb/row/row0umod.c
index 6be475d8c78..e7245dbee41 100644
--- a/storage/xtradb/row/row0umod.c
+++ b/storage/xtradb/row/row0umod.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved.
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
@@ -144,13 +144,17 @@ row_undo_mod_clust_low(
/***********************************************************//**
Removes a clustered index record after undo if possible.
+This is attempted when the record was inserted by updating a
+delete-marked record and there no longer exist transactions
+that would see the delete-marked record. In other words, we
+roll back the insert by purging the record.
@return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */
static
ulint
row_undo_mod_remove_clust_low(
/*==========================*/
undo_node_t* node, /*!< in: row undo node */
- que_thr_t* thr __attribute__((unused)), /*!< in: query thread */
+ que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr, /*!< in: mtr */
ulint mode) /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */
{
@@ -159,6 +163,7 @@ row_undo_mod_remove_clust_low(
ulint err;
ibool success;
+ ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC);
pcur = &(node->pcur);
btr_cur = btr_pcur_get_btr_cur(pcur);
@@ -190,11 +195,13 @@ row_undo_mod_remove_clust_low(
} else {
ut_ad(mode == BTR_MODIFY_TREE);
- /* Note that since this operation is analogous to purge,
- we can free also inherited externally stored fields:
- hence the RB_NONE in the call below */
+ /* This operation is analogous to purge, we can free also
+ inherited externally stored fields */
- btr_cur_pessimistic_delete(&err, FALSE, btr_cur, RB_NONE, mtr);
+ btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
+ thr_is_recv(thr)
+ ? RB_RECOVERY_PURGE_REC
+ : RB_NONE, mtr);
/* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database
@@ -370,10 +377,11 @@ row_undo_mod_del_mark_or_remove_sec_low(
} else {
ut_ad(mode == BTR_MODIFY_TREE);
- /* No need to distinguish RB_RECOVERY here, because we
- are deleting a secondary index record: the distinction
- between RB_NORMAL and RB_RECOVERY only matters when
- deleting a record that contains externally stored
+ /* No need to distinguish RB_RECOVERY_PURGE here,
+ because we are deleting a secondary index record:
+ the distinction between RB_NORMAL and
+ RB_RECOVERY_PURGE only matters when deleting a
+ record that contains externally stored
columns. */
ut_ad(!dict_index_is_clust(index));
btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
@@ -438,7 +446,7 @@ row_undo_mod_del_unmark_sec_and_undo_update(
BTR_MODIFY_TREE */
que_thr_t* thr, /*!< in: query thread */
dict_index_t* index, /*!< in: index */
- dtuple_t* entry) /*!< in: index entry */
+ const dtuple_t* entry) /*!< in: index entry */
{
mem_heap_t* heap;
btr_pcur_t pcur;
@@ -533,6 +541,7 @@ row_undo_mod_upd_del_sec(
dict_index_t* index;
ulint err = DB_SUCCESS;
+ ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC);
heap = mem_heap_create(1024);
while (node->index != NULL) {
@@ -550,7 +559,7 @@ row_undo_mod_upd_del_sec(
does not exist. However, this situation may
only occur during the rollback of incomplete
transactions. */
- ut_a(trx_is_recv(thr_get_trx(thr)));
+ ut_a(thr_is_recv(thr));
} else {
err = row_undo_mod_del_mark_or_remove_sec(
node, thr, index, entry);
diff --git a/storage/xtradb/row/row0upd.c b/storage/xtradb/row/row0upd.c
index 58dfd43ead9..95d1d00aeef 100644
--- a/storage/xtradb/row/row0upd.c
+++ b/storage/xtradb/row/row0upd.c
@@ -1344,9 +1344,6 @@ row_upd_copy_columns(
data = rec_get_nth_field(rec, offsets,
column->field_nos[SYM_CLUST_FIELD_NO],
&len);
- if (len == UNIV_SQL_NULL) {
- len = UNIV_SQL_NULL;
- }
eval_node_copy_and_alloc_val(column, data, len);
column = UT_LIST_GET_NEXT(col_var_list, column);
diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c
index e655c4e844d..86bf309bac1 100644
--- a/storage/xtradb/srv/srv0srv.c
+++ b/storage/xtradb/srv/srv0srv.c
@@ -1,7 +1,8 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
+Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are
incorporated with their permission, and subject to the conditions contained in
the file COPYING.Google.
+Portions of this file contain modifications contributed and copyrighted
+by Percona Inc.. Those modifications are
+gratefully acknowledged and are described briefly in the InnoDB
+documentation. The contributions by Percona Inc. are incorporated with
+their permission, and subject to the conditions contained in the file
+COPYING.Percona.
+
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.
@@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-/***********************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
-Copyright (c) 2009, Percona Inc.
-
-Portions of this file contain modifications contributed and copyrighted
-by Percona Inc.. Those modifications are
-gratefully acknowledged and are described briefly in the InnoDB
-documentation. The contributions by Percona Inc. are incorporated with
-their permission, and subject to the conditions contained in the file
-COPYING.Percona.
-
-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
-
-***********************************************************************/
/**************************************************//**
@file srv/srv0srv.c
@@ -122,7 +104,8 @@ UNIV_INTERN ulint srv_fatal_semaphore_wait_threshold = 600;
in microseconds, in order to reduce the lagging of the purge thread. */
UNIV_INTERN ulint srv_dml_needed_delay = 0;
-UNIV_INTERN ibool srv_lock_timeout_and_monitor_active = FALSE;
+UNIV_INTERN ibool srv_lock_timeout_active = FALSE;
+UNIV_INTERN ibool srv_monitor_active = FALSE;
UNIV_INTERN ibool srv_error_monitor_active = FALSE;
UNIV_INTERN const char* srv_main_thread_op_info = "";
@@ -162,9 +145,10 @@ UNIV_INTERN char** srv_data_file_names = NULL;
/* size in database pages */
UNIV_INTERN ulint* srv_data_file_sizes = NULL;
+UNIV_INTERN char* srv_doublewrite_file = NULL;
+
UNIV_INTERN ibool srv_extra_undoslots = FALSE;
-UNIV_INTERN ibool srv_fast_recovery = FALSE;
UNIV_INTERN ibool srv_recovery_stats = FALSE;
UNIV_INTERN ulint srv_use_purge_thread = 0;
@@ -198,11 +182,20 @@ UNIV_INTERN ulong srv_flush_log_at_trx_commit = 1;
the checkpoints. */
UNIV_INTERN char srv_adaptive_flushing = TRUE;
-UNIV_INTERN ulong srv_show_locks_held = 10;
-UNIV_INTERN ulong srv_show_verbose_locks = 0;
+UNIV_INTERN ulong srv_show_locks_held = 10;
+UNIV_INTERN ulong srv_show_verbose_locks = 0;
+/** Maximum number of times allowed to conditionally acquire
+mutex before switching to blocking wait on the mutex */
+#define MAX_MUTEX_NOWAIT 20
-/* The sort order table of the MySQL latin1_swedish_ci character set
+/** Check whether the number of failed nonblocking mutex
+acquisition attempts exceeds maximum allowed value. If so,
+srv_printf_innodb_monitor() will request mutex acquisition
+with mutex_enter(), which will wait until it gets the mutex. */
+#define MUTEX_NOWAIT(mutex_skipped) ((mutex_skipped) < MAX_MUTEX_NOWAIT)
+
+/** The sort order table of the MySQL latin1_swedish_ci character set
collation */
UNIV_INTERN const byte* srv_latin1_ordering;
@@ -410,7 +403,6 @@ UNIV_INTERN ulong srv_read_ahead = 3; /* 1: random 2: linear 3: Both */
UNIV_INTERN ulong srv_adaptive_checkpoint = 0; /* 0: none 1: reflex 2: estimate */
UNIV_INTERN ulong srv_expand_import = 0; /* 0:disable 1:enable */
-UNIV_INTERN ulint srv_relax_table_creation = 0; /* 0:disable 1:enable */
UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */
UNIV_INTERN ulong srv_extra_rsegments = 0; /* extra rseg for users */
@@ -439,7 +431,7 @@ static ulint srv_n_rows_inserted_old = 0;
static ulint srv_n_rows_updated_old = 0;
static ulint srv_n_rows_deleted_old = 0;
static ulint srv_n_rows_read_old = 0;
-
+UNIV_INTERN ulint srv_n_lock_deadlock_count = 0;
UNIV_INTERN ulint srv_n_lock_wait_count = 0;
UNIV_INTERN ulint srv_n_lock_wait_current_count = 0;
UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0;
@@ -1766,8 +1758,9 @@ srv_suspend_mysql_thread(
innodb_lock_wait_timeout, because trx->mysql_thd == NULL. */
lock_wait_timeout = thd_lock_wait_timeout(trx->mysql_thd);
- if (lock_wait_timeout < 100000000
- && wait_time > (double) lock_wait_timeout) {
+ if (trx_is_interrupted(trx)
+ || (lock_wait_timeout < 100000000
+ && wait_time > (double) lock_wait_timeout)) {
trx->error_state = DB_LOCK_WAIT_TIMEOUT;
}
@@ -1833,12 +1826,15 @@ srv_refresh_innodb_monitor_stats(void)
}
/******************************************************************//**
-Outputs to a file the output of the InnoDB Monitor. */
+Outputs to a file the output of the InnoDB Monitor.
+@return FALSE if not all information printed
+due to failure to obtain necessary mutex */
UNIV_INTERN
-void
+ibool
srv_printf_innodb_monitor(
/*======================*/
FILE* file, /*!< in: output stream */
+ ibool nowait, /*!< in: whether to wait for kernel mutex */
ulint* trx_start, /*!< out: file position of the start of
the list of active transactions */
ulint* trx_end) /*!< out: file position of the end of
@@ -1847,6 +1843,7 @@ srv_printf_innodb_monitor(
double time_elapsed;
time_t current_time;
ulint n_reserved;
+ ibool ret;
ulint btr_search_sys_subtotal;
ulint lock_sys_subtotal;
@@ -1877,9 +1874,9 @@ srv_printf_innodb_monitor(
"Per second averages calculated from the last %lu seconds\n",
(ulong)time_elapsed);
- fputs("----------\n"
- "BACKGROUND THREAD\n"
- "----------\n", file);
+ fputs("-----------------\n"
+ "BACKGROUND THREAD\n"
+ "-----------------\n", file);
srv_print_master_thread_info(file);
fputs("----------\n"
@@ -2069,22 +2066,28 @@ srv_printf_innodb_monitor(
srv_n_rows_deleted_old = srv_n_rows_deleted;
srv_n_rows_read_old = srv_n_rows_read;
- lock_print_info_summary(file);
- if (trx_start) {
- long t = ftell(file);
- if (t < 0) {
- *trx_start = ULINT_UNDEFINED;
- } else {
- *trx_start = (ulint) t;
+ /* Only if lock_print_info_summary proceeds correctly,
+ before we call the lock_print_info_all_transactions
+ to print all the lock information. */
+ ret = lock_print_info_summary(file, nowait);
+
+ if (ret) {
+ if (trx_start) {
+ long t = ftell(file);
+ if (t < 0) {
+ *trx_start = ULINT_UNDEFINED;
+ } else {
+ *trx_start = (ulint) t;
+ }
}
- }
- lock_print_info_all_transactions(file);
- if (trx_end) {
- long t = ftell(file);
- if (t < 0) {
- *trx_end = ULINT_UNDEFINED;
- } else {
- *trx_end = (ulint) t;
+ lock_print_info_all_transactions(file);
+ if (trx_end) {
+ long t = ftell(file);
+ if (t < 0) {
+ *trx_end = ULINT_UNDEFINED;
+ } else {
+ *trx_end = (ulint) t;
+ }
}
}
@@ -2093,6 +2096,8 @@ srv_printf_innodb_monitor(
"============================\n", file);
mutex_exit(&srv_innodb_monitor_mutex);
fflush(file);
+
+ return(ret);
}
/******************************************************************//**
@@ -2133,6 +2138,8 @@ srv_export_innodb_status(void)
= UT_LIST_GET_LEN(buf_pool->flush_list);
export_vars.innodb_buffer_pool_pages_free
= UT_LIST_GET_LEN(buf_pool->free);
+ export_vars.innodb_deadlocks
+ = srv_n_lock_deadlock_count;
#ifdef UNIV_DEBUG
export_vars.innodb_buffer_pool_pages_latched
= buf_get_latched_pages_number();
@@ -2181,26 +2188,23 @@ srv_export_innodb_status(void)
}
/*********************************************************************//**
-A thread which wakes up threads whose lock wait may have lasted too long.
-This also prints the info output by various InnoDB monitors.
+A thread which prints the info output by various InnoDB monitors.
@return a dummy parameter */
UNIV_INTERN
os_thread_ret_t
-srv_lock_timeout_and_monitor_thread(
-/*================================*/
+srv_monitor_thread(
+/*===============*/
void* arg __attribute__((unused)))
/*!< in: a dummy parameter required by
os_thread_create */
{
- srv_slot_t* slot;
double time_elapsed;
time_t current_time;
time_t last_table_monitor_time;
time_t last_tablespace_monitor_time;
time_t last_monitor_time;
- ibool some_waits;
- double wait_time;
- ulint i;
+ ulint mutex_skipped;
+ ibool last_srv_print_monitor;
#ifdef UNIV_DEBUG_THREAD_CREATION
fprintf(stderr, "Lock timeout thread starts, id %lu\n",
@@ -2211,13 +2215,15 @@ srv_lock_timeout_and_monitor_thread(
last_table_monitor_time = time(NULL);
last_tablespace_monitor_time = time(NULL);
last_monitor_time = time(NULL);
+ mutex_skipped = 0;
+ last_srv_print_monitor = srv_print_innodb_monitor;
loop:
- srv_lock_timeout_and_monitor_active = TRUE;
+ srv_monitor_active = TRUE;
- /* When someone is waiting for a lock, we wake up every second
- and check if a timeout has passed for a lock wait */
+ /* Wake up every 5 seconds to see if we need to print
+ monitor information. */
- os_thread_sleep(1000000);
+ os_thread_sleep(5000000);
current_time = time(NULL);
@@ -2227,14 +2233,40 @@ loop:
last_monitor_time = time(NULL);
if (srv_print_innodb_monitor) {
- srv_printf_innodb_monitor(stderr, NULL, NULL);
+ /* Reset mutex_skipped counter everytime
+ srv_print_innodb_monitor changes. This is to
+ ensure we will not be blocked by kernel_mutex
+ for short duration information printing,
+ such as requested by sync_array_print_long_waits() */
+ if (!last_srv_print_monitor) {
+ mutex_skipped = 0;
+ last_srv_print_monitor = TRUE;
+ }
+
+ if (!srv_printf_innodb_monitor(stderr,
+ MUTEX_NOWAIT(mutex_skipped),
+ NULL, NULL)) {
+ mutex_skipped++;
+ } else {
+ /* Reset the counter */
+ mutex_skipped = 0;
+ }
+ } else {
+ last_srv_print_monitor = FALSE;
}
+
if (srv_innodb_status) {
mutex_enter(&srv_monitor_file_mutex);
rewind(srv_monitor_file);
- srv_printf_innodb_monitor(srv_monitor_file, NULL,
- NULL);
+ if (!srv_printf_innodb_monitor(srv_monitor_file,
+ MUTEX_NOWAIT(mutex_skipped),
+ NULL, NULL)) {
+ mutex_skipped++;
+ } else {
+ mutex_skipped = 0;
+ }
+
os_file_set_eof(srv_monitor_file);
mutex_exit(&srv_monitor_file_mutex);
}
@@ -2287,6 +2319,56 @@ loop:
}
}
+ if (srv_shutdown_state >= SRV_SHUTDOWN_CLEANUP) {
+ goto exit_func;
+ }
+
+ if (srv_print_innodb_monitor
+ || srv_print_innodb_lock_monitor
+ || srv_print_innodb_tablespace_monitor
+ || srv_print_innodb_table_monitor) {
+ goto loop;
+ }
+
+ srv_monitor_active = FALSE;
+
+ goto loop;
+
+exit_func:
+ srv_monitor_active = FALSE;
+
+ /* We count the number of threads in os_thread_exit(). A created
+ thread should always use that to exit and not use return() to exit. */
+
+ os_thread_exit(NULL);
+
+ OS_THREAD_DUMMY_RETURN;
+}
+
+/*********************************************************************//**
+A thread which wakes up threads whose lock wait may have lasted too long.
+@return a dummy parameter */
+UNIV_INTERN
+os_thread_ret_t
+srv_lock_timeout_thread(
+/*====================*/
+ void* arg __attribute__((unused)))
+ /* in: a dummy parameter required by
+ os_thread_create */
+{
+ srv_slot_t* slot;
+ ibool some_waits;
+ double wait_time;
+ ulint i;
+
+loop:
+ /* When someone is waiting for a lock, we wake up every second
+ and check if a timeout has passed for a lock wait */
+
+ os_thread_sleep(1000000);
+
+ srv_lock_timeout_active = TRUE;
+
mutex_enter(&kernel_mutex);
some_waits = FALSE;
@@ -2310,9 +2392,10 @@ loop:
lock_wait_timeout = thd_lock_wait_timeout(
trx->mysql_thd);
- if (lock_wait_timeout < 100000000
- && (wait_time > (double) lock_wait_timeout
- || wait_time < 0)) {
+ if (trx_is_interrupted(trx)
+ || (lock_wait_timeout < 100000000
+ && (wait_time > (double) lock_wait_timeout
+ || wait_time < 0))) {
/* Timeout exceeded or a wrap-around in system
time counter: cancel the lock request queued
@@ -2337,17 +2420,11 @@ loop:
goto exit_func;
}
- if (some_waits || srv_print_innodb_monitor
- || srv_print_innodb_lock_monitor
- || srv_print_innodb_tablespace_monitor
- || srv_print_innodb_table_monitor) {
+ if (some_waits) {
goto loop;
}
- /* No one was waiting for a lock and no monitor was active:
- suspend this thread */
-
- srv_lock_timeout_and_monitor_active = FALSE;
+ srv_lock_timeout_active = FALSE;
#if 0
/* The following synchronisation is disabled, since
@@ -2357,7 +2434,7 @@ loop:
goto loop;
exit_func:
- srv_lock_timeout_and_monitor_active = FALSE;
+ srv_lock_timeout_active = FALSE;
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
@@ -2706,7 +2783,10 @@ loop:
BUF_FLUSH_LIST,
n_flush,
IB_ULONGLONG_MAX);
- skip_sleep = TRUE;
+
+ if (n_flush == PCT_IO(100)) {
+ skip_sleep = TRUE;
+ }
}
mutex_enter(&(log_sys->mutex));
diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c
index dcc13ea17b6..7b5581a24f0 100644
--- a/storage/xtradb/srv/srv0start.c
+++ b/storage/xtradb/srv/srv0start.c
@@ -1,7 +1,8 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
+Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are
incorporated with their permission, and subject to the conditions contained in
the file COPYING.Google.
+Portions of this file contain modifications contributed and copyrighted
+by Percona Inc.. Those modifications are
+gratefully acknowledged and are described briefly in the InnoDB
+documentation. The contributions by Percona Inc. are incorporated with
+their permission, and subject to the conditions contained in the file
+COPYING.Percona.
+
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.
@@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-/***********************************************************************
-
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
-Copyright (c) 2009, Percona Inc.
-
-Portions of this file contain modifications contributed and copyrighted
-by Percona Inc.. Those modifications are
-gratefully acknowledged and are described briefly in the InnoDB
-documentation. The contributions by Percona Inc. are incorporated with
-their permission, and subject to the conditions contained in the file
-COPYING.Percona.
-
-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
-
-***********************************************************************/
/********************************************************************//**
@file srv/srv0start.c
@@ -105,6 +87,7 @@ Created 2/16/1996 Heikki Tuuri
# include "btr0pcur.h"
# include "thr0loc.h"
# include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
+# include "zlib.h" /* for ZLIB_VERSION */
/** Log sequence number immediately after startup */
UNIV_INTERN ib_uint64_t srv_start_lsn;
@@ -143,9 +126,9 @@ static mutex_t ios_mutex;
static ulint ios;
/** io_handler_thread parameters for thread identification */
-static ulint n[SRV_MAX_N_IO_THREADS + 5 + 64];
+static ulint n[SRV_MAX_N_IO_THREADS + 6 + 64];
/** io_handler_thread identifiers */
-static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 5 + 64];
+static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 6 + 64];
/** We use this mutex to test the return value of pthread_mutex_trylock
on successful locking. HP-UX does NOT return 0, though Linux et al do. */
@@ -728,6 +711,7 @@ open_or_create_data_files(
/*======================*/
ibool* create_new_db, /*!< out: TRUE if new database should be
created */
+ ibool* create_new_doublewrite_file,
#ifdef UNIV_LOG_ARCHIVE
ulint* min_arch_log_no,/*!< out: min of archived log
numbers in data files */
@@ -760,6 +744,7 @@ open_or_create_data_files(
*sum_of_new_sizes = 0;
*create_new_db = FALSE;
+ *create_new_doublewrite_file = FALSE;
srv_normalize_path_for_win(srv_data_home);
@@ -992,6 +977,142 @@ skip_size_check:
srv_data_file_is_raw_partition[i] != 0);
}
+ /* special file for doublewrite buffer */
+ if (srv_doublewrite_file)
+ {
+ srv_normalize_path_for_win(srv_doublewrite_file);
+
+ fprintf(stderr,
+ "InnoDB: Notice: innodb_doublewrite_file is specified.\n"
+ "InnoDB: This is for expert only. Don't use if you don't understand what is it 'WELL'.\n"
+ "InnoDB: ### Don't specify older file than the last checkpoint ###\n"
+ "InnoDB: otherwise the older doublewrite buffer will break your data during recovery!\n");
+
+ strcpy(name, srv_doublewrite_file);
+
+ /* First we try to create the file: if it already
+ exists, ret will get value FALSE */
+
+ files[i] = os_file_create(name, OS_FILE_CREATE,
+ OS_FILE_NORMAL,
+ OS_DATA_FILE, &ret);
+
+ if (ret == FALSE && os_file_get_last_error(FALSE)
+ != OS_FILE_ALREADY_EXISTS
+#ifdef UNIV_AIX
+ /* AIX 5.1 after security patch ML7 may have
+ errno set to 0 here, which causes our function
+ to return 100; work around that AIX problem */
+ && os_file_get_last_error(FALSE) != 100
+#endif
+ ) {
+ fprintf(stderr,
+ "InnoDB: Error in creating"
+ " or opening %s\n",
+ name);
+
+ return(DB_ERROR);
+ }
+
+ if (ret == FALSE) {
+ /* We open the data file */
+
+ files[i] = os_file_create(
+ name, OS_FILE_OPEN, OS_FILE_NORMAL,
+ OS_DATA_FILE, &ret);
+
+ if (!ret) {
+ fprintf(stderr,
+ "InnoDB: Error in opening %s\n", name);
+ os_file_get_last_error(TRUE);
+
+ return(DB_ERROR);
+ }
+
+ ret = os_file_get_size(files[i], &size, &size_high);
+ ut_a(ret);
+ /* Round size downward to megabytes */
+
+ rounded_size_pages
+ = (size / (1024 * 1024) + 4096 * size_high)
+ << (20 - UNIV_PAGE_SIZE_SHIFT);
+
+ if (rounded_size_pages != TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9) {
+
+ fprintf(stderr,
+ "InnoDB: Warning: doublewrite buffer file %s"
+ " is of a different size\n"
+ "InnoDB: %lu pages"
+ " (rounded down to MB)\n"
+ "InnoDB: than intended size"
+ " %lu pages...\n",
+ name,
+ (ulong) rounded_size_pages,
+ (ulong) TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9);
+ }
+
+ fil_read_flushed_lsn_and_arch_log_no(
+ files[i], one_opened,
+#ifdef UNIV_LOG_ARCHIVE
+ min_arch_log_no, max_arch_log_no,
+#endif /* UNIV_LOG_ARCHIVE */
+ min_flushed_lsn, max_flushed_lsn);
+ one_opened = TRUE;
+ } else {
+ /* We created the data file and now write it full of
+ zeros */
+
+ *create_new_doublewrite_file = TRUE;
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Doublewrite buffer file %s did not"
+ " exist: new to be created\n",
+ name);
+
+ if (*create_new_db == FALSE) {
+ fprintf(stderr,
+ "InnoDB: Warning: Previous version's ibdata files may cause crash.\n"
+ " If you use that, please use the ibdata files of this version.\n");
+ }
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Setting file %s size to %lu MB\n",
+ name,
+ (ulong) ((TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9)
+ >> (20 - UNIV_PAGE_SIZE_SHIFT)));
+
+ fprintf(stderr,
+ "InnoDB: Database physically writes the"
+ " file full: wait...\n");
+
+ ret = os_file_set_size(
+ name, files[i],
+ srv_calc_low32(TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9),
+ srv_calc_high32(TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9));
+
+ if (!ret) {
+ fprintf(stderr,
+ "InnoDB: Error in creating %s:"
+ " probably out of disk space\n", name);
+
+ return(DB_ERROR);
+ }
+ }
+
+ ret = os_file_close(files[i]);
+ ut_a(ret);
+
+ fil_space_create(name, TRX_DOUBLEWRITE_SPACE, 0, FIL_TABLESPACE);
+
+ ut_a(fil_validate());
+
+ fil_node_create(name, TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9, TRX_DOUBLEWRITE_SPACE, FALSE);
+
+ i++;
+ }
+
ios = 0;
mutex_create(&ios_mutex, SYNC_NO_ORDER_CHECK);
@@ -1010,6 +1131,7 @@ innobase_start_or_create_for_mysql(void)
{
buf_pool_t* ret;
ibool create_new_db;
+ ibool create_new_doublewrite_file;
ibool log_file_created;
ibool log_created = FALSE;
ibool log_opened = FALSE;
@@ -1074,7 +1196,11 @@ innobase_start_or_create_for_mysql(void)
#ifdef UNIV_IBUF_DEBUG
fprintf(stderr,
"InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"
- "InnoDB: Crash recovery will fail with UNIV_IBUF_DEBUG\n");
+# ifdef UNIV_IBUF_COUNT_DEBUG
+ "InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n"
+ "InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"
+# endif
+ );
#endif
#ifdef UNIV_SYNC_DEBUG
@@ -1101,7 +1227,15 @@ innobase_start_or_create_for_mysql(void)
"InnoDB: The InnoDB memory heap is disabled\n");
}
- fprintf(stderr, "InnoDB: %s\n", IB_ATOMICS_STARTUP_MSG);
+ fputs("InnoDB: " IB_ATOMICS_STARTUP_MSG
+ "\nInnoDB: Compressed tables use zlib " ZLIB_VERSION
+#ifdef UNIV_ZIP_DEBUG
+ " with validation"
+#endif /* UNIV_ZIP_DEBUG */
+#ifdef UNIV_ZIP_COPY
+ " and extra copying"
+#endif /* UNIV_ZIP_COPY */
+ "\n" , stderr);
/* Since InnoDB does not currently clean up all its internal data
structures in MySQL Embedded Server Library server_end(), we
@@ -1388,6 +1522,7 @@ innobase_start_or_create_for_mysql(void)
}
err = open_or_create_data_files(&create_new_db,
+ &create_new_doublewrite_file,
#ifdef UNIV_LOG_ARCHIVE
&min_arch_log_no, &max_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
@@ -1504,6 +1639,14 @@ innobase_start_or_create_for_mysql(void)
trx_sys_file_format_init();
+ if (create_new_doublewrite_file) {
+ mtr_start(&mtr);
+ fsp_header_init(TRX_DOUBLEWRITE_SPACE, TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9, &mtr);
+ mtr_commit(&mtr);
+
+ trx_sys_dummy_create(TRX_DOUBLEWRITE_SPACE);
+ }
+
if (create_new_db) {
mtr_start(&mtr);
fsp_header_init(0, sum_of_new_sizes, &mtr);
@@ -1596,6 +1739,14 @@ innobase_start_or_create_for_mysql(void)
dict_boot();
trx_sys_init_at_db_start();
+ /* Initialize the fsp free limit global variable in the log
+ system */
+ fsp_header_get_free_limit();
+
+ /* recv_recovery_from_checkpoint_finish needs trx lists which
+ are initialized in trx_sys_init_at_db_start(). */
+
+ recv_recovery_from_checkpoint_finish();
if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
/* The following call is necessary for the insert
buffer to work with multiple tablespaces. We must
@@ -1611,26 +1762,14 @@ innobase_start_or_create_for_mysql(void)
every table in the InnoDB data dictionary that has
an .ibd file.
- We also determine the maximum tablespace id used.
-
- TODO: We may have incomplete transactions in the
- data dictionary tables. Does that harm the scanning of
- the data dictionary below? */
+ We also determine the maximum tablespace id used. */
dict_check_tablespaces_and_store_max_id(
recv_needed_recovery);
}
srv_startup_is_before_trx_rollback_phase = FALSE;
-
- /* Initialize the fsp free limit global variable in the log
- system */
- fsp_header_get_free_limit();
-
- /* recv_recovery_from_checkpoint_finish needs trx lists which
- are initialized in trx_sys_init_at_db_start(). */
-
- recv_recovery_from_checkpoint_finish();
+ recv_recovery_rollback_active();
/* It is possible that file_format tag has never
been set. In this case we initialize it to minimum
@@ -1679,15 +1818,18 @@ innobase_start_or_create_for_mysql(void)
/* fprintf(stderr, "Max allowed record size %lu\n",
page_get_free_space_of_empty() / 2); */
- /* Create the thread which watches the timeouts for lock waits
- and prints InnoDB monitor info */
-
- os_thread_create(&srv_lock_timeout_and_monitor_thread, NULL,
+ /* Create the thread which watches the timeouts for lock waits */
+ os_thread_create(&srv_lock_timeout_thread, NULL,
thread_ids + 2 + SRV_MAX_N_IO_THREADS);
/* Create the thread which warns of long semaphore waits */
os_thread_create(&srv_error_monitor_thread, NULL,
thread_ids + 3 + SRV_MAX_N_IO_THREADS);
+
+ /* Create the thread which prints InnoDB monitor info */
+ os_thread_create(&srv_monitor_thread, NULL,
+ thread_ids + 4 + SRV_MAX_N_IO_THREADS);
+
srv_is_being_started = FALSE;
if (trx_doublewrite == NULL) {
@@ -1712,13 +1854,13 @@ innobase_start_or_create_for_mysql(void)
ulint i;
os_thread_create(&srv_purge_thread, NULL, thread_ids
- + (4 + SRV_MAX_N_IO_THREADS));
+ + (5 + SRV_MAX_N_IO_THREADS));
for (i = 0; i < srv_use_purge_thread - 1; i++) {
- n[5 + i + SRV_MAX_N_IO_THREADS] = i; /* using as index for arrays in purge_sys */
+ n[6 + i + SRV_MAX_N_IO_THREADS] = i; /* using as index for arrays in purge_sys */
os_thread_create(&srv_purge_worker_thread,
- n + (5 + i + SRV_MAX_N_IO_THREADS),
- thread_ids + (5 + i + SRV_MAX_N_IO_THREADS));
+ n + (6 + i + SRV_MAX_N_IO_THREADS),
+ thread_ids + (6 + i + SRV_MAX_N_IO_THREADS));
}
}
#ifdef UNIV_DEBUG
@@ -1821,7 +1963,7 @@ innobase_start_or_create_for_mysql(void)
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB Plugin %s started; "
+ " Percona XtraDB (http://www.percona.com) %s started; "
"log sequence number %llu\n",
INNODB_VERSION_STR, srv_start_lsn);
}
diff --git a/storage/xtradb/sync/sync0sync.c b/storage/xtradb/sync/sync0sync.c
index c0e543f284d..fe14cbf0886 100644
--- a/storage/xtradb/sync/sync0sync.c
+++ b/storage/xtradb/sync/sync0sync.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -317,6 +317,15 @@ mutex_free(
ut_a(mutex_get_lock_word(mutex) == 0);
ut_a(mutex_get_waiters(mutex) == 0);
+#ifdef UNIV_MEM_DEBUG
+ if (mutex == &mem_hash_mutex) {
+ ut_ad(UT_LIST_GET_LEN(mutex_list) == 1);
+ ut_ad(UT_LIST_GET_FIRST(mutex_list) == &mem_hash_mutex);
+ UT_LIST_REMOVE(list, mutex_list, mutex);
+ goto func_exit;
+ }
+#endif /* UNIV_MEM_DEBUG */
+
if (mutex != &mutex_list_mutex
#ifdef UNIV_SYNC_DEBUG
&& mutex != &sync_thread_mutex
@@ -338,7 +347,9 @@ mutex_free(
}
os_event_free(mutex->event);
-
+#ifdef UNIV_MEM_DEBUG
+func_exit:
+#endif /* UNIV_MEM_DEBUG */
#if !defined(HAVE_ATOMIC_BUILTINS)
os_fast_mutex_free(&(mutex->os_fast_mutex));
#endif
@@ -959,12 +970,62 @@ sync_thread_levels_contain(
}
/******************************************************************//**
+Checks if the level array for the current thread contains a
+mutex or rw-latch at the specified level.
+@return a matching latch, or NULL if not found */
+UNIV_INTERN
+void*
+sync_thread_levels_contains(
+/*========================*/
+ ulint level) /*!< in: latching order level
+ (SYNC_DICT, ...)*/
+{
+ sync_level_t* arr;
+ sync_thread_t* thread_slot;
+ sync_level_t* slot;
+ ulint i;
+
+ if (!sync_order_checks_on) {
+
+ return(NULL);
+ }
+
+ mutex_enter(&sync_thread_mutex);
+
+ thread_slot = sync_thread_level_arrays_find_slot();
+
+ if (thread_slot == NULL) {
+
+ mutex_exit(&sync_thread_mutex);
+
+ return(NULL);
+ }
+
+ arr = thread_slot->levels;
+
+ for (i = 0; i < SYNC_THREAD_N_LEVELS; i++) {
+
+ slot = sync_thread_levels_get_nth(arr, i);
+
+ if (slot->latch != NULL && slot->level == level) {
+
+ mutex_exit(&sync_thread_mutex);
+ return(slot->latch);
+ }
+ }
+
+ mutex_exit(&sync_thread_mutex);
+
+ return(NULL);
+}
+
+/******************************************************************//**
Checks that the level array for the current thread is empty.
-@return TRUE if empty except the exceptions specified below */
+@return a latch, or NULL if empty except the exceptions specified below */
UNIV_INTERN
-ibool
-sync_thread_levels_empty_gen(
-/*=========================*/
+void*
+sync_thread_levels_nonempty_gen(
+/*============================*/
ibool dict_mutex_allowed) /*!< in: TRUE if dictionary mutex is
allowed to be owned by the thread,
also purge_is_running mutex is
@@ -977,7 +1038,7 @@ sync_thread_levels_empty_gen(
if (!sync_order_checks_on) {
- return(TRUE);
+ return(NULL);
}
mutex_enter(&sync_thread_mutex);
@@ -988,7 +1049,7 @@ sync_thread_levels_empty_gen(
mutex_exit(&sync_thread_mutex);
- return(TRUE);
+ return(NULL);
}
arr = thread_slot->levels;
@@ -1005,13 +1066,13 @@ sync_thread_levels_empty_gen(
mutex_exit(&sync_thread_mutex);
ut_error;
- return(FALSE);
+ return(slot->latch);
}
}
mutex_exit(&sync_thread_mutex);
- return(TRUE);
+ return(NULL);
}
/******************************************************************//**
@@ -1388,6 +1449,12 @@ sync_close(void)
mutex = UT_LIST_GET_FIRST(mutex_list);
while (mutex) {
+#ifdef UNIV_MEM_DEBUG
+ if (mutex == &mem_hash_mutex) {
+ mutex = UT_LIST_GET_NEXT(list, mutex);
+ continue;
+ }
+#endif /* UNIV_MEM_DEBUG */
mutex_free(mutex);
mutex = UT_LIST_GET_FIRST(mutex_list);
}
diff --git a/storage/xtradb/trx/trx0i_s.c b/storage/xtradb/trx/trx0i_s.c
index 78b20edd365..c160eb2942a 100644
--- a/storage/xtradb/trx/trx0i_s.c
+++ b/storage/xtradb/trx/trx0i_s.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2007, 2010, Innobase Oy. All Rights Reserved.
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
@@ -28,11 +28,18 @@ table cache" for later retrieval.
Created July 17, 2007 Vasil Dimov
*******************************************************/
+/* Found during the build of 5.5.3 on Linux 2.4 and early 2.6 kernels:
+ The includes "univ.i" -> "my_global.h" cause a different path
+ to be taken further down with pthread functions and types,
+ so they must come first.
+ From the symptoms, this is related to bug#46587 in the MySQL bug DB.
+*/
+#include "univ.i"
+
+#include <mysql/plugin.h>
#include "mysql_addons.h"
-#include "univ.i"
-#include <mysql/plugin.h>
#include "buf0buf.h"
#include "dict0dict.h"
#include "ha0storage.h"
diff --git a/storage/xtradb/trx/trx0rec.c b/storage/xtradb/trx/trx0rec.c
index 5097cf18dcd..f50e10ed756 100644
--- a/storage/xtradb/trx/trx0rec.c
+++ b/storage/xtradb/trx/trx0rec.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -350,8 +350,13 @@ trx_undo_rec_get_col_val(
ut_ad(*orig_len >= BTR_EXTERN_FIELD_REF_SIZE);
ut_ad(*len > *orig_len);
- ut_ad(*len >= REC_MAX_INDEX_COL_LEN
+ /* @see dtuple_convert_big_rec() */
+ ut_ad(*len >= BTR_EXTERN_FIELD_REF_SIZE * 2);
+ /* we do not have access to index->table here
+ ut_ad(dict_table_get_format(index->table) >= DICT_TF_FORMAT_ZIP
+ || *len >= REC_MAX_INDEX_COL_LEN
+ BTR_EXTERN_FIELD_REF_SIZE);
+ */
*len += UNIV_EXTERN_STORAGE_FIELD;
break;
@@ -977,6 +982,7 @@ trx_undo_update_rec_get_update(
fprintf(stderr, "\n"
"InnoDB: n_fields = %lu, i = %lu, ptr %p\n",
(ulong) n_fields, (ulong) i, ptr);
+ *upd = NULL;
return(NULL);
}
@@ -1074,11 +1080,15 @@ trx_undo_rec_get_partial_row(
/* If the prefix of this column is indexed,
ensure that enough prefix is stored in the
undo log record. */
- ut_a(ignore_prefix
- || !col->ord_part
- || dfield_get_len(dfield)
- >= REC_MAX_INDEX_COL_LEN
- + BTR_EXTERN_FIELD_REF_SIZE);
+ if (!ignore_prefix && col->ord_part) {
+ ut_a(dfield_get_len(dfield)
+ >= 2 * BTR_EXTERN_FIELD_REF_SIZE);
+ ut_a(dict_table_get_format(index->table)
+ >= DICT_TF_FORMAT_ZIP
+ || dfield_get_len(dfield)
+ >= REC_MAX_INDEX_COL_LEN
+ + BTR_EXTERN_FIELD_REF_SIZE);
+ }
}
}
diff --git a/storage/xtradb/trx/trx0rseg.c b/storage/xtradb/trx/trx0rseg.c
index 8d754788e2a..57b5611d624 100644
--- a/storage/xtradb/trx/trx0rseg.c
+++ b/storage/xtradb/trx/trx0rseg.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
diff --git a/storage/xtradb/trx/trx0sys.c b/storage/xtradb/trx/trx0sys.c
index 8ea34a8c81c..47a21c3a318 100644
--- a/storage/xtradb/trx/trx0sys.c
+++ b/storage/xtradb/trx/trx0sys.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -402,6 +402,149 @@ start_again:
goto start_again;
}
+
+ if (srv_doublewrite_file) {
+ /* the same doublewrite buffer to TRX_SYS_SPACE should exist.
+ check and create if not exist.*/
+
+ mtr_start(&mtr);
+ trx_doublewrite_buf_is_being_created = TRUE;
+
+ block = buf_page_get(TRX_DOUBLEWRITE_SPACE, 0, TRX_SYS_PAGE_NO,
+ RW_X_LATCH, &mtr);
+ buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
+
+ doublewrite = buf_block_get_frame(block) + TRX_SYS_DOUBLEWRITE;
+
+ if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
+ == TRX_SYS_DOUBLEWRITE_MAGIC_N) {
+ /* The doublewrite buffer has already been created:
+ just read in some numbers */
+
+ mtr_commit(&mtr);
+ } else {
+ fprintf(stderr,
+ "InnoDB: Doublewrite buffer not found in the doublewrite file:"
+ " creating new\n");
+
+ if (buf_pool_get_curr_size()
+ < ((2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+ + FSP_EXTENT_SIZE / 2 + 100)
+ * UNIV_PAGE_SIZE)) {
+ fprintf(stderr,
+ "InnoDB: Cannot create doublewrite buffer:"
+ " you must\n"
+ "InnoDB: increase your buffer pool size.\n"
+ "InnoDB: Cannot continue operation.\n");
+
+ exit(1);
+ }
+
+ block2 = fseg_create(TRX_DOUBLEWRITE_SPACE, TRX_SYS_PAGE_NO,
+ TRX_SYS_DOUBLEWRITE
+ + TRX_SYS_DOUBLEWRITE_FSEG, &mtr);
+
+ /* fseg_create acquires a second latch on the page,
+ therefore we must declare it: */
+
+ buf_block_dbg_add_level(block2, SYNC_NO_ORDER_CHECK);
+
+ if (block2 == NULL) {
+ fprintf(stderr,
+ "InnoDB: Cannot create doublewrite buffer:"
+ " you must\n"
+ "InnoDB: increase your tablespace size.\n"
+ "InnoDB: Cannot continue operation.\n");
+
+ /* We exit without committing the mtr to prevent
+ its modifications to the database getting to disk */
+
+ exit(1);
+ }
+
+ fseg_header = buf_block_get_frame(block)
+ + TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_FSEG;
+ prev_page_no = 0;
+
+ for (i = 0; i < 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+ + FSP_EXTENT_SIZE / 2; i++) {
+ page_no = fseg_alloc_free_page(fseg_header,
+ prev_page_no + 1,
+ FSP_UP, &mtr);
+ if (page_no == FIL_NULL) {
+ fprintf(stderr,
+ "InnoDB: Cannot create doublewrite"
+ " buffer: you must\n"
+ "InnoDB: increase your"
+ " tablespace size.\n"
+ "InnoDB: Cannot continue operation.\n"
+ );
+
+ exit(1);
+ }
+
+ /* We read the allocated pages to the buffer pool;
+ when they are written to disk in a flush, the space
+ id and page number fields are also written to the
+ pages. When we at database startup read pages
+ from the doublewrite buffer, we know that if the
+ space id and page number in them are the same as
+ the page position in the tablespace, then the page
+ has not been written to in doublewrite. */
+
+ new_block = buf_page_get(TRX_DOUBLEWRITE_SPACE, 0, page_no,
+ RW_X_LATCH, &mtr);
+ buf_block_dbg_add_level(new_block,
+ SYNC_NO_ORDER_CHECK);
+
+ if (i == FSP_EXTENT_SIZE / 2) {
+ ut_a(page_no == FSP_EXTENT_SIZE);
+ mlog_write_ulint(doublewrite
+ + TRX_SYS_DOUBLEWRITE_BLOCK1,
+ page_no, MLOG_4BYTES, &mtr);
+ mlog_write_ulint(doublewrite
+ + TRX_SYS_DOUBLEWRITE_REPEAT
+ + TRX_SYS_DOUBLEWRITE_BLOCK1,
+ page_no, MLOG_4BYTES, &mtr);
+ } else if (i == FSP_EXTENT_SIZE / 2
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
+ ut_a(page_no == 2 * FSP_EXTENT_SIZE);
+ mlog_write_ulint(doublewrite
+ + TRX_SYS_DOUBLEWRITE_BLOCK2,
+ page_no, MLOG_4BYTES, &mtr);
+ mlog_write_ulint(doublewrite
+ + TRX_SYS_DOUBLEWRITE_REPEAT
+ + TRX_SYS_DOUBLEWRITE_BLOCK2,
+ page_no, MLOG_4BYTES, &mtr);
+ } else if (i > FSP_EXTENT_SIZE / 2) {
+ ut_a(page_no == prev_page_no + 1);
+ }
+
+ prev_page_no = page_no;
+ }
+
+ mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC,
+ TRX_SYS_DOUBLEWRITE_MAGIC_N,
+ MLOG_4BYTES, &mtr);
+ mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC
+ + TRX_SYS_DOUBLEWRITE_REPEAT,
+ TRX_SYS_DOUBLEWRITE_MAGIC_N,
+ MLOG_4BYTES, &mtr);
+
+ mlog_write_ulint(doublewrite
+ + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED,
+ TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N,
+ MLOG_4BYTES, &mtr);
+ mtr_commit(&mtr);
+
+ /* Flush the modified pages to disk and make a checkpoint */
+ log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
+
+ fprintf(stderr, "InnoDB: Doublewrite buffer created in the doublewrite file\n");
+ }
+
+ trx_doublewrite_buf_is_being_created = FALSE;
+ }
}
/****************************************************************//**
@@ -425,10 +568,19 @@ trx_sys_doublewrite_init_or_restore_pages(
ulint source_page_no;
byte* page;
byte* doublewrite;
+ ulint doublewrite_space_id;
ulint space_id;
ulint page_no;
ulint i;
+ doublewrite_space_id = (srv_doublewrite_file ? TRX_DOUBLEWRITE_SPACE : TRX_SYS_SPACE);
+
+ if (srv_doublewrite_file) {
+ fprintf(stderr,
+ "InnoDB: doublewrite file '%s' is used.\n",
+ srv_doublewrite_file);
+ }
+
/* We do the file i/o past the buffer pool */
unaligned_read_buf = ut_malloc(2 * UNIV_PAGE_SIZE);
@@ -437,7 +589,7 @@ trx_sys_doublewrite_init_or_restore_pages(
/* Read the trx sys header to check if we are using the doublewrite
buffer */
- fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO, 0,
+ fil_io(OS_FILE_READ, TRUE, doublewrite_space_id, 0, TRX_SYS_PAGE_NO, 0,
UNIV_PAGE_SIZE, read_buf, NULL);
doublewrite = read_buf + TRX_SYS_DOUBLEWRITE;
@@ -475,10 +627,10 @@ trx_sys_doublewrite_init_or_restore_pages(
/* Read the pages from the doublewrite buffer to memory */
- fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, block1, 0,
+ fil_io(OS_FILE_READ, TRUE, doublewrite_space_id, 0, block1, 0,
TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
buf, NULL);
- fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, block2, 0,
+ fil_io(OS_FILE_READ, TRUE, doublewrite_space_id, 0, block2, 0,
TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
buf + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
NULL);
@@ -534,7 +686,8 @@ trx_sys_doublewrite_init_or_restore_pages(
" doublewrite buf.\n",
(ulong) space_id, (ulong) page_no, (ulong) i);
- } else if (space_id == TRX_SYS_SPACE
+ } else if ((space_id == TRX_SYS_SPACE
+ || (srv_doublewrite_file && space_id == TRX_DOUBLEWRITE_SPACE))
&& ((page_no >= block1
&& page_no
< block1 + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
@@ -594,8 +747,8 @@ trx_sys_doublewrite_init_or_restore_pages(
" recover the database"
" with the my.cnf\n"
"InnoDB: option:\n"
- "InnoDB: set-variable="
- "innodb_force_recovery=6\n");
+ "InnoDB:"
+ " innodb_force_recovery=6\n");
exit(1);
}
@@ -982,6 +1135,89 @@ trx_sysf_create(
}
/*****************************************************************//**
+Creates dummy of the file page for the transaction system. */
+static
+void
+trx_sysf_dummy_create(
+/*==================*/
+ ulint space,
+ mtr_t* mtr)
+{
+#ifdef UNDEFINED
+ trx_sysf_t* sys_header;
+ ulint slot_no;
+ ulint page_no;
+ ulint i;
+#endif
+ page_t* page;
+ buf_block_t* block;
+
+ ut_ad(mtr);
+
+ /* Note that below we first reserve the file space x-latch, and
+ then enter the kernel: we must do it in this order to conform
+ to the latching order rules. */
+
+ mtr_x_lock(fil_space_get_latch(space, NULL), mtr);
+ mutex_enter(&kernel_mutex);
+
+ /* Create the trx sys file block in a new allocated file segment */
+ block = fseg_create(space, 0, TRX_SYS + TRX_SYS_FSEG_HEADER,
+ mtr);
+ buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER);
+
+ fprintf(stderr, "%lu\n", buf_block_get_page_no(block));
+ ut_a(buf_block_get_page_no(block) == TRX_SYS_PAGE_NO);
+
+ page = buf_block_get_frame(block);
+
+ mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_TYPE_TRX_SYS,
+ MLOG_2BYTES, mtr);
+
+ /* Reset the doublewrite buffer magic number to zero so that we
+ know that the doublewrite buffer has not yet been created (this
+ suppresses a Valgrind warning) */
+
+ mlog_write_ulint(page + TRX_SYS_DOUBLEWRITE
+ + TRX_SYS_DOUBLEWRITE_MAGIC, 0, MLOG_4BYTES, mtr);
+
+#ifdef UNDEFINED
+ /* TODO: REMOVE IT: The bellow is not needed, I think */
+ sys_header = trx_sysf_get(mtr);
+
+ /* Start counting transaction ids from number 1 up */
+ mlog_write_dulint(sys_header + TRX_SYS_TRX_ID_STORE,
+ ut_dulint_create(0, 1), mtr);
+
+ /* Reset the rollback segment slots */
+ for (i = 0; i < TRX_SYS_N_RSEGS; i++) {
+
+ trx_sysf_rseg_set_space(sys_header, i, ULINT_UNDEFINED, mtr);
+ trx_sysf_rseg_set_page_no(sys_header, i, FIL_NULL, mtr);
+ }
+
+ /* The remaining area (up to the page trailer) is uninitialized.
+ Silence Valgrind warnings about it. */
+ UNIV_MEM_VALID(sys_header + (TRX_SYS_RSEGS
+ + TRX_SYS_N_RSEGS * TRX_SYS_RSEG_SLOT_SIZE
+ + TRX_SYS_RSEG_SPACE),
+ (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END
+ - (TRX_SYS_RSEGS
+ + TRX_SYS_N_RSEGS * TRX_SYS_RSEG_SLOT_SIZE
+ + TRX_SYS_RSEG_SPACE))
+ + page - sys_header);
+
+ /* Create the first rollback segment in the SYSTEM tablespace */
+ page_no = trx_rseg_header_create(space, 0, ULINT_MAX, &slot_no,
+ mtr);
+ ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID);
+ ut_a(page_no != FIL_NULL);
+#endif
+
+ mutex_exit(&kernel_mutex);
+}
+
+/*****************************************************************//**
Creates and initializes the central memory structures for the transaction
system. This is called when the database is started. */
UNIV_INTERN
@@ -1087,6 +1323,26 @@ trx_sys_create(void)
trx_sys_init_at_db_start();
}
+/*****************************************************************//**
+Creates and initializes the dummy transaction system page for tablespace. */
+UNIV_INTERN
+void
+trx_sys_dummy_create(
+/*=================*/
+ ulint space)
+{
+ mtr_t mtr;
+
+ /* This function is only for doublewrite file for now */
+ ut_a(space == TRX_DOUBLEWRITE_SPACE);
+
+ mtr_start(&mtr);
+
+ trx_sysf_dummy_create(space, &mtr);
+
+ mtr_commit(&mtr);
+}
+
/*********************************************************************
Create extra rollback segments when create_new_db */
UNIV_INTERN
@@ -1608,6 +1864,7 @@ trx_sys_file_format_id_to_name(
#endif /* !UNIV_HOTBACKUP */
+#ifndef UNIV_HOTBACKUP
/*********************************************************************
Shutdown/Close the transaction system. */
UNIV_INTERN
@@ -1684,3 +1941,4 @@ trx_sys_close(void)
trx_sys = NULL;
mutex_exit(&kernel_mutex);
}
+#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c
index e81daf4cad9..f150d64f8dc 100644
--- a/storage/xtradb/trx/trx0trx.c
+++ b/storage/xtradb/trx/trx0trx.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
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
@@ -455,6 +455,7 @@ trx_lists_init_at_db_start(void)
trx_undo_t* undo;
trx_t* trx;
+ ut_ad(mutex_own(&kernel_mutex));
UT_LIST_INIT(trx_sys->trx_list);
/* Look from the rollback segments if there exist undo logs for
@@ -885,7 +886,7 @@ trx_commit_off_kernel(
recovery i.e.: back ground rollback thread is still active
then there is a chance that the rollback thread may see
this trx as COMMITTED_IN_MEMORY and goes adhead to clean it
- up calling trx_cleanup_at_db_startup(). This can happen
+ up calling trx_cleanup_at_db_startup(). This can happen
in the case we are committing a trx here that is left in
PREPARED state during the crash. Note that commit of the
rollback of a PREPARED trx happens in the recovery thread
diff --git a/storage/xtradb/ut/ut0rbt.c b/storage/xtradb/ut/ut0rbt.c
new file mode 100644
index 00000000000..3d7bc91e714
--- /dev/null
+++ b/storage/xtradb/ut/ut0rbt.c
@@ -0,0 +1,1249 @@
+/*****************************************************************************
+
+Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
+
+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
+
+*****************************************************************************/
+
+/*******************************************************************//**
+@file ut/ut0rbt.c
+Red-Black tree implementation
+
+Created 2007-03-20 Sunny Bains
+***********************************************************************/
+
+#include "ut0rbt.h"
+
+/************************************************************************
+Definition of a red-black tree
+==============================
+
+A red-black tree is a binary search tree which has the following
+red-black properties:
+
+ 1. Every node is either red or black.
+ 2. Every leaf (NULL - in our case tree->nil) is black.
+ 3. If a node is red, then both its children are black.
+ 4. Every simple path from a node to a descendant leaf contains the
+ same number of black nodes.
+
+ from (3) above, the implication is that on any path from the root
+ to a leaf, red nodes must not be adjacent.
+
+ However, any number of black nodes may appear in a sequence. */
+
+#if defined(IB_RBT_TESTING)
+#warning "Testing enabled!"
+#endif
+
+#define ROOT(t) (t->root->left)
+#define SIZEOF_NODE(t) ((sizeof(ib_rbt_node_t) + t->sizeof_value) - 1)
+
+/****************************************************************//**
+Print out the sub-tree recursively. */
+static
+void
+rbt_print_subtree(
+/*==============*/
+ const ib_rbt_t* tree, /*!< in: tree to traverse */
+ const ib_rbt_node_t* node, /*!< in: node to print */
+ ib_rbt_print_node print) /*!< in: print key function */
+{
+ /* FIXME: Doesn't do anything yet */
+ if (node != tree->nil) {
+ print(node);
+ rbt_print_subtree(tree, node->left, print);
+ rbt_print_subtree(tree, node->right, print);
+ }
+}
+
+/****************************************************************//**
+Verify that the keys are in order.
+@return TRUE of OK. FALSE if not ordered */
+static
+ibool
+rbt_check_ordering(
+/*===============*/
+ const ib_rbt_t* tree) /*!< in: tree to verfify */
+{
+ const ib_rbt_node_t* node;
+ const ib_rbt_node_t* prev = NULL;
+
+ /* Iterate over all the nodes, comparing each node with the prev */
+ for (node = rbt_first(tree); node; node = rbt_next(tree, prev)) {
+
+ if (prev && tree->compare(prev->value, node->value) >= 0) {
+ return(FALSE);
+ }
+
+ prev = node;
+ }
+
+ return(TRUE);
+}
+
+/****************************************************************//**
+Check that every path from the root to the leaves has the same count.
+Count is expressed in the number of black nodes.
+@return 0 on failure else black height of the subtree */
+static
+ibool
+rbt_count_black_nodes(
+/*==================*/
+ const ib_rbt_t* tree, /*!< in: tree to verify */
+ const ib_rbt_node_t* node) /*!< in: start of sub-tree */
+{
+ ulint result;
+
+ if (node != tree->nil) {
+ ulint left_height = rbt_count_black_nodes(tree, node->left);
+
+ ulint right_height = rbt_count_black_nodes(tree, node->right);
+
+ if (left_height == 0
+ || right_height == 0
+ || left_height != right_height) {
+
+ result = 0;
+ } else if (node->color == IB_RBT_RED) {
+
+ /* Case 3 */
+ if (node->left->color != IB_RBT_BLACK
+ || node->right->color != IB_RBT_BLACK) {
+
+ result = 0;
+ } else {
+ result = left_height;
+ }
+ /* Check if it's anything other than RED or BLACK. */
+ } else if (node->color != IB_RBT_BLACK) {
+
+ result = 0;
+ } else {
+
+ result = right_height + 1;
+ }
+ } else {
+ result = 1;
+ }
+
+ return(result);
+}
+
+/****************************************************************//**
+Turn the node's right child's left sub-tree into node's right sub-tree.
+This will also make node's right child it's parent. */
+static
+void
+rbt_rotate_left(
+/*============*/
+ const ib_rbt_node_t* nil, /*!< in: nil node of the tree */
+ ib_rbt_node_t* node) /*!< in: node to rotate */
+{
+ ib_rbt_node_t* right = node->right;
+
+ node->right = right->left;
+
+ if (right->left != nil) {
+ right->left->parent = node;
+ }
+
+ /* Right's new parent was node's parent. */
+ right->parent = node->parent;
+
+ /* Since root's parent is tree->nil and root->parent->left points
+ back to root, we can avoid the check. */
+ if (node == node->parent->left) {
+ /* Node was on the left of its parent. */
+ node->parent->left = right;
+ } else {
+ /* Node must have been on the right. */
+ node->parent->right = right;
+ }
+
+ /* Finally, put node on right's left. */
+ right->left = node;
+ node->parent = right;
+}
+
+/****************************************************************//**
+Turn the node's left child's right sub-tree into node's left sub-tree.
+This also make node's left child it's parent. */
+static
+void
+rbt_rotate_right(
+/*=============*/
+ const ib_rbt_node_t* nil, /*!< in: nil node of tree */
+ ib_rbt_node_t* node) /*!< in: node to rotate */
+{
+ ib_rbt_node_t* left = node->left;
+
+ node->left = left->right;
+
+ if (left->right != nil) {
+ left->right->parent = node;
+ }
+
+ /* Left's new parent was node's parent. */
+ left->parent = node->parent;
+
+ /* Since root's parent is tree->nil and root->parent->left points
+ back to root, we can avoid the check. */
+ if (node == node->parent->right) {
+ /* Node was on the left of its parent. */
+ node->parent->right = left;
+ } else {
+ /* Node must have been on the left. */
+ node->parent->left = left;
+ }
+
+ /* Finally, put node on left's right. */
+ left->right = node;
+ node->parent = left;
+}
+
+/****************************************************************//**
+Append a node to the tree.
+@return inserted node */
+static
+ib_rbt_node_t*
+rbt_tree_add_child(
+/*===============*/
+ const ib_rbt_t* tree, /*!< in: rbt tree */
+ ib_rbt_bound_t* parent, /*!< in: node's parent */
+ ib_rbt_node_t* node) /*!< in: node to add */
+{
+ /* Cast away the const. */
+ ib_rbt_node_t* last = (ib_rbt_node_t*) parent->last;
+
+ if (last == tree->root || parent->result < 0) {
+ last->left = node;
+ } else {
+ /* FIXME: We don't handle duplicates (yet)! */
+ ut_a(parent->result != 0);
+
+ last->right = node;
+ }
+
+ node->parent = last;
+
+ return(node);
+}
+
+/****************************************************************//**
+Generic binary tree insert
+@return inserted node */
+static
+ib_rbt_node_t*
+rbt_tree_insert(
+/*============*/
+ ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key, /*!< in: key for ordering */
+ ib_rbt_node_t* node) /*!< in: node hold the insert value */
+{
+ ib_rbt_bound_t parent;
+ ib_rbt_node_t* current = ROOT(tree);
+
+ parent.result = 0;
+ parent.last = tree->root;
+
+ /* Regular binary search. */
+ while (current != tree->nil) {
+
+ parent.last = current;
+ parent.result = tree->compare(key, current->value);
+
+ if (parent.result < 0) {
+ current = current->left;
+ } else {
+ current = current->right;
+ }
+ }
+
+ ut_a(current == tree->nil);
+
+ rbt_tree_add_child(tree, &parent, node);
+
+ return(node);
+}
+
+/****************************************************************//**
+Balance a tree after inserting a node. */
+static
+void
+rbt_balance_tree(
+/*=============*/
+ const ib_rbt_t* tree, /*!< in: tree to balance */
+ ib_rbt_node_t* node) /*!< in: node that was inserted */
+{
+ const ib_rbt_node_t* nil = tree->nil;
+ ib_rbt_node_t* parent = node->parent;
+
+ /* Restore the red-black property. */
+ node->color = IB_RBT_RED;
+
+ while (node != ROOT(tree) && parent->color == IB_RBT_RED) {
+ ib_rbt_node_t* grand_parent = parent->parent;
+
+ if (parent == grand_parent->left) {
+ ib_rbt_node_t* uncle = grand_parent->right;
+
+ if (uncle->color == IB_RBT_RED) {
+
+ /* Case 1 - change the colors. */
+ uncle->color = IB_RBT_BLACK;
+ parent->color = IB_RBT_BLACK;
+ grand_parent->color = IB_RBT_RED;
+
+ /* Move node up the tree. */
+ node = grand_parent;
+
+ } else {
+
+ if (node == parent->right) {
+ /* Right is a black node and node is
+ to the right, case 2 - move node
+ up and rotate. */
+ node = parent;
+ rbt_rotate_left(nil, node);
+ }
+
+ grand_parent = node->parent->parent;
+
+ /* Case 3. */
+ node->parent->color = IB_RBT_BLACK;
+ grand_parent->color = IB_RBT_RED;
+
+ rbt_rotate_right(nil, grand_parent);
+ }
+
+ } else {
+ ib_rbt_node_t* uncle = grand_parent->left;
+
+ if (uncle->color == IB_RBT_RED) {
+
+ /* Case 1 - change the colors. */
+ uncle->color = IB_RBT_BLACK;
+ parent->color = IB_RBT_BLACK;
+ grand_parent->color = IB_RBT_RED;
+
+ /* Move node up the tree. */
+ node = grand_parent;
+
+ } else {
+
+ if (node == parent->left) {
+ /* Left is a black node and node is to
+ the right, case 2 - move node up and
+ rotate. */
+ node = parent;
+ rbt_rotate_right(nil, node);
+ }
+
+ grand_parent = node->parent->parent;
+
+ /* Case 3. */
+ node->parent->color = IB_RBT_BLACK;
+ grand_parent->color = IB_RBT_RED;
+
+ rbt_rotate_left(nil, grand_parent);
+ }
+ }
+
+ parent = node->parent;
+ }
+
+ /* Color the root black. */
+ ROOT(tree)->color = IB_RBT_BLACK;
+}
+
+/****************************************************************//**
+Find the given node's successor.
+@return successor node or NULL if no successor */
+static
+ib_rbt_node_t*
+rbt_find_successor(
+/*===============*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* current)/*!< in: this is declared const
+ because it can be called via
+ rbt_next() */
+{
+ const ib_rbt_node_t* nil = tree->nil;
+ ib_rbt_node_t* next = current->right;
+
+ /* Is there a sub-tree to the right that we can follow. */
+ if (next != nil) {
+
+ /* Follow the left most links of the current right child. */
+ while (next->left != nil) {
+ next = next->left;
+ }
+
+ } else { /* We will have to go up the tree to find the successor. */
+ ib_rbt_node_t* parent = current->parent;
+
+ /* Cast away the const. */
+ next = (ib_rbt_node_t*) current;
+
+ while (parent != tree->root && next == parent->right) {
+ next = parent;
+ parent = next->parent;
+ }
+
+ next = (parent == tree->root) ? NULL : parent;
+ }
+
+ return(next);
+}
+
+/****************************************************************//**
+Find the given node's precedecessor.
+@return predecessor node or NULL if no predecesor */
+static
+ib_rbt_node_t*
+rbt_find_predecessor(
+/*=================*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* current) /*!< in: this is declared const
+ because it can be called via
+ rbt_prev() */
+{
+ const ib_rbt_node_t* nil = tree->nil;
+ ib_rbt_node_t* prev = current->left;
+
+ /* Is there a sub-tree to the left that we can follow. */
+ if (prev != nil) {
+
+ /* Follow the right most links of the current left child. */
+ while (prev->right != nil) {
+ prev = prev->right;
+ }
+
+ } else { /* We will have to go up the tree to find the precedecessor. */
+ ib_rbt_node_t* parent = current->parent;
+
+ /* Cast away the const. */
+ prev = (ib_rbt_node_t*)current;
+
+ while (parent != tree->root && prev == parent->left) {
+ prev = parent;
+ parent = prev->parent;
+ }
+
+ prev = (parent == tree->root) ? NULL : parent;
+ }
+
+ return(prev);
+}
+
+/****************************************************************//**
+Replace node with child. After applying transformations eject becomes
+an orphan. */
+static
+void
+rbt_eject_node(
+/*===========*/
+ ib_rbt_node_t* eject, /*!< in: node to eject */
+ ib_rbt_node_t* node) /*!< in: node to replace with */
+{
+ /* Update the to be ejected node's parent's child pointers. */
+ if (eject->parent->left == eject) {
+ eject->parent->left = node;
+ } else if (eject->parent->right == eject) {
+ eject->parent->right = node;
+ } else {
+ ut_a(0);
+ }
+ /* eject is now an orphan but otherwise its pointers
+ and color are left intact. */
+
+ node->parent = eject->parent;
+}
+
+/****************************************************************//**
+Replace a node with another node. */
+static
+void
+rbt_replace_node(
+/*=============*/
+ ib_rbt_node_t* replace, /*!< in: node to replace */
+ ib_rbt_node_t* node) /*!< in: node to replace with */
+{
+ ib_rbt_color_t color = node->color;
+
+ /* Update the node pointers. */
+ node->left = replace->left;
+ node->right = replace->right;
+
+ /* Update the child node pointers. */
+ node->left->parent = node;
+ node->right->parent = node;
+
+ /* Make the parent of replace point to node. */
+ rbt_eject_node(replace, node);
+
+ /* Swap the colors. */
+ node->color = replace->color;
+ replace->color = color;
+}
+
+/****************************************************************//**
+Detach node from the tree replacing it with one of it's children.
+@return the child node that now occupies the position of the detached node */
+static
+ib_rbt_node_t*
+rbt_detach_node(
+/*============*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_node_t* node) /*!< in: node to detach */
+{
+ ib_rbt_node_t* child;
+ const ib_rbt_node_t* nil = tree->nil;
+
+ if (node->left != nil && node->right != nil) {
+ /* Case where the node to be deleted has two children. */
+ ib_rbt_node_t* successor = rbt_find_successor(tree, node);
+
+ ut_a(successor != nil);
+ ut_a(successor->parent != nil);
+ ut_a(successor->left == nil);
+
+ child = successor->right;
+
+ /* Remove the successor node and replace with its child. */
+ rbt_eject_node(successor, child);
+
+ /* Replace the node to delete with its successor node. */
+ rbt_replace_node(node, successor);
+ } else {
+ ut_a(node->left == nil || node->right == nil);
+
+ child = (node->left != nil) ? node->left : node->right;
+
+ /* Replace the node to delete with one of it's children. */
+ rbt_eject_node(node, child);
+ }
+
+ /* Reset the node links. */
+ node->parent = node->right = node->left = tree->nil;
+
+ return(child);
+}
+
+/****************************************************************//**
+Rebalance the right sub-tree after deletion.
+@return node to rebalance if more rebalancing required else NULL */
+static
+ib_rbt_node_t*
+rbt_balance_right(
+/*==============*/
+ const ib_rbt_node_t* nil, /*!< in: rb tree nil node */
+ ib_rbt_node_t* parent, /*!< in: parent node */
+ ib_rbt_node_t* sibling)/*!< in: sibling node */
+{
+ ib_rbt_node_t* node = NULL;
+
+ ut_a(sibling != nil);
+
+ /* Case 3. */
+ if (sibling->color == IB_RBT_RED) {
+
+ parent->color = IB_RBT_RED;
+ sibling->color = IB_RBT_BLACK;
+
+ rbt_rotate_left(nil, parent);
+
+ sibling = parent->right;
+
+ ut_a(sibling != nil);
+ }
+
+ /* Since this will violate case 3 because of the change above. */
+ if (sibling->left->color == IB_RBT_BLACK
+ && sibling->right->color == IB_RBT_BLACK) {
+
+ node = parent; /* Parent needs to be rebalanced too. */
+ sibling->color = IB_RBT_RED;
+
+ } else {
+ if (sibling->right->color == IB_RBT_BLACK) {
+
+ ut_a(sibling->left->color == IB_RBT_RED);
+
+ sibling->color = IB_RBT_RED;
+ sibling->left->color = IB_RBT_BLACK;
+
+ rbt_rotate_right(nil, sibling);
+
+ sibling = parent->right;
+ ut_a(sibling != nil);
+ }
+
+ sibling->color = parent->color;
+ sibling->right->color = IB_RBT_BLACK;
+
+ parent->color = IB_RBT_BLACK;
+
+ rbt_rotate_left(nil, parent);
+ }
+
+ return(node);
+}
+
+/****************************************************************//**
+Rebalance the left sub-tree after deletion.
+@return node to rebalance if more rebalancing required else NULL */
+static
+ib_rbt_node_t*
+rbt_balance_left(
+/*=============*/
+ const ib_rbt_node_t* nil, /*!< in: rb tree nil node */
+ ib_rbt_node_t* parent, /*!< in: parent node */
+ ib_rbt_node_t* sibling)/*!< in: sibling node */
+{
+ ib_rbt_node_t* node = NULL;
+
+ ut_a(sibling != nil);
+
+ /* Case 3. */
+ if (sibling->color == IB_RBT_RED) {
+
+ parent->color = IB_RBT_RED;
+ sibling->color = IB_RBT_BLACK;
+
+ rbt_rotate_right(nil, parent);
+ sibling = parent->left;
+
+ ut_a(sibling != nil);
+ }
+
+ /* Since this will violate case 3 because of the change above. */
+ if (sibling->right->color == IB_RBT_BLACK
+ && sibling->left->color == IB_RBT_BLACK) {
+
+ node = parent; /* Parent needs to be rebalanced too. */
+ sibling->color = IB_RBT_RED;
+
+ } else {
+ if (sibling->left->color == IB_RBT_BLACK) {
+
+ ut_a(sibling->right->color == IB_RBT_RED);
+
+ sibling->color = IB_RBT_RED;
+ sibling->right->color = IB_RBT_BLACK;
+
+ rbt_rotate_left(nil, sibling);
+
+ sibling = parent->left;
+
+ ut_a(sibling != nil);
+ }
+
+ sibling->color = parent->color;
+ sibling->left->color = IB_RBT_BLACK;
+
+ parent->color = IB_RBT_BLACK;
+
+ rbt_rotate_right(nil, parent);
+ }
+
+ return(node);
+}
+
+/****************************************************************//**
+Delete the node and rebalance the tree if necessary */
+static
+void
+rbt_remove_node_and_rebalance(
+/*==========================*/
+ ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_node_t* node) /*!< in: node to remove */
+{
+ /* Detach node and get the node that will be used
+ as rebalance start. */
+ ib_rbt_node_t* child = rbt_detach_node(tree, node);
+
+ if (node->color == IB_RBT_BLACK) {
+ ib_rbt_node_t* last = child;
+
+ ROOT(tree)->color = IB_RBT_RED;
+
+ while (child && child->color == IB_RBT_BLACK) {
+ ib_rbt_node_t* parent = child->parent;
+
+ /* Did the deletion cause an imbalance in the
+ parents left sub-tree. */
+ if (parent->left == child) {
+
+ child = rbt_balance_right(
+ tree->nil, parent, parent->right);
+
+ } else if (parent->right == child) {
+
+ child = rbt_balance_left(
+ tree->nil, parent, parent->left);
+
+ } else {
+ ut_error;
+ }
+
+ if (child) {
+ last = child;
+ }
+ }
+
+ ut_a(last);
+
+ last->color = IB_RBT_BLACK;
+ ROOT(tree)->color = IB_RBT_BLACK;
+ }
+
+ /* Note that we have removed a node from the tree. */
+ --tree->n_nodes;
+}
+
+/****************************************************************//**
+Recursively free the nodes. */
+static
+void
+rbt_free_node(
+/*==========*/
+ ib_rbt_node_t* node, /*!< in: node to free */
+ ib_rbt_node_t* nil) /*!< in: rb tree nil node */
+{
+ if (node != nil) {
+ rbt_free_node(node->left, nil);
+ rbt_free_node(node->right, nil);
+
+ ut_free(node);
+ }
+}
+
+/****************************************************************//**
+Free all the nodes and free the tree. */
+UNIV_INTERN
+void
+rbt_free(
+/*=====*/
+ ib_rbt_t* tree) /*!< in: rb tree to free */
+{
+ rbt_free_node(tree->root, tree->nil);
+ ut_free(tree->nil);
+ ut_free(tree);
+}
+
+/****************************************************************//**
+Create an instance of a red black tree.
+@return an empty rb tree */
+UNIV_INTERN
+ib_rbt_t*
+rbt_create(
+/*=======*/
+ size_t sizeof_value, /*!< in: sizeof data item */
+ ib_rbt_compare compare) /*!< in: fn to compare items */
+{
+ ib_rbt_t* tree;
+ ib_rbt_node_t* node;
+
+ tree = (ib_rbt_t*) ut_malloc(sizeof(*tree));
+ memset(tree, 0, sizeof(*tree));
+
+ tree->sizeof_value = sizeof_value;
+
+ /* Create the sentinel (NIL) node. */
+ node = tree->nil = (ib_rbt_node_t*) ut_malloc(sizeof(*node));
+ memset(node, 0, sizeof(*node));
+
+ node->color = IB_RBT_BLACK;
+ node->parent = node->left = node->right = node;
+
+ /* Create the "fake" root, the real root node will be the
+ left child of this node. */
+ node = tree->root = (ib_rbt_node_t*) ut_malloc(sizeof(*node));
+ memset(node, 0, sizeof(*node));
+
+ node->color = IB_RBT_BLACK;
+ node->parent = node->left = node->right = tree->nil;
+
+ tree->compare = compare;
+
+ return(tree);
+}
+
+/****************************************************************//**
+Generic insert of a value in the rb tree.
+@return inserted node */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_insert(
+/*=======*/
+ ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key, /*!< in: key for ordering */
+ const void* value) /*!< in: value of key, this value
+ is copied to the node */
+{
+ ib_rbt_node_t* node;
+
+ /* Create the node that will hold the value data. */
+ node = (ib_rbt_node_t*) ut_malloc(SIZEOF_NODE(tree));
+
+ memcpy(node->value, value, tree->sizeof_value);
+ node->parent = node->left = node->right = tree->nil;
+
+ /* Insert in the tree in the usual way. */
+ rbt_tree_insert(tree, key, node);
+ rbt_balance_tree(tree, node);
+
+ ++tree->n_nodes;
+
+ return(node);
+}
+
+/****************************************************************//**
+Add a new node to the tree, useful for data that is pre-sorted.
+@return appended node */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_add_node(
+/*=========*/
+ ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: bounds */
+ const void* value) /*!< in: this value is copied
+ to the node */
+{
+ ib_rbt_node_t* node;
+
+ /* Create the node that will hold the value data */
+ node = (ib_rbt_node_t*) ut_malloc(SIZEOF_NODE(tree));
+
+ memcpy(node->value, value, tree->sizeof_value);
+ node->parent = node->left = node->right = tree->nil;
+
+ /* If tree is empty */
+ if (parent->last == NULL) {
+ parent->last = tree->root;
+ }
+
+ /* Append the node, the hope here is that the caller knows
+ what s/he is doing. */
+ rbt_tree_add_child(tree, parent, node);
+ rbt_balance_tree(tree, node);
+
+ ++tree->n_nodes;
+
+#if defined(IB_RBT_TESTING)
+ ut_a(rbt_validate(tree));
+#endif
+ return(node);
+}
+
+/****************************************************************//**
+Find a matching node in the rb tree.
+@return NULL if not found else the node where key was found */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_lookup(
+/*=======*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key) /*!< in: key to use for search */
+{
+ const ib_rbt_node_t* current = ROOT(tree);
+
+ /* Regular binary search. */
+ while (current != tree->nil) {
+ int result = tree->compare(key, current->value);
+
+ if (result < 0) {
+ current = current->left;
+ } else if (result > 0) {
+ current = current->right;
+ } else {
+ break;
+ }
+ }
+
+ return(current != tree->nil ? current : NULL);
+}
+
+/****************************************************************//**
+Delete a node from the red black tree, identified by key.
+@return TRUE if success FALSE if not found */
+UNIV_INTERN
+ibool
+rbt_delete(
+/*=======*/
+ ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key) /*!< in: key to delete */
+{
+ ibool deleted = FALSE;
+ ib_rbt_node_t* node = (ib_rbt_node_t*) rbt_lookup(tree, key);
+
+ if (node) {
+ rbt_remove_node_and_rebalance(tree, node);
+
+ ut_free(node);
+ deleted = TRUE;
+ }
+
+ return(deleted);
+}
+
+/****************************************************************//**
+Remove a node from the rb tree, the node is not free'd, that is the
+callers responsibility.
+@return deleted node but without the const */
+UNIV_INTERN
+ib_rbt_node_t*
+rbt_remove_node(
+/*============*/
+ ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* const_node) /*!< in: node to delete, this
+ is a fudge and declared const
+ because the caller can access
+ only const nodes */
+{
+ /* Cast away the const. */
+ rbt_remove_node_and_rebalance(tree, (ib_rbt_node_t*) const_node);
+
+ /* This is to make it easier to do something like this:
+ ut_free(rbt_remove_node(node));
+ */
+
+ return((ib_rbt_node_t*) const_node);
+}
+
+/****************************************************************//**
+Find the node that has the lowest key that is >= key.
+@return node satisfying the lower bound constraint or NULL */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_lower_bound(
+/*============*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key) /*!< in: key to search */
+{
+ ib_rbt_node_t* lb_node = NULL;
+ ib_rbt_node_t* current = ROOT(tree);
+
+ while (current != tree->nil) {
+ int result = tree->compare(key, current->value);
+
+ if (result > 0) {
+
+ current = current->right;
+
+ } else if (result < 0) {
+
+ lb_node = current;
+ current = current->left;
+
+ } else {
+ lb_node = current;
+ break;
+ }
+ }
+
+ return(lb_node);
+}
+
+/****************************************************************//**
+Find the node that has the greatest key that is <= key.
+@return node satisfying the upper bound constraint or NULL */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_upper_bound(
+/*============*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const void* key) /*!< in: key to search */
+{
+ ib_rbt_node_t* ub_node = NULL;
+ ib_rbt_node_t* current = ROOT(tree);
+
+ while (current != tree->nil) {
+ int result = tree->compare(key, current->value);
+
+ if (result > 0) {
+
+ ub_node = current;
+ current = current->right;
+
+ } else if (result < 0) {
+
+ current = current->left;
+
+ } else {
+ ub_node = current;
+ break;
+ }
+ }
+
+ return(ub_node);
+}
+
+/****************************************************************//**
+Find the node that has the greatest key that is <= key.
+@return value of result */
+UNIV_INTERN
+int
+rbt_search(
+/*=======*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: search bounds */
+ const void* key) /*!< in: key to search */
+{
+ ib_rbt_node_t* current = ROOT(tree);
+
+ /* Every thing is greater than the NULL root. */
+ parent->result = 1;
+ parent->last = NULL;
+
+ while (current != tree->nil) {
+
+ parent->last = current;
+ parent->result = tree->compare(key, current->value);
+
+ if (parent->result > 0) {
+ current = current->right;
+ } else if (parent->result < 0) {
+ current = current->left;
+ } else {
+ break;
+ }
+ }
+
+ return(parent->result);
+}
+
+/****************************************************************//**
+Find the node that has the greatest key that is <= key. But use the
+supplied comparison function.
+@return value of result */
+UNIV_INTERN
+int
+rbt_search_cmp(
+/*===========*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ ib_rbt_bound_t* parent, /*!< in: search bounds */
+ const void* key, /*!< in: key to search */
+ ib_rbt_compare compare) /*!< in: fn to compare items */
+{
+ ib_rbt_node_t* current = ROOT(tree);
+
+ /* Every thing is greater than the NULL root. */
+ parent->result = 1;
+ parent->last = NULL;
+
+ while (current != tree->nil) {
+
+ parent->last = current;
+ parent->result = compare(key, current->value);
+
+ if (parent->result > 0) {
+ current = current->right;
+ } else if (parent->result < 0) {
+ current = current->left;
+ } else {
+ break;
+ }
+ }
+
+ return(parent->result);
+}
+
+/****************************************************************//**
+Get the leftmost node.
+Return the left most node in the tree. */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_first(
+/*======*/
+ const ib_rbt_t* tree) /* in: rb tree */
+{
+ ib_rbt_node_t* first = NULL;
+ ib_rbt_node_t* current = ROOT(tree);
+
+ while (current != tree->nil) {
+ first = current;
+ current = current->left;
+ }
+
+ return(first);
+}
+
+/****************************************************************//**
+Return the right most node in the tree.
+@return the rightmost node or NULL */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_last(
+/*=====*/
+ const ib_rbt_t* tree) /*!< in: rb tree */
+{
+ ib_rbt_node_t* last = NULL;
+ ib_rbt_node_t* current = ROOT(tree);
+
+ while (current != tree->nil) {
+ last = current;
+ current = current->right;
+ }
+
+ return(last);
+}
+
+/****************************************************************//**
+Return the next node.
+@return node next from current */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_next(
+/*=====*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* current)/*!< in: current node */
+{
+ return(current ? rbt_find_successor(tree, current) : NULL);
+}
+
+/****************************************************************//**
+Return the previous node.
+@return node prev from current */
+UNIV_INTERN
+const ib_rbt_node_t*
+rbt_prev(
+/*=====*/
+ const ib_rbt_t* tree, /*!< in: rb tree */
+ const ib_rbt_node_t* current)/*!< in: current node */
+{
+ return(current ? rbt_find_predecessor(tree, current) : NULL);
+}
+
+/****************************************************************//**
+Reset the tree. Delete all the nodes. */
+UNIV_INTERN
+void
+rbt_clear(
+/*======*/
+ ib_rbt_t* tree) /*!< in: rb tree */
+{
+ rbt_free_node(ROOT(tree), tree->nil);
+
+ tree->n_nodes = 0;
+ tree->root->left = tree->root->right = tree->nil;
+}
+
+/****************************************************************//**
+Merge the node from dst into src. Return the number of nodes merged.
+@return no. of recs merged */
+UNIV_INTERN
+ulint
+rbt_merge_uniq(
+/*===========*/
+ ib_rbt_t* dst, /*!< in: dst rb tree */
+ const ib_rbt_t* src) /*!< in: src rb tree */
+{
+ ib_rbt_bound_t parent;
+ ulint n_merged = 0;
+ const ib_rbt_node_t* src_node = rbt_first(src);
+
+ if (rbt_empty(src) || dst == src) {
+ return(0);
+ }
+
+ for (/* No op */; src_node; src_node = rbt_next(src, src_node)) {
+
+ if (rbt_search(dst, &parent, src_node->value) != 0) {
+ rbt_add_node(dst, &parent, src_node->value);
+ ++n_merged;
+ }
+ }
+
+ return(n_merged);
+}
+
+/****************************************************************//**
+Merge the node from dst into src. Return the number of nodes merged.
+Delete the nodes from src after copying node to dst. As a side effect
+the duplicates will be left untouched in the src.
+@return no. of recs merged */
+UNIV_INTERN
+ulint
+rbt_merge_uniq_destructive(
+/*=======================*/
+ ib_rbt_t* dst, /*!< in: dst rb tree */
+ ib_rbt_t* src) /*!< in: src rb tree */
+{
+ ib_rbt_bound_t parent;
+ ib_rbt_node_t* src_node;
+ ulint old_size = rbt_size(dst);
+
+ if (rbt_empty(src) || dst == src) {
+ return(0);
+ }
+
+ for (src_node = (ib_rbt_node_t*) rbt_first(src); src_node; /* */) {
+ ib_rbt_node_t* prev = src_node;
+
+ src_node = (ib_rbt_node_t*)rbt_next(src, prev);
+
+ /* Skip duplicates. */
+ if (rbt_search(dst, &parent, prev->value) != 0) {
+
+ /* Remove and reset the node but preserve
+ the node (data) value. */
+ rbt_remove_node_and_rebalance(src, prev);
+
+ /* The nil should be taken from the dst tree. */
+ prev->parent = prev->left = prev->right = dst->nil;
+ rbt_tree_add_child(dst, &parent, prev);
+ rbt_balance_tree(dst, prev);
+
+ ++dst->n_nodes;
+ }
+ }
+
+#if defined(IB_RBT_TESTING)
+ ut_a(rbt_validate(dst));
+ ut_a(rbt_validate(src));
+#endif
+ return(rbt_size(dst) - old_size);
+}
+
+/****************************************************************//**
+Check that every path from the root to the leaves has the same count and
+the tree nodes are in order.
+@return TRUE if OK FALSE otherwise */
+UNIV_INTERN
+ibool
+rbt_validate(
+/*=========*/
+ const ib_rbt_t* tree) /*!< in: RB tree to validate */
+{
+ if (rbt_count_black_nodes(tree, ROOT(tree)) > 0) {
+ return(rbt_check_ordering(tree));
+ }
+
+ return(FALSE);
+}
+
+/****************************************************************//**
+Iterate over the tree in depth first order. */
+UNIV_INTERN
+void
+rbt_print(
+/*======*/
+ const ib_rbt_t* tree, /*!< in: tree to traverse */
+ ib_rbt_print_node print) /*!< in: print function */
+{
+ rbt_print_subtree(tree, ROOT(tree), print);
+}
diff --git a/strings/decimal.c b/strings/decimal.c
index 184f78a20b7..631750cf219 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -971,7 +971,7 @@ int decimal2double(decimal_t *from, double *to)
*to= from->sign ? -result : result;
- DBUG_PRINT("info", ("result: %f (%lx)", *to, *(ulong *)to));
+ DBUG_PRINT("info", ("result: %f", *to));
return E_DEC_OK;
}
diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp
index c8d2926145d..7651ae5aee4 100644
--- a/support-files/compiler_warnings.supp
+++ b/support-files/compiler_warnings.supp
@@ -70,6 +70,7 @@ term\.c : .*
#
.*/extra/libevent/.* : .*unused parameter.*
.*/extra/libevent/select\.c : .*comparison between signed and unsigned.* : 270-280
+signal\.c : .*unused parameter.*
#
# Ignore warnings from system libraries
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index bb8178dbcea..63ae93a313b 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -1,4 +1,5 @@
-# Copyright (C) 2000-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
+# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010 Monty Program 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
@@ -640,6 +641,7 @@ touch $RBR%{_sysconfdir}/mysqlmanager.passwd
##############################################################################
%pre server
+mysql_datadir=%{mysqldatadir}
# Check if we can safely upgrade. An upgrade is only safe if it's from one
# of our RPMs in the same version family.
@@ -708,7 +710,74 @@ HERE
fi
fi
+# We assume that if there is exactly one ".pid" file,
+# it contains the valid PID of a running MySQL server.
+NR_PID_FILES=`ls $mysql_datadir/*.pid 2>/dev/null | wc -l`
+case $NR_PID_FILES in
+ 0 ) SERVER_TO_START='' ;; # No "*.pid" file == no running server
+ 1 ) SERVER_TO_START='true' ;;
+ * ) SERVER_TO_START='' # Situation not clear
+ SEVERAL_PID_FILES=true ;;
+esac
+# That logic may be debated: We might check whether it is non-empty,
+# contains exactly one number (possibly a PID), and whether "ps" finds it.
+# OTOH, if there is no such process, it means a crash without a cleanup -
+# is that a reason not to start a new server after upgrade?
+
+STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER
+
+if [ -f $STATUS_FILE ]; then
+ echo "Some previous upgrade was not finished:"
+ ls -ld $STATUS_FILE
+ echo "Please check its status, then do"
+ echo " rm $STATUS_FILE"
+ echo "before repeating the MySQL upgrade."
+ exit 1
+elif [ -n "$SEVERAL_PID_FILES" ] ; then
+ echo "Your MySQL directory '$mysql_datadir' has more than one PID file:"
+ ls -ld $mysql_datadir/*.pid
+ echo "Please check which one (if any) corresponds to a running server"
+ echo "and delete all others before repeating the MySQL upgrade."
+ exit 1
+fi
+
+NEW_VERSION=%{mysql_version}-%{release}
+
+# The "pre" section code is also run on a first installation,
+# when there is no data directory yet. Protect against error messages.
+if [ -d $mysql_datadir ] ; then
+ echo "MySQL RPM upgrade to version $NEW_VERSION" > $STATUS_FILE
+ echo "'pre' step running at `date`" >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "ERR file(s):" >> $STATUS_FILE
+ ls -ltr $mysql_datadir/*.err >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "Latest 'Version' line in latest file:" >> $STATUS_FILE
+ grep '^Version' `ls -tr $mysql_datadir/*.err | tail -1` | \
+ tail -1 >> $STATUS_FILE
+ echo >> $STATUS_FILE
+
+ if [ -n "$SERVER_TO_START" ] ; then
+ # There is only one PID file, race possibility ignored
+ echo "PID file:" >> $STATUS_FILE
+ ls -l $mysql_datadir/*.pid >> $STATUS_FILE
+ cat $mysql_datadir/*.pid >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "Server process:" >> $STATUS_FILE
+ ps -fp `cat $mysql_datadir/*.pid` >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "SERVER_TO_START=$SERVER_TO_START" >> $STATUS_FILE
+ else
+ # Take a note we checked it ...
+ echo "PID file:" >> $STATUS_FILE
+ ls -l $mysql_datadir/*.pid >> $STATUS_FILE 2>&1
+ fi
+fi
+
# Shut down a previously installed server first
+# Note we *could* make that depend on $SERVER_TO_START, but we rather don't,
+# so a "stop" is attempted even if there is no PID file.
+# (Maybe the "stop" doesn't work then, but we might fix that in itself.)
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
%{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1
echo "Giving mysqld 5 seconds to exit nicely"
@@ -717,17 +786,33 @@ fi
%post server
mysql_datadir=%{mysqldatadir}
+NEW_VERSION=%{mysql_version}-%{release}
+STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER
# ----------------------------------------------------------------------
-# Create data directory if needed
+# Create data directory if needed, check whether upgrade or install
# ----------------------------------------------------------------------
if [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi
-if [ ! -d $mysql_datadir/mysql ] ; then mkdir $mysql_datadir/mysql; fi
+if [ -f $STATUS_FILE ] ; then
+ SERVER_TO_START=`grep '^SERVER_TO_START=' $STATUS_FILE | cut -c17-`
+else
+ SERVER_TO_START='true' # This is for 5.1 only, to not change behavior
+fi
+# echo "Analyzed: SERVER_TO_START=$SERVER_TO_START"
+if [ ! -d $mysql_datadir/mysql ] ; then
+ mkdir $mysql_datadir/mysql;
+ echo "MySQL RPM installation of version $NEW_VERSION" >> $STATUS_FILE
+else
+ # If the directory exists, we may assume it is an upgrade.
+ echo "MySQL RPM upgrade to version $NEW_VERSION" >> $STATUS_FILE
+fi
if [ ! -d $mysql_datadir/test ] ; then mkdir $mysql_datadir/test; fi
# ----------------------------------------------------------------------
# Make MySQL start/shutdown automatically when the machine does it.
# ----------------------------------------------------------------------
+# NOTE: This still needs to be debated. Should we check whether these links
+# for the other run levels exist(ed) before the upgrade?
# use insserv for older SuSE Linux versions
if [ -x /sbin/insserv ] ; then
/sbin/insserv %{_sysconfdir}/init.d/mysql
@@ -771,18 +856,26 @@ chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
# ----------------------------------------------------------------------
chmod -R og-rw $mysql_datadir/mysql
-# Restart in the same way that mysqld will be started normally.
-%{_sysconfdir}/init.d/mysql start
+# Was the server running before the upgrade? If so, restart the new one.
+if [ "$SERVER_TO_START" = "true" ] ; then
+ # Restart in the same way that mysqld will be started normally.
+ %{_sysconfdir}/init.d/mysql start
-# Allow mysqld_safe to start mysqld and print a message before we exit
-sleep 2
-
-#echo "Thank you for installing the MySQL Community Server! For Production
-#systems, we recommend MySQL Enterprise, which contains enterprise-ready
-#software, intelligent advisory services, and full production support with
-#scheduled service packs and more. Visit www.mysql.com/enterprise for more
-#information."
+ # Allow mysqld_safe to start mysqld and print a message before we exit
+ sleep 2
+fi
+#echo "Thank you for installing the MariaDB Server!"
+#echo "For more information about MariaDB, visit www.mariadb.org."
+
+# Collect an upgrade history ...
+echo "Upgrade/install finished at `date`" >> $STATUS_FILE
+echo >> $STATUS_FILE
+echo "=====" >> $STATUS_FILE
+STATUS_HISTORY=$mysql_datadir/RPM_UPGRADE_HISTORY
+cat $STATUS_FILE >> $STATUS_HISTORY
+rm $STATUS_FILE
+
%if %{CLUSTER_BUILD}
%post ndb-storage
mysql_clusterdir=/var/lib/mysql-cluster
@@ -1068,6 +1161,17 @@ fi
# merging BK trees)
##############################################################################
%changelog
+
+* Tue Jun 15 2010 Joerg Bruehe <joerg.bruehe@sun.com>
+
+- Change the behaviour on upgrade:
+ *Iff* the server was stopped before the upgrade is started, this is taken as a
+ sign the administrator is handling that manually, and so the new server will
+ not be started automatically at the end of the upgrade.
+ The start/stop scripts will still be installed, so the server will be started
+ on the next machine boot.
+ This is the 5.1 version of fixing bug#27072 (RPM autostarting the server).
+
* Mon Mar 01 2010 Joerg Bruehe <joerg.bruehe@sun.com>
- Set "Oracle and/or its affiliates" as the vendor and copyright owner,
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 0be541f7caa..47ab569b725 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -18137,6 +18137,181 @@ static void test_bug53371()
}
+static void test_bug53907()
+{
+ int rc;
+ char buf[] = "\x4test\x14../client_test_db/t1";
+
+ myheader("test_bug53907");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+ rc= mysql_query(mysql, "DROP DATABASE IF EXISTS bug53907");
+ myquery(rc);
+ rc= mysql_query(mysql, "DROP USER 'testbug'@localhost");
+
+ rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)");
+ myquery(rc);
+ rc= mysql_query(mysql, "CREATE DATABASE bug53907");
+ myquery(rc);
+ rc= mysql_query(mysql, "GRANT SELECT ON bug53907.* to 'testbug'@localhost");
+ myquery(rc);
+
+ rc= mysql_change_user(mysql, "testbug", NULL, "bug53907");
+ myquery(rc);
+
+ rc= simple_command(mysql, COM_TABLE_DUMP, (uchar*) buf, sizeof(buf), 0);
+ fprintf(stderr, ">>>>>>>>> %d\n", mysql_errno(mysql));
+ DIE_UNLESS(mysql_errno(mysql) == 1103); /* ER_WRONG_TABLE_NAME */
+
+ rc= mysql_change_user(mysql, opt_user, opt_password, current_db);
+ myquery(rc);
+ rc= mysql_query(mysql, "DROP TABLE t1");
+ myquery(rc);
+ rc= mysql_query(mysql, "DROP DATABASE bug53907");
+ myquery(rc);
+ rc= mysql_query(mysql, "DROP USER 'testbug'@localhost");
+ myquery(rc);
+}
+
+
+/**
+ Bug#42373: libmysql can mess a connection at connect
+*/
+static void test_bug42373()
+{
+ int rc;
+ MYSQL con;
+ MYSQL_STMT *stmt;
+
+ DBUG_ENTER("test_bug42373");
+ myheader("test_42373");
+
+ rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "CREATE PROCEDURE p1()"
+ " BEGIN"
+ " SELECT 1;"
+ " INSERT INTO t1 VALUES (2);"
+ "END;");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)");
+ myquery(rc);
+
+ /* Try with a stored procedure. */
+ DIE_UNLESS(mysql_client_init(&con));
+
+ mysql_options(&con, MYSQL_INIT_COMMAND, "CALL p1()");
+
+ DIE_UNLESS(mysql_real_connect(&con, opt_host, opt_user, opt_password,
+ current_db, opt_port, opt_unix_socket,
+ CLIENT_MULTI_STATEMENTS|CLIENT_MULTI_RESULTS));
+
+ stmt= mysql_simple_prepare(&con, "SELECT a FROM t1");
+ check_stmt(stmt);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ rc= my_process_stmt_result(stmt);
+ DIE_UNLESS(rc == 1);
+
+ mysql_stmt_close(stmt);
+
+ /* Now try with a multi-statement. */
+ DIE_UNLESS(mysql_client_init(&con));
+
+ mysql_options(&con, MYSQL_INIT_COMMAND,
+ "SELECT 3; INSERT INTO t1 VALUES (4)");
+
+ DIE_UNLESS(mysql_real_connect(&con, opt_host, opt_user, opt_password,
+ current_db, opt_port, opt_unix_socket,
+ CLIENT_MULTI_STATEMENTS|CLIENT_MULTI_RESULTS));
+
+ stmt= mysql_simple_prepare(&con, "SELECT a FROM t1");
+ check_stmt(stmt);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ rc= my_process_stmt_result(stmt);
+ DIE_UNLESS(rc == 2);
+
+ mysql_stmt_close(stmt);
+ mysql_close(&con);
+
+ rc= mysql_query(mysql, "DROP TABLE t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "DROP PROCEDURE p1");
+ myquery(rc);
+
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run
+*/
+
+static void test_bug54041()
+{
+ int rc;
+ MYSQL_STMT *stmt;
+ MYSQL_BIND bind;
+
+ DBUG_ENTER("test_bug54041");
+ myheader("test_bug54041");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)");
+ myquery(rc);
+
+ stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 (a) VALUES (?)");
+ check_stmt(stmt);
+ verify_param_count(stmt, 1);
+
+ memset(&bind, 0, sizeof(bind));
+
+ /* Any type that does not support long data handling. */
+ bind.buffer_type= MYSQL_TYPE_LONG;
+
+ rc= mysql_stmt_bind_param(stmt, &bind);
+ check_execute(stmt, rc);
+
+ /*
+ Trick the client API into sending a long data packet for
+ the parameter. Long data is only supported for string and
+ binary types.
+ */
+ stmt->params[0].buffer_type= MYSQL_TYPE_STRING;
+
+ rc= mysql_stmt_send_long_data(stmt, 0, "data", 5);
+ check_execute(stmt, rc);
+
+ /* Undo API violation. */
+ stmt->params[0].buffer_type= MYSQL_TYPE_LONG;
+
+ rc= mysql_stmt_execute(stmt);
+ /* Incorrect arguments. */
+ check_execute_r(stmt, rc);
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+
+ DBUG_VOID_RETURN;
+}
+
+
/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -18146,17 +18321,17 @@ static char **defaults_argv;
static struct my_option client_test_long_options[] =
{
- {"basedir", 'b', "Basedir for tests.", (uchar**) &opt_basedir,
- (uchar**) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"count", 't', "Number of times test to be executed", (uchar **) &opt_count,
- (uchar **) &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
- {"database", 'D', "Database to use", (uchar **) &opt_db, (uchar **) &opt_db,
+ {"basedir", 'b', "Basedir for tests.", &opt_basedir,
+ &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"count", 't', "Number of times test to be executed", &opt_count,
+ &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
+ {"database", 'D', "Database to use", &opt_db, &opt_db,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
- (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", &default_dbug_option,
+ &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host", (uchar **) &opt_host, (uchar **) &opt_host,
+ {"host", 'h', "Connect to host", &opt_host, &opt_host,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
@@ -18167,8 +18342,7 @@ static struct my_option client_test_long_options[] =
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
- (uchar **) &opt_port,
- (uchar **) &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ &opt_port, &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-arg", 'A', "Send embedded server this as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"show-tests", 'T', "Show all tests' names", 0, 0, 0, GET_NO_ARG, NO_ARG,
@@ -18177,23 +18351,23 @@ static struct my_option client_test_long_options[] =
0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", 'm', "Base name of shared memory.",
- (uchar**) &shared_memory_base_name, (uchar**)&shared_memory_base_name, 0,
+ &shared_memory_base_name, (uchar**)&shared_memory_base_name, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"socket", 'S', "Socket file to use for connection",
- (uchar **) &opt_unix_socket, (uchar **) &opt_unix_socket, 0, GET_STR,
+ &opt_unix_socket, &opt_unix_socket, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"testcase", 'c',
"May disable some code when runs as mysql-test-run testcase.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user", (uchar **) &opt_user,
- (uchar **) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"user", 'u', "User for login if not current user", &opt_user,
+ &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"vardir", 'v', "Data dir for tests.", (uchar**) &opt_vardir,
- (uchar**) &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"vardir", 'v', "Data dir for tests.", &opt_vardir,
+ &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"getopt-ll-test", 'g', "Option for testing bug in getopt library",
- (uchar **) &opt_getopt_ll_test, (uchar **) &opt_getopt_ll_test, 0,
+ &opt_getopt_ll_test, &opt_getopt_ll_test, 0,
GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -18447,6 +18621,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug20023", test_bug20023 },
{ "test_bug45010", test_bug45010 },
{ "test_bug53371", test_bug53371 },
+ { "test_bug53907", test_bug53907 },
{ "test_bug31418", test_bug31418 },
{ "test_bug31669", test_bug31669 },
{ "test_bug28386", test_bug28386 },
@@ -18458,6 +18633,8 @@ static struct my_tests_st my_tests[]= {
{ "test_bug36326", test_bug36326 },
{ "test_bug41078", test_bug41078 },
{ "test_bug44495", test_bug44495 },
+ { "test_bug42373", test_bug42373 },
+ { "test_bug54041", test_bug54041 },
{ 0, 0 }
};
diff --git a/unittest/examples/Makefile.am b/unittest/examples/Makefile.am
index 94032c00928..a1627a58b4e 100644
--- a/unittest/examples/Makefile.am
+++ b/unittest/examples/Makefile.am
@@ -20,7 +20,8 @@ AM_LDFLAGS = -L$(top_builddir)/unittest/mytap
LDADD = -lmytap
-noinst_PROGRAMS = simple-t skip-t todo-t skip_all-t no_plan-t core-t
+# We omit core-t here, since it will always fail.
+noinst_PROGRAMS = simple-t skip-t todo-t skip_all-t no_plan-t
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/unittest/examples/no_plan-t.c b/unittest/examples/no_plan-t.c
index 56aabd6d752..f22340ae0d1 100644
--- a/unittest/examples/no_plan-t.c
+++ b/unittest/examples/no_plan-t.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
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
@@ -20,14 +20,19 @@
/*
Sometimes, the number of tests is not known beforehand. In those
- cases, the plan can be omitted and will instead be written at the
- end of the test (inside exit_status()).
+ cases, you should invoke plan(NO_PLAN).
+ The plan will be printed at the end of the test (inside exit_status()).
Use this sparingly, it is a last resort: planning how many tests you
are going to run will help you catch that offending case when some
tests are skipped for an unknown reason.
*/
int main() {
+ /*
+ We recommend calling plan(NO_PLAN), but want to verify that
+ omitting the call works as well.
+ plan(NO_PLAN);
+ */
ok(1, " ");
ok(1, " ");
ok(1, " ");
diff --git a/unittest/mytap/tap.c b/unittest/mytap/tap.c
index a7552b15eed..2f1747d7167 100644
--- a/unittest/mytap/tap.c
+++ b/unittest/mytap/tap.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
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
@@ -50,7 +50,7 @@
@ingroup MyTAP_Internal
*/
-static TEST_DATA g_test = { 0, 0, 0, "" };
+static TEST_DATA g_test = { NO_PLAN, 0, 0, "" };
/**
Output stream for test report message.
@@ -84,6 +84,7 @@ vemit_tap(int pass, char const *fmt, va_list ap)
(fmt && *fmt) ? " - " : "");
if (fmt && *fmt)
vfprintf(tapout, fmt, ap);
+ fflush(tapout);
}
@@ -106,6 +107,7 @@ static void
emit_dir(const char *dir, const char *why)
{
fprintf(tapout, " # %s %s", dir, why);
+ fflush(tapout);
}
@@ -118,6 +120,7 @@ static void
emit_endl()
{
fprintf(tapout, "\n");
+ fflush(tapout);
}
static void
@@ -204,7 +207,10 @@ plan(int count)
break;
default:
if (count > 0)
+ {
fprintf(tapout, "1..%d\n", count);
+ fflush(tapout);
+ }
break;
}
}
@@ -217,6 +223,7 @@ skip_all(char const *reason, ...)
va_start(ap, reason);
fprintf(tapout, "1..0 # skip ");
vfprintf(tapout, reason, ap);
+ fflush(tapout);
va_end(ap);
exit(0);
}
diff --git a/unittest/mytap/tap.h b/unittest/mytap/tap.h
index f92fad1101f..206a939e43b 100644
--- a/unittest/mytap/tap.h
+++ b/unittest/mytap/tap.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
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
@@ -90,10 +90,9 @@ extern int skip_big_tests;
/**
Set number of tests that is planned to execute.
- The function also accepts the predefined constant
- <code>NO_PLAN</code>. If the function is not called, it is as if
- it was called with <code>NO_PLAN</code>, i.e., the test plan will
- be printed after all the test lines.
+ The function also accepts the predefined constant <code>NO_PLAN</code>.
+ If invoked with this constant -- or not invoked at all --
+ the test plan will be printed after all the test lines.
The plan() function will install signal handlers for all signals
that generate a core, so if you want to override these signals, do
@@ -107,7 +106,7 @@ extern int skip_big_tests;
@param count The planned number of tests to run.
*/
-void plan(int count);
+void plan(int const count);
/**
@@ -126,7 +125,7 @@ void plan(int count);
which case nothing is printed.
*/
-void ok(int pass, char const *fmt, ...)
+void ok(int const pass, char const *fmt, ...)
__attribute__((format(printf,2,3)));